21 #include <TGraphErrors.h>
28 #include <TLegendEntry.h>
30 #include <TEventList.h>
32 #include <TPaveText.h>
33 #include <TPaveStats.h>
34 #include <TPaletteAxis.h>
51 double zmin = 100000000;
52 double zmax = -100000000;
54 for (
int ix = 0; ix < reshist0->GetNbinsX(); ix++)
56 for (
int iy = 0; iy < reshist0->GetNbinsY(); iy++)
58 temp = reshist0->GetBinContent(ix, iy);
65 reshist0->GetZaxis()->SetRangeUser(
zmin,
zmax);
70 TPaletteAxis *palette = (TPaletteAxis *)
hist->GetListOfFunctions()->FindObject(
"palette");
71 palette->SetX2NDC(0.92);
73 palette->SetLabelSize(0.03);
78 const char * whitespace =
" \n\r\t";
79 s.erase(
s.find_last_not_of(whitespace)+1);
80 s.erase(0,
s.find_first_not_of(whitespace));
93 TPaveText *
pt =
new TPaveText(.1, .1, 0.9, 0.9);
104 NHitStack(TNtuple *, TLegend *,
bool,
int,
int);
110 int min = (
int)tuple->GetMinimum(
"nt0");
111 int max = (
int)tuple->GetMaximum(
"nt0");
112 float bsize = ceil(((
float)(
max -
min) / 50));
115 TH1F *hits1 =
new TH1F(Form(
"%s_hits1", tuple->GetName()),
"test1", 50,
min,
hmax);
116 TH1F *hits2 =
new TH1F(Form(
"%s_hits2", tuple->GetName()),
"test2", 50,
min,
hmax);
117 TH1F *hits3 =
new TH1F(Form(
"%s_hits3", tuple->GetName()),
"test3", 50,
min,
hmax);
120 tuple->Draw(Form(
"nt0>>%s_hits1", tuple->GetName()), Form(
"nt0<=%i", mint0));
121 tuple->Draw(Form(
"nt0>>%s_hits2", tuple->GetName()), Form(
"nt0>%i && nt0<=%i", mint0, minrt));
122 tuple->Draw(Form(
"nt0>>%s_hits3", tuple->GetName()), Form(
"nt0>%i", minrt));
123 hits1->SetFillColor(46);
124 hits2->SetFillColor(8);
125 hits3->SetFillColor(38);
135 leg->AddEntry(hits1,
"no calibration");
136 leg->AddEntry(hits2,
"enough for T0 calib");
137 leg->AddEntry(hits3,
"enough for T0+RT calib");
138 leg->SetTextSize(0.04);
154 cout <<
" In HitStatistics infile: " <<
infile << endl;
156 TNtuple *Strawtuple =
nullptr;
157 TNtuple *Chiptuple =
nullptr;
158 TNtuple *Boardtuple =
nullptr;
159 TNtuple *Moduletuple =
nullptr;
160 TNtuple *Layertuple =
nullptr;
161 TNtuple *Detectortuple =
nullptr;
162 TNtuple *conftup =
nullptr;
166 Strawtuple = (TNtuple *)
file->Get(
"Strawtuple");
167 Chiptuple = (TNtuple *)
file->Get(
"Chiptuple");
168 Boardtuple = (TNtuple *)
file->Get(
"Boardtuple");
169 Moduletuple = (TNtuple *)
file->Get(
"Moduletuple");
170 Layertuple = (TNtuple *)
file->Get(
"Layertuple");
171 Detectortuple = (TNtuple *)
file->Get(
"Detectortuple");
172 conftup = (TNtuple *)
file->Get(
"configs");
176 Strawtuple = (TNtuple *)
file->Get(
"Straw_Artuple");
177 Chiptuple = (TNtuple *)
file->Get(
"Chip_Artuple");
178 Boardtuple = (TNtuple *)
file->Get(
"Board_Artuple");
179 Moduletuple = (TNtuple *)
file->Get(
"Module_Artuple");
180 Layertuple = (TNtuple *)
file->Get(
"Layer_Artuple");
181 Detectortuple = (TNtuple *)
file->Get(
"Detector_Artuple");
182 conftup = (TNtuple *)
file->Get(
"configs");
185 float mint0 = 500, minrt = 10000;
188 conftup->SetBranchAddress(
"mint0", &mint0);
189 conftup->SetBranchAddress(
"minrt", &minrt);
190 conftup->GetEntry(0);
195 this->Divide(3, 2, 0.01, 0.01);
197 ((TPad *)this->GetPrimitive(
"c1_1"))->SetFrameFillColor(0);
198 ((TPad *)this->GetPrimitive(
"c1_2"))->SetFrameFillColor(0);
199 ((TPad *)this->GetPrimitive(
"c1_3"))->SetFrameFillColor(0);
200 ((TPad *)this->GetPrimitive(
"c1_4"))->SetFrameFillColor(0);
201 ((TPad *)this->GetPrimitive(
"c1_5"))->SetFrameFillColor(0);
202 ((TPad *)this->GetPrimitive(
"c1_6"))->SetFrameFillColor(0);
204 ((TPad *)this->GetPrimitive(
"c1_1"))->SetLogy();
205 ((TPad *)this->GetPrimitive(
"c1_2"))->SetLogy();
206 ((TPad *)this->GetPrimitive(
"c1_3"))->SetLogy();
207 ((TPad *)this->GetPrimitive(
"c1_4"))->SetLogy();
208 ((TPad *)this->GetPrimitive(
"c1_5"))->SetLogy();
209 ((TPad *)this->GetPrimitive(
"c1_6"))->SetLogy();
211 TLegend *
leg =
new TLegend(0.95, 0.6, 0.35, 0.35);
216 hsStraw->SetTitle(
"Hit Statistics (Straw)");
218 hsStraw->SetTitle(
"Hit Statistics (Argon Straw)");
220 hsStraw->GetHistogram()->GetXaxis()->SetTitle(
"No. Hits");
221 hsStraw->GetHistogram()->GetYaxis()->SetTitle(
"No. Straws");
222 hsStraw->GetHistogram()->GetXaxis()->SetNdivisions(-4);
226 hsChip->SetTitle(
"Hit Statistics (Chip)");
228 hsChip->SetTitle(
"Hit Statistics (Argon chip)");
230 hsChip->GetHistogram()->GetXaxis()->SetTitle(
"No. Hits");
231 hsChip->GetHistogram()->GetYaxis()->SetTitle(
"No. Chips");
232 hsChip->GetHistogram()->GetXaxis()->SetNdivisions(-4);
236 hsBoard->SetTitle(
"Hit Statistics (Board)");
238 hsBoard->SetTitle(
"Hit Statistics (Argon Board)");
240 hsBoard->GetHistogram()->GetXaxis()->SetTitle(
"No. Hits");
241 hsBoard->GetHistogram()->GetYaxis()->SetTitle(
"No. Boards");
242 hsBoard->GetHistogram()->GetXaxis()->SetNdivisions(-4);
246 hsModule->SetTitle(
"Hit Statistics (Phi Sector)");
248 hsModule->SetTitle(
"Hit Statistics (Argon Phi Sector)");
250 hsModule->GetHistogram()->GetXaxis()->SetTitle(
"No. Hits");
251 hsModule->GetHistogram()->GetYaxis()->SetTitle(
"No. Phi Sectors");
252 hsModule->GetHistogram()->GetXaxis()->SetNdivisions(-4);
256 hsLayer->SetTitle(
"Hit Statistics (Layer/wheel)");
258 hsLayer->SetTitle(
"Hit Statistics (Argon Layer/wheel)");
260 hsLayer->GetHistogram()->GetXaxis()->SetTitle(
"No. Hits");
261 hsLayer->GetHistogram()->GetYaxis()->SetTitle(
"No. Layers/wheel");
262 hsLayer->GetHistogram()->GetXaxis()->SetNdivisions(-4);
266 hsDetector->SetTitle(
"Hit Statistics (Detector)");
268 hsDetector->SetTitle(
"Argon Hit Statistics (Detector)");
270 hsDetector->GetHistogram()->GetXaxis()->SetTitle(
"No. Hits");
271 hsDetector->GetHistogram()->GetYaxis()->SetTitle(
"No. Detectors");
272 hsDetector->GetHistogram()->GetXaxis()->SetNdivisions(-4);
282 XYMaps(
char *,
string,
bool);
288 char selectionA[500];
289 sprintf(selectionA,
"%s*(det==1)",
variable.c_str());
290 char selectionC[500];
291 sprintf(selectionC,
"%s*(det==-1)",
variable.c_str());
295 cout <<
"In XYMaps infile: " <<
infile <<
" variable " <<
variable << endl;
297 TNtuple *Chiptuple =
nullptr;
298 TNtuple *Boardtuple =
nullptr;
299 TNtuple *Moduletuple =
nullptr;
303 Chiptuple = (TNtuple *)
file->Get(
"Chiptuple");
304 Boardtuple = (TNtuple *)
file->Get(
"Boardtuple");
305 Moduletuple = (TNtuple *)
file->Get(
"Moduletuple");
309 Chiptuple = (TNtuple *)
file->Get(
"Chip_Artuple");
310 Boardtuple = (TNtuple *)
file->Get(
"Board_Artuple");
311 Moduletuple = (TNtuple *)
file->Get(
"Module_Artuple");
316 this->Divide(3, 2, 0.01, 0.01);
317 ((TPad *)this->GetPrimitive(
"c1_1"))->SetFrameFillColor(1);
318 ((TPad *)this->GetPrimitive(
"c1_2"))->SetFrameFillColor(1);
319 ((TPad *)this->GetPrimitive(
"c1_3"))->SetFrameFillColor(1);
320 ((TPad *)this->GetPrimitive(
"c1_4"))->SetFrameFillColor(1);
321 ((TPad *)this->GetPrimitive(
"c1_5"))->SetFrameFillColor(1);
322 ((TPad *)this->GetPrimitive(
"c1_6"))->SetFrameFillColor(1);
324 gStyle->SetPalette(1);
327 Moduletuple->Draw(
"y:x>>reshist10(40,-1200,1200,40,-1200,1200)", selectionA,
"colz");
328 TH2F *reshist10 = (
TH2F *)gPad->GetPrimitive(
"reshist10");
330 throw string(
"Variable not found!");
333 reshist10->GetZaxis()->SetRangeUser(0.12, 0.19);
335 else if (
variable ==
"abs(resMean)")
337 reshist10->GetZaxis()->SetRangeUser(0.0, 0.01);
341 reshist10->GetZaxis()->SetRangeUser(1.0, 7.0);
343 else if (
variable ==
"abs(t0-oldt0)")
345 reshist10->GetZaxis()->SetRangeUser(0, .4);
349 reshist10->GetZaxis()->SetRangeUser(2.0, 4.0);
352 if (reshist10->GetEntries() > 1)
356 sprintf(title1,
"Module %s (barrel side A)",
variable.c_str());
358 sprintf(title1,
"Argon Module %s (barrel side A)",
variable.c_str());
359 reshist10->SetTitle(title1);
360 reshist10->SetStats(0);
361 reshist10->GetXaxis()->SetLabelOffset(1000);
362 reshist10->GetYaxis()->SetLabelOffset(1000);
365 Boardtuple->Draw(
"y:x>>reshist0(100,-1200,1200,100,-1200,1200)", selectionA,
"colz");
366 TH2F *reshist0 = (
TH2F *)gPad->GetPrimitive(
"reshist0");
368 throw string(
"Variable not found!");
372 reshist0->GetZaxis()->SetRangeUser(0.12, 0.19);
374 else if (
variable ==
"abs(resMean)")
376 reshist0->GetZaxis()->SetRangeUser(0.0, 0.01);
380 reshist0->GetZaxis()->SetRangeUser(1.0, 7.0);
382 else if (
variable ==
"abs(t0-oldt0)")
384 reshist0->GetZaxis()->SetRangeUser(0, .4);
388 reshist0->GetZaxis()->SetRangeUser(2.0, 4.0);
391 if (reshist0->GetEntries() > 1)
395 sprintf(title2,
"Board %s (barrel side A)",
variable.c_str());
397 sprintf(title2,
"Argon Board %s (barrel side A)",
variable.c_str());
398 reshist0->SetTitle(title2);
399 reshist0->SetStats(0);
400 reshist0->GetXaxis()->SetLabelOffset(1000);
401 reshist0->GetYaxis()->SetLabelOffset(1000);
404 Chiptuple->Draw(
"y:x>>t0hist0(300,-1200,1200,300,-1200,1200)", selectionA,
"colz");
405 TH2F *t0hist0 = (
TH2F *)gPad->GetPrimitive(
"t0hist0");
407 throw string(
"Variable not found!");
409 sprintf(title3,
"Chip %s (barrel side A)",
variable.c_str());
411 sprintf(title3,
"Argon Chip %s (barrel side A)",
variable.c_str());
412 t0hist0->SetTitle(title3);
416 t0hist0->GetZaxis()->SetRangeUser(0.12, 0.19);
418 else if (
variable ==
"abs(resMean)")
420 t0hist0->GetZaxis()->SetRangeUser(0.0, 0.01);
424 t0hist0->GetZaxis()->SetRangeUser(1.0, 7.0);
426 else if (
variable ==
"abs(t0-oldt0)")
428 t0hist0->GetZaxis()->SetRangeUser(0, .4);
432 t0hist0->GetZaxis()->SetRangeUser(2.0, 4.0);
435 if (t0hist0->GetEntries() > 1)
438 t0hist0->SetStats(0);
439 t0hist0->GetXaxis()->SetLabelOffset(1000);
440 t0hist0->GetYaxis()->SetLabelOffset(1000);
443 Moduletuple->Draw(
"y:x>>reshist11(40,-1200,1200,40,-1200,1200)", selectionC,
"colz");
444 TH2F *reshist11 = (
TH2F *)gPad->GetPrimitive(
"reshist11");
446 throw string(
"Variable not found!");
449 reshist11->GetZaxis()->SetRangeUser(0.12, 0.19);
451 else if (
variable ==
"abs(resMean)")
453 reshist11->GetZaxis()->SetRangeUser(0.0, 0.01);
457 reshist11->GetZaxis()->SetRangeUser(1.0, 7.0);
459 else if (
variable ==
"abs(t0-oldt0)")
461 reshist11->GetZaxis()->SetRangeUser(0, .4);
465 reshist11->GetZaxis()->SetRangeUser(2.0, 4.0);
468 if (reshist11->GetEntries() > 1)
472 sprintf(title4,
"Module %s (barrel side C)",
variable.c_str());
474 sprintf(title4,
"Argon Module %s (barrel side C)",
variable.c_str());
475 reshist11->SetTitle(title4);
476 reshist11->SetStats(0);
477 reshist11->GetXaxis()->SetLabelOffset(1000);
478 reshist11->GetYaxis()->SetLabelOffset(1000);
481 Boardtuple->Draw(
"y:x>>reshist1(100,-1200,1200,100,-1200,1200)", selectionC,
"colz");
482 TH2F *reshist1 = (
TH2F *)gPad->GetPrimitive(
"reshist1");
484 throw string(
"Variable not found!");
487 reshist1->GetZaxis()->SetRangeUser(0.12, 0.19);
489 else if (
variable ==
"abs(resMean)")
491 reshist1->GetZaxis()->SetRangeUser(0.0, 0.01);
495 reshist1->GetZaxis()->SetRangeUser(1.0, 7.0);
497 else if (
variable ==
"abs(t0-oldt0)")
499 reshist1->GetZaxis()->SetRangeUser(0, .4);
503 reshist1->GetZaxis()->SetRangeUser(2.0, 4.0);
506 if (reshist1->GetEntries() > 1)
510 sprintf(title5,
"Board %s (barrel side C)",
variable.c_str());
512 sprintf(title5,
"Argon Board %s (barrel side C)",
variable.c_str());
513 reshist1->SetTitle(title5);
514 reshist1->SetStats(0);
515 reshist1->GetXaxis()->SetLabelOffset(1000);
516 reshist1->GetYaxis()->SetLabelOffset(1000);
519 Chiptuple->Draw(
"y:x>>t0hist1(300,-1200,1200,300,-1200,1200)", selectionC,
"colz");
520 TH2F *t0hist1 = (
TH2F *)gPad->GetPrimitive(
"t0hist1");
522 throw string(
"Variable not found!");
525 t0hist1->GetZaxis()->SetRangeUser(0.12, 0.19);
527 else if (
variable ==
"abs(resMean)")
529 t0hist1->GetZaxis()->SetRangeUser(0.0, 0.01);
533 t0hist1->GetZaxis()->SetRangeUser(1.0, 7.0);
535 else if (
variable ==
"abs(t0-oldt0)")
537 t0hist1->GetZaxis()->SetRangeUser(0, .4);
541 t0hist1->GetZaxis()->SetRangeUser(2.0, 4.0);
544 if (t0hist1->GetEntries() > 1)
548 sprintf(title6,
"Chip %s (barrel side C)",
variable.c_str());
550 sprintf(title6,
"Argon Chip %s (barrel side C)",
variable.c_str());
551 t0hist1->SetTitle(title6);
552 t0hist1->SetStats(0);
553 t0hist1->GetXaxis()->SetLabelOffset(1000);
554 t0hist1->GetYaxis()->SetLabelOffset(1000);
563 void Draw(
const string &,
bool);
565 TEventList* elist[7]{};
571 float x{},
y{}, nt0{}, chp{}, brd{}, lay{},
mod{},
det{};
572 int color[7] = {0, 46, 38, 8, 16, 1, 2};
574 Levtuple->SetBranchAddress(
"x", &
x);
575 Levtuple->SetBranchAddress(
"y", &
y);
576 Levtuple->SetBranchAddress(
"nt0", &nt0);
577 Levtuple->SetBranchAddress(
"chp", &chp);
578 Levtuple->SetBranchAddress(
"brd", &brd);
579 Levtuple->SetBranchAddress(
"lay", &lay);
580 Levtuple->SetBranchAddress(
"mod", &
mod);
581 Levtuple->SetBranchAddress(
"det", &
det);
583 Levtuple->Draw(
">>tmplist0", Form(
"nt0*(det==%i)",
detector));
584 Levtuple->Draw(
">>tmplist1", Form(
"nt0*(ftype==1 && det==%i)",
detector));
585 Levtuple->Draw(
">>tmplist2", Form(
"nt0*(ftype==2 && det==%i)",
detector));
586 Levtuple->Draw(
">>tmplist3", Form(
"nt0*(ftype==3 && det==%i)",
detector));
587 Levtuple->Draw(
">>tmplist4", Form(
"nt0*(ftype==4 && det==%i)",
detector));
588 Levtuple->Draw(
">>tmplist5", Form(
"nt0*(ftype==5 && det==%i)",
detector));
589 Levtuple->Draw(
">>tmplist6", Form(
"nt0*(ftype==6 && det==%i)",
detector));
590 elist[0] = (TEventList *)
gDirectory->Get(
"tmplist0");
591 elist[1] = (TEventList *)
gDirectory->Get(
"tmplist1");
592 elist[2] = (TEventList *)
gDirectory->Get(
"tmplist2");
593 elist[3] = (TEventList *)
gDirectory->Get(
"tmplist3");
594 elist[4] = (TEventList *)
gDirectory->Get(
"tmplist4");
595 elist[5] = (TEventList *)
gDirectory->Get(
"tmplist5");
596 elist[6] = (TEventList *)
gDirectory->Get(
"tmplist6");
598 for (
int igr = 0; igr <= 6; igr++)
600 graph[igr] =
new TGraph();
601 graph[igr]->SetMarkerStyle(20);
603 graph[igr]->SetMarkerColor(
color[igr]);
605 for (
int ib = 0;
ib < elist[igr]->GetN();
ib++)
608 Levtuple->GetEntry(elist[igr]->GetEntry(
ib));
610 graph[igr]->SetPoint(ipnt,
x,
y);
612 graph[igr]->RemovePoint(0);
614 graph[0]->SetMarkerSize(0.1);
619 graph[0]->GetHistogram()->GetXaxis()->SetLabelOffset(1000);
620 graph[0]->GetHistogram()->GetYaxis()->SetLabelOffset(1000);
621 if (graph[0]->GetN() > 0)
622 graph[0]->Draw(
"ap");
623 if (graph[1]->GetN() > 0)
625 if (graph[2]->GetN() > 0)
627 if (graph[3]->GetN() > 0)
629 if (graph[4]->GetN() > 0)
631 if (graph[5]->GetN() > 0)
633 if (graph[6]->GetN() > 0)
635 cout <<
"In Draw title: " <<
title << endl;
636 cout <<
" Events in graph[0]: " << graph[0]->GetN() << endl;
637 cout <<
" Events in graph[1]: " << graph[1]->GetN() << endl;
638 cout <<
" Events in graph[2]: " << graph[2]->GetN() << endl;
639 cout <<
" Events in graph[3]: " << graph[3]->GetN() << endl;
640 cout <<
" Events in graph[4]: " << graph[4]->GetN() << endl;
642 graph[0]->SetTitle(
title.c_str());
646 TLegend *
leg =
new TLegend(0.99, 0.35, 0.55, 0.01);
647 leg->AddEntry(graph[2],
"normal fit");
648 leg->AddEntry(graph[3],
"used chip ref");
649 leg->AddEntry(graph[4],
"Low stat,T0");
650 leg->AddEntry(graph[1],
"|mean|>5");
651 leg->AddEntry(graph[5],
"No T0 Cal");
652 leg->AddEntry(graph[6],
"Wrong fit, RMS and Mean used");
653 leg->SetTextSize(0.04);
671 cout <<
"In T0CalibTypeXY infile: " <<
infile << endl;
673 TNtuple *Chiptuple =
nullptr;
674 TNtuple *Boardtuple =
nullptr;
675 TNtuple *Moduletuple =
nullptr;
679 Chiptuple = (TNtuple *)
file->Get(
"Chiptuple");
680 Boardtuple = (TNtuple *)
file->Get(
"Boardtuple");
681 Moduletuple = (TNtuple *)
file->Get(
"Moduletuple");
685 Chiptuple = (TNtuple *)
file->Get(
"Chip_Artuple");
686 Boardtuple = (TNtuple *)
file->Get(
"Board_Artuple");
687 Moduletuple = (TNtuple *)
file->Get(
"Module_Artuple");
699 this->Divide(3, 2, 0.01, 0.01);
700 ((TPad *)this->GetPrimitive(
"c1_1"))->SetFrameFillColor(1);
701 ((TPad *)this->GetPrimitive(
"c1_2"))->SetFrameFillColor(1);
702 ((TPad *)this->GetPrimitive(
"c1_3"))->SetFrameFillColor(1);
703 ((TPad *)this->GetPrimitive(
"c1_4"))->SetFrameFillColor(1);
704 ((TPad *)this->GetPrimitive(
"c1_5"))->SetFrameFillColor(1);
705 ((TPad *)this->GetPrimitive(
"c1_6"))->SetFrameFillColor(1);
709 hxy1.
Draw(
"T0 calib type (Chip, side C)",
false);
711 hxy2.
Draw(
"T0 calib type (Board, side C)",
false);
713 hxy3.
Draw(
"T0 calib type (Module, side C)",
false);
715 hxy4.
Draw(
"T0 calib type (Chip, side A)",
false);
717 hxy5.
Draw(
"T0 calib type (Board, side A)",
false);
719 hxy6.
Draw(
"T0 calib type (Module, side A)",
true);
724 hxy1.
Draw(
"Argon T0 calib type (Chip, side C)",
false);
726 hxy2.
Draw(
"Argon T0 calib type (Board, side C)",
false);
728 hxy3.
Draw(
"Argon T0 calib type (Module, side C)",
false);
730 hxy4.
Draw(
"Argon T0 calib type (Chip, side A)",
false);
732 hxy5.
Draw(
"Argon T0 calib type (Board, side A)",
false);
734 hxy6.
Draw(
"Argon T0 calib type (Module, side A)",
true);
744 void DrawLines(
float,
float);
752 float t0o, chip,
dt0, rt0;
753 int nchip[9] = {10, 11, 15, 9, 9, 11, 12, 13, 14};
755 this->SetBins(104, 0.5, 104.5);
756 this->SetName(Form(
"ChipT0Var_%i",
detector));
759 cout <<
"In ChipVariations infile: " <<
infile <<
" detector " <<
detector << endl;
761 TNtuple *Chiptuple = (TNtuple *)
file->Get(
"Chiptuple");
763 Chiptuple->SetBranchAddress(
"rt0", &rt0);
764 Chiptuple->SetBranchAddress(
"t0offset", &t0o);
765 Chiptuple->SetBranchAddress(
"chp", &chip);
766 Chiptuple->SetBranchAddress(
"dt0", &
dt0);
769 for (
int ibrd = 0; ibrd < 9; ibrd++)
772 Chiptuple->Draw(
">>tmplist", Form(
"brd==%i && t0offset!=0 && ftype>1 && det==%i", ibrd,
detector));
773 TEventList *elist = (TEventList *)
gDirectory->Get(
"tmplist");
776 for (
int ib = 0;
ib < elist->GetN();
ib++)
779 Chiptuple->GetEntry(elist->GetEntry(
ib));
782 if (ibrd >= 2 && ibrd < 5)
783 mchip = (
int)chip + 21;
785 mchip = (
int)chip + 21 + 33;
786 this->Fill(mchip, t0o);
791 for (
int ibrd = 0; ibrd < 9; ibrd++)
793 for (
int ichp = 0; ichp < nchip[ibrd]; ichp++)
799 mchip = ichp + nchip[ibrd - 1] + 1;
803 mchip = ichp + nchip[ibrd - 1] + 1;
805 mchip = ichp + nchip[ibrd - 1] + nchip[ibrd - 2] + 1;
809 mchip = ichp + nchip[ibrd - 1] + 1;
811 mchip = ichp + nchip[ibrd - 1] + nchip[ibrd - 2] + 1;
813 mchip = ichp + nchip[ibrd - 1] + nchip[ibrd - 2] + nchip[ibrd - 3] + 1;
814 txtfile << ibrd <<
" " << mchip <<
" " <<
detector <<
" " <<
ic <<
" " << this->GetBinContent(
ic + 1) << endl;
820 this->SetTitle(Form(
"Chip T0 offset (phi-mod average, %c-side)",
detlet[
detector + 1]));
821 this->SetStats(kFALSE);
822 this->SetLineColor(2);
823 this->GetYaxis()->SetTitle(
"T0_{board}-T0_{chip} / ns");
824 this->GetXaxis()->SetTitle(
"chip #");
833 TLine *lin1 =
new TLine(10.5, lowe, 10.5, upe);
834 lin1->SetLineStyle(2);
836 TLine *lin2 =
new TLine(21.5, lowe, 21.5, upe);
837 lin2->SetLineStyle(2);
839 TLine *lin3 =
new TLine(36.5, lowe, 36.5, upe);
840 lin3->SetLineStyle(2);
842 TLine *lin4 =
new TLine(45.5, lowe, 45.5, upe);
843 lin4->SetLineStyle(2);
845 TLine *lin5 =
new TLine(54.5, lowe, 54.5, upe);
846 lin5->SetLineStyle(2);
848 TLine *lin6 =
new TLine(65.5, lowe, 65.5, upe);
849 lin6->SetLineStyle(2);
851 TLine *lin7 =
new TLine(77.5, lowe, 77.5, upe);
852 lin7->SetLineStyle(2);
854 TLine *lin8 =
new TLine(90.5, lowe, 90.5, upe);
855 lin8->SetLineStyle(2);
867 double *
GetX() {
return this->fX; }
868 double *
GetY() {
return this->fY; }
875 cout <<
"In BoardVariations infile: " <<
infile <<
" detector " <<
det << endl;
879 float t0,
dt0, bindex;
888 this->SetName(Form(
"BoardT0Var_%i",
det));
893 TNtuple *Boardtuple = (TNtuple *)
file->Get(
"Board_Artuple");
894 TNtuple *BoardtupleXe = (TNtuple *)
file->Get(
"Boardtuple");
895 Boardtuple->SetBranchAddress(
"t0", &
t0);
896 Boardtuple->SetBranchAddress(
"dt0", &
dt0);
899 BoardtupleXe->SetBranchAddress(
"t0", &
t0);
900 BoardtupleXe->SetBranchAddress(
"dt0", &
dt0);
906 for (
int imod = 0; imod < 32; imod++)
908 for (
int ibrd = 0; ibrd < 9; ibrd++)
911 bindex = 9 * imod + ibrd;
913 Boardtuple->Draw(
">>tmplist", Form(
"brd==%i && det==%i && mod==%i", ibrd,
det, imod));
914 TEventList *elist = (TEventList *)
gDirectory->Get(
"tmplist");
915 for (
int ib = 0;
ib < elist->GetN();
ib++)
918 Boardtuple->GetEntry(elist->GetEntry(
ib));
924 this->SetPoint(ipnt, bindex + 1,
t0);
925 this->SetPointError(ipnt, 0,
dt0);
933 else if (abs(
det) == 2)
935 for (
int imod = 0; imod < 32; imod++)
937 for (
int ilay = 0; ilay < 14; ilay++)
940 bindex = 14 * imod + ilay;
942 Boardtuple->Draw(
">>tmplist1", Form(
"lay==%i && det==%i && mod==%i", ilay,
det, imod));
943 TEventList *elist = (TEventList *)
gDirectory->Get(
"tmplist1");
944 for (
int ib = 0;
ib < elist->GetN();
ib++)
947 Boardtuple->GetEntry(elist->GetEntry(
ib));
948 this->SetPoint(ipnt, bindex + 1,
t0);
949 this->SetPointError(ipnt, 0,
dt0);
957 BoardtupleXe->Draw(
">>tmplistXe", Form(
"lay==%i && det==%i && mod==%i", ilay,
det, imod));
958 elist = (TEventList *)
gDirectory->Get(
"tmplistXe");
959 for (
int ib = 0;
ib < elist->GetN();
ib++)
962 BoardtupleXe->GetEntry(elist->GetEntry(
ib));
963 this->SetPoint(ipnt, bindex + 1,
t0);
964 this->SetPointError(ipnt, 0,
dt0);
975 this->fMaximum = maxy;
976 this->fMinimum = miny;
979 this->SetTitle(
"Barrel Board T0s A side");
983 this->SetTitle(
"Barrel Board T0s C side");
987 this->SetTitle(
"Endcap Board T0s A side");
991 this->SetTitle(
"Endcap Board T0s C side");
994 this->SetLineColor(4);
995 this->RemovePoint(0);
999 cout <<
" found " << ipnt <<
" board t0s " << endl;
1006 this->GetYaxis()->SetTitle(
"T0_{board} / ns");
1007 this->GetXaxis()->SetTitle(
"board #");
1008 this->GetYaxis()->SetRangeUser(-0.1 + miny, 0.1 + maxy);
1010 this->GetYaxis()->SetRangeUser(0.0, 20.0);
1013 this->GetXaxis()->SetRangeUser(minx, maxx);
1018 for (
int imod = 1; imod <= (floor(
int(maxx) /
nb)); imod++)
1020 TLine *lin =
new TLine((
float)imod *
nb + 0.5, miny, (
float)imod *
nb + 0.5, maxy);
1021 lin->SetLineStyle(2);
1034 double *
GetX() {
return this->fX; }
1035 double *
GetY() {
return this->fY; }
1042 cout <<
"In BoardVariationsDiff infile_data: " << string(infile_data) <<
" infile_ref: " << string(infile_ref) <<
" detector " <<
det << endl;
1046 float t0,
dt0, oldt0, bindex;
1055 this->SetName(Form(
"BoardT0VarDiff_%i",
det));
1057 unique_ptr<TFile> filedata(
new TFile(infile_data));
1058 unique_ptr<TFile> fileref(
new TFile(infile_ref));
1061 TNtuple *Boardtuple_data = (TNtuple *)filedata->Get(
"Board_Artuple");
1063 TNtuple *Boardtuple_ref = (TNtuple *)fileref->Get(
"Board_Artuple");
1065 Boardtuple_data->SetBranchAddress(
"t0", &
t0);
1066 Boardtuple_data->SetBranchAddress(
"dt0", &
dt0);
1067 Boardtuple_ref->SetBranchAddress(
"oldt0", &oldt0);
1070 for (
int imod = 0; imod < 32; imod++)
1072 for (
int ibrd = 0; ibrd < 9; ibrd++)
1075 bindex = 9 * imod + ibrd;
1077 Boardtuple_data->Draw(
">>tmplist", Form(
"brd==%i && det==%i && mod==%i", ibrd,
det, imod));
1078 TEventList *elist = (TEventList *)
gDirectory->Get(
"tmplist");
1079 for (
int ib = 0;
ib < elist->GetN();
ib++)
1082 Boardtuple_data->GetEntry(elist->GetEntry(
ib));
1083 Boardtuple_ref->GetEntry(elist->GetEntry(
ib));
1084 if ((
t0 - oldt0) < miny)
1086 if ((
t0 - oldt0) > maxy)
1088 this->SetPoint(ipnt, bindex + 1,
t0 - oldt0);
1089 this->SetPointError(ipnt, 0,
dt0);
1096 this->fMaximum = maxy + 0.2;
1097 this->fMinimum = miny - 0.2;
1099 throw std::runtime_error(
"detlet[det + 1] is out of bounds");
1101 this->SetTitle(Form(
"Board T0 - ref (%c-side)",
detlet[
det + 1]));
1102 this->SetLineColor(4);
1103 this->RemovePoint(0);
1107 cout <<
" found " << ipnt <<
" board t0s " << endl;
1114 this->GetYaxis()->SetTitle(
"T0_{board}-ref / ns");
1115 this->GetXaxis()->SetTitle(
"board #");
1117 this->GetYaxis()->SetRangeUser(-0.2 + miny, 0.2 + maxy);
1118 this->GetXaxis()->SetRangeUser(minx, maxx);
1123 TLine *lin =
new TLine(minx, 0, maxx, 0);
1124 lin->SetLineColor(2);
1126 for (
int imod = 1; imod <= (floor(
int(maxx) /
nb)); imod++)
1128 TLine *lin =
new TLine((
float)imod *
nb + 0.5, this->fMinimum, (
float)imod *
nb + 0.5, this->fMaximum);
1129 lin->SetLineStyle(2);
1142 double *
GetX() {
return this->fX; }
1143 double *
GetY() {
return this->fY; }
1150 cout <<
"In BoardVariationsOldT0 infile: " << string(
infile) <<
" detector " <<
det << endl;
1154 float oldt0, bindex;
1163 this->SetName(Form(
"BoardOldT0Var_%i",
det));
1168 TNtuple *Boardtuple = (TNtuple *)
file->Get(
"Board_Artuple");
1169 TNtuple *BoardtupleXe = (TNtuple *)
file->Get(
"Boardtuple");
1171 Boardtuple->SetBranchAddress(
"oldt0", &oldt0);
1173 BoardtupleXe->SetBranchAddress(
"oldt0", &oldt0);
1179 for (
int imod = 0; imod < 32; imod++)
1181 for (
int ibrd = 0; ibrd < 9; ibrd++)
1184 bindex = 9 * imod + ibrd;
1186 Boardtuple->Draw(
">>tmplist", Form(
"brd==%i && det==%i && mod==%i", ibrd,
det, imod));
1187 TEventList *elist = (TEventList *)
gDirectory->Get(
"tmplist");
1188 for (
int ib = 0;
ib < elist->GetN();
ib++)
1191 Boardtuple->GetEntry(elist->GetEntry(
ib));
1196 this->SetPoint(ipnt, bindex + 1, oldt0);
1202 else if (abs(
det) == 2)
1204 for (
int imod = 0; imod < 32; imod++)
1206 for (
int ilay = 0; ilay < 14; ilay++)
1209 bindex = 14 * imod + ilay;
1211 Boardtuple->Draw(
">>tmplist1", Form(
"lay==%i && det==%i && mod==%i", ilay,
det, imod));
1212 TEventList *elist = (TEventList *)
gDirectory->Get(
"tmplist1");
1213 for (
int ib = 0;
ib < elist->GetN();
ib++)
1216 Boardtuple->GetEntry(elist->GetEntry(
ib));
1217 this->SetPoint(ipnt, bindex + 1, oldt0);
1225 BoardtupleXe->Draw(
">>tmplistXe", Form(
"lay==%i && det==%i && mod==%i", ilay,
det, imod));
1226 elist = (TEventList *)
gDirectory->Get(
"tmplistXe");
1227 for (
int ib = 0;
ib < elist->GetN();
ib++)
1230 BoardtupleXe->GetEntry(elist->GetEntry(
ib));
1231 this->SetPoint(ipnt, bindex + 1, oldt0);
1242 this->fMaximum = maxy;
1243 this->fMinimum = miny;
1247 this->SetTitle(Form(
"Barrel Board T0s (%c-side)",
detlet[
det + 1]));
1252 throw std::runtime_error(
"detlet[det + 1] is out of bounds");
1254 this->SetTitle(Form(
"Endcap Board T0s (%c-side)",
detlet[
det + 1]));
1256 this->SetLineColor(4);
1257 this->RemovePoint(0);
1259 this->GetYaxis()->SetRangeUser(9, 10.7);
1263 cout <<
" found " << ipnt <<
" board t0s " << endl;
1270 this->GetYaxis()->SetTitle(
"T0_{board} / ns");
1271 this->GetXaxis()->SetTitle(
"board #");
1275 this->GetYaxis()->SetRangeUser(miny, maxy);
1276 this->GetXaxis()->SetRangeUser(minx, maxx);
1281 for (
int imod = 1; imod <= (floor(
int(maxx) /
nb)); imod++)
1283 TLine *lin =
new TLine((
float)imod *
nb + 0.5, miny, (
float)imod *
nb + 0.5, maxy);
1284 lin->SetLineStyle(2);
1298 double *
GetX() {
return this->fX; }
1299 double *
GetY() {
return this->fY; }
1308 float t0{},
dt0{}, bindex{};
1317 this->SetName(Form(
"BoardResVar_%i",
det));
1320 cout <<
"In BoardVariationsRes infile: " << string(
infile) <<
" detector " <<
det << endl;
1324 TNtuple *BoardtupleRes = (TNtuple *)
file->Get(
"Board_Artuple");
1325 TNtuple *BoardtupleXe = (TNtuple *)
file->Get(
"Boardtuple");
1327 BoardtupleRes->SetBranchAddress(
"res", &
t0);
1328 BoardtupleRes->SetBranchAddress(
"dres", &
dt0);
1331 BoardtupleXe->SetBranchAddress(
"res", &
t0);
1332 BoardtupleXe->SetBranchAddress(
"dres", &
dt0);
1338 for (
int imod = 0; imod < 32; imod++)
1340 for (
int ibrd = 0; ibrd < 9; ibrd++)
1343 bindex = 9 * imod + ibrd;
1345 BoardtupleRes->Draw(
">>tmplist", Form(
"brd==%i && det==%i && mod==%i", ibrd,
det, imod));
1346 TEventList *elist = (TEventList *)
gDirectory->Get(
"tmplist");
1347 for (
int ib = 0;
ib < elist->GetN();
ib++)
1350 BoardtupleRes->GetEntry(elist->GetEntry(
ib));
1356 this->SetPoint(ipnt, bindex + 1,
t0);
1357 this->SetPointError(ipnt, 0,
dt0);
1363 else if (abs(
det) == 2)
1365 for (
int imod = 0; imod < 32; imod++)
1367 for (
int ilay = 0; ilay < 14; ilay++)
1370 bindex = 14 * imod + ilay;
1372 BoardtupleRes->Draw(
">>tmplist1", Form(
"lay==%i && det==%i && mod==%i", ilay,
det, imod));
1373 TEventList *elist = (TEventList *)
gDirectory->Get(
"tmplist1");
1374 for (
int ib = 0;
ib < elist->GetN();
ib++)
1377 BoardtupleRes->GetEntry(elist->GetEntry(
ib));
1378 this->SetPoint(ipnt, bindex + 1,
t0);
1379 this->SetPointError(ipnt, 0,
dt0);
1387 BoardtupleXe->Draw(
">>tmplistXe", Form(
"lay==%i && det==%i && mod==%i", ilay,
det, imod));
1388 elist = (TEventList *)
gDirectory->Get(
"tmplistXe");
1389 for (
int ib = 0;
ib < elist->GetN();
ib++)
1392 BoardtupleXe->GetEntry(elist->GetEntry(
ib));
1393 this->SetPoint(ipnt, bindex + 1,
t0);
1394 this->SetPointError(ipnt, 0,
dt0);
1407 this->SetTitle(
"Barrel Board Residuals A side");
1411 this->SetTitle(
"Barrel Board Residuals C side");
1415 this->SetTitle(
"Endcap Board Residuals A side");
1419 this->SetTitle(
"Endcap Board Residuals C side");
1421 this->SetLineColor(4);
1422 this->RemovePoint(0);
1423 this->fMaximum = 0.200;
1424 this->fMinimum = 0.100;
1428 cout <<
" found " << ipnt <<
" board t0s " << endl;
1435 this->GetYaxis()->SetTitle(
"Residual{board} / um");
1436 this->GetXaxis()->SetTitle(
"board #");
1439 this->GetYaxis()->SetRangeUser(miny, maxy);
1440 this->GetXaxis()->SetRangeUser(minx, maxx);
1445 for (
int imod = 1; imod <= (floor(
int(maxx) /
nb)); imod++)
1447 TLine *lin =
new TLine((
float)imod *
nb + 0.5, miny, (
float)imod *
nb + 0.5, maxy);
1448 lin->SetLineStyle(2);
1462 double *
GetX() {
return this->fX; }
1463 double *
GetY() {
return this->fY; }
1472 cout <<
"In BoardVariationsTRes1 infile: " << string(
infile) <<
" detector " <<
det << endl;
1474 float t0{}, oldt0{},
dt0{}, bindex{}, t0offset{};
1483 this->SetName(Form(
"BoardT0Var_%i",
det));
1488 TNtuple *BoardtupleTRes = (TNtuple *)
file->Get(
"Board_Artuple");
1489 TNtuple *BoardtupleXe = (TNtuple *)
file->Get(
"Boardtuple");
1491 BoardtupleTRes->SetBranchAddress(
"t0", &
t0);
1492 BoardtupleTRes->SetBranchAddress(
"oldt0", &oldt0);
1493 BoardtupleTRes->SetBranchAddress(
"dt0", &
dt0);
1494 BoardtupleTRes->SetBranchAddress(
"t0offset", &t0offset);
1497 BoardtupleXe->SetBranchAddress(
"t0", &
t0);
1498 BoardtupleXe->SetBranchAddress(
"oldt0", &oldt0);
1499 BoardtupleXe->SetBranchAddress(
"dt0", &
dt0);
1500 BoardtupleXe->SetBranchAddress(
"t0offset", &t0offset);
1506 for (
int imod = 0; imod < 32; imod++)
1508 for (
int ibrd = 0; ibrd < 9; ibrd++)
1511 bindex = 9 * imod + ibrd;
1513 BoardtupleTRes->Draw(
">>tmplist", Form(
"brd==%i && det==%i && mod==%i", ibrd,
det, imod));
1514 TEventList *elist = (TEventList *)
gDirectory->Get(
"tmplist");
1515 for (
int ib = 0;
ib < elist->GetN();
ib++)
1518 BoardtupleTRes->GetEntry(elist->GetEntry(
ib));
1519 if ((
t0 - oldt0) < miny)
1521 if ((
t0 - oldt0) > maxy)
1523 this->SetPoint(ipnt, bindex + 1,
t0 - oldt0);
1524 this->SetPointError(ipnt, 0,
dt0);
1530 else if (abs(
det) == 2)
1532 for (
int imod = 0; imod < 32; imod++)
1534 for (
int ilay = 0; ilay < 14; ilay++)
1537 bindex = 14 * imod + ilay;
1539 BoardtupleTRes->Draw(
">>tmplist1", Form(
"lay==%i && det==%i && mod==%i", ilay,
det, imod));
1540 TEventList *elist = (TEventList *)
gDirectory->Get(
"tmplist1");
1541 for (
int ib = 0;
ib < elist->GetN();
ib++)
1544 BoardtupleTRes->GetEntry(elist->GetEntry(
ib));
1545 if ((
t0 - oldt0) < miny)
1547 if ((
t0 - oldt0) > maxy)
1549 this->SetPoint(ipnt, bindex + 1,
t0 - oldt0);
1550 this->SetPointError(ipnt, 0,
dt0);
1554 BoardtupleXe->Draw(
">>tmplistXe", Form(
"lay==%i && det==%i && mod==%i", ilay,
det, imod));
1555 elist = (TEventList *)
gDirectory->Get(
"tmplistXe");
1556 for (
int ib = 0;
ib < elist->GetN();
ib++)
1559 BoardtupleXe->GetEntry(elist->GetEntry(
ib));
1560 if ((
t0 - oldt0) < miny)
1562 if ((
t0 - oldt0) > maxy)
1564 this->SetPoint(ipnt, bindex + 1,
t0 - oldt0);
1565 this->SetPointError(ipnt, 0,
dt0);
1574 this->SetTitle(
"Barrel Board T0 Difference (A side)");
1578 this->SetTitle(
"Barrel Board T0 Difference (C side)");
1582 this->SetTitle(
"Endcap Board T0 Difference (A side)");
1586 this->SetTitle(
"Endcap Board T0 Difference (C side)");
1588 this->SetLineColor(4);
1589 this->RemovePoint(0);
1590 this->GetYaxis()->SetRangeUser(9, 10.7);
1594 cout <<
" found " << ipnt <<
" board t0s " << endl;
1601 this->GetYaxis()->SetTitle(
"Board T0 Difference / ns");
1602 this->GetXaxis()->SetTitle(
"board #");
1606 this->GetYaxis()->SetRangeUser(miny, maxy);
1607 this->GetXaxis()->SetRangeUser(minx, maxx);
1609 TLine *lin =
new TLine(minx, 0, maxx, 0);
1611 TLine *lin1 =
new TLine(minx, 0.3, maxx, 0.3);
1612 lin1->SetLineStyle(2);
1614 TLine *lin2 =
new TLine(minx, -0.3, maxx, -0.3);
1615 lin2->SetLineStyle(2);
1619 for (
int imod = 1; imod <= (floor(
int(maxx) / 9)); imod++)
1622 TLine *lin =
new TLine((
float)imod * 9 + 0.5, miny, (
float)imod * 9 + 0.5, maxy);
1623 lin->SetLineStyle(2);
1637 double *
GetX() {
return this->fX; }
1638 double *
GetY() {
return this->fY; }
1647 float t0,
dt0, bindex;
1656 this->SetName(Form(
"BoardT0Var_%i",
det));
1660 cout <<
"In BoardVariationsTRes infile: " << string(
infile) <<
" detector " <<
det << endl;
1662 TNtuple *BoardtupleTRes = (TNtuple *)
file->Get(
"Board_Artuple");
1663 TNtuple *BoardtupleXe = (TNtuple *)
file->Get(
"Boardtuple");
1665 BoardtupleTRes->SetBranchAddress(
"tres", &
t0);
1666 BoardtupleTRes->SetBranchAddress(
"dres", &
dt0);
1669 BoardtupleXe->SetBranchAddress(
"tres", &
t0);
1670 BoardtupleXe->SetBranchAddress(
"dres", &
dt0);
1676 for (
int imod = 0; imod < 32; imod++)
1678 for (
int ibrd = 0; ibrd < 9; ibrd++)
1681 bindex = 9 * imod + ibrd;
1683 BoardtupleTRes->Draw(
">>tmplist", Form(
"brd==%i && det==%i && mod==%i", ibrd,
det, imod));
1684 TEventList *elist = (TEventList *)
gDirectory->Get(
"tmplist");
1685 for (
int ib = 0;
ib < elist->GetN();
ib++)
1688 BoardtupleTRes->GetEntry(elist->GetEntry(
ib));
1689 this->SetPoint(ipnt, bindex + 1,
t0);
1690 this->SetPointError(ipnt, 0,
dt0);
1700 else if (abs(
det) == 2)
1702 for (
int imod = 0; imod < 32; imod++)
1704 for (
int ilay = 0; ilay < 14; ilay++)
1707 bindex = 14 * imod + ilay;
1709 BoardtupleTRes->Draw(
">>tmplist1", Form(
"lay==%i && det==%i && mod==%i", ilay,
det, imod));
1710 TEventList *elist = (TEventList *)
gDirectory->Get(
"tmplist1");
1711 for (
int ib = 0;
ib < elist->GetN();
ib++)
1714 BoardtupleTRes->GetEntry(elist->GetEntry(
ib));
1715 this->SetPoint(ipnt, bindex + 1,
t0);
1716 this->SetPointError(ipnt, 0,
dt0);
1724 BoardtupleXe->Draw(
">>tmplistXe", Form(
"lay==%i && det==%i && mod==%i", ilay,
det, imod));
1725 elist = (TEventList *)
gDirectory->Get(
"tmplistXe");
1726 for (
int ib = 0;
ib < elist->GetN();
ib++)
1729 BoardtupleXe->GetEntry(elist->GetEntry(
ib));
1730 this->SetPoint(ipnt, bindex + 1,
t0);
1731 this->SetPointError(ipnt, 0,
dt0);
1742 this->fMaximum = maxy;
1743 this->fMinimum = miny;
1747 this->SetTitle(Form(
"Barrel Board Sigma Time Residuals (%c-side)",
detlet[
det + 1]));
1752 throw std::out_of_range(
"Out-of-bounds access to the detlet array");
1754 this->SetTitle(Form(
"Endcap Board Sigma Time Residuals (%c-side)",
detlet[
det + 1]));
1756 this->SetLineColor(4);
1757 this->RemovePoint(0);
1761 cout <<
" found " << ipnt <<
" board t0s " << endl;
1768 this->GetYaxis()->SetTitle(
"Board Sigma Time Residuals/ ns");
1769 this->GetXaxis()->SetTitle(
"board #");
1773 this->GetYaxis()->SetRangeUser(miny, maxy);
1774 this->GetXaxis()->SetRangeUser(minx, maxx);
1776 TLine *lin =
new TLine(minx, 0, maxx, 0);
1778 TLine *lin1 =
new TLine(minx, 0.3, maxx, 0.3);
1779 lin1->SetLineStyle(2);
1781 TLine *lin2 =
new TLine(minx, -0.3, maxx, -0.3);
1782 lin2->SetLineStyle(2);
1787 for (
int imod = 1; imod <= (floor(
int(maxx) /
nb)); imod++)
1789 TLine *lin =
new TLine((
float)imod *
nb + 0.5, miny, (
float)imod *
nb + 0.5, maxy);
1790 lin->SetLineStyle(2);
1800 DvGraph(
char *,
string,
const string &,
int,
int,
bool);
1808 this->SetName(Form(
"Dv_%i_%i",
det, lay));
1810 vector<string> levels;
1814 if (
const auto f =
path.find(
',');
f==std::string::npos ){
1817 levels.push_back(
path.substr(0,
f));
1818 path.erase(
f+1,std::string::npos);
1821 levels.push_back(
path.substr(0,
path.find(
",")));
1822 cout <<
" In DvGraph folder: " <<
folder <<
" det " <<
det <<
" lay " << lay << endl;
1823 for (
unsigned int i = 0;
i < levels.size();
i++)
1824 cout <<
" " << levels.at(
i);
1831 TDirectory *trt = (TDirectory *)
file->FindKey(
"TRT_all")->ReadObj();
1834 TDirectory *thisdet = (TDirectory *)trt->FindKey(
folder.c_str())->ReadObj();
1835 cout <<
"PLOT FOR " <<
folder << endl;
1836 if (thisdet->FindKey(
"rtgraph"))
1838 rtgraph = (TGraphErrors *)thisdet->FindKey(
"rtgraph")->ReadObj();
1839 cout <<
"found rtgraph " <<
folder << endl;
1844 cout <<
"did not find rtgraph " <<
folder << endl;
1847 else if (trt->FindKey(
"rtgraph"))
1849 rtgraph = (TGraphErrors *)trt->FindKey(
"rtgraph")->ReadObj();
1850 cout <<
"no folder, but found rtgraph " <<
folder << endl;
1855 cout <<
"no folder, no rtgraph " <<
folder << endl;
1861 TF1 *rtfunc = (TF1 *)rtgraph->GetListOfFunctions()->First();
1863 double p0 = rtfunc->GetParameter(0);
1864 double p1 = rtfunc->GetParameter(1);
1865 double p2 = rtfunc->GetParameter(2);
1866 double p3 = rtfunc->GetParameter(3);
1868 cout <<
" R-t PARAMETERS: " <<
p0 <<
" " <<
p1 <<
" " <<
p2 <<
" " <<
p3 << endl;
1870 bool isdines =
false;
1876 vrrelation =
"x*[2]/sqrt([0]*[0]+x*x)";
1878 vrrelation =
"sqrt([0]*[0]+x*x)/(x*[2])";
1880 TF1 *vr1 =
new TF1(
"vr-relation", vrrelation.c_str(), 0.0001, 2.0);
1881 vr1->SetParameters(
p0,
p1,
p2);
1883 for (
int i = 0;
i <= 100;
i++)
1885 float r = 0.1 + (2.0 - 0.1) * (
float)
i / 100;
1886 float v1 = vr1->Eval(
r, 0, 0, 0);
1887 this->SetPoint(
i,
r, v1);
1895 cout <<
" USING POLYNOMIAL R-t RELATION" << endl;
1897 string rtrelation =
"[0]+x*([1]+x*([2]+x*[3]))";
1900 vtrelation =
"1/([0]+2*x*[1]+3*x*x*[2])";
1902 vtrelation =
"[0]+2*x*[1]+3*x*x*[2]";
1904 TF1 *rt1 =
new TF1(
"rt-relation", rtrelation.c_str(), -10000, 10000);
1905 rt1->SetParameters(
p0,
p1,
p2,
p3);
1906 TF1 *vt1 =
new TF1(
"vt-relation", vtrelation.c_str(), -10000, 10000);
1907 vt1->SetParameters(
p1,
p2,
p3);
1909 for (
int i = 0;
i <= 100;
i++)
1911 float r = 0.1 + (2.0 - 0.1) * (
float)
i / 100;
1912 float t1 = rt1->GetX(
r, -10000, 10000);
1913 float v1 = vt1->Eval(
t1, 0, 0, 0);
1914 this->SetPoint(
i,
r, v1);
1929 DGraph(
char *,
string,
string,
int,
int,
bool);
1937 this->SetName(Form(
"Dv_%i_%i",
det, lay));
1939 vector<string> levels;
1942 if (
const auto f =
path.find(
',');
f==std::string::npos ){
1945 levels.push_back(
path.substr(0,
f));
1949 levels.push_back(
path.substr(0,
path.find(
',')));
1954 cout <<
" In DGraph. Folder: " <<
folder <<
" det " <<
det <<
" lay " << lay << endl;
1955 for (
unsigned int i = 0;
i < levels.size();
i++)
1956 cout <<
" " << levels.at(
i);
1958 cout <<
" infile:" << string(
infile) << endl;
1960 TDirectory *trt = (TDirectory *)
file->FindKey(
"TRT_all")->ReadObj();
1963 TDirectory *thisDet = (TDirectory *)trt->FindKey(
folder.c_str())->ReadObj();
1964 cout <<
"PLOT FOR " <<
folder << endl;
1965 if (thisDet->FindKey(
"rtgraph"))
1967 rtgraph = (TGraphErrors *)thisDet->FindKey(
"rtgraph")->ReadObj();
1968 cout <<
" folder: " <<
folder <<
" found rtgraph " << endl;
1973 cout <<
" folder: " <<
folder <<
" did not find rtgraph " << endl;
1976 else if (trt->FindKey(
"rtgraph"))
1978 rtgraph = (TGraphErrors *)trt->FindKey(
"rtgraph")->ReadObj();
1979 cout <<
" no folder, found rtgraph " << endl;
1984 cout <<
" no folder, no rtgraph " << endl;
1989 TF1 *rtfunc = (TF1 *)rtgraph->GetListOfFunctions()->First();
1991 double p0 = rtfunc->GetParameter(0);
1992 double p1 = rtfunc->GetParameter(1);
1993 double p2 = rtfunc->GetParameter(2);
1994 double p3 = rtfunc->GetParameter(3);
1996 cout <<
" R-t PARAMETERS: " <<
p0 <<
" " <<
p1 <<
" " <<
p2 <<
" " <<
p3 << endl;
1998 bool isdines =
false;
2005 vrrelation =
"x*[2]/sqrt([0]*[0]+x*x)";
2007 vrrelation =
"sqrt([0]*[0]+x*x)/(x*[2])";
2009 TF1 *vr1 =
new TF1(
"vr-relation", vrrelation.c_str(), 0.0001, 2.0);
2010 vr1->SetParameters(
p0,
p1,
p2);
2012 for (
int i = 0;
i <= 100;
i++)
2014 float r = 0.1 + (2.0 - 0.1) * (
float)
i / 100;
2015 float v1 = vr1->Eval(
r, 0, 0, 0);
2016 this->SetPoint(
i,
r, v1);
2023 cout <<
" USING POLYNOMIAL R-t RELATION" << endl;
2025 string rtrelation =
"[0]+x*([1]+x*([2]+x*[3]))";
2028 vtrelation =
"1/([0]+2*x*[1]+3*x*x*[2])";
2030 vtrelation =
"[0]+2*x*[1]+3*x*x*[2]";
2032 TF1 *rt1 =
new TF1(
"rt-relation", rtrelation.c_str(), -10000, 10000);
2033 rt1->SetParameters(
p0,
p1,
p2,
p3);
2034 TF1 *vt1 =
new TF1(
"vt-relation", vtrelation.c_str(), -10000, 10000);
2035 vt1->SetParameters(
p1,
p2,
p3);
2037 for (
int i = 0;
i <= 1000;
i++)
2039 float t1 = -5 +
i * 0.05;
2040 float r1 = rt1->Eval(
t1, 0, 0, 0);
2041 this->SetPoint(
i,
t1, r1);
2056 RtGraphs(
char *,
const string& ,
bool);
2058 TGraphErrors *rtgraph{};
2059 TGraphErrors *trgraph{};
2066 this->SetName(Form(
"Rt_%s",
folder.c_str()));
2069 cout <<
"in RtGraphs. Infile: " << string(
infile) << endl;
2071 TDirectory *trt =
nullptr;
2073 map<string, string> titlemap;
2077 trt = (TDirectory *)
file->FindKey(
"TRT_all")->ReadObj();
2078 titlemap[
"WholeBarrel_1"] =
"whole barrel";
2079 titlemap[
"Detector_-1"] =
"barrel C";
2080 titlemap[
"Detector_1"] =
"barrel A";
2081 titlemap[
"Detector_-2"] =
"end-cap C";
2082 titlemap[
"Detector_2"] =
"end-cap A";
2084 cout <<
" Xenon. Found TRT_all " << endl;
2086 cout <<
" Xenon. Did not find TRT_all " << endl;
2092 trt = (TDirectory *)
file->FindKey(
"TRT_Ar_all")->ReadObj();
2093 titlemap[
"WholeBarrel_Ar_1"] =
"whole Ar barrel";
2094 titlemap[
"Detector_Ar_-1"] =
"barrel Ar C";
2095 titlemap[
"Detector_Ar_1"] =
"barrel Ar A";
2096 titlemap[
"Detector_Ar_-2"] =
"end-cap Ar C";
2097 titlemap[
"Detector_Ar_2"] =
"end-cap Ar A";
2099 cout <<
" Argon. Found TRT_Ar_all " << endl;
2101 cout <<
" Argon. Did not find TRT_Ar_all " << endl;
2104 if (trt and (not
folder.empty()))
2106 cout <<
" PLOT FOR " <<
folder << endl;
2107 TDirectory *
det = (TDirectory *)trt->FindKey(
folder.c_str())->ReadObj();
2108 if (
det->FindKey(
"rt-relation"))
2110 cout <<
" found rt-relation " << endl;
2111 rthist = (
TH2F *)
det->FindKey(
"rt-relation")->ReadObj();
2113 rthist->GetXaxis()->SetRangeUser(0, 40);
2115 sprintf(
name,
"rt (%s)", titlemap[
folder].c_str());
2116 rthist->SetTitle(
name);
2117 if (
det->FindKey(
"rtgraph"))
2119 rtgraph = (TGraphErrors *)
det->FindKey(
"rtgraph")->ReadObj();
2120 cout <<
" found also rtgraph " << endl;
2125 cout <<
" did not found rtgraph " << endl;
2127 if (
det->FindKey(
"trgraph"))
2129 trgraph = (TGraphErrors *)
det->FindKey(
"trgraph")->ReadObj();
2130 cout <<
" found also trgraph " << endl;
2135 cout <<
" did not found trgraph " << endl;
2137 if (
det->FindKey(
"oldrtfunc"))
2139 oldrtfunc = (TF1 *)
det->FindKey(
"oldrtfunc")->ReadObj();
2140 cout <<
" found also oldrtfunc " << endl;
2144 oldrtfunc =
nullptr;
2145 cout <<
" did not find oldrtfunc " << endl;
2150 throw string(
" NO RT OBJECTS FOUND");
2153 else if (trt and trt->FindKey(
"rt-relation"))
2155 cout <<
" No folder. Found rt-relation. PLOT FOR TRT" << endl;
2156 rthist = (
TH2F *)trt->FindKey(
"rt-relation")->ReadObj();
2158 rthist->GetXaxis()->SetRangeUser(0, 40);
2159 rthist->SetTitle(
"r(t) for whole TRT");
2160 if (trt->FindKey(
"rtgraph"))
2162 rtgraph = (TGraphErrors *)trt->FindKey(
"rtgraph")->ReadObj();
2163 cout <<
" found also rtgraph " << endl;
2168 cout <<
" did not find rtgraph " << endl;
2170 if (trt->FindKey(
"trgraph"))
2172 trgraph = (TGraphErrors *)trt->FindKey(
"trgraph")->ReadObj();
2173 cout <<
" found also trgraph " << endl;
2178 cout <<
" did not find trgraph " << endl;
2180 if (trt->FindKey(
"oldrtfunc"))
2182 oldrtfunc = (TF1 *)trt->FindKey(
"oldrtfunc")->ReadObj();
2183 cout <<
" found also oldtrtfunc " << endl;
2187 oldrtfunc =
nullptr;
2188 cout <<
" did not find oldtrtfunc " << endl;
2193 cout <<
" No folder. No rt-relation." << endl;
2196 oldrtfunc =
nullptr;
2200 this->Divide(2, 1, 0.01, 0.01);
2203 TPad *c1_3 =
new TPad(
"c1_3",
"newpad", 0.01, 0.33, 0.99, 0.99);
2206 c1_3->SetTopMargin(0.1);
2207 c1_3->SetBottomMargin(0.01);
2208 c1_3->SetRightMargin(0.1);
2209 c1_3->SetFillStyle(0);
2216 cout <<
" found rtgraph for entire TRT " << endl;
2217 rtgraph->SetTitle(
"r(t) fit (whole TRT)");
2221 cout <<
" found rtgraph for folder: " <<
folder << endl;
2222 rtgraph->SetTitle(titlemap[
folder].c_str());
2224 cout <<
" set rtgraph X title t-T0/ns and Y title |r|_{track}/mm" << endl;
2226 rtgraph->GetXaxis()->SetTitle(
"t-T0/ns");
2227 rtgraph->GetYaxis()->SetTitle(
"|r|_{track}/mm");
2229 rtgraph->GetXaxis()->SetTitleSize(0.06);
2230 rtgraph->GetXaxis()->SetLabelSize(0.06);
2233 rtgraph->SetMarkerStyle(20);
2234 rtgraph->SetMarkerSize(0.5);
2235 rtgraph->GetYaxis()->SetRangeUser(-0.05, 2.6);
2236 cout <<
" Draw rtgraph " << endl;
2237 rtgraph->Draw(
"ap");
2239 if (rtgraph->GetFunction(
"rtfunc"))
2240 newRT = rtgraph->GetFunction(
"rtfunc");
2242 newRT = rtgraph->GetFunction(
"rtfunc2");
2245 cout <<
" Draw new fit " << endl;
2246 newRT->SetLineWidth(1);
2247 newRT->Draw(
"same");
2251 oldrtfunc->SetLineColor(1);
2252 oldrtfunc->SetLineWidth(1);
2253 oldrtfunc->SetLineStyle(2);
2254 cout <<
" Draw old fit " << endl;
2255 oldrtfunc->Draw(
"same");
2259 TLegend *
leg =
new TLegend(0.7155172, 0.1038136, 0.8965517, 0.2542373,
nullptr,
"brNDC");
2260 leg->AddEntry(rtgraph,
"Data",
"p");
2261 leg->AddEntry(newRT,
"Fit",
"l");
2262 leg->AddEntry(oldrtfunc,
"Fit old rt",
"l");
2263 leg->SetTextSize(0.03);
2267 if (oldrtfunc && newRT)
2271 TPad *c1_4 =
new TPad(
"c1_4",
"newpad", 0.01, 0, 0.99, 0.32);
2274 c1_4->SetTopMargin(0.01);
2275 c1_4->SetBottomMargin(0.3);
2276 c1_4->SetRightMargin(0.1);
2277 c1_4->SetFillStyle(0);
2280 Double_t Xmax = rtgraph->GetXaxis()->GetXmax();
2281 Double_t
Xmin = rtgraph->GetXaxis()->GetXmin();
2283 const Int_t
n = 300;
2287 Double_t Ymax = -10;
2290 for (Int_t
i = 0;
i <
n;
i++)
2293 y[
i] = (oldrtfunc->Eval(
x[
i]) - newRT->Eval(
x[
i]));
2300 TGraph *
gr1 =
new TGraph(
n,
x,
y);
2303 gr1->GetXaxis()->SetTitle(
"t-T0/ns");
2304 gr1->GetXaxis()->SetRangeUser(
Xmin, Xmax);
2305 gr1->GetYaxis()->SetTitle(
"Old r(t) - New r(t) /mm");
2306 gr1->GetYaxis()->SetRangeUser(-0.1, 0.1);
2308 gr1->GetYaxis()->SetNdivisions(5);
2309 gr1->GetXaxis()->SetTitleSize(0.06);
2310 gr1->GetXaxis()->SetLabelSize(0.06);
2311 gr1->GetYaxis()->SetLabelSize(0.08);
2312 gr1->GetYaxis()->SetTitleOffset(0.8);
2313 gr1->GetYaxis()->SetTitleSize(0.06);
2314 gr1->SetLineStyle(2);
2318 const Int_t
n1 = rtgraph->GetN();
2322 for (Int_t
i = 0;
i <
n1;
i++)
2326 rtgraph->GetPoint(
i,
X,
Y);
2328 y1.at(
i) =
Y - newRT->Eval(
X);
2330 ey1.at(
i) = rtgraph->GetErrorY(
i);
2331 if (
y1.at(
i) > Ymax)
2335 if (
y1.at(
i) < Ymin)
2341 TGraphErrors *
gr2 =
new TGraphErrors(
n1, &
x1.at(0), &
y1.at(0), &
ex1.at(0), &ey1.at(0));
2342 gr2->SetMarkerColor(2);
2343 gr2->SetMarkerStyle(20);
2345 gr2->GetYaxis()->SetTitle(
"Old r(t) - New r(t) /mm");
2347 gr2->GetYaxis()->SetRangeUser(-0.2, 0.2);
2348 gr2->GetXaxis()->SetRangeUser(-5, 50);
2349 cout <<
" Draw difference " << endl;
2353 TLine *line0 =
new TLine(
Xmin, 0, Xmax, 0);
2354 line0->SetLineColor(4);
2360 cout <<
" nullptr rtgraph " << endl;
2368 trgraph->SetTitle(
"t(r) fit (whole TRT)");
2372 sprintf(
name,
"t(r) fit (%s)", titlemap[
string(std::move(
folder))].c_str());
2373 trgraph->SetTitle(
name);
2376 trgraph->GetYaxis()->SetTitle(
"t-T0/ns");
2377 trgraph->GetXaxis()->SetTitle(
"|r|_{track}/mm");
2379 trgraph->SetMarkerStyle(20);
2380 trgraph->SetMarkerSize(0.5);
2381 cout <<
" Draw trgraph " << endl;
2382 trgraph->Draw(
"ap");
2386 cout <<
" nullptr trgraph " << endl;
2389 gStyle->SetOptStat(1);
2403 char selectionA[500];
2404 sprintf(selectionA,
"%s*(det==2)",
variable.c_str());
2405 char selectionC[500];
2406 sprintf(selectionC,
"%s*(det==-2)",
variable.c_str());
2412 TNtuple *Chiptuple =
nullptr;
2413 TNtuple *Moduletuple =
nullptr;
2417 Chiptuple = (TNtuple *)
file->Get(
"Chiptuple");
2418 Moduletuple = (TNtuple *)
file->Get(
"Moduletuple");
2422 Chiptuple = (TNtuple *)
file->Get(
"Chip_Artuple");
2423 Moduletuple = (TNtuple *)
file->Get(
"Module_Artuple");
2426 this->SetName(
"c1");
2428 this->Divide(2, 2, 0.01, 0.01);
2429 ((TPad *)this->GetPrimitive(
"c1_1"))->SetFrameFillColor(1);
2430 ((TPad *)this->GetPrimitive(
"c1_2"))->SetFrameFillColor(1);
2431 ((TPad *)this->GetPrimitive(
"c1_3"))->SetFrameFillColor(1);
2432 ((TPad *)this->GetPrimitive(
"c1_4"))->SetFrameFillColor(1);
2434 gStyle->SetPalette(1);
2438 Moduletuple->Draw(
"mod:lay>>reshist10(14,0,14,32,0,32)", selectionA,
"colz");
2439 TH2F *reshist10 = (
TH2F *)gPad->GetPrimitive(
"reshist10");
2441 if (reshist10->GetEntries() > 1)
2445 sprintf(title1,
"Phi Sector VS Wheel %s (EC side A)",
variable.c_str());
2447 sprintf(title1,
"Argon Phi Sector VS Wheel %s (EC side A)",
variable.c_str());
2448 reshist10->SetTitle(title1);
2449 reshist10->SetStats(0);
2450 reshist10->GetXaxis()->SetLabelOffset(1000);
2451 reshist10->GetYaxis()->SetLabelOffset(1000);
2452 reshist10->GetXaxis()->SetTitle(
"Wheel (Z)");
2453 reshist10->GetYaxis()->SetTitle(
"Phi sector");
2456 reshist10->GetZaxis()->SetRangeUser(1, 6);
2457 reshist10->GetZaxis()->SetNdivisions(6);
2461 reshist10->GetZaxis()->SetRangeUser(0.10, 0.20);
2463 else if (
variable ==
"abs(resMean)")
2465 reshist10->GetZaxis()->SetRangeUser(0.0, 0.05);
2469 reshist10->GetZaxis()->SetRangeUser(2, 14);
2471 else if (
variable ==
"abs(t0-oldt0)")
2473 reshist10->GetZaxis()->SetRangeUser(0.0, 0.6);
2477 reshist10->GetZaxis()->SetRangeUser(2.0, 4.5);
2482 Chiptuple->Draw(
"mod:chp>>histC(248,84,332,32,0,32)", selectionA,
"colz");
2483 TH2F *histC = (
TH2F *)gPad->GetPrimitive(
"histC");
2485 sprintf(title3,
"Chip %s (EC side A)",
variable.c_str());
2487 sprintf(title3,
"Argon Chip %s (EC side A)",
variable.c_str());
2488 histC->SetTitle(title3);
2490 if (histC->GetEntries() > 1)
2494 histC->GetXaxis()->SetLabelOffset(1000);
2495 histC->GetYaxis()->SetLabelOffset(1000);
2496 histC->GetXaxis()->SetTitle(
"Chip number");
2497 histC->GetYaxis()->SetTitle(
"Phi sector");
2500 histC->GetZaxis()->SetRangeUser(1, 6);
2501 histC->GetZaxis()->SetNdivisions(6);
2505 histC->GetZaxis()->SetRangeUser(0.10, 0.20);
2507 else if (
variable ==
"abs(resMean)")
2509 histC->GetZaxis()->SetRangeUser(0.0, 0.05);
2513 histC->GetZaxis()->SetRangeUser(2, 14);
2515 else if (
variable ==
"abs(t0-oldt0)")
2517 histC->GetZaxis()->SetRangeUser(0.0, 0.6);
2521 histC->GetZaxis()->SetRangeUser(2.0, 4.5);
2527 TLine *lin11 =
new TLine(84, lowe, 84, upe);
2528 lin11->SetLineStyle(2);
2530 TLine *lin12 =
new TLine(107, lowe, 107, upe);
2531 lin12->SetLineStyle(2);
2533 TLine *lin13 =
new TLine(131, lowe, 131, upe);
2534 lin13->SetLineStyle(2);
2536 TLine *lin14 =
new TLine(155, lowe, 155, upe);
2537 lin14->SetLineStyle(2);
2539 TLine *lin15 =
new TLine(179, lowe, 179, upe);
2540 lin15->SetLineStyle(2);
2542 TLine *lin16 =
new TLine(203, lowe, 203, upe);
2543 lin16->SetLineStyle(2);
2545 TLine *lin17 =
new TLine(227, lowe, 227, upe);
2546 lin17->SetLineStyle(2);
2548 TLine *lin18 =
new TLine(239, lowe, 239, upe);
2549 lin18->SetLineStyle(2);
2554 Moduletuple->Draw(
"mod:lay>>reshist11(14,0,14,32,0,32)", selectionC,
"colz");
2555 TH2F *reshist11 = (
TH2F *)gPad->GetPrimitive(
"reshist11");
2557 if (reshist11->GetEntries() > 1)
2561 sprintf(title4,
"Phi Sector VS Wheel %s (EC side C)",
variable.c_str());
2563 sprintf(title4,
"Argon Phi Sector VS Wheel %s (EC side C)",
variable.c_str());
2564 reshist11->SetTitle(title4);
2565 reshist11->SetMarkerStyle(21);
2566 reshist11->SetStats(0);
2567 reshist11->GetXaxis()->SetLabelOffset(1000);
2568 reshist11->GetYaxis()->SetLabelOffset(1000);
2569 reshist11->GetXaxis()->SetTitle(
"Layer (Z)");
2570 reshist11->GetYaxis()->SetTitle(
"Phi sector");
2573 reshist11->GetZaxis()->SetRangeUser(1, 6);
2574 reshist11->GetZaxis()->SetNdivisions(6);
2576 TLegend *
leg =
new TLegend(0.99, 0.35, 0.55, 0.01,
"T0 fit type");
2578 TH2F *
h1 =
new TH2F(
"h1",
"h1 title", 40, 0, 4, 30, -3, 3);
2579 h1->SetMarkerColor(54);
2580 h1->SetMarkerStyle(21);
2582 TH2F *h2 =
new TH2F(
"h2",
"h2 title", 40, 0, 4, 30, -3, 3);
2583 h2->SetMarkerColor(4);
2584 h2->SetMarkerStyle(21);
2586 TH2F *h3 =
new TH2F(
"h3",
"h3 title", 40, 0, 4, 30, -3, 3);
2587 h3->SetMarkerColor(7);
2588 h3->SetMarkerStyle(21);
2590 TH2F *h4 =
new TH2F(
"h4",
"h4 title", 40, 0, 4, 30, -3, 3);
2591 h4->SetMarkerColor(81);
2592 h4->SetMarkerStyle(21);
2594 TH2F *h5 =
new TH2F(
"h5",
"h5 title", 40, 0, 4, 30, -3, 3);
2595 h5->SetMarkerColor(kYellow);
2596 h5->SetMarkerStyle(21);
2598 TH2F *h6 =
new TH2F(
"h6",
"h6 title", 40, 0, 4, 30, -3, 3);
2599 h6->SetMarkerColor(kRed);
2600 h6->SetMarkerStyle(21);
2602 leg->AddEntry(
h1,
"1: |mean|>5",
"P");
2603 leg->AddEntry(h2,
"2: normal fit",
"P");
2604 leg->AddEntry(h3,
"3: used chip ref",
"P");
2605 leg->AddEntry(h4,
"4: Low stat",
"P");
2606 leg->AddEntry(h5,
"5: No T0 Cal",
"P");
2607 leg->AddEntry(h6,
"6: Wrong fit. Mean used",
"P");
2608 leg->SetTextSize(0.04);
2613 reshist11->GetZaxis()->SetRangeUser(0.1, 0.20);
2615 else if (
variable ==
"abs(resMean)")
2617 reshist11->GetZaxis()->SetRangeUser(0.0, 0.05);
2621 reshist11->GetZaxis()->SetRangeUser(2, 14);
2623 else if (
variable ==
"abs(t0-oldt0)")
2625 reshist11->GetZaxis()->SetRangeUser(0.0, 0.6);
2629 reshist11->GetZaxis()->SetRangeUser(2.0, 4.5);
2633 Chiptuple->Draw(
"mod:chp>>histC1(248,84,332,32,0,32)", selectionC,
"colz");
2634 TH2F *histC1 = (
TH2F *)gPad->GetPrimitive(
"histC1");
2636 sprintf(title5,
"Chip %s (EC side C)",
variable.c_str());
2638 sprintf(title5,
"Argon Chip %s (EC side C)",
variable.c_str());
2639 histC1->SetTitle(title5);
2641 if (histC1->GetEntries() > 1)
2644 histC1->SetStats(0);
2645 histC1->GetXaxis()->SetLabelOffset(1000);
2646 histC1->GetYaxis()->SetLabelOffset(1000);
2647 histC1->GetXaxis()->SetTitle(
"Chip number");
2648 histC1->GetYaxis()->SetTitle(
"Phi sector");
2651 histC1->GetZaxis()->SetRangeUser(1, 6);
2652 histC1->GetZaxis()->SetNdivisions(6);
2656 histC1->GetZaxis()->SetRangeUser(0.10, 0.20);
2658 else if (
variable ==
"abs(resMean)")
2660 histC1->GetZaxis()->SetRangeUser(0.0, 0.05);
2664 histC1->GetZaxis()->SetRangeUser(2, 14);
2666 else if (
variable ==
"abs(t0-oldt0)")
2668 histC1->GetZaxis()->SetRangeUser(0.0, 0.6);
2672 histC1->GetZaxis()->SetRangeUser(2.0, 4.5);
2675 TLine *lin1 =
new TLine(84, lowe, 84, upe);
2676 lin1->SetLineStyle(2);
2678 TLine *lin2 =
new TLine(108, lowe, 108, upe);
2679 lin2->SetLineStyle(2);
2681 TLine *lin3 =
new TLine(132, lowe, 132, upe);
2682 lin3->SetLineStyle(2);
2684 TLine *lin4 =
new TLine(156, lowe, 156, upe);
2685 lin4->SetLineStyle(2);
2687 TLine *lin5 =
new TLine(180, lowe, 180, upe);
2688 lin5->SetLineStyle(2);
2690 TLine *lin6 =
new TLine(204, lowe, 204, upe);
2691 lin6->SetLineStyle(2);
2693 TLine *lin7 =
new TLine(228, lowe, 228, upe);
2694 lin7->SetLineStyle(2);
2696 TLine *lin8 =
new TLine(240, lowe, 239, upe);
2697 lin8->SetLineStyle(2);
2708 RtColor(
char *,
const string&,
bool);
2710 TGraphErrors *rtgraph{};
2718 map<string, string> titlemap;
2719 titlemap[
"WholeBarrel_1"] =
"whole barrel";
2720 titlemap[
"Detector_-1"] =
"barrel C";
2721 titlemap[
"Detector_1"] =
"barrel A";
2722 titlemap[
"Detector_-2"] =
"end-cap C";
2723 titlemap[
"Detector_2"] =
"end-cap A";
2725 titlemap[
"WholeBarrel_Ar_1"] =
"whole barrel";
2726 titlemap[
"Detector_Ar_-1"] =
"barrel C";
2727 titlemap[
"Detector_Ar_1"] =
"barrel A";
2728 titlemap[
"Detector_Ar_-2"] =
"end-cap C";
2729 titlemap[
"Detector_Ar-2"] =
"end-cap A";
2734 TPad *c1_3 =
new TPad(
"c1_3",
"newpad", 0.01, 0.33, 0.99, 0.99);
2737 c1_3->SetTopMargin(0.1);
2738 c1_3->SetBottomMargin(0.01);
2739 c1_3->SetRightMargin(0.1);
2740 c1_3->SetFillStyle(0);
2745 TDirectory *trt =
nullptr;
2747 trt = (TDirectory *)
file->FindKey(
"TRT_all")->ReadObj();
2749 trt = (TDirectory *)
file->FindKey(
"TRT_Ar_all")->ReadObj();
2753 TDirectory *
det = (TDirectory *)trt->FindKey(
folder.c_str())->ReadObj();
2754 cout <<
" RtColor plot for folder" <<
folder << endl;
2755 if (
det->FindKey(
"rt-relation"))
2757 hist = (
TH2F *)
det->FindKey(
"rt-relation")->ReadObj();
2761 cout <<
" found rt-relation " << endl;
2762 hist->GetXaxis()->SetRangeUser(0, 40);
2763 hist->GetYaxis()->SetRangeUser(0, 2.4);
2765 sprintf(
name,
"r(t) for %s",
folder.c_str());
2767 sprintf(
name,
"Argon r(t) for %s",
folder.c_str());
2769 hist->GetXaxis()->SetRangeUser(0, 50);
2772 if (
det->FindKey(
"rtgraph"))
2774 cout <<
" found rtgraph " << endl;
2775 rtgraph = (TGraphErrors *)
det->FindKey(
"rtgraph")->ReadObj();
2776 rtgraph->SetMarkerStyle(20);
2777 rtgraph->SetMarkerColor(1);
2778 rtgraph->SetLineColor(1);
2779 rtgraph->GetYaxis()->SetRangeUser(0, 2.4);
2781 if (rtgraph->GetFunction(
"rtfunc"))
2782 newRT = rtgraph->GetFunction(
"rtfunc");
2784 newRT = rtgraph->GetFunction(
"rtfunc2");
2786 if (
det->FindKey(
"oldrtfunc"))
2788 cout <<
" found oldrtfunc " << endl;
2789 oldrtfunc = (TF1 *)
det->FindKey(
"oldrtfunc")->ReadObj();
2790 oldrtfunc->SetRange(0, 50);
2791 oldrtfunc->Draw(
"same");
2797 throw string(
" NO RT OBJECTS FOUND");
2800 else if (trt->FindKey(
"rt-relation"))
2802 cout <<
" RtColor Plot entire TRT" << endl;
2803 hist = (
TH2F *)trt->FindKey(
"rt-relation")->ReadObj();
2805 hist->GetXaxis()->SetRangeUser(0, 40);
2806 hist->SetTitle(
"r(t) for whole TRT");
2808 hist->SetTitle(
"Argon r(t) for whole TRT");
2809 hist->GetYaxis()->SetRangeUser(0, 2.4);
2810 hist->GetXaxis()->SetRangeUser(0, 50);
2812 if (trt->FindKey(
"rtgraph"))
2814 rtgraph = (TGraphErrors *)trt->FindKey(
"rtgraph")->ReadObj();
2815 rtgraph->SetMarkerStyle(20);
2816 rtgraph->SetLineColor(1);
2817 rtgraph->SetMarkerColor(1);
2818 rtgraph->GetYaxis()->SetRangeUser(0, 2.4);
2819 if (rtgraph->GetFunction(
"rtfunc"))
2820 newRT = rtgraph->GetFunction(
"rtfunc");
2822 newRT = rtgraph->GetFunction(
"rtfunc2");
2825 if (trt->FindKey(
"oldrtfunc"))
2827 oldrtfunc = (TF1 *)trt->FindKey(
"oldrtfunc")->ReadObj();
2828 oldrtfunc->SetRange(0, 50);
2829 oldrtfunc->Draw(
"same");
2842 TPad *c1_4 =
new TPad(
"c1_4",
"newpad", 0.01, 0, 0.99, 0.32);
2845 c1_4->SetTopMargin(0.01);
2846 c1_4->SetBottomMargin(0.3);
2847 c1_4->SetRightMargin(0.1);
2848 c1_4->SetFillStyle(0);
2851 Double_t Xmax = rtgraph->GetXaxis()->GetXmax();
2852 Double_t
Xmin = rtgraph->GetXaxis()->GetXmin();
2854 const Int_t
n = 300;
2858 Double_t Ymax = -10;
2861 newRT->SetRange(-10., 60.);
2862 oldrtfunc->SetRange(-10., 60.);
2864 for (Int_t
i = 0;
i <
n;
i++)
2867 y[
i] = (oldrtfunc->Eval(
x[
i]) - newRT->Eval(
x[
i]));
2874 TGraph *
gr1 =
new TGraph(
n,
x,
y);
2878 gr1->GetXaxis()->SetTitle(
"t-T0/ns");
2879 gr1->GetXaxis()->SetRangeUser(
Xmin, Xmax);
2880 gr1->GetYaxis()->SetTitle(
"Old r(t) - New r(t) /mm");
2881 gr1->GetYaxis()->SetRangeUser(-0.1, 0.1);
2883 gr1->GetYaxis()->SetNdivisions(5);
2884 gr1->GetXaxis()->SetTitleSize(0.06);
2885 gr1->GetXaxis()->SetLabelSize(0.06);
2886 gr1->GetYaxis()->SetLabelSize(0.08);
2887 gr1->GetYaxis()->SetTitleOffset(0.8);
2888 gr1->GetYaxis()->SetTitleSize(0.06);
2889 gr1->SetLineStyle(2);
2893 Int_t
n1 = rtgraph->GetN();
2897 for (Int_t
i = 0;
i <
n1;
i++)
2901 rtgraph->GetPoint(
i,
X,
Y);
2903 y1.at(
i) =
Y - newRT->Eval(
X);
2905 ey1.at(
i) = rtgraph->GetErrorY(
i);
2906 if (
y1.at(
i) > Ymax)
2908 if (
y1.at(
i) < Ymin)
2913 TGraphErrors *
gr2 =
new TGraphErrors(
n1, &
x1.at(0), &
y1.at(0), &
ex1.at(0), &ey1.at(0));
2914 gr2->SetMarkerColor(kBlack);
2915 gr2->SetMarkerStyle(20);
2917 gr2->GetYaxis()->SetTitle(
"Old r(t) - New r(t) /mm");
2920 gr2->GetYaxis()->SetRangeUser(-0.1, 0.1);
2921 gr2->GetXaxis()->SetRangeUser(0, 50);
2926 TLine *line0 =
new TLine(0, 0, 50, 0);
2927 line0->SetLineColor(4);
2943 this->SetName(
"resplots");
2947 TDirectory *trt =
nullptr;
2948 TDirectory *det1 =
nullptr;
2949 TDirectory *det2 =
nullptr;
2950 TDirectory *det3 =
nullptr;
2951 TDirectory *det4 =
nullptr;
2955 cout <<
" In ResidualPlots Xenon" << endl;
2956 trt = (TDirectory *)
file->FindKey(
"TRT_all")->ReadObj();
2958 throw std::runtime_error(
"trt pointer is null");
2960 det1 = (TDirectory *)trt->FindKey(
"Detector_-1")->ReadObj();
2961 det2 = (TDirectory *)trt->FindKey(
"Detector_1")->ReadObj();
2962 det3 = (TDirectory *)trt->FindKey(
"Detector_-2")->ReadObj();
2963 det4 = (TDirectory *)trt->FindKey(
"Detector_2")->ReadObj();
2968 throw std::runtime_error(
"trt pointer is null");
2970 cout <<
" In ResidualPlots Argon" << endl;
2971 if (
file->FindKey(
"TRT_Ar_all"))
2972 trt = (TDirectory *)
file->FindKey(
"TRT_Ar_all")->ReadObj();
2973 if (trt->FindKey(
"Detector_Ar_-1"))
2974 det1 = (TDirectory *)trt->FindKey(
"Detector_Ar_-1")->ReadObj();
2975 if (trt->FindKey(
"Detector_Ar_1"))
2976 det2 = (TDirectory *)trt->FindKey(
"Detector_Ar_1")->ReadObj();
2977 if (trt->FindKey(
"Detector_Ar_-2"))
2978 det3 = (TDirectory *)trt->FindKey(
"Detector_Ar_-2")->ReadObj();
2979 if (trt->FindKey(
"Detector_Ar_2"))
2980 det4 = (TDirectory *)trt->FindKey(
"Detector_Ar_2")->ReadObj();
2983 TH2F *reshist1 =
nullptr;
2984 TH2F *reshist2 =
nullptr;
2985 TH2F *reshist3 =
nullptr;
2986 TH2F *reshist4 =
nullptr;
2987 TH2F *reshist5 =
nullptr;
2988 TH2F *treshist1 =
nullptr;
2989 TH2F *treshist2 =
nullptr;
2990 TH2F *treshist3 =
nullptr;
2991 TH2F *treshist4 =
nullptr;
2992 TH2F *treshist5 =
nullptr;
2994 cout <<
" Find residual histograms " << endl;
2996 if (trt->FindKey(
"residual"))
2997 reshist1 = (
TH2F *)trt->FindKey(
"residual")->ReadObj();
3000 if (det1->FindKey(
"residual"))
3001 reshist2 = (
TH2F *)det1->FindKey(
"residual")->ReadObj();
3005 if (det2->FindKey(
"residual"))
3006 reshist3 = (
TH2F *)det2->FindKey(
"residual")->ReadObj();
3010 if (det3->FindKey(
"residual"))
3011 reshist4 = (
TH2F *)det3->FindKey(
"residual")->ReadObj();
3015 if (det4->FindKey(
"residual"))
3016 reshist5 = (
TH2F *)det4->FindKey(
"residual")->ReadObj();
3019 cout <<
" Find time residual histograms" << endl;
3020 if (trt->FindKey(
"timeresidual"))
3021 treshist1 = (
TH2F *)trt->FindKey(
"timeresidual")->ReadObj();
3024 if (det1->FindKey(
"timeresidual"))
3025 treshist2 = (
TH2F *)det1->FindKey(
"timeresidual")->ReadObj();
3029 if (det2->FindKey(
"timeresidual"))
3030 treshist3 = (
TH2F *)det2->FindKey(
"timeresidual")->ReadObj();
3034 if (det3->FindKey(
"timeresidual"))
3035 treshist4 = (
TH2F *)det3->FindKey(
"timeresidual")->ReadObj();
3039 if (det4->FindKey(
"timeresidual"))
3040 treshist5 = (
TH2F *)det4->FindKey(
"timeresidual")->ReadObj();
3043 cout <<
" Configure residual histograms" << endl;
3045 reshist1->SetTitle(Form(
"residual whole TRT"));
3047 reshist2->SetTitle(Form(
"residual (barrel side C)"));
3049 reshist3->SetTitle(Form(
"residual (barrel side A)"));
3051 reshist4->SetTitle(Form(
"residual (endcap side C)"));
3053 reshist5->SetTitle(Form(
"residual (endcap side A)"));
3055 reshist2->SetFillColor(46);
3057 reshist3->SetFillColor(46);
3059 reshist4->SetFillColor(46);
3061 reshist5->SetFillColor(46);
3063 cout <<
" Configure time residual histograms" << endl;
3065 treshist1->SetTitle(
"time-residual whole TRT");
3067 treshist2->SetTitle(
"time-residual (barrel side C)");
3069 treshist3->SetTitle(
"time-residual (barrel side A)");
3071 treshist4->SetTitle(
"time-residual (endcap side C)");
3073 treshist5->SetTitle(
"time-residual (endcap side A)");
3075 treshist2->SetFillColor(38);
3077 treshist3->SetFillColor(38);
3079 treshist4->SetFillColor(38);
3081 treshist5->SetFillColor(38);
3085 cout <<
" Configure Argon residual histograms" << endl;
3087 reshist1->SetTitle(
"residual Argon whole TRT");
3089 reshist2->SetTitle(
"residual Argon (barrel side C)");
3091 reshist3->SetTitle(
"residual Argon (barrel side A)");
3093 reshist4->SetTitle(
"residual Argon (endcap side C)");
3095 reshist5->SetTitle(
"residual Argon (endcap side A)");
3097 treshist1->SetTitle(
"time-residual Argon whole TRT");
3099 treshist2->SetTitle(
"time-residual Argon (barrel side C)");
3101 treshist3->SetTitle(
"time-residual Argon (barrel side A)");
3103 treshist4->SetTitle(
"time-residual Argon (endcap side C)");
3105 treshist5->SetTitle(
"time-residual Argon (endcap side A)");
3108 TF1 *resfit2 =
nullptr;
3109 TF1 *resfit3 =
nullptr;
3110 TF1 *resfit4 =
nullptr;
3111 TF1 *resfit5 =
nullptr;
3112 TF1 *tresfit2 =
nullptr;
3113 TF1 *tresfit3 =
nullptr;
3114 TF1 *tresfit4 =
nullptr;
3115 TF1 *tresfit5 =
nullptr;
3118 resfit2 = (TF1 *)reshist2->GetListOfFunctions()->First();
3120 resfit3 = (TF1 *)reshist3->GetListOfFunctions()->First();
3122 resfit4 = (TF1 *)reshist4->GetListOfFunctions()->First();
3124 resfit5 = (TF1 *)reshist5->GetListOfFunctions()->First();
3126 tresfit2 = (TF1 *)treshist2->GetListOfFunctions()->First();
3128 tresfit3 = (TF1 *)treshist3->GetListOfFunctions()->First();
3130 tresfit4 = (TF1 *)treshist4->GetListOfFunctions()->First();
3132 tresfit5 = (TF1 *)treshist5->GetListOfFunctions()->First();
3134 TText *mintxt =
new TText();
3135 mintxt->SetNDC(kTRUE);
3142 cout <<
" Draw residual barrel C" << endl;
3144 mintxt->DrawText(0.15, 0.85, Form(
"Mean: %.3f", resfit2->GetParameter(1)));
3145 mintxt->DrawText(0.15, 0.80, Form(
"Sigma: %.3f", resfit2->GetParameter(2)));
3151 cout <<
" Draw residual barrel A" << endl;
3153 mintxt->DrawText(0.15, 0.85, Form(
"Mean: %.3f", resfit3->GetParameter(1)));
3154 mintxt->DrawText(0.15, 0.80, Form(
"Sigma: %.3f", resfit3->GetParameter(2)));
3160 cout <<
" Draw residual endcap C" << endl;
3162 mintxt->DrawText(0.15, 0.85, Form(
"Mean: %.3f", resfit4->GetParameter(1)));
3163 mintxt->DrawText(0.15, 0.80, Form(
"Sigma: %.3f", resfit4->GetParameter(2)));
3168 cout <<
" Draw residual endcap A" << endl;
3170 mintxt->DrawText(0.15, 0.85, Form(
"Mean: %.3f", resfit5->GetParameter(1)));
3171 mintxt->DrawText(0.15, 0.80, Form(
"Sigma: %.3f", resfit5->GetParameter(2)));
3177 cout <<
" Draw time residual barrel C" << endl;
3179 mintxt->DrawText(0.15, 0.85, Form(
"Mean: %.3f", tresfit2->GetParameter(1)));
3180 mintxt->DrawText(0.15, 0.80, Form(
"Sigma: %.3f", tresfit2->GetParameter(2)));
3186 cout <<
" Draw time residual barrel A" << endl;
3188 mintxt->DrawText(0.15, 0.85, Form(
"Mean: %.3f", tresfit3->GetParameter(1)));
3189 mintxt->DrawText(0.15, 0.80, Form(
"Sigma: %.3f", tresfit3->GetParameter(2)));
3194 cout <<
" Draw time residual endcap C" << endl;
3196 mintxt->DrawText(0.15, 0.85, Form(
"Mean: %.3f", tresfit4->GetParameter(1)));
3197 mintxt->DrawText(0.15, 0.80, Form(
"Sigma: %.3f", tresfit4->GetParameter(2)));
3202 cout <<
" Draw time residual endcap A" << endl;
3204 mintxt->DrawText(0.15, 0.85, Form(
"Mean: %.3f", tresfit5->GetParameter(1)));
3205 mintxt->DrawText(0.15, 0.80, Form(
"Sigma: %.3f", tresfit5->GetParameter(2)));
3207 gStyle->SetOptStat(0);
3221 this->SetName(
"resplots");
3225 TDirectory *trt =
nullptr;
3227 trt = (TDirectory *)
file->FindKey(
"TRT_all")->ReadObj();
3229 trt = (TDirectory *)
file->FindKey(
"TRT_Ar_all")->ReadObj();
3231 TH2F *reshist1 =
nullptr;
3232 if (trt->FindKey(
"residual"))
3233 reshist1 = (
TH2F *)trt->FindKey(
"residual")->ReadObj();
3235 throw(
string(
"residual histograms for entire TRT not found!"));
3237 TH2F *treshist1 =
nullptr;
3238 if (trt->FindKey(
"timeresidual"))
3239 treshist1 = (
TH2F *)trt->FindKey(
"timeresidual")->ReadObj();
3241 throw(
string(
"timeresidual histograms for entire TRT not found!"));
3243 reshist1->SetTitle(Form(
"residual whole TRT"));
3245 reshist1->SetTitle(Form(
"Argon residual whole TRT"));
3246 reshist1->SetFillColor(46);
3247 treshist1->SetTitle(Form(
"time-residual whole TRT"));
3249 treshist1->SetTitle(Form(
"Argon time-residual whole TRT"));
3250 treshist1->SetFillColor(38);
3252 this->Divide(1, 2, 0.01, 0.01);
3272 cout <<
"In TBinnedRes. Input is " << reshists.size() <<
" histograms to be drawn " << endl;
3274 this->Divide(((
int)reshists.size()) / 5, 5);
3275 for (
int ihist = 0; ihist < (
int)reshists.size(); ihist++)
3277 this->
cd(ihist + 1);
3278 reshists[ihist]->SetTitle(
"");
3279 reshists[ihist]->Draw();
3280 reshists[ihist]->GetYaxis()->SetRangeUser(0, 1.1 * reshists[ihist]->GetMaximum());
3281 TLine *zlin =
new TLine(0, 0, 0, reshists[ihist]->GetMaximum());
3282 zlin->SetLineStyle(2);
3283 zlin->SetLineColor(4);
3304 TDirectory *binhist = (TDirectory *)(((TDirectory *)
file->Get(
detector.c_str()))->Get(
"binhist"));
3307 int nhists = binhist->GetListOfKeys()->GetEntries();
3309 this->Divide(
nhists / 5, 5);
3310 for (
int ihist = 0; ihist <
nhists; ihist++)
3312 this->
cd(ihist + 1);
3313 m_hist2 = (
TH1F *)(binhist->Get(binhist->GetListOfKeys()->At(ihist)->GetName()));
3314 m_hist2->SetTitle(
"");
3327 RresTbin(TFile *,
const string &,
int);
3342 TF1
ff(
"fitfunc",
"gaus");
3343 TF1 *ff2 =
new TF1(
"fitfunc2",
"pol3");
3345 TDirectory *trt =
nullptr;
3346 TDirectory *detdir =
nullptr;
3347 TDirectory *binhist =
nullptr;
3350 if (detname.find(
"Ar") != string::npos)
3352 bool allTRT =
false;
3353 if (detname ==
"WholeBarrel_1")
3355 resname =
"reshists5";
3357 else if (detname ==
"Detector_-1")
3359 resname =
"reshists2";
3361 else if (detname ==
"Detector_1")
3363 resname =
"reshists3";
3365 else if (detname ==
"Detector_-2")
3367 resname =
"reshists1";
3369 else if (detname ==
"Detector_2")
3371 resname =
"reshists4";
3375 resname =
"reshists";
3378 else if (detname ==
"WholeBarrel_Ar_1")
3380 resname =
"reshists_Ar5";
3382 else if (detname ==
"Detector_Ar_-1")
3384 resname =
"reshists_Ar2";
3386 else if (detname ==
"Detector_Ar_1")
3388 resname =
"reshists_Ar3";
3390 else if (detname ==
"Detector_Ar_-2")
3392 resname =
"reshists_Ar1";
3394 else if (detname ==
"Detector_Ar_2")
3396 resname =
"reshists_Ar4";
3400 resname =
"reshists_Ar";
3405 trt = (TDirectory *)
file->FindKey(
"TRT_all")->ReadObj();
3407 trt = (TDirectory *)
file->FindKey(
"TRT_Ar_all")->ReadObj();
3410 cout <<
"In RresTbin Xenon" << endl;
3412 cout <<
"In RresTbin Argon" << endl;
3415 cout <<
" found TRT_all directory " << endl;
3416 detdir = (TDirectory *)trt->FindKey(detname.c_str())->ReadObj();
3419 cout <<
" found binhist directory for detector name " << detname << endl;
3422 binhist = (TDirectory *)detdir->FindKey(resname.c_str())->ReadObj();
3426 binhist = (TDirectory *)trt->FindKey(resname.c_str())->ReadObj();
3431 cout <<
" found reshists directory for detector number: " <<
det << endl;
3435 cout <<
" did not find reshists directory for detector number " <<
det << endl;
3440 cout <<
" did not find binhist directory for detector name " << detname << endl;
3445 cout <<
" did not find TRT_all directory " << endl;
3451 TVectorD *tbins = (TVectorD *)
file->FindKey(
"tbins")->ReadObj();
3455 const size_t nElements = tbins->GetNoElements();
3456 cout <<
" found tbins vector with length " << nElements << endl;
3457 m_rdata = std::vector<double>(nElements,0.);
3458 m_erdata = std::vector<double>(nElements,0.);
3459 m_tdata = std::vector<double>(nElements,0.);
3460 m_etdata = std::vector<double>(nElements,0.);
3461 m_thegraph = TGraphErrors(nElements);
3464 for (
int ihist = 0; ihist < tbins->GetNoElements(); ihist++)
3467 TH1D *reshist =
nullptr;
3470 reshist = (TH1D *)binhist->Get(Form(
"res_tbin%i_bar", ihist));
3472 reshist = (TH1D *)binhist->Get(Form(
"res_tbin%i_trt", ihist));
3474 reshist = (TH1D *)binhist->Get(Form(
"res_tbin%i_%i", ihist,
det));
3476 if (reshist !=
nullptr)
3478 double lolim = -0.1;
3481 if (reshist->Fit(&
ff,
"Q",
"", lolim, hilim) + 1)
3483 m_rdata[ipoint] =
ff.GetParameter(1);
3484 m_erdata[ipoint] =
ff.GetParError(1);
3485 m_tdata[ipoint] = (*tbins)[ihist];
3487 m_etdata[ipoint] = 0;
3492 reshists.push_back(reshist);
3495 cout <<
" succesfully fitted " << ipoint <<
" histograms " << endl;
3496 for (
int ip = 0;
ip < ipoint;
ip++)
3499 resmap[m_tdata[
ip]] = m_rdata[
ip];
3505 m_thegraph = TGraphErrors(ipoint, m_tdata.data(), m_rdata.data(), m_etdata.data(), m_erdata.data());
3507 cout <<
" draw t-binned residual graph " << endl;
3508 string detstr[8] = {
"endcap A",
"barrel A",
"",
"barrel C",
"endcap C",
"",
"whole barrel",
"whole TRT"};
3510 m_thegraph.SetMarkerStyle(20);
3511 m_thegraph.SetTitle(Form(
"t-binned absolute residual (%s)", detstr[
det + 2].c_str()));
3512 m_thegraph.Draw(
"ap");
3513 m_thegraph.GetYaxis()->SetTitle(
"|r|-|r_{track}| /mm");
3514 m_thegraph.GetYaxis()->SetRangeUser(-0.150, 0.150);
3515 m_thegraph.GetXaxis()->SetRangeUser(0, 50);
3516 m_thegraph.GetXaxis()->SetTitle(
"t-t0 /ns");
3518 printf(
"RPOLDIFF %i %e %e %e %e\n",
det, ff2->GetParameter(0), ff2->GetParameter(1), ff2->GetParameter(2), ff2->GetParameter(3));
3543 TNtuple *Tracktuple = (TNtuple *)
file->Get(
"tracktuple");
3545 TH1F *resAr0 = (
TH1F *)
file->Get(
"TRT_Ar_all/Detector_Ar_-1/residual");
3546 TH1F *tresAr0 = (
TH1F *)
file->Get(
"TRT_Ar_all/Detector_Ar_-1/timeresidual");
3547 TH1F *resAr1 = (
TH1F *)
file->Get(
"TRT_Ar_all/Detector_Ar_-2/residual");
3548 TH1F *tresAr1 = (
TH1F *)
file->Get(
"TRT_Ar_all/Detector_Ar_-2/timeresidual");
3549 TH1F *resXe1 = (
TH1F *)
file->Get(
"TRT_all/Detector_-2/residual");
3550 TH1F *tresXe1 = (
TH1F *)
file->Get(
"TRT_all/Detector_-2/timeresidual");
3551 TH1F *resAr2 = (
TH1F *)
file->Get(
"TRT_Ar_all/Detector_Ar_1/residual");
3552 TH1F *tresAr2 = (
TH1F *)
file->Get(
"TRT_Ar_all/Detector_Ar_1/timeresidual");
3553 TH1F *resAr3 = (
TH1F *)
file->Get(
"TRT_Ar_all/Detector_Ar_2/residual");
3554 TH1F *tresAr3 = (
TH1F *)
file->Get(
"TRT_Ar_all/Detector_Ar_2/timeresidual");
3555 TH1F *resXe3 = (
TH1F *)
file->Get(
"TRT_all/Detector_2/residual");
3556 TH1F *tresXe3 = (
TH1F *)
file->Get(
"TRT_all/Detector_2/timeresidual");
3558 TDatime *
dt =
new TDatime();
3560 TPaveText *
pt =
new TPaveText(.1, .2, .9, .9);
3563 throw(
string(
"tracktuple not found!"));
3565 cout <<
" tracktuple found " << endl;
3572 cout <<
" writing to header. iteration number " << iter << endl;
3573 pt->AddText(Form(
"Iteration number: %i", iter));
3574 cout <<
" writing to header. month " <<
dt->GetMonth() << endl;
3575 pt->AddText(Form(
"Time: %02i/%02i/%i %02i:%02i",
dt->GetDay(),
dt->GetMonth(),
dt->GetYear(),
dt->GetHour(),
dt->GetMinute()));
3576 Tracktuple->SetBranchAddress(
"run", &
runnumber);
3577 Tracktuple->GetEntry(0);
3578 cout <<
" writing to header. run number " << (
int)
runnumber << endl;
3579 pt->AddText(Form(
"Run number: %i", (
int)
runnumber));
3587 cout <<
" writing to header. number of tracks " << Tracktuple->GetEntries() << endl;
3588 pt->AddText(Form(
"Total no. tracks: %lli", Tracktuple->GetEntries()));
3594 float bhitst[4]={0};
3599 cout <<
" debug 1 " << endl;
3600 bhitst[0] = resAr0->GetEntries();
3601 bhitst[2] = resAr2->GetEntries();
3602 float nhAr1 = resAr1->GetEntries();
3603 float nhXe1 = resXe1->GetEntries();
3604 cout <<
" debug 2 " << endl;
3605 bhitst[1] = nhAr1 + nhXe1;
3609 nhAr3 = resAr3->GetEntries();
3611 nhXe3 = resXe3->GetEntries();
3612 bhitst[3] = nhAr3 + nhXe3;
3613 cout <<
" debug 3 " << endl;
3614 rest[0] = resAr0->GetFunction(
"gaus")->GetParameter(2);
3615 rest[2] = resAr2->GetFunction(
"gaus")->GetParameter(2);
3616 rest[1] = (resAr1->GetFunction(
"gaus")->GetParameter(2) * nhAr1 + resXe1->GetFunction(
"gaus")->GetParameter(2) * nhXe1) / bhitst[1];
3617 if (resAr3 and resXe3)
3618 rest[3] = (resAr3->GetFunction(
"gaus")->GetParameter(2) * nhAr3 + resXe3->GetFunction(
"gaus")->GetParameter(2) * nhXe3) / bhitst[3];
3619 cout <<
" debug 4 " << endl;
3620 trest[0] = tresAr0->GetFunction(
"gaus")->GetParameter(1);
3621 trest[2] = tresAr2->GetFunction(
"gaus")->GetParameter(1);
3622 trest[1] = (tresAr1->GetFunction(
"gaus")->GetParameter(1) * nhAr1 + tresXe1->GetFunction(
"gaus")->GetParameter(1) * nhXe1) / bhitst[1];
3624 trest[3] = (tresAr3->GetFunction(
"gaus")->GetParameter(1) * nhAr3 + tresXe3->GetFunction(
"gaus")->GetParameter(1) * nhXe3) / bhitst[3];
3625 cout <<
" debug 5 " << endl;
3626 treswt[0] = tresAr0->GetFunction(
"gaus")->GetParameter(2);
3627 treswt[2] = tresAr2->GetFunction(
"gaus")->GetParameter(2);
3628 treswt[1] = (tresAr1->GetFunction(
"gaus")->GetParameter(2) * nhAr1 + tresXe1->GetFunction(
"gaus")->GetParameter(2) * nhXe1) / bhitst[1];
3630 treswt[3] = (tresAr3->GetFunction(
"gaus")->GetParameter(2) * nhAr3 + tresXe3->GetFunction(
"gaus")->GetParameter(2) * nhXe3) / bhitst[3];
3631 cout <<
" debug 6 " << endl;
3635 TDirectory *
errors =
nullptr;
3636 TDirectory *errorsAr =
nullptr;
3637 bool iserrors =
false;
3638 bool iserrorsAr =
false;
3639 if (
file->FindKey(
"ErrorsAr"))
3641 errorsAr = (TDirectory *)
file->FindKey(
"ErrorsAr")->ReadObj();
3642 if (errorsAr !=
nullptr)
3645 if (
file->FindKey(
"Errors"))
3647 errors = (TDirectory *)
file->FindKey(
"Errors")->ReadObj();
3660 TH2F *residual_ea =
nullptr;
3661 TH2F *residual_ec =
nullptr;
3666 TH2F *residual_eaP =
nullptr;
3667 TH2F *residual_ecP =
nullptr;
3670 TH2F *residualAr_ba =
nullptr;
3671 TH2F *residualAr_bc =
nullptr;
3672 TH2F *residualAr_ea =
nullptr;
3673 TH2F *residualAr_ec =
nullptr;
3676 TH2F *residualAr_baP =
nullptr;
3677 TH2F *residualAr_bcP =
nullptr;
3678 TH2F *residualAr_eaP =
nullptr;
3679 TH2F *residualAr_ecP =
nullptr;
3681 if (iserrors &&
errors->FindKey(
"tresidual_trt") &&
errors->FindKey(
"tresidual_trtP"))
3684 if (
errors->FindKey(
"tresidual_ea"))
3685 residual_ea = (
TH2F *)
errors->FindKey(
"tresidual_ea")->ReadObj();
3686 if (
errors->FindKey(
"tresidual_ec"))
3687 residual_ec = (
TH2F *)
errors->FindKey(
"tresidual_ec")->ReadObj();
3690 if (
errors->FindKey(
"tresidual_eaP"))
3691 residual_eaP = (
TH2F *)
errors->FindKey(
"tresidual_eaP")->ReadObj();
3692 if (
errors->FindKey(
"tresidual_ecP"))
3693 residual_ecP = (
TH2F *)
errors->FindKey(
"tresidual_ecP")->ReadObj();
3697 cout <<
" No time residual histograms in endcaps: tresidual_trt and tresidual_trtP " << endl;
3699 if (iserrorsAr && errorsAr->FindKey(
"tresidualAr_trt") && errorsAr->FindKey(
"tresidualAr_trtP"))
3702 if (errorsAr->FindKey(
"tresidualAr_ba"))
3703 residualAr_ba = (
TH2F *)errorsAr->FindKey(
"tresidualAr_ba")->ReadObj();
3704 if (errorsAr->FindKey(
"tresidualAr_bc"))
3705 residualAr_bc = (
TH2F *)errorsAr->FindKey(
"tresidualAr_bc")->ReadObj();
3706 if (errorsAr->FindKey(
"tresidualAr_ea"))
3707 residualAr_ea = (
TH2F *)errorsAr->FindKey(
"tresidualAr_ea")->ReadObj();
3708 if (errorsAr->FindKey(
"tresidualAr_ec"))
3709 residualAr_ec = (
TH2F *)errorsAr->FindKey(
"tresidualAr_ec")->ReadObj();
3712 if (errorsAr->FindKey(
"tresidualAr_baP"))
3713 residualAr_baP = (
TH2F *)errorsAr->FindKey(
"tresidualAr_baP")->ReadObj();
3714 if (errorsAr->FindKey(
"tresidualAr_bcP"))
3715 residualAr_bcP = (
TH2F *)errorsAr->FindKey(
"tresidualAr_bcP")->ReadObj();
3716 if (errorsAr->FindKey(
"tresidualAr_eaP"))
3717 residualAr_eaP = (
TH2F *)errorsAr->FindKey(
"tresidualAr_eaP")->ReadObj();
3718 if (errorsAr->FindKey(
"tresidualAr_ecP"))
3719 residualAr_ecP = (
TH2F *)errorsAr->FindKey(
"tresidualAr_ecP")->ReadObj();
3723 cout <<
" No time residual histograms for Argon layers : tresidualAr_trt and tresidualAr_trtP " << endl;
3730 if (residualAr_ba && residualAr_baP && residualAr_ba->GetEntries() > 0)
3732 ratioba = residualAr_baP->GetEntries() / residualAr_ba->GetEntries();
3734 if (residualAr_bc && residualAr_bcP && residualAr_ea && residualAr_bc->GetEntries() > 0)
3736 ratiobc = residualAr_bcP->GetEntries() / residualAr_bc->GetEntries();
3738 if (residual_ea && residual_eaP && residualAr_ea && residualAr_eaP && residual_ea->GetEntries() > 0)
3740 ratioea = (residual_eaP->GetEntries() + residualAr_eaP->GetEntries()) / (residual_ea->GetEntries() + residualAr_ea->GetEntries());
3742 if (residual_ec && residualAr_ecP &&residualAr_ec && residual_ec->GetEntries() > 0)
3744 ratioec = (residual_ecP->GetEntries() + residualAr_ecP->GetEntries()) / (residual_ec->GetEntries() + residualAr_ec->GetEntries());
3747 pt->AddText(
"Barrels:");
3748 pt->AddText(Form(
" (side C) hits: %i residual: %.4f mm Time res peak: %.3f ns ", (
int)bhitst[0], rest[0], trest[0]));
3749 pt->AddText(Form(
" (side C) Time res width: %.2f ns Ratio prec hits: %.3f ", treswt[0], ratioba));
3750 pt->AddText(Form(
" (side A) hits: %i residual: %.4f mm Time res peak: %.3f ns ", (
int)bhitst[2], rest[2], trest[2]));
3751 pt->AddText(Form(
" (side A) Time res width: %.2f ns Ratio prec hits: %.3f ", treswt[2], ratiobc));
3752 pt->AddText(
" Endcaps:");
3753 pt->AddText(Form(
" (side C) hits: %i residual: %.4f mm Time res peak: %.3f ns", (
int)bhitst[1], rest[1], trest[1]));
3754 pt->AddText(Form(
" (side C) Time res width: %.2f ns Ratio prec hits: %.3f ", treswt[1], ratioea));
3755 pt->AddText(Form(
" (side A) hits: %i residual: %.4f mm Time res peak: %.3f ns", (
int)bhitst[3], rest[3], trest[3]));
3756 pt->AddText(Form(
" (side A) Time res width: %.2f ns Ratio prec hits: %.3f ", treswt[3], ratioec));
3758 pt->SetLabel(Form(
"TRT calibration iteration summary"));
3779 TPaveText *
pt =
new TPaveText(.1, .1, 0.9, 0.9);
3780 pt->SetTextAlign(11);
3783 pt->SetLabel(Form(
"TRT calibration Main Settings"));
3787 if (myfile.is_open())
3789 while (!myfile.eof())
3791 getline(myfile,
line);
3792 auto notfirst = [&
line](
const std::string & sub)->
bool{
3793 return line.find(sub)!=0;
3795 if (notfirst(
"#") && notfirst(
"Clean") && notfirst(
"Submit") && notfirst(
"Relink") && notfirst(
"JobPrefix") && notfirst(
"Tag") && notfirst(
"WWW"))
3797 int space =
line.find_first_of(
" ");
3805 for (
const auto & [txt1,txt2]:
set)
3807 pt->AddText((
string(txt1 +
" . . . . . . . . . . . . " + txt2)).c_str());
3812 throw(
string(
"config file not found: ") +
string(
filename));
3831 m_Tracktuple = (TNtuple *)
file->Get(
"tracktuple");
3833 throw(
string(
"tracktuple not found!"));
3835 this->SetName(
"c1");
3836 this->Divide(1, 2, 0.01, 0.01);
3837 ((TPad *)this->GetPrimitive(
"c1_1"))->SetLogy();
3839 TH1F *trackhits =
new TH1F(
"trackhits",
"Accepted hits per track", 60, -0.5, 59.5);
3840 TH1F *trackhits1 =
new TH1F(
"trackhits1",
"Accepted hits per track BarrelA", 60, -0.5, 59.5);
3841 TH1F *trackhits2 =
new TH1F(
"trackhits2",
"Accepted hits per track EndcaoA", 60, -0.5, 59.5);
3842 TH1F *trackhits3 =
new TH1F(
"trackhits3",
"Accepted hits per track BarrelC", 60, -0.5, 59.5);
3843 TH1F *trackhits4 =
new TH1F(
"trackhits4",
"Accepted hits per track EndcaoC", 60, -0.5, 59.5);
3845 TH1F *eventphase =
new TH1F(
"eventphase",
"Event Phase", 80, -18, -1);
3846 TH1F *eventphase1 =
new TH1F(
"eventphase1",
"Eventphase1", 80, -18, -1);
3847 TH1F *eventphase2 =
new TH1F(
"eventphase2",
"Eventphase2", 80, -18, -1);
3848 TH1F *eventphase3 =
new TH1F(
"eventphase3",
"Eventphase3", 80, -18, -1);
3849 TH1F *eventphase4 =
new TH1F(
"eventphase4",
"Eventphase4", 80, -18, -1);
3851 m_Tracktuple->Draw(
"nhits>>trackhits");
3853 m_Tracktuple->Draw(
"nhits>>trackhits1",
"-log(tan(theta/2))>0 && -log(tan(theta/2))< 1 ",
"same");
3854 m_Tracktuple->Draw(
"nhits>>trackhits2",
"-log(tan(theta/2))>1",
"same");
3855 m_Tracktuple->Draw(
"nhits>>trackhits3",
"-log(tan(theta/2))<0 && -log(tan(theta/2))> -1 ",
"same");
3856 m_Tracktuple->Draw(
"nhits>>trackhits4",
"-log(tan(theta/2))<-1 ",
"same");
3857 trackhits1->SetLineColor(2);
3858 trackhits2->SetLineColor(3);
3859 trackhits3->SetLineColor(4);
3860 trackhits4->SetLineColor(5);
3861 trackhits1->Draw(
"same");
3862 trackhits2->Draw(
"same");
3863 trackhits3->Draw(
"same");
3864 trackhits4->Draw(
"same");
3865 TLegend *leg1 =
new TLegend(0.7155172, 0.1038136, 0.8965517, 0.2542373,
nullptr,
"brNDC");
3866 leg1->AddEntry(trackhits,
"all tracks",
"l");
3867 leg1->AddEntry(trackhits1,
"0 < eta < 1",
"l");
3868 leg1->AddEntry(trackhits2,
"eta > 1",
"l");
3869 leg1->AddEntry(trackhits3,
"-1 < eta < 0",
"l");
3870 leg1->AddEntry(trackhits4,
"eta < -1",
"l");
3871 leg1->SetTextSize(0.03);
3874 trackhits->SetTitle(Form(
"Accepted precission hits per track (%lli tracks in total)", m_Tracktuple->GetEntries()));
3875 trackhits->GetXaxis()->SetTitle(
"accepted precission hits");
3876 trackhits->GetYaxis()->SetTitle(
"No. tracks");
3877 this->SetName(
"c1");
3879 ((TPad *)this->GetPrimitive(
"c1_2"))->SetLogy();
3881 m_Tracktuple->Draw(
"epold>>eventphase");
3882 m_Tracktuple->Draw(
"epold>>eventphase1",
"-log(tan(theta/2))>0 && -log(tan(theta/2))< 1",
"same");
3883 m_Tracktuple->Draw(
"epold>>eventphase2",
"-log(tan(theta/2))>1",
"same");
3884 m_Tracktuple->Draw(
"epold>>eventphase3",
"-log(tan(theta/2))<0 && -log(tan(theta/2))> -1",
"same");
3885 m_Tracktuple->Draw(
"epold>>eventphase4",
"-log(tan(theta/2))<-1",
"same");
3887 eventphase1->SetLineColor(2);
3888 eventphase2->SetLineColor(3);
3889 eventphase3->SetLineColor(4);
3890 eventphase4->SetLineColor(5);
3892 eventphase->SetTitle(
"Eventphase");
3893 eventphase->GetXaxis()->SetTitle(
"eventphase");
3894 eventphase->GetYaxis()->SetTitle(
"No. tracks");
3896 TLegend *leg2 =
new TLegend(0.7155172, 0.1038136, 0.8965517, 0.2542373,
nullptr,
"brNDC");
3897 leg2->AddEntry(trackhits1,
"0 < eta < 1",
"l");
3898 leg2->AddEntry(trackhits2,
"eta > 1",
"l");
3899 leg2->AddEntry(trackhits3,
"-1 < eta < 0",
"l");
3900 leg2->AddEntry(trackhits4,
"eta < -1",
"l");
3901 leg2->SetTextSize(0.03);
3912 int const nxbins =
histo->GetNbinsX();
3913 TGraphErrors *Means =
new TGraphErrors(nxbins);
3916 TF1 *
ff =
new TF1(
"ff",
"gaus");
3917 for (
int i = 0;
i < nxbins;
i++)
3919 TH1D *
slice =
histo->ProjectionY(
"slice",
i + 1,
i + 1);
3922 ff->SetParameter(0,
slice->GetEntries());
3923 ff->SetParameter(1,
mean);
3924 ff->SetParameter(2,
rms);
3925 mean =
ff->GetParameter(1);
3926 rms =
ff->GetParameter(2);
3927 float x =
histo->GetBinCenter(
i + 1);
3928 Means->SetPoint(
i,
x,
mean);
3929 Means->SetPointError(
i, 0.5 *
histo->GetBinWidth(
i),
ff->GetParError(1));
3941 int const nxbins =
histo->GetNbinsX();
3942 TGraphErrors *Means =
new TGraphErrors(nxbins);
3945 TF1 *
ff =
new TF1(
"ff",
"gaus");
3946 for (
int i = 0;
i < nxbins;
i++)
3948 TH1D *
slice =
histo->ProjectionY(
"slice",
i + 1,
i + 1);
3951 float x =
histo->GetBinCenter(
i + 1);
3952 Means->SetPoint(
i,
x,
mean);
3953 Means->SetPointError(
i, 0.5 *
histo->GetBinWidth(
i),
ff->GetParError(1));
3965 int const nxbins =
histo->GetNbinsX();
3966 TGraphErrors *Means =
new TGraphErrors(nxbins);
3969 TF1 *
ff =
new TF1(
"ff",
"gaus");
3970 for (
int i = 0;
i < nxbins;
i++)
3972 TH1D *
slice =
histo->ProjectionY(
"slice",
i + 1,
i + 1);
3974 float x =
histo->GetBinCenter(
i + 1);
3975 Means->SetPoint(
i,
x,
mean);
3976 Means->SetPointError(
i, 0.5 *
histo->GetBinWidth(
i),
ff->GetParError(1));
3987 int const nxbins =
histo->GetNbinsX();
3988 TGraphErrors *Means =
new TGraphErrors(nxbins);
3991 TF1 *
ff =
new TF1(
"ff",
"gaus");
3992 for (
int i = 0;
i < nxbins;
i++)
3994 TH1D *
slice =
histo->ProjectionY(
"slice",
i + 1,
i + 1);
3997 ff->SetParameter(0,
slice->GetEntries());
3998 ff->SetParameter(1,
mean);
3999 ff->SetParameter(2,
rms);
4001 mean =
ff->GetParameter(1);
4002 rms =
ff->GetParameter(2);
4003 for (
int j = 0; j < 6; j++)
4006 mean =
ff->GetParameter(1);
4007 rms =
ff->GetParameter(2);
4010 float x =
histo->GetBinCenter(
i + 1);
4011 Means->SetPoint(
i,
x,
rms);
4012 Means->SetPointError(
i, 0.5 *
histo->GetBinWidth(
i),
ff->GetParError(2));
4023 int const nxbins =
histo->GetNbinsX();
4024 TGraphErrors *Means =
new TGraphErrors(nxbins);
4027 TF1 *
ff =
new TF1(
"ff",
"gaus");
4028 for (
int i = 0;
i < nxbins;
i++)
4030 TH1D *
slice =
histo->ProjectionY(
"slice",
i + 1,
i + 1);
4033 float x =
histo->GetBinCenter(
i + 1);
4034 Means->SetPoint(
i,
x,
mean);
4035 Means->SetPointError(
i, 0.5 *
histo->GetBinWidth(
i),
rms);
4046 int const nxbins =
histo->GetNbinsX();
4047 TGraphErrors *Means =
new TGraphErrors(nxbins);
4050 TF1 *
ff =
new TF1(
"ff",
"gaus");
4051 for (
int i = 0;
i < nxbins;
i++)
4053 TH1D *
slice =
histo->ProjectionY(
"slice",
i + 1,
i + 1);
4056 ff->SetParameter(0,
slice->GetEntries());
4057 ff->SetParameter(1,
mean);
4058 ff->SetParameter(2,
rms);
4060 mean =
ff->GetParameter(1);
4061 rms =
ff->GetParameter(2);
4063 mean =
ff->GetParameter(1);
4064 rms =
ff->GetParameter(2);
4066 float x =
histo->GetBinCenter(
i + 1);
4067 Means->SetPoint(
i,
x,
rms);
4068 Means->SetPointError(
i, 0.5 *
histo->GetBinWidth(
i),
ff->GetParError(2));
4086 m_errors = (TDirectory *)
file->FindKey(
"Errors")->ReadObj();
4087 if (m_errors ==
nullptr)
4088 throw(
string(
"No errors folder!!!!!!!!!!!!!!!"));
4089 if (m_errors->GetNkeys() > 29)
4091 this->Divide(2, 3, 0.01, 0.01);
4093 TH2F *residual_trt = (
TH2F *)m_errors->FindKey(
"residual_allhits")->ReadObj();
4094 TH2F *residual_ba = (
TH2F *)m_errors->FindKey(
"residual_ba")->ReadObj();
4095 TH2F *residual_bc = (
TH2F *)m_errors->FindKey(
"residual_bc")->ReadObj();
4096 TH2F *residual_ea = (
TH2F *)m_errors->FindKey(
"residual_ea")->ReadObj();
4097 TH2F *residual_ec = (
TH2F *)m_errors->FindKey(
"residual_ec")->ReadObj();
4103 TH2F *pull_trtP = (
TH2F *)m_errors->FindKey(
"pull_trtP")->ReadObj();
4104 TH2F *pull_baP = (
TH2F *)m_errors->FindKey(
"pull_baP")->ReadObj();
4105 TH2F *pull_bcP = (
TH2F *)m_errors->FindKey(
"pull_bcP")->ReadObj();
4106 TH2F *pull_eaP = (
TH2F *)m_errors->FindKey(
"pull_eaP")->ReadObj();
4107 TH2F *pull_ecP = (
TH2F *)m_errors->FindKey(
"pull_ecP")->ReadObj();
4108 TH2F *residual_trtP = (
TH2F *)m_errors->FindKey(
"residual_trtP")->ReadObj();
4109 TH2F *residual_baP = (
TH2F *)m_errors->FindKey(
"residual_baP")->ReadObj();
4110 TH2F *residual_bcP = (
TH2F *)m_errors->FindKey(
"residual_bcP")->ReadObj();
4111 TH2F *residual_eaP = (
TH2F *)m_errors->FindKey(
"residual_eaP")->ReadObj();
4112 TH2F *residual_ecP = (
TH2F *)m_errors->FindKey(
"residual_ecP")->ReadObj();
4113 TH2F *tresidual_trtP = (
TH2F *)m_errors->FindKey(
"tresidual_trtP")->ReadObj();
4114 TH2F *tresidual_baP = (
TH2F *)m_errors->FindKey(
"tresidual_baP")->ReadObj();
4115 TH2F *tresidual_bcP = (
TH2F *)m_errors->FindKey(
"tresidual_bcP")->ReadObj();
4116 TH2F *tresidual_eaP = (
TH2F *)m_errors->FindKey(
"tresidual_eaP")->ReadObj();
4117 TH2F *tresidual_ecP = (
TH2F *)m_errors->FindKey(
"tresidual_ecP")->ReadObj();
4118 TH2F *trackerrors_trt = (
TH2F *)m_errors->FindKey(
"trackerrors_trt")->ReadObj();
4119 TH2F *trackerrors_ba = (
TH2F *)m_errors->FindKey(
"trackerrors_ba")->ReadObj();
4120 TH2F *trackerrors_bc = (
TH2F *)m_errors->FindKey(
"trackerrors_bc")->ReadObj();
4121 TH2F *trackerrors_ea = (
TH2F *)m_errors->FindKey(
"trackerrors_ea")->ReadObj();
4122 TH2F *trackerrors_ec = (
TH2F *)m_errors->FindKey(
"trackerrors_ec")->ReadObj();
4126 TGraphErrors *tresTRT =
GetMean(tresidual_trtP);
4127 TGraphErrors *tresBA =
GetMean(tresidual_baP);
4128 tresBA->SetLineColor(kRed);
4129 tresBA->SetMarkerColor(kRed);
4130 TGraphErrors *tresBC =
GetMean(tresidual_bcP);
4131 tresBC->SetLineColor(kBlue);
4132 tresBC->SetMarkerColor(kBlue);
4133 TGraphErrors *tresEA =
GetMean(tresidual_eaP);
4134 tresEA->SetLineColor(kGreen);
4135 tresEA->SetMarkerColor(kGreen);
4136 TGraphErrors *tresEC =
GetMean(tresidual_ecP);
4137 tresEC->SetLineColor(kYellow);
4138 tresEC->SetMarkerColor(kYellow);
4140 tresTRT->SetTitle(
"Time Residual Mean VS PT");
4141 tresTRT->GetXaxis()->SetTitle(
"Pt (GeV)");
4142 tresTRT->GetYaxis()->SetTitle(
"ns");
4143 tresTRT->GetYaxis()->SetRangeUser(-0.8, 0.4);
4144 tresTRT->Draw(
"ALP");
4153 TGraphErrors *tresTRTw =
GetWidth(tresidual_trtP);
4154 TGraphErrors *tresBAw =
GetWidth(tresidual_baP);
4155 tresBAw->SetLineColor(kRed);
4156 tresBAw->SetMarkerColor(kRed);
4157 TGraphErrors *tresBCw =
GetWidth(tresidual_bcP);
4158 tresBCw->SetLineColor(kBlue);
4159 tresBCw->SetMarkerColor(kBlue);
4160 TGraphErrors *tresEAw =
GetWidth(tresidual_eaP);
4161 tresEAw->SetLineColor(kGreen);
4162 tresEAw->SetMarkerColor(kGreen);
4163 TGraphErrors *tresECw =
GetWidth(tresidual_ecP);
4164 tresECw->SetLineColor(kYellow);
4165 tresECw->SetMarkerColor(kYellow);
4167 tresTRTw->SetTitle(
"Time Residual Width VS PT");
4168 tresTRTw->GetXaxis()->SetTitle(
"Pt (GeV)");
4169 tresTRTw->GetYaxis()->SetTitle(
"ns");
4170 tresTRTw->GetYaxis()->SetRangeUser(2.9, 4.0);
4171 tresTRTw->Draw(
"ALP");
4172 tresBAw->Draw(
"LP");
4173 tresBCw->Draw(
"LP");
4174 tresEAw->Draw(
"LP");
4175 tresECw->Draw(
"LP");
4179 TGraphErrors *resTRTw =
GetWidth(residual_trtP);
4180 TGraphErrors *resBAw =
GetWidth(residual_baP);
4181 resBAw->SetLineColor(kRed);
4182 resBAw->SetMarkerColor(kRed);
4183 TGraphErrors *resBCw =
GetWidth(residual_bcP);
4184 resBCw->SetLineColor(kBlue);
4185 resBCw->SetMarkerColor(kBlue);
4186 TGraphErrors *resEAw =
GetWidth(residual_eaP);
4187 resEAw->SetLineColor(kGreen);
4188 resEAw->SetMarkerColor(kGreen);
4189 TGraphErrors *resECw =
GetWidth(residual_ecP);
4190 resECw->SetLineColor(kYellow);
4191 resECw->SetMarkerColor(kYellow);
4193 resTRTw->SetTitle(
"Residual Width VS PT");
4194 resTRTw->GetXaxis()->SetTitle(
"Pt (GeV)");
4195 resTRTw->GetYaxis()->SetTitle(
"mm");
4196 resTRTw->GetYaxis()->SetRangeUser(0.11, 0.18);
4197 resTRTw->Draw(
"ALP");
4205 TGraphErrors *pullTRTw =
GetPWidth(pull_trtP);
4206 TGraphErrors *pullBAw =
GetPWidth(pull_baP);
4207 pullBAw->SetLineColor(kRed);
4208 pullBAw->SetMarkerColor(kRed);
4209 TGraphErrors *pullBCw =
GetPWidth(pull_bcP);
4210 pullBCw->SetLineColor(kBlue);
4211 pullBCw->SetMarkerColor(kBlue);
4212 TGraphErrors *pullEAw =
GetPWidth(pull_eaP);
4213 pullEAw->SetLineColor(kGreen);
4214 pullEAw->SetMarkerColor(kGreen);
4215 TGraphErrors *pullECw =
GetPWidth(pull_ecP);
4216 pullECw->SetLineColor(kYellow);
4217 pullECw->SetMarkerColor(kYellow);
4219 pullTRTw->SetTitle(
"Pull Width VS PT");
4220 pullTRTw->GetXaxis()->SetTitle(
"Pt (GeV)");
4221 pullTRTw->GetYaxis()->SetTitle(
" ");
4222 pullTRTw->GetYaxis()->SetRangeUser(0.7, 1.3);
4223 pullTRTw->Draw(
"ALP");
4224 pullBAw->Draw(
"LP");
4225 pullBCw->Draw(
"LP");
4226 pullEAw->Draw(
"LP");
4227 pullECw->Draw(
"LP");
4231 TGraphErrors *trkTRTw =
GetMean(trackerrors_trt);
4232 TGraphErrors *trkBAw =
GetMean(trackerrors_ba);
4233 trkBAw->SetLineColor(kRed);
4234 trkBAw->SetMarkerColor(kRed);
4235 TGraphErrors *trkBCw =
GetMean(trackerrors_bc);
4236 trkBCw->SetLineColor(kBlue);
4237 trkBCw->SetMarkerColor(kBlue);
4238 TGraphErrors *trkEAw =
GetMean(trackerrors_ea);
4239 trkEAw->SetLineColor(kGreen);
4240 trkEAw->SetMarkerColor(kGreen);
4241 TGraphErrors *trkECw =
GetMean(trackerrors_ec);
4242 trkECw->SetLineColor(kYellow);
4243 trkECw->SetMarkerColor(kYellow);
4245 trkTRTw->SetTitle(
"Trk error Mean Width VS PT");
4246 trkTRTw->GetXaxis()->SetTitle(
"Pt (GeV)");
4247 trkTRTw->GetYaxis()->SetTitle(
"mm");
4248 trkTRTw->GetYaxis()->SetRangeUser(0.0, 0.07);
4249 trkTRTw->Draw(
"ALP");
4258 TGraphErrors *presTRTw =
GetWidth(residual_trt);
4259 TGraphErrors *presBAw =
GetWidth(residual_ba);
4260 presBAw->SetLineColor(kRed);
4261 presBAw->SetMarkerColor(kRed);
4262 TGraphErrors *presBCw =
GetWidth(residual_bc);
4263 presBCw->SetLineColor(kBlue);
4264 presBCw->SetMarkerColor(kBlue);
4265 TGraphErrors *presEAw =
GetWidth(residual_ea);
4266 presEAw->SetLineColor(kGreen);
4267 presEAw->SetMarkerColor(kGreen);
4268 TGraphErrors *presECw =
GetWidth(residual_ec);
4269 presECw->SetLineColor(kYellow);
4270 presECw->SetMarkerColor(kYellow);
4272 presTRTw->SetTitle(
"Residual Width all hits VS PT");
4273 presTRTw->GetXaxis()->SetTitle(
"Pt (GeV)");
4274 presTRTw->GetYaxis()->SetTitle(
"mm");
4275 presTRTw->GetYaxis()->SetRangeUser(0.11, 0.18);
4276 presTRTw->Draw(
"ALP");
4277 presBAw->Draw(
"LP");
4278 presBCw->Draw(
"LP");
4279 presEAw->Draw(
"LP");
4280 presECw->Draw(
"LP");
4284 cout <<
" Not enough keys in Errors directory for Pt dependence plots " << endl;
4299 errors = (TDirectory *)
file->FindKey(
"Errors")->ReadObj();
4301 throw(
string(
"No errors folder!!!!!!!!!!!!!!!"));
4302 if (
errors->GetNkeys() > 19)
4304 this->Divide(2, 3, 0.01, 0.01);
4308 TH2F *pull_vs_tb_trt = (
TH2F *)
errors->FindKey(
"pull_vs_tb_trt")->ReadObj();
4309 TH2F *pull_vs_tb_ba = (
TH2F *)
errors->FindKey(
"pull_vs_tb_ba")->ReadObj();
4310 TH2F *pull_vs_tb_bc = (
TH2F *)
errors->FindKey(
"pull_vs_tb_bc")->ReadObj();
4311 TH2F *pull_vs_tb_ea = (
TH2F *)
errors->FindKey(
"pull_vs_tb_ea")->ReadObj();
4312 TH2F *pull_vs_tb_ec = (
TH2F *)
errors->FindKey(
"pull_vs_tb_ec")->ReadObj();
4314 TH2F *errors_vs_tb_trt = (
TH2F *)
errors->FindKey(
"errors_vs_tb_trt")->ReadObj();
4315 TH2F *errors_vs_tb_ba = (
TH2F *)
errors->FindKey(
"errors_vs_tb_ba")->ReadObj();
4316 TH2F *errors_vs_tb_bc = (
TH2F *)
errors->FindKey(
"errors_vs_tb_bc")->ReadObj();
4317 TH2F *errors_vs_tb_ea = (
TH2F *)
errors->FindKey(
"errors_vs_tb_ea")->ReadObj();
4318 TH2F *errors_vs_tb_ec = (
TH2F *)
errors->FindKey(
"errors_vs_tb_ec")->ReadObj();
4320 TH2F *residual_vs_tb_trt = (
TH2F *)
errors->FindKey(
"residual_vs_tb_trt")->ReadObj();
4321 TH2F *residual_vs_tb_ba = (
TH2F *)
errors->FindKey(
"residual_vs_tb_ba")->ReadObj();
4322 TH2F *residual_vs_tb_bc = (
TH2F *)
errors->FindKey(
"residual_vs_tb_bc")->ReadObj();
4323 TH2F *residual_vs_tb_ea = (
TH2F *)
errors->FindKey(
"residual_vs_tb_ea")->ReadObj();
4324 TH2F *residual_vs_tb_ec = (
TH2F *)
errors->FindKey(
"residual_vs_tb_ec")->ReadObj();
4326 TH2F *trackerrors_vs_tb_trt = (
TH2F *)
errors->FindKey(
"trackerrors_vs_tb_trt")->ReadObj();
4327 TH2F *trackerrors_vs_tb_ba = (
TH2F *)
errors->FindKey(
"trackerrors_vs_tb_ba")->ReadObj();
4328 TH2F *trackerrors_vs_tb_bc = (
TH2F *)
errors->FindKey(
"trackerrors_vs_tb_bc")->ReadObj();
4329 TH2F *trackerrors_vs_tb_ea = (
TH2F *)
errors->FindKey(
"trackerrors_vs_tb_ea")->ReadObj();
4330 TH2F *trackerrors_vs_tb_ec = (
TH2F *)
errors->FindKey(
"trackerrors_vs_tb_ec")->ReadObj();
4334 TGraphErrors *tresTRT =
GetPWidth(pull_vs_tb_trt);
4335 TGraphErrors *tresBA =
GetPWidth(pull_vs_tb_ba);
4336 tresBA->SetLineColor(kRed);
4337 tresBA->SetMarkerColor(kRed);
4338 TGraphErrors *tresBC =
GetPWidth(pull_vs_tb_bc);
4339 tresBC->SetLineColor(kBlue);
4340 tresBC->SetMarkerColor(kBlue);
4341 TGraphErrors *tresEA =
GetPWidth(pull_vs_tb_ea);
4342 tresEA->SetLineColor(kGreen);
4343 tresEA->SetMarkerColor(kGreen);
4344 TGraphErrors *tresEC =
GetPWidth(pull_vs_tb_ec);
4345 tresEC->SetLineColor(kYellow);
4346 tresEC->SetMarkerColor(kYellow);
4348 tresTRT->SetTitle(
"Pull Width VS Drift Time. Pt>2GeV");
4349 tresTRT->GetXaxis()->SetTitle(
"Drift Time ");
4350 tresTRT->GetYaxis()->SetTitle(
" ");
4351 tresTRT->GetYaxis()->SetRangeUser(0.7, 1.3);
4352 tresTRT->Draw(
"ALP");
4359 TGraphErrors *errorsTRT =
GetMeanE(errors_vs_tb_trt);
4360 TGraphErrors *errorsBA =
GetMeanE(errors_vs_tb_ba);
4361 errorsBA->SetLineColor(kRed);
4362 errorsBA->SetMarkerColor(kRed);
4363 TGraphErrors *errorsBC =
GetMeanE(errors_vs_tb_bc);
4364 errorsBC->SetLineColor(kBlue);
4365 errorsBC->SetMarkerColor(kBlue);
4366 TGraphErrors *errorsEA =
GetMeanE(errors_vs_tb_ea);
4367 errorsEA->SetLineColor(kGreen);
4368 errorsEA->SetMarkerColor(kGreen);
4369 TGraphErrors *errorsEC =
GetMeanE(errors_vs_tb_ec);
4370 errorsEC->SetLineColor(kYellow);
4371 errorsEC->SetMarkerColor(kYellow);
4372 errorsTRT->SetTitle(
"Error VS Drift Time");
4373 errorsTRT->GetXaxis()->SetTitle(
"Drift Time");
4374 errorsTRT->GetYaxis()->SetTitle(
"mm");
4375 errorsTRT->GetYaxis()->SetRangeUser(0.05, 0.24);
4376 errorsTRT->Draw(
"ALP");
4377 errorsBA->Draw(
"LP");
4378 errorsBC->Draw(
"LP");
4379 errorsEA->Draw(
"LP");
4380 errorsEC->Draw(
"LP");
4383 TGraphErrors *ntresBA =
GetPn(pull_vs_tb_ba);
4384 ntresBA->SetLineColor(kRed);
4385 ntresBA->SetMarkerColor(kRed);
4386 TGraphErrors *ntresBC =
GetPn(pull_vs_tb_bc);
4387 ntresBC->SetLineColor(kBlue);
4388 ntresBC->SetMarkerColor(kBlue);
4389 TGraphErrors *ntresEA =
GetPn(pull_vs_tb_ea);
4390 ntresEA->SetLineColor(kGreen);
4391 ntresEA->SetMarkerColor(kGreen);
4392 TGraphErrors *ntresEC =
GetPn(pull_vs_tb_ec);
4393 ntresEC->SetLineColor(kYellow);
4394 ntresEC->SetMarkerColor(kYellow);
4395 ntresEA->SetTitle(
"Number of hits VS Drift Time. Pt>2GeV");
4396 ntresEA->GetXaxis()->SetTitle(
"Drift Time");
4397 ntresEA->GetYaxis()->SetTitle(
" hits ");
4398 ntresEA->Draw(
"ALP");
4399 ntresEC->Draw(
"LP");
4400 ntresBA->Draw(
"LP");
4401 ntresBC->Draw(
"LP");
4404 TGraphErrors *terrorsTRT =
GetMean(trackerrors_vs_tb_trt);
4405 TGraphErrors *terrorsBA =
GetMean(trackerrors_vs_tb_ba);
4406 terrorsBA->SetLineColor(kRed);
4407 terrorsBA->SetMarkerColor(kRed);
4408 TGraphErrors *terrorsBC =
GetMean(trackerrors_vs_tb_bc);
4409 terrorsBC->SetLineColor(kBlue);
4410 terrorsBC->SetMarkerColor(kBlue);
4411 TGraphErrors *terrorsEA =
GetMean(trackerrors_vs_tb_ea);
4412 terrorsEA->SetLineColor(kGreen);
4413 terrorsEA->SetMarkerColor(kGreen);
4414 TGraphErrors *terrorsEC =
GetMean(trackerrors_vs_tb_ec);
4415 terrorsEC->SetLineColor(kYellow);
4416 terrorsEC->SetMarkerColor(kYellow);
4417 terrorsTRT->SetTitle(
"Track Error VS Drift Time");
4418 terrorsTRT->GetXaxis()->SetTitle(
"Drift Time");
4419 terrorsTRT->GetYaxis()->SetTitle(
"mm");
4420 terrorsTRT->GetYaxis()->SetRangeUser(0.0, 0.07);
4421 terrorsTRT->Draw(
"ALP");
4422 terrorsBA->Draw(
"LP");
4423 terrorsBC->Draw(
"LP");
4424 terrorsEA->Draw(
"LP");
4425 terrorsEC->Draw(
"LP");
4428 TGraphErrors *residualTRT =
GetWidth(residual_vs_tb_trt);
4429 TGraphErrors *residualBA =
GetWidth(residual_vs_tb_ba);
4430 residualBA->SetLineColor(kRed);
4431 residualBA->SetMarkerColor(kRed);
4432 TGraphErrors *residualBC =
GetWidth(residual_vs_tb_bc);
4433 residualBC->SetLineColor(kBlue);
4434 residualBC->SetMarkerColor(kBlue);
4435 TGraphErrors *residualEA =
GetWidth(residual_vs_tb_ea);
4436 residualEA->SetLineColor(kGreen);
4437 residualEA->SetMarkerColor(kGreen);
4438 TGraphErrors *residualEC =
GetWidth(residual_vs_tb_ec);
4439 residualEC->SetLineColor(kYellow);
4440 residualEC->SetMarkerColor(kYellow);
4441 residualTRT->SetTitle(
"Residual VS Drift Time. Pt > 2GeV");
4442 residualTRT->GetXaxis()->SetTitle(
"Drift Time ");
4443 residualTRT->GetYaxis()->SetTitle(
"mm");
4444 residualTRT->GetYaxis()->SetRangeUser(0.05, 0.24);
4445 residualTRT->Draw(
"ALP");
4446 residualBA->Draw(
"LP");
4447 residualBC->Draw(
"LP");
4448 residualEA->Draw(
"LP");
4449 residualEC->Draw(
"LP");
4453 TH2F *residual_trt = (
TH2F *)
errors->FindKey(
"tresidual_trt")->ReadObj();
4454 TH2F *residual_ba = (
TH2F *)
errors->FindKey(
"tresidual_ba")->ReadObj();
4455 TH2F *residual_bc = (
TH2F *)
errors->FindKey(
"tresidual_bc")->ReadObj();
4456 TH2F *residual_ea = (
TH2F *)
errors->FindKey(
"tresidual_ea")->ReadObj();
4457 TH2F *residual_ec = (
TH2F *)
errors->FindKey(
"tresidual_ec")->ReadObj();
4459 TH2F *residual_trtP = (
TH2F *)
errors->FindKey(
"tresidual_trtP")->ReadObj();
4460 TH2F *residual_baP = (
TH2F *)
errors->FindKey(
"tresidual_baP")->ReadObj();
4461 TH2F *residual_bcP = (
TH2F *)
errors->FindKey(
"tresidual_bcP")->ReadObj();
4462 TH2F *residual_eaP = (
TH2F *)
errors->FindKey(
"tresidual_eaP")->ReadObj();
4463 TH2F *residual_ecP = (
TH2F *)
errors->FindKey(
"tresidual_ecP")->ReadObj();
4465 TGraphErrors *residualTRT1 =
GetEntries(residual_trt);
4466 TGraphErrors *residualBA1 =
GetEntries(residual_ba);
4467 residualBA1->SetLineColor(kRed);
4468 residualBA1->SetMarkerColor(kRed);
4469 TGraphErrors *residualBC1 =
GetEntries(residual_bc);
4470 residualBC1->SetLineColor(kBlue);
4471 residualBC1->SetMarkerColor(kBlue);
4472 TGraphErrors *residualEA1 =
GetEntries(residual_ea);
4473 residualEA1->SetLineColor(kGreen);
4474 residualEA1->SetMarkerColor(kGreen);
4475 TGraphErrors *residualEC1 =
GetEntries(residual_ec);
4476 residualEC1->SetLineColor(kYellow);
4477 residualEC1->SetMarkerColor(kYellow);
4479 TGraphErrors *residualTRT2 =
GetEntries(residual_trtP);
4480 TGraphErrors *residualBA2 =
GetEntries(residual_baP);
4481 residualBA2->SetLineColor(kRed);
4482 residualBA2->SetMarkerColor(kRed);
4483 TGraphErrors *residualBC2 =
GetEntries(residual_bcP);
4484 residualBC2->SetLineColor(kBlue);
4485 residualBC2->SetMarkerColor(kBlue);
4486 TGraphErrors *residualEA2 =
GetEntries(residual_eaP);
4487 residualEA2->SetLineColor(kGreen);
4488 residualEA2->SetMarkerColor(kGreen);
4489 TGraphErrors *residualEC2 =
GetEntries(residual_ecP);
4490 residualEC2->SetLineColor(kYellow);
4491 residualEC2->SetMarkerColor(kYellow);
4493 int nbins = residualTRT1->GetN();
4495 TGraphErrors *ratioTRT =
new TGraphErrors(
nbins);
4496 TGraphErrors *ratioBA =
new TGraphErrors(
nbins);
4497 TGraphErrors *ratioBC =
new TGraphErrors(
nbins);
4498 TGraphErrors *ratioEA =
new TGraphErrors(
nbins);
4499 TGraphErrors *ratioEC =
new TGraphErrors(
nbins);
4506 residualTRT1->GetPoint(
i,
x,
all);
4507 residualTRT2->GetPoint(
i,
x,
prec);
4508 cout <<
i <<
" " <<
x <<
" " <<
prec <<
" " <<
all << endl;
4515 ratioTRT->SetPoint(
i,
x, 0);
4517 residualBA1->GetPoint(
i,
x,
all);
4518 residualBA2->GetPoint(
i,
x,
prec);
4519 cout <<
i <<
" " <<
x <<
" " <<
prec <<
" " <<
all << endl;
4526 ratioBA->SetPoint(
i,
x, 0);
4529 residualBC1->GetPoint(
i,
x,
all);
4530 residualBC2->GetPoint(
i,
x,
prec);
4531 cout <<
i <<
" " <<
x <<
" " <<
prec <<
" " <<
all << endl;
4538 ratioBC->SetPoint(
i,
x, 0);
4541 residualEA1->GetPoint(
i,
x,
all);
4542 residualEA2->GetPoint(
i,
x,
prec);
4543 cout <<
i <<
" " <<
x <<
" " <<
prec <<
" " <<
all << endl;
4550 ratioEA->SetPoint(
i,
x, 0);
4553 residualEC1->GetPoint(
i,
x,
all);
4554 residualEC2->GetPoint(
i,
x,
prec);
4555 cout <<
i <<
" " <<
x <<
" " <<
prec <<
" " <<
all << endl;
4562 ratioEC->SetPoint(
i,
x, 0);
4567 ratioTRT->SetTitle(
"Ratio Precision Hits Vs Pt. Pt > 2GeV");
4568 ratioTRT->GetXaxis()->SetTitle(
"Precission Hits/Total Hits ");
4569 ratioTRT->GetYaxis()->SetTitle(
"pt");
4570 ratioTRT->GetYaxis()->SetRangeUser(0.05, 0.24);
4571 ratioTRT->GetYaxis()->SetRangeUser(0.3, 1);
4573 ratioBA->SetLineColor(kRed);
4574 ratioBC->SetLineColor(kBlue);
4575 ratioEA->SetLineColor(kGreen);
4576 ratioEC->SetLineColor(kYellow);
4578 ratioTRT->Draw(
"alp");
4579 ratioBA->Draw(
"lp");
4580 ratioBC->Draw(
"lp");
4581 ratioEA->Draw(
"lp");
4582 ratioEC->Draw(
"lp");
4586 cout <<
" Not enough keys in Errors directory for tb dependence plots " << endl;
4602 cout <<
"READING CORRECTIONS: " << endl;
4605 m_errors = (TDirectory *)
file->FindKey(
"Correction")->ReadObj();
4607 m_errors = (TDirectory *)
file->FindKey(
"CorrectionAr")->ReadObj();
4609 this->Divide(2, 3, 0.01, 0.01);
4613 TH2F *tres_vs_ToT_ba =
nullptr;
4614 TH2F *tres_vs_ToT_bc =
nullptr;
4616 TH2F *res_vs_ToT_ba =
nullptr;
4617 TH2F *res_vs_ToT_bc =
nullptr;
4625 if (m_errors->FindKey(
"tres_vs_ToT_ba"))
4626 tres_vs_ToT_ba = (
TH2F *)m_errors->FindKey(
"tres_vs_ToT_ba")->ReadObj();
4627 if (m_errors->FindKey(
"res_vs_ToT_ba"))
4628 res_vs_ToT_ba = (
TH2F *)m_errors->FindKey(
"res_vs_ToT_ba")->ReadObj();
4629 if (m_errors->FindKey(
"tres_vs_ToT_bc"))
4630 tres_vs_ToT_bc = (
TH2F *)m_errors->FindKey(
"tres_vs_ToT_bc")->ReadObj();
4631 if (m_errors->FindKey(
"res_vs_ToT_bc"))
4632 res_vs_ToT_bc = (
TH2F *)m_errors->FindKey(
"res_vs_ToT_bc")->ReadObj();
4636 if (m_errors->FindKey(
"tres_vs_ToT_ea"))
4637 tres_vs_ToT_ba = (
TH2F *)m_errors->FindKey(
"tres_vs_ToT_ea")->ReadObj();
4638 if (m_errors->FindKey(
"res_vs_ToT_ea"))
4639 res_vs_ToT_ba = (
TH2F *)m_errors->FindKey(
"res_vs_ToT_ea")->ReadObj();
4640 if (m_errors->FindKey(
"tres_vs_ToT_ec"))
4641 tres_vs_ToT_bc = (
TH2F *)m_errors->FindKey(
"tres_vs_ToT_ec")->ReadObj();
4642 if (m_errors->FindKey(
"res_vs_ToT_ec"))
4643 res_vs_ToT_bc = (
TH2F *)m_errors->FindKey(
"res_vs_ToT_ec")->ReadObj();
4650 if (m_errors->FindKey(
"tres_vs_HT_ba"))
4651 tres_vs_ToT_ba = (
TH2F *)m_errors->FindKey(
"tres_vs_HT_ba")->ReadObj();
4652 if (m_errors->FindKey(
"res_vs_HT_ba"))
4653 res_vs_ToT_ba = (
TH2F *)m_errors->FindKey(
"res_vs_HT_ba")->ReadObj();
4654 if (m_errors->FindKey(
"tres_vs_HT_bc"))
4655 tres_vs_ToT_bc = (
TH2F *)m_errors->FindKey(
"tres_vs_HT_bc")->ReadObj();
4656 if (m_errors->FindKey(
"res_vs_HT_bc"))
4657 res_vs_ToT_bc = (
TH2F *)m_errors->FindKey(
"res_vs_HT_bc")->ReadObj();
4661 if (m_errors->FindKey(
"tres_vs_HT_ea"))
4662 tres_vs_ToT_ba = (
TH2F *)m_errors->FindKey(
"tres_vs_HT_ea")->ReadObj();
4663 if (m_errors->FindKey(
"res_vs_HT_ea"))
4664 res_vs_ToT_ba = (
TH2F *)m_errors->FindKey(
"res_vs_HT_ea")->ReadObj();
4665 if (m_errors->FindKey(
"tres_vs_HT_ec"))
4666 tres_vs_ToT_bc = (
TH2F *)m_errors->FindKey(
"tres_vs_HT_ec")->ReadObj();
4667 if (m_errors->FindKey(
"res_vs_HT_ec"))
4668 res_vs_ToT_bc = (
TH2F *)m_errors->FindKey(
"res_vs_HT_ec")->ReadObj();
4678 if (m_errors->FindKey(
"tresAr_vs_ToT_ba"))
4679 tres_vs_ToT_ba = (
TH2F *)m_errors->FindKey(
"tresAr_vs_ToT_ba")->ReadObj();
4680 if (m_errors->FindKey(
"resAr_vs_ToT_ba"))
4681 res_vs_ToT_ba = (
TH2F *)m_errors->FindKey(
"resAr_vs_ToT_ba")->ReadObj();
4682 if (m_errors->FindKey(
"tresAr_vs_ToT_bc"))
4683 tres_vs_ToT_bc = (
TH2F *)m_errors->FindKey(
"tresAr_vs_ToT_bc")->ReadObj();
4684 if (m_errors->FindKey(
"resAr_vs_ToT_bc"))
4685 res_vs_ToT_bc = (
TH2F *)m_errors->FindKey(
"resAr_vs_ToT_bc")->ReadObj();
4689 if (m_errors->FindKey(
"tresAr_vs_ToT_ea"))
4690 tres_vs_ToT_ba = (
TH2F *)m_errors->FindKey(
"tresAr_vs_ToT_ea")->ReadObj();
4691 if (m_errors->FindKey(
"resAr_vs_ToT_ea"))
4692 res_vs_ToT_ba = (
TH2F *)m_errors->FindKey(
"resAr_vs_ToT_ea")->ReadObj();
4693 if (m_errors->FindKey(
"tresAr_vs_ToT_ec"))
4694 tres_vs_ToT_bc = (
TH2F *)m_errors->FindKey(
"tresAr_vs_ToT_ec")->ReadObj();
4695 if (m_errors->FindKey(
"resAr_vs_ToT_ec"))
4696 res_vs_ToT_bc = (
TH2F *)m_errors->FindKey(
"resAr_vs_ToT_ec")->ReadObj();
4703 if (m_errors->FindKey(
"tresAr_vs_HT_ba"))
4704 tres_vs_ToT_ba = (
TH2F *)m_errors->FindKey(
"tresAr_vs_HT_ba")->ReadObj();
4705 if (m_errors->FindKey(
"resAr_vs_HT_ba"))
4706 res_vs_ToT_ba = (
TH2F *)m_errors->FindKey(
"resAr_vs_HT_ba")->ReadObj();
4707 if (m_errors->FindKey(
"tresAr_vs_HT_bc"))
4708 tres_vs_ToT_bc = (
TH2F *)m_errors->FindKey(
"tresAr_vs_HT_bc")->ReadObj();
4709 if (m_errors->FindKey(
"resAr_vs_HT_bc"))
4710 res_vs_ToT_bc = (
TH2F *)m_errors->FindKey(
"resAr_vs_HT_bc")->ReadObj();
4714 if (m_errors->FindKey(
"tresAr_vs_HT_ea"))
4715 tres_vs_ToT_ba = (
TH2F *)m_errors->FindKey(
"tresAr_vs_HT_ea")->ReadObj();
4716 if (m_errors->FindKey(
"resAr_vs_HT_ea"))
4717 res_vs_ToT_ba = (
TH2F *)m_errors->FindKey(
"resAr_vs_HT_ea")->ReadObj();
4718 if (m_errors->FindKey(
"tresAr_vs_HT_ec"))
4719 tres_vs_ToT_bc = (
TH2F *)m_errors->FindKey(
"tresAr_vs_HT_ec")->ReadObj();
4720 if (m_errors->FindKey(
"resAr_vs_HT_ec"))
4721 res_vs_ToT_bc = (
TH2F *)m_errors->FindKey(
"resAr_vs_HT_ec")->ReadObj();
4728 TGraphErrors *tresBA =
GetMean(tres_vs_ToT_ba);
4729 tresBA->SetLineColor(kRed);
4730 tresBA->SetMarkerColor(kRed);
4731 if (not tres_vs_ToT_ba){
4732 throw std::runtime_error(
"tres_vs_ToT_ba pointer is null");
4735 tres_vs_ToT_ba->SetTitle(
"Barrel A Time Residual Mean VS ToT");
4737 tres_vs_ToT_ba->SetTitle(
"Endcap A Time Residual Mean VS ToT");
4738 tres_vs_ToT_ba->GetXaxis()->SetTitle(
"ToT (bin)");
4739 tres_vs_ToT_ba->GetYaxis()->SetTitle(
"Time Residual (ns)");
4743 tres_vs_ToT_ba->SetTitle(
"Barrel A Time Residual Mean VS HT");
4745 tres_vs_ToT_ba->SetTitle(
"Endcap A Time Residual Mean VS HT");}
4746 tres_vs_ToT_ba->GetXaxis()->SetTitle(
"HT (bin)");
4749 tres_vs_ToT_ba->Draw(
"colz");
4750 tresBA->Draw(
"same");
4753 TGraphErrors *tresBC =
GetMean(tres_vs_ToT_bc);
4754 tresBC->SetLineColor(kBlue);
4755 tresBC->SetMarkerColor(kBlue);
4757 if (not tres_vs_ToT_bc){
4758 throw std::runtime_error(
" tres_vs_ToT_bc is null");
4760 tres_vs_ToT_bc->SetTitle(
"Barrel C Time Residual Mean VS ToT");
4762 tres_vs_ToT_bc->SetTitle(
"Endcap C Time Residual Mean VS ToT");}
4763 tres_vs_ToT_bc->GetXaxis()->SetTitle(
"ToT (bin)");
4764 tres_vs_ToT_bc->GetYaxis()->SetTitle(
"Time Residual (ns)");
4767 tres_vs_ToT_bc->SetTitle(
"Barrel C Time Residual Mean VS HT");
4769 tres_vs_ToT_bc->SetTitle(
"Endcap C Time Residual Mean VS HT");
4771 tres_vs_ToT_bc->GetXaxis()->SetTitle(
"HT (bin)");
4774 tres_vs_ToT_bc->Draw(
"colz");
4775 tresBC->Draw(
"same");
4778 tresBA->SetTitle(
"Barrel Time Residual Mean vs ToT");
4780 tresBA->SetTitle(
"Endcap Time Residual Mean vs ToT");
4781 tresBA->GetXaxis()->SetTitle(
"ToT (bin)");
4785 tresBA->SetTitle(
"Barrel Time Residual Mean vs HT");
4787 tresBA->SetTitle(
"Endcap Time Residual Mean vs HT");
4788 tresBA->GetXaxis()->SetTitle(
"HT");
4790 tresBA->GetXaxis()->SetRangeUser(-0.5, 23.5);
4791 tresBA->GetYaxis()->SetRangeUser(-10, 10);
4794 tresBA->GetXaxis()->SetRangeUser(-0.5, 1.5);
4795 tresBA->GetYaxis()->SetRangeUser(-3, 3);
4797 tresBA->Draw(
"alp");
4798 tresBC->Draw(
"same");
4801 TGraphErrors *resBA1 =
GetMean(res_vs_ToT_ba);
4802 resBA1->SetLineColor(kRed);
4803 resBA1->SetMarkerColor(kRed);
4804 if (not res_vs_ToT_ba){
4805 throw std::runtime_error(
"res_vs_ToT_ba is null ptr");
4808 res_vs_ToT_ba->SetTitle(
"Barrel A Residual Mean VS ToT");
4810 res_vs_ToT_ba->SetTitle(
"Endcap A Residual Mean VS ToT");
4811 res_vs_ToT_ba->GetXaxis()->SetTitle(
"ToT (bin)");
4812 res_vs_ToT_ba->GetYaxis()->SetTitle(
"Residual (mm)");
4816 res_vs_ToT_ba->SetTitle(
"Barrel A Residual Mean VS HT");
4818 res_vs_ToT_ba->SetTitle(
"Endcap A Residual Mean VS HT");
4819 res_vs_ToT_ba->GetXaxis()->SetTitle(
"HT (bin)");
4821 res_vs_ToT_ba->Draw(
"colz");
4822 resBA1->Draw(
"same");
4825 TGraphErrors *resBC1 =
GetMean(res_vs_ToT_bc);
4826 resBC1->SetLineColor(kBlue);
4827 resBC1->SetMarkerColor(kBlue);
4829 res_vs_ToT_bc->SetTitle(
"Barrel C Residual Mean VS ToT");
4831 res_vs_ToT_bc->SetTitle(
"Endcap C Residual Mean VS ToT");
4832 res_vs_ToT_bc->GetXaxis()->SetTitle(
"ToT (bin)");
4833 res_vs_ToT_bc->GetYaxis()->SetTitle(
"Residual (mm)");
4837 res_vs_ToT_bc->SetTitle(
"Barrel C Residual Mean VS HT");
4839 res_vs_ToT_bc->SetTitle(
"Endcap C Residual Mean VS HT");
4840 res_vs_ToT_bc->GetXaxis()->SetTitle(
"HT (bin)");
4842 res_vs_ToT_bc->Draw(
"colz");
4843 resBC1->Draw(
"same");
4847 TGraphErrors *resBA =
GetWidth(res_vs_ToT_ba);
4848 resBA->SetLineColor(kRed);
4849 resBA->SetMarkerColor(kRed);
4850 TGraphErrors *resBC =
GetWidth(res_vs_ToT_bc);
4851 resBC->SetLineColor(kBlue);
4852 resBC->SetMarkerColor(kBlue);
4853 resBA->SetTitle(
"Barrel Time Residual Width vs ToT");
4855 resBA->SetTitle(
"Endcap Time Residual Width vs ToT");
4856 resBA->GetXaxis()->SetTitle(
"ToT (bin)");
4860 resBA->SetTitle(
"Barrel Residual Width vs HT");
4862 resBA->SetTitle(
"Endcap Residual Width vs HT");
4863 resBA->GetXaxis()->SetTitle(
"HT");
4865 resBA->GetXaxis()->SetRangeUser(-0.5, 23.5);
4866 resBA->GetYaxis()->SetRangeUser(0.08, 0.2);
4869 resBA->GetXaxis()->SetRangeUser(-0.5, 1.5);
4870 resBA->GetYaxis()->SetRangeUser(0.08, 0.2);
4873 resBC->Draw(
"same");
4890 m_errors = (TDirectory *)
file->FindKey(
"Correction")->ReadObj();
4892 m_errors = (TDirectory *)
file->FindKey(
"CorrectionAr")->ReadObj();
4894 throw(
string(
"No errors folder!!!!!!!!!!!!!!!"));
4896 this->Divide(2, 3, 0.01, 0.01);
4900 TH2F *tres_vs_ToT_ba =
nullptr;
4901 TH2F *tres_vs_ToT_bc =
nullptr;
4903 TH2F *res_vs_ToT_ba =
nullptr;
4904 TH2F *res_vs_ToT_bc =
nullptr;
4912 tres_vs_ToT_ba = (
TH2F *)m_errors->FindKey(
"tres_vs_SinOverP_bc")->ReadObj();
4913 res_vs_ToT_ba = (
TH2F *)m_errors->FindKey(
"res_vs_SinOverP_ba")->ReadObj();
4914 tres_vs_ToT_bc = (
TH2F *)m_errors->FindKey(
"tres_vs_SinOverP_bc")->ReadObj();
4915 res_vs_ToT_bc = (
TH2F *)m_errors->FindKey(
"res_vs_SinOverP_bc")->ReadObj();
4919 tres_vs_ToT_ba = (
TH2F *)m_errors->FindKey(
"tres_vs_SinOverP_ea")->ReadObj();
4920 res_vs_ToT_ba = (
TH2F *)m_errors->FindKey(
"res_vs_SinOverP_ea")->ReadObj();
4921 tres_vs_ToT_bc = (
TH2F *)m_errors->FindKey(
"tres_vs_SinOverP_ec")->ReadObj();
4922 res_vs_ToT_bc = (
TH2F *)m_errors->FindKey(
"res_vs_SinOverP_ec")->ReadObj();
4929 tres_vs_ToT_ba = (
TH2F *)m_errors->FindKey(
"tres_vs_CosOverP_bc")->ReadObj();
4930 res_vs_ToT_ba = (
TH2F *)m_errors->FindKey(
"res_vs_CosOverP_ba")->ReadObj();
4931 tres_vs_ToT_bc = (
TH2F *)m_errors->FindKey(
"tres_vs_CosOverP_bc")->ReadObj();
4932 res_vs_ToT_bc = (
TH2F *)m_errors->FindKey(
"res_vs_CosOverP_bc")->ReadObj();
4936 tres_vs_ToT_ba = (
TH2F *)m_errors->FindKey(
"tres_vs_CosOverP_ea")->ReadObj();
4937 res_vs_ToT_ba = (
TH2F *)m_errors->FindKey(
"res_vs_CosOverP_ea")->ReadObj();
4938 tres_vs_ToT_bc = (
TH2F *)m_errors->FindKey(
"tres_vs_CosOverP_ec")->ReadObj();
4939 res_vs_ToT_bc = (
TH2F *)m_errors->FindKey(
"res_vs_CosOverP_ec")->ReadObj();
4949 tres_vs_ToT_ba = (
TH2F *)m_errors->FindKey(
"tresAr_vs_SinOverP_bc")->ReadObj();
4950 res_vs_ToT_ba = (
TH2F *)m_errors->FindKey(
"resAr_vs_SinOverP_ba")->ReadObj();
4951 tres_vs_ToT_bc = (
TH2F *)m_errors->FindKey(
"tresAr_vs_SinOverP_bc")->ReadObj();
4952 res_vs_ToT_bc = (
TH2F *)m_errors->FindKey(
"resAr_vs_SinOverP_bc")->ReadObj();
4956 tres_vs_ToT_ba = (
TH2F *)m_errors->FindKey(
"tresAr_vs_SinOverP_ea")->ReadObj();
4957 res_vs_ToT_ba = (
TH2F *)m_errors->FindKey(
"resAr_vs_SinOverP_ea")->ReadObj();
4958 tres_vs_ToT_bc = (
TH2F *)m_errors->FindKey(
"tresAr_vs_SinOverP_ec")->ReadObj();
4959 res_vs_ToT_bc = (
TH2F *)m_errors->FindKey(
"resAr_vs_SinOverP_ec")->ReadObj();
4966 tres_vs_ToT_ba = (
TH2F *)m_errors->FindKey(
"tresAr_vs_CosOverP_bc")->ReadObj();
4967 res_vs_ToT_ba = (
TH2F *)m_errors->FindKey(
"resAr_vs_CosOverP_ba")->ReadObj();
4968 tres_vs_ToT_bc = (
TH2F *)m_errors->FindKey(
"tresAr_vs_CosOverP_bc")->ReadObj();
4969 res_vs_ToT_bc = (
TH2F *)m_errors->FindKey(
"resAr_vs_CosOverP_bc")->ReadObj();
4973 tres_vs_ToT_ba = (
TH2F *)m_errors->FindKey(
"tresAr_vs_CosOverP_ea")->ReadObj();
4974 res_vs_ToT_ba = (
TH2F *)m_errors->FindKey(
"resAr_vs_CosOverP_ea")->ReadObj();
4975 tres_vs_ToT_bc = (
TH2F *)m_errors->FindKey(
"tresAr_vs_CosOverP_ec")->ReadObj();
4976 res_vs_ToT_bc = (
TH2F *)m_errors->FindKey(
"resAr_vs_CosOverP_ec")->ReadObj();
4983 TGraphErrors *tresBA =
GetMean(tres_vs_ToT_ba);
4984 tresBA->SetLineColor(kRed);
4985 tresBA->SetMarkerColor(kRed);
4987 tres_vs_ToT_ba->SetTitle(
"Barrel A Time Residual Mean VS sin(Theta)/p");
4989 tres_vs_ToT_ba->SetTitle(
"Endcap A Time Residual Mean VS sin(Theta)/p");
4990 tres_vs_ToT_ba->GetXaxis()->SetTitle(
"sin(Theta)/p");
4991 tres_vs_ToT_ba->GetYaxis()->SetTitle(
"Time Residual (ns)");
4996 tres_vs_ToT_ba->SetTitle(
"Barrel A Time Residual Mean VS cos(Theta)/p");
4998 tres_vs_ToT_ba->SetTitle(
"Endcap A Time Residual Mean VS cos(Theta)/p");
4999 tres_vs_ToT_ba->GetXaxis()->SetTitle(
"cos(Theta)/p");
5002 tres_vs_ToT_ba->Draw(
"colz");
5003 tresBA->Draw(
"same");
5006 TGraphErrors *tresBC =
GetMean(tres_vs_ToT_bc);
5007 tresBC->SetLineColor(kBlue);
5008 tresBC->SetMarkerColor(kBlue);
5010 tres_vs_ToT_bc->SetTitle(
"Barrel C Time Residual Mean VS sin(Theta)/p");
5012 tres_vs_ToT_bc->SetTitle(
"Endcap C Time Residual Mean VS sin(Theta)/p");
5013 tres_vs_ToT_bc->GetXaxis()->SetTitle(
"sin(Theta)/p");
5014 tres_vs_ToT_bc->GetYaxis()->SetTitle(
"Time Residual (ns)");
5018 tres_vs_ToT_bc->SetTitle(
"Barrel C Time Residual Mean VS cos(Theta)/p");
5020 tres_vs_ToT_bc->SetTitle(
"Endcap C Time Residual Mean VS cos(Theta)/p");
5021 tres_vs_ToT_bc->GetXaxis()->SetTitle(
"cos(Theta)/p");
5023 tres_vs_ToT_bc->Draw(
"colz");
5024 tresBC->Draw(
"same");
5027 tresBA->SetTitle(
"Barrel Time Residual Mean vs Sin(theta) / p");
5029 tresBA->SetTitle(
"Endcap Time Residual Mean vs Sin(theta) / p");
5033 tresBA->SetTitle(
"Barrel Time Residual Mean vs Cos(theta) / p");
5035 tresBA->SetTitle(
"Endcap Time Residual Mean vs Cos(theta) / p");
5038 tresBA->GetXaxis()->SetRangeUser(0, 1);
5039 tresBA->GetYaxis()->SetRangeUser(-1, 1.5);
5040 tresBA->Draw(
"alp");
5041 tresBC->Draw(
"same");
5044 TGraphErrors *resBA1 =
GetMean(res_vs_ToT_ba);
5045 resBA1->SetLineColor(kRed);
5046 resBA1->SetMarkerColor(kRed);
5048 res_vs_ToT_ba->SetTitle(
"Barrel A Residual Mean VS sin(Theta)/p");
5050 res_vs_ToT_ba->SetTitle(
"Endcap A Residual Mean VS sin(Theta)/p");
5051 res_vs_ToT_ba->GetXaxis()->SetTitle(
"sin(Theta)/p");
5052 res_vs_ToT_ba->GetYaxis()->SetTitle(
"Residual (mm)");
5056 res_vs_ToT_ba->SetTitle(
"Barrel A Residual Mean VS cos(Theta)/p");
5058 res_vs_ToT_ba->SetTitle(
"Endcap A Residual Mean VS cos(Theta)/p");
5059 res_vs_ToT_ba->GetXaxis()->SetTitle(
"cos(Theta)/p");
5061 res_vs_ToT_ba->Draw(
"colz");
5062 resBA1->Draw(
"same");
5065 TGraphErrors *resBC1 =
GetMean(res_vs_ToT_bc);
5066 resBC1->SetLineColor(kBlue);
5067 resBC1->SetMarkerColor(kBlue);
5069 res_vs_ToT_bc->SetTitle(
"Barrel C Residual Mean VS sin(Theta)/p");
5071 res_vs_ToT_bc->SetTitle(
"Endcap C Residual Mean VS sin(Theta)/p");
5072 res_vs_ToT_bc->GetXaxis()->SetTitle(
"sin(Theta)/p");
5073 res_vs_ToT_bc->GetYaxis()->SetTitle(
"Residual (mm)");
5077 res_vs_ToT_bc->SetTitle(
"Barrel C Residual Mean VS cos(Theta)/p");
5079 res_vs_ToT_bc->SetTitle(
"Endcap C Residual Mean VS cos(Theta)/p");
5080 res_vs_ToT_bc->GetXaxis()->SetTitle(
"cos(Theta)/p");
5082 res_vs_ToT_bc->Draw(
"colz");
5083 resBC1->Draw(
"same");
5087 TGraphErrors *resBA =
GetWidth(res_vs_ToT_ba);
5088 resBA->SetLineColor(kRed);
5089 resBA->SetMarkerColor(kRed);
5090 TGraphErrors *resBC =
GetWidth(res_vs_ToT_bc);
5091 resBC->SetLineColor(kBlue);
5092 resBC->SetMarkerColor(kBlue);
5093 resBA->SetTitle(
"Barrel Residual Width vs Sin(theta) / p");
5095 resBA->SetTitle(
"Endcap Residual Widht vs Sin(theta) / p");
5099 resBA->SetTitle(
"Barrel Residual Width vs Cos(theta) / p");
5101 resBA->SetTitle(
"Endcap Residual Widht vs Cos(theta) / p");
5104 resBA->GetXaxis()->SetRangeUser(0, 1);
5105 resBA->GetYaxis()->SetRangeUser(0.08, 0.20);
5107 resBC->Draw(
"same");
5117 TFile *datafile =
new TFile(
argv[2]);
5118 if (datafile->IsZombie())
5120 cout <<
"ERROR! INPUT FILE DOES NOT EXIST!" << endl;
5125 if (datafile->FindKey(
"TRT_Ar_all"))
5128 cout <<
" This run contains straws with Argon" << endl;
5130 if (!datafile->FindKey(
"Chip_Artuple"))
5133 cout <<
" This run contains does not have Argon ntuples" << endl;
5139 bool useref =
false;
5143 refdatafile =
new TFile(
argv[4]);
5144 if (refdatafile->IsZombie())
5146 cout <<
"INPUT REFERENCE FILE DOES NOT EXIST! RUNNING WITHOUT IT!" << endl;
5150 cout <<
"INPUT REFERENCE FILE OK!" << endl;
5154 cout <<
"MAKING FirstPage" << endl;
5166 cout <<
"MAKING Settings" << endl;
5171 cout <<
"MAKING TracktupleInfo" << endl;
5184 cout <<
"MAKING HitStatistics" << endl;
5190 cout <<
"MAKING Ar HitStatistics" << endl;
5195 cout <<
"MAKING TRTPlots" << endl;
5218 cout <<
"MAKING ResidualPlots" << endl;
5240 cout <<
"MAKING T0CalibTypeXY" << endl;
5247 cout <<
"MAKING XYMaps(nt0)" << endl;
5249 XYMaps *nhitsAr =
nullptr;
5253 cout <<
"MAKING XYMaps(res)" << endl;
5255 XYMaps *resxy0Ar =
nullptr;
5259 cout <<
"MAKING XYMaps(resmean)" << endl;
5261 XYMaps *resxyAr =
nullptr;
5263 resxyAr =
new XYMaps(
argv[2],
"abs(resMean)",
true);
5265 cout <<
"MAKING XYMaps(t0)" << endl;
5267 XYMaps *xymapAr =
nullptr;
5271 cout <<
"MAKING XYMaps(oldt0)" << endl;
5273 XYMaps *oldt0Ar =
nullptr;
5275 oldt0Ar =
new XYMaps(
argv[2],
"oldt0",
true);
5277 cout <<
"MAKING XYMaps(t0-oldt0)" << endl;
5279 XYMaps *oldt01Ar =
nullptr;
5281 oldt01Ar =
new XYMaps(
argv[2],
"abs(t0-oldt0)",
true);
5283 cout <<
"MAKING XYMaps(tresMean)" << endl;
5285 XYMaps *oldt0111Ar =
nullptr;
5287 oldt0111Ar =
new XYMaps(
argv[2],
"abs(tresMean)",
true);
5289 cout <<
"MAKING XYMaps(tres)" << endl;
5291 XYMaps *oldt011Ar =
nullptr;
5293 oldt011Ar =
new XYMaps(
argv[2],
"(tres)",
true);
5298 if (datafile->FindKey(
"TRT_all"))
5300 cout <<
"MAKING ChipVariations" << endl;
5312 cout <<
"MAKING BoardVariationsOldT0" << endl;
5315 refboardgraphA->SetLineColor(2);
5316 refboardgraphC->SetLineColor(2);
5317 cout <<
"MAKING BoardVariationsDiff" << endl;
5322 cout <<
"MAKING BoardVariations" << endl;
5326 cout <<
"MAKING BoardVariationsRes" << endl;
5330 cout <<
"MAKING BoardVariationsTRes" << endl;
5334 cout <<
"MAKING BoardVariationsTRes1" << endl;
5339 RtGraphs *rtrelation_bar =
nullptr;
5349 if (datafile->FindKey(
"TRT_all"))
5351 cout <<
"MAKING RtGraphs" << endl;
5352 TDirectory *trt = (TDirectory *)datafile->FindKey(
"TRT_all")->ReadObj();
5354 if (trt->FindKey(
"WholeBarrel_1"))
5358 rtrelation_bar =
new RtGraphs(
argv[2],
"WholeBarrel_1");
5365 if (trt->FindKey(
"Detector_-1"))
5376 if (trt->FindKey(
"Detector_1"))
5387 if (trt->FindKey(
"Detector_-2"))
5398 if (trt->FindKey(
"Detector_2"))
5410 cout <<
"MAKING Rt binning" << endl;
5418 cout <<
"MAKING Rt binning for Detector_-2" << endl;
5419 rtbinning3 =
new RtBinning(trt,
"Detector_-2");
5420 cout <<
"MAKING Rt binning for Detector_2" << endl;
5421 rtbinning4 =
new RtBinning(trt,
"Detector_2");
5436 cout <<
"MAKING Binned Residual" << endl;
5446 cout <<
"MAKING Binned Residual for Detector_-2" << endl;
5447 binres3 =
new RresTbin(datafile,
"Detector_-2", -2);
5449 cout <<
"MAKING Binned Residual for Detector_2" << endl;
5450 binres4 =
new RresTbin(datafile,
"Detector_2", 2);
5460 cout <<
"MAKING RtColor" << endl;
5462 if (datafile->FindKey(
"TRT_all"))
5464 cout <<
" found TRT_all " << endl;
5469 TDirectory *trt = (TDirectory *)datafile->FindKey(
"TRT_all")->ReadObj();
5493 if (trt->FindKey(
"Detector_-2"))
5495 cout <<
" MAKING RtColor Detector_-2" << endl;
5506 if (trt->FindKey(
"Detector_2"))
5508 cout <<
" MAKING RtColor Detector_2" << endl;
5611 cout <<
"MAKING RT Binned Residual for Ar" << endl;
5613 TDirectory *trtAr = (TDirectory *)datafile->FindKey(
"TRT_Ar_all")->ReadObj();
5624 cout <<
"MAKING RT Binned Abs Residual for Ar" << endl;
5652 if (trtAr->FindKey(
"Detector_Ar_-1"))
5654 cout <<
" MAKING AR RtColor det -1" << endl;
5657 rtArcol2 =
new RtColor(
argv[2],
"Detector_Ar_-1",
true);
5664 if (trtAr->FindKey(
"Detector_Ar_1"))
5666 cout <<
" MAKING AR RtColor det 1" << endl;
5669 rtArcol3 =
new RtColor(
argv[2],
"Detector_Ar_1",
true);
5676 if (trtAr->FindKey(
"Detector_Ar_-2"))
5678 cout <<
" MAKING AR RtColor det -2" << endl;
5681 rtArcol4 =
new RtColor(
argv[2],
"Detector_Ar_-2",
true);
5688 if (trtAr->FindKey(
"Detector_Ar_2"))
5690 cout <<
" MAKING AR RtColor det 2" << endl;
5693 rtArcol5 =
new RtColor(
argv[2],
"Detector_Ar_2",
true);
5707 cout <<
"MAKING BoardVariationsOldT0 for Ar" << endl;
5710 cout <<
"MAKING BoardVariationsDiff Ar" << endl;
5713 boarddiffECgraphA->SetLineColor(2);
5714 boarddiffECgraphC->SetLineColor(2);
5717 cout <<
"MAKING BoardVariations Ar" << endl;
5721 cout <<
"MAKING BoardVariationsRes Ar" << endl;
5725 cout <<
"MAKING BoardVariationsTRes Ar" << endl;
5729 cout <<
"MAKING BoardVariationsTRes1" << endl;
5733 cout <<
" Start printing itersum.ps" << endl;
5737 TCanvas *
c1 =
new TCanvas();
5738 c1->Print(
"itersum.ps[");
5742 firstpage->Print(
"itersum.ps");
5745 settings->Print(
"itersum.ps");
5748 tracktupleinfo->Print(
"itersum.ps");
5751 hitstat->Print(
"itersum.ps");
5754 hitstatAr->Print(
"itersum.ps");
5757 gStyle->SetOptStat(0);
5759 resplots->Print(
"itersum.ps");
5762 resplotsAr->Print(
"itersum.ps");
5765 textpage =
new TextPage(
" BARREL PLOTS ");
5766 textpage->Print(
"itersum.ps");
5769 hitstatxy->Print(
"itersum.ps");
5772 hitstatxyAr->Print(
"itersum.ps");
5774 nhits->Print(
"itersum.ps");
5777 nhitsAr->Print(
"itersum.ps");
5779 resxy0->Print(
"itersum.ps");
5782 resxy0Ar->Print(
"itersum.ps");
5784 resxy->Print(
"itersum.ps");
5787 resxyAr->Print(
"itersum.ps");
5789 xymap->Print(
"itersum.ps");
5792 xymapAr->Print(
"itersum.ps");
5796 oldt0->Print(
"itersum.ps");
5799 oldt0Ar->Print(
"itersum.ps");
5802 oldt01->Print(
"itersum.ps");
5805 oldt01Ar->Print(
"itersum.ps");
5809 oldt0111->Print(
"itersum.ps");
5812 oldt0111Ar->Print(
"itersum.ps");
5815 oldt011->Print(
"itersum.ps");
5818 oldt011Ar->Print(
"itersum.ps");
5823 double lowe = -3.5, upe = 3.5;
5825 if (chipgraphA && chipgraphC)
5827 chipgraphA->GetYaxis()->SetRangeUser(lowe, upe);
5828 chipgraphC->GetYaxis()->SetRangeUser(lowe, upe);
5830 c1->Divide(1, 2, 0.01, 0.01);
5837 c1->Print(
"itersum.ps");
5842 c1->Divide(1, 2, 0.01, 0.01);
5844 boardgraphA->Draw(
"apl");
5847 refboardgraphA->Draw(
"pl");
5848 TLegend *
leg =
new TLegend(0.8, 0.8, 0.98, 0.95);
5849 leg->AddEntry(boardgraphA,
"data",
"l");
5851 leg->AddEntry(refboardgraphA,
"ref (input to 1st it)",
"l");
5852 leg->SetTextSize(0.03);
5855 boardgraphC->Draw(
"apl");
5858 refboardgraphC->Draw(
"pl");
5859 c1->Print(
"itersum.ps");
5866 c1->Divide(1, 2, 0.01, 0.01);
5868 boarddiffgraphA->Draw(
"ap");
5872 boarddiffgraphC->Draw(
"ap");
5875 c1->Print(
"itersum.ps");
5880 c1->Divide(1, 2, 0.01, 0.01);
5882 boardgraphA1->Draw(
"apl");
5885 boardgraphC1->Draw(
"apl");
5887 c1->Print(
"itersum.ps");
5891 c1->Divide(1, 2, 0.01, 0.01);
5893 boardgraphA2->Draw(
"apl");
5896 boardgraphC2->Draw(
"apl");
5898 c1->Print(
"itersum.ps");
5902 c1->Divide(1, 2, 0.01, 0.01);
5904 boardgraphA3->Draw(
"apl");
5907 boardgraphC3->Draw(
"apl");
5909 c1->Print(
"itersum.ps");
5915 textpage =
new TextPage(
"ENDCAP PLOTS");
5916 textpage->Print(
"itersum.ps");
5919 cout <<
"MAKING PLOTS FOR ENDCAPS" << endl;
5923 ntypeEC->Print(
"itersum.ps");
5928 ntypeECAr->Print(
"itersum.ps");
5933 nhitsEC->Print(
"itersum.ps");
5938 nhitsECAr->Print(
"itersum.ps");
5942 resxy0EC->Print(
"itersum.ps");
5947 resxy0ECAr->Print(
"itersum.ps");
5951 resxyM0EC->Print(
"itersum.ps");
5955 resxyM0ECAr =
new XYMapsEC(
argv[2],
"abs(resMean)",
true);
5956 resxyM0ECAr->Print(
"itersum.ps");
5961 xymapEC->Print(
"itersum.ps");
5966 xymapECAr->Print(
"itersum.ps");
5974 oldt0EC->Print(
"itersum.ps");
5981 oldt0ECAr->Print(
"itersum.ps");
5987 oldt01EC->Print(
"itersum.ps");
5991 oldt01ECAr =
new XYMapsEC(
argv[2],
"abs(t0-oldt0)",
true);
5992 oldt01ECAr->Print(
"itersum.ps");
6001 oldt0111EC->Print(
"itersum.ps");
6007 oldt0111ECAr =
new XYMapsEC(
argv[2],
"abs(tresMean)",
true);
6008 oldt0111ECAr->Print(
"itersum.ps");
6013 oldt011EC->Print(
"itersum.ps");
6018 oldt011ECAr->Print(
"itersum.ps");
6023 c1->Divide(1, 2, 0.01, 0.01);
6025 boardECgraphA->Draw(
"apl");
6027 if (refboardECgraphA)
6028 refboardECgraphA->Draw(
"pl");
6029 TLegend *legAr =
new TLegend(0.8, 0.8, 0.98, 0.95);
6030 legAr->AddEntry(boardECgraphA,
"data",
"l");
6031 if (refboardECgraphA)
6032 leg->AddEntry(refboardECgraphA,
"ref (input to 1st it)",
"l");
6033 legAr->SetTextSize(0.03);
6036 boardECgraphC->Draw(
"apl");
6038 if (refboardECgraphC)
6039 refboardECgraphC->Draw(
"pl");
6040 c1->Print(
"itersum.ps");
6047 c1->Divide(1, 2, 0.01, 0.01);
6049 boarddiffECgraphA->Draw(
"ap");
6052 boarddiffECgraphC->Draw(
"ap");
6055 c1->Print(
"itersum.ps");
6060 c1->Divide(1, 2, 0.01, 0.01);
6062 boardECgraphA1->Draw(
"apl");
6065 boardECgraphC1->Draw(
"apl");
6067 c1->Print(
"itersum.ps");
6071 c1->Divide(1, 2, 0.01, 0.01);
6073 boardECgraphA2->Draw(
"apl");
6076 boardECgraphC2->Draw(
"apl");
6078 c1->Print(
"itersum.ps");
6082 c1->Divide(1, 2, 0.01, 0.01);
6084 boardECgraphA3->Draw(
"apl");
6087 boardECgraphC3->Draw(
"apl");
6089 c1->Print(
"itersum.ps");
6094 textpage =
new TextPage(
" RT PLOTS ");
6095 textpage->Print(
"itersum.ps");
6098 gStyle->SetOptStat(1);
6099 gStyle->SetOptFit(0);
6102 rtrelation_bar->Print(
"itersum.ps");
6106 rtbinning_bar->Print(
"itersum.ps");
6110 rtrelation21->Print(
"itersum.ps");
6114 rtbinning1->Print(
"itersum.ps");
6118 rtrelation31->Print(
"itersum.ps");
6122 rtbinning2->Print(
"itersum.ps");
6126 rtrelation41->Print(
"itersum.ps");
6130 rtbinning3->Print(
"itersum.ps");
6134 rtrelation51->Print(
"itersum.ps");
6138 rtbinning4->Print(
"itersum.ps");
6143 binres_bar->Print(
"itersum.ps");
6147 tbinnedres_bar->Print(
"itersum.ps");
6151 binres1->Print(
"itersum.ps");
6155 tbinnedres1->Print(
"itersum.ps");
6159 binres2->Print(
"itersum.ps");
6163 tbinnedres2->Print(
"itersum.ps");
6166 binres3->Print(
"itersum.ps");
6170 tbinnedres3->Print(
"itersum.ps");
6173 binres4->Print(
"itersum.ps");
6177 tbinnedres4->Print(
"itersum.ps");
6180 gStyle->SetOptStat(0);
6183 rtcol->Print(
"itersum.ps");
6187 rtcol1->Print(
"itersum.ps");
6190 rtcol2->Print(
"itersum.ps");
6192 if (isAr && rtArcol2)
6193 rtArcol2->Print(
"itersum.ps");
6196 rtcol3->Print(
"itersum.ps");
6198 if (isAr && rtArcol3)
6199 rtArcol3->Print(
"itersum.ps");
6202 rtcol4->Print(
"itersum.ps");
6204 if (isAr && rtArcol4)
6205 rtArcol4->Print(
"itersum.ps");
6208 rtcol5->Print(
"itersum.ps");
6210 if (isAr && rtArcol5)
6211 rtArcol5->Print(
"itersum.ps");
6216 DGraph *dgraph0 =
nullptr;
6217 DGraph *dgraph1 =
nullptr;
6218 DGraph *dgraph2 =
nullptr;
6219 DGraph *dgraph3 =
nullptr;
6220 DGraph *dgraph4 =
nullptr;
6221 DGraph *dgraph5 =
nullptr;
6222 bool isinverted =
false;
6223 if (datafile->FindKey(
"TRT_all"))
6225 TDirectory *trt = (TDirectory *)datafile->FindKey(
"TRT_all")->ReadObj();
6226 cout <<
"MAKING DGraphs" << endl;
6229 dgraph0 =
new DGraph(
argv[2],
"-2,-1",
"", -2, -1, isinverted);
6230 if (trt->FindKey(
"WholeBarrel_1"))
6232 dgraph5 =
new DGraph(
argv[2],
"-2,-1",
"WholeBarrel_1", -1, -1, isinverted);
6236 cout <<
" did not find WholeBarrel_1" << endl;
6237 if (trt->FindKey(
"Detector_1"))
6238 dgraph1 =
new DGraph(
argv[2],
"-2,-1",
"Detector_1", 1, -1, isinverted);
6239 if (trt->FindKey(
"Detector_-1"))
6240 dgraph2 =
new DGraph(
argv[2],
"-2,-1",
"Detector_-1", 1, -1, isinverted);
6242 if (trt->FindKey(
"Detector_2"))
6243 dgraph3 =
new DGraph(
argv[2],
"-2,-1",
"Detector_2", 1, -1, isinverted);
6244 if (trt->FindKey(
"Detector_-2"))
6245 dgraph4 =
new DGraph(
argv[2],
"-2,-1",
"Detector_-2", 1, -1, isinverted);
6248 TLegend *
leg =
new TLegend(0.8, 0.8, 0.98, 0.95);
6249 if (dgraph0 !=
nullptr)
6251 dgraph0->GetXaxis()->SetRangeUser(-5, 45);
6252 cout <<
" found TRT_all" << endl;
6253 dgraph0->SetLineWidth(3);
6254 dgraph0->SetLineColor(1);
6255 dgraph0->SetTitle(
"r(t)");
6257 dgraph0->GetXaxis()->SetTitle(
"t/ns");
6259 dgraph0->GetYaxis()->SetTitle(
"R / (mm)");
6262 dgraph0->Draw(
"apl");
6264 leg->AddEntry(dgraph0,
"Whole TRT",
"l");
6266 if (dgraph1 !=
nullptr)
6268 cout <<
" found Detector_1" << endl;
6269 dgraph1->SetLineWidth(3);
6270 dgraph1->SetLineColor(3);
6272 dgraph1->Draw(
"pl");
6274 leg->AddEntry(dgraph1,
"Barrel C Side",
"l");
6277 if (dgraph2 !=
nullptr)
6279 cout <<
" found Detector_-1" << endl;
6280 dgraph2->SetLineWidth(3);
6281 dgraph2->SetLineColor(2);
6283 dgraph2->Draw(
"pl");
6285 leg->AddEntry(dgraph2,
"Barrel A Side",
"l");
6288 if (dgraph3 !=
nullptr)
6290 dgraph3->SetLineWidth(3);
6291 cout <<
" found Detector_2" << endl;
6292 dgraph3->SetLineColor(6);
6294 dgraph3->Draw(
"pl");
6296 leg->AddEntry(dgraph3,
"Endcap C side",
"l");
6299 if (dgraph4 !=
nullptr)
6301 cout <<
" found Detector_-2" << endl;
6302 dgraph4->SetLineWidth(3);
6303 dgraph4->SetLineColor(7);
6305 dgraph4->Draw(
"pl");
6307 leg->AddEntry(dgraph4,
"Endcap A side",
"l");
6309 if (dgraph5 !=
nullptr)
6311 cout <<
" found WholeBarrel_1" << endl;
6312 dgraph5->SetLineWidth(3);
6313 dgraph5->SetLineColor(8);
6315 dgraph5->Draw(
"pl");
6317 leg->AddEntry(dgraph5,
"Whole Barrel",
"l");
6320 leg->SetTextSize(0.03);
6322 c1->Print(
"itersum.ps");
6336 if (datafile->FindKey(
"TRT_all"))
6338 cout <<
" do_expert: found TRT_all" << endl;
6339 TDirectory *trt = (TDirectory *)datafile->FindKey(
"TRT_all")->ReadObj();
6340 cout <<
"MAKING DvGraphs" << endl;
6343 dvgraph0 =
new DvGraph(
argv[2],
"-2,-1",
"", -2, -1, isinverted);
6344 if (trt->FindKey(
"WholeBarrel_1"))
6345 dvgraph5 =
new DvGraph(
argv[2],
"-2,-1",
"WholeBarrel_1", -1, -1, isinverted);
6348 if (trt->FindKey(
"Detector_1"))
6349 dvgraph1 =
new DvGraph(
argv[2],
"-2,-1",
"Detector_1", 1, -1, isinverted);
6350 if (trt->FindKey(
"Detector_-1"))
6351 dvgraph2 =
new DvGraph(
argv[2],
"-2,-1",
"Detector_-1", 1, -1, isinverted);
6353 if (trt->FindKey(
"Detector_2"))
6354 dvgraph3 =
new DvGraph(
argv[2],
"-2,-1",
"Detector_2", 1, -1, isinverted);
6355 if (trt->FindKey(
"Detector_-2"))
6356 dvgraph4 =
new DvGraph(
argv[2],
"-2,-1",
"Detector_-2", 1, -1, isinverted);
6359 TLegend *
leg =
new TLegend(0.8, 0.8, 0.98, 0.95);
6360 if (dvgraph0 !=
nullptr)
6362 dvgraph0->GetXaxis()->SetRangeUser(0, 2);
6363 cout <<
" do_expert: found -2-1" << endl;
6364 dvgraph0->SetLineWidth(3);
6365 dvgraph0->SetLineColor(1);
6367 dvgraph0->SetTitle(
"dt/dr");
6369 dvgraph0->SetTitle(
"dr/dt");
6370 dvgraph0->GetXaxis()->SetTitle(
"r/mm");
6372 dvgraph0->GetYaxis()->SetTitle(
"dt/dr / (ns/mm)");
6374 dvgraph0->GetYaxis()->SetTitle(
"dr/dt / (mm/ns)");
6376 dvgraph0->Draw(
"apl");
6378 leg->AddEntry(dvgraph0,
"Whole TRT",
"l");
6380 if (dvgraph1 !=
nullptr)
6382 cout <<
" do_expert: found Detector_1" << endl;
6383 dvgraph1->SetLineWidth(3);
6384 dvgraph1->SetLineColor(3);
6386 dvgraph1->Draw(
"pl");
6388 leg->AddEntry(dvgraph1,
"Barrel C Side",
"l");
6391 if (dvgraph2 !=
nullptr)
6393 dvgraph2->SetLineWidth(3);
6394 dvgraph2->SetLineColor(2);
6396 dvgraph2->Draw(
"pl");
6398 leg->AddEntry(dvgraph2,
"Barrel A Side",
"l");
6401 if (dvgraph3 !=
nullptr)
6403 dvgraph3->SetLineWidth(3);
6404 dvgraph3->SetLineColor(6);
6406 dvgraph3->Draw(
"pl");
6408 leg->AddEntry(dvgraph3,
"Endcap C side",
"l");
6411 if (dvgraph4 !=
nullptr)
6413 dvgraph4->SetLineWidth(3);
6414 dvgraph4->SetLineColor(7);
6416 dvgraph4->Draw(
"pl");
6418 leg->AddEntry(dvgraph4,
"Endcap A side",
"l");
6420 if (dvgraph5 !=
nullptr)
6422 dvgraph5->SetLineWidth(3);
6423 dvgraph5->SetLineColor(8);
6425 dvgraph5->Draw(
"pl");
6427 leg->AddEntry(dvgraph5,
"Whole Barrel",
"l");
6430 leg->SetTextSize(0.03);
6432 c1->Print(
"itersum.ps");
6439 textpage =
new TextPage(
"Track plots: Only for Experts!!!");
6440 textpage->Print(
"itersum.ps");
6443 bool istracktuple =
false;
6444 TNtuple *Tracktuple =
nullptr;
6445 if (datafile->FindKey(
"tracktuple"))
6447 Tracktuple = (TNtuple *)datafile->Get(
"tracktuple");
6448 istracktuple =
true;
6451 cout <<
"MAKING TRACK PLOTS" << endl;
6456 if (Tracktuple->GetListOfBranches()->FindObject(
"trackres"))
6459 c1->Divide(2, 1, 0.01, 0.01);
6461 Tracktuple->Draw(
"trackres>>histRes(100,0,1.5)");
6462 TH1F *histRes = (
TH1F *)gPad->GetPrimitive(
"histRes");
6463 histRes->SetTitle(
"Residual on track");
6464 histRes->GetXaxis()->SetTitle(
"Residual (mm)");
6468 Tracktuple->Draw(
"trackres:t-ttrack-t0>>histRes2d(100,-12,12,100,0,1)",
"",
"colz");
6469 TH2F *histRes2d = (
TH2F *)gPad->GetPrimitive(
"histRes2d");
6470 histRes2d->SetTitle(
"Track time residual VS track residual");
6471 histRes2d->GetXaxis()->SetTitle(
"Time residual (ns)");
6472 histRes2d->GetYaxis()->SetTitle(
"Track Residual (mm)");
6473 histRes2d->Draw(
"colz");
6474 TProfile *res2d = histRes2d->ProfileX();
6475 res2d->Draw(
"same");
6477 c1->Print(
"itersum.ps");
6482 if (Tracktuple->GetListOfBranches()->FindObject(
"pt"))
6485 c1->Divide(2, 1, 0.01, 0.01);
6487 Tracktuple->Draw(
"pt/1000>>histPt(100,0,20)");
6488 TH1F *histPt = (
TH1F *)gPad->GetPrimitive(
"histPt");
6489 histPt->SetTitle(
"Transverse momentum on track");
6490 histPt->GetXaxis()->SetTitle(
"Pt (GeV)");
6494 Tracktuple->Draw(
"trackres:pt/1000>>histPt2d(100,0,20,100,0,1.5)",
"",
"colz");
6495 TH2F *histPt2d = (
TH2F *)gPad->GetPrimitive(
"histPt2d");
6496 histPt2d->SetTitle(
"Transverse momentum on track VS track residual");
6497 histPt2d->GetXaxis()->SetTitle(
"Pt (GeV)");
6498 histPt2d->GetYaxis()->SetTitle(
"Track Residual (mm)");
6499 histPt2d->Draw(
"COLZ");
6500 TProfile *pt2d = histPt2d->ProfileX();
6502 c1->Print(
"itersum.ps");
6506 if (Tracktuple->GetListOfBranches()->FindObject(
"theta"))
6509 c1->Divide(2, 1, 0.01, 0.01);
6511 Tracktuple->Draw(
"theta>>histTheta(100,0,4)");
6512 TH1F *histTheta = (
TH1F *)gPad->GetPrimitive(
"histTheta");
6513 histTheta->SetTitle(
"Theta distribution on track");
6514 histTheta->GetXaxis()->SetTitle(
"Theta (rad)");
6518 Tracktuple->Draw(
"trackres:theta>>histTheta2d(100,0,4,100,0,1.5)",
"",
"colz");
6519 TH2F *histTheta2d = (
TH2F *)gPad->GetPrimitive(
"histTheta2d");
6520 histTheta2d->SetTitle(
"Theta distrib. on track VS track residual");
6521 histTheta2d->GetXaxis()->SetTitle(
"Theta (rad)");
6522 histTheta2d->GetYaxis()->SetTitle(
"Track Residual (mm)");
6523 histTheta2d->Draw(
"COLZ");
6524 TProfile *theta2d = histTheta2d->ProfileX();
6525 theta2d->Draw(
"same");
6526 c1->Print(
"itersum.ps");
6530 if (Tracktuple->GetListOfBranches()->FindObject(
"phi"))
6533 c1->Divide(2, 1, 0.01, 0.01);
6535 Tracktuple->Draw(
"phi>>histPhi(100,-3.5,0)");
6536 TH1F *histPhi = (
TH1F *)gPad->GetPrimitive(
"histPhi");
6537 histPhi->SetTitle(
"Phi distribution on track");
6538 histPhi->GetXaxis()->SetTitle(
"Phi (rad)");
6542 Tracktuple->Draw(
"trackres:phi>>histPhi2d(100,-3.5,0,100,0,1.5)",
"",
"colz");
6543 TH2F *histPhi2d = (
TH2F *)gPad->GetPrimitive(
"histPhi2d");
6544 histPhi2d->SetTitle(
"Phi distrib. on track VS track residual");
6545 histPhi2d->GetXaxis()->SetTitle(
"Phi (rad)");
6546 histPhi2d->GetYaxis()->SetTitle(
"Track Residual (mm)");
6547 histPhi2d->Draw(
"COLZ");
6548 TProfile *phi2d = histPhi2d->ProfileX();
6549 phi2d->Draw(
"same");
6550 c1->Print(
"itersum.ps");
6554 if (Tracktuple->GetListOfBranches()->FindObject(
"d0"))
6557 c1->Divide(2, 1, 0.01, 0.01);
6559 Tracktuple->Draw(
"d0>>histD0(100,-5,5)");
6560 TH1F *histD0 = (
TH1F *)gPad->GetPrimitive(
"histD0");
6561 histD0->SetTitle(
"D0 distribution on track");
6562 histD0->GetXaxis()->SetTitle(
"D0 (mm)");
6566 Tracktuple->Draw(
"trackres:d0>>histD02d(100,-5,5,100,0,1.5)",
"",
"colz");
6567 TH2F *histD02d = (
TH2F *)gPad->GetPrimitive(
"histD02d");
6568 histD02d->SetTitle(
"D0 distrib. on track VS track residual");
6569 histD02d->GetXaxis()->SetTitle(
"D0 (rad)");
6570 histD02d->GetYaxis()->SetTitle(
"Track Residual (mm)");
6571 histD02d->Draw(
"COLZ");
6572 TProfile *d02d = histD02d->ProfileX();
6574 c1->Print(
"itersum.ps");
6582 cout <<
" Skipping plots for Pulls and Errors " << endl;
6623 cout <<
" Skipping plots for ToT and HT " << endl;
6636 textpage =
new TextPage(
" ToT Corrections and HT corrections: ");
6637 textpage->Print(
"itersum.pdf");
6640 cout <<
"Making ToT / HT Plots" << endl;
6746 refdatafile->Close();
6772 if (settings && firstpage)
6774 string fixfloat, fieldonoff;
6775 if (settings->
set[
"UsePol0"].find(
"True") != string::npos)
6776 fixfloat =
" - floating";
6778 fixfloat =
" - fixed";
6779 if (settings->
set[
"RtRelation"].find(
"binned") != string::npos)
6781 if (settings->
set[
"Solenoid"].find(
"True") != string::npos)
6787 string(
"/Helvetica-Bold findfont 36 scalefont setfont 40 2190 moveto (Run:) show ") +
6788 string(Form(
"/Helvetica findfont 36 scalefont setfont 240 2190 moveto (%i) show ", (
int)firstpage->
runnumber)) +
6790 string(
"/Helvetica-Bold findfont 36 scalefont setfont 40 2150 moveto (Iteration:) show ") +
6791 string(Form(
"/Helvetica findfont 36 scalefont setfont 240 2150 moveto (%02i) show ", firstpage->
iter)) +
6793 string(
"/Helvetica-Bold findfont 36 scalefont setfont 40 2110 moveto (Rt relation:) show ") +
6794 string(Form(
"/Helvetica findfont 36 scalefont setfont 240 2110 moveto (%s%s) show ", settings->
set[
"RtRelation"].data(), fixfloat.data())) +
6796 string(
"/Helvetica-Bold findfont 36 scalefont setfont 540 2190 moveto (Rt binning:) show ") +
6797 string(Form(
"/Helvetica findfont 36 scalefont setfont 740 2190 moveto (%s) show ", settings->
set[
"RtBinning"].data())) +
6799 string(
"/Helvetica-Bold findfont 36 scalefont setfont 540 2150 moveto (Rt level:) show ") +
6801 string(
"/Helvetica-Bold findfont 36 scalefont setfont 540 2110 moveto (T0 level:) show ") +
6803 string(
"/Helvetica-Bold findfont 36 scalefont setfont 1040 2190 moveto (Solenoid:) show ") +
6804 string(Form(
"/Helvetica findfont 36 scalefont setfont 1260 2190 moveto (%s) show ", fieldonoff.data())) +
6806 string(
"/Helvetica-Bold findfont 36 scalefont setfont 1040 2150 moveto (SW release:) show ") +
6807 string(Form(
"/Helvetica findfont 36 scalefont setfont 1260 2150 moveto (%s) show ", settings->
set[
"ReleaseRec"].data())) +
6809 string(
"/Helvetica-Bold findfont 36 scalefont setfont 1040 2110 moveto (T0 Offset:) show ") +
6810 string(Form(
"/Helvetica findfont 36 scalefont setfont 1260 2110 moveto (%s) show ", settings->
set[
"T0Offset"].data())) +
6812 string(
"/Helvetica-Bold findfont 30 scalefont setfont 40 2060 moveto (Data:) show ") +
6813 string(Form(
"/Helvetica findfont 30 scalefont setfont 240 2060 moveto (%s) show ", settings->
set[
"Inputdir"].data())) +
6815 string(
"/Helvetica-Bold findfont 30 scalefont setfont 40 2020 moveto (Start const:) show ") +
6816 string(Form(
"/Helvetica findfont 30 scalefont setfont 240 2020 moveto (%s) show ", settings->
set[
"StartConst"].data()));
6817 system((
string(
"sed -i 's?showpage?" + pmarking +
"showpage?g' itersum.ps")).
data());
6821 datafile =
new TFile(
argv[2],
"UPDATE");
6823 if (datafile->FindKey(
"analysis"))
6824 datafile->rmdir(
"analysis");
6825 TDirectory *adir = datafile->mkdir(
"analysis",
"analysis");
6828 chipgraphA->Write();
6830 chipgraphC->Write();
6831 boardgraphA->Write();
6832 boardgraphC->Write();
6834 refboardgraphA->Write();
6836 refboardgraphC->Write();
6852 TFile *itersumfile =
new TFile(
argv[2],
"UPDATE");
6853 if (itersumfile->FindKey(
"tracktuple"))
6855 itersumfile->Delete(
"tracktuple;*");
6857 if (itersumfile->FindKey(
"binhist"))
6859 itersumfile->rmdir(
"binhist");
6861 if (itersumfile->FindKey(
"analysis"))
6863 itersumfile->rmdir(
"analysis");
6866 itersumfile->Write();
6867 itersumfile->Close();
6877 if ((
string(
argv[1])).
find(
"itersum") != std::string::npos)
6879 cout <<
"GENERATING ITERATION SUMMARY PLOTS" << endl;
6883 if ((
string(
argv[1])).
find(
"restore") != std::string::npos)
6885 cout <<
"REMOVING THE TRACKTUPLE, BINHIST AND ANALYSE DIRECTORY" << endl;