-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathLoopEvalHR.C
executable file
·1119 lines (862 loc) · 42 KB
/
LoopEvalHR.C
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
> LoopEvalHR.C(int print = 1, int debug = 0, Double_t energyCutAggregate = 0.1, Double_t energyCut = 0.0, int MIP_theta_parametrisation = 1)
- Creates the analysis plots for the combined forward calorimeters CEMC+HCALIN+HCALOUT (default parameters for pions)
- Processing - Eta Cuts, Manual Clustering (or elliptical cuts based on difference between generated and detected azimuth and polar angle), Recalibration, Tower energy cuts on CEMC alone and CEMC+HCALIN+HCALOUT as well, and polar angle based energy cuts to eliminate MIPs
- Arguments
# print - saves plots as .png files if not 0
# debug - prints debugging messages if not 0; Pipe the output to a file while using this
# energyCutAggregate - specify the value for the tower energy cut on CEMC+HCALIN+HCALOUT
# energyCut - specify the value for the tower energy cut on individual towers
# MIP_theta_parametrization - applies a polar angle dependent energy cut on individual towers of CEMC to eliminate MIPs, based on the parametric equation provided in the code
- Output file - energy_verification_EtaCut_CircularCut_CEMC_HCALIN_HCALOUT.root, and the .png plots if generated
*/
/*
authors - Sagar Joshi ([email protected])
Siddhant Rathi ([email protected])
version - 2
*/
#include <iostream>
#include <stdexcept>
#include <eicqa_modules/EvalRootTTree.h>
#include <eicqa_modules/EvalHit.h>
#include "TMath.h"
#include "TStyle.h"
R__LOAD_LIBRARY(libeicqa_modules.so)
void LoopEvalHR(int print = 1, int debug = 0, Double_t energyCutAggregate = 0.1, Double_t energyCut = 0.0, int MIP_theta_parametrisation = 1){
Double_t EMC_cut = 0.0;
TF1 *mip_pmzn_energy_cut_ftheta = new TF1("mip_pmzn_energy_cut_ftheta", "(9.46093e-01) - 1.62771*x + 1.37776*(x^2) - (5.4996e-01)*(x^3) + (8.82673e-02)*(x^4)");
if(MIP_theta_parametrisation == 1 && energyCut != 0){
throw std::invalid_argument("We do not currently support theta-parametrized \nMIP cut on EMC simultaneously with individual tower cuts \non other detectors.:(;");
}
//variable binning code
int arraySizeBins = 0; //size of the bins array
Double_t arraySizeBinsLoop = 0; //loop variable
int lowThresholdBins = 2; //number of bins below the threshold bin
int highThresholdBins = 9; //number of bins above the threshold bin
Double_t maxEnergyBin = 30; //highest energy
Double_t lowEnergyBin = 3; //threshold energy
//calculating the number of bins required
while(arraySizeBinsLoop < maxEnergyBin){
arraySizeBins += 1;
if(arraySizeBinsLoop < lowEnergyBin){
arraySizeBinsLoop += lowEnergyBin/lowThresholdBins;
}
else{
arraySizeBinsLoop += (maxEnergyBin - lowEnergyBin)/highThresholdBins;
}
}
Double_t binLimitArray[arraySizeBins + 1];
//filing the array containing bin lower limits
for(int i = 0; i <= arraySizeBins; i++){
if(i <= lowThresholdBins){
binLimitArray[i] = lowEnergyBin*i/lowThresholdBins;
}
else{
binLimitArray[i] = lowEnergyBin + ((maxEnergyBin - lowEnergyBin)*(i - lowThresholdBins)/highThresholdBins);
}
}
//print array
for(int i = 0; i < arraySizeBins; i++){
cout<<"element "<<i<<" of the bin array is "<<binLimitArray[i]<<" \n";
}
//variable binning code end
TString detector = "CEMC_HCALIN_HCALOUT";
TFile *f1 = new TFile("merged_Eval_HCALIN.root","READ");
TFile *f2 = new TFile("merged_Eval_HCALOUT.root","READ");
TFile *f3 = new TFile("merged_Eval_CEMC.root","READ");
TTree* T1 = (TTree*)f1->Get("T");
EvalRootTTree *evaltree1 = nullptr;
TTree* T2 = (TTree*)f2->Get("T");
EvalRootTTree *evaltree2 = nullptr;
TTree* T3 = (TTree*)f3->Get("T");
EvalRootTTree *evaltree3 = nullptr;
gStyle->SetCanvasPreferGL(kTRUE);
TCanvas *c = new TCanvas();
c->SetTickx();
c->SetTicky();
// Modifying default plotting style
gStyle->SetOptTitle(0);
gStyle->SetOptFit(102);
gStyle->SetTitleXOffset(1);
gStyle->SetTitleYOffset(1);
gStyle->SetLabelSize(0.05);
gStyle->SetTitleXSize(0.05);
gStyle->SetTitleYSize(0.05);
long double total_te = 0;
long double total_te_CircularCut = 0;
long double total_ge = 0;
int nSlicesx = arraySizeBins; // Number of ge-axis slices taken for making sigma_e vs ge plot
int nSlicesy = 350;
Double_t eta_min, eta_max; // Eta range of detectors
Double_t x_radius_HCALIN = 0.15; // Length of semi-minor axis of circular (elliptical) in HCALIN
Double_t y_radius_HCALIN = 0.25; // Length of semi-major axis of circular (elliptical) in HCALIN
Double_t x_radius_HCALOUT = 0.2; // Length of semi-minor axis of circular (elliptical) in HCALOUT
Double_t y_radius_HCALOUT = 0.3; // Length of semi-major axis of circular (elliptical) in HCALOUT
Double_t x_radius_CEMC = 0.1; // Length of semi-minor axis of circular (elliptical) in CEMC
Double_t y_radius_CEMC = 0.2; // Length of semi-minor axis of circular (elliptical) in CEMC
Double_t fit_min, fit_max; // Fit range of the first slice of [(te-ge)/ge vs ge] plot
Double_t sigma_min, sigma_max; // Range of Y-axis in sigma_e vs ge plot
Double_t mean_min, mean_max; // Range of Y-axis in mean_e vs ge plot
Double_t chi2_min, chi2_max; // Range of Y-axis in chi2_e vs ge plot
Double_t recalibration_factor; // Number divided from entries of [(te-ge)/ge vs ge] plot for recalibration
Double_t recalibration_firstSlice = 3.8147;
Double_t recalibration_firstSlice_FHCAL = 0.0260; // Recalibration factor of first slice (needed to be done manually because of low statistics)
Double_t recalibration_firstSlice_FEMC = 0.0300;
Double_t te_minus_ge_by_ge_ge_min, te_minus_ge_by_ge_ge_max; // Range of y-axis in [(te-ge)/ge vs ge] plot
fit_min = -0.8;
fit_max = 1.0;
eta_min = -0.96;
eta_max = 0.92;
sigma_min = 0;
sigma_max = 1.5;
mean_min = -0.7;
mean_max = 0.3;
chi2_min = 0;
chi2_max = 2.23;
// recalibration_factor = 0.7088;
te_minus_ge_by_ge_ge_min = -0.99;
te_minus_ge_by_ge_ge_max = 1.0;
TString cut_text = " {-0.96 < geta < 0.92} ";
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,-2,1);
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);;
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.5);
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,binLimitArray,nSlicesy,te_minus_ge_by_ge_ge_min,te_minus_ge_by_ge_ge_max); // histogram from which mean vs ge, sigma vs ge, and reduced_chi2 vs ge plots are derived
TH2D *te_minus_ge_by_ge_ge_EtaCut_temp = new TH2D("te_minus_ge_by_ge_ge_EtaCut_temp","#frac{#Delta e_{agg}}{truth e} vs truth e",nSlicesx,binLimitArray,500,-0.99,1.3); // histogram from which mean vs ge, sigma vs ge, and reduced_chi2 vs ge plots are derived
TH2D *te_by_ge_ge_EtaCut = new TH2D("te_by_ge_ge_EtaCut","te_{agg}/ge vs ge",200,0,30,200,-0.5,1.5);
TH2D *te_by_ge_ge_EtaCut_CircularCut = new TH2D("te_by_ge_ge_EtaCut_CircularCut","te_{agg}/ge vs ge",200,0,30,200,-1,2);
TH2D *te_by_ge_ge_EtaCut_CircularCut_HCALIN = new TH2D("te_by_ge_ge_EtaCut_CircularCut_HCALIN","te_{agg}/ge vs ge",200,0,30,200,-1,2);
TH2D *te_by_ge_ge_EtaCut_CircularCut_HCALOUT = new TH2D("te_by_ge_ge_EtaCut_CircularCut_HCALOUT","te_{agg}/ge vs ge",200,0,30,200,-1,2);
TH2D *te_by_ge_ge_EtaCut_CircularCut_CEMC = new TH2D("te_by_ge_ge_EtaCut_CircularCut_CEMC","te_{agg}/ge vs ge",200,0,30,200,-1,2);
auto *mean_te_by_ge_ge_EtaCut_CircularCut = new TProfile("mean_te_by_ge_ge_EtaCut_CircularCut","Mean_{te/ge}",nSlicesx,binLimitArray,-0.5,35);
auto *mean_te_by_ge_ge_EtaCut_CircularCut_HCALIN = new TProfile("mean_te_by_ge_ge_EtaCut_CircularCut_HCALIN","Mean_{te/ge}",nSlicesx,binLimitArray,-0.5,35);
auto *mean_te_by_ge_ge_EtaCut_CircularCut_HCALOUT = new TProfile("mean_te_by_ge_ge_EtaCut_CircularCut_HCALOUT","Mean_{te/ge}",nSlicesx,binLimitArray,-0.5,35);
auto *mean_te_by_ge_ge_EtaCut_CircularCut_CEMC = new TProfile("mean_te_by_ge_ge_EtaCut_CircularCut_CEMC","Mean_{te/ge}",nSlicesx,binLimitArray,-0.5,35);
T1->SetBranchAddress("DST#EvalTTree_HCALIN",&evaltree1);
T2->SetBranchAddress("DST#EvalTTree_HCALOUT",&evaltree2);
T3->SetBranchAddress("DST#EvalTTree_CEMC",&evaltree3);
//T1->GetEntries()
for(int i=0; i<T1->GetEntries(); i++) // We assume same no. of entries, since no cuts are applied
{
T1->GetEntry(i);
T2->GetEntry(i);
T3->GetEntry(i);
if(debug==1){
std::cout<<"\n\n\n------------------------------------------\nParticle: "<<i<<"\n\n";
std::cout<<"Initial Parameters "<<"\n";
}
Double_t geta1 = evaltree1->get_geta();
if(debug==1){
std::cout<<"geta: "<<geta1<<"\n";
}
if(geta1>=eta_min && geta1<=eta_max){
if(debug==1){
cout<<"\ngeta cut applied (1.3, 3.3)"<<"\n\n";
}
Double_t ge = evaltree1->get_ge();
if(debug==1){
std::cout<<"ge: "<<ge<<"\n";
}
Double_t gphi = evaltree1->get_gphi();
if(debug==1){
std::cout<<"gphi: "<<gphi<<"\n";
}
Double_t gtheta = evaltree1->get_gtheta();
if(debug==1){
std::cout<<"gtheta: "<<gtheta<<"\n";
}
total_ge += ge;
if(debug==1){
std::cout<<"total_ge till now = "<<total_ge<<"\n";
}
Double_t te_aggregate = 0;
Double_t te_aggregate_CircularCut = 0;
Double_t te_aggregate_HCALIN_CircularCut = 0;
Double_t te_aggregate_HCALOUT_CircularCut = 0;
for (int j=0; j<evaltree1->get_ntowers(); j++){
if(debug==1){
std::cout<<"\nHCALIN Tower: "<<j<<"\n";
}
EvalTower *twr1 = evaltree1->get_tower(j);
if (twr1){
if(debug==1){
cout<<"non-empty HCALIN tower\n";
}
Double_t tphi = twr1->get_tphi();
if(debug==1){
std::cout<<"tphi: "<<tphi<<"\n";
}
Double_t ttheta = twr1->get_ttheta();
if(debug==1){
std::cout<<"ttheta: "<<ttheta<<"\n";
}
Double_t dphi = tphi - gphi;
if(debug==1){
std::cout<<"tphi-gphi: "<<dphi<<"\n";
}
Double_t dtheta = ttheta - gtheta;
if(debug==1){
std::cout<<"ttheta-gtheta: "<<dtheta<<"\n";
}
Double_t te = twr1->get_te();
if(debug==1){
std::cout<<"te: "<<te<<"\n";
}
if(te > energyCut){
te_aggregate += te;
if(debug==1){
std::cout<<"HCALIN: pow(dphi/y_radius_HCALIN,2)+pow(dtheta/x_radius_HCALOUT,2) = "<<pow(dphi/y_radius_HCALIN,2)+pow(dtheta/x_radius_HCALIN,2)<<"\n";
}
if (pow(dphi/y_radius_HCALIN,2)+pow(dtheta/x_radius_HCALIN,2)<=1){
if(debug==1){
cout<<"HCALIN Tower included after circular cut\n";
}
te_aggregate_CircularCut += te;
te_aggregate_HCALIN_CircularCut += te;
}
if(debug==1){
cout<<"te_aggregate till now = "<<te_aggregate<<"\n";
std::cout<<"te += "<<twr1->get_te()<<"\n";
cout<<"te_aggregate_CircularCut till now = "<<te_aggregate_CircularCut<<"\n";
}
}
}
}
for (int j=0; j<evaltree2->get_ntowers(); j++){
if(debug==1){
std::cout<<"\nHCALOUT Tower: "<<j<<"\n";
}
EvalTower *twr2 = evaltree2->get_tower(j);
if (twr2){
if(debug==1){
cout<<"non-empty HCALOUT tower\n";
}
Double_t tphi = twr2->get_tphi();
if(debug==1){
std::cout<<"tphi: "<<tphi<<"\n";
}
Double_t ttheta = twr2->get_ttheta();
if(debug==1){
std::cout<<"ttheta: "<<ttheta<<"\n";
}
Double_t dphi = tphi - gphi;
if(debug==1){
std::cout<<"tphi-gphi: "<<dphi<<"\n";
}
Double_t dtheta = ttheta - gtheta;
if(debug==1){
std::cout<<"ttheta-gtheta: "<<dtheta<<"\n";
}
Double_t te = twr2->get_te();
if(debug==1){
std::cout<<"te: "<<te<<"\n";
}
if(te > energyCut){
te_aggregate += te;
if(debug==1){
std::cout<<"HCALOUT: pow(dphi/y_radius_HCALOUT,2)+pow(dtheta/x_radius_HCALOUT,2): "<<pow(dphi/y_radius_HCALOUT,2)+pow(dtheta/x_radius_HCALOUT,2)<<"\n";
}
if (pow(dphi/y_radius_HCALOUT,2)+pow(dtheta/x_radius_HCALOUT,2)<=1){
if(debug==1){
cout<<"HCALOUT Tower included after circular cut\n";
}
te_aggregate_HCALOUT_CircularCut += te;
te_aggregate_CircularCut += te;
}
if(debug==1){
cout<<"te_aggregate till now = "<<te_aggregate<<"\n";
cout<<"te_aggregate_CircularCut till now = "<<te_aggregate_CircularCut<<"\n";
std::cout<<"te += "<<twr2->get_te()<<"\n";
}
}
}
}
for (int j=0; j<evaltree3->get_ntowers(); j++){
if(debug==1){
std::cout<<"\nCEMC Tower: "<<j<<"\n";
}
EvalTower *twr3 = evaltree3->get_tower(j);
if (twr3){
if(debug==1){
cout<<"non-empty CEMC tower\n";
}
Double_t tphi = twr3->get_tphi();
if(debug==1){
std::cout<<"tphi: "<<tphi<<"\n";
}
Double_t ttheta = twr3->get_ttheta();
if(debug==1){
std::cout<<"ttheta: "<<ttheta<<"\n";
}
Double_t dphi = tphi - gphi;
if(debug==1){
std::cout<<"tphi-gphi: "<<dphi<<"\n";
}
Double_t dtheta = ttheta - gtheta;
if(debug==1){
std::cout<<"ttheta-gtheta: "<<dtheta<<"\n";
}
Double_t te = twr3->get_te();
if(debug==1){
std::cout<<"te: "<<te<<"\n";
}
if(MIP_theta_parametrisation == 1){
EMC_cut = mip_pmzn_energy_cut_ftheta->Eval(gtheta);
}
if(te > energyCut + EMC_cut){
te_aggregate += te;
if(debug==1){
std::cout<<"CEMC: pow(dphi/y_radius,2)+pow(dtheta/x_radius,2): "<<pow(dphi/y_radius_CEMC,2)+pow(dtheta/x_radius_CEMC,2)<<"\n";
}
if (pow(dphi/y_radius_CEMC,2)+pow(dtheta/x_radius_CEMC,2)<=1){
if(debug==1){
cout<<"CEMC Tower included after circular cut\n";
}
te_aggregate_CircularCut += te;
}
if(debug==1){
cout<<"te_aggregate till now = "<<te_aggregate<<"\n";
cout<<"te_aggregate_CircularCut till now = "<<te_aggregate_CircularCut<<"\n";
std::cout<<"te += "<<twr3->get_te()<<"\n";
}
}
}
}
total_te += te_aggregate;
total_te_CircularCut += te_aggregate_CircularCut;
if(debug==1){
cout<<"total_te till now = "<<total_te<<"\n";
cout<<"total_te_CircularCut till now = "<<total_te_CircularCut<<"\n\n";
}
if(te_aggregate_CircularCut > energyCutAggregate){
te_minus_ge_by_ge_ge_EtaCut->Fill(ge, (te_aggregate-ge)/ge);
if(debug==1){
cout<<"(ge, (te_aggregate-ge)/ge): ("<<ge<<", "<<(te_aggregate-ge)/ge<<")\n";
}
te_minus_ge_by_ge_ge_EtaCut_CircularCut->Fill(ge, (te_aggregate_CircularCut-ge)/ge);
if(debug==1){
cout<<"(ge, (te_aggregate_CircularCut-ge)/ge): ("<<ge<<", "<<(te_aggregate_CircularCut-ge)/ge<<")\n";
}
/*te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated->Fill(ge, ((te_aggregate_CircularCut/recalibration_factor)-ge)/ge);
r early on, it took me a while to realize what I need is best done by a weighted sum instead of trying to normalize the fit functions. if(debug==1){
cout<<"(ge, ((te_aggregate_CircularCut/recalibration_factor)-ge)/ge: ("<<ge<<", "<<((te_aggregate_CircularCut/recalibration_factor)-ge)/ge<<")\n";
}
te_minus_ge_by_ge_ge_EtaCut_Recalibrated_temp->Fill(ge, ((te_aggregate_CircularCut/recalibration_factor)-ge)/ge);*/
te_by_ge_ge_EtaCut->Fill(ge, te_aggregate/ge);
if(debug==1){
cout<<"(ge, te_aggregate/ge): ("<<ge<<", "<<te_aggregate/ge<<")\n";
}
te_by_ge_ge_EtaCut_CircularCut->Fill(ge, te_aggregate_CircularCut/ge);
te_by_ge_ge_EtaCut_CircularCut_HCALIN->Fill(ge, te_aggregate_HCALIN_CircularCut/ge);
te_by_ge_ge_EtaCut_CircularCut_HCALOUT->Fill(ge, te_aggregate_HCALOUT_CircularCut/ge);
te_by_ge_ge_EtaCut_CircularCut_CEMC->Fill(ge, (te_aggregate_CircularCut-te_aggregate_HCALIN_CircularCut-te_aggregate_HCALOUT_CircularCut)/ge);
mean_te_by_ge_ge_EtaCut_CircularCut_HCALIN->Fill(ge, te_aggregate_HCALIN_CircularCut/ge);
mean_te_by_ge_ge_EtaCut_CircularCut_HCALOUT->Fill(ge, te_aggregate_HCALOUT_CircularCut/ge);
mean_te_by_ge_ge_EtaCut_CircularCut_CEMC->Fill(ge, (te_aggregate_CircularCut-te_aggregate_HCALIN_CircularCut-te_aggregate_HCALOUT_CircularCut)/ge);
if(debug==1){
cout<<"\n(ge, te_aggregate_CircularCut/ge): ("<<ge<<", "<<te_aggregate_CircularCut/ge<<")\n";
cout<<"(ge, te_aggregate_HCALIN_CircularCut/ge): ("<<ge<<", "<<te_aggregate_HCALIN_CircularCut/ge<<")\n";
cout<<"(ge, te_aggregate_HCALOUT_CircularCut/ge): ("<<ge<<", "<<te_aggregate_HCALOUT_CircularCut/ge<<")\n";
cout<<"(ge, (te_aggregate_CircularCut-te_aggregate_HCALIN_CircularCut - te_aggregate_HCALOUT_CircularCut)/ge): ("<<ge<<", "<<(te_aggregate_CircularCut-te_aggregate_HCALIN_CircularCut - te_aggregate_HCALOUT_CircularCut)/ge<<")\n\n";
}
}
}
}
if(debug==1){
cout<<"\neta cut if ends"<<"\n";
}
TString arr[nSlicesx]; // Used for naming fitted slices used in sigma_e vs ge
for(int sno = 0; sno < nSlicesx; sno++){
arr[sno] = TString::Itoa(sno + 1, 10);
}
if(debug==1){
std::cout<<"\nGenerating sigma_e vs ge plots\n\n";
}
Double_t recalibrationArr1[nSlicesx];
Double_t rf_integral_HCALIN = 0;
Double_t weight_HCALIN = te_by_ge_ge_EtaCut_CircularCut_HCALIN->GetMean(2);
if(debug==1){
cout << "HCALIN weight is : " << weight_HCALIN << endl;
}
//recalibrationArr1[0] = recalibration_firstSlice_FHCAL;
//rf_integral_FHCAL += recalibrationArr1[0];
//cout << "Recalibration factor for slice " << 1 << " of FHCAL is: " << recalibrationArr1[0] << endl;
for(int binIter = 1; binIter <= nSlicesx; binIter++){
recalibrationArr1[binIter-1] = mean_te_by_ge_ge_EtaCut_CircularCut_HCALIN->GetBinContent(binIter);
rf_integral_HCALIN += recalibrationArr1[binIter-1];
if(debug == 1){
cout<<"rf_integral_HCALIN += "<<recalibrationArr1[binIter-1]<<"\n";
}
cout << "Recalibration factor for slice " << binIter << " of HCALIN is: " << recalibrationArr1[binIter-1] << endl;
}
if(debug == 1){
cout<<"rf_integral_HCALIN = "<<rf_integral_HCALIN<<"\n\n";
}
Double_t recalibrationArr2[nSlicesx];
Double_t rf_integral_HCALOUT = 0;
Double_t weight_HCALOUT = te_by_ge_ge_EtaCut_CircularCut_HCALOUT->GetMean(2);
if(debug==1){
cout << "HCALOUT weight is : " << weight_HCALOUT << endl;
}
//recalibrationArr2[0] = recalibration_firstSlice_HCALOUT;
//rf_integral_HCALOUT += recalibrationArr2[0];
//cout << "Recalibration factor for slice " << 1 << " of HCALOUT is: " << recalibrationArr2[0] << endl;
for(int binIter = 1; binIter <= nSlicesx; binIter++){
recalibrationArr2[binIter-1] = mean_te_by_ge_ge_EtaCut_CircularCut_HCALOUT->GetBinContent(binIter);
rf_integral_HCALOUT += recalibrationArr2[binIter-1];
if(debug == 1){
cout<<"rf_integral_HCALOUT += "<<recalibrationArr2[binIter-1]<<"\n";
}
cout << "Recalibration factor for slice " << binIter << " of HCALOUT is: " << recalibrationArr2[binIter-1] << endl;
}
if(debug == 1){
cout<<"rf_integral_HCALOUT = "<<rf_integral_HCALOUT<<"\n\n";
}
Double_t recalibrationArr3[nSlicesx];
Double_t rf_integral_CEMC = 0;
Double_t weight_CEMC = te_by_ge_ge_EtaCut_CircularCut_CEMC->GetMean(2);
if(debug==1){
cout << "CEMC weight is : " << weight_CEMC << endl;
}
//recalibrationArr3[0] = recalibration_firstSlice_CEMC;
//rf_integral_CEMC += recalibrationArr3[0];
//cout << "Recalibration factor for slice " << 1 << " of CEMC is: " << recalibrationArr3[0] << endl;
for(int binIter = 1; binIter <= nSlicesx; binIter++){
recalibrationArr3[binIter-1] = mean_te_by_ge_ge_EtaCut_CircularCut_CEMC->GetBinContent(binIter);
rf_integral_CEMC += recalibrationArr3[binIter-1];
if(debug == 1){
cout<<"rf_integral_CEMC += "<<recalibrationArr3[binIter-1]<<"\n";
}
cout << "Recalibration factor for slice " << binIter << " of CEMC is: " << recalibrationArr3[binIter-1] << endl;
}
if(debug == 1){
cout<<"rf_integral_CEMC = "<<rf_integral_CEMC<<"\n\n";
}
for(int i=0; i<T1->GetEntries(); i++){
T1->GetEntry(i);
T2->GetEntry(i);
T3->GetEntry(i);
Double_t geta1 = evaltree1->get_geta();
Double_t gphi = evaltree1->get_gphi();
Double_t gtheta = evaltree1->get_gtheta();
Double_t ge = evaltree1->get_ge();
Double_t te_aggregate_CircularCut = 0;
Double_t te_aggregate_CircularCut_normalised = 0;
int recalibration_factor = 0;
if(ge > lowEnergyBin){
Double_t eRangeBin = (maxEnergyBin - lowEnergyBin)/highThresholdBins;
recalibration_factor = (lowThresholdBins - 1) + ceil(ge/eRangeBin)- 1;
}
else{
recalibration_factor = ceil((ge/lowEnergyBin)*(Double_t)lowThresholdBins)- 1;
}
if(debug==1){
cout << "Recalibration index in Loop 2 is : " << recalibration_factor << endl;
}
if(geta1>=eta_min && geta1<=eta_max){
for (int j=0; j<evaltree1->get_ntowers(); j++){
EvalTower *twr1 = evaltree1->get_tower(j);
if (twr1){
Double_t tphi = twr1->get_tphi();
Double_t ttheta = twr1->get_ttheta();
Double_t dphi = tphi - gphi;
Double_t dtheta = ttheta - gtheta;
Double_t te = twr1->get_te();
if(te > energyCut){
if(debug==1){
std::cout<<"pow(dphi/y_radius_HCALIN,2)+pow(dtheta/x_radius_HCALIN,2): "<<pow(dphi/y_radius_HCALIN,2)+pow(dtheta/x_radius_HCALIN,2)<<"\n";
}
if (pow(dphi/y_radius_HCALIN,2)+pow(dtheta/x_radius_HCALIN,2)<=1){
te_aggregate_CircularCut += te;
te_aggregate_CircularCut_normalised += te*weight_HCALIN/recalibrationArr1[recalibration_factor];
}
}
}
}
for (int j=0; j<evaltree2->get_ntowers(); j++){
EvalTower *twr2 = evaltree2->get_tower(j);
if (twr2){
Double_t tphi = twr2->get_tphi();
Double_t ttheta = twr2->get_ttheta();
Double_t dphi = tphi - gphi;
Double_t dtheta = ttheta - gtheta;
Double_t te = twr2->get_te();
if(te > energyCut){
if(debug==1){
std::cout<<"pow(dphi/y_radius_HCALOUT,2)+pow(dtheta/x_radius_HCALOUT,2): "<<pow(dphi/y_radius_HCALOUT,2)+pow(dtheta/x_radius_HCALOUT,2)<<"\n";
}
if (pow(dphi/y_radius_HCALOUT,2)+pow(dtheta/x_radius_HCALOUT,2)<=1){
te_aggregate_CircularCut += te;
te_aggregate_CircularCut_normalised += te*weight_HCALOUT/recalibrationArr2[recalibration_factor];
}
}
}
}
for (int j=0; j<evaltree3->get_ntowers(); j++){
EvalTower *twr3 = evaltree3->get_tower(j);
if (twr3){
Double_t tphi = twr3->get_tphi();
Double_t ttheta = twr3->get_ttheta();
Double_t dphi = tphi - gphi;
Double_t dtheta = ttheta - gtheta;
Double_t te = twr3->get_te();
if(MIP_theta_parametrisation == 1){
EMC_cut = mip_pmzn_energy_cut_ftheta->Eval(gtheta);
}
if(te > energyCut + EMC_cut){
if(debug==1){
std::cout<<"pow(dphi/y_radius_CEMC,2)+pow(dtheta/x_radius_CEMC,2): "<<pow(dphi/y_radius_CEMC,2)+pow(dtheta/x_radius_CEMC,2)<<"\n";
}
if (pow(dphi/y_radius_CEMC,2)+pow(dtheta/x_radius_CEMC,2)<=1){
te_aggregate_CircularCut += te;
te_aggregate_CircularCut_normalised += te*weight_CEMC/recalibrationArr3[recalibration_factor];
}
}
}
}
if(te_aggregate_CircularCut > energyCutAggregate){
mean_te_by_ge_ge_EtaCut_CircularCut->Fill(ge, te_aggregate_CircularCut_normalised/ge);
if(debug==1){
cout << "mean_te_by_ge_ge_EtaCut_CircularCut entry " << i << " is : " << te_aggregate_CircularCut_normalised/ge << endl;
}
}
if(debug == 1){
cout<<"(ge, te_aggregate_CircularCut_normalised/ge): ("<<ge<<", "<<te_aggregate_CircularCut_normalised/ge<<")\n";
}
}
}
Double_t recalibrationArr[nSlicesx];
// recalibrationArr[0] = recalibration_firstSlice;
// cout << "Recalibration factor for slice " << 1 << " is: " << recalibrationArr[0] << endl;
for(int binIter = 1; binIter <= nSlicesx; binIter++){
recalibrationArr[binIter-1] = mean_te_by_ge_ge_EtaCut_CircularCut->GetBinContent(binIter);
cout << "Recalibration factor for slice " << binIter << " is: " << recalibrationArr[binIter-1] << endl;
}
for(int i=0; i<T1->GetEntries(); i++){
T1->GetEntry(i);
T2->GetEntry(i);
T3->GetEntry(i);
Double_t geta1 = evaltree1->get_geta();
Double_t gphi = evaltree1->get_gphi();
Double_t gtheta = evaltree1->get_gtheta();
Double_t ge = evaltree1->get_ge();
Double_t te_aggregate_CircularCut = 0;
Double_t te_aggregate_CircularCut_normalised = 0;
int recalibration_factor = 0;
if(ge > lowEnergyBin){
Double_t eRangeBin = (maxEnergyBin - lowEnergyBin)/highThresholdBins;
recalibration_factor = (lowThresholdBins - 1) + ceil(ge/eRangeBin)- 1;
}
else{
recalibration_factor = ceil((ge/lowEnergyBin)*(Double_t)lowThresholdBins)- 1;
}
if(debug==1){
cout << "Recalibration index in Loop 3 is : " << recalibration_factor << endl;
}
if(geta1>=eta_min && geta1<=eta_max){
for (int j=0; j<evaltree1->get_ntowers(); j++){
EvalTower *twr1 = evaltree1->get_tower(j);
if (twr1){
Double_t tphi = twr1->get_tphi();
Double_t ttheta = twr1->get_ttheta();
Double_t dphi = tphi - gphi;
Double_t dtheta = ttheta - gtheta;
Double_t te = twr1->get_te();
if(te > energyCut){
if(debug==1){
std::cout<<"pow(dphi/y_radius_HCALIN,2)+pow(dtheta/x_radius_HCALIN,2): "<<pow(dphi/y_radius_HCALIN,2)+pow(dtheta/x_radius_HCALIN,2)<<"\n";
}
if (pow(dphi/y_radius_HCALIN,2)+pow(dtheta/x_radius_HCALIN,2)<=1){
te_aggregate_CircularCut += te;
te_aggregate_CircularCut_normalised += te*weight_HCALIN/recalibrationArr1[recalibration_factor];
}
}
}
}
for (int j=0; j<evaltree2->get_ntowers(); j++){
EvalTower *twr2 = evaltree2->get_tower(j);
if (twr2){
Double_t tphi = twr2->get_tphi();
Double_t ttheta = twr2->get_ttheta();
Double_t dphi = tphi - gphi;
Double_t dtheta = ttheta - gtheta;
Double_t te = twr2->get_te();
if(te > energyCut){
if(debug==1){
std::cout<<"pow(dphi/y_radius_HCALOUT,2)+pow(dtheta/x_radius_HCALOUT,2): "<<pow(dphi/y_radius_HCALOUT,2)+pow(dtheta/x_radius_HCALOUT,2)<<"\n";
}
if (pow(dphi/y_radius_HCALOUT,2)+pow(dtheta/x_radius_HCALOUT,2)<=1){
te_aggregate_CircularCut += te;
te_aggregate_CircularCut_normalised += te*weight_HCALOUT/recalibrationArr2[recalibration_factor];
}
}
}
}
for (int j=0; j<evaltree3->get_ntowers(); j++){
EvalTower *twr3 = evaltree3->get_tower(j);
if (twr3){
Double_t tphi = twr3->get_tphi();
Double_t ttheta = twr3->get_ttheta();
Double_t dphi = tphi - gphi;
Double_t dtheta = ttheta - gtheta;
Double_t te = twr3->get_te();
if(MIP_theta_parametrisation == 1){
EMC_cut = mip_pmzn_energy_cut_ftheta->Eval(gtheta);
}
if(te > energyCut + EMC_cut){
if(debug==1){
std::cout<<"pow(dphi/y_radius_CEMC,2)+pow(dtheta/x_radius_CEMC,2): "<<pow(dphi/y_radius_CEMC,2)+pow(dtheta/x_radius_CEMC,2)<<"\n";
}
if (pow(dphi/y_radius_CEMC,2)+pow(dtheta/x_radius_CEMC,2)<=1){
te_aggregate_CircularCut += te;
te_aggregate_CircularCut_normalised += te*weight_CEMC/recalibrationArr3[recalibration_factor];
}
}
}
}
if(te_aggregate_CircularCut > energyCutAggregate){
te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated->Fill(ge, ((te_aggregate_CircularCut_normalised/recalibrationArr[recalibration_factor])-ge)/ge);
te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated_temp->Fill(ge, ((te_aggregate_CircularCut_normalised/recalibrationArr[recalibration_factor])-ge)/ge);
if(debug==1){
cout << "te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated entry " << i << " is : " << ((te_aggregate_CircularCut_normalised/recalibrationArr[recalibration_factor])-ge)/ge << endl;
}
}
if(debug==1){
cout<<"(ge, ((te_aggregate_CircularCut_normalised/recalibration_factor)-ge)/ge: ("<<ge<<", "<<((te_aggregate_CircularCut_normalised/recalibrationArr[recalibration_factor])-ge)/ge<<")\n";
}
}
}
// Initialising fit functions
TF1 *fit = new TF1("fit", "gaus");
TF1 *fit1 = new TF1("fit1","gaus",fit_min,fit_max);
TF1 *fExp = new TF1("fExp","0.1 + 1.0/sqrt(x)",0,30);
TF1 *fTrue = new TF1("fTrue","[0] + [1]/sqrt(x)",0,30);
te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated_temp->FitSlicesY(0, 1, -1, 0, "QN");
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");
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");
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");
TH1D* slices[nSlicesx];
// Generating plots for individual slices
for(int sno = 0; sno < nSlicesx; sno++){
int plusOne = sno+1;
TString sname = "slice " + arr[sno];
slices[sno] = te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated_temp->ProjectionY(sname, plusOne, plusOne);
}
if(debug==1){
cout<<"\nHistogram Formatting\n\n";
}
te_minus_ge_by_ge_ge_EtaCut->GetXaxis()->SetTitle("Generated Energy (GeV)");
te_minus_ge_by_ge_ge_EtaCut->GetXaxis()->SetLabelSize(0.05);
te_minus_ge_by_ge_ge_EtaCut->GetXaxis()->SetTitleSize(0.05);
te_minus_ge_by_ge_ge_EtaCut->GetYaxis()->SetTitle("(te_{agg}-ge)/ge");
te_minus_ge_by_ge_ge_EtaCut->GetYaxis()->SetLabelSize(0.05);
te_minus_ge_by_ge_ge_EtaCut->GetYaxis()->SetTitleSize(0.05);
te_minus_ge_by_ge_ge_EtaCut_CircularCut->GetXaxis()->SetTitle("Generated Energy (GeV)");
te_minus_ge_by_ge_ge_EtaCut_CircularCut->GetXaxis()->SetLabelSize(0.05);
te_minus_ge_by_ge_ge_EtaCut_CircularCut->GetXaxis()->SetTitleSize(0.05);
te_minus_ge_by_ge_ge_EtaCut_CircularCut->GetYaxis()->SetTitle("(te_{agg}-ge)/ge");
te_minus_ge_by_ge_ge_EtaCut_CircularCut->GetYaxis()->SetLabelSize(0.05);
te_minus_ge_by_ge_ge_EtaCut_CircularCut->GetYaxis()->SetTitleSize(0.05);
te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated->GetXaxis()->SetTitle("Generated Energy (GeV)");
te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated->GetXaxis()->SetLabelSize(0.05);
te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated->GetXaxis()->SetTitleSize(0.05);
te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated->GetYaxis()->SetTitle("(te_{agg}-ge)/ge");
te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated->GetYaxis()->SetLabelSize(0.05);
te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated->GetYaxis()->SetTitleSize(0.05);
te_by_ge_ge_EtaCut->GetXaxis()->SetTitle("Generated Energy (GeV)");
te_by_ge_ge_EtaCut->GetXaxis()->SetLabelSize(0.05);
te_by_ge_ge_EtaCut->GetXaxis()->SetTitleSize(0.05);
te_by_ge_ge_EtaCut->GetYaxis()->SetTitle("te_{agg}/ge");
te_by_ge_ge_EtaCut->GetYaxis()->SetLabelSize(0.05);
te_by_ge_ge_EtaCut->GetYaxis()->SetTitleSize(0.05);
te_by_ge_ge_EtaCut_CircularCut->GetXaxis()->SetTitle("Generated Energy (GeV)");
te_by_ge_ge_EtaCut_CircularCut->GetXaxis()->SetLabelSize(0.05);
te_by_ge_ge_EtaCut_CircularCut->GetXaxis()->SetTitleSize(0.05);
te_by_ge_ge_EtaCut_CircularCut->GetYaxis()->SetTitle("te_{agg}/ge");
te_by_ge_ge_EtaCut_CircularCut->GetYaxis()->SetLabelSize(0.05);
te_by_ge_ge_EtaCut_CircularCut->GetYaxis()->SetTitleSize(0.05);
mean_te_by_ge_ge_EtaCut_CircularCut->GetXaxis()->SetTitle("Generated Energy (GeV)");
mean_te_by_ge_ge_EtaCut_CircularCut->GetXaxis()->SetLabelSize(0.05);
mean_te_by_ge_ge_EtaCut_CircularCut->GetXaxis()->SetTitleSize(0.05);
mean_te_by_ge_ge_EtaCut_CircularCut->GetYaxis()->SetTitle("Mean of te_{agg}/ge");
mean_te_by_ge_ge_EtaCut_CircularCut->GetYaxis()->SetLabelSize(0.05);
mean_te_by_ge_ge_EtaCut_CircularCut->GetYaxis()->SetTitleSize(0.05);
mean_te_by_ge_ge_EtaCut_CircularCut_HCALIN->GetXaxis()->SetTitle("Generated Energy (GeV)");
mean_te_by_ge_ge_EtaCut_CircularCut_HCALIN->GetXaxis()->SetLabelSize(0.05);
mean_te_by_ge_ge_EtaCut_CircularCut_HCALIN->GetXaxis()->SetTitleSize(0.05);
mean_te_by_ge_ge_EtaCut_CircularCut_HCALIN->GetYaxis()->SetTitle("Mean of te_{agg}/ge (HCALIN)");
mean_te_by_ge_ge_EtaCut_CircularCut_HCALIN->GetYaxis()->SetLabelSize(0.05);
mean_te_by_ge_ge_EtaCut_CircularCut_HCALIN->GetYaxis()->SetTitleSize(0.05);
mean_te_by_ge_ge_EtaCut_CircularCut_HCALOUT->GetXaxis()->SetTitle("Generated Energy (GeV)");
mean_te_by_ge_ge_EtaCut_CircularCut_HCALOUT->GetXaxis()->SetLabelSize(0.05);
mean_te_by_ge_ge_EtaCut_CircularCut_HCALOUT->GetXaxis()->SetTitleSize(0.05);
mean_te_by_ge_ge_EtaCut_CircularCut_HCALOUT->GetYaxis()->SetTitle("Mean of te_{agg}/ge (HCALOUT)");
mean_te_by_ge_ge_EtaCut_CircularCut_HCALOUT->GetYaxis()->SetLabelSize(0.05);
mean_te_by_ge_ge_EtaCut_CircularCut_HCALOUT->GetYaxis()->SetTitleSize(0.05);
mean_te_by_ge_ge_EtaCut_CircularCut_CEMC->GetXaxis()->SetTitle("Generated Energy (GeV)");
mean_te_by_ge_ge_EtaCut_CircularCut_CEMC->GetXaxis()->SetLabelSize(0.05);
mean_te_by_ge_ge_EtaCut_CircularCut_CEMC->GetXaxis()->SetTitleSize(0.05);
mean_te_by_ge_ge_EtaCut_CircularCut_CEMC->GetYaxis()->SetTitle("Mean of te_{agg}/ge (CEMC)");
mean_te_by_ge_ge_EtaCut_CircularCut_CEMC->GetYaxis()->SetLabelSize(0.05);
mean_te_by_ge_ge_EtaCut_CircularCut_CEMC->GetYaxis()->SetTitleSize(0.05);
te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated_temp_2->GetXaxis()->SetTitle("Generated Energy (GeV)");
te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated_temp_2->GetXaxis()->SetLabelSize(0.05);
te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated_temp_2->GetXaxis()->SetTitleSize(0.05);
te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated_temp_2->GetYaxis()->SetTitle("#sigma_{e_{agg}}");
te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated_temp_2->GetYaxis()->SetLabelSize(0.05);
te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated_temp_2->GetYaxis()->SetTitleSize(0.05);
//te_minus_ge_by_ge_ge_EtaCut_2->SetTitle("#sigma_{e_{agg}} vs true_e" + cut_text);
te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated_temp_chi2->GetXaxis()->SetTitle("Generated Energy (GeV)");
te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated_temp_chi2->GetXaxis()->SetLabelSize(0.05);
te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated_temp_chi2->GetXaxis()->SetTitleSize(0.05);
te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated_temp_chi2->GetYaxis()->SetTitle("Reduced_#chi^{2}_{e_{agg}}");
te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated_temp_chi2->GetYaxis()->SetLabelSize(0.05);
te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated_temp_chi2->GetYaxis()->SetTitleSize(0.04);
//te_minus_ge_by_ge_ge_EtaCut_chi2->SetTitle("#chi^{2}_{e_{agg}} vs true_e" + cut_text);
te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated_temp_1->GetXaxis()->SetTitle("Generated Energy (GeV)");
te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated_temp_1->GetXaxis()->SetLabelSize(0.05);
te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated_temp_1->GetXaxis()->SetTitleSize(0.05);
te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated_temp_1->GetYaxis()->SetTitle("Mean_{e_{agg}}");
te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated_temp_1->GetYaxis()->SetLabelSize(0.05);
te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated_temp_1->GetYaxis()->SetTitleSize(0.05);
//te_minus_ge_by_ge_ge_EtaCut_1->SetTitle("mean_{e_{agg}} vs true_e" + cut_text);
for(int sno = 0; sno < nSlicesx; sno++){
slices[sno]->GetXaxis()->SetTitle("#Delta e^{agg}/ ge");
slices[sno]->GetXaxis()->SetLabelSize(0.05);
slices[sno]->GetXaxis()->SetTitleSize(0.05);
slices[sno]->GetYaxis()->SetTitle("Counts");
slices[sno]->GetYaxis()->SetLabelSize(0.05);
slices[sno]->GetYaxis()->SetTitleSize(0.05);
}
if(debug==1){
std::cout<<"\nWrite Histograms to File\n";
}
TFile *f = new TFile("energy_verification_EtaCut_CircularCut_" + detector + ".root","RECREATE");
f->GetList()->Add(te_by_ge_ge_EtaCut);
f->GetList()->Add(te_by_ge_ge_EtaCut_CircularCut);
f->GetList()->Add(te_minus_ge_by_ge_ge_EtaCut);
f->GetList()->Add(te_minus_ge_by_ge_ge_EtaCut_CircularCut);
f->GetList()->Add(mean_te_by_ge_ge_EtaCut_CircularCut);
f->GetList()->Add(mean_te_by_ge_ge_EtaCut_CircularCut_HCALIN);
f->GetList()->Add(mean_te_by_ge_ge_EtaCut_CircularCut_HCALOUT);
f->GetList()->Add(mean_te_by_ge_ge_EtaCut_CircularCut_CEMC);
f->GetList()->Add(te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated);
f->GetList()->Add(te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated_temp_2);
f->GetList()->Add(te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated_temp_1);
f->GetList()->Add(te_minus_ge_by_ge_ge_EtaCut_CircularCut_Recalibrated_temp_chi2);
for(int sno = 0; sno < nSlicesx; sno++){
f->GetList()->Add(slices[sno]);
}
f->Write();
gStyle -> SetOptStat(11);
gStyle -> SetOptFit(112);
/*
int sno = 0;
TString plusOne = (TString)(sno + 1);
TString nameF = detector + "_sigmaE_slice" + arr[sno] + "_EtaCut_CircularCut.png";
slices[sno] -> Fit("fit1", "R+");
slices[sno] -> Draw("hist same");
c->Print(nameF);
*/
/* double_t mean = fit1->GetParameter(1);
double_t mean_error = fit1->GetParError(1);
double_t sigma = fit1->GetParameter(2);
double_t sigma_error = fit1->GetParError(2);
double_t chi2 = (fit1->GetChisquare())/(fit1->GetNDF());
TLine *Mean = new TLine(0,mean,30.0/nSlicesx,mean);
TLine *Sigma = new TLine(0,sigma,30.0/nSlicesx,sigma);
TLine *Chi2 = new TLine(0,chi2,30.0/nSlicesx,chi2);
TLine *Periphery_Chi2 = new TLine(30.0/nSlicesx,0,30.0/nSlicesx,chi2);