11 #include "TDirectoryFile.h" 19 gROOT->SetStyle(
"Plain");
30 TLegend
leg(0.1,0.7,0.2,0.9);
33 std::ifstream inmodules(modulelist);
38 if (!inmodules.good())
break;
40 hn=
"ClusterDigiPosition__det__" + detid;
42 TCanvas
c1(
"c1",
"c1",1600,900);
49 std::ifstream fileToCountLines(filelist);
50 std::size_t lines_count =0;
53 while (std::getline(fileToCountLines , line))
56 const float dim=lines_count;
58 std::ifstream filesin(filelist);
63 TH1D* trend=
new TH1D(
"trend",
"trend",
int(dim),0.5,dim+0.5);
64 trend->SetMarkerSize(3);
65 trend->SetMarkerStyle(8);
66 trend->SetMarkerColor(4);
69 trend->SetTitle(ttitle.c_str());
77 THStack *hs =
new THStack(
"hs",
"");
83 if (!filesin.good())
break;
85 std::string runNum= filename.substr(filename.find(
"run_")+4, 6);
88 fin=TFile::Open(filename.c_str());
90 if (!fin) {
std::cout <<
"Cannot open file " << filename.c_str() << std::endl;
94 TH1D* Events=(TH1D*)fin->Get(
"TotEvents");
96 double EvtNum=Events->GetBinContent(1);
98 TH1D*
histo=(TH1D*) fin->Get(hn.c_str());
100 if (!histo) {
std::cout <<
"Cannot open histo " << hn.c_str() << std::endl;
104 histo->SetDirectory(0);
105 histo->SetStats(kFALSE);
107 if (hn.find(
"Summary")==std::string::npos) histo->Scale(1/EvtNum);
109 double numberPerEvent= histo->Integral();
112 if (max<=histo->GetBinContent(histo->GetMaximumBin())) max=histo->GetBinContent(histo->GetMaximumBin());
113 if (min>histo->GetBinContent(histo->GetMinimumBin())) min=histo->GetBinContent(histo->GetMinimumBin());
115 histo->SetLineColor(k+1);
116 histo->SetMarkerStyle(9);
117 histo->SetMarkerColor(k+1);
122 trend->SetBinContent(k+1,numberPerEvent);
123 trend->GetXaxis()->SetBinLabel(k+1,runNum.c_str());
125 leg.AddEntry(histo, runNum.c_str(),
"L");
132 if (min==0) min=1.e-6;
138 hs->SetTitle(hn.c_str());
148 l.DrawLine(128,min,128,max);
149 l.DrawLine(256,min,256,max);
150 l.DrawLine(384,min,384,max);
151 l.DrawLine(384,min,384,max);
152 l.DrawLine(512,min,512,max);
153 l.DrawLine(640,min,640,max);
157 c1.SaveAs(outname.c_str());
162 if (trend->GetMinimum()==0) mintrend=1.
e-4;
163 else mintrend=trend->GetMinimum();
165 trend->SetStats(kFALSE);
167 trend->GetYaxis()->SetRangeUser(mintrend*0.5,trend->GetMaximum()*2);
169 outname=hn+
"_Trend.png";
170 c1.SaveAs(outname.c_str());
int main(int argc, char *argv[])