6 line.DrawLine(x,ymin,x,ymax);
11 arr.DrawArrow(x,ymax,x+dx,ymax,0.01,
"|>");
18 leg->SetBorderSize(0);
19 leg->SetTextSize(0.04);
21 leg->SetY1(leg->GetY2()-leg->GetNRows()*0.05);
30 TLatex *
l =
new TLatex(x,y,text);
33 l->SetTextColor(kBlack);
43 TString lasttime =
TString::Format(
"Last updated on: %s", tnow.AsString());
44 TLatex *ltx =
MiscText(0.6,0.96,0.03,lasttime);
54 strcpy(str,instr.c_str());
60 for(
int i=0;
i<strlen(str);
i++){
64 strStripped[
c] = str[
i];
71 strStripped[
c] =
'\0';
79 int GMToffset = (t.Convert(
true) - t.Convert());
80 gSystem->Setenv(
"TZ",
"UTC");
83 int maxt = t.Convert();
84 int mint = TDatime(20140801,0).Convert();
90 if(ptype==0) dt *= 30;
92 if(ptype==3) dt = maxt - mint;
94 TString tsel =
TString::Format(
"&& lastsec > %d && lastsec < %d",maxt - dt + 2*GMToffset, maxt + 2*GMToffset);
98 TString tlab =
"Date (dd/mm/yy - Central Time)";
99 TString tform =
"%d/%m/%y";
100 TString suf =
"Month";
106 tlab =
"Date (dd/mm - Central Time)";
116 tlab =
"Central Time (hour:min)";
124 tbin = (maxt - mint)/30;
126 tlab =
"Date (dd/mm/yy - Central Time)";
132 TString metricstr =
"emptyspillfract < 0 ? -1 : TMath::Min(100*emptyspillfract,9.99)";
134 TString
title =
"Fraction of Empty Spills (%)";
139 gStyle->SetTimeOffset(0);
140 gStyle->SetOptStat(0);
142 if(sel==
"") sel =
"1";
144 if(title==
"") title = metricstr;
146 TString selpre =
"((" + sel +
") && preliminary)";
148 TChain *
mytree =
new TChain(
"mytree");
149 mytree->Add(filenames);
153 TCanvas *
c1 =
new TCanvas(
"c1",
"c1",1000,600);
154 c1->SetBottomMargin(0.12);
155 c1->SetLeftMargin(0.12);
156 c1->SetRightMargin(0.07);
157 c1->SetTopMargin(0.07);
159 TLegend *
leg =
new TLegend(0.15,0.65,0.65,0.9);
160 TLegend *legpre =
new TLegend(0.67,0.65,0.95,0.9);
161 mytree->Draw(metricstr,sel,
"hist");
163 hAll = (TH1F*)(mytree->GetHistogram())->
Clone(
"");
164 if(xmin == -9999 || xmax == -9999){
166 xmin = hAll->GetXaxis()->GetXmin();
167 xmax = hAll->GetXaxis()->GetXmax();
177 if(
int(xmax-xmin)%nbins!=0){
179 xmax += (nbins -
int(xmax-xmin)%
nbins)/2;
180 xmin -= (nbins -
int(xmax-xmin)%
nbins);
184 nbins = (xmax -
xmin) / nbins;
190 hAll =
new TH1F(
"hAll",
"hAll",nbins,xmin,xmax);
191 mytree->Draw(metricstr+
">>hAll",sel,
"hist");
194 hAll->SetLineColor(1);
195 hAll->SetLineWidth(2);
196 hAll->SetTitle(
";"+title+
";Subruns");
197 hAll->GetXaxis()->SetTitleOffset(1);
198 hAll->GetYaxis()->SetTitleOffset(1);
199 hAll->GetXaxis()->CenterTitle();
200 hAll->GetYaxis()->CenterTitle();
201 hAll->GetXaxis()->SetNdivisions();
202 hAll->GetYaxis()->SetNdivisions();
203 hAll->SetMinimum(0.1);
204 hAll->SetStats(kFALSE);
205 double max = hAll->GetMaximum();
206 hAll->SetMaximum(
pow(10,1.5*(
log10(max)+1)-1));
207 leg->AddEntry(hAll,
"Good Subruns",
"f");
209 mytree->Draw(metricstr,
"!(pass_all && !preliminary) && "+sel,
"hist same");
210 mytree->GetHistogram()->SetLineColor(1);
211 mytree->GetHistogram()->SetLineWidth(2);
212 mytree->GetHistogram()->SetFillColor(
kOrange+7);
213 leg->AddEntry(mytree->GetHistogram(),
"Failed Slice",
"f");
215 mytree->Draw(metricstr,
"!(pass_db && pass_hits && passemptyspill && pass_timingpeak && pass_time && pass_duration && !preliminary) && "+sel,
"hist same");
216 mytree->GetHistogram()->SetLineColor(1);
217 mytree->GetHistogram()->SetLineWidth(2);
218 mytree->GetHistogram()->SetFillColor(
kGreen+1);
219 leg->AddEntry(mytree->GetHistogram(),
"Failed Diblock",
"f");
221 mytree->Draw(metricstr,
"!(pass_hits && passemptyspill && pass_timingpeak && pass_time && pass_duration && !preliminary) && "+sel,
"hist same");
222 mytree->GetHistogram()->SetLineColor(1);
223 mytree->GetHistogram()->SetLineWidth(2);
224 mytree->GetHistogram()->SetFillColor(
kBlue+2);
225 leg->AddEntry(mytree->GetHistogram(),
"Failed Hit Rate",
"f");
227 mytree->Draw(metricstr,
"!(passemptyspill && pass_timingpeak && pass_time && pass_duration && !preliminary) && "+sel,
"hist same");
228 mytree->GetHistogram()->SetLineColor(1);
229 mytree->GetHistogram()->SetLineWidth(2);
230 mytree->GetHistogram()->SetFillColor(
kBlue-9);
231 leg->AddEntry(mytree->GetHistogram(),
"Failed Empty Spill",
"f");
233 mytree->Draw(metricstr,
"!(pass_timingpeak && pass_time && pass_duration && !preliminary) && "+sel,
"hist same");
234 mytree->GetHistogram()->SetLineColor(1);
235 mytree->GetHistogram()->SetLineWidth(2);
237 mytree->GetHistogram()->SetFillColor(
kRed+1);
238 leg->AddEntry(mytree->GetHistogram(),
"Failed Timing Peak",
"f");
240 mytree->Draw(metricstr,
"!(pass_time && pass_duration && !preliminary) && "+sel,
"hist same");
241 mytree->GetHistogram()->SetLineColor(1);
242 mytree->GetHistogram()->SetLineWidth(2);
243 mytree->GetHistogram()->SetFillColor(kMagenta+2);
244 leg->AddEntry(mytree->GetHistogram(),
"Failed NuMI Live Time",
"f");
246 mytree->Draw(metricstr,
"!(pass_time && !preliminary) && "+sel,
"hist same");
247 mytree->GetHistogram()->SetLineColor(1);
248 mytree->GetHistogram()->SetLineWidth(2);
249 mytree->GetHistogram()->SetFillColor(kBlack);
250 leg->AddEntry(mytree->GetHistogram(),
"Failed Timestamp",
"f");
251 mytree->Draw(metricstr,selpre,
"hist same");
252 mytree->GetHistogram()->SetLineColor(1);
253 mytree->GetHistogram()->SetLineWidth(2);
254 mytree->GetHistogram()->SetFillColor(18);
255 legpre->AddEntry(mytree->GetHistogram(),
" ",
"f");
257 mytree->Draw(metricstr,
"!pass_all && "+selpre,
"hist same");
258 mytree->GetHistogram()->SetLineColor(1);
259 mytree->GetHistogram()->SetLineWidth(2);
260 mytree->GetHistogram()->SetFillColor(
kGreen-9);
261 legpre->AddEntry(mytree->GetHistogram(),
" ",
"f");
263 mytree->Draw(metricstr,
"!(pass_time && pass_duration) && "+selpre,
"hist same");
264 mytree->GetHistogram()->SetLineColor(1);
265 mytree->GetHistogram()->SetLineWidth(2);
266 mytree->GetHistogram()->SetFillColor(kMagenta-7);
267 legpre->AddEntry(mytree->GetHistogram(),
" ",
"f");
269 mytree->Draw(metricstr,
"!(pass_time) && "+selpre,
"hist same");
270 mytree->GetHistogram()->SetLineColor(1);
271 mytree->GetHistogram()->SetLineWidth(2);
272 mytree->GetHistogram()->SetFillColor(kGray+2);
273 legpre->AddEntry(mytree->GetHistogram(),
" Preliminary",
"f");
276 leg->SetY1(0.9-leg->GetNRows()*0.05);
278 legpre->SetNColumns(2);
280 legpre->SetColumnSeparation(-0.05);
283 MiscText(0.15,0.94,0.055,
"Near Detector");
286 DrawArrow(3,0.5,0.1,0.7*hAll->GetBinContent(hAll->GetMaximumBin()));
290 line.SetLineStyle(7);
291 line.SetLineWidth(2);
292 line.DrawLine(0,0.1,0,
pow(hAll->GetMaximum(),0.58));
293 line.DrawLine(-1,
pow(hAll->GetMaximum(),0.58),0,
pow(hAll->GetMaximum(),0.58));
294 TLatex* ltx=
MiscText(0.165,0.29,0.03,
"No Spill Information");
295 ltx->SetTextAngle(90);
296 c1->SaveAs(
"pngfiles/NearDet-t00-P1GoodDataSelEmptySpillFrac"+suf+
".png");
std::map< std::string, double > xmax
void StripSpecialChar(string &instr)
void GoodDataSelEmptySpillFrac(int ptype=0)
TLatex * MiscText(float x, float y, float size, TString text)
fvar< T > floor(const fvar< T > &x)
void SetLeg(TLegend *leg)
void Format(TGraph *gr, int lcol, int lsty, int lwid, int mcol, int msty, double msiz)
void DrawArrow(double x, double dx, double ymin, double ymax)
T max(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
fvar< T > ceil(const fvar< T > &x)
void UpdateStamp(int ptype, int maxt)