5 leg->SetTextSize(0.04);
7 leg->SetY1(leg->GetY2()-leg->GetNRows()*0.05);
15 TLatex *
l =
new TLatex(x,y,text);
18 l->SetTextColor(kBlack);
27 TString lasttime =
TString::Format(
"Last updated on: %s", tnow.AsString());
28 TLatex *ltx =
MiscText(0.6,0.96,0.03,lasttime);
35 int GMToffset = (t.Convert(
true) - t.Convert());
36 gSystem->Setenv(
"TZ",
"UTC");
37 TString stdP1 =
"run>11495&&par==1";
39 int maxt = t.Convert();
40 int mint = TDatime(20130729,0).Convert();
46 if(ptype==0) dt *= 30;
48 TString tsel =
TString::Format(
"&& lastsec > %d && lastsec < %d",maxt - dt + 2*GMToffset, maxt + 2*GMToffset);
52 TString tlab =
"Date (dd/mm/yy - Central Time)";
53 TString tform =
"%d/%m/%y";
54 TString suf =
"Month";
60 tlab =
"Date (dd/mm - Central Time)";
70 tlab =
"Central Time (hour:min)";
84 gStyle->SetTimeOffset(0);
86 if(sel==
"") sel =
"1";
88 if(title==
"") title = metricstr;
90 TString selpre =
"((" + sel +
") && preliminary)";
92 TChain *
mytree =
new TChain(
"mytree");
93 mytree->Add(filenames);
98 bool gotRunLimits = run_highlimit != run_lowlimit;
102 mytree->Draw(
"firstsec",
104 , run_lowlimit, run_highlimit, mint));
105 xmin = mytree->GetHistogram()->GetXaxis()->GetXmin();
107 mytree->Draw(
"lastsec",
109 , run_lowlimit, run_highlimit, mint));
110 xmax = mytree->GetHistogram()->GetXaxis()->GetXmax();
112 TString stdP1 =
"run>11495&&par==1";
114 "&& run>=%d && run<=%d",run_lowlimit, run_highlimit);
115 selpre =
"((" + sel +
") && preliminary)";
117 suf =
"CustomRunRange";
119 runlabel =
TString::Format(
"%d < Run < %d",run_lowlimit, run_highlimit);
123 TCanvas *
c1 =
new TCanvas(
"c1",
"c1",1000,600);
124 c1->SetBottomMargin(0.12);
125 c1->SetLeftMargin(0.12);
126 c1->SetRightMargin(0.07);
127 c1->SetTopMargin(0.07);
129 TLegend *
leg =
new TLegend(0.15,0.65,0.65,0.9);
131 TLegend *legpre =
new TLegend(0.16,0.50,0.93,0.68);
134 mytree->Draw(metricstr,sel);
135 hAll = (TH1F*)(mytree->GetHistogram())->
Clone(
"");
137 if(xmin == -9999 || xmax == -9999){
139 xmin = hAll->GetXaxis()->GetXmin();
140 xmax = hAll->GetXaxis()->GetXmax();
150 if(
int(xmax-xmin)%nbins!=0){
152 xmax += (nbins -
int(xmax-xmin)%
nbins)/2;
153 xmin -= (nbins -
int(xmax-xmin)%
nbins);
157 nbins = (xmax -
xmin) / nbins;
164 hAll =
new TH1F(
"hAll",
"hAll",nbins,xmin,xmax);
165 mytree->Draw(metricstr+
">>hAll",sel,
"hist");
167 hAll->SetLineColor(1);
168 hAll->SetLineWidth(2);
169 hAll->SetTitle(
";"+title+
";Percentage of Subruns");
170 hAll->GetXaxis()->SetTitleOffset(1);
171 hAll->GetYaxis()->SetTitleOffset(1);
172 hAll->GetXaxis()->CenterTitle();
173 hAll->GetYaxis()->CenterTitle();
175 mytree->Draw(metricstr,
"!(pass_all && ngoodcdb==14 && !preliminary) && "+sel,
"hist same");
176 TH1F* h0 = (TH1F*)(mytree->GetHistogram())->
Clone(
"h0");
179 h0->SetFillColor(
kRed-4);
181 mytree->Draw(metricstr,
"!(pass_all && !preliminary) && "+sel,
"hist same");
182 TH1F*
h1 = (TH1F*)(mytree->GetHistogram())->
Clone(
"h1");
187 mytree->Draw(metricstr,
"!(pass_time && pass_runlen && pass_hits && pass_db && pass_empty && !preliminary) && "+sel,
"hist same");
188 TH1F* h2r = (TH1F*)(mytree->GetHistogram())->
Clone(
"h2r");
189 h2r->SetLineColor(1);
190 h2r->SetLineWidth(2);
191 h2r->SetFillColor(
kGreen+1);
193 mytree->Draw(metricstr,
"!(pass_time && pass_runlen && pass_hits && pass_empty && !preliminary) && "+sel,
"hist same");
194 TH1F*
h2 = (TH1F*)(mytree->GetHistogram())->
Clone(
"h2");
199 mytree->Draw(metricstr,
"!(pass_time && pass_runlen && pass_empty && !preliminary) && "+sel,
"hist same");
200 TH1F*
h3 = (TH1F*)(mytree->GetHistogram())->
Clone(
"h3");
203 h3->SetFillColor(kMagenta+2);
205 mytree->Draw(metricstr,
"!(pass_time && pass_empty && !preliminary) && "+sel,
"hist same");
206 TH1F* h4 = (TH1F*)(mytree->GetHistogram())->
Clone(
"h4");
209 h4->SetFillColor(kBlack);
211 mytree->Draw(metricstr,selpre,
"hist same");
212 TH1F* hGp = (TH1F*)(mytree->GetHistogram())->
Clone(
"hGp");
213 hGp->SetLineColor(1);
214 hGp->SetLineWidth(2);
215 hGp->SetFillColor(18);
217 mytree->Draw(metricstr,
"!(pass_all && ngoodcdb==14) && "+selpre,
"hist same");
218 TH1F* h0p = (TH1F*)(mytree->GetHistogram())->
Clone(
"h0p");
219 h0p->SetLineColor(1);
220 h0p->SetLineWidth(2);
221 h0p->SetFillColor(kPink-4);
223 mytree->Draw(metricstr,
"!pass_all && "+selpre,
"hist same");
224 TH1F* h1p = (TH1F*)(mytree->GetHistogram())->
Clone(
"h1p");
225 h1p->SetLineColor(1);
226 h1p->SetLineWidth(2);
229 mytree->Draw(metricstr,
"!(pass_time && pass_runlen && pass_hits && pass_db && pass_empty) && "+selpre,
"hist same");
230 TH1F* h2rp = (TH1F*)(mytree->GetHistogram())->
Clone(
"h2rp");
231 h2rp->SetLineColor(1);
232 h2rp->SetLineWidth(2);
233 h2rp->SetFillColor(
kGreen-9);
235 mytree->Draw(metricstr,
"!(pass_time && pass_runlen && pass_hits && pass_empty) && "+selpre,
"hist same");
236 TH1F* h2p = (TH1F*)(mytree->GetHistogram())->
Clone(
"h2p");
237 h2p->SetLineColor(1);
238 h2p->SetLineWidth(2);
239 h2p->SetFillColor(
kBlue-9);
241 mytree->Draw(metricstr,
"!(pass_time && pass_runlen && pass_empty) && "+selpre,
"hist same");
242 TH1F* h3p = (TH1F*)(mytree->GetHistogram())->
Clone(
"h3p");
243 h3p->SetLineColor(1);
244 h3p->SetLineWidth(2);
245 h3p->SetFillColor(kMagenta-7);
247 mytree->Draw(metricstr,
"!(pass_time && pass_empty) && "+selpre,
"hist same");
248 TH1F* h4p = (TH1F*)(mytree->GetHistogram())->
Clone(
"h4p");
249 h4p->SetLineColor(1);
250 h4p->SetLineWidth(2);
251 h4p->SetFillColor(kGray+2);
270 leg->AddEntry(hAll,
"Good Subruns",
"f");
271 leg->AddEntry(h0,
"Partial Detector",
"f");
272 leg->AddEntry(h1,
"Failed Reco",
"f");
273 leg->AddEntry(h2r,
"Failed Diblock",
"f");
274 leg->AddEntry(h2,
"Failed Hit Rate",
"f");
275 leg->AddEntry(h3,
"Failed Live Time",
"f");
276 leg->AddEntry(h4,
"Failed Other",
"f");
278 legpre->AddEntry(hGp,
" ",
"f");
279 legpre->AddEntry(h0p,
" ",
"f");
280 legpre->AddEntry(h1p,
" ",
"f");
281 legpre->AddEntry(h2rp,
" ",
"f");
282 legpre->AddEntry(h2p,
" ",
"f");
283 legpre->AddEntry(h3p,
" ",
"f");
284 legpre->AddEntry(h4p,
" ",
"f");
286 hAll->GetYaxis()->SetRangeUser(0,250);
294 gStyle->SetPaintTextFormat(
"2.1f%%");
296 h0->SetMarkerSize(2);
298 h0->Draw(
"hist text same");
299 h1->Draw(
"hist same");
300 h2r->Draw(
"hist same");
301 h2->Draw(
"hist same");
302 h3->Draw(
"hist same");
303 h4->Draw(
"hist same");
304 hGp->Draw(
"hist same");
305 h0p->Draw(
"hist same");
306 h1p->Draw(
"hist same");
307 h2rp->Draw(
"hist same");
308 h2p->Draw(
"hist same");
309 h3p->Draw(
"hist same");
310 h4p->Draw(
"hist same");
313 leg->SetY1(0.9-leg->GetNRows()*0.05);
315 legpre->SetNColumns(7);
318 legpre->SetColumnSeparation(-4.3);
322 MiscText(0.15,0.94,0.055,
"Far Detector");
323 double eff = 100.0*mytree->GetEntries(sel+
" && pass_all")/mytree->GetEntries(sel);
325 MiscText(0.675,0.850,0.055,effstr.Data());
326 MiscText(0.380,0.638,0.055,
"Preliminary");
327 hAll->GetXaxis()->SetTimeFormat(tform);
328 hAll->GetXaxis()->SetTimeDisplay(1);
329 hAll->GetXaxis()->SetNdivisions(tdiv);
330 hAll->SetStats(kFALSE);
333 if(gotRunLimits)
MiscText(0.7,0.96,0.04,runlabel);
336 c1->SaveAs(
"pngfiles/FarDet-t02-P1GoodDataSelDateEff"+suf+
".png");
std::map< std::string, double > xmax
void PlotEfficiency(int ptype=0, int run_lowlimit=0, int run_highlimit=0)
void SetLeg(TLegend *leg)
TLatex * MiscText(float x, float y, float size, TString text)
void UpdateStamp(int ptype, int maxt)
fvar< T > floor(const fvar< T > &x)
void Format(TGraph *gr, int lcol, int lsty, int lwid, int mcol, int msty, double msiz)
fvar< T > ceil(const fvar< T > &x)