29 sprintf(
filename,
"output/%s", figname);
34 c1->SaveAs(
"allPlots.pdf",
"pdf");
35 c1->Write(Form(
"%s",
filename), TObject::kWriteDelete);
36 printf(
"Info in <TCanvas::Print>: %s has been saved and added to allPlots.pdf file\n",
filename);
43 TNtuple *ntuple =
new TNtuple(
"ntuple",
"data",
"side:phi:straw:status:hits:occ:htocc:eff:lay");
51 in.open(
"TRT_StrawStatusReport.txt");
56 for (
int i = 0;
i < 5;
i++){
60 for (
int i = 0;
i < 3;
i++){
77 printf(
"read %d lines from file\n",
count);
81 TFile* myfile =
new TFile(
"test.HIST.root",
"RECREATE");
83 TCanvas *
c1 =
new TCanvas(
"c1",
"This is the canvas test", 1200,800);
88 gStyle->SetOptStat(10);
89 gStyle->SetStatY(0.98);
90 gStyle->SetStatX(0.9);
91 gStyle->SetStatW(0.15);
92 gStyle->SetStatH(0.1);
94 c1->SaveAs(
"allPlots.pdf[");
96 std::unique_ptr<TH1F>
h1 = std::make_unique<TH1F>(
"h1",
"", 101, 0., 101);
97 ntuple->Project(
"h1",
"eff");
98 h1->GetXaxis()->SetTitle(
"Straw hit efficiency [%]");
99 h1->GetXaxis()->SetTitleSize(0.04);
100 h1->GetYaxis()->SetTitle(
"Number of straws");
101 h1->GetYaxis()->SetTitleSize(0.04);
104 std::unique_ptr<TH1F> h1a = std::make_unique<TH1F>(
"h1a",
"", 101, 0., 101);
105 ntuple->Project(
"h1a",
"eff",
"status>0");
106 h1a->SetFillStyle(1001);
107 h1a->SetFillColor(kOrange);
110 std::unique_ptr<TH1F> h1b = std::make_unique<TH1F>(
"h1b",
"", 101, 0., 101);
111 ntuple->Project(
"h1b",
"eff",
"status==42");
112 h1b->SetFillStyle(1001);
113 h1b->SetFillColor(2);
120 mytext.SetTextAlign(21);
122 mytext.SetTextSize(0.04);
123 mytext.SetTextFont(42);
124 mytext.DrawLatex(0.10, 0.02, Form(
"Run %d",
run));
126 print(Form(
"strawHitEfficiency_%d",
run),
c1);
133 double htrange = 0.1;
134 std::unique_ptr<TH1F> hh1 = std::make_unique<TH1F>(
"hh1",
"", 100, 0., htrange);
135 ntuple->Project(
"hh1",
"htocc");
137 hh1->GetXaxis()->SetTitle(
"Straw HT occupancy");
138 hh1->GetXaxis()->SetTitleSize(0.04);
140 hh1->GetYaxis()->SetTitle(
"Number of straws");
141 hh1->GetYaxis()->SetTitleSize(0.04);
143 hh1->SetBinContent(100, hh1->GetBinContent(100) + hh1->GetBinContent(101));
146 std::unique_ptr<TH1F> hh1a = std::make_unique<TH1F>(
"hh1a",
"", 100, 0., htrange);
147 ntuple->Project(
"hh1a",
"htocc",
"status>0");
148 hh1a->SetFillStyle(1001);
149 hh1a->SetFillColor(kOrange);
150 hh1a->SetBinContent(100, hh1a->GetBinContent(100) + hh1a->GetBinContent(101));
153 std::unique_ptr<TH1F> hh1b = std::make_unique<TH1F>(
"hh1b",
"", 100, 0., htrange);
154 ntuple->Project(
"hh1b",
"htocc",
"status==52");
155 hh1b->SetFillStyle(1001);
156 hh1b->SetFillColor(2);
157 hh1b->SetBinContent(100, hh1b->GetBinContent(100) + hh1b->GetBinContent(101));
162 mytext.DrawLatex(0.10, 0.02, Form(
"Run %d",
run));
170 gStyle->SetPalette(1);
171 c1->SetRightMargin(0.2);
174 std::unique_ptr<TH1F> h7 = std::make_unique<TH1F>(
"h7",
"", 100, 0, 10000);
175 ntuple->Draw(
"hits>>h7",
"straw>=147&&straw<200&&eff>0.7");
176 double range = h7->GetMean();
179 std::unique_ptr<TH2F> h2 = std::make_unique<TH2F>(
"h2",
"", 110, -0.5, 5481.5, 100, 0.,
range * 1.2);
180 ntuple->Project(
"h2",
"hits:straw",
"status==0");
182 h2->GetXaxis()->SetTitle(
"Straw index");
183 h2->GetXaxis()->SetTitleSize(0.04);
185 h2->GetYaxis()->SetTitleOffset(1.2);
186 h2->GetYaxis()->SetTitle(
"Number of hits on track");
187 h2->GetYaxis()->SetTitleSize(0.04);
189 h2->GetZaxis()->SetTitleOffset(1.2);
190 h2->GetZaxis()->SetTitle(
"Number of straws");
191 h2->GetZaxis()->SetTitleSize(0.04);
194 ntuple->SetMarkerStyle(20);
195 ntuple->SetMarkerSize(0.8);
196 ntuple->SetMarkerColor(1);
197 ntuple->Draw(
"hits:straw",
"status==52||status==51",
"same");
201 l.DrawLatex(750,
range * 1.1,
"black points: straws excluded due to low / high HT occupancy");
202 mytext.DrawLatex(0.10, 0.02, Form(
"Run %d",
run));
204 print(Form(
"numberOfHitsOnTrack_%d",
run),
c1);
210 std::unique_ptr<TH2F> hh22 = std::make_unique<TH2F>(
"hh22",
"", 5, -2.5, 2.5, 32, -0.5, 31.5);
211 ntuple->Project(
"hh22",
"phi:side",
"status>1");
213 hh22->GetXaxis()->SetTitle(
"Detector side (athena numbering) Z");
214 hh22->GetXaxis()->SetTitleSize(0.04);
216 hh22->GetYaxis()->SetTitleOffset(0.8);
217 hh22->GetYaxis()->SetTitle(
"Detector #phi (athena 0-31 range)");
218 hh22->GetYaxis()->SetTitleSize(0.04);
220 hh22->GetZaxis()->SetTitle(
"Number of additional excluded straws");
221 hh22->GetZaxis()->SetTitleSize(0.04);
225 mytext.DrawLatex(0.10, 0.02, Form(
"Run %d",
run));
226 mytext.DrawLatex(0.23, 0.91,
"Endcap || Barrel");
227 mytext.DrawLatex(0.45, 0.91,
"#leftarrow C || A #rightarrow");
228 mytext.DrawLatex(0.67, 0.91,
"Barrel || Endcap");
230 print(Form(
"additionalExcludedStraws_%d",
run),
c1);
233 std::unique_ptr<TH2F> h3 = std::make_unique<TH2F>(
"h3",
"", 7, -3.5, 3.5, 32, -0.5, 31.5);
234 ntuple->Project(
"h3",
"phi:side*(lay+1)/abs(side)",
"status>1 && abs(side)==1");
235 h3->GetXaxis()->SetTitle(
"Barrel Module (athena numbering) Z");
236 h3->GetXaxis()->SetTitleSize(0.04);
238 h3->GetYaxis()->SetTitleOffset(0.8);
239 h3->GetYaxis()->SetTitle(
"Detector #phi (athena 0-31 range)");
240 h3->GetYaxis()->SetTitleSize(0.04);
242 h3->GetZaxis()->SetTitle(
"Number of additional excluded straws");
243 h3->GetZaxis()->SetTitleSize(0.04);
245 h3->Draw(
"colz text");
247 mytext.DrawLatex(0.10, 0.02, Form(
"Run %d",
run));
248 mytext.DrawLatex(0.45, 0.91,
"#leftarrow C || A #rightarrow");
250 print(Form(
"additionalExcludedStrawsBarrel_%d",
run),
c1);
253 std::unique_ptr<TH2F> h4 = std::make_unique<TH2F>(
"h4",
"", 29, -14.5, 14.5, 32, -0.5, 31.5);
254 ntuple->Project(
"h4",
"phi:side*(lay+1)/abs(side)",
"status>1 && abs(side)==2");
256 h4->GetXaxis()->SetTitle(
"Endcap Wheel (athena numbering) Z");
257 h4->GetXaxis()->SetTitleSize(0.04);
259 h4->GetYaxis()->SetTitleOffset(0.8);
260 h4->GetYaxis()->SetTitle(
"Detector #phi (athena 0-31 range)");
261 h4->GetYaxis()->SetTitleSize(0.04);
263 h4->GetZaxis()->SetTitle(
"Number of additional excluded straws");
264 h4->GetZaxis()->SetTitleSize(0.04);
266 h4->Draw(
"colz text");
268 mytext.DrawLatex(0.10, 0.02, Form(
"Run %d",
run));
269 mytext.DrawLatex(0.45, 0.91,
"#leftarrow C || A #rightarrow");
271 print(Form(
"additionalExcludedStrawsEndcap_%d",
run),
c1);
274 std::unique_ptr<TH2F> h5 = std::make_unique<TH2F>(
"h5",
"", 7, -3.5, 3.5, 32, -0.5, 31.5);
275 ntuple->Project(
"h5",
"phi:side*(lay+1)/abs(side)",
"status == 12 && abs(side)==1");
276 if (h5->GetEntries() != 0)
279 h5->GetXaxis()->SetTitle(
"Barrel Module (athena numbering) Z");
280 h5->GetXaxis()->SetTitleSize(0.04);
282 h5->GetYaxis()->SetTitleOffset(0.8);
283 h5->GetYaxis()->SetTitle(
"Detector #phi (athena 0-31 range)");
284 h5->GetYaxis()->SetTitleSize(0.04);
286 h5->GetZaxis()->SetTitle(
"Number of additional DEAD excluded straws");
287 h5->GetZaxis()->SetTitleSize(0.04);
289 h5->Draw(
"colz text");
291 mytext.DrawLatex(0.10, 0.02, Form(
"Run %d",
run));
292 mytext.DrawLatex(0.45, 0.91,
"#leftarrow C || A #rightarrow");
294 print(Form(
"additionalExcludedDEADStrawsBarrel_%d",
run),
c1);
298 std::unique_ptr<TH2F> h6 = std::make_unique<TH2F>(
"h6",
"", 29, -14.5, 14.5, 32, -0.5, 31.5);
299 ntuple->Project(
"h6",
"phi:side*(lay+1)/abs(side)",
"status == 12 && abs(side)==2");
300 if (h6->GetEntries() != 0)
303 h6->GetXaxis()->SetTitle(
"Endcap Module (athena numbering) Z");
304 h6->GetXaxis()->SetTitleSize(0.04);
306 h6->GetYaxis()->SetTitleOffset(0.8);
307 h6->GetYaxis()->SetTitle(
"Detector #phi (athena 0-31 range)");
308 h6->GetYaxis()->SetTitleSize(0.04);
310 h6->GetZaxis()->SetTitle(
"Number of additional DEAD excluded straws");
311 h6->GetZaxis()->SetTitleSize(0.04);
313 h6->Draw(
"colz text");
315 mytext.DrawLatex(0.10, 0.02, Form(
"Run %d",
run));
316 mytext.DrawLatex(0.45, 0.91,
"#leftarrow C || A #rightarrow");
318 print(Form(
"additionalExcludedDEADStrawsEndcap_%d",
run),
c1);
322 std::unique_ptr<TH2F> h55 = std::make_unique<TH2F>(
"h55",
"", 7, -3.5, 3.5, 32, -0.5, 31.5);
323 ntuple->Project(
"h55",
"phi:side*(lay+1)/abs(side)",
"status == 11 && abs(side)==1");
324 if (h55->GetEntries() != 0)
327 h55->GetXaxis()->SetTitle(
"Barrel Module (athena numbering) Z");
328 h55->GetXaxis()->SetTitleSize(0.04);
330 h55->GetYaxis()->SetTitleOffset(0.8);
331 h55->GetYaxis()->SetTitle(
"Detector #phi (athena 0-31 range)");
332 h55->GetYaxis()->SetTitleSize(0.04);
334 h55->GetZaxis()->SetTitle(
"Number of additional NOISY excluded straws");
335 h55->GetZaxis()->SetTitleSize(0.04);
337 h55->Draw(
"colz text");
339 mytext.DrawLatex(0.10, 0.02, Form(
"Run %d",
run));
340 mytext.DrawLatex(0.45, 0.91,
"#leftarrow C || A #rightarrow");
342 print(Form(
"additionalExcludedNOISYStrawsBarrel_%d",
run),
c1);
347 std::unique_ptr<TH2F> h66 = std::make_unique<TH2F>(
"h66",
"", 29, -14.5, 14.5, 32, -0.5, 31.5);
348 ntuple->Project(
"h66",
"phi:side*(lay+1)/abs(side)",
"status == 11 && abs(side)==2");
349 if (h66->GetEntries() != 0)
352 h66->GetXaxis()->SetTitle(
"Endcap Module (athena numbering) Z");
353 h66->GetXaxis()->SetTitleSize(0.04);
355 h66->GetYaxis()->SetTitleOffset(0.8);
356 h66->GetYaxis()->SetTitle(
"Detector #phi (athena 0-31 range)");
357 h66->GetYaxis()->SetTitleSize(0.04);
359 h66->GetZaxis()->SetTitle(
"Number of additional NOISY excluded straws");
360 h66->GetZaxis()->SetTitleSize(0.04);
362 h66->Draw(
"colz text");
364 mytext.DrawLatex(0.10, 0.02, Form(
"Run %d",
run));
365 mytext.DrawLatex(0.45, 0.91,
"#leftarrow C || A #rightarrow");
367 print(Form(
"additionalExcludedNOISYStrawsEndcap_%d",
run),
c1);
371 std::unique_ptr<TH2F> h555 = std::make_unique<TH2F>(
"h555",
"", 7, -3.5, 3.5, 32, -0.5, 31.5);
372 ntuple->Project(
"h555",
"phi:side*(lay+1)/abs(side)",
"status == 42 && abs(side)==1");
373 if (h555->GetEntries() != 0)
376 h555->GetXaxis()->SetTitle(
"Barrel Module (athena numbering) Z");
377 h555->GetXaxis()->SetTitleSize(0.04);
379 h555->GetYaxis()->SetTitleOffset(0.8);
380 h555->GetYaxis()->SetTitle(
"Detector #phi (athena 0-31 range)");
381 h555->GetYaxis()->SetTitleSize(0.04);
383 h555->GetZaxis()->SetTitle(
"Number of additional LowEff excluded straws");
384 h555->GetZaxis()->SetTitleSize(0.04);
386 h555->Draw(
"colz text");
388 mytext.DrawLatex(0.10, 0.02, Form(
"Run %d",
run));
389 mytext.DrawLatex(0.45, 0.91,
"#leftarrow C || A #rightarrow");
391 print(Form(
"additionalExcludedLowEffStrawsBarrel_%d",
run),
c1);
395 std::unique_ptr<TH2F> h666 = std::make_unique<TH2F>(
"h666",
"", 29, -14.5, 14.5, 32, -0.5, 31.5);
396 ntuple->Project(
"h666",
"phi:side*(lay+1)/abs(side)",
"status == 42 && abs(side)==2");
397 if (h666->GetEntries() != 0)
400 h666->GetXaxis()->SetTitle(
"Endcap Module (athena numbering) Z");
401 h666->GetXaxis()->SetTitleSize(0.04);
403 h666->GetYaxis()->SetTitleOffset(0.8);
404 h666->GetYaxis()->SetTitle(
"Detector #phi (athena 0-31 range)");
405 h666->GetYaxis()->SetTitleSize(0.04);
407 h666->GetZaxis()->SetTitle(
"Number of additional LowEff excluded straws");
408 h666->GetZaxis()->SetTitleSize(0.04);
410 h666->Draw(
"colz text");
412 mytext.DrawLatex(0.10, 0.02, Form(
"Run %d",
run));
413 mytext.DrawLatex(0.45, 0.91,
"#leftarrow C || A #rightarrow");
415 print(Form(
"additionalExcludedLowEffStrawsEndcap_%d",
run),
c1);
419 std::unique_ptr<TH2F> h5555 = std::make_unique<TH2F>(
"h5555",
"", 7, -3.5, 3.5, 32, -0.5, 31.5);
420 ntuple->Project(
"h5555",
"phi:side*(lay+1)/abs(side)",
"status > 50 && abs(side)==1");
421 if (h5555->GetEntries() != 0)
424 h5555->GetXaxis()->SetTitle(
"Barrel Module (athena numbering) Z");
425 h5555->GetXaxis()->SetTitleSize(0.04);
427 h5555->GetYaxis()->SetTitleOffset(0.8);
428 h5555->GetYaxis()->SetTitle(
"Detector #phi (athena 0-31 range)");
429 h5555->GetYaxis()->SetTitleSize(0.04);
431 h5555->GetZaxis()->SetTitle(
"Number of additional BadHT excluded straws");
432 h5555->GetZaxis()->SetTitleSize(0.04);
434 h5555->Draw(
"colz text");
436 mytext.DrawLatex(0.10, 0.02, Form(
"Run %d",
run));
437 mytext.DrawLatex(0.45, 0.91,
"#leftarrow C || A #rightarrow");
439 print(Form(
"additionalExcludedBadHTStrawsBarrel_%d",
run),
c1);
443 std::unique_ptr<TH2F> h6666 = std::make_unique<TH2F>(
"h6666",
"", 29, -14.5, 14.5, 32, -0.5, 31.5);
444 ntuple->Project(
"h6666",
"phi:side*(lay+1)/abs(side)",
"status > 50 && abs(side)==2");
445 if (h6666->GetEntries() != 0)
448 h6666->GetXaxis()->SetTitle(
"Endcap Module (athena numbering) Z");
449 h6666->GetXaxis()->SetTitleSize(0.04);
451 h6666->GetYaxis()->SetTitleOffset(0.8);
452 h6666->GetYaxis()->SetTitle(
"Detector #phi (athena 0-31 range)");
453 h6666->GetYaxis()->SetTitleSize(0.04);
455 h6666->GetZaxis()->SetTitle(
"Number of additional BadHT excluded straws");
456 h6666->GetZaxis()->SetTitleSize(0.04);
458 h6666->Draw(
"colz text");
460 mytext.DrawLatex(0.10, 0.02, Form(
"Run %d",
run));
461 mytext.DrawLatex(0.45, 0.91,
"#leftarrow C || A #rightarrow");
463 print(Form(
"additionalExcludedBadHTStrawsEndcap_%d",
run),
c1);
467 c1->SaveAs(
"allPlots.pdf]");
468 myfile->Write(0,TObject::kOverwrite);