24 #include <eicqa_modules/EvalRootTTree.h>
25 #include <eicqa_modules/EvalHit.h>
33 TFile *f1 =
new TFile(
"merged_Eval_" + detector +
".root",
"READ");
35 TTree*
T1 = (TTree*)f1->Get(
"T");
38 gStyle->SetCanvasPreferGL(kTRUE);
39 TCanvas *
c =
new TCanvas();
44 gStyle->SetOptTitle(0);
45 gStyle->SetOptFit(102);
46 gStyle->SetTitleXOffset(1);
47 gStyle->SetTitleYOffset(1);
48 gStyle->SetLabelSize(0.05);
49 gStyle->SetTitleXSize(0.05);
50 gStyle->SetTitleYSize(0.05);
52 long double total_te = 0;
53 long double total_te_CircularCut = 0;
54 long double total_ge = 0;
58 Double_t eta_min, eta_max;
59 Double_t x_radius, y_radius;
60 Double_t fit_min, fit_max;
61 Double_t ttheta_gtheta_min, ttheta_gtheta_max;
62 Double_t towerCounts_max, towerCounts_CircularCut_max;
63 Double_t sigma_min, sigma_max;
64 Double_t mean_min, mean_max;
65 Double_t chi2_min, chi2_max;
66 Double_t recalibration_firstSlice;
67 Double_t te_minus_ge_by_ge_ge_min, te_minus_ge_by_ge_ge_max;
68 TString fitting_function;
69 TString cut_text, eRes, eRes1;
71 if (detector ==
"FEMC"){
84 ttheta_gtheta_min = 0;
85 ttheta_gtheta_max = 0.6;
86 towerCounts_max = 400;
87 towerCounts_CircularCut_max = 200;
88 te_minus_ge_by_ge_ge_min = -0.99;
89 te_minus_ge_by_ge_ge_max = 1;
90 recalibration_firstSlice = 0.8200;
91 fitting_function =
"gaus";
92 cut_text =
" {1.3 < true_eta < 3.3} ";
93 eRes =
"0.02 + 0.08/sqrt(x) + 0.02/x";
94 eRes1 =
"0.02 + 0.08/#sqrt{ge} + 0.02/ge";
99 std::cout<<
"FEMC eta cut & circular cut applied"<<
"\n\n";
103 else if(detector ==
"EEMC"){
116 ttheta_gtheta_min = 2.7;
117 ttheta_gtheta_max = 3.1;
118 towerCounts_max = 400;
119 towerCounts_CircularCut_max = 200;
120 te_minus_ge_by_ge_ge_min = -0.58;
121 te_minus_ge_by_ge_ge_max = 0.45;
122 recalibration_firstSlice = 0.75;
123 fitting_function =
"gaus";
124 cut_text =
" {-3.5 < true_eta < -1.7} ";
125 eRes =
"0.01 + 0.025/sqrt(x) + 0.01/x";
126 eRes1 =
"0.01 + 0.025/#sqrt{ge} + 0.01/ge";
131 std::cout<<
"EEMC eta cut & circular cut applied"<<
"\n\n";
135 else if(detector ==
"CEMC"){
148 ttheta_gtheta_min = 0.45;
149 ttheta_gtheta_max = 2.6;
150 towerCounts_max = 400;
151 towerCounts_CircularCut_max = 200;
152 te_minus_ge_by_ge_ge_min = -0.99;
153 te_minus_ge_by_ge_ge_max = 1;
154 recalibration_firstSlice = 0.96;
155 fitting_function =
"gaus";
156 cut_text =
" {-1.5 < true_eta < 1.2} ";
157 eRes =
"0.025 + 0.13/sqrt(x) + 0.02/x";
158 eRes1 =
"0.025 + 0.13/#sqrt{ge} + 0.02/ge";
163 std::cout<<
"CEMC eta cut & circular cut applied"<<
"\n\n";
167 else if(detector ==
"FHCAL"){
180 ttheta_gtheta_min = 0;
181 ttheta_gtheta_max = 0.6;
182 towerCounts_max = 400;
183 towerCounts_CircularCut_max = 200;
184 te_minus_ge_by_ge_ge_min = -0.99;
185 te_minus_ge_by_ge_ge_max = 1;
186 recalibration_firstSlice = 1.414;
187 fitting_function =
"gaus";
188 cut_text =
" {1.2 < true_eta < 3.5} ";
195 std::cout<<
"FHCAL eta cut & circular cut applied"<<
"\n\n";
199 else if(detector ==
"HCALIN"){
212 ttheta_gtheta_min = 0;
213 ttheta_gtheta_max = 0.6;
214 towerCounts_max = 400;
215 towerCounts_CircularCut_max = 200;
216 te_minus_ge_by_ge_ge_min = -0.99;
217 te_minus_ge_by_ge_ge_max = 1;
218 recalibration_firstSlice = 1.414;
219 fitting_function =
"gaus";
220 cut_text =
" {-1.1 < true_eta < 1.1} ";
227 std::cout<<
"HCALIN eta cut & circular cut applied"<<
"\n\n";
231 else if(detector ==
"HCALOUT"){
244 ttheta_gtheta_min = 0;
245 ttheta_gtheta_max = 0.6;
246 towerCounts_max = 400;
247 towerCounts_CircularCut_max = 200;
248 te_minus_ge_by_ge_ge_min = -0.99;
249 te_minus_ge_by_ge_ge_max = 1;
250 recalibration_firstSlice = 1.414;
251 fitting_function =
"gaus";
252 cut_text =
" {-1.1 < true_eta < 1.1} ";
259 std::cout<<
"HCALOUT eta cut & circular cut applied"<<
"\n\n";
264 std::cout<<
"Please try again.";
270 TH2D *te_minus_ge_by_ge_ge_EtaCut =
new TH2D(
"te_minus_ge_by_ge_ge_EtaCut",
"#frac{#Delta e_{agg}}{truth e} vs truth e",200,0,30,200,-1.5,1);
271 TH2D *te_minus_ge_by_ge_ge_EtaCut_CircularCut =
new TH2D(
"te_minus_ge_by_ge_ge_EtaCut_CircularCut",
"#frac{#Delta e_{agg}}{truth e} vs truth e",200,0,30,200,-1.5,2);
272 TH2D *te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated =
new TH2D(
"te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated",
"#frac{#Delta e_{agg}}{truth e} vs truth e",200,0,30,200,-1.5,1);
273 TH2D *te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated_temp =
new TH2D(
"te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated_temp",
"#frac{#Delta e_{agg}}{truth e} vs truth e",nSlicesx,0,30,nSlicesy,te_minus_ge_by_ge_ge_min,te_minus_ge_by_ge_ge_max);
274 TH2D *te_aggregate_by_geta =
new TH2D(
"te_aggregate_by_geta",
"",200,-4,4,200,0,30);
275 TH2D *te_aggregate_by_ge =
new TH2D(
"te_aggregate_by_ge",
"",200,0,30,200,0,30);
277 TH2D *te_by_ge_ge_EtaCut =
new TH2D(
"te_by_ge_ge_EtaCut",
"te_{agg}/ge vs ge",200,0,30,200,-0.5,3.5);
278 TH2D *te_by_ge_ge_EtaCut_CircularCut =
new TH2D(
"te_by_ge_ge_EtaCut_CircularCut",
"te_{agg}/ge vs ge",200,0,30,200,-0.5,3.5);
279 auto *mean_te_by_ge_ge_EtaCut_CircularCut =
new TProfile(
"mean_te_by_ge_ge_EtaCut_CircularCut",
"Mean_{te/ge}",nSlicesx,0,30,-0.5,3.5);
281 TH2D *tphi_gphi_EtaCut =
new TH2D(
"tphi_gphi_EtaCut",
"tphi vs gphi",200,-4,4,200,-4,4);
282 TH2D *tphi_gphi_EtaCut_CircularCut =
new TH2D(
"tphi_gphi_EtaCut_CircularCut",
"tphi vs gphi",200,-4,4,200,-4,4);
284 TH2D *ttheta_gtheta_EtaCut =
new TH2D(
"ttheta_gtheta_EtaCut",
"ttheta vs gtheta",200,ttheta_gtheta_min,ttheta_gtheta_max,200,ttheta_gtheta_min,ttheta_gtheta_max);
285 TH2D *ttheta_gtheta_EtaCut_CircularCut =
new TH2D(
"ttheta_gtheta_EtaCut_CircularCut",
"ttheta vs gtheta",200,ttheta_gtheta_min,ttheta_gtheta_max,200,ttheta_gtheta_min,ttheta_gtheta_max);
287 TH1D *counts_towerCounts_EtaCut =
new TH1D(
"counts_towerCounts_EtaCut",
"n_towers",200,-1,towerCounts_max);
288 TH1D *counts_towerCounts_EtaCut_CircularCut =
new TH1D(
"counts_towerCounts_EtaCut_CircularCut",
"n_towers",200,-1,towerCounts_CircularCut_max);
290 TH1D *te_aggregate_EtaCut_CircularCut =
new TH1D(
"te_aggregate_EtaCut_CircularCut",
"",200,0, 30);
291 TH1D *hist_geta =
new TH1D(
"hist_geta",
"",200,-4,4);
293 TH2D *dphi_dtheta_EtaCut =
new TH2D(
"dphi_dtheta_EtaCut",
"dphi vs dtheta",200,-1,1,200,-1,1);
294 auto *mean_te_geta_EtaCut =
new TProfile(
"mean_te_geta_EtaCut",
"te vs geta",200,-4,4,0,5);
296 Double_t theta_min = 0;
297 if (detector ==
"EEMC"){
301 auto *mean_te_gtheta_EtaCut =
new TProfile(
"mean_te_gtheta_EtaCut",
"te vs gtheta",200,theta_min,
M_PI,0,5);
303 T1->SetBranchAddress(
"DST#EvalTTree_" + detector,&evaltree1);
305 for(
int i=0; i<T1->GetEntries(); i++){
310 std::cout<<
"\n\n\n------------------------------------------\nParticle: "<<i<<
"\n\n";
311 std::cout<<
"Initial Parameters "<<
"\n";
314 Double_t geta1 = evaltree1->
get_geta();
316 std::cout<<
"geta: "<<geta1<<
"\n";
319 if(geta1>=eta_min && geta1<=eta_max){
322 cout<<
"\ngeta cut applied (1.3, 3.3)"<<
"\n\n";
325 Double_t ge = evaltree1->
get_ge();
327 std::cout<<
"ge: "<<ge<<
"\n";
330 Double_t gphi = evaltree1->
get_gphi();
332 std::cout<<
"gphi: "<<gphi<<
"\n";
337 std::cout<<
"gtheta: "<<gtheta<<
"\n";
342 std::cout<<
"total_ge till now = "<<total_ge<<
"\n";
346 int twr_count_CircularCut = 0;
347 Double_t te_aggregate = 0;
348 Double_t te_aggregate_CircularCut = 0;
353 std::cout<<
"\n"<<detector<<
" Tower: "<<j<<
"\n";
360 cout<<
"non-empty "<<detector<<
" tower\n";
364 std::cout<<
"tphi: "<<tphi<<
"\n";
368 std::cout<<
"ttheta: "<<ttheta<<
"\n";
370 Double_t dphi = tphi - gphi;
372 std::cout<<
"tphi-gphi: "<<dphi<<
"\n";
374 Double_t dtheta = ttheta - gtheta;
376 std::cout<<
"ttheta-gtheta: "<<dtheta<<
"\n";
378 Double_t te = twr1->
get_te();
380 std::cout<<
"te: "<<te<<
"\n";
386 dphi_dtheta_EtaCut->Fill(dtheta, dphi);
387 tphi_gphi_EtaCut->Fill(gphi, tphi, te);
388 ttheta_gtheta_EtaCut->Fill(gtheta, ttheta, te);
391 std::cout<<
"pow(dphi/y_radius,2)+pow(dtheta/x_radius,2): "<<pow(dphi/y_radius,2)+pow(dtheta/x_radius,2)<<
"\n";
394 if (pow(dphi/y_radius,2)+pow(dtheta/x_radius,2)<=1){
396 cout<<
"Tower included after circular cut\n";
398 twr_count_CircularCut += 1;
399 te_aggregate_CircularCut += te;
400 tphi_gphi_EtaCut_CircularCut->Fill(gphi, tphi, te);
401 ttheta_gtheta_EtaCut_CircularCut->Fill(gtheta, ttheta, te);
405 cout<<
"te_aggregate till now = "<<te_aggregate<<
"\n";
406 cout<<
"te_aggregate_CircularCut till now = "<<te_aggregate_CircularCut<<
"\n";
407 std::cout<<
"te += "<<twr1->
get_te()<<
"\n";
413 total_te += te_aggregate;
414 total_te_CircularCut += te_aggregate_CircularCut;
416 cout<<
"total_te till now = "<<total_te<<
"\n";
417 cout<<
"total_te_CircularCut till now = "<<total_te_CircularCut<<
"\n\n";
420 if(te_aggregate_CircularCut > energyCutAggregate){
422 te_aggregate_EtaCut_CircularCut->Fill(te_aggregate_CircularCut);
423 te_aggregate_by_ge->Fill(ge, te_aggregate_CircularCut);
424 te_aggregate_by_geta->Fill(geta1, te_aggregate_CircularCut);
425 hist_geta->Fill(geta1, te_aggregate_CircularCut);
426 te_minus_ge_by_ge_ge_EtaCut->Fill(ge, (te_aggregate-ge)/ge);
428 cout<<
"(ge, (te_aggregate-ge)/ge): ("<<ge<<
", "<<(te_aggregate-ge)/ge<<
")\n";
430 te_minus_ge_by_ge_ge_EtaCut_CircularCut->Fill(ge, (te_aggregate_CircularCut-ge)/ge);
432 cout<<
"(ge, (te_aggregate_CircularCut-ge)/ge): ("<<ge<<
", "<<(te_aggregate_CircularCut-ge)/ge<<
")\n";
435 te_by_ge_ge_EtaCut->Fill(ge, te_aggregate/ge);
437 cout<<
"(ge, te_aggregate/ge): ("<<ge<<
", "<<te_aggregate/ge<<
")\n";
440 te_by_ge_ge_EtaCut_CircularCut->Fill(ge, te_aggregate_CircularCut/ge);
441 mean_te_by_ge_ge_EtaCut_CircularCut->Fill(ge, te_aggregate_CircularCut/ge);
444 cout<<
"(ge, te_aggregate_CircularCut/ge): ("<<ge<<
", "<<te_aggregate_CircularCut/ge<<
")\n";
447 counts_towerCounts_EtaCut->Fill(twr_count);
448 mean_te_geta_EtaCut->Fill(geta1, te_aggregate_CircularCut);
449 mean_te_gtheta_EtaCut->Fill(gtheta, te_aggregate_CircularCut);
451 cout<<
"(twr_count): ("<<twr_count<<
")\n";
454 counts_towerCounts_EtaCut_CircularCut->Fill(twr_count_CircularCut);
456 cout<<
"(twr_count_CircularCut): ("<<twr_count_CircularCut<<
")\n";
463 cout<<
"\neta cut if ends"<<
"\n";
467 TString arr[nSlicesx];
468 for(
int sno = 0; sno < nSlicesx; sno++){
469 arr[sno] = TString::Itoa(sno + 1, 10);
473 std::cout<<
"\nGenerating sigma_e vs ge plots\n\n";
477 Double_t recalibrationArr[nSlicesx];
479 recalibrationArr[0] = recalibration_firstSlice;
480 cout <<
"Recalibration factor for slice " << 1 <<
" is: " << recalibrationArr[0] << endl;
482 for(
int binIter = 2; binIter <= nSlicesx; binIter++){
483 recalibrationArr[binIter-1] = mean_te_by_ge_ge_EtaCut_CircularCut->GetBinContent(binIter);
484 cout <<
"Recalibration factor for slice " << binIter <<
" is: " << recalibrationArr[binIter-1] << endl;
487 for(
int i=0; i<T1->GetEntries(); i++){
491 Double_t geta1 = evaltree1->
get_geta();
492 Double_t gphi = evaltree1->
get_gphi();
494 Double_t ge = evaltree1->
get_ge();
495 Double_t te_aggregate_CircularCut = 0;
497 if(geta1>=eta_min && geta1<=eta_max){
507 Double_t dphi = tphi - gphi;
508 Double_t dtheta = ttheta - gtheta;
509 Double_t te = twr1->
get_te();
514 std::cout<<
"pow(dphi/y_radius,2)+pow(dtheta/x_radius,2): "<<pow(dphi/y_radius,2)+pow(dtheta/x_radius,2)<<
"\n";
517 if (pow(dphi/y_radius,2)+pow(dtheta/x_radius,2)<=1){
518 te_aggregate_CircularCut += te;
524 if(te_aggregate_CircularCut > energyCutAggregate){
525 int recalibration_factor = ceil((ge/30.0)*(Double_t)nSlicesx)- 1;
526 te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated->Fill(ge, ((te_aggregate_CircularCut/recalibrationArr[recalibration_factor])-ge)/ge);
527 te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated_temp->Fill(ge, ((te_aggregate_CircularCut/recalibrationArr[recalibration_factor])-ge)/ge);
529 cout<<
"(ge, ((te_aggregate_CircularCut/recalibration_factor)-ge)/ge: ("<<ge<<
", "<<((te_aggregate_CircularCut/recalibrationArr[recalibration_factor])-ge)/ge<<
")\n";
537 TF1 *fit =
new TF1(
"fit",fitting_function);
538 TF1 *fit1 =
new TF1(
"fit1",fitting_function,fit_min,fit_max);
539 TEllipse *el1 =
new TEllipse(0,0,x_radius,y_radius);
540 TF1 *fExp =
new TF1(
"fExp",eRes,0,30);
541 TF1 *fTrue =
new TF1(
"fTrue",
"[0] + [1]/sqrt(x) + [2]/x",0,30);
543 te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated_temp->FitSlicesY(0, 0, -1, 0,
"QN");
544 TH2D *te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated_temp_2 = (TH2D*)gDirectory->Get(
"te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated_temp_2");
545 TH2D *te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated_temp_1 = (TH2D*)gDirectory->Get(
"te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated_temp_1");
546 TH2D *te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated_temp_chi2 = (TH2D*)gDirectory->Get(
"te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated_temp_chi2");
551 TH1D* slices[nSlicesx];
553 for(
int sno = 0; sno < nSlicesx; sno++){
555 TString sname =
"slice " + arr[sno];
556 slices[sno] = te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated_temp->ProjectionY(sname, plusOne, plusOne);
560 std::cout<<
"\nHistogram Formatting\n\n";
563 counts_towerCounts_EtaCut->GetXaxis()->SetTitle(
"Number of Towers");
564 counts_towerCounts_EtaCut->GetXaxis()->SetLabelSize(0.045);
565 counts_towerCounts_EtaCut->GetXaxis()->SetTitleSize(0.045);
566 counts_towerCounts_EtaCut->GetYaxis()->SetTitle(
"Counts");
567 counts_towerCounts_EtaCut->GetYaxis()->SetLabelSize(0.045);
568 counts_towerCounts_EtaCut->GetYaxis()->SetTitleSize(0.045);
570 counts_towerCounts_EtaCut_CircularCut->GetXaxis()->SetTitle(
"Number of Towers");
571 counts_towerCounts_EtaCut_CircularCut->GetXaxis()->SetLabelSize(0.045);
572 counts_towerCounts_EtaCut_CircularCut->GetXaxis()->SetTitleSize(0.045);
573 counts_towerCounts_EtaCut_CircularCut->GetYaxis()->SetTitle(
"Counts");
574 counts_towerCounts_EtaCut_CircularCut->GetYaxis()->SetLabelSize(0.045);
575 counts_towerCounts_EtaCut_CircularCut->GetYaxis()->SetTitleSize(0.045);
577 mean_te_geta_EtaCut->GetXaxis()->SetTitle(
"geta");
578 mean_te_geta_EtaCut->GetXaxis()->SetLabelSize(0.045);
579 mean_te_geta_EtaCut->GetXaxis()->SetTitleSize(0.045);
580 mean_te_geta_EtaCut->GetYaxis()->SetTitle(
"te_{agg}");
581 mean_te_geta_EtaCut->GetYaxis()->SetLabelSize(0.045);
582 mean_te_geta_EtaCut->GetYaxis()->SetTitleSize(0.045);
584 mean_te_gtheta_EtaCut->GetXaxis()->SetTitle(
"gtheta");
585 mean_te_gtheta_EtaCut->GetXaxis()->SetLabelSize(0.045);
586 mean_te_gtheta_EtaCut->GetXaxis()->SetTitleSize(0.045);
587 mean_te_gtheta_EtaCut->GetYaxis()->SetTitle(
"te_{agg}");
588 mean_te_gtheta_EtaCut->GetYaxis()->SetLabelSize(0.045);
589 mean_te_gtheta_EtaCut->GetYaxis()->SetTitleSize(0.045);
591 te_minus_ge_by_ge_ge_EtaCut->GetXaxis()->SetTitle(
"Generated Energy (GeV)");
592 te_minus_ge_by_ge_ge_EtaCut->GetXaxis()->SetLabelSize(0.05);
593 te_minus_ge_by_ge_ge_EtaCut->GetXaxis()->SetTitleSize(0.05);
594 te_minus_ge_by_ge_ge_EtaCut->GetYaxis()->SetTitle(
"(te_{agg}-ge)/ge");
595 te_minus_ge_by_ge_ge_EtaCut->GetYaxis()->SetLabelSize(0.05);
596 te_minus_ge_by_ge_ge_EtaCut->GetYaxis()->SetTitleSize(0.05);
598 te_aggregate_by_ge->GetXaxis()->SetTitle(
"Generated Energy (GeV)");
599 te_aggregate_by_ge->GetXaxis()->SetLabelSize(0.05);
600 te_aggregate_by_ge->GetXaxis()->SetTitleSize(0.05);
601 te_aggregate_by_ge->GetYaxis()->SetTitle(
"te_{agg} (GeV)");
602 te_aggregate_by_ge->GetYaxis()->SetLabelSize(0.05);
603 te_aggregate_by_ge->GetYaxis()->SetTitleSize(0.05);
605 te_aggregate_by_geta->GetXaxis()->SetTitle(
"Generated #eta");
606 te_aggregate_by_geta->GetXaxis()->SetLabelSize(0.05);
607 te_aggregate_by_geta->GetXaxis()->SetTitleSize(0.05);
608 te_aggregate_by_geta->GetYaxis()->SetTitle(
"te_{agg} (GeV)");
609 te_aggregate_by_geta->GetYaxis()->SetLabelSize(0.05);
610 te_aggregate_by_geta->GetYaxis()->SetTitleSize(0.05);
612 te_minus_ge_by_ge_ge_EtaCut_CircularCut->GetXaxis()->SetTitle(
"Generated Energy (GeV)");
613 te_minus_ge_by_ge_ge_EtaCut_CircularCut->GetXaxis()->SetLabelSize(0.05);
614 te_minus_ge_by_ge_ge_EtaCut_CircularCut->GetXaxis()->SetTitleSize(0.05);
615 te_minus_ge_by_ge_ge_EtaCut_CircularCut->GetYaxis()->SetTitle(
"(te_{agg}-ge)/ge");
616 te_minus_ge_by_ge_ge_EtaCut_CircularCut->GetYaxis()->SetLabelSize(0.05);
617 te_minus_ge_by_ge_ge_EtaCut_CircularCut->GetYaxis()->SetTitleSize(0.05);
619 te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated->GetXaxis()->SetTitle(
"Generated Energy (GeV)");
620 te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated->GetXaxis()->SetLabelSize(0.05);
621 te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated->GetXaxis()->SetTitleSize(0.05);
622 te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated->GetYaxis()->SetTitle(
"(te_{agg}-ge)/ge");
623 te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated->GetYaxis()->SetLabelSize(0.05);
624 te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated->GetYaxis()->SetTitleSize(0.05);
626 te_by_ge_ge_EtaCut->GetXaxis()->SetTitle(
"Generated Energy (GeV)");
627 te_by_ge_ge_EtaCut->GetXaxis()->SetLabelSize(0.05);
628 te_by_ge_ge_EtaCut->GetXaxis()->SetTitleSize(0.05);
629 te_by_ge_ge_EtaCut->GetYaxis()->SetTitle(
"te_{agg}/ge");
630 te_by_ge_ge_EtaCut->GetYaxis()->SetLabelSize(0.05);
631 te_by_ge_ge_EtaCut->GetYaxis()->SetTitleSize(0.05);
633 te_aggregate_EtaCut_CircularCut->GetXaxis()->SetTitle(
"te_{agg} (GeV)");
634 te_aggregate_EtaCut_CircularCut->GetXaxis()->SetLabelSize(0.05);
635 te_aggregate_EtaCut_CircularCut->GetXaxis()->SetTitleSize(0.05);
636 te_aggregate_EtaCut_CircularCut->GetYaxis()->SetTitle(
"Counts");
637 te_aggregate_EtaCut_CircularCut->GetYaxis()->SetLabelSize(0.05);
638 te_aggregate_EtaCut_CircularCut->GetYaxis()->SetTitleSize(0.05);
640 hist_geta->GetXaxis()->SetTitle(
"Generated #eta");
641 hist_geta->GetXaxis()->SetLabelSize(0.05);
642 hist_geta->GetXaxis()->SetTitleSize(0.05);
643 hist_geta->GetYaxis()->SetTitle(
"Counts");
644 hist_geta->GetYaxis()->SetLabelSize(0.05);
645 hist_geta->GetYaxis()->SetTitleSize(0.05);
647 te_by_ge_ge_EtaCut_CircularCut->GetXaxis()->SetTitle(
"Generated Energy (GeV)");
648 te_by_ge_ge_EtaCut_CircularCut->GetXaxis()->SetLabelSize(0.05);
649 te_by_ge_ge_EtaCut_CircularCut->GetXaxis()->SetTitleSize(0.05);
650 te_by_ge_ge_EtaCut_CircularCut->GetYaxis()->SetTitle(
"te_{agg}/ge");
651 te_by_ge_ge_EtaCut_CircularCut->GetYaxis()->SetLabelSize(0.05);
652 te_by_ge_ge_EtaCut_CircularCut->GetYaxis()->SetTitleSize(0.05);
654 mean_te_by_ge_ge_EtaCut_CircularCut->GetXaxis()->SetTitle(
"Generated Energy (GeV)");
655 mean_te_by_ge_ge_EtaCut_CircularCut->GetXaxis()->SetLabelSize(0.05);
656 mean_te_by_ge_ge_EtaCut_CircularCut->GetXaxis()->SetTitleSize(0.05);
657 mean_te_by_ge_ge_EtaCut_CircularCut->GetYaxis()->SetTitle(
"Mean of te_{agg}/ge");
658 mean_te_by_ge_ge_EtaCut_CircularCut->GetYaxis()->SetLabelSize(0.05);
659 mean_te_by_ge_ge_EtaCut_CircularCut->GetYaxis()->SetTitleSize(0.05);
661 tphi_gphi_EtaCut->GetXaxis()->SetTitle(
"Generated #Phi");
662 tphi_gphi_EtaCut->GetXaxis()->SetLabelSize(0.05);
663 tphi_gphi_EtaCut->GetXaxis()->SetTitleSize(0.05);
664 tphi_gphi_EtaCut->GetYaxis()->SetTitle(
"Tower #Phi");
665 tphi_gphi_EtaCut->GetYaxis()->SetLabelSize(0.05);
666 tphi_gphi_EtaCut->GetYaxis()->SetTitleSize(0.05);
668 tphi_gphi_EtaCut_CircularCut->GetXaxis()->SetTitle(
"Generated #Phi");
669 tphi_gphi_EtaCut_CircularCut->GetXaxis()->SetLabelSize(0.05);
670 tphi_gphi_EtaCut_CircularCut->GetXaxis()->SetTitleSize(0.05);
671 tphi_gphi_EtaCut_CircularCut->GetYaxis()->SetTitle(
"Tower #Phi");
672 tphi_gphi_EtaCut_CircularCut->GetYaxis()->SetLabelSize(0.05);
673 tphi_gphi_EtaCut_CircularCut->GetYaxis()->SetTitleSize(0.05);
675 ttheta_gtheta_EtaCut->GetXaxis()->SetTitle(
"Generated #theta");
676 ttheta_gtheta_EtaCut->GetXaxis()->SetLabelSize(0.05);
677 ttheta_gtheta_EtaCut->GetXaxis()->SetTitleSize(0.05);
678 ttheta_gtheta_EtaCut->GetYaxis()->SetTitle(
"Tower #theta");
679 ttheta_gtheta_EtaCut->GetYaxis()->SetLabelSize(0.05);
680 ttheta_gtheta_EtaCut->GetYaxis()->SetTitleSize(0.05);
682 ttheta_gtheta_EtaCut_CircularCut->GetXaxis()->SetTitle(
"Generated #theta");
683 ttheta_gtheta_EtaCut_CircularCut->GetXaxis()->SetLabelSize(0.05);
684 ttheta_gtheta_EtaCut_CircularCut->GetXaxis()->SetTitleSize(0.05);
685 ttheta_gtheta_EtaCut_CircularCut->GetYaxis()->SetTitle(
"Tower #theta");
686 ttheta_gtheta_EtaCut_CircularCut->GetYaxis()->SetLabelSize(0.05);
687 ttheta_gtheta_EtaCut_CircularCut->GetYaxis()->SetTitleSize(0.05);
689 dphi_dtheta_EtaCut->GetXaxis()->SetTitle(
"ttheta-gtheta");
690 dphi_dtheta_EtaCut->GetXaxis()->SetLabelSize(0.05);
691 dphi_dtheta_EtaCut->GetXaxis()->SetTitleSize(0.05);
692 dphi_dtheta_EtaCut->GetYaxis()->SetTitle(
"tphi-gphi");
693 dphi_dtheta_EtaCut->GetYaxis()->SetLabelSize(0.05);
694 dphi_dtheta_EtaCut->GetYaxis()->SetTitleSize(0.05);
696 te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated_temp_2->GetXaxis()->SetTitle(
"Generated Energy (GeV)");
697 te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated_temp_2->GetXaxis()->SetLabelSize(0.05);
698 te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated_temp_2->GetXaxis()->SetTitleSize(0.05);
699 te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated_temp_2->GetYaxis()->SetTitle(
"#sigma_{e_{agg}}");
700 te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated_temp_2->GetYaxis()->SetLabelSize(0.05);
701 te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated_temp_2->GetYaxis()->SetTitleSize(0.05);
704 te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated_temp_chi2->GetXaxis()->SetTitle(
"Generated Energy (GeV)");
705 te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated_temp_chi2->GetXaxis()->SetLabelSize(0.05);
706 te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated_temp_chi2->GetXaxis()->SetTitleSize(0.05);
707 te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated_temp_chi2->GetYaxis()->SetTitle(
"Reduced_#chi^{2}_{e_{agg}}");
708 te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated_temp_chi2->GetYaxis()->SetLabelSize(0.05);
709 te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated_temp_chi2->GetYaxis()->SetTitleSize(0.04);
712 te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated_temp_1->GetXaxis()->SetTitle(
"Generated Energy (GeV)");
713 te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated_temp_1->GetXaxis()->SetLabelSize(0.05);
714 te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated_temp_1->GetXaxis()->SetTitleSize(0.05);
715 te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated_temp_1->GetYaxis()->SetTitle(
"Mean_{e_{agg}}");
716 te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated_temp_1->GetYaxis()->SetLabelSize(0.05);
717 te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated_temp_1->GetYaxis()->SetTitleSize(0.05);
720 for(
int sno = 0; sno < nSlicesx; sno++){
721 slices[sno]->GetXaxis()->SetTitle(
"#Delta e^{agg}/ ge");
722 slices[sno]->GetXaxis()->SetLabelSize(0.05);
723 slices[sno]->GetXaxis()->SetTitleSize(0.05);
724 slices[sno]->GetYaxis()->SetTitle(
"Counts");
725 slices[sno]->GetYaxis()->SetLabelSize(0.05);
726 slices[sno]->GetYaxis()->SetTitleSize(0.05);
730 std::cout<<
"\nWriting Histograms to File\n";
733 TFile *f =
new TFile(
"Energy_verification_EtaCut_CircularCut_" + detector +
".root",
"RECREATE");
735 f->GetList()->Add(mean_te_geta_EtaCut);
736 f->GetList()->Add(mean_te_gtheta_EtaCut);
737 f->GetList()->Add(counts_towerCounts_EtaCut);
738 f->GetList()->Add(counts_towerCounts_EtaCut_CircularCut);
739 f->GetList()->Add(te_by_ge_ge_EtaCut);
740 f->GetList()->Add(te_by_ge_ge_EtaCut_CircularCut);
741 f->GetList()->Add(mean_te_by_ge_ge_EtaCut_CircularCut);
742 f->GetList()->Add(tphi_gphi_EtaCut);
743 f->GetList()->Add(tphi_gphi_EtaCut_CircularCut);
744 f->GetList()->Add(ttheta_gtheta_EtaCut);
745 f->GetList()->Add(ttheta_gtheta_EtaCut_CircularCut);
746 f->GetList()->Add(dphi_dtheta_EtaCut);
747 f->GetList()->Add(te_minus_ge_by_ge_ge_EtaCut);
748 f->GetList()->Add(te_minus_ge_by_ge_ge_EtaCut_CircularCut);
749 f->GetList()->Add(te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated);
750 f->GetList()->Add(te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated_temp_2);
751 f->GetList()->Add(te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated_temp_1);
752 f->GetList()->Add(te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated_temp_chi2);
753 f->GetList()->Add(te_aggregate_EtaCut_CircularCut);
754 f->GetList()->Add(hist_geta);
755 f->GetList()->Add(te_aggregate_by_geta);
756 f->GetList()->Add(te_aggregate_by_ge);
758 for(
int sno = 0; sno < nSlicesx; sno++){
759 f->GetList()->Add(slices[sno]);
765 gStyle -> SetOptFit(112);
769 std::cout<<
"\nSaving Histograms as .png\n";
774 te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated_temp_1->SetAxisRange(mean_min,mean_max,
"Y");
775 te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated_temp_1->Draw();
776 c->Print(detector +
"_meanE_ge_EtaCut_CircularCut.png");
778 te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated_temp_chi2->SetAxisRange(chi2_min,chi2_max,
"Y");
779 te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated_temp_chi2->Draw();
780 c->Print(detector +
"_chi2E_ge_EtaCut_CircularCut.png");
783 gStyle -> SetOptFit(0);
785 fExp->SetLineColor(4);
786 fTrue->SetLineColor(2);
788 te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated_temp_2->SetMarkerStyle(kFullCircle);
789 te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated_temp_2->SetMarkerColor(46);
790 te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated_temp_2->SetMarkerSize(0.75);
791 te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated_temp_2->SetAxisRange(sigma_min,sigma_max,
"Y");
793 te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated_temp_2->Fit(
"fTrue",
"M+");
794 te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated_temp_2->Draw(
"same");
797 TLegend* legend =
new TLegend(1.75,1.75);
798 legend->SetHeader(
"Legend",
"C");
799 legend->AddEntry(te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated_temp_2,
"#sigma_{e_{agg}} vs Generated Energy",
"flep");
800 legend->AddEntry((
TObject*)0,
"",
"");
801 legend->AddEntry(fTrue,
"p_{0} + p_{1}/#sqrt{ge} + p_{2}/ge (Fitted)",
"l");
802 legend->AddEntry((
TObject*)0,
"",
"");
803 legend->AddEntry(fExp, eRes1,
"l");
804 legend->AddEntry((
TObject*)0,
"(Requirement)",
"" );
805 legend->SetTextSize(0.033);
808 std::cout<<
"reduced_chi2 of fit: "<<fTrue->GetChisquare()/fTrue->GetNDF()<<
"\n";
810 c->Print(detector +
"_sigmaE_ge_EtaCut_CircularCut.png");
813 gStyle -> SetOptFit(112);
814 for(
int sno = 0; sno < nSlicesx; sno++){
815 TString plusOne = (TString)(sno + 1);
816 TString nameF = detector +
"_sigmaE_slice" + arr[sno] +
"_EtaCut_CircularCut.png";
817 slices[sno] -> Fit(
"fit",
"M+");
818 slices[sno] ->
Draw(
"hist same");
824 counts_towerCounts_EtaCut->Draw(
"colz");
825 c->Print(detector +
"_counts_towerCounts_EtaCut.png");
826 counts_towerCounts_EtaCut_CircularCut->Draw(
"colz");
827 c->Print(detector +
"_counts_towerCounts_EtaCut_CircularCut.png");
829 te_by_ge_ge_EtaCut->Draw(
"colz");
830 c->Print(detector +
"_te_by_ge_ge_EtaCut.png");
831 te_by_ge_ge_EtaCut_CircularCut->Draw(
"colz");
832 c->Print(detector +
"_te_by_ge_ge_EtaCut_CircularCut.png");
836 mean_te_by_ge_ge_EtaCut_CircularCut->Draw();
837 c->Print(detector +
"_mean_te_by_ge_ge_EtaCut_CircularCut.png");
841 tphi_gphi_EtaCut->Draw(
"colz");
842 c->Print(detector +
"_tphi_gphi_EtaCut.png");
843 tphi_gphi_EtaCut_CircularCut->Draw(
"colz");
844 c->Print(detector +
"_tphi_gphi_EtaCut_CircularCut.png");
846 ttheta_gtheta_EtaCut->Draw(
"colz");
847 c->Print(detector +
"_ttheta_gtheta_EtaCut.png");
848 ttheta_gtheta_EtaCut_CircularCut->Draw(
"colz");
849 c->Print(detector +
"_ttheta_gtheta_EtaCut_CircularCut.png");
851 te_minus_ge_by_ge_ge_EtaCut->Draw(
"colz");
852 c->Print(detector +
"_te_minus_ge_by_ge_ge_EtaCut.png");
853 te_minus_ge_by_ge_ge_EtaCut_CircularCut->Draw(
"colz");
854 c->Print(detector +
"_te_minus_ge_by_ge_ge_EtaCut_CircularCut.png");
855 te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated->Draw(
"colz");
856 c->Print(detector +
"_te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated.png");
858 c->SetCanvasSize(700,700);
859 dphi_dtheta_EtaCut->Draw(
"colz");
860 el1->SetFillColorAlpha(0, 0);
861 el1->SetLineColorAlpha(2, 1);
862 el1->SetLineWidth(3);
864 c->Print(detector +
"_dphi_dtheta_EtaCut_CircularCut.png");
866 c->SetCanvasSize(500,700);
871 gStyle -> SetOptFit(112);
873 te_aggregate_EtaCut_CircularCut->Draw();
874 c->Print(detector +
"_te_aggregate_EtaCut_CircularCut.png");
876 hist_geta->Draw(
"colz");
877 c->Print(detector +
"_hist_geta.png");
880 gStyle -> SetOptFit(0);
882 te_aggregate_by_ge->Draw(
"colz");
883 c->Print(detector +
"_te_aggregate_by_ge.png");
885 te_aggregate_by_geta->Draw(
"colz");
886 c->Print(detector +
"_te_aggregate_by_geta.png");
888 TF1 *polFit =
new TF1(
"polFit",
"pol4",eta_min,eta_max);
889 TF1 *polFit2 =
new TF1(
"polFit2",
"pol4",2*atan(exp(-eta_min)),2*atan(exp(-eta_max)));
890 if (detector ==
"FHCAL"){
891 polFit =
new TF1(
"polFit",
"pol7",eta_min+0.2,eta_max-0.55);
892 polFit2 =
new TF1(
"polFit2",
"pol6",2*atan(exp(-eta_min-0.2)),2*atan(exp(-eta_max+0.55)));
894 if (detector ==
"EEMC"){
895 polFit =
new TF1(
"polFit",
"pol3",eta_min+0.15,eta_max-0.05);
896 polFit2 =
new TF1(
"polFit2",
"pol3",2*atan(exp(-eta_min-0.15)),2*atan(exp(-eta_max+0.05)));
898 if (detector ==
"FEMC"){
899 polFit =
new TF1(
"polFit",
"pol4",eta_min+0.1,eta_max-0.3);
900 polFit2 =
new TF1(
"polFit2",
"pol4",2*atan(exp(-eta_min-0.1)),2*atan(exp(-eta_max+0.3)));
903 TF1 *HcalFit =
new TF1(
"HcalFit",
"pol2",-0.96,-0.65);
904 TF1 *HcalFit2 =
new TF1(
"HcalFit2",
"pol2",-0.65,0.7);
905 TF1 *HcalFit3 =
new TF1(
"HcalFit3",
"pol2",0.69,0.92);
906 TF1 *HcalFit4 =
new TF1(
"HcalFit4",
"pol2",2*atan(exp(0.96)),2*atan(exp(0.65)));
907 TF1 *HcalFit5 =
new TF1(
"HcalFit5",
"pol2",2*atan(exp(0.65)),2*atan(exp(-0.7)));
908 TF1 *HcalFit6 =
new TF1(
"HcalFit6",
"pol2",2*atan(exp(-0.68)),2*atan(exp(-0.93)));
910 if (detector ==
"HCALOUT"){
911 mean_te_geta_EtaCut->Fit(
"HcalFit",
"ER+");
912 mean_te_geta_EtaCut->Fit(
"HcalFit2",
"ER+");
913 mean_te_geta_EtaCut->Fit(
"HcalFit3",
"ER+");
914 mean_te_geta_EtaCut->Draw(
"colz");
915 c->Print(detector +
"_mean_te_geta_EtaCut.png");
916 std::cout<<
"reduced_chi2 of eta fits from left to right: "<<HcalFit->GetChisquare()/HcalFit->GetNDF()<<
", "<<HcalFit2->GetChisquare()/HcalFit2->GetNDF()<<
", "<<HcalFit3->GetChisquare()/HcalFit3->GetNDF()<<
"\n";
918 mean_te_gtheta_EtaCut->Fit(
"HcalFit4",
"ER+");
919 mean_te_gtheta_EtaCut->Fit(
"HcalFit5",
"ER+");
920 mean_te_gtheta_EtaCut->Fit(
"HcalFit6",
"ER+");
921 mean_te_gtheta_EtaCut->Draw(
"colz");
922 c->Print(detector +
"_mean_te_gtheta_EtaCut.png");
923 std::cout<<
"reduced_chi2 of theta fits from left to right: "<<HcalFit4->GetChisquare()/HcalFit4->GetNDF()<<
", "<<HcalFit5->GetChisquare()/HcalFit5->GetNDF()<<
", "<<HcalFit6->GetChisquare()/HcalFit6->GetNDF()<<
"\n";
927 mean_te_geta_EtaCut->Fit(
"polFit",
"ER+");
928 mean_te_geta_EtaCut->Draw(
"colz");
929 c->Print(detector +
"_mean_te_geta_EtaCut.png");
930 std::cout<<
"reduced_chi2 of eta fit: "<<polFit->GetChisquare()/polFit->GetNDF()<<
"\n";
932 mean_te_gtheta_EtaCut->Fit(
"polFit2",
"ER+");
933 mean_te_gtheta_EtaCut->Draw(
"colz");
934 c->Print(detector +
"_mean_te_gtheta_EtaCut.png");
935 std::cout<<
"reduced_chi2 of theta fit: "<<polFit2->GetChisquare()/polFit2->GetNDF()<<
"\n";
940 std::cout <<
"The total_te is: " << total_te << endl;
941 std::cout <<
"The total_te_CircularCut is: " << total_te_CircularCut << endl;
942 std::cout <<
"The total_ge is: " << total_ge << endl;
943 std::cout<<
"\n\nDone\n----------------------------------------------------------------------\n\n";