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 const bool isdines =
false;
1877 vrrelation =
"x*[2]/sqrt([0]*[0]+x*x)";
1879 vrrelation =
"sqrt([0]*[0]+x*x)/(x*[2])";
1881 TF1 *vr1 =
new TF1(
"vr-relation", vrrelation.c_str(), 0.0001, 2.0);
1882 vr1->SetParameters(
p0,
p1,
p2);
1884 for (
int i = 0;
i <= 100;
i++)
1886 float r = 0.1 + (2.0 - 0.1) * (
float)
i / 100;
1887 float v1 = vr1->Eval(
r, 0, 0, 0);
1888 this->SetPoint(
i,
r, v1);
1896 cout <<
" USING POLYNOMIAL R-t RELATION" << endl;
1898 string rtrelation =
"[0]+x*([1]+x*([2]+x*[3]))";
1901 vtrelation =
"1/([0]+2*x*[1]+3*x*x*[2])";
1903 vtrelation =
"[0]+2*x*[1]+3*x*x*[2]";
1905 TF1 *rt1 =
new TF1(
"rt-relation", rtrelation.c_str(), -10000, 10000);
1906 rt1->SetParameters(
p0,
p1,
p2,
p3);
1907 TF1 *vt1 =
new TF1(
"vt-relation", vtrelation.c_str(), -10000, 10000);
1908 vt1->SetParameters(
p1,
p2,
p3);
1910 for (
int i = 0;
i <= 100;
i++)
1912 float r = 0.1 + (2.0 - 0.1) * (
float)
i / 100;
1913 float t1 = rt1->GetX(
r, -10000, 10000);
1914 float v1 = vt1->Eval(
t1, 0, 0, 0);
1915 this->SetPoint(
i,
r, v1);
1930 DGraph(
char *,
string,
const string&,
int,
int,
bool);
1938 this->SetName(Form(
"Dv_%i_%i",
det, lay));
1940 vector<string> levels;
1943 if (
const auto f =
path.find(
',');
f==std::string::npos ){
1946 levels.push_back(
path.substr(0,
f));
1950 levels.push_back(
path.substr(0,
path.find(
',')));
1955 cout <<
" In DGraph. Folder: " <<
folder <<
" det " <<
det <<
" lay " << lay << endl;
1956 for (
unsigned int i = 0;
i < levels.size();
i++)
1957 cout <<
" " << levels.at(
i);
1959 cout <<
" infile:" << string(
infile) << endl;
1961 TDirectory *trt = (TDirectory *)
file->FindKey(
"TRT_all")->ReadObj();
1964 TDirectory *thisDet = (TDirectory *)trt->FindKey(
folder.c_str())->ReadObj();
1965 cout <<
"PLOT FOR " <<
folder << endl;
1966 if (thisDet->FindKey(
"rtgraph"))
1968 rtgraph = (TGraphErrors *)thisDet->FindKey(
"rtgraph")->ReadObj();
1969 cout <<
" folder: " <<
folder <<
" found rtgraph " << endl;
1974 cout <<
" folder: " <<
folder <<
" did not find rtgraph " << endl;
1977 else if (trt->FindKey(
"rtgraph"))
1979 rtgraph = (TGraphErrors *)trt->FindKey(
"rtgraph")->ReadObj();
1980 cout <<
" no folder, found rtgraph " << endl;
1985 cout <<
" no folder, no rtgraph " << endl;
1990 TF1 *rtfunc = (TF1 *)rtgraph->GetListOfFunctions()->First();
1992 double p0 = rtfunc->GetParameter(0);
1993 double p1 = rtfunc->GetParameter(1);
1994 double p2 = rtfunc->GetParameter(2);
1995 double p3 = rtfunc->GetParameter(3);
1997 cout <<
" R-t PARAMETERS: " <<
p0 <<
" " <<
p1 <<
" " <<
p2 <<
" " <<
p3 << endl;
1999 const bool isdines =
false;
2006 vrrelation =
"x*[2]/sqrt([0]*[0]+x*x)";
2008 vrrelation =
"sqrt([0]*[0]+x*x)/(x*[2])";
2010 TF1 *vr1 =
new TF1(
"vr-relation", vrrelation.c_str(), 0.0001, 2.0);
2011 vr1->SetParameters(
p0,
p1,
p2);
2013 for (
int i = 0;
i <= 100;
i++)
2015 float r = 0.1 + (2.0 - 0.1) * (
float)
i / 100;
2016 float v1 = vr1->Eval(
r, 0, 0, 0);
2017 this->SetPoint(
i,
r, v1);
2024 cout <<
" USING POLYNOMIAL R-t RELATION" << endl;
2026 string rtrelation =
"[0]+x*([1]+x*([2]+x*[3]))";
2029 vtrelation =
"1/([0]+2*x*[1]+3*x*x*[2])";
2031 vtrelation =
"[0]+2*x*[1]+3*x*x*[2]";
2033 TF1 *rt1 =
new TF1(
"rt-relation", rtrelation.c_str(), -10000, 10000);
2034 rt1->SetParameters(
p0,
p1,
p2,
p3);
2035 TF1 *vt1 =
new TF1(
"vt-relation", vtrelation.c_str(), -10000, 10000);
2036 vt1->SetParameters(
p1,
p2,
p3);
2038 for (
int i = 0;
i <= 1000;
i++)
2040 float t1 = -5 +
i * 0.05;
2041 float r1 = rt1->Eval(
t1, 0, 0, 0);
2042 this->SetPoint(
i,
t1, r1);
2057 RtGraphs(
char *,
const string& ,
bool);
2059 TGraphErrors *rtgraph{};
2060 TGraphErrors *trgraph{};
2067 this->SetName(Form(
"Rt_%s",
folder.c_str()));
2070 cout <<
"in RtGraphs. Infile: " << string(
infile) << endl;
2072 TDirectory *trt =
nullptr;
2074 map<string, string> titlemap;
2078 trt = (TDirectory *)
file->FindKey(
"TRT_all")->ReadObj();
2079 titlemap[
"WholeBarrel_1"] =
"whole barrel";
2080 titlemap[
"Detector_-1"] =
"barrel C";
2081 titlemap[
"Detector_1"] =
"barrel A";
2082 titlemap[
"Detector_-2"] =
"end-cap C";
2083 titlemap[
"Detector_2"] =
"end-cap A";
2085 cout <<
" Xenon. Found TRT_all " << endl;
2087 cout <<
" Xenon. Did not find TRT_all " << endl;
2093 trt = (TDirectory *)
file->FindKey(
"TRT_Ar_all")->ReadObj();
2094 titlemap[
"WholeBarrel_Ar_1"] =
"whole Ar barrel";
2095 titlemap[
"Detector_Ar_-1"] =
"barrel Ar C";
2096 titlemap[
"Detector_Ar_1"] =
"barrel Ar A";
2097 titlemap[
"Detector_Ar_-2"] =
"end-cap Ar C";
2098 titlemap[
"Detector_Ar_2"] =
"end-cap Ar A";
2100 cout <<
" Argon. Found TRT_Ar_all " << endl;
2102 cout <<
" Argon. Did not find TRT_Ar_all " << endl;
2105 if (trt and (not
folder.empty()))
2107 cout <<
" PLOT FOR " <<
folder << endl;
2108 TDirectory *
det = (TDirectory *)trt->FindKey(
folder.c_str())->ReadObj();
2109 if (
det->FindKey(
"rt-relation"))
2111 cout <<
" found rt-relation " << endl;
2112 rthist = (
TH2F *)
det->FindKey(
"rt-relation")->ReadObj();
2114 rthist->GetXaxis()->SetRangeUser(0, 40);
2116 sprintf(
name,
"rt (%s)", titlemap[
folder].c_str());
2117 rthist->SetTitle(
name);
2118 if (
det->FindKey(
"rtgraph"))
2120 rtgraph = (TGraphErrors *)
det->FindKey(
"rtgraph")->ReadObj();
2121 cout <<
" found also rtgraph " << endl;
2126 cout <<
" did not found rtgraph " << endl;
2128 if (
det->FindKey(
"trgraph"))
2130 trgraph = (TGraphErrors *)
det->FindKey(
"trgraph")->ReadObj();
2131 cout <<
" found also trgraph " << endl;
2136 cout <<
" did not found trgraph " << endl;
2138 if (
det->FindKey(
"oldrtfunc"))
2140 oldrtfunc = (TF1 *)
det->FindKey(
"oldrtfunc")->ReadObj();
2141 cout <<
" found also oldrtfunc " << endl;
2145 oldrtfunc =
nullptr;
2146 cout <<
" did not find oldrtfunc " << endl;
2151 throw string(
" NO RT OBJECTS FOUND");
2154 else if (trt and trt->FindKey(
"rt-relation"))
2156 cout <<
" No folder. Found rt-relation. PLOT FOR TRT" << endl;
2157 rthist = (
TH2F *)trt->FindKey(
"rt-relation")->ReadObj();
2159 rthist->GetXaxis()->SetRangeUser(0, 40);
2160 rthist->SetTitle(
"r(t) for whole TRT");
2161 if (trt->FindKey(
"rtgraph"))
2163 rtgraph = (TGraphErrors *)trt->FindKey(
"rtgraph")->ReadObj();
2164 cout <<
" found also rtgraph " << endl;
2169 cout <<
" did not find rtgraph " << endl;
2171 if (trt->FindKey(
"trgraph"))
2173 trgraph = (TGraphErrors *)trt->FindKey(
"trgraph")->ReadObj();
2174 cout <<
" found also trgraph " << endl;
2179 cout <<
" did not find trgraph " << endl;
2181 if (trt->FindKey(
"oldrtfunc"))
2183 oldrtfunc = (TF1 *)trt->FindKey(
"oldrtfunc")->ReadObj();
2184 cout <<
" found also oldtrtfunc " << endl;
2188 oldrtfunc =
nullptr;
2189 cout <<
" did not find oldtrtfunc " << endl;
2194 cout <<
" No folder. No rt-relation." << endl;
2197 oldrtfunc =
nullptr;
2201 this->Divide(2, 1, 0.01, 0.01);
2204 TPad *c1_3 =
new TPad(
"c1_3",
"newpad", 0.01, 0.33, 0.99, 0.99);
2207 c1_3->SetTopMargin(0.1);
2208 c1_3->SetBottomMargin(0.01);
2209 c1_3->SetRightMargin(0.1);
2210 c1_3->SetFillStyle(0);
2217 cout <<
" found rtgraph for entire TRT " << endl;
2218 rtgraph->SetTitle(
"r(t) fit (whole TRT)");
2222 cout <<
" found rtgraph for folder: " <<
folder << endl;
2223 rtgraph->SetTitle(titlemap[
folder].c_str());
2225 cout <<
" set rtgraph X title t-T0/ns and Y title |r|_{track}/mm" << endl;
2227 rtgraph->GetXaxis()->SetTitle(
"t-T0/ns");
2228 rtgraph->GetYaxis()->SetTitle(
"|r|_{track}/mm");
2230 rtgraph->GetXaxis()->SetTitleSize(0.06);
2231 rtgraph->GetXaxis()->SetLabelSize(0.06);
2234 rtgraph->SetMarkerStyle(20);
2235 rtgraph->SetMarkerSize(0.5);
2236 rtgraph->GetYaxis()->SetRangeUser(-0.05, 2.6);
2237 cout <<
" Draw rtgraph " << endl;
2238 rtgraph->Draw(
"ap");
2240 if (rtgraph->GetFunction(
"rtfunc"))
2241 newRT = rtgraph->GetFunction(
"rtfunc");
2243 newRT = rtgraph->GetFunction(
"rtfunc2");
2246 cout <<
" Draw new fit " << endl;
2247 newRT->SetLineWidth(1);
2248 newRT->Draw(
"same");
2252 oldrtfunc->SetLineColor(1);
2253 oldrtfunc->SetLineWidth(1);
2254 oldrtfunc->SetLineStyle(2);
2255 cout <<
" Draw old fit " << endl;
2256 oldrtfunc->Draw(
"same");
2260 TLegend *
leg =
new TLegend(0.7155172, 0.1038136, 0.8965517, 0.2542373,
nullptr,
"brNDC");
2261 leg->AddEntry(rtgraph,
"Data",
"p");
2262 leg->AddEntry(newRT,
"Fit",
"l");
2263 leg->AddEntry(oldrtfunc,
"Fit old rt",
"l");
2264 leg->SetTextSize(0.03);
2268 if (oldrtfunc && newRT)
2272 TPad *c1_4 =
new TPad(
"c1_4",
"newpad", 0.01, 0, 0.99, 0.32);
2275 c1_4->SetTopMargin(0.01);
2276 c1_4->SetBottomMargin(0.3);
2277 c1_4->SetRightMargin(0.1);
2278 c1_4->SetFillStyle(0);
2281 Double_t Xmax = rtgraph->GetXaxis()->GetXmax();
2282 Double_t
Xmin = rtgraph->GetXaxis()->GetXmin();
2284 const Int_t
n = 300;
2288 Double_t Ymax = -10;
2291 for (Int_t
i = 0;
i <
n;
i++)
2294 y[
i] = (oldrtfunc->Eval(
x[
i]) - newRT->Eval(
x[
i]));
2301 TGraph *
gr1 =
new TGraph(
n,
x,
y);
2304 gr1->GetXaxis()->SetTitle(
"t-T0/ns");
2305 gr1->GetXaxis()->SetRangeUser(
Xmin, Xmax);
2306 gr1->GetYaxis()->SetTitle(
"Old r(t) - New r(t) /mm");
2307 gr1->GetYaxis()->SetRangeUser(-0.1, 0.1);
2309 gr1->GetYaxis()->SetNdivisions(5);
2310 gr1->GetXaxis()->SetTitleSize(0.06);
2311 gr1->GetXaxis()->SetLabelSize(0.06);
2312 gr1->GetYaxis()->SetLabelSize(0.08);
2313 gr1->GetYaxis()->SetTitleOffset(0.8);
2314 gr1->GetYaxis()->SetTitleSize(0.06);
2315 gr1->SetLineStyle(2);
2319 const Int_t
n1 = rtgraph->GetN();
2323 for (Int_t
i = 0;
i <
n1;
i++)
2327 rtgraph->GetPoint(
i,
X,
Y);
2329 y1.at(
i) =
Y - newRT->Eval(
X);
2331 ey1.at(
i) = rtgraph->GetErrorY(
i);
2332 if (
y1.at(
i) > Ymax)
2336 if (
y1.at(
i) < Ymin)
2342 TGraphErrors *
gr2 =
new TGraphErrors(
n1, &
x1.at(0), &
y1.at(0), &
ex1.at(0), &ey1.at(0));
2343 gr2->SetMarkerColor(2);
2344 gr2->SetMarkerStyle(20);
2346 gr2->GetYaxis()->SetTitle(
"Old r(t) - New r(t) /mm");
2348 gr2->GetYaxis()->SetRangeUser(-0.2, 0.2);
2349 gr2->GetXaxis()->SetRangeUser(-5, 50);
2350 cout <<
" Draw difference " << endl;
2354 TLine *line0 =
new TLine(
Xmin, 0, Xmax, 0);
2355 line0->SetLineColor(4);
2361 cout <<
" nullptr rtgraph " << endl;
2369 trgraph->SetTitle(
"t(r) fit (whole TRT)");
2374 sprintf(
name,
"t(r) fit (%s)", titlemap[
string(
folder)].c_str());
2375 trgraph->SetTitle(
name);
2378 trgraph->GetYaxis()->SetTitle(
"t-T0/ns");
2379 trgraph->GetXaxis()->SetTitle(
"|r|_{track}/mm");
2381 trgraph->SetMarkerStyle(20);
2382 trgraph->SetMarkerSize(0.5);
2383 cout <<
" Draw trgraph " << endl;
2384 trgraph->Draw(
"ap");
2388 cout <<
" nullptr trgraph " << endl;
2391 gStyle->SetOptStat(1);
2405 char selectionA[500];
2406 sprintf(selectionA,
"%s*(det==2)",
variable.c_str());
2407 char selectionC[500];
2408 sprintf(selectionC,
"%s*(det==-2)",
variable.c_str());
2414 TNtuple *Chiptuple =
nullptr;
2415 TNtuple *Moduletuple =
nullptr;
2419 Chiptuple = (TNtuple *)
file->Get(
"Chiptuple");
2420 Moduletuple = (TNtuple *)
file->Get(
"Moduletuple");
2424 Chiptuple = (TNtuple *)
file->Get(
"Chip_Artuple");
2425 Moduletuple = (TNtuple *)
file->Get(
"Module_Artuple");
2428 this->SetName(
"c1");
2430 this->Divide(2, 2, 0.01, 0.01);
2431 ((TPad *)this->GetPrimitive(
"c1_1"))->SetFrameFillColor(1);
2432 ((TPad *)this->GetPrimitive(
"c1_2"))->SetFrameFillColor(1);
2433 ((TPad *)this->GetPrimitive(
"c1_3"))->SetFrameFillColor(1);
2434 ((TPad *)this->GetPrimitive(
"c1_4"))->SetFrameFillColor(1);
2436 gStyle->SetPalette(1);
2440 Moduletuple->Draw(
"mod:lay>>reshist10(14,0,14,32,0,32)", selectionA,
"colz");
2441 TH2F *reshist10 = (
TH2F *)gPad->GetPrimitive(
"reshist10");
2443 if (reshist10->GetEntries() > 1)
2447 sprintf(title1,
"Phi Sector VS Wheel %s (EC side A)",
variable.c_str());
2449 sprintf(title1,
"Argon Phi Sector VS Wheel %s (EC side A)",
variable.c_str());
2450 reshist10->SetTitle(title1);
2451 reshist10->SetStats(0);
2452 reshist10->GetXaxis()->SetLabelOffset(1000);
2453 reshist10->GetYaxis()->SetLabelOffset(1000);
2454 reshist10->GetXaxis()->SetTitle(
"Wheel (Z)");
2455 reshist10->GetYaxis()->SetTitle(
"Phi sector");
2458 reshist10->GetZaxis()->SetRangeUser(1, 6);
2459 reshist10->GetZaxis()->SetNdivisions(6);
2463 reshist10->GetZaxis()->SetRangeUser(0.10, 0.20);
2465 else if (
variable ==
"abs(resMean)")
2467 reshist10->GetZaxis()->SetRangeUser(0.0, 0.05);
2471 reshist10->GetZaxis()->SetRangeUser(2, 14);
2473 else if (
variable ==
"abs(t0-oldt0)")
2475 reshist10->GetZaxis()->SetRangeUser(0.0, 0.6);
2479 reshist10->GetZaxis()->SetRangeUser(2.0, 4.5);
2484 Chiptuple->Draw(
"mod:chp>>histC(248,84,332,32,0,32)", selectionA,
"colz");
2485 TH2F *histC = (
TH2F *)gPad->GetPrimitive(
"histC");
2487 sprintf(title3,
"Chip %s (EC side A)",
variable.c_str());
2489 sprintf(title3,
"Argon Chip %s (EC side A)",
variable.c_str());
2490 histC->SetTitle(title3);
2492 if (histC->GetEntries() > 1)
2496 histC->GetXaxis()->SetLabelOffset(1000);
2497 histC->GetYaxis()->SetLabelOffset(1000);
2498 histC->GetXaxis()->SetTitle(
"Chip number");
2499 histC->GetYaxis()->SetTitle(
"Phi sector");
2502 histC->GetZaxis()->SetRangeUser(1, 6);
2503 histC->GetZaxis()->SetNdivisions(6);
2507 histC->GetZaxis()->SetRangeUser(0.10, 0.20);
2509 else if (
variable ==
"abs(resMean)")
2511 histC->GetZaxis()->SetRangeUser(0.0, 0.05);
2515 histC->GetZaxis()->SetRangeUser(2, 14);
2517 else if (
variable ==
"abs(t0-oldt0)")
2519 histC->GetZaxis()->SetRangeUser(0.0, 0.6);
2523 histC->GetZaxis()->SetRangeUser(2.0, 4.5);
2529 TLine *lin11 =
new TLine(84, lowe, 84, upe);
2530 lin11->SetLineStyle(2);
2532 TLine *lin12 =
new TLine(107, lowe, 107, upe);
2533 lin12->SetLineStyle(2);
2535 TLine *lin13 =
new TLine(131, lowe, 131, upe);
2536 lin13->SetLineStyle(2);
2538 TLine *lin14 =
new TLine(155, lowe, 155, upe);
2539 lin14->SetLineStyle(2);
2541 TLine *lin15 =
new TLine(179, lowe, 179, upe);
2542 lin15->SetLineStyle(2);
2544 TLine *lin16 =
new TLine(203, lowe, 203, upe);
2545 lin16->SetLineStyle(2);
2547 TLine *lin17 =
new TLine(227, lowe, 227, upe);
2548 lin17->SetLineStyle(2);
2550 TLine *lin18 =
new TLine(239, lowe, 239, upe);
2551 lin18->SetLineStyle(2);
2556 Moduletuple->Draw(
"mod:lay>>reshist11(14,0,14,32,0,32)", selectionC,
"colz");
2557 TH2F *reshist11 = (
TH2F *)gPad->GetPrimitive(
"reshist11");
2559 if (reshist11->GetEntries() > 1)
2563 sprintf(title4,
"Phi Sector VS Wheel %s (EC side C)",
variable.c_str());
2565 sprintf(title4,
"Argon Phi Sector VS Wheel %s (EC side C)",
variable.c_str());
2566 reshist11->SetTitle(title4);
2567 reshist11->SetMarkerStyle(21);
2568 reshist11->SetStats(0);
2569 reshist11->GetXaxis()->SetLabelOffset(1000);
2570 reshist11->GetYaxis()->SetLabelOffset(1000);
2571 reshist11->GetXaxis()->SetTitle(
"Layer (Z)");
2572 reshist11->GetYaxis()->SetTitle(
"Phi sector");
2575 reshist11->GetZaxis()->SetRangeUser(1, 6);
2576 reshist11->GetZaxis()->SetNdivisions(6);
2578 TLegend *
leg =
new TLegend(0.99, 0.35, 0.55, 0.01,
"T0 fit type");
2580 TH2F *
h1 =
new TH2F(
"h1",
"h1 title", 40, 0, 4, 30, -3, 3);
2581 h1->SetMarkerColor(54);
2582 h1->SetMarkerStyle(21);
2584 TH2F *h2 =
new TH2F(
"h2",
"h2 title", 40, 0, 4, 30, -3, 3);
2585 h2->SetMarkerColor(4);
2586 h2->SetMarkerStyle(21);
2588 TH2F *h3 =
new TH2F(
"h3",
"h3 title", 40, 0, 4, 30, -3, 3);
2589 h3->SetMarkerColor(7);
2590 h3->SetMarkerStyle(21);
2592 TH2F *h4 =
new TH2F(
"h4",
"h4 title", 40, 0, 4, 30, -3, 3);
2593 h4->SetMarkerColor(81);
2594 h4->SetMarkerStyle(21);
2596 TH2F *h5 =
new TH2F(
"h5",
"h5 title", 40, 0, 4, 30, -3, 3);
2597 h5->SetMarkerColor(kYellow);
2598 h5->SetMarkerStyle(21);
2600 TH2F *h6 =
new TH2F(
"h6",
"h6 title", 40, 0, 4, 30, -3, 3);
2601 h6->SetMarkerColor(kRed);
2602 h6->SetMarkerStyle(21);
2604 leg->AddEntry(
h1,
"1: |mean|>5",
"P");
2605 leg->AddEntry(h2,
"2: normal fit",
"P");
2606 leg->AddEntry(h3,
"3: used chip ref",
"P");
2607 leg->AddEntry(h4,
"4: Low stat",
"P");
2608 leg->AddEntry(h5,
"5: No T0 Cal",
"P");
2609 leg->AddEntry(h6,
"6: Wrong fit. Mean used",
"P");
2610 leg->SetTextSize(0.04);
2615 reshist11->GetZaxis()->SetRangeUser(0.1, 0.20);
2617 else if (
variable ==
"abs(resMean)")
2619 reshist11->GetZaxis()->SetRangeUser(0.0, 0.05);
2623 reshist11->GetZaxis()->SetRangeUser(2, 14);
2625 else if (
variable ==
"abs(t0-oldt0)")
2627 reshist11->GetZaxis()->SetRangeUser(0.0, 0.6);
2631 reshist11->GetZaxis()->SetRangeUser(2.0, 4.5);
2635 Chiptuple->Draw(
"mod:chp>>histC1(248,84,332,32,0,32)", selectionC,
"colz");
2636 TH2F *histC1 = (
TH2F *)gPad->GetPrimitive(
"histC1");
2638 sprintf(title5,
"Chip %s (EC side C)",
variable.c_str());
2640 sprintf(title5,
"Argon Chip %s (EC side C)",
variable.c_str());
2641 histC1->SetTitle(title5);
2643 if (histC1->GetEntries() > 1)
2646 histC1->SetStats(0);
2647 histC1->GetXaxis()->SetLabelOffset(1000);
2648 histC1->GetYaxis()->SetLabelOffset(1000);
2649 histC1->GetXaxis()->SetTitle(
"Chip number");
2650 histC1->GetYaxis()->SetTitle(
"Phi sector");
2653 histC1->GetZaxis()->SetRangeUser(1, 6);
2654 histC1->GetZaxis()->SetNdivisions(6);
2658 histC1->GetZaxis()->SetRangeUser(0.10, 0.20);
2660 else if (
variable ==
"abs(resMean)")
2662 histC1->GetZaxis()->SetRangeUser(0.0, 0.05);
2666 histC1->GetZaxis()->SetRangeUser(2, 14);
2668 else if (
variable ==
"abs(t0-oldt0)")
2670 histC1->GetZaxis()->SetRangeUser(0.0, 0.6);
2674 histC1->GetZaxis()->SetRangeUser(2.0, 4.5);
2677 TLine *lin1 =
new TLine(84, lowe, 84, upe);
2678 lin1->SetLineStyle(2);
2680 TLine *lin2 =
new TLine(108, lowe, 108, upe);
2681 lin2->SetLineStyle(2);
2683 TLine *lin3 =
new TLine(132, lowe, 132, upe);
2684 lin3->SetLineStyle(2);
2686 TLine *lin4 =
new TLine(156, lowe, 156, upe);
2687 lin4->SetLineStyle(2);
2689 TLine *lin5 =
new TLine(180, lowe, 180, upe);
2690 lin5->SetLineStyle(2);
2692 TLine *lin6 =
new TLine(204, lowe, 204, upe);
2693 lin6->SetLineStyle(2);
2695 TLine *lin7 =
new TLine(228, lowe, 228, upe);
2696 lin7->SetLineStyle(2);
2698 TLine *lin8 =
new TLine(240, lowe, 239, upe);
2699 lin8->SetLineStyle(2);
2710 RtColor(
char *,
const string&,
bool);
2712 TGraphErrors *rtgraph{};
2720 map<string, string> titlemap;
2721 titlemap[
"WholeBarrel_1"] =
"whole barrel";
2722 titlemap[
"Detector_-1"] =
"barrel C";
2723 titlemap[
"Detector_1"] =
"barrel A";
2724 titlemap[
"Detector_-2"] =
"end-cap C";
2725 titlemap[
"Detector_2"] =
"end-cap A";
2727 titlemap[
"WholeBarrel_Ar_1"] =
"whole barrel";
2728 titlemap[
"Detector_Ar_-1"] =
"barrel C";
2729 titlemap[
"Detector_Ar_1"] =
"barrel A";
2730 titlemap[
"Detector_Ar_-2"] =
"end-cap C";
2731 titlemap[
"Detector_Ar-2"] =
"end-cap A";
2736 TPad *c1_3 =
new TPad(
"c1_3",
"newpad", 0.01, 0.33, 0.99, 0.99);
2739 c1_3->SetTopMargin(0.1);
2740 c1_3->SetBottomMargin(0.01);
2741 c1_3->SetRightMargin(0.1);
2742 c1_3->SetFillStyle(0);
2747 TDirectory *trt =
nullptr;
2749 trt = (TDirectory *)
file->FindKey(
"TRT_all")->ReadObj();
2751 trt = (TDirectory *)
file->FindKey(
"TRT_Ar_all")->ReadObj();
2755 TDirectory *
det = (TDirectory *)trt->FindKey(
folder.c_str())->ReadObj();
2756 cout <<
" RtColor plot for folder" <<
folder << endl;
2757 if (
det->FindKey(
"rt-relation"))
2759 hist = (
TH2F *)
det->FindKey(
"rt-relation")->ReadObj();
2763 cout <<
" found rt-relation " << endl;
2764 hist->GetXaxis()->SetRangeUser(0, 40);
2765 hist->GetYaxis()->SetRangeUser(0, 2.4);
2767 sprintf(
name,
"r(t) for %s",
folder.c_str());
2769 sprintf(
name,
"Argon r(t) for %s",
folder.c_str());
2771 hist->GetXaxis()->SetRangeUser(0, 50);
2774 if (
det->FindKey(
"rtgraph"))
2776 cout <<
" found rtgraph " << endl;
2777 rtgraph = (TGraphErrors *)
det->FindKey(
"rtgraph")->ReadObj();
2778 rtgraph->SetMarkerStyle(20);
2779 rtgraph->SetMarkerColor(1);
2780 rtgraph->SetLineColor(1);
2781 rtgraph->GetYaxis()->SetRangeUser(0, 2.4);
2783 if (rtgraph->GetFunction(
"rtfunc"))
2784 newRT = rtgraph->GetFunction(
"rtfunc");
2786 newRT = rtgraph->GetFunction(
"rtfunc2");
2788 if (
det->FindKey(
"oldrtfunc"))
2790 cout <<
" found oldrtfunc " << endl;
2791 oldrtfunc = (TF1 *)
det->FindKey(
"oldrtfunc")->ReadObj();
2792 oldrtfunc->SetRange(0, 50);
2793 oldrtfunc->Draw(
"same");
2799 throw string(
" NO RT OBJECTS FOUND");
2802 else if (trt->FindKey(
"rt-relation"))
2804 cout <<
" RtColor Plot entire TRT" << endl;
2805 hist = (
TH2F *)trt->FindKey(
"rt-relation")->ReadObj();
2807 hist->GetXaxis()->SetRangeUser(0, 40);
2808 hist->SetTitle(
"r(t) for whole TRT");
2810 hist->SetTitle(
"Argon r(t) for whole TRT");
2811 hist->GetYaxis()->SetRangeUser(0, 2.4);
2812 hist->GetXaxis()->SetRangeUser(0, 50);
2814 if (trt->FindKey(
"rtgraph"))
2816 rtgraph = (TGraphErrors *)trt->FindKey(
"rtgraph")->ReadObj();
2817 rtgraph->SetMarkerStyle(20);
2818 rtgraph->SetLineColor(1);
2819 rtgraph->SetMarkerColor(1);
2820 rtgraph->GetYaxis()->SetRangeUser(0, 2.4);
2821 if (rtgraph->GetFunction(
"rtfunc"))
2822 newRT = rtgraph->GetFunction(
"rtfunc");
2824 newRT = rtgraph->GetFunction(
"rtfunc2");
2827 if (trt->FindKey(
"oldrtfunc"))
2829 oldrtfunc = (TF1 *)trt->FindKey(
"oldrtfunc")->ReadObj();
2830 oldrtfunc->SetRange(0, 50);
2831 oldrtfunc->Draw(
"same");
2844 TPad *c1_4 =
new TPad(
"c1_4",
"newpad", 0.01, 0, 0.99, 0.32);
2847 c1_4->SetTopMargin(0.01);
2848 c1_4->SetBottomMargin(0.3);
2849 c1_4->SetRightMargin(0.1);
2850 c1_4->SetFillStyle(0);
2853 Double_t Xmax = rtgraph->GetXaxis()->GetXmax();
2854 Double_t
Xmin = rtgraph->GetXaxis()->GetXmin();
2856 const Int_t
n = 300;
2860 Double_t Ymax = -10;
2863 newRT->SetRange(-10., 60.);
2864 oldrtfunc->SetRange(-10., 60.);
2866 for (Int_t
i = 0;
i <
n;
i++)
2869 y[
i] = (oldrtfunc->Eval(
x[
i]) - newRT->Eval(
x[
i]));
2876 TGraph *
gr1 =
new TGraph(
n,
x,
y);
2880 gr1->GetXaxis()->SetTitle(
"t-T0/ns");
2881 gr1->GetXaxis()->SetRangeUser(
Xmin, Xmax);
2882 gr1->GetYaxis()->SetTitle(
"Old r(t) - New r(t) /mm");
2883 gr1->GetYaxis()->SetRangeUser(-0.1, 0.1);
2885 gr1->GetYaxis()->SetNdivisions(5);
2886 gr1->GetXaxis()->SetTitleSize(0.06);
2887 gr1->GetXaxis()->SetLabelSize(0.06);
2888 gr1->GetYaxis()->SetLabelSize(0.08);
2889 gr1->GetYaxis()->SetTitleOffset(0.8);
2890 gr1->GetYaxis()->SetTitleSize(0.06);
2891 gr1->SetLineStyle(2);
2895 Int_t
n1 = rtgraph->GetN();
2899 for (Int_t
i = 0;
i <
n1;
i++)
2903 rtgraph->GetPoint(
i,
X,
Y);
2905 y1.at(
i) =
Y - newRT->Eval(
X);
2907 ey1.at(
i) = rtgraph->GetErrorY(
i);
2908 if (
y1.at(
i) > Ymax)
2910 if (
y1.at(
i) < Ymin)
2915 TGraphErrors *
gr2 =
new TGraphErrors(
n1, &
x1.at(0), &
y1.at(0), &
ex1.at(0), &ey1.at(0));
2916 gr2->SetMarkerColor(kBlack);
2917 gr2->SetMarkerStyle(20);
2919 gr2->GetYaxis()->SetTitle(
"Old r(t) - New r(t) /mm");
2922 gr2->GetYaxis()->SetRangeUser(-0.1, 0.1);
2923 gr2->GetXaxis()->SetRangeUser(0, 50);
2928 TLine *line0 =
new TLine(0, 0, 50, 0);
2929 line0->SetLineColor(4);
2945 this->SetName(
"resplots");
2949 TDirectory *trt =
nullptr;
2950 TDirectory *det1 =
nullptr;
2951 TDirectory *det2 =
nullptr;
2952 TDirectory *det3 =
nullptr;
2953 TDirectory *det4 =
nullptr;
2957 cout <<
" In ResidualPlots Xenon" << endl;
2958 trt = (TDirectory *)
file->FindKey(
"TRT_all")->ReadObj();
2960 throw std::runtime_error(
"trt pointer is null");
2962 det1 = (TDirectory *)trt->FindKey(
"Detector_-1")->ReadObj();
2963 det2 = (TDirectory *)trt->FindKey(
"Detector_1")->ReadObj();
2964 det3 = (TDirectory *)trt->FindKey(
"Detector_-2")->ReadObj();
2965 det4 = (TDirectory *)trt->FindKey(
"Detector_2")->ReadObj();
2970 throw std::runtime_error(
"trt pointer is null");
2974 cout <<
" In ResidualPlots Argon" << endl;
2975 if (
file->FindKey(
"TRT_Ar_all"))
2976 trt = (TDirectory *)
file->FindKey(
"TRT_Ar_all")->ReadObj();
2977 if (trt->FindKey(
"Detector_Ar_-1"))
2978 det1 = (TDirectory *)trt->FindKey(
"Detector_Ar_-1")->ReadObj();
2979 if (trt->FindKey(
"Detector_Ar_1"))
2980 det2 = (TDirectory *)trt->FindKey(
"Detector_Ar_1")->ReadObj();
2981 if (trt->FindKey(
"Detector_Ar_-2"))
2982 det3 = (TDirectory *)trt->FindKey(
"Detector_Ar_-2")->ReadObj();
2983 if (trt->FindKey(
"Detector_Ar_2"))
2984 det4 = (TDirectory *)trt->FindKey(
"Detector_Ar_2")->ReadObj();
2987 TH2F *reshist1 =
nullptr;
2988 TH2F *reshist2 =
nullptr;
2989 TH2F *reshist3 =
nullptr;
2990 TH2F *reshist4 =
nullptr;
2991 TH2F *reshist5 =
nullptr;
2992 TH2F *treshist1 =
nullptr;
2993 TH2F *treshist2 =
nullptr;
2994 TH2F *treshist3 =
nullptr;
2995 TH2F *treshist4 =
nullptr;
2996 TH2F *treshist5 =
nullptr;
2998 cout <<
" Find residual histograms " << endl;
3000 if (trt->FindKey(
"residual"))
3001 reshist1 = (
TH2F *)trt->FindKey(
"residual")->ReadObj();
3004 if (det1->FindKey(
"residual"))
3005 reshist2 = (
TH2F *)det1->FindKey(
"residual")->ReadObj();
3009 if (det2->FindKey(
"residual"))
3010 reshist3 = (
TH2F *)det2->FindKey(
"residual")->ReadObj();
3014 if (det3->FindKey(
"residual"))
3015 reshist4 = (
TH2F *)det3->FindKey(
"residual")->ReadObj();
3019 if (det4->FindKey(
"residual"))
3020 reshist5 = (
TH2F *)det4->FindKey(
"residual")->ReadObj();
3023 cout <<
" Find time residual histograms" << endl;
3024 if (trt->FindKey(
"timeresidual"))
3025 treshist1 = (
TH2F *)trt->FindKey(
"timeresidual")->ReadObj();
3028 if (det1->FindKey(
"timeresidual"))
3029 treshist2 = (
TH2F *)det1->FindKey(
"timeresidual")->ReadObj();
3033 if (det2->FindKey(
"timeresidual"))
3034 treshist3 = (
TH2F *)det2->FindKey(
"timeresidual")->ReadObj();
3038 if (det3->FindKey(
"timeresidual"))
3039 treshist4 = (
TH2F *)det3->FindKey(
"timeresidual")->ReadObj();
3043 if (det4->FindKey(
"timeresidual"))
3044 treshist5 = (
TH2F *)det4->FindKey(
"timeresidual")->ReadObj();
3047 cout <<
" Configure residual histograms" << endl;
3049 reshist1->SetTitle(Form(
"residual whole TRT"));
3051 reshist2->SetTitle(Form(
"residual (barrel side C)"));
3053 reshist3->SetTitle(Form(
"residual (barrel side A)"));
3055 reshist4->SetTitle(Form(
"residual (endcap side C)"));
3057 reshist5->SetTitle(Form(
"residual (endcap side A)"));
3059 reshist2->SetFillColor(46);
3061 reshist3->SetFillColor(46);
3063 reshist4->SetFillColor(46);
3065 reshist5->SetFillColor(46);
3067 cout <<
" Configure time residual histograms" << endl;
3069 treshist1->SetTitle(
"time-residual whole TRT");
3071 treshist2->SetTitle(
"time-residual (barrel side C)");
3073 treshist3->SetTitle(
"time-residual (barrel side A)");
3075 treshist4->SetTitle(
"time-residual (endcap side C)");
3077 treshist5->SetTitle(
"time-residual (endcap side A)");
3079 treshist2->SetFillColor(38);
3081 treshist3->SetFillColor(38);
3083 treshist4->SetFillColor(38);
3085 treshist5->SetFillColor(38);
3091 cout <<
" Configure Argon residual histograms" << endl;
3093 reshist1->SetTitle(
"residual Argon whole TRT");
3095 reshist2->SetTitle(
"residual Argon (barrel side C)");
3097 reshist3->SetTitle(
"residual Argon (barrel side A)");
3099 reshist4->SetTitle(
"residual Argon (endcap side C)");
3101 reshist5->SetTitle(
"residual Argon (endcap side A)");
3103 treshist1->SetTitle(
"time-residual Argon whole TRT");
3105 treshist2->SetTitle(
"time-residual Argon (barrel side C)");
3107 treshist3->SetTitle(
"time-residual Argon (barrel side A)");
3109 treshist4->SetTitle(
"time-residual Argon (endcap side C)");
3111 treshist5->SetTitle(
"time-residual Argon (endcap side A)");
3114 TF1 *resfit2 =
nullptr;
3115 TF1 *resfit3 =
nullptr;
3116 TF1 *resfit4 =
nullptr;
3117 TF1 *resfit5 =
nullptr;
3118 TF1 *tresfit2 =
nullptr;
3119 TF1 *tresfit3 =
nullptr;
3120 TF1 *tresfit4 =
nullptr;
3121 TF1 *tresfit5 =
nullptr;
3124 resfit2 = (TF1 *)reshist2->GetListOfFunctions()->First();
3126 resfit3 = (TF1 *)reshist3->GetListOfFunctions()->First();
3128 resfit4 = (TF1 *)reshist4->GetListOfFunctions()->First();
3130 resfit5 = (TF1 *)reshist5->GetListOfFunctions()->First();
3132 tresfit2 = (TF1 *)treshist2->GetListOfFunctions()->First();
3134 tresfit3 = (TF1 *)treshist3->GetListOfFunctions()->First();
3136 tresfit4 = (TF1 *)treshist4->GetListOfFunctions()->First();
3138 tresfit5 = (TF1 *)treshist5->GetListOfFunctions()->First();
3140 TText *mintxt =
new TText();
3141 mintxt->SetNDC(kTRUE);
3148 cout <<
" Draw residual barrel C" << endl;
3150 mintxt->DrawText(0.15, 0.85, Form(
"Mean: %.3f", resfit2->GetParameter(1)));
3151 mintxt->DrawText(0.15, 0.80, Form(
"Sigma: %.3f", resfit2->GetParameter(2)));
3157 cout <<
" Draw residual barrel A" << endl;
3159 mintxt->DrawText(0.15, 0.85, Form(
"Mean: %.3f", resfit3->GetParameter(1)));
3160 mintxt->DrawText(0.15, 0.80, Form(
"Sigma: %.3f", resfit3->GetParameter(2)));
3166 cout <<
" Draw residual endcap C" << endl;
3168 mintxt->DrawText(0.15, 0.85, Form(
"Mean: %.3f", resfit4->GetParameter(1)));
3169 mintxt->DrawText(0.15, 0.80, Form(
"Sigma: %.3f", resfit4->GetParameter(2)));
3174 cout <<
" Draw residual endcap A" << endl;
3176 mintxt->DrawText(0.15, 0.85, Form(
"Mean: %.3f", resfit5->GetParameter(1)));
3177 mintxt->DrawText(0.15, 0.80, Form(
"Sigma: %.3f", resfit5->GetParameter(2)));
3183 cout <<
" Draw time residual barrel C" << endl;
3185 mintxt->DrawText(0.15, 0.85, Form(
"Mean: %.3f", tresfit2->GetParameter(1)));
3186 mintxt->DrawText(0.15, 0.80, Form(
"Sigma: %.3f", tresfit2->GetParameter(2)));
3192 cout <<
" Draw time residual barrel A" << endl;
3194 mintxt->DrawText(0.15, 0.85, Form(
"Mean: %.3f", tresfit3->GetParameter(1)));
3195 mintxt->DrawText(0.15, 0.80, Form(
"Sigma: %.3f", tresfit3->GetParameter(2)));
3200 cout <<
" Draw time residual endcap C" << endl;
3202 mintxt->DrawText(0.15, 0.85, Form(
"Mean: %.3f", tresfit4->GetParameter(1)));
3203 mintxt->DrawText(0.15, 0.80, Form(
"Sigma: %.3f", tresfit4->GetParameter(2)));
3208 cout <<
" Draw time residual endcap A" << endl;
3210 mintxt->DrawText(0.15, 0.85, Form(
"Mean: %.3f", tresfit5->GetParameter(1)));
3211 mintxt->DrawText(0.15, 0.80, Form(
"Sigma: %.3f", tresfit5->GetParameter(2)));
3213 gStyle->SetOptStat(0);
3227 this->SetName(
"resplots");
3231 TDirectory *trt =
nullptr;
3233 trt = (TDirectory *)
file->FindKey(
"TRT_all")->ReadObj();
3235 trt = (TDirectory *)
file->FindKey(
"TRT_Ar_all")->ReadObj();
3237 TH2F *reshist1 =
nullptr;
3238 if (trt->FindKey(
"residual"))
3239 reshist1 = (
TH2F *)trt->FindKey(
"residual")->ReadObj();
3241 throw(
string(
"residual histograms for entire TRT not found!"));
3243 TH2F *treshist1 =
nullptr;
3244 if (trt->FindKey(
"timeresidual"))
3245 treshist1 = (
TH2F *)trt->FindKey(
"timeresidual")->ReadObj();
3247 throw(
string(
"timeresidual histograms for entire TRT not found!"));
3249 reshist1->SetTitle(Form(
"residual whole TRT"));
3251 reshist1->SetTitle(Form(
"Argon residual whole TRT"));
3252 reshist1->SetFillColor(46);
3253 treshist1->SetTitle(Form(
"time-residual whole TRT"));
3255 treshist1->SetTitle(Form(
"Argon time-residual whole TRT"));
3256 treshist1->SetFillColor(38);
3258 this->Divide(1, 2, 0.01, 0.01);
3278 cout <<
"In TBinnedRes. Input is " << reshists.size() <<
" histograms to be drawn " << endl;
3280 this->Divide(((
int)reshists.size()) / 5, 5);
3281 for (
int ihist = 0; ihist < (
int)reshists.size(); ihist++)
3283 this->
cd(ihist + 1);
3284 reshists[ihist]->SetTitle(
"");
3285 reshists[ihist]->Draw();
3286 reshists[ihist]->GetYaxis()->SetRangeUser(0, 1.1 * reshists[ihist]->GetMaximum());
3287 TLine *zlin =
new TLine(0, 0, 0, reshists[ihist]->GetMaximum());
3288 zlin->SetLineStyle(2);
3289 zlin->SetLineColor(4);
3310 TDirectory *binhist = (TDirectory *)(((TDirectory *)
file->Get(
detector.c_str()))->Get(
"binhist"));
3313 int nhists = binhist->GetListOfKeys()->GetEntries();
3315 this->Divide(
nhists / 5, 5);
3316 for (
int ihist = 0; ihist <
nhists; ihist++)
3318 this->
cd(ihist + 1);
3319 m_hist2 = (
TH1F *)(binhist->Get(binhist->GetListOfKeys()->At(ihist)->GetName()));
3320 m_hist2->SetTitle(
"");
3333 RresTbin(TFile *,
const string &,
int);
3348 TF1
ff(
"fitfunc",
"gaus");
3349 TF1 *ff2 =
new TF1(
"fitfunc2",
"pol3");
3351 TDirectory *trt =
nullptr;
3352 TDirectory *detdir =
nullptr;
3353 TDirectory *binhist =
nullptr;
3356 if (detname.find(
"Ar") != string::npos)
3358 bool allTRT =
false;
3359 if (detname ==
"WholeBarrel_1")
3361 resname =
"reshists5";
3363 else if (detname ==
"Detector_-1")
3365 resname =
"reshists2";
3367 else if (detname ==
"Detector_1")
3369 resname =
"reshists3";
3371 else if (detname ==
"Detector_-2")
3373 resname =
"reshists1";
3375 else if (detname ==
"Detector_2")
3377 resname =
"reshists4";
3381 resname =
"reshists";
3384 else if (detname ==
"WholeBarrel_Ar_1")
3386 resname =
"reshists_Ar5";
3388 else if (detname ==
"Detector_Ar_-1")
3390 resname =
"reshists_Ar2";
3392 else if (detname ==
"Detector_Ar_1")
3394 resname =
"reshists_Ar3";
3396 else if (detname ==
"Detector_Ar_-2")
3398 resname =
"reshists_Ar1";
3400 else if (detname ==
"Detector_Ar_2")
3402 resname =
"reshists_Ar4";
3406 resname =
"reshists_Ar";
3411 trt = (TDirectory *)
file->FindKey(
"TRT_all")->ReadObj();
3413 trt = (TDirectory *)
file->FindKey(
"TRT_Ar_all")->ReadObj();
3416 cout <<
"In RresTbin Xenon" << endl;
3418 cout <<
"In RresTbin Argon" << endl;
3421 cout <<
" found TRT_all directory " << endl;
3422 detdir = (TDirectory *)trt->FindKey(detname.c_str())->ReadObj();
3425 cout <<
" found binhist directory for detector name " << detname << endl;
3428 binhist = (TDirectory *)detdir->FindKey(resname.c_str())->ReadObj();
3432 binhist = (TDirectory *)trt->FindKey(resname.c_str())->ReadObj();
3437 cout <<
" found reshists directory for detector number: " <<
det << endl;
3441 cout <<
" did not find reshists directory for detector number " <<
det << endl;
3446 cout <<
" did not find binhist directory for detector name " << detname << endl;
3451 cout <<
" did not find TRT_all directory " << endl;
3457 TVectorD *tbins = (TVectorD *)
file->FindKey(
"tbins")->ReadObj();
3461 const size_t nElements = tbins->GetNoElements();
3462 cout <<
" found tbins vector with length " << nElements << endl;
3463 m_rdata = std::vector<double>(nElements,0.);
3464 m_erdata = std::vector<double>(nElements,0.);
3465 m_tdata = std::vector<double>(nElements,0.);
3466 m_etdata = std::vector<double>(nElements,0.);
3467 m_thegraph = TGraphErrors(nElements);
3470 for (
int ihist = 0; ihist < tbins->GetNoElements(); ihist++)
3473 TH1D *reshist =
nullptr;
3476 reshist = (TH1D *)binhist->Get(Form(
"res_tbin%i_bar", ihist));
3478 reshist = (TH1D *)binhist->Get(Form(
"res_tbin%i_trt", ihist));
3480 reshist = (TH1D *)binhist->Get(Form(
"res_tbin%i_%i", ihist,
det));
3482 if (reshist !=
nullptr)
3484 double lolim = -0.1;
3487 if (reshist->Fit(&
ff,
"Q",
"", lolim, hilim) + 1)
3489 m_rdata[ipoint] =
ff.GetParameter(1);
3490 m_erdata[ipoint] =
ff.GetParError(1);
3491 m_tdata[ipoint] = (*tbins)[ihist];
3493 m_etdata[ipoint] = 0;
3498 reshists.push_back(reshist);
3501 cout <<
" succesfully fitted " << ipoint <<
" histograms " << endl;
3502 for (
int ip = 0;
ip < ipoint;
ip++)
3505 resmap[m_tdata[
ip]] = m_rdata[
ip];
3511 m_thegraph = TGraphErrors(ipoint, m_tdata.data(), m_rdata.data(), m_etdata.data(), m_erdata.data());
3513 cout <<
" draw t-binned residual graph " << endl;
3514 string detstr[8] = {
"endcap A",
"barrel A",
"",
"barrel C",
"endcap C",
"",
"whole barrel",
"whole TRT"};
3516 m_thegraph.SetMarkerStyle(20);
3517 m_thegraph.SetTitle(Form(
"t-binned absolute residual (%s)", detstr[
det + 2].c_str()));
3518 m_thegraph.Draw(
"ap");
3519 m_thegraph.GetYaxis()->SetTitle(
"|r|-|r_{track}| /mm");
3520 m_thegraph.GetYaxis()->SetRangeUser(-0.150, 0.150);
3521 m_thegraph.GetXaxis()->SetRangeUser(0, 50);
3522 m_thegraph.GetXaxis()->SetTitle(
"t-t0 /ns");
3524 printf(
"RPOLDIFF %i %e %e %e %e\n",
det, ff2->GetParameter(0), ff2->GetParameter(1), ff2->GetParameter(2), ff2->GetParameter(3));
3549 TNtuple *Tracktuple = (TNtuple *)
file->Get(
"tracktuple");
3551 TH1F *resAr0 = (
TH1F *)
file->Get(
"TRT_Ar_all/Detector_Ar_-1/residual");
3552 TH1F *tresAr0 = (
TH1F *)
file->Get(
"TRT_Ar_all/Detector_Ar_-1/timeresidual");
3553 TH1F *resAr1 = (
TH1F *)
file->Get(
"TRT_Ar_all/Detector_Ar_-2/residual");
3554 TH1F *tresAr1 = (
TH1F *)
file->Get(
"TRT_Ar_all/Detector_Ar_-2/timeresidual");
3555 TH1F *resXe1 = (
TH1F *)
file->Get(
"TRT_all/Detector_-2/residual");
3556 TH1F *tresXe1 = (
TH1F *)
file->Get(
"TRT_all/Detector_-2/timeresidual");
3557 TH1F *resAr2 = (
TH1F *)
file->Get(
"TRT_Ar_all/Detector_Ar_1/residual");
3558 TH1F *tresAr2 = (
TH1F *)
file->Get(
"TRT_Ar_all/Detector_Ar_1/timeresidual");
3559 TH1F *resAr3 = (
TH1F *)
file->Get(
"TRT_Ar_all/Detector_Ar_2/residual");
3560 TH1F *tresAr3 = (
TH1F *)
file->Get(
"TRT_Ar_all/Detector_Ar_2/timeresidual");
3561 TH1F *resXe3 = (
TH1F *)
file->Get(
"TRT_all/Detector_2/residual");
3562 TH1F *tresXe3 = (
TH1F *)
file->Get(
"TRT_all/Detector_2/timeresidual");
3564 TDatime *
dt =
new TDatime();
3566 TPaveText *
pt =
new TPaveText(.1, .2, .9, .9);
3569 throw(
string(
"tracktuple not found!"));
3571 cout <<
" tracktuple found " << endl;
3578 cout <<
" writing to header. iteration number " <<
iter << endl;
3579 pt->AddText(Form(
"Iteration number: %i",
iter));
3580 cout <<
" writing to header. month " <<
dt->GetMonth() << endl;
3581 pt->AddText(Form(
"Time: %02i/%02i/%i %02i:%02i",
dt->GetDay(),
dt->GetMonth(),
dt->GetYear(),
dt->GetHour(),
dt->GetMinute()));
3582 Tracktuple->SetBranchAddress(
"run", &
runnumber);
3583 Tracktuple->GetEntry(0);
3584 cout <<
" writing to header. run number " << (
int)
runnumber << endl;
3585 pt->AddText(Form(
"Run number: %i", (
int)
runnumber));
3593 cout <<
" writing to header. number of tracks " << Tracktuple->GetEntries() << endl;
3594 pt->AddText(Form(
"Total no. tracks: %lli", Tracktuple->GetEntries()));
3600 float bhitst[4]={0};
3605 cout <<
" debug 1 " << endl;
3606 bhitst[0] = resAr0->GetEntries();
3607 bhitst[2] = resAr2->GetEntries();
3608 float nhAr1 = resAr1->GetEntries();
3609 float nhXe1 = resXe1->GetEntries();
3610 cout <<
" debug 2 " << endl;
3611 bhitst[1] = nhAr1 + nhXe1;
3615 nhAr3 = resAr3->GetEntries();
3617 nhXe3 = resXe3->GetEntries();
3618 bhitst[3] = nhAr3 + nhXe3;
3619 cout <<
" debug 3 " << endl;
3620 rest[0] = resAr0->GetFunction(
"gaus")->GetParameter(2);
3621 rest[2] = resAr2->GetFunction(
"gaus")->GetParameter(2);
3622 rest[1] = (resAr1->GetFunction(
"gaus")->GetParameter(2) * nhAr1 + resXe1->GetFunction(
"gaus")->GetParameter(2) * nhXe1) / bhitst[1];
3623 if (resAr3 and resXe3)
3624 rest[3] = (resAr3->GetFunction(
"gaus")->GetParameter(2) * nhAr3 + resXe3->GetFunction(
"gaus")->GetParameter(2) * nhXe3) / bhitst[3];
3625 cout <<
" debug 4 " << endl;
3626 trest[0] = tresAr0->GetFunction(
"gaus")->GetParameter(1);
3627 trest[2] = tresAr2->GetFunction(
"gaus")->GetParameter(1);
3628 trest[1] = (tresAr1->GetFunction(
"gaus")->GetParameter(1) * nhAr1 + tresXe1->GetFunction(
"gaus")->GetParameter(1) * nhXe1) / bhitst[1];
3630 trest[3] = (tresAr3->GetFunction(
"gaus")->GetParameter(1) * nhAr3 + tresXe3->GetFunction(
"gaus")->GetParameter(1) * nhXe3) / bhitst[3];
3631 cout <<
" debug 5 " << endl;
3632 treswt[0] = tresAr0->GetFunction(
"gaus")->GetParameter(2);
3633 treswt[2] = tresAr2->GetFunction(
"gaus")->GetParameter(2);
3634 treswt[1] = (tresAr1->GetFunction(
"gaus")->GetParameter(2) * nhAr1 + tresXe1->GetFunction(
"gaus")->GetParameter(2) * nhXe1) / bhitst[1];
3636 treswt[3] = (tresAr3->GetFunction(
"gaus")->GetParameter(2) * nhAr3 + tresXe3->GetFunction(
"gaus")->GetParameter(2) * nhXe3) / bhitst[3];
3637 cout <<
" debug 6 " << endl;
3641 TDirectory *
errors =
nullptr;
3642 TDirectory *errorsAr =
nullptr;
3643 bool iserrors =
false;
3644 bool iserrorsAr =
false;
3645 if (
file->FindKey(
"ErrorsAr"))
3647 errorsAr = (TDirectory *)
file->FindKey(
"ErrorsAr")->ReadObj();
3648 if (errorsAr !=
nullptr)
3651 if (
file->FindKey(
"Errors"))
3653 errors = (TDirectory *)
file->FindKey(
"Errors")->ReadObj();
3666 TH2F *residual_ea =
nullptr;
3667 TH2F *residual_ec =
nullptr;
3672 TH2F *residual_eaP =
nullptr;
3673 TH2F *residual_ecP =
nullptr;
3676 TH2F *residualAr_ba =
nullptr;
3677 TH2F *residualAr_bc =
nullptr;
3678 TH2F *residualAr_ea =
nullptr;
3679 TH2F *residualAr_ec =
nullptr;
3682 TH2F *residualAr_baP =
nullptr;
3683 TH2F *residualAr_bcP =
nullptr;
3684 TH2F *residualAr_eaP =
nullptr;
3685 TH2F *residualAr_ecP =
nullptr;
3687 if (iserrors &&
errors->FindKey(
"tresidual_trt") &&
errors->FindKey(
"tresidual_trtP"))
3690 if (
errors->FindKey(
"tresidual_ea"))
3691 residual_ea = (
TH2F *)
errors->FindKey(
"tresidual_ea")->ReadObj();
3692 if (
errors->FindKey(
"tresidual_ec"))
3693 residual_ec = (
TH2F *)
errors->FindKey(
"tresidual_ec")->ReadObj();
3696 if (
errors->FindKey(
"tresidual_eaP"))
3697 residual_eaP = (
TH2F *)
errors->FindKey(
"tresidual_eaP")->ReadObj();
3698 if (
errors->FindKey(
"tresidual_ecP"))
3699 residual_ecP = (
TH2F *)
errors->FindKey(
"tresidual_ecP")->ReadObj();
3703 cout <<
" No time residual histograms in endcaps: tresidual_trt and tresidual_trtP " << endl;
3705 if (iserrorsAr && errorsAr->FindKey(
"tresidualAr_trt") && errorsAr->FindKey(
"tresidualAr_trtP"))
3708 if (errorsAr->FindKey(
"tresidualAr_ba"))
3709 residualAr_ba = (
TH2F *)errorsAr->FindKey(
"tresidualAr_ba")->ReadObj();
3710 if (errorsAr->FindKey(
"tresidualAr_bc"))
3711 residualAr_bc = (
TH2F *)errorsAr->FindKey(
"tresidualAr_bc")->ReadObj();
3712 if (errorsAr->FindKey(
"tresidualAr_ea"))
3713 residualAr_ea = (
TH2F *)errorsAr->FindKey(
"tresidualAr_ea")->ReadObj();
3714 if (errorsAr->FindKey(
"tresidualAr_ec"))
3715 residualAr_ec = (
TH2F *)errorsAr->FindKey(
"tresidualAr_ec")->ReadObj();
3718 if (errorsAr->FindKey(
"tresidualAr_baP"))
3719 residualAr_baP = (
TH2F *)errorsAr->FindKey(
"tresidualAr_baP")->ReadObj();
3720 if (errorsAr->FindKey(
"tresidualAr_bcP"))
3721 residualAr_bcP = (
TH2F *)errorsAr->FindKey(
"tresidualAr_bcP")->ReadObj();
3722 if (errorsAr->FindKey(
"tresidualAr_eaP"))
3723 residualAr_eaP = (
TH2F *)errorsAr->FindKey(
"tresidualAr_eaP")->ReadObj();
3724 if (errorsAr->FindKey(
"tresidualAr_ecP"))
3725 residualAr_ecP = (
TH2F *)errorsAr->FindKey(
"tresidualAr_ecP")->ReadObj();
3729 cout <<
" No time residual histograms for Argon layers : tresidualAr_trt and tresidualAr_trtP " << endl;
3736 if (residualAr_ba && residualAr_baP && residualAr_ba->GetEntries() > 0)
3738 ratioba = residualAr_baP->GetEntries() / residualAr_ba->GetEntries();
3740 if (residualAr_bc && residualAr_bcP && residualAr_ea && residualAr_bc->GetEntries() > 0)
3742 ratiobc = residualAr_bcP->GetEntries() / residualAr_bc->GetEntries();
3744 if (residual_ea && residual_eaP && residualAr_ea && residualAr_eaP && residual_ea->GetEntries() > 0)
3746 ratioea = (residual_eaP->GetEntries() + residualAr_eaP->GetEntries()) / (residual_ea->GetEntries() + residualAr_ea->GetEntries());
3748 if (residual_ecP && residual_ec && residualAr_ecP &&residualAr_ec && residual_ec->GetEntries() > 0)
3750 ratioec = (residual_ecP->GetEntries() + residualAr_ecP->GetEntries()) / (residual_ec->GetEntries() + residualAr_ec->GetEntries());
3753 pt->AddText(
"Barrels:");
3754 pt->AddText(Form(
" (side C) hits: %i residual: %.4f mm Time res peak: %.3f ns ", (
int)bhitst[0], rest[0], trest[0]));
3755 pt->AddText(Form(
" (side C) Time res width: %.2f ns Ratio prec hits: %.3f ", treswt[0], ratioba));
3756 pt->AddText(Form(
" (side A) hits: %i residual: %.4f mm Time res peak: %.3f ns ", (
int)bhitst[2], rest[2], trest[2]));
3757 pt->AddText(Form(
" (side A) Time res width: %.2f ns Ratio prec hits: %.3f ", treswt[2], ratiobc));
3758 pt->AddText(
" Endcaps:");
3759 pt->AddText(Form(
" (side C) hits: %i residual: %.4f mm Time res peak: %.3f ns", (
int)bhitst[1], rest[1], trest[1]));
3760 pt->AddText(Form(
" (side C) Time res width: %.2f ns Ratio prec hits: %.3f ", treswt[1], ratioea));
3761 pt->AddText(Form(
" (side A) hits: %i residual: %.4f mm Time res peak: %.3f ns", (
int)bhitst[3], rest[3], trest[3]));
3762 pt->AddText(Form(
" (side A) Time res width: %.2f ns Ratio prec hits: %.3f ", treswt[3], ratioec));
3764 pt->SetLabel(Form(
"TRT calibration iteration summary"));
3785 TPaveText *
pt =
new TPaveText(.1, .1, 0.9, 0.9);
3786 pt->SetTextAlign(11);
3789 pt->SetLabel(Form(
"TRT calibration Main Settings"));
3793 if (myfile.is_open())
3795 while (!myfile.eof())
3797 getline(myfile,
line);
3798 auto notfirst = [&
line](
const std::string & sub)->
bool{
3799 return line.find(sub)!=0;
3801 if (notfirst(
"#") && notfirst(
"Clean") && notfirst(
"Submit") && notfirst(
"Relink") && notfirst(
"JobPrefix") && notfirst(
"Tag") && notfirst(
"WWW"))
3803 int space =
line.find_first_of(
" ");
3811 for (
const auto & [txt1,txt2]:
set)
3813 pt->AddText((
string(txt1 +
" . . . . . . . . . . . . " + txt2)).c_str());
3818 throw(
string(
"config file not found: ") +
string(
filename));
3837 m_Tracktuple = (TNtuple *)
file->Get(
"tracktuple");
3839 throw(
string(
"tracktuple not found!"));
3841 this->SetName(
"c1");
3842 this->Divide(1, 2, 0.01, 0.01);
3843 ((TPad *)this->GetPrimitive(
"c1_1"))->SetLogy();
3845 TH1F *trackhits =
new TH1F(
"trackhits",
"Accepted hits per track", 60, -0.5, 59.5);
3846 TH1F *trackhits1 =
new TH1F(
"trackhits1",
"Accepted hits per track BarrelA", 60, -0.5, 59.5);
3847 TH1F *trackhits2 =
new TH1F(
"trackhits2",
"Accepted hits per track EndcaoA", 60, -0.5, 59.5);
3848 TH1F *trackhits3 =
new TH1F(
"trackhits3",
"Accepted hits per track BarrelC", 60, -0.5, 59.5);
3849 TH1F *trackhits4 =
new TH1F(
"trackhits4",
"Accepted hits per track EndcaoC", 60, -0.5, 59.5);
3851 TH1F *eventphase =
new TH1F(
"eventphase",
"Event Phase", 80, -18, -1);
3852 TH1F *eventphase1 =
new TH1F(
"eventphase1",
"Eventphase1", 80, -18, -1);
3853 TH1F *eventphase2 =
new TH1F(
"eventphase2",
"Eventphase2", 80, -18, -1);
3854 TH1F *eventphase3 =
new TH1F(
"eventphase3",
"Eventphase3", 80, -18, -1);
3855 TH1F *eventphase4 =
new TH1F(
"eventphase4",
"Eventphase4", 80, -18, -1);
3857 m_Tracktuple->Draw(
"nhits>>trackhits");
3859 m_Tracktuple->Draw(
"nhits>>trackhits1",
"-log(tan(theta/2))>0 && -log(tan(theta/2))< 1 ",
"same");
3860 m_Tracktuple->Draw(
"nhits>>trackhits2",
"-log(tan(theta/2))>1",
"same");
3861 m_Tracktuple->Draw(
"nhits>>trackhits3",
"-log(tan(theta/2))<0 && -log(tan(theta/2))> -1 ",
"same");
3862 m_Tracktuple->Draw(
"nhits>>trackhits4",
"-log(tan(theta/2))<-1 ",
"same");
3863 trackhits1->SetLineColor(2);
3864 trackhits2->SetLineColor(3);
3865 trackhits3->SetLineColor(4);
3866 trackhits4->SetLineColor(5);
3867 trackhits1->Draw(
"same");
3868 trackhits2->Draw(
"same");
3869 trackhits3->Draw(
"same");
3870 trackhits4->Draw(
"same");
3871 TLegend *leg1 =
new TLegend(0.7155172, 0.1038136, 0.8965517, 0.2542373,
nullptr,
"brNDC");
3872 leg1->AddEntry(trackhits,
"all tracks",
"l");
3873 leg1->AddEntry(trackhits1,
"0 < eta < 1",
"l");
3874 leg1->AddEntry(trackhits2,
"eta > 1",
"l");
3875 leg1->AddEntry(trackhits3,
"-1 < eta < 0",
"l");
3876 leg1->AddEntry(trackhits4,
"eta < -1",
"l");
3877 leg1->SetTextSize(0.03);
3880 trackhits->SetTitle(Form(
"Accepted precission hits per track (%lli tracks in total)", m_Tracktuple->GetEntries()));
3881 trackhits->GetXaxis()->SetTitle(
"accepted precission hits");
3882 trackhits->GetYaxis()->SetTitle(
"No. tracks");
3883 this->SetName(
"c1");
3885 ((TPad *)this->GetPrimitive(
"c1_2"))->SetLogy();
3887 m_Tracktuple->Draw(
"epold>>eventphase");
3888 m_Tracktuple->Draw(
"epold>>eventphase1",
"-log(tan(theta/2))>0 && -log(tan(theta/2))< 1",
"same");
3889 m_Tracktuple->Draw(
"epold>>eventphase2",
"-log(tan(theta/2))>1",
"same");
3890 m_Tracktuple->Draw(
"epold>>eventphase3",
"-log(tan(theta/2))<0 && -log(tan(theta/2))> -1",
"same");
3891 m_Tracktuple->Draw(
"epold>>eventphase4",
"-log(tan(theta/2))<-1",
"same");
3893 eventphase1->SetLineColor(2);
3894 eventphase2->SetLineColor(3);
3895 eventphase3->SetLineColor(4);
3896 eventphase4->SetLineColor(5);
3898 eventphase->SetTitle(
"Eventphase");
3899 eventphase->GetXaxis()->SetTitle(
"eventphase");
3900 eventphase->GetYaxis()->SetTitle(
"No. tracks");
3902 TLegend *leg2 =
new TLegend(0.7155172, 0.1038136, 0.8965517, 0.2542373,
nullptr,
"brNDC");
3903 leg2->AddEntry(trackhits1,
"0 < eta < 1",
"l");
3904 leg2->AddEntry(trackhits2,
"eta > 1",
"l");
3905 leg2->AddEntry(trackhits3,
"-1 < eta < 0",
"l");
3906 leg2->AddEntry(trackhits4,
"eta < -1",
"l");
3907 leg2->SetTextSize(0.03);
3918 int const nxbins =
histo->GetNbinsX();
3919 TGraphErrors *Means =
new TGraphErrors(nxbins);
3922 TF1 *
ff =
new TF1(
"ff",
"gaus");
3923 for (
int i = 0;
i < nxbins;
i++)
3925 TH1D *
slice =
histo->ProjectionY(
"slice",
i + 1,
i + 1);
3928 ff->SetParameter(0,
slice->GetEntries());
3929 ff->SetParameter(1,
mean);
3930 ff->SetParameter(2,
rms);
3931 mean =
ff->GetParameter(1);
3932 rms =
ff->GetParameter(2);
3933 float x =
histo->GetBinCenter(
i + 1);
3934 Means->SetPoint(
i,
x,
mean);
3935 Means->SetPointError(
i, 0.5 *
histo->GetBinWidth(
i),
ff->GetParError(1));
3947 int const nxbins =
histo->GetNbinsX();
3948 TGraphErrors *Means =
new TGraphErrors(nxbins);
3951 TF1 *
ff =
new TF1(
"ff",
"gaus");
3952 for (
int i = 0;
i < nxbins;
i++)
3954 TH1D *
slice =
histo->ProjectionY(
"slice",
i + 1,
i + 1);
3957 float x =
histo->GetBinCenter(
i + 1);
3958 Means->SetPoint(
i,
x,
mean);
3959 Means->SetPointError(
i, 0.5 *
histo->GetBinWidth(
i),
ff->GetParError(1));
3971 int const nxbins =
histo->GetNbinsX();
3972 TGraphErrors *Means =
new TGraphErrors(nxbins);
3975 TF1 *
ff =
new TF1(
"ff",
"gaus");
3976 for (
int i = 0;
i < nxbins;
i++)
3978 TH1D *
slice =
histo->ProjectionY(
"slice",
i + 1,
i + 1);
3980 float x =
histo->GetBinCenter(
i + 1);
3981 Means->SetPoint(
i,
x,
mean);
3982 Means->SetPointError(
i, 0.5 *
histo->GetBinWidth(
i),
ff->GetParError(1));
3993 int const nxbins =
histo->GetNbinsX();
3994 TGraphErrors *Means =
new TGraphErrors(nxbins);
3997 TF1 *
ff =
new TF1(
"ff",
"gaus");
3998 for (
int i = 0;
i < nxbins;
i++)
4000 TH1D *
slice =
histo->ProjectionY(
"slice",
i + 1,
i + 1);
4003 ff->SetParameter(0,
slice->GetEntries());
4004 ff->SetParameter(1,
mean);
4005 ff->SetParameter(2,
rms);
4007 mean =
ff->GetParameter(1);
4008 rms =
ff->GetParameter(2);
4009 for (
int j = 0; j < 6; j++)
4013 rms =
ff->GetParameter(2);
4016 float x =
histo->GetBinCenter(
i + 1);
4017 Means->SetPoint(
i,
x,
rms);
4018 Means->SetPointError(
i, 0.5 *
histo->GetBinWidth(
i),
ff->GetParError(2));
4029 int const nxbins =
histo->GetNbinsX();
4030 TGraphErrors *Means =
new TGraphErrors(nxbins);
4033 TF1 *
ff =
new TF1(
"ff",
"gaus");
4034 for (
int i = 0;
i < nxbins;
i++)
4036 TH1D *
slice =
histo->ProjectionY(
"slice",
i + 1,
i + 1);
4039 float x =
histo->GetBinCenter(
i + 1);
4040 Means->SetPoint(
i,
x,
mean);
4041 Means->SetPointError(
i, 0.5 *
histo->GetBinWidth(
i),
rms);
4052 int const nxbins =
histo->GetNbinsX();
4053 TGraphErrors *Means =
new TGraphErrors(nxbins);
4056 TF1 *
ff =
new TF1(
"ff",
"gaus");
4057 for (
int i = 0;
i < nxbins;
i++)
4059 TH1D *
slice =
histo->ProjectionY(
"slice",
i + 1,
i + 1);
4062 ff->SetParameter(0,
slice->GetEntries());
4063 ff->SetParameter(1,
mean);
4064 ff->SetParameter(2,
rms);
4066 mean =
ff->GetParameter(1);
4067 rms =
ff->GetParameter(2);
4069 mean =
ff->GetParameter(1);
4070 rms =
ff->GetParameter(2);
4072 float x =
histo->GetBinCenter(
i + 1);
4073 Means->SetPoint(
i,
x,
rms);
4074 Means->SetPointError(
i, 0.5 *
histo->GetBinWidth(
i),
ff->GetParError(2));
4092 m_errors = (TDirectory *)
file->FindKey(
"Errors")->ReadObj();
4093 if (m_errors ==
nullptr)
4094 throw(
string(
"No errors folder!!!!!!!!!!!!!!!"));
4095 if (m_errors->GetNkeys() > 29)
4097 this->Divide(2, 3, 0.01, 0.01);
4099 TH2F *residual_trt = (
TH2F *)m_errors->FindKey(
"residual_allhits")->ReadObj();
4100 TH2F *residual_ba = (
TH2F *)m_errors->FindKey(
"residual_ba")->ReadObj();
4101 TH2F *residual_bc = (
TH2F *)m_errors->FindKey(
"residual_bc")->ReadObj();
4102 TH2F *residual_ea = (
TH2F *)m_errors->FindKey(
"residual_ea")->ReadObj();
4103 TH2F *residual_ec = (
TH2F *)m_errors->FindKey(
"residual_ec")->ReadObj();
4109 TH2F *pull_trtP = (
TH2F *)m_errors->FindKey(
"pull_trtP")->ReadObj();
4110 TH2F *pull_baP = (
TH2F *)m_errors->FindKey(
"pull_baP")->ReadObj();
4111 TH2F *pull_bcP = (
TH2F *)m_errors->FindKey(
"pull_bcP")->ReadObj();
4112 TH2F *pull_eaP = (
TH2F *)m_errors->FindKey(
"pull_eaP")->ReadObj();
4113 TH2F *pull_ecP = (
TH2F *)m_errors->FindKey(
"pull_ecP")->ReadObj();
4114 TH2F *residual_trtP = (
TH2F *)m_errors->FindKey(
"residual_trtP")->ReadObj();
4115 TH2F *residual_baP = (
TH2F *)m_errors->FindKey(
"residual_baP")->ReadObj();
4116 TH2F *residual_bcP = (
TH2F *)m_errors->FindKey(
"residual_bcP")->ReadObj();
4117 TH2F *residual_eaP = (
TH2F *)m_errors->FindKey(
"residual_eaP")->ReadObj();
4118 TH2F *residual_ecP = (
TH2F *)m_errors->FindKey(
"residual_ecP")->ReadObj();
4119 TH2F *tresidual_trtP = (
TH2F *)m_errors->FindKey(
"tresidual_trtP")->ReadObj();
4120 TH2F *tresidual_baP = (
TH2F *)m_errors->FindKey(
"tresidual_baP")->ReadObj();
4121 TH2F *tresidual_bcP = (
TH2F *)m_errors->FindKey(
"tresidual_bcP")->ReadObj();
4122 TH2F *tresidual_eaP = (
TH2F *)m_errors->FindKey(
"tresidual_eaP")->ReadObj();
4123 TH2F *tresidual_ecP = (
TH2F *)m_errors->FindKey(
"tresidual_ecP")->ReadObj();
4124 TH2F *trackerrors_trt = (
TH2F *)m_errors->FindKey(
"trackerrors_trt")->ReadObj();
4125 TH2F *trackerrors_ba = (
TH2F *)m_errors->FindKey(
"trackerrors_ba")->ReadObj();
4126 TH2F *trackerrors_bc = (
TH2F *)m_errors->FindKey(
"trackerrors_bc")->ReadObj();
4127 TH2F *trackerrors_ea = (
TH2F *)m_errors->FindKey(
"trackerrors_ea")->ReadObj();
4128 TH2F *trackerrors_ec = (
TH2F *)m_errors->FindKey(
"trackerrors_ec")->ReadObj();
4132 TGraphErrors *tresTRT =
GetMean(tresidual_trtP);
4133 TGraphErrors *tresBA =
GetMean(tresidual_baP);
4134 tresBA->SetLineColor(kRed);
4135 tresBA->SetMarkerColor(kRed);
4136 TGraphErrors *tresBC =
GetMean(tresidual_bcP);
4137 tresBC->SetLineColor(kBlue);
4138 tresBC->SetMarkerColor(kBlue);
4139 TGraphErrors *tresEA =
GetMean(tresidual_eaP);
4140 tresEA->SetLineColor(kGreen);
4141 tresEA->SetMarkerColor(kGreen);
4142 TGraphErrors *tresEC =
GetMean(tresidual_ecP);
4143 tresEC->SetLineColor(kYellow);
4144 tresEC->SetMarkerColor(kYellow);
4146 tresTRT->SetTitle(
"Time Residual Mean VS PT");
4147 tresTRT->GetXaxis()->SetTitle(
"Pt (GeV)");
4148 tresTRT->GetYaxis()->SetTitle(
"ns");
4149 tresTRT->GetYaxis()->SetRangeUser(-0.8, 0.4);
4150 tresTRT->Draw(
"ALP");
4159 TGraphErrors *tresTRTw =
GetWidth(tresidual_trtP);
4160 TGraphErrors *tresBAw =
GetWidth(tresidual_baP);
4161 tresBAw->SetLineColor(kRed);
4162 tresBAw->SetMarkerColor(kRed);
4163 TGraphErrors *tresBCw =
GetWidth(tresidual_bcP);
4164 tresBCw->SetLineColor(kBlue);
4165 tresBCw->SetMarkerColor(kBlue);
4166 TGraphErrors *tresEAw =
GetWidth(tresidual_eaP);
4167 tresEAw->SetLineColor(kGreen);
4168 tresEAw->SetMarkerColor(kGreen);
4169 TGraphErrors *tresECw =
GetWidth(tresidual_ecP);
4170 tresECw->SetLineColor(kYellow);
4171 tresECw->SetMarkerColor(kYellow);
4173 tresTRTw->SetTitle(
"Time Residual Width VS PT");
4174 tresTRTw->GetXaxis()->SetTitle(
"Pt (GeV)");
4175 tresTRTw->GetYaxis()->SetTitle(
"ns");
4176 tresTRTw->GetYaxis()->SetRangeUser(2.9, 4.0);
4177 tresTRTw->Draw(
"ALP");
4178 tresBAw->Draw(
"LP");
4179 tresBCw->Draw(
"LP");
4180 tresEAw->Draw(
"LP");
4181 tresECw->Draw(
"LP");
4185 TGraphErrors *resTRTw =
GetWidth(residual_trtP);
4186 TGraphErrors *resBAw =
GetWidth(residual_baP);
4187 resBAw->SetLineColor(kRed);
4188 resBAw->SetMarkerColor(kRed);
4189 TGraphErrors *resBCw =
GetWidth(residual_bcP);
4190 resBCw->SetLineColor(kBlue);
4191 resBCw->SetMarkerColor(kBlue);
4192 TGraphErrors *resEAw =
GetWidth(residual_eaP);
4193 resEAw->SetLineColor(kGreen);
4194 resEAw->SetMarkerColor(kGreen);
4195 TGraphErrors *resECw =
GetWidth(residual_ecP);
4196 resECw->SetLineColor(kYellow);
4197 resECw->SetMarkerColor(kYellow);
4199 resTRTw->SetTitle(
"Residual Width VS PT");
4200 resTRTw->GetXaxis()->SetTitle(
"Pt (GeV)");
4201 resTRTw->GetYaxis()->SetTitle(
"mm");
4202 resTRTw->GetYaxis()->SetRangeUser(0.11, 0.18);
4203 resTRTw->Draw(
"ALP");
4211 TGraphErrors *pullTRTw =
GetPWidth(pull_trtP);
4212 TGraphErrors *pullBAw =
GetPWidth(pull_baP);
4213 pullBAw->SetLineColor(kRed);
4214 pullBAw->SetMarkerColor(kRed);
4215 TGraphErrors *pullBCw =
GetPWidth(pull_bcP);
4216 pullBCw->SetLineColor(kBlue);
4217 pullBCw->SetMarkerColor(kBlue);
4218 TGraphErrors *pullEAw =
GetPWidth(pull_eaP);
4219 pullEAw->SetLineColor(kGreen);
4220 pullEAw->SetMarkerColor(kGreen);
4221 TGraphErrors *pullECw =
GetPWidth(pull_ecP);
4222 pullECw->SetLineColor(kYellow);
4223 pullECw->SetMarkerColor(kYellow);
4225 pullTRTw->SetTitle(
"Pull Width VS PT");
4226 pullTRTw->GetXaxis()->SetTitle(
"Pt (GeV)");
4227 pullTRTw->GetYaxis()->SetTitle(
" ");
4228 pullTRTw->GetYaxis()->SetRangeUser(0.7, 1.3);
4229 pullTRTw->Draw(
"ALP");
4230 pullBAw->Draw(
"LP");
4231 pullBCw->Draw(
"LP");
4232 pullEAw->Draw(
"LP");
4233 pullECw->Draw(
"LP");
4237 TGraphErrors *trkTRTw =
GetMean(trackerrors_trt);
4238 TGraphErrors *trkBAw =
GetMean(trackerrors_ba);
4239 trkBAw->SetLineColor(kRed);
4240 trkBAw->SetMarkerColor(kRed);
4241 TGraphErrors *trkBCw =
GetMean(trackerrors_bc);
4242 trkBCw->SetLineColor(kBlue);
4243 trkBCw->SetMarkerColor(kBlue);
4244 TGraphErrors *trkEAw =
GetMean(trackerrors_ea);
4245 trkEAw->SetLineColor(kGreen);
4246 trkEAw->SetMarkerColor(kGreen);
4247 TGraphErrors *trkECw =
GetMean(trackerrors_ec);
4248 trkECw->SetLineColor(kYellow);
4249 trkECw->SetMarkerColor(kYellow);
4251 trkTRTw->SetTitle(
"Trk error Mean Width VS PT");
4252 trkTRTw->GetXaxis()->SetTitle(
"Pt (GeV)");
4253 trkTRTw->GetYaxis()->SetTitle(
"mm");
4254 trkTRTw->GetYaxis()->SetRangeUser(0.0, 0.07);
4255 trkTRTw->Draw(
"ALP");
4264 TGraphErrors *presTRTw =
GetWidth(residual_trt);
4265 TGraphErrors *presBAw =
GetWidth(residual_ba);
4266 presBAw->SetLineColor(kRed);
4267 presBAw->SetMarkerColor(kRed);
4268 TGraphErrors *presBCw =
GetWidth(residual_bc);
4269 presBCw->SetLineColor(kBlue);
4270 presBCw->SetMarkerColor(kBlue);
4271 TGraphErrors *presEAw =
GetWidth(residual_ea);
4272 presEAw->SetLineColor(kGreen);
4273 presEAw->SetMarkerColor(kGreen);
4274 TGraphErrors *presECw =
GetWidth(residual_ec);
4275 presECw->SetLineColor(kYellow);
4276 presECw->SetMarkerColor(kYellow);
4278 presTRTw->SetTitle(
"Residual Width all hits VS PT");
4279 presTRTw->GetXaxis()->SetTitle(
"Pt (GeV)");
4280 presTRTw->GetYaxis()->SetTitle(
"mm");
4281 presTRTw->GetYaxis()->SetRangeUser(0.11, 0.18);
4282 presTRTw->Draw(
"ALP");
4283 presBAw->Draw(
"LP");
4284 presBCw->Draw(
"LP");
4285 presEAw->Draw(
"LP");
4286 presECw->Draw(
"LP");
4290 cout <<
" Not enough keys in Errors directory for Pt dependence plots " << endl;
4305 errors = (TDirectory *)
file->FindKey(
"Errors")->ReadObj();
4307 throw(
string(
"No errors folder!!!!!!!!!!!!!!!"));
4308 if (
errors->GetNkeys() > 19)
4310 this->Divide(2, 3, 0.01, 0.01);
4314 TH2F *pull_vs_tb_trt = (
TH2F *)
errors->FindKey(
"pull_vs_tb_trt")->ReadObj();
4315 TH2F *pull_vs_tb_ba = (
TH2F *)
errors->FindKey(
"pull_vs_tb_ba")->ReadObj();
4316 TH2F *pull_vs_tb_bc = (
TH2F *)
errors->FindKey(
"pull_vs_tb_bc")->ReadObj();
4317 TH2F *pull_vs_tb_ea = (
TH2F *)
errors->FindKey(
"pull_vs_tb_ea")->ReadObj();
4318 TH2F *pull_vs_tb_ec = (
TH2F *)
errors->FindKey(
"pull_vs_tb_ec")->ReadObj();
4320 TH2F *errors_vs_tb_trt = (
TH2F *)
errors->FindKey(
"errors_vs_tb_trt")->ReadObj();
4321 TH2F *errors_vs_tb_ba = (
TH2F *)
errors->FindKey(
"errors_vs_tb_ba")->ReadObj();
4322 TH2F *errors_vs_tb_bc = (
TH2F *)
errors->FindKey(
"errors_vs_tb_bc")->ReadObj();
4323 TH2F *errors_vs_tb_ea = (
TH2F *)
errors->FindKey(
"errors_vs_tb_ea")->ReadObj();
4324 TH2F *errors_vs_tb_ec = (
TH2F *)
errors->FindKey(
"errors_vs_tb_ec")->ReadObj();
4326 TH2F *residual_vs_tb_trt = (
TH2F *)
errors->FindKey(
"residual_vs_tb_trt")->ReadObj();
4327 TH2F *residual_vs_tb_ba = (
TH2F *)
errors->FindKey(
"residual_vs_tb_ba")->ReadObj();
4328 TH2F *residual_vs_tb_bc = (
TH2F *)
errors->FindKey(
"residual_vs_tb_bc")->ReadObj();
4329 TH2F *residual_vs_tb_ea = (
TH2F *)
errors->FindKey(
"residual_vs_tb_ea")->ReadObj();
4330 TH2F *residual_vs_tb_ec = (
TH2F *)
errors->FindKey(
"residual_vs_tb_ec")->ReadObj();
4332 TH2F *trackerrors_vs_tb_trt = (
TH2F *)
errors->FindKey(
"trackerrors_vs_tb_trt")->ReadObj();
4333 TH2F *trackerrors_vs_tb_ba = (
TH2F *)
errors->FindKey(
"trackerrors_vs_tb_ba")->ReadObj();
4334 TH2F *trackerrors_vs_tb_bc = (
TH2F *)
errors->FindKey(
"trackerrors_vs_tb_bc")->ReadObj();
4335 TH2F *trackerrors_vs_tb_ea = (
TH2F *)
errors->FindKey(
"trackerrors_vs_tb_ea")->ReadObj();
4336 TH2F *trackerrors_vs_tb_ec = (
TH2F *)
errors->FindKey(
"trackerrors_vs_tb_ec")->ReadObj();
4340 TGraphErrors *tresTRT =
GetPWidth(pull_vs_tb_trt);
4341 TGraphErrors *tresBA =
GetPWidth(pull_vs_tb_ba);
4342 tresBA->SetLineColor(kRed);
4343 tresBA->SetMarkerColor(kRed);
4344 TGraphErrors *tresBC =
GetPWidth(pull_vs_tb_bc);
4345 tresBC->SetLineColor(kBlue);
4346 tresBC->SetMarkerColor(kBlue);
4347 TGraphErrors *tresEA =
GetPWidth(pull_vs_tb_ea);
4348 tresEA->SetLineColor(kGreen);
4349 tresEA->SetMarkerColor(kGreen);
4350 TGraphErrors *tresEC =
GetPWidth(pull_vs_tb_ec);
4351 tresEC->SetLineColor(kYellow);
4352 tresEC->SetMarkerColor(kYellow);
4354 tresTRT->SetTitle(
"Pull Width VS Drift Time. Pt>2GeV");
4355 tresTRT->GetXaxis()->SetTitle(
"Drift Time ");
4356 tresTRT->GetYaxis()->SetTitle(
" ");
4357 tresTRT->GetYaxis()->SetRangeUser(0.7, 1.3);
4358 tresTRT->Draw(
"ALP");
4365 TGraphErrors *errorsTRT =
GetMeanE(errors_vs_tb_trt);
4366 TGraphErrors *errorsBA =
GetMeanE(errors_vs_tb_ba);
4367 errorsBA->SetLineColor(kRed);
4368 errorsBA->SetMarkerColor(kRed);
4369 TGraphErrors *errorsBC =
GetMeanE(errors_vs_tb_bc);
4370 errorsBC->SetLineColor(kBlue);
4371 errorsBC->SetMarkerColor(kBlue);
4372 TGraphErrors *errorsEA =
GetMeanE(errors_vs_tb_ea);
4373 errorsEA->SetLineColor(kGreen);
4374 errorsEA->SetMarkerColor(kGreen);
4375 TGraphErrors *errorsEC =
GetMeanE(errors_vs_tb_ec);
4376 errorsEC->SetLineColor(kYellow);
4377 errorsEC->SetMarkerColor(kYellow);
4378 errorsTRT->SetTitle(
"Error VS Drift Time");
4379 errorsTRT->GetXaxis()->SetTitle(
"Drift Time");
4380 errorsTRT->GetYaxis()->SetTitle(
"mm");
4381 errorsTRT->GetYaxis()->SetRangeUser(0.05, 0.24);
4382 errorsTRT->Draw(
"ALP");
4383 errorsBA->Draw(
"LP");
4384 errorsBC->Draw(
"LP");
4385 errorsEA->Draw(
"LP");
4386 errorsEC->Draw(
"LP");
4389 TGraphErrors *ntresBA =
GetPn(pull_vs_tb_ba);
4390 ntresBA->SetLineColor(kRed);
4391 ntresBA->SetMarkerColor(kRed);
4392 TGraphErrors *ntresBC =
GetPn(pull_vs_tb_bc);
4393 ntresBC->SetLineColor(kBlue);
4394 ntresBC->SetMarkerColor(kBlue);
4395 TGraphErrors *ntresEA =
GetPn(pull_vs_tb_ea);
4396 ntresEA->SetLineColor(kGreen);
4397 ntresEA->SetMarkerColor(kGreen);
4398 TGraphErrors *ntresEC =
GetPn(pull_vs_tb_ec);
4399 ntresEC->SetLineColor(kYellow);
4400 ntresEC->SetMarkerColor(kYellow);
4401 ntresEA->SetTitle(
"Number of hits VS Drift Time. Pt>2GeV");
4402 ntresEA->GetXaxis()->SetTitle(
"Drift Time");
4403 ntresEA->GetYaxis()->SetTitle(
" hits ");
4404 ntresEA->Draw(
"ALP");
4405 ntresEC->Draw(
"LP");
4406 ntresBA->Draw(
"LP");
4407 ntresBC->Draw(
"LP");
4410 TGraphErrors *terrorsTRT =
GetMean(trackerrors_vs_tb_trt);
4411 TGraphErrors *terrorsBA =
GetMean(trackerrors_vs_tb_ba);
4412 terrorsBA->SetLineColor(kRed);
4413 terrorsBA->SetMarkerColor(kRed);
4414 TGraphErrors *terrorsBC =
GetMean(trackerrors_vs_tb_bc);
4415 terrorsBC->SetLineColor(kBlue);
4416 terrorsBC->SetMarkerColor(kBlue);
4417 TGraphErrors *terrorsEA =
GetMean(trackerrors_vs_tb_ea);
4418 terrorsEA->SetLineColor(kGreen);
4419 terrorsEA->SetMarkerColor(kGreen);
4420 TGraphErrors *terrorsEC =
GetMean(trackerrors_vs_tb_ec);
4421 terrorsEC->SetLineColor(kYellow);
4422 terrorsEC->SetMarkerColor(kYellow);
4423 terrorsTRT->SetTitle(
"Track Error VS Drift Time");
4424 terrorsTRT->GetXaxis()->SetTitle(
"Drift Time");
4425 terrorsTRT->GetYaxis()->SetTitle(
"mm");
4426 terrorsTRT->GetYaxis()->SetRangeUser(0.0, 0.07);
4427 terrorsTRT->Draw(
"ALP");
4428 terrorsBA->Draw(
"LP");
4429 terrorsBC->Draw(
"LP");
4430 terrorsEA->Draw(
"LP");
4431 terrorsEC->Draw(
"LP");
4434 TGraphErrors *residualTRT =
GetWidth(residual_vs_tb_trt);
4435 TGraphErrors *residualBA =
GetWidth(residual_vs_tb_ba);
4436 residualBA->SetLineColor(kRed);
4437 residualBA->SetMarkerColor(kRed);
4438 TGraphErrors *residualBC =
GetWidth(residual_vs_tb_bc);
4439 residualBC->SetLineColor(kBlue);
4440 residualBC->SetMarkerColor(kBlue);
4441 TGraphErrors *residualEA =
GetWidth(residual_vs_tb_ea);
4442 residualEA->SetLineColor(kGreen);
4443 residualEA->SetMarkerColor(kGreen);
4444 TGraphErrors *residualEC =
GetWidth(residual_vs_tb_ec);
4445 residualEC->SetLineColor(kYellow);
4446 residualEC->SetMarkerColor(kYellow);
4447 residualTRT->SetTitle(
"Residual VS Drift Time. Pt > 2GeV");
4448 residualTRT->GetXaxis()->SetTitle(
"Drift Time ");
4449 residualTRT->GetYaxis()->SetTitle(
"mm");
4450 residualTRT->GetYaxis()->SetRangeUser(0.05, 0.24);
4451 residualTRT->Draw(
"ALP");
4452 residualBA->Draw(
"LP");
4453 residualBC->Draw(
"LP");
4454 residualEA->Draw(
"LP");
4455 residualEC->Draw(
"LP");
4459 TH2F *residual_trt = (
TH2F *)
errors->FindKey(
"tresidual_trt")->ReadObj();
4460 TH2F *residual_ba = (
TH2F *)
errors->FindKey(
"tresidual_ba")->ReadObj();
4461 TH2F *residual_bc = (
TH2F *)
errors->FindKey(
"tresidual_bc")->ReadObj();
4462 TH2F *residual_ea = (
TH2F *)
errors->FindKey(
"tresidual_ea")->ReadObj();
4463 TH2F *residual_ec = (
TH2F *)
errors->FindKey(
"tresidual_ec")->ReadObj();
4465 TH2F *residual_trtP = (
TH2F *)
errors->FindKey(
"tresidual_trtP")->ReadObj();
4466 TH2F *residual_baP = (
TH2F *)
errors->FindKey(
"tresidual_baP")->ReadObj();
4467 TH2F *residual_bcP = (
TH2F *)
errors->FindKey(
"tresidual_bcP")->ReadObj();
4468 TH2F *residual_eaP = (
TH2F *)
errors->FindKey(
"tresidual_eaP")->ReadObj();
4469 TH2F *residual_ecP = (
TH2F *)
errors->FindKey(
"tresidual_ecP")->ReadObj();
4471 TGraphErrors *residualTRT1 =
GetEntries(residual_trt);
4472 TGraphErrors *residualBA1 =
GetEntries(residual_ba);
4473 residualBA1->SetLineColor(kRed);
4474 residualBA1->SetMarkerColor(kRed);
4475 TGraphErrors *residualBC1 =
GetEntries(residual_bc);
4476 residualBC1->SetLineColor(kBlue);
4477 residualBC1->SetMarkerColor(kBlue);
4478 TGraphErrors *residualEA1 =
GetEntries(residual_ea);
4479 residualEA1->SetLineColor(kGreen);
4480 residualEA1->SetMarkerColor(kGreen);
4481 TGraphErrors *residualEC1 =
GetEntries(residual_ec);
4482 residualEC1->SetLineColor(kYellow);
4483 residualEC1->SetMarkerColor(kYellow);
4485 TGraphErrors *residualTRT2 =
GetEntries(residual_trtP);
4486 TGraphErrors *residualBA2 =
GetEntries(residual_baP);
4487 residualBA2->SetLineColor(kRed);
4488 residualBA2->SetMarkerColor(kRed);
4489 TGraphErrors *residualBC2 =
GetEntries(residual_bcP);
4490 residualBC2->SetLineColor(kBlue);
4491 residualBC2->SetMarkerColor(kBlue);
4492 TGraphErrors *residualEA2 =
GetEntries(residual_eaP);
4493 residualEA2->SetLineColor(kGreen);
4494 residualEA2->SetMarkerColor(kGreen);
4495 TGraphErrors *residualEC2 =
GetEntries(residual_ecP);
4496 residualEC2->SetLineColor(kYellow);
4497 residualEC2->SetMarkerColor(kYellow);
4499 int nbins = residualTRT1->GetN();
4501 TGraphErrors *ratioTRT =
new TGraphErrors(
nbins);
4502 TGraphErrors *ratioBA =
new TGraphErrors(
nbins);
4503 TGraphErrors *ratioBC =
new TGraphErrors(
nbins);
4504 TGraphErrors *ratioEA =
new TGraphErrors(
nbins);
4505 TGraphErrors *ratioEC =
new TGraphErrors(
nbins);
4512 residualTRT1->GetPoint(
i,
x,
all);
4513 residualTRT2->GetPoint(
i,
x,
prec);
4514 cout <<
i <<
" " <<
x <<
" " <<
prec <<
" " <<
all << endl;
4521 ratioTRT->SetPoint(
i,
x, 0);
4523 residualBA1->GetPoint(
i,
x,
all);
4524 residualBA2->GetPoint(
i,
x,
prec);
4525 cout <<
i <<
" " <<
x <<
" " <<
prec <<
" " <<
all << endl;
4532 ratioBA->SetPoint(
i,
x, 0);
4535 residualBC1->GetPoint(
i,
x,
all);
4536 residualBC2->GetPoint(
i,
x,
prec);
4537 cout <<
i <<
" " <<
x <<
" " <<
prec <<
" " <<
all << endl;
4544 ratioBC->SetPoint(
i,
x, 0);
4547 residualEA1->GetPoint(
i,
x,
all);
4548 residualEA2->GetPoint(
i,
x,
prec);
4549 cout <<
i <<
" " <<
x <<
" " <<
prec <<
" " <<
all << endl;
4556 ratioEA->SetPoint(
i,
x, 0);
4559 residualEC1->GetPoint(
i,
x,
all);
4560 residualEC2->GetPoint(
i,
x,
prec);
4561 cout <<
i <<
" " <<
x <<
" " <<
prec <<
" " <<
all << endl;
4568 ratioEC->SetPoint(
i,
x, 0);
4573 ratioTRT->SetTitle(
"Ratio Precision Hits Vs Pt. Pt > 2GeV");
4574 ratioTRT->GetXaxis()->SetTitle(
"Precission Hits/Total Hits ");
4575 ratioTRT->GetYaxis()->SetTitle(
"pt");
4576 ratioTRT->GetYaxis()->SetRangeUser(0.05, 0.24);
4577 ratioTRT->GetYaxis()->SetRangeUser(0.3, 1);
4579 ratioBA->SetLineColor(kRed);
4580 ratioBC->SetLineColor(kBlue);
4581 ratioEA->SetLineColor(kGreen);
4582 ratioEC->SetLineColor(kYellow);
4584 ratioTRT->Draw(
"alp");
4585 ratioBA->Draw(
"lp");
4586 ratioBC->Draw(
"lp");
4587 ratioEA->Draw(
"lp");
4588 ratioEC->Draw(
"lp");
4592 cout <<
" Not enough keys in Errors directory for tb dependence plots " << endl;
4608 cout <<
"READING CORRECTIONS: " << endl;
4611 m_errors = (TDirectory *)
file->FindKey(
"Correction")->ReadObj();
4613 m_errors = (TDirectory *)
file->FindKey(
"CorrectionAr")->ReadObj();
4615 this->Divide(2, 3, 0.01, 0.01);
4619 TH2F *tres_vs_ToT_ba =
nullptr;
4620 TH2F *tres_vs_ToT_bc =
nullptr;
4622 TH2F *res_vs_ToT_ba =
nullptr;
4623 TH2F *res_vs_ToT_bc =
nullptr;
4631 if (m_errors->FindKey(
"tres_vs_ToT_ba"))
4632 tres_vs_ToT_ba = (
TH2F *)m_errors->FindKey(
"tres_vs_ToT_ba")->ReadObj();
4633 if (m_errors->FindKey(
"res_vs_ToT_ba"))
4634 res_vs_ToT_ba = (
TH2F *)m_errors->FindKey(
"res_vs_ToT_ba")->ReadObj();
4635 if (m_errors->FindKey(
"tres_vs_ToT_bc"))
4636 tres_vs_ToT_bc = (
TH2F *)m_errors->FindKey(
"tres_vs_ToT_bc")->ReadObj();
4637 if (m_errors->FindKey(
"res_vs_ToT_bc"))
4638 res_vs_ToT_bc = (
TH2F *)m_errors->FindKey(
"res_vs_ToT_bc")->ReadObj();
4642 if (m_errors->FindKey(
"tres_vs_ToT_ea"))
4643 tres_vs_ToT_ba = (
TH2F *)m_errors->FindKey(
"tres_vs_ToT_ea")->ReadObj();
4644 if (m_errors->FindKey(
"res_vs_ToT_ea"))
4645 res_vs_ToT_ba = (
TH2F *)m_errors->FindKey(
"res_vs_ToT_ea")->ReadObj();
4646 if (m_errors->FindKey(
"tres_vs_ToT_ec"))
4647 tres_vs_ToT_bc = (
TH2F *)m_errors->FindKey(
"tres_vs_ToT_ec")->ReadObj();
4648 if (m_errors->FindKey(
"res_vs_ToT_ec"))
4649 res_vs_ToT_bc = (
TH2F *)m_errors->FindKey(
"res_vs_ToT_ec")->ReadObj();
4656 if (m_errors->FindKey(
"tres_vs_HT_ba"))
4657 tres_vs_ToT_ba = (
TH2F *)m_errors->FindKey(
"tres_vs_HT_ba")->ReadObj();
4658 if (m_errors->FindKey(
"res_vs_HT_ba"))
4659 res_vs_ToT_ba = (
TH2F *)m_errors->FindKey(
"res_vs_HT_ba")->ReadObj();
4660 if (m_errors->FindKey(
"tres_vs_HT_bc"))
4661 tres_vs_ToT_bc = (
TH2F *)m_errors->FindKey(
"tres_vs_HT_bc")->ReadObj();
4662 if (m_errors->FindKey(
"res_vs_HT_bc"))
4663 res_vs_ToT_bc = (
TH2F *)m_errors->FindKey(
"res_vs_HT_bc")->ReadObj();
4667 if (m_errors->FindKey(
"tres_vs_HT_ea"))
4668 tres_vs_ToT_ba = (
TH2F *)m_errors->FindKey(
"tres_vs_HT_ea")->ReadObj();
4669 if (m_errors->FindKey(
"res_vs_HT_ea"))
4670 res_vs_ToT_ba = (
TH2F *)m_errors->FindKey(
"res_vs_HT_ea")->ReadObj();
4671 if (m_errors->FindKey(
"tres_vs_HT_ec"))
4672 tres_vs_ToT_bc = (
TH2F *)m_errors->FindKey(
"tres_vs_HT_ec")->ReadObj();
4673 if (m_errors->FindKey(
"res_vs_HT_ec"))
4674 res_vs_ToT_bc = (
TH2F *)m_errors->FindKey(
"res_vs_HT_ec")->ReadObj();
4684 if (m_errors->FindKey(
"tresAr_vs_ToT_ba"))
4685 tres_vs_ToT_ba = (
TH2F *)m_errors->FindKey(
"tresAr_vs_ToT_ba")->ReadObj();
4686 if (m_errors->FindKey(
"resAr_vs_ToT_ba"))
4687 res_vs_ToT_ba = (
TH2F *)m_errors->FindKey(
"resAr_vs_ToT_ba")->ReadObj();
4688 if (m_errors->FindKey(
"tresAr_vs_ToT_bc"))
4689 tres_vs_ToT_bc = (
TH2F *)m_errors->FindKey(
"tresAr_vs_ToT_bc")->ReadObj();
4690 if (m_errors->FindKey(
"resAr_vs_ToT_bc"))
4691 res_vs_ToT_bc = (
TH2F *)m_errors->FindKey(
"resAr_vs_ToT_bc")->ReadObj();
4695 if (m_errors->FindKey(
"tresAr_vs_ToT_ea"))
4696 tres_vs_ToT_ba = (
TH2F *)m_errors->FindKey(
"tresAr_vs_ToT_ea")->ReadObj();
4697 if (m_errors->FindKey(
"resAr_vs_ToT_ea"))
4698 res_vs_ToT_ba = (
TH2F *)m_errors->FindKey(
"resAr_vs_ToT_ea")->ReadObj();
4699 if (m_errors->FindKey(
"tresAr_vs_ToT_ec"))
4700 tres_vs_ToT_bc = (
TH2F *)m_errors->FindKey(
"tresAr_vs_ToT_ec")->ReadObj();
4701 if (m_errors->FindKey(
"resAr_vs_ToT_ec"))
4702 res_vs_ToT_bc = (
TH2F *)m_errors->FindKey(
"resAr_vs_ToT_ec")->ReadObj();
4709 if (m_errors->FindKey(
"tresAr_vs_HT_ba"))
4710 tres_vs_ToT_ba = (
TH2F *)m_errors->FindKey(
"tresAr_vs_HT_ba")->ReadObj();
4711 if (m_errors->FindKey(
"resAr_vs_HT_ba"))
4712 res_vs_ToT_ba = (
TH2F *)m_errors->FindKey(
"resAr_vs_HT_ba")->ReadObj();
4713 if (m_errors->FindKey(
"tresAr_vs_HT_bc"))
4714 tres_vs_ToT_bc = (
TH2F *)m_errors->FindKey(
"tresAr_vs_HT_bc")->ReadObj();
4715 if (m_errors->FindKey(
"resAr_vs_HT_bc"))
4716 res_vs_ToT_bc = (
TH2F *)m_errors->FindKey(
"resAr_vs_HT_bc")->ReadObj();
4720 if (m_errors->FindKey(
"tresAr_vs_HT_ea"))
4721 tres_vs_ToT_ba = (
TH2F *)m_errors->FindKey(
"tresAr_vs_HT_ea")->ReadObj();
4722 if (m_errors->FindKey(
"resAr_vs_HT_ea"))
4723 res_vs_ToT_ba = (
TH2F *)m_errors->FindKey(
"resAr_vs_HT_ea")->ReadObj();
4724 if (m_errors->FindKey(
"tresAr_vs_HT_ec"))
4725 tres_vs_ToT_bc = (
TH2F *)m_errors->FindKey(
"tresAr_vs_HT_ec")->ReadObj();
4726 if (m_errors->FindKey(
"resAr_vs_HT_ec"))
4727 res_vs_ToT_bc = (
TH2F *)m_errors->FindKey(
"resAr_vs_HT_ec")->ReadObj();
4734 TGraphErrors *tresBA =
GetMean(tres_vs_ToT_ba);
4735 tresBA->SetLineColor(kRed);
4736 tresBA->SetMarkerColor(kRed);
4737 if (not tres_vs_ToT_ba){
4738 throw std::runtime_error(
"tres_vs_ToT_ba pointer is null");
4741 tres_vs_ToT_ba->SetTitle(
"Barrel A Time Residual Mean VS ToT");
4743 tres_vs_ToT_ba->SetTitle(
"Endcap A Time Residual Mean VS ToT");
4744 tres_vs_ToT_ba->GetXaxis()->SetTitle(
"ToT (bin)");
4745 tres_vs_ToT_ba->GetYaxis()->SetTitle(
"Time Residual (ns)");
4749 tres_vs_ToT_ba->SetTitle(
"Barrel A Time Residual Mean VS HT");
4751 tres_vs_ToT_ba->SetTitle(
"Endcap A Time Residual Mean VS HT");}
4752 tres_vs_ToT_ba->GetXaxis()->SetTitle(
"HT (bin)");
4755 tres_vs_ToT_ba->Draw(
"colz");
4756 tresBA->Draw(
"same");
4759 TGraphErrors *tresBC =
GetMean(tres_vs_ToT_bc);
4760 tresBC->SetLineColor(kBlue);
4761 tresBC->SetMarkerColor(kBlue);
4763 if (not tres_vs_ToT_bc){
4764 throw std::runtime_error(
" tres_vs_ToT_bc is null");
4766 tres_vs_ToT_bc->SetTitle(
"Barrel C Time Residual Mean VS ToT");
4768 tres_vs_ToT_bc->SetTitle(
"Endcap C Time Residual Mean VS ToT");}
4769 tres_vs_ToT_bc->GetXaxis()->SetTitle(
"ToT (bin)");
4770 tres_vs_ToT_bc->GetYaxis()->SetTitle(
"Time Residual (ns)");
4773 tres_vs_ToT_bc->SetTitle(
"Barrel C Time Residual Mean VS HT");
4775 tres_vs_ToT_bc->SetTitle(
"Endcap C Time Residual Mean VS HT");
4777 tres_vs_ToT_bc->GetXaxis()->SetTitle(
"HT (bin)");
4780 tres_vs_ToT_bc->Draw(
"colz");
4781 tresBC->Draw(
"same");
4784 tresBA->SetTitle(
"Barrel Time Residual Mean vs ToT");
4786 tresBA->SetTitle(
"Endcap Time Residual Mean vs ToT");
4787 tresBA->GetXaxis()->SetTitle(
"ToT (bin)");
4791 tresBA->SetTitle(
"Barrel Time Residual Mean vs HT");
4793 tresBA->SetTitle(
"Endcap Time Residual Mean vs HT");
4794 tresBA->GetXaxis()->SetTitle(
"HT");
4796 tresBA->GetXaxis()->SetRangeUser(-0.5, 23.5);
4797 tresBA->GetYaxis()->SetRangeUser(-10, 10);
4800 tresBA->GetXaxis()->SetRangeUser(-0.5, 1.5);
4801 tresBA->GetYaxis()->SetRangeUser(-3, 3);
4803 tresBA->Draw(
"alp");
4804 tresBC->Draw(
"same");
4807 TGraphErrors *resBA1 =
GetMean(res_vs_ToT_ba);
4808 resBA1->SetLineColor(kRed);
4809 resBA1->SetMarkerColor(kRed);
4810 if (not res_vs_ToT_ba){
4811 throw std::runtime_error(
"res_vs_ToT_ba is null ptr");
4814 res_vs_ToT_ba->SetTitle(
"Barrel A Residual Mean VS ToT");
4816 res_vs_ToT_ba->SetTitle(
"Endcap A Residual Mean VS ToT");
4817 res_vs_ToT_ba->GetXaxis()->SetTitle(
"ToT (bin)");
4818 res_vs_ToT_ba->GetYaxis()->SetTitle(
"Residual (mm)");
4822 res_vs_ToT_ba->SetTitle(
"Barrel A Residual Mean VS HT");
4824 res_vs_ToT_ba->SetTitle(
"Endcap A Residual Mean VS HT");
4825 res_vs_ToT_ba->GetXaxis()->SetTitle(
"HT (bin)");
4827 res_vs_ToT_ba->Draw(
"colz");
4828 resBA1->Draw(
"same");
4831 TGraphErrors *resBC1 =
GetMean(res_vs_ToT_bc);
4832 resBC1->SetLineColor(kBlue);
4833 resBC1->SetMarkerColor(kBlue);
4835 res_vs_ToT_bc->SetTitle(
"Barrel C Residual Mean VS ToT");
4837 res_vs_ToT_bc->SetTitle(
"Endcap C Residual Mean VS ToT");
4838 res_vs_ToT_bc->GetXaxis()->SetTitle(
"ToT (bin)");
4839 res_vs_ToT_bc->GetYaxis()->SetTitle(
"Residual (mm)");
4843 res_vs_ToT_bc->SetTitle(
"Barrel C Residual Mean VS HT");
4845 res_vs_ToT_bc->SetTitle(
"Endcap C Residual Mean VS HT");
4846 res_vs_ToT_bc->GetXaxis()->SetTitle(
"HT (bin)");
4848 res_vs_ToT_bc->Draw(
"colz");
4849 resBC1->Draw(
"same");
4853 TGraphErrors *resBA =
GetWidth(res_vs_ToT_ba);
4854 resBA->SetLineColor(kRed);
4855 resBA->SetMarkerColor(kRed);
4856 TGraphErrors *resBC =
GetWidth(res_vs_ToT_bc);
4857 resBC->SetLineColor(kBlue);
4858 resBC->SetMarkerColor(kBlue);
4859 resBA->SetTitle(
"Barrel Time Residual Width vs ToT");
4861 resBA->SetTitle(
"Endcap Time Residual Width vs ToT");
4862 resBA->GetXaxis()->SetTitle(
"ToT (bin)");
4866 resBA->SetTitle(
"Barrel Residual Width vs HT");
4868 resBA->SetTitle(
"Endcap Residual Width vs HT");
4869 resBA->GetXaxis()->SetTitle(
"HT");
4871 resBA->GetXaxis()->SetRangeUser(-0.5, 23.5);
4872 resBA->GetYaxis()->SetRangeUser(0.08, 0.2);
4875 resBA->GetXaxis()->SetRangeUser(-0.5, 1.5);
4876 resBA->GetYaxis()->SetRangeUser(0.08, 0.2);
4879 resBC->Draw(
"same");
4896 m_errors = (TDirectory *)
file->FindKey(
"Correction")->ReadObj();
4898 m_errors = (TDirectory *)
file->FindKey(
"CorrectionAr")->ReadObj();
4900 throw(
string(
"No errors folder!!!!!!!!!!!!!!!"));
4902 this->Divide(2, 3, 0.01, 0.01);
4906 TH2F *tres_vs_ToT_ba =
nullptr;
4907 TH2F *tres_vs_ToT_bc =
nullptr;
4909 TH2F *res_vs_ToT_ba =
nullptr;
4910 TH2F *res_vs_ToT_bc =
nullptr;
4918 tres_vs_ToT_ba = (
TH2F *)m_errors->FindKey(
"tres_vs_SinOverP_bc")->ReadObj();
4919 res_vs_ToT_ba = (
TH2F *)m_errors->FindKey(
"res_vs_SinOverP_ba")->ReadObj();
4920 tres_vs_ToT_bc = (
TH2F *)m_errors->FindKey(
"tres_vs_SinOverP_bc")->ReadObj();
4921 res_vs_ToT_bc = (
TH2F *)m_errors->FindKey(
"res_vs_SinOverP_bc")->ReadObj();
4925 tres_vs_ToT_ba = (
TH2F *)m_errors->FindKey(
"tres_vs_SinOverP_ea")->ReadObj();
4926 res_vs_ToT_ba = (
TH2F *)m_errors->FindKey(
"res_vs_SinOverP_ea")->ReadObj();
4927 tres_vs_ToT_bc = (
TH2F *)m_errors->FindKey(
"tres_vs_SinOverP_ec")->ReadObj();
4928 res_vs_ToT_bc = (
TH2F *)m_errors->FindKey(
"res_vs_SinOverP_ec")->ReadObj();
4935 tres_vs_ToT_ba = (
TH2F *)m_errors->FindKey(
"tres_vs_CosOverP_bc")->ReadObj();
4936 res_vs_ToT_ba = (
TH2F *)m_errors->FindKey(
"res_vs_CosOverP_ba")->ReadObj();
4937 tres_vs_ToT_bc = (
TH2F *)m_errors->FindKey(
"tres_vs_CosOverP_bc")->ReadObj();
4938 res_vs_ToT_bc = (
TH2F *)m_errors->FindKey(
"res_vs_CosOverP_bc")->ReadObj();
4942 tres_vs_ToT_ba = (
TH2F *)m_errors->FindKey(
"tres_vs_CosOverP_ea")->ReadObj();
4943 res_vs_ToT_ba = (
TH2F *)m_errors->FindKey(
"res_vs_CosOverP_ea")->ReadObj();
4944 tres_vs_ToT_bc = (
TH2F *)m_errors->FindKey(
"tres_vs_CosOverP_ec")->ReadObj();
4945 res_vs_ToT_bc = (
TH2F *)m_errors->FindKey(
"res_vs_CosOverP_ec")->ReadObj();
4955 tres_vs_ToT_ba = (
TH2F *)m_errors->FindKey(
"tresAr_vs_SinOverP_bc")->ReadObj();
4956 res_vs_ToT_ba = (
TH2F *)m_errors->FindKey(
"resAr_vs_SinOverP_ba")->ReadObj();
4957 tres_vs_ToT_bc = (
TH2F *)m_errors->FindKey(
"tresAr_vs_SinOverP_bc")->ReadObj();
4958 res_vs_ToT_bc = (
TH2F *)m_errors->FindKey(
"resAr_vs_SinOverP_bc")->ReadObj();
4962 tres_vs_ToT_ba = (
TH2F *)m_errors->FindKey(
"tresAr_vs_SinOverP_ea")->ReadObj();
4963 res_vs_ToT_ba = (
TH2F *)m_errors->FindKey(
"resAr_vs_SinOverP_ea")->ReadObj();
4964 tres_vs_ToT_bc = (
TH2F *)m_errors->FindKey(
"tresAr_vs_SinOverP_ec")->ReadObj();
4965 res_vs_ToT_bc = (
TH2F *)m_errors->FindKey(
"resAr_vs_SinOverP_ec")->ReadObj();
4972 tres_vs_ToT_ba = (
TH2F *)m_errors->FindKey(
"tresAr_vs_CosOverP_bc")->ReadObj();
4973 res_vs_ToT_ba = (
TH2F *)m_errors->FindKey(
"resAr_vs_CosOverP_ba")->ReadObj();
4974 tres_vs_ToT_bc = (
TH2F *)m_errors->FindKey(
"tresAr_vs_CosOverP_bc")->ReadObj();
4975 res_vs_ToT_bc = (
TH2F *)m_errors->FindKey(
"resAr_vs_CosOverP_bc")->ReadObj();
4979 tres_vs_ToT_ba = (
TH2F *)m_errors->FindKey(
"tresAr_vs_CosOverP_ea")->ReadObj();
4980 res_vs_ToT_ba = (
TH2F *)m_errors->FindKey(
"resAr_vs_CosOverP_ea")->ReadObj();
4981 tres_vs_ToT_bc = (
TH2F *)m_errors->FindKey(
"tresAr_vs_CosOverP_ec")->ReadObj();
4982 res_vs_ToT_bc = (
TH2F *)m_errors->FindKey(
"resAr_vs_CosOverP_ec")->ReadObj();
4989 TGraphErrors *tresBA =
GetMean(tres_vs_ToT_ba);
4990 tresBA->SetLineColor(kRed);
4991 tresBA->SetMarkerColor(kRed);
4993 tres_vs_ToT_ba->SetTitle(
"Barrel A Time Residual Mean VS sin(Theta)/p");
4995 tres_vs_ToT_ba->SetTitle(
"Endcap A Time Residual Mean VS sin(Theta)/p");
4996 tres_vs_ToT_ba->GetXaxis()->SetTitle(
"sin(Theta)/p");
4997 tres_vs_ToT_ba->GetYaxis()->SetTitle(
"Time Residual (ns)");
5002 tres_vs_ToT_ba->SetTitle(
"Barrel A Time Residual Mean VS cos(Theta)/p");
5004 tres_vs_ToT_ba->SetTitle(
"Endcap A Time Residual Mean VS cos(Theta)/p");
5005 tres_vs_ToT_ba->GetXaxis()->SetTitle(
"cos(Theta)/p");
5008 tres_vs_ToT_ba->Draw(
"colz");
5009 tresBA->Draw(
"same");
5012 TGraphErrors *tresBC =
GetMean(tres_vs_ToT_bc);
5013 tresBC->SetLineColor(kBlue);
5014 tresBC->SetMarkerColor(kBlue);
5016 tres_vs_ToT_bc->SetTitle(
"Barrel C Time Residual Mean VS sin(Theta)/p");
5018 tres_vs_ToT_bc->SetTitle(
"Endcap C Time Residual Mean VS sin(Theta)/p");
5019 tres_vs_ToT_bc->GetXaxis()->SetTitle(
"sin(Theta)/p");
5020 tres_vs_ToT_bc->GetYaxis()->SetTitle(
"Time Residual (ns)");
5024 tres_vs_ToT_bc->SetTitle(
"Barrel C Time Residual Mean VS cos(Theta)/p");
5026 tres_vs_ToT_bc->SetTitle(
"Endcap C Time Residual Mean VS cos(Theta)/p");
5027 tres_vs_ToT_bc->GetXaxis()->SetTitle(
"cos(Theta)/p");
5029 tres_vs_ToT_bc->Draw(
"colz");
5030 tresBC->Draw(
"same");
5033 tresBA->SetTitle(
"Barrel Time Residual Mean vs Sin(theta) / p");
5035 tresBA->SetTitle(
"Endcap Time Residual Mean vs Sin(theta) / p");
5039 tresBA->SetTitle(
"Barrel Time Residual Mean vs Cos(theta) / p");
5041 tresBA->SetTitle(
"Endcap Time Residual Mean vs Cos(theta) / p");
5044 tresBA->GetXaxis()->SetRangeUser(0, 1);
5045 tresBA->GetYaxis()->SetRangeUser(-1, 1.5);
5046 tresBA->Draw(
"alp");
5047 tresBC->Draw(
"same");
5050 TGraphErrors *resBA1 =
GetMean(res_vs_ToT_ba);
5051 resBA1->SetLineColor(kRed);
5052 resBA1->SetMarkerColor(kRed);
5054 res_vs_ToT_ba->SetTitle(
"Barrel A Residual Mean VS sin(Theta)/p");
5056 res_vs_ToT_ba->SetTitle(
"Endcap A Residual Mean VS sin(Theta)/p");
5057 res_vs_ToT_ba->GetXaxis()->SetTitle(
"sin(Theta)/p");
5058 res_vs_ToT_ba->GetYaxis()->SetTitle(
"Residual (mm)");
5062 res_vs_ToT_ba->SetTitle(
"Barrel A Residual Mean VS cos(Theta)/p");
5064 res_vs_ToT_ba->SetTitle(
"Endcap A Residual Mean VS cos(Theta)/p");
5065 res_vs_ToT_ba->GetXaxis()->SetTitle(
"cos(Theta)/p");
5067 res_vs_ToT_ba->Draw(
"colz");
5068 resBA1->Draw(
"same");
5071 TGraphErrors *resBC1 =
GetMean(res_vs_ToT_bc);
5072 resBC1->SetLineColor(kBlue);
5073 resBC1->SetMarkerColor(kBlue);
5075 res_vs_ToT_bc->SetTitle(
"Barrel C Residual Mean VS sin(Theta)/p");
5077 res_vs_ToT_bc->SetTitle(
"Endcap C Residual Mean VS sin(Theta)/p");
5078 res_vs_ToT_bc->GetXaxis()->SetTitle(
"sin(Theta)/p");
5079 res_vs_ToT_bc->GetYaxis()->SetTitle(
"Residual (mm)");
5083 res_vs_ToT_bc->SetTitle(
"Barrel C Residual Mean VS cos(Theta)/p");
5085 res_vs_ToT_bc->SetTitle(
"Endcap C Residual Mean VS cos(Theta)/p");
5086 res_vs_ToT_bc->GetXaxis()->SetTitle(
"cos(Theta)/p");
5088 res_vs_ToT_bc->Draw(
"colz");
5089 resBC1->Draw(
"same");
5093 TGraphErrors *resBA =
GetWidth(res_vs_ToT_ba);
5094 resBA->SetLineColor(kRed);
5095 resBA->SetMarkerColor(kRed);
5096 TGraphErrors *resBC =
GetWidth(res_vs_ToT_bc);
5097 resBC->SetLineColor(kBlue);
5098 resBC->SetMarkerColor(kBlue);
5099 resBA->SetTitle(
"Barrel Residual Width vs Sin(theta) / p");
5101 resBA->SetTitle(
"Endcap Residual Widht vs Sin(theta) / p");
5105 resBA->SetTitle(
"Barrel Residual Width vs Cos(theta) / p");
5107 resBA->SetTitle(
"Endcap Residual Widht vs Cos(theta) / p");
5110 resBA->GetXaxis()->SetRangeUser(0, 1);
5111 resBA->GetYaxis()->SetRangeUser(0.08, 0.20);
5113 resBC->Draw(
"same");
5123 TFile *datafile =
new TFile(
argv[2]);
5124 if (datafile->IsZombie())
5126 cout <<
"ERROR! INPUT FILE DOES NOT EXIST!" << endl;
5131 if (datafile->FindKey(
"TRT_Ar_all"))
5134 cout <<
" This run contains straws with Argon" << endl;
5136 if (!datafile->FindKey(
"Chip_Artuple"))
5139 cout <<
" This run contains does not have Argon ntuples" << endl;
5145 bool useref =
false;
5149 refdatafile =
new TFile(
argv[4]);
5150 if (refdatafile->IsZombie())
5152 cout <<
"INPUT REFERENCE FILE DOES NOT EXIST! RUNNING WITHOUT IT!" << endl;
5156 cout <<
"INPUT REFERENCE FILE OK!" << endl;
5160 cout <<
"MAKING FirstPage" << endl;
5172 cout <<
"MAKING Settings" << endl;
5177 cout <<
"MAKING TracktupleInfo" << endl;
5190 cout <<
"MAKING HitStatistics" << endl;
5196 cout <<
"MAKING Ar HitStatistics" << endl;
5201 cout <<
"MAKING TRTPlots" << endl;
5224 cout <<
"MAKING ResidualPlots" << endl;
5246 cout <<
"MAKING T0CalibTypeXY" << endl;
5253 cout <<
"MAKING XYMaps(nt0)" << endl;
5255 XYMaps *nhitsAr =
nullptr;
5259 cout <<
"MAKING XYMaps(res)" << endl;
5261 XYMaps *resxy0Ar =
nullptr;
5265 cout <<
"MAKING XYMaps(resmean)" << endl;
5267 XYMaps *resxyAr =
nullptr;
5269 resxyAr =
new XYMaps(
argv[2],
"abs(resMean)",
true);
5271 cout <<
"MAKING XYMaps(t0)" << endl;
5273 XYMaps *xymapAr =
nullptr;
5277 cout <<
"MAKING XYMaps(oldt0)" << endl;
5279 XYMaps *oldt0Ar =
nullptr;
5281 oldt0Ar =
new XYMaps(
argv[2],
"oldt0",
true);
5283 cout <<
"MAKING XYMaps(t0-oldt0)" << endl;
5285 XYMaps *oldt01Ar =
nullptr;
5287 oldt01Ar =
new XYMaps(
argv[2],
"abs(t0-oldt0)",
true);
5289 cout <<
"MAKING XYMaps(tresMean)" << endl;
5291 XYMaps *oldt0111Ar =
nullptr;
5293 oldt0111Ar =
new XYMaps(
argv[2],
"abs(tresMean)",
true);
5295 cout <<
"MAKING XYMaps(tres)" << endl;
5297 XYMaps *oldt011Ar =
nullptr;
5299 oldt011Ar =
new XYMaps(
argv[2],
"(tres)",
true);
5304 if (datafile->FindKey(
"TRT_all"))
5306 cout <<
"MAKING ChipVariations" << endl;
5318 cout <<
"MAKING BoardVariationsOldT0" << endl;
5321 refboardgraphA->SetLineColor(2);
5322 refboardgraphC->SetLineColor(2);
5323 cout <<
"MAKING BoardVariationsDiff" << endl;
5328 cout <<
"MAKING BoardVariations" << endl;
5332 cout <<
"MAKING BoardVariationsRes" << endl;
5336 cout <<
"MAKING BoardVariationsTRes" << endl;
5340 cout <<
"MAKING BoardVariationsTRes1" << endl;
5345 RtGraphs *rtrelation_bar =
nullptr;
5355 if (datafile->FindKey(
"TRT_all"))
5357 cout <<
"MAKING RtGraphs" << endl;
5358 TDirectory *trt = (TDirectory *)datafile->FindKey(
"TRT_all")->ReadObj();
5360 if (trt->FindKey(
"WholeBarrel_1"))
5364 rtrelation_bar =
new RtGraphs(
argv[2],
"WholeBarrel_1");
5371 if (trt->FindKey(
"Detector_-1"))
5382 if (trt->FindKey(
"Detector_1"))
5393 if (trt->FindKey(
"Detector_-2"))
5404 if (trt->FindKey(
"Detector_2"))
5416 cout <<
"MAKING Rt binning" << endl;
5424 cout <<
"MAKING Rt binning for Detector_-2" << endl;
5425 rtbinning3 =
new RtBinning(trt,
"Detector_-2");
5426 cout <<
"MAKING Rt binning for Detector_2" << endl;
5427 rtbinning4 =
new RtBinning(trt,
"Detector_2");
5442 cout <<
"MAKING Binned Residual" << endl;
5452 cout <<
"MAKING Binned Residual for Detector_-2" << endl;
5453 binres3 =
new RresTbin(datafile,
"Detector_-2", -2);
5455 cout <<
"MAKING Binned Residual for Detector_2" << endl;
5456 binres4 =
new RresTbin(datafile,
"Detector_2", 2);
5466 cout <<
"MAKING RtColor" << endl;
5468 if (datafile->FindKey(
"TRT_all"))
5470 cout <<
" found TRT_all " << endl;
5475 TDirectory *trt = (TDirectory *)datafile->FindKey(
"TRT_all")->ReadObj();
5499 if (trt->FindKey(
"Detector_-2"))
5501 cout <<
" MAKING RtColor Detector_-2" << endl;
5512 if (trt->FindKey(
"Detector_2"))
5514 cout <<
" MAKING RtColor Detector_2" << endl;
5617 cout <<
"MAKING RT Binned Residual for Ar" << endl;
5619 TDirectory *trtAr = (TDirectory *)datafile->FindKey(
"TRT_Ar_all")->ReadObj();
5630 cout <<
"MAKING RT Binned Abs Residual for Ar" << endl;
5658 if (trtAr->FindKey(
"Detector_Ar_-1"))
5660 cout <<
" MAKING AR RtColor det -1" << endl;
5663 rtArcol2 =
new RtColor(
argv[2],
"Detector_Ar_-1",
true);
5670 if (trtAr->FindKey(
"Detector_Ar_1"))
5672 cout <<
" MAKING AR RtColor det 1" << endl;
5675 rtArcol3 =
new RtColor(
argv[2],
"Detector_Ar_1",
true);
5682 if (trtAr->FindKey(
"Detector_Ar_-2"))
5684 cout <<
" MAKING AR RtColor det -2" << endl;
5687 rtArcol4 =
new RtColor(
argv[2],
"Detector_Ar_-2",
true);
5694 if (trtAr->FindKey(
"Detector_Ar_2"))
5696 cout <<
" MAKING AR RtColor det 2" << endl;
5699 rtArcol5 =
new RtColor(
argv[2],
"Detector_Ar_2",
true);
5713 cout <<
"MAKING BoardVariationsOldT0 for Ar" << endl;
5716 cout <<
"MAKING BoardVariationsDiff Ar" << endl;
5719 boarddiffECgraphA->SetLineColor(2);
5720 boarddiffECgraphC->SetLineColor(2);
5723 cout <<
"MAKING BoardVariations Ar" << endl;
5727 cout <<
"MAKING BoardVariationsRes Ar" << endl;
5731 cout <<
"MAKING BoardVariationsTRes Ar" << endl;
5735 cout <<
"MAKING BoardVariationsTRes1" << endl;
5739 cout <<
" Start printing itersum.ps" << endl;
5743 TCanvas *
c1 =
new TCanvas();
5744 c1->Print(
"itersum.ps[");
5748 firstpage->Print(
"itersum.ps");
5751 settings->Print(
"itersum.ps");
5754 tracktupleinfo->Print(
"itersum.ps");
5757 hitstat->Print(
"itersum.ps");
5760 hitstatAr->Print(
"itersum.ps");
5763 gStyle->SetOptStat(0);
5765 resplots->Print(
"itersum.ps");
5768 resplotsAr->Print(
"itersum.ps");
5771 textpage =
new TextPage(
" BARREL PLOTS ");
5772 textpage->Print(
"itersum.ps");
5775 hitstatxy->Print(
"itersum.ps");
5778 hitstatxyAr->Print(
"itersum.ps");
5780 nhits->Print(
"itersum.ps");
5783 nhitsAr->Print(
"itersum.ps");
5785 resxy0->Print(
"itersum.ps");
5788 resxy0Ar->Print(
"itersum.ps");
5790 resxy->Print(
"itersum.ps");
5793 resxyAr->Print(
"itersum.ps");
5795 xymap->Print(
"itersum.ps");
5798 xymapAr->Print(
"itersum.ps");
5802 oldt0->Print(
"itersum.ps");
5805 oldt0Ar->Print(
"itersum.ps");
5808 oldt01->Print(
"itersum.ps");
5811 oldt01Ar->Print(
"itersum.ps");
5815 oldt0111->Print(
"itersum.ps");
5818 oldt0111Ar->Print(
"itersum.ps");
5821 oldt011->Print(
"itersum.ps");
5824 oldt011Ar->Print(
"itersum.ps");
5829 double lowe = -3.5, upe = 3.5;
5831 if (chipgraphA && chipgraphC)
5833 chipgraphA->GetYaxis()->SetRangeUser(lowe, upe);
5834 chipgraphC->GetYaxis()->SetRangeUser(lowe, upe);
5836 c1->Divide(1, 2, 0.01, 0.01);
5843 c1->Print(
"itersum.ps");
5848 c1->Divide(1, 2, 0.01, 0.01);
5850 boardgraphA->Draw(
"apl");
5853 refboardgraphA->Draw(
"pl");
5854 TLegend *
leg =
new TLegend(0.8, 0.8, 0.98, 0.95);
5855 leg->AddEntry(boardgraphA,
"data",
"l");
5857 leg->AddEntry(refboardgraphA,
"ref (input to 1st it)",
"l");
5858 leg->SetTextSize(0.03);
5861 boardgraphC->Draw(
"apl");
5864 refboardgraphC->Draw(
"pl");
5865 c1->Print(
"itersum.ps");
5872 c1->Divide(1, 2, 0.01, 0.01);
5874 boarddiffgraphA->Draw(
"ap");
5878 boarddiffgraphC->Draw(
"ap");
5881 c1->Print(
"itersum.ps");
5886 c1->Divide(1, 2, 0.01, 0.01);
5888 boardgraphA1->Draw(
"apl");
5891 boardgraphC1->Draw(
"apl");
5893 c1->Print(
"itersum.ps");
5897 c1->Divide(1, 2, 0.01, 0.01);
5899 boardgraphA2->Draw(
"apl");
5902 boardgraphC2->Draw(
"apl");
5904 c1->Print(
"itersum.ps");
5908 c1->Divide(1, 2, 0.01, 0.01);
5910 boardgraphA3->Draw(
"apl");
5913 boardgraphC3->Draw(
"apl");
5915 c1->Print(
"itersum.ps");
5921 textpage =
new TextPage(
"ENDCAP PLOTS");
5922 textpage->Print(
"itersum.ps");
5925 cout <<
"MAKING PLOTS FOR ENDCAPS" << endl;
5929 ntypeEC->Print(
"itersum.ps");
5934 ntypeECAr->Print(
"itersum.ps");
5939 nhitsEC->Print(
"itersum.ps");
5944 nhitsECAr->Print(
"itersum.ps");
5948 resxy0EC->Print(
"itersum.ps");
5953 resxy0ECAr->Print(
"itersum.ps");
5957 resxyM0EC->Print(
"itersum.ps");
5961 resxyM0ECAr =
new XYMapsEC(
argv[2],
"abs(resMean)",
true);
5962 resxyM0ECAr->Print(
"itersum.ps");
5967 xymapEC->Print(
"itersum.ps");
5972 xymapECAr->Print(
"itersum.ps");
5980 oldt0EC->Print(
"itersum.ps");
5987 oldt0ECAr->Print(
"itersum.ps");
5993 oldt01EC->Print(
"itersum.ps");
5997 oldt01ECAr =
new XYMapsEC(
argv[2],
"abs(t0-oldt0)",
true);
5998 oldt01ECAr->Print(
"itersum.ps");
6007 oldt0111EC->Print(
"itersum.ps");
6013 oldt0111ECAr =
new XYMapsEC(
argv[2],
"abs(tresMean)",
true);
6014 oldt0111ECAr->Print(
"itersum.ps");
6019 oldt011EC->Print(
"itersum.ps");
6024 oldt011ECAr->Print(
"itersum.ps");
6029 c1->Divide(1, 2, 0.01, 0.01);
6031 boardECgraphA->Draw(
"apl");
6033 if (refboardECgraphA)
6034 refboardECgraphA->Draw(
"pl");
6035 TLegend *legAr =
new TLegend(0.8, 0.8, 0.98, 0.95);
6036 legAr->AddEntry(boardECgraphA,
"data",
"l");
6037 if (refboardECgraphA)
6038 leg->AddEntry(refboardECgraphA,
"ref (input to 1st it)",
"l");
6039 legAr->SetTextSize(0.03);
6042 boardECgraphC->Draw(
"apl");
6044 if (refboardECgraphC)
6045 refboardECgraphC->Draw(
"pl");
6046 c1->Print(
"itersum.ps");
6053 c1->Divide(1, 2, 0.01, 0.01);
6055 boarddiffECgraphA->Draw(
"ap");
6058 boarddiffECgraphC->Draw(
"ap");
6061 c1->Print(
"itersum.ps");
6066 c1->Divide(1, 2, 0.01, 0.01);
6068 boardECgraphA1->Draw(
"apl");
6071 boardECgraphC1->Draw(
"apl");
6073 c1->Print(
"itersum.ps");
6077 c1->Divide(1, 2, 0.01, 0.01);
6079 boardECgraphA2->Draw(
"apl");
6082 boardECgraphC2->Draw(
"apl");
6084 c1->Print(
"itersum.ps");
6088 c1->Divide(1, 2, 0.01, 0.01);
6090 boardECgraphA3->Draw(
"apl");
6093 boardECgraphC3->Draw(
"apl");
6095 c1->Print(
"itersum.ps");
6100 textpage =
new TextPage(
" RT PLOTS ");
6101 textpage->Print(
"itersum.ps");
6104 gStyle->SetOptStat(1);
6105 gStyle->SetOptFit(0);
6108 rtrelation_bar->Print(
"itersum.ps");
6112 rtbinning_bar->Print(
"itersum.ps");
6116 rtrelation21->Print(
"itersum.ps");
6120 rtbinning1->Print(
"itersum.ps");
6124 rtrelation31->Print(
"itersum.ps");
6128 rtbinning2->Print(
"itersum.ps");
6132 rtrelation41->Print(
"itersum.ps");
6136 rtbinning3->Print(
"itersum.ps");
6140 rtrelation51->Print(
"itersum.ps");
6144 rtbinning4->Print(
"itersum.ps");
6149 binres_bar->Print(
"itersum.ps");
6153 tbinnedres_bar->Print(
"itersum.ps");
6157 binres1->Print(
"itersum.ps");
6161 tbinnedres1->Print(
"itersum.ps");
6165 binres2->Print(
"itersum.ps");
6169 tbinnedres2->Print(
"itersum.ps");
6172 binres3->Print(
"itersum.ps");
6176 tbinnedres3->Print(
"itersum.ps");
6179 binres4->Print(
"itersum.ps");
6183 tbinnedres4->Print(
"itersum.ps");
6186 gStyle->SetOptStat(0);
6189 rtcol->Print(
"itersum.ps");
6193 rtcol1->Print(
"itersum.ps");
6196 rtcol2->Print(
"itersum.ps");
6198 if (isAr && rtArcol2)
6199 rtArcol2->Print(
"itersum.ps");
6202 rtcol3->Print(
"itersum.ps");
6204 if (isAr && rtArcol3)
6205 rtArcol3->Print(
"itersum.ps");
6208 rtcol4->Print(
"itersum.ps");
6210 if (isAr && rtArcol4)
6211 rtArcol4->Print(
"itersum.ps");
6214 rtcol5->Print(
"itersum.ps");
6216 if (isAr && rtArcol5)
6217 rtArcol5->Print(
"itersum.ps");
6222 DGraph *dgraph0 =
nullptr;
6223 DGraph *dgraph1 =
nullptr;
6224 DGraph *dgraph2 =
nullptr;
6225 DGraph *dgraph3 =
nullptr;
6226 DGraph *dgraph4 =
nullptr;
6227 DGraph *dgraph5 =
nullptr;
6228 bool isinverted =
false;
6229 if (datafile->FindKey(
"TRT_all"))
6231 TDirectory *trt = (TDirectory *)datafile->FindKey(
"TRT_all")->ReadObj();
6232 cout <<
"MAKING DGraphs" << endl;
6235 dgraph0 =
new DGraph(
argv[2],
"-2,-1",
"", -2, -1, isinverted);
6236 if (trt->FindKey(
"WholeBarrel_1"))
6238 dgraph5 =
new DGraph(
argv[2],
"-2,-1",
"WholeBarrel_1", -1, -1, isinverted);
6242 cout <<
" did not find WholeBarrel_1" << endl;
6243 if (trt->FindKey(
"Detector_1"))
6244 dgraph1 =
new DGraph(
argv[2],
"-2,-1",
"Detector_1", 1, -1, isinverted);
6245 if (trt->FindKey(
"Detector_-1"))
6246 dgraph2 =
new DGraph(
argv[2],
"-2,-1",
"Detector_-1", 1, -1, isinverted);
6248 if (trt->FindKey(
"Detector_2"))
6249 dgraph3 =
new DGraph(
argv[2],
"-2,-1",
"Detector_2", 1, -1, isinverted);
6250 if (trt->FindKey(
"Detector_-2"))
6251 dgraph4 =
new DGraph(
argv[2],
"-2,-1",
"Detector_-2", 1, -1, isinverted);
6254 TLegend *
leg =
new TLegend(0.8, 0.8, 0.98, 0.95);
6255 if (dgraph0 !=
nullptr)
6257 dgraph0->GetXaxis()->SetRangeUser(-5, 45);
6258 cout <<
" found TRT_all" << endl;
6259 dgraph0->SetLineWidth(3);
6260 dgraph0->SetLineColor(1);
6261 dgraph0->SetTitle(
"r(t)");
6263 dgraph0->GetXaxis()->SetTitle(
"t/ns");
6265 dgraph0->GetYaxis()->SetTitle(
"R / (mm)");
6268 dgraph0->Draw(
"apl");
6270 leg->AddEntry(dgraph0,
"Whole TRT",
"l");
6272 if (dgraph1 !=
nullptr)
6274 cout <<
" found Detector_1" << endl;
6275 dgraph1->SetLineWidth(3);
6276 dgraph1->SetLineColor(3);
6278 dgraph1->Draw(
"pl");
6280 leg->AddEntry(dgraph1,
"Barrel C Side",
"l");
6283 if (dgraph2 !=
nullptr)
6285 cout <<
" found Detector_-1" << endl;
6286 dgraph2->SetLineWidth(3);
6287 dgraph2->SetLineColor(2);
6289 dgraph2->Draw(
"pl");
6291 leg->AddEntry(dgraph2,
"Barrel A Side",
"l");
6294 if (dgraph3 !=
nullptr)
6296 dgraph3->SetLineWidth(3);
6297 cout <<
" found Detector_2" << endl;
6298 dgraph3->SetLineColor(6);
6300 dgraph3->Draw(
"pl");
6302 leg->AddEntry(dgraph3,
"Endcap C side",
"l");
6305 if (dgraph4 !=
nullptr)
6307 cout <<
" found Detector_-2" << endl;
6308 dgraph4->SetLineWidth(3);
6309 dgraph4->SetLineColor(7);
6311 dgraph4->Draw(
"pl");
6313 leg->AddEntry(dgraph4,
"Endcap A side",
"l");
6315 if (dgraph5 !=
nullptr)
6317 cout <<
" found WholeBarrel_1" << endl;
6318 dgraph5->SetLineWidth(3);
6319 dgraph5->SetLineColor(8);
6321 dgraph5->Draw(
"pl");
6323 leg->AddEntry(dgraph5,
"Whole Barrel",
"l");
6326 leg->SetTextSize(0.03);
6328 c1->Print(
"itersum.ps");
6342 if (datafile->FindKey(
"TRT_all"))
6344 cout <<
" do_expert: found TRT_all" << endl;
6345 TDirectory *trt = (TDirectory *)datafile->FindKey(
"TRT_all")->ReadObj();
6346 cout <<
"MAKING DvGraphs" << endl;
6349 dvgraph0 =
new DvGraph(
argv[2],
"-2,-1",
"", -2, -1, isinverted);
6350 if (trt->FindKey(
"WholeBarrel_1"))
6351 dvgraph5 =
new DvGraph(
argv[2],
"-2,-1",
"WholeBarrel_1", -1, -1, isinverted);
6354 if (trt->FindKey(
"Detector_1"))
6355 dvgraph1 =
new DvGraph(
argv[2],
"-2,-1",
"Detector_1", 1, -1, isinverted);
6356 if (trt->FindKey(
"Detector_-1"))
6357 dvgraph2 =
new DvGraph(
argv[2],
"-2,-1",
"Detector_-1", 1, -1, isinverted);
6359 if (trt->FindKey(
"Detector_2"))
6360 dvgraph3 =
new DvGraph(
argv[2],
"-2,-1",
"Detector_2", 1, -1, isinverted);
6361 if (trt->FindKey(
"Detector_-2"))
6362 dvgraph4 =
new DvGraph(
argv[2],
"-2,-1",
"Detector_-2", 1, -1, isinverted);
6365 TLegend *
leg =
new TLegend(0.8, 0.8, 0.98, 0.95);
6366 if (dvgraph0 !=
nullptr)
6368 dvgraph0->GetXaxis()->SetRangeUser(0, 2);
6369 cout <<
" do_expert: found -2-1" << endl;
6370 dvgraph0->SetLineWidth(3);
6371 dvgraph0->SetLineColor(1);
6373 dvgraph0->SetTitle(
"dt/dr");
6375 dvgraph0->SetTitle(
"dr/dt");
6376 dvgraph0->GetXaxis()->SetTitle(
"r/mm");
6378 dvgraph0->GetYaxis()->SetTitle(
"dt/dr / (ns/mm)");
6380 dvgraph0->GetYaxis()->SetTitle(
"dr/dt / (mm/ns)");
6382 dvgraph0->Draw(
"apl");
6384 leg->AddEntry(dvgraph0,
"Whole TRT",
"l");
6386 if (dvgraph1 !=
nullptr)
6388 cout <<
" do_expert: found Detector_1" << endl;
6389 dvgraph1->SetLineWidth(3);
6390 dvgraph1->SetLineColor(3);
6392 dvgraph1->Draw(
"pl");
6394 leg->AddEntry(dvgraph1,
"Barrel C Side",
"l");
6397 if (dvgraph2 !=
nullptr)
6399 dvgraph2->SetLineWidth(3);
6400 dvgraph2->SetLineColor(2);
6402 dvgraph2->Draw(
"pl");
6404 leg->AddEntry(dvgraph2,
"Barrel A Side",
"l");
6407 if (dvgraph3 !=
nullptr)
6409 dvgraph3->SetLineWidth(3);
6410 dvgraph3->SetLineColor(6);
6412 dvgraph3->Draw(
"pl");
6414 leg->AddEntry(dvgraph3,
"Endcap C side",
"l");
6417 if (dvgraph4 !=
nullptr)
6419 dvgraph4->SetLineWidth(3);
6420 dvgraph4->SetLineColor(7);
6422 dvgraph4->Draw(
"pl");
6424 leg->AddEntry(dvgraph4,
"Endcap A side",
"l");
6426 if (dvgraph5 !=
nullptr)
6428 dvgraph5->SetLineWidth(3);
6429 dvgraph5->SetLineColor(8);
6431 dvgraph5->Draw(
"pl");
6433 leg->AddEntry(dvgraph5,
"Whole Barrel",
"l");
6436 leg->SetTextSize(0.03);
6438 c1->Print(
"itersum.ps");
6445 textpage =
new TextPage(
"Track plots: Only for Experts!!!");
6446 textpage->Print(
"itersum.ps");
6449 bool istracktuple =
false;
6450 TNtuple *Tracktuple =
nullptr;
6451 if (datafile->FindKey(
"tracktuple"))
6453 Tracktuple = (TNtuple *)datafile->Get(
"tracktuple");
6454 istracktuple =
true;
6457 cout <<
"MAKING TRACK PLOTS" << endl;
6462 if (Tracktuple->GetListOfBranches()->FindObject(
"trackres"))
6465 c1->Divide(2, 1, 0.01, 0.01);
6467 Tracktuple->Draw(
"trackres>>histRes(100,0,1.5)");
6468 TH1F *histRes = (
TH1F *)gPad->GetPrimitive(
"histRes");
6469 histRes->SetTitle(
"Residual on track");
6470 histRes->GetXaxis()->SetTitle(
"Residual (mm)");
6474 Tracktuple->Draw(
"trackres:t-ttrack-t0>>histRes2d(100,-12,12,100,0,1)",
"",
"colz");
6475 TH2F *histRes2d = (
TH2F *)gPad->GetPrimitive(
"histRes2d");
6476 histRes2d->SetTitle(
"Track time residual VS track residual");
6477 histRes2d->GetXaxis()->SetTitle(
"Time residual (ns)");
6478 histRes2d->GetYaxis()->SetTitle(
"Track Residual (mm)");
6479 histRes2d->Draw(
"colz");
6480 TProfile *res2d = histRes2d->ProfileX();
6481 res2d->Draw(
"same");
6483 c1->Print(
"itersum.ps");
6488 if (Tracktuple->GetListOfBranches()->FindObject(
"pt"))
6491 c1->Divide(2, 1, 0.01, 0.01);
6493 Tracktuple->Draw(
"pt/1000>>histPt(100,0,20)");
6494 TH1F *histPt = (
TH1F *)gPad->GetPrimitive(
"histPt");
6495 histPt->SetTitle(
"Transverse momentum on track");
6496 histPt->GetXaxis()->SetTitle(
"Pt (GeV)");
6500 Tracktuple->Draw(
"trackres:pt/1000>>histPt2d(100,0,20,100,0,1.5)",
"",
"colz");
6501 TH2F *histPt2d = (
TH2F *)gPad->GetPrimitive(
"histPt2d");
6502 histPt2d->SetTitle(
"Transverse momentum on track VS track residual");
6503 histPt2d->GetXaxis()->SetTitle(
"Pt (GeV)");
6504 histPt2d->GetYaxis()->SetTitle(
"Track Residual (mm)");
6505 histPt2d->Draw(
"COLZ");
6506 TProfile *pt2d = histPt2d->ProfileX();
6508 c1->Print(
"itersum.ps");
6512 if (Tracktuple->GetListOfBranches()->FindObject(
"theta"))
6515 c1->Divide(2, 1, 0.01, 0.01);
6517 Tracktuple->Draw(
"theta>>histTheta(100,0,4)");
6518 TH1F *histTheta = (
TH1F *)gPad->GetPrimitive(
"histTheta");
6519 histTheta->SetTitle(
"Theta distribution on track");
6520 histTheta->GetXaxis()->SetTitle(
"Theta (rad)");
6524 Tracktuple->Draw(
"trackres:theta>>histTheta2d(100,0,4,100,0,1.5)",
"",
"colz");
6525 TH2F *histTheta2d = (
TH2F *)gPad->GetPrimitive(
"histTheta2d");
6526 histTheta2d->SetTitle(
"Theta distrib. on track VS track residual");
6527 histTheta2d->GetXaxis()->SetTitle(
"Theta (rad)");
6528 histTheta2d->GetYaxis()->SetTitle(
"Track Residual (mm)");
6529 histTheta2d->Draw(
"COLZ");
6530 TProfile *theta2d = histTheta2d->ProfileX();
6531 theta2d->Draw(
"same");
6532 c1->Print(
"itersum.ps");
6536 if (Tracktuple->GetListOfBranches()->FindObject(
"phi"))
6539 c1->Divide(2, 1, 0.01, 0.01);
6541 Tracktuple->Draw(
"phi>>histPhi(100,-3.5,0)");
6542 TH1F *histPhi = (
TH1F *)gPad->GetPrimitive(
"histPhi");
6543 histPhi->SetTitle(
"Phi distribution on track");
6544 histPhi->GetXaxis()->SetTitle(
"Phi (rad)");
6548 Tracktuple->Draw(
"trackres:phi>>histPhi2d(100,-3.5,0,100,0,1.5)",
"",
"colz");
6549 TH2F *histPhi2d = (
TH2F *)gPad->GetPrimitive(
"histPhi2d");
6550 histPhi2d->SetTitle(
"Phi distrib. on track VS track residual");
6551 histPhi2d->GetXaxis()->SetTitle(
"Phi (rad)");
6552 histPhi2d->GetYaxis()->SetTitle(
"Track Residual (mm)");
6553 histPhi2d->Draw(
"COLZ");
6554 TProfile *phi2d = histPhi2d->ProfileX();
6555 phi2d->Draw(
"same");
6556 c1->Print(
"itersum.ps");
6560 if (Tracktuple->GetListOfBranches()->FindObject(
"d0"))
6563 c1->Divide(2, 1, 0.01, 0.01);
6565 Tracktuple->Draw(
"d0>>histD0(100,-5,5)");
6566 TH1F *histD0 = (
TH1F *)gPad->GetPrimitive(
"histD0");
6567 histD0->SetTitle(
"D0 distribution on track");
6568 histD0->GetXaxis()->SetTitle(
"D0 (mm)");
6572 Tracktuple->Draw(
"trackres:d0>>histD02d(100,-5,5,100,0,1.5)",
"",
"colz");
6573 TH2F *histD02d = (
TH2F *)gPad->GetPrimitive(
"histD02d");
6574 histD02d->SetTitle(
"D0 distrib. on track VS track residual");
6575 histD02d->GetXaxis()->SetTitle(
"D0 (rad)");
6576 histD02d->GetYaxis()->SetTitle(
"Track Residual (mm)");
6577 histD02d->Draw(
"COLZ");
6578 TProfile *d02d = histD02d->ProfileX();
6580 c1->Print(
"itersum.ps");
6588 cout <<
" Skipping plots for Pulls and Errors " << endl;
6629 cout <<
" Skipping plots for ToT and HT " << endl;
6642 textpage =
new TextPage(
" ToT Corrections and HT corrections: ");
6643 textpage->Print(
"itersum.pdf");
6646 cout <<
"Making ToT / HT Plots" << endl;
6752 refdatafile->Close();
6778 if (settings && firstpage)
6780 string fixfloat, fieldonoff;
6781 if (settings->
set[
"UsePol0"].find(
"True") != string::npos)
6782 fixfloat =
" - floating";
6784 fixfloat =
" - fixed";
6785 if (settings->
set[
"RtRelation"].find(
"binned") != string::npos)
6787 if (settings->
set[
"Solenoid"].find(
"True") != string::npos)
6793 string(
"/Helvetica-Bold findfont 36 scalefont setfont 40 2190 moveto (Run:) show ") +
6794 string(Form(
"/Helvetica findfont 36 scalefont setfont 240 2190 moveto (%i) show ", (
int)firstpage->
runnumber)) +
6796 string(
"/Helvetica-Bold findfont 36 scalefont setfont 40 2150 moveto (Iteration:) show ") +
6797 string(Form(
"/Helvetica findfont 36 scalefont setfont 240 2150 moveto (%02i) show ", firstpage->
iter)) +
6799 string(
"/Helvetica-Bold findfont 36 scalefont setfont 40 2110 moveto (Rt relation:) show ") +
6800 string(Form(
"/Helvetica findfont 36 scalefont setfont 240 2110 moveto (%s%s) show ", settings->
set[
"RtRelation"].data(), fixfloat.data())) +
6802 string(
"/Helvetica-Bold findfont 36 scalefont setfont 540 2190 moveto (Rt binning:) show ") +
6803 string(Form(
"/Helvetica findfont 36 scalefont setfont 740 2190 moveto (%s) show ", settings->
set[
"RtBinning"].data())) +
6805 string(
"/Helvetica-Bold findfont 36 scalefont setfont 540 2150 moveto (Rt level:) show ") +
6807 string(
"/Helvetica-Bold findfont 36 scalefont setfont 540 2110 moveto (T0 level:) show ") +
6809 string(
"/Helvetica-Bold findfont 36 scalefont setfont 1040 2190 moveto (Solenoid:) show ") +
6810 string(Form(
"/Helvetica findfont 36 scalefont setfont 1260 2190 moveto (%s) show ", fieldonoff.data())) +
6812 string(
"/Helvetica-Bold findfont 36 scalefont setfont 1040 2150 moveto (SW release:) show ") +
6813 string(Form(
"/Helvetica findfont 36 scalefont setfont 1260 2150 moveto (%s) show ", settings->
set[
"ReleaseRec"].data())) +
6815 string(
"/Helvetica-Bold findfont 36 scalefont setfont 1040 2110 moveto (T0 Offset:) show ") +
6816 string(Form(
"/Helvetica findfont 36 scalefont setfont 1260 2110 moveto (%s) show ", settings->
set[
"T0Offset"].data())) +
6818 string(
"/Helvetica-Bold findfont 30 scalefont setfont 40 2060 moveto (Data:) show ") +
6819 string(Form(
"/Helvetica findfont 30 scalefont setfont 240 2060 moveto (%s) show ", settings->
set[
"Inputdir"].data())) +
6821 string(
"/Helvetica-Bold findfont 30 scalefont setfont 40 2020 moveto (Start const:) show ") +
6822 string(Form(
"/Helvetica findfont 30 scalefont setfont 240 2020 moveto (%s) show ", settings->
set[
"StartConst"].data()));
6823 system((
string(
"sed -i 's?showpage?" + pmarking +
"showpage?g' itersum.ps")).
data());
6827 datafile =
new TFile(
argv[2],
"UPDATE");
6829 if (datafile->FindKey(
"analysis"))
6830 datafile->rmdir(
"analysis");
6831 TDirectory *adir = datafile->mkdir(
"analysis",
"analysis");
6834 chipgraphA->Write();
6836 chipgraphC->Write();
6837 boardgraphA->Write();
6838 boardgraphC->Write();
6840 refboardgraphA->Write();
6842 refboardgraphC->Write();
6858 TFile *itersumfile =
new TFile(
argv[2],
"UPDATE");
6859 if (itersumfile->FindKey(
"tracktuple"))
6861 itersumfile->Delete(
"tracktuple;*");
6863 if (itersumfile->FindKey(
"binhist"))
6865 itersumfile->rmdir(
"binhist");
6867 if (itersumfile->FindKey(
"analysis"))
6869 itersumfile->rmdir(
"analysis");
6872 itersumfile->Write();
6873 itersumfile->Close();
6883 if ((
string(
argv[1])).
find(
"itersum") != std::string::npos)
6885 cout <<
"GENERATING ITERATION SUMMARY PLOTS" << endl;
6889 if ((
string(
argv[1])).
find(
"restore") != std::string::npos)
6891 cout <<
"REMOVING THE TRACKTUPLE, BINHIST AND ANALYSE DIRECTORY" << endl;