6 #include "TGraphErrors.h"
12 #include "TPaveText.h"
26 void bsQaShowAdc(
string inFile,
int detId,
int ch,
bool PRINT =
true)
30 TFile *F = TFile::Open(inFile.c_str());
31 if (!F || F->IsZombie()) { cout <<
"Cannot open the file: " <<inFile <<endl;
return; }
34 std::size_t strPos = inFile.find(
".root");
35 string runNoStr = inFile.substr(strPos-8, 8);
36 const int runNo = std::atoi(runNoStr.c_str());
38 TH2F* H2 = (TH2F*)F->Get(Form(
"Adc_d%i", detId));
39 if (!H2) { cout <<
"Cannot open the histogram!" <<endl;
return; }
41 TH1F* H1 = (TH1F*)H2->ProjectionY(
"", ch, ch);
42 H1->SetTitle(Form(
"d%i_ch%i_run%i", detId, ch, runNo));
45 for (
int x=0; x<H1->GetNbinsX(); x++) {
if (H1->GetBinContent(x+1) != 0) xMax = x+1; }
46 H1->GetXaxis()->SetRangeUser(0, xMax + 10);
47 H1->GetXaxis()->SetLabelSize(0.05);
48 H1->GetXaxis()->SetTitleOffset(1.25);
49 H1->GetYaxis()->SetLabelSize(0.05);
51 gStyle->SetOptDate(0);
52 gStyle->SetOptStat(
"emr");
53 TCanvas *c1 =
new TCanvas(
"c1", H1->GetTitle(), 800*1.5, 600*1.5);
56 H1->DrawCopy(
"hist e");
58 H1->GetXaxis()->SetRangeUser(0, 32);
59 H1->DrawCopy(
"hist e");
61 if (PRINT) c1->Print(Form(
"%s.png", c1->GetTitle()));