-
Notifications
You must be signed in to change notification settings - Fork 0
/
CombineGammaResultspPb_V2.C
3865 lines (3375 loc) · 267 KB
/
CombineGammaResultspPb_V2.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
#include <Riostream.h>
#include <fstream>
#include "TMath.h"
#include <stdlib.h>
#include <fstream>
#include <math.h>
#include <TROOT.h>
#include <TApplication.h>
#include <TPaveLabel.h>
#include <TSystem.h>
#include <TFrame.h>
#include <TStyle.h>
#include <TString.h>
#include "TGaxis.h"
#include "TFile.h"
#include "TH1F.h"
#include "TH1D.h"
#include "TH2F.h"
#include "TF1.h"
#include "TVirtualFitter.h"
#include "TObject.h"
#include "TCanvas.h"
#include "TMultiGraph.h"
#include "TLegend.h"
#include "TDatabasePDG.h"
#include "TMinuit.h"
#include "TBenchmark.h"
#include "TRandom.h"
#include "TLatex.h"
#include "TASImage.h"
#include "TPostScript.h"
#include "TGraphErrors.h"
#include "TArrow.h"
#include "TGaxis.h"
#include "TMarker.h"
#include "TPaveText.h"
#include "TGraphAsymmErrors.h"
#include "CommonHeaders/PlottingGammaConversionHistos.h"
#include "CommonHeaders/ExtractSignalBinning.h"
#include "CommonHeaders/PlottingGammaConversionAdditional.h"
#include "CommonHeaders/FittingGammaConversion.h"
#include "CommonHeaders/ConversionFunctionsBasicsAndLabeling.h"
#include "CommonHeaders/ConversionFunctions.h"
#include "CommonHeaders/CombinationFunctions.h"
void CombineGammaResultspPb_V2( TString inputFileNamePCM = "",
TString inputFileNamePHOS = "",
TString inputFileNamePHOS2 = "",
TString inputFileNameEMC = "",
TString inputFileNamePCMEMC = "",
TString suffix = "eps",
Bool_t enablepValueCalc = kFALSE,
Bool_t isThesis = kFALSE,
Int_t fixPHOSspectrum = 0,
TString fileNameCorrelations = ""
){
Int_t nMeasSetDR[5] = {4,4,4,4,4};
Int_t nMeasSetIncGamma[5] = {4,4,4,4,4};
Bool_t combineCent[5] = {kTRUE,kTRUE,kTRUE,kTRUE,kTRUE};
//*******************************************************************************************************************************************
//*********************************************************** Set main style choices ********************************************************
//*******************************************************************************************************************************************
StyleSettingsThesis();
SetPlotStyle();
//*******************************************************************************************************************************************
//********************************************* Create output directory and copy input files there ******************************************
//*******************************************************************************************************************************************
TString dateForOutput = ReturnDateStringForOutput();
TString outputDir = Form("%s/%s/CombineGammaResultspPb_V2",suffix.Data(),dateForOutput.Data());
TString fileNameTheorypPb = "ExternalInputpPb/Theory/TheoryCompilationPPb.root";
TString fileNameIsolatedGamma = "ExternalInputpPb/EMCAL/isolated_photon_invariant_yield_20180417.root";
gSystem->Exec("mkdir -p "+outputDir);
gSystem->Exec(Form("mkdir -p %s/Inputs",outputDir.Data()));
gSystem->Exec(Form("mkdir -p %s/SecCorrPlots",outputDir.Data()));
gSystem->Exec(Form("mkdir -p %s/SecCorrPlots/method",outputDir.Data()));
gSystem->Exec(Form("mkdir -p %s/OtherCorrPlots",outputDir.Data()));
gSystem->Exec(Form("mkdir -p %s/RelUncAndWeights",outputDir.Data()));
gSystem->Exec(Form("mkdir -p %s/SinglePlots",outputDir.Data()));
gSystem->Exec(Form("cp %s %s/Inputs/InputPHOSGammapPb.root", inputFileNamePHOS.Data(), outputDir.Data()));
gSystem->Exec(Form("cp %s %s/Inputs/InputPHOSGammapPbMB.root", inputFileNamePHOS2.Data(), outputDir.Data()));
gSystem->Exec(Form("cp %s %s/Inputs/InputPCMGammapPb.root", inputFileNamePCM.Data(), outputDir.Data()));
gSystem->Exec(Form("cp %s %s/Inputs/InputPCMEMCGammapPb.root", inputFileNamePCMEMC.Data(), outputDir.Data()));
gSystem->Exec(Form("cp %s %s/Inputs/InputEMCGammapPb.root", inputFileNameEMC.Data(), outputDir.Data()));
gSystem->Exec(Form("cp %s %s/Inputs/TheorypPb.root", fileNameTheorypPb.Data(), outputDir.Data()));
gSystem->Exec(Form("cp %s %s/Inputs/CorrelationFactors.root", fileNameCorrelations.Data(), outputDir.Data()));
TString nameFinalResDat = Form("%s/CombinedResultsGamma_FitResults_%s.dat",outputDir.Data(),dateForOutput.Data());
fstream fileFinalResults;
fileFinalResults.open(nameFinalResDat.Data(), ios::out);
//*******************************************************************************************************************************************
//******************************************************* set ranges for plotting ***********************************************************
//*******************************************************************************************************************************************
Double_t doubleRatio[2];
Double_t indMeasRatio[2];
// Double_t incRatio[2];
Double_t doubleRatioX[2];
Double_t doubleRatioXpp[2];
doubleRatio[0] = 0.75; doubleRatio[1] = 1.65;
indMeasRatio[0] = 0.65; indMeasRatio[1] = 1.45;
// incRatio[0] = 0.0; incRatio[1] = 1.7;
doubleRatioX[0] = 0.33; doubleRatioX[1] = 49;
doubleRatioXpp[0] = 0.33; doubleRatioXpp[1] = 49;
Color_t colorCocktailPi0 = kRed+2;
Color_t colorCocktailEta = kBlue+1;
Color_t colorCocktailEtaP = kOrange+1;
Color_t colorCocktailOmega = kYellow+2;
Color_t colorCocktailPhi = kViolet;
Color_t colorCocktailRho0 = kAzure-2;
Color_t colorCocktailSigma0 = kGray+1;
Color_t colorPHSD = kGray+2;
Style_t stylePHSD = 2;
Color_t colorNLOWerner = kAzure+2;
Color_t colorNLOWernerBand = kAzure-9;
Color_t colorNLONCTEQ = kOrange+4;
Color_t colorNLONCTEQBand = kOrange+5;
Color_t colorNLOEPPS = kViolet+3;
Color_t colorNLOEPPSBand = kViolet-8;
Color_t colorNLOMcGill = kGreen+2;
Color_t colorNLOMcGillBand = kGreen-6;
Style_t styleMarkerNLOWerner = 24;
Style_t styleMarkerNLONCTEQ = 27;
Style_t styleMarkerNLOEPPS = 30;
Style_t styleLineNLOWerner = 5;
Style_t styleLineNLONCTEQ = 8;
Style_t styleLineNLOEPPS = 6;
Style_t styleLineMcGill = 7;
Width_t widthLineNLO = 2.;
Double_t ncollpPb5TeV0020 = (14.6+12.2)/2;
Double_t ncollpPb5TeV2040 = (10.5+8.95)/2;
Double_t ncollpPb5TeV4060 = (7.38+5.83)/2;
Double_t ncollpPb5TeV60100 = (4.42+3.2+2.23+1.5)/4;
Double_t ncollpPb5TeVMB = (ncollpPb5TeV0020+ncollpPb5TeV2040+ncollpPb5TeV4060+ncollpPb5TeV60100)/4;
Double_t ncollpPb5TeVAllCent[5] = {ncollpPb5TeV0020,ncollpPb5TeV2040,ncollpPb5TeV4060,ncollpPb5TeV60100,ncollpPb5TeVMB};
TString nameMeasGlobal[11] = { "PCM", "PHOS", "EMCal", "PCM-PHOS", "PCM-EMCal",
"PCM-Dalitz", "PHOS-Dalitz", "EMCal-Dalitz", "EMCal high pT", "EMCal merged",
"PCMOtherDataset"};
TString nameMeasGlobalLabel[11] = { "PCM", "PHOS", "EMC", "PCM-PHOS", "PCM-EMC",
"PCM-Dalitz", "PHOS-Dalitz", "EMC-Dalitz", "EMC high pT", "mEMC",
"PCMOtherDataset"};
Color_t colorDet[11];
Color_t colorDetMC[11];
Color_t colorMult[5];
Style_t markerStyleDet[11];
Style_t markerStyleDetMC[11];
Style_t markerStyleMult[5];
Style_t markerStyleMultOpen[5] = {24,27,24,28,24};
Size_t markerSizeDet[11];
Size_t markerSizeDetMC[11];
Size_t markerSizeMult[5];
TString multbins[5] = {"0-20%","20-40%","40-60%","60-100%",""};
TString multbinsPlot[5] = {"0- 20%","20- 40%","40- 60%","60-100%","0-100%"};
TString multbinsCorrF[5] = {"0020/","2040/","4060/","60100/",""};
TString multbinsPHOS[5] = {"00-20","20-40","40-60","60-100","00-100"};
TString multbinsTheory[5] = {"0020","2040","4060","60100",""};
for (Int_t i = 0; i < 5; i++){
colorMult[i] = GetColorDefaultColor("pPb_5.023TeV", "", multbins[i].Data());
markerStyleMult[i] = GetDefaultMarkerStyle("pPb_5.023TeV", "", multbins[i].Data());
markerSizeMult[i] = GetDefaultMarkerSize("pPb_5.023TeV", "", multbins[i].Data());
}
for (Int_t i = 0; i < 11; i++){
colorDet[i] = GetDefaultColorDiffDetectors(nameMeasGlobal[i].Data(), kFALSE, kFALSE, kTRUE);
colorDetMC[i] = GetDefaultColorDiffDetectors(nameMeasGlobal[i].Data(), kTRUE, kFALSE, kTRUE);
markerStyleDet[i] = GetDefaultMarkerStyleDiffDetectors(nameMeasGlobal[i].Data(), kFALSE);
markerStyleDetMC[i] = GetDefaultMarkerStyleDiffDetectors(nameMeasGlobal[i].Data(), kTRUE);
markerSizeDet[i] = GetDefaultMarkerSizeDiffDetectors(nameMeasGlobal[i].Data(), kFALSE);
markerSizeDetMC[i] = GetDefaultMarkerSizeDiffDetectors(nameMeasGlobal[i].Data(), kTRUE);
}
Color_t colorComb = GetColorDefaultColor("pPb_5.023TeV", "", "");
Style_t markerStyleComb = GetDefaultMarkerStyle("pPb_5.023TeV", "", "");
Size_t markerSizeComb = GetDefaultMarkerSize("pPb_5.023TeV", "", "");
Color_t colorCombpPb = kBlack; //GetColorDefaultColor("pPb_5.023TeV", "", "");
Color_t colorCombpPbBox = kGray+2; //GetColorDefaultColor("pPb_5.023TeV", "", "", kTRUE);
Style_t markerStyleCombpPb = 20; //GetDefaultMarkerStyle("pPb_5.023TeV", "", "");
Size_t markerSizeCombpPb = 1.8; //GetDefaultMarkerSize("pPb_5.023TeV", "", "");
Width_t widthLinesBoxes = 1.4;
Width_t widthCommonFit = 2.4;
Double_t scalingToNSD[5] = {1,1,1,0.97,0.964};
TString collisionSystempPb = "p-Pb, #sqrt{#it{s}_{_{NN}}} = 5.02 TeV";
TString textALICE = "ALICE preliminary";
TString textALICEPerf = "ALICE performance";
if (isThesis) textALICE = "ALICE this thesis";
cout << "Setting Gamma binning" << endl;
Double_t xPtLimitsGamma[5][100] = {0};
Int_t maxNBinsGammaAbs[5] = {0};
Int_t maxNBinsGamma[5];
for(Int_t ncent = 0; ncent < 5; ncent++){
if(ncent<4)
maxNBinsGamma[ncent] = GetBinning( xPtLimitsGamma[ncent], maxNBinsGammaAbs[ncent], "Gamma", "pPb_5.023TeV", 24, kFALSE, multbins[ncent].Data() );
else
maxNBinsGamma[ncent] = GetBinning( xPtLimitsGamma[ncent], maxNBinsGammaAbs[ncent], "Gamma", "pPb_5.023TeV", 23 );
cout << "combination binning used for " << multbins[ncent].Data() << " is:" << endl;
for (Int_t i = 0; i< maxNBinsGamma[ncent]; i++){
cout << i << ": "<< xPtLimitsGamma[ncent][i] <<" - " << xPtLimitsGamma[ncent][i+1]<< ", " <<endl;
}
}
TH1D* histoDRNonFitStatErr[5][11] = { {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}};
TGraphAsymmErrors* graphDRNonFitSysErr[5][11] = { {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}};
TH1D* histoIncGammaRatioStatErr[5][11] = { {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}};
TGraphAsymmErrors* graphIncGammaRatioSysErr[5][11] = { {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}};
TH1D* histoIncGammaStatErr[5][11] = { {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}};
TGraphAsymmErrors* graphIncGammaSysErr[5][11] = { {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}};
TH1D* histoRawGamma[5][11] = { {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}};
TH1D* histoConvProb[5][11] = { {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}};
TH1D* histoEffi[5][11] = { {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}};
TH1D* histoEffiMCPt[5][11] = { {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}};
TH1D* histoResolCorr[5][11] = { {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}};
TH1D* histoPurity[5][11] = { {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}};
TH1D* histoEffSecCorr[4][5][11] = { {{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}},
{{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}},
{{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}},
{{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}}};
TH1D* histoTotalCorrFactor[5][11] = { {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}};
TH1D* histoPileupCorr[5][11] = { {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}};
//*******************************************************************************************************************************************
//*********************************************** Load PCM histograms from pPb PCM file ******************************************************
//*******************************************************************************************************************************************
TFile* filePCMGammapPb = new TFile( inputFileNamePCM.Data());
//________________________________________________ Load PCM pPb 5.023TeV _________________________________________________________________________
if (!filePCMGammapPb->IsZombie()){
for(Int_t i = 0; i<5; i++){
TDirectory* directoryPCMGammapPb = (TDirectory*)filePCMGammapPb->Get(Form("Gamma_pPb5TeV%s",multbins[i].Data()));
if(directoryPCMGammapPb){
cout << "found PCM " << multbins[i].Data() << "input folder... loading spectra:" << endl;
histoDRNonFitStatErr[i][0] = (TH1D*) directoryPCMGammapPb->Get("DoubleRatioStatError");
graphDRNonFitSysErr[i][0] = (TGraphAsymmErrors*) directoryPCMGammapPb->Get("DoubleRatioSystError");
histoIncGammaRatioStatErr[i][0] = (TH1D*) directoryPCMGammapPb->Get("IncRatioStatError");
graphIncGammaRatioSysErr[i][0] = (TGraphAsymmErrors*) directoryPCMGammapPb->Get("IncRatioSystError");
histoConvProb[i][0] = (TH1D*) directoryPCMGammapPb->Get("GammaConversionProbability");
histoEffi[i][0] = (TH1D*) directoryPCMGammapPb->Get("GammaRecoEfficiency");
histoEffiMCPt[i][0] = (TH1D*) directoryPCMGammapPb->Get("GammaRecoEfficiencyMCPt");
histoResolCorr[i][0] = (TH1D*) directoryPCMGammapPb->Get("GammaResolCorr");
histoPurity[i][0] = (TH1D*) directoryPCMGammapPb->Get("GammaTruePurity");
histoIncGammaStatErr[i][0] = (TH1D*) directoryPCMGammapPb->Get("IncGammaStatError");
graphIncGammaSysErr[i][0] = (TGraphAsymmErrors*) directoryPCMGammapPb->Get("IncGammaSystError");
histoPileupCorr[i][0] = (TH1D*) directoryPCMGammapPb->Get("PileUpCorrectionFactor");
histoRawGamma[i][0] = (TH1D*) directoryPCMGammapPb->Get("GammaRawYields");
if (histoIncGammaStatErr[i][0])
histoIncGammaStatErr[i][0]->Scale(scalingToNSD[i]);
if (graphIncGammaSysErr[i][0])
graphIncGammaSysErr[i][0] = ScaleGraph(graphIncGammaSysErr[i][0],scalingToNSD[i]);
histoEffSecCorr[i][0][0] = (TH1D*) directoryPCMGammapPb->Get("GammaEffectiveSecondaryCorr_K0s");
histoEffSecCorr[i][1][0] = (TH1D*) directoryPCMGammapPb->Get("GammaEffectiveSecondaryCorr_K0l");
histoEffSecCorr[i][2][0] = (TH1D*) directoryPCMGammapPb->Get("GammaEffectiveSecondaryCorr_Lambda");
histoEffSecCorr[i][3][0] = (TH1D*) directoryPCMGammapPb->Get("GammaEffectiveSecondaryCorr_Rest");
Int_t j = 1;
while (i==4 ? histoEffi[i][0]->GetBinCenter(j) < 0.3 : histoEffi[i][0]->GetBinCenter(j) < 0.4){
histoEffi[i][0]->SetBinContent(j,1e-10);
histoEffiMCPt[i][0]->SetBinContent(j,1e-10);
histoResolCorr[i][0]->SetBinContent(j,1e10);
histoPurity[i][0]->SetBinContent(j,1e10);
histoIncGammaStatErr[i][0]->SetBinContent(j,0);
histoDRNonFitStatErr[i][0]->SetBinContent(j,0);
histoIncGammaRatioStatErr[i][0]->SetBinContent(j,0);
histoPileupCorr[i][0]->SetBinContent(j,0);
histoEffSecCorr[i][0][0]->SetBinContent(j,1e10);
histoEffSecCorr[i][1][0]->SetBinContent(j,1e10);
histoEffSecCorr[i][2][0]->SetBinContent(j,1e10);
histoEffSecCorr[i][3][0]->SetBinContent(j,1e10);
j++;
}
histoTotalCorrFactor[i][0] = (TH1D*) histoEffi[i][0]->Clone("GammaTotalCorrFactorPCM");
histoTotalCorrFactor[i][0]->Sumw2();
histoTotalCorrFactor[i][0]->Divide(histoPurity[i][0]);
histoTotalCorrFactor[i][0]->Multiply(histoConvProb[i][0]);
cout << "Successfully loaded all inputs" << endl;
}
}
}
//*******************************************************************************************************************************************
//*********************************************** Load PCMEMC histograms from pPb PCM file ******************************************************
//*******************************************************************************************************************************************
TFile* filePCMEMCGammapPb = new TFile( inputFileNamePCMEMC.Data());
//________________________________________________ Load PCM-EMC pPb 5.023TeV _________________________________________________________________________
if (!filePCMEMCGammapPb->IsZombie()){
for(Int_t i = 0; i<5; i++){
TDirectory* directoryPCMEMCGammapPb = (TDirectory*)filePCMEMCGammapPb->Get(Form("Gamma_pPb5TeV%s",multbins[i].Data()));
if(directoryPCMEMCGammapPb){
cout << "found PCMEMC " << multbins[i].Data() << "input folder... loading spectra:" << endl;
histoDRNonFitStatErr[i][4] = (TH1D*) directoryPCMEMCGammapPb->Get("DoubleRatioStatError");
graphDRNonFitSysErr[i][4] = (TGraphAsymmErrors*) directoryPCMEMCGammapPb->Get("DoubleRatioSystError");
histoIncGammaRatioStatErr[i][4] = (TH1D*) directoryPCMEMCGammapPb->Get("IncRatioStatError");
graphIncGammaRatioSysErr[i][4] = (TGraphAsymmErrors*) directoryPCMEMCGammapPb->Get("IncRatioSystError");
histoConvProb[i][4] = (TH1D*) directoryPCMEMCGammapPb->Get("GammaConversionProbability");
histoEffi[i][4] = (TH1D*) directoryPCMEMCGammapPb->Get("GammaRecoEfficiency");
histoEffiMCPt[i][4] = (TH1D*) directoryPCMEMCGammapPb->Get("GammaRecoEfficiencyMCPt");
histoResolCorr[i][4] = (TH1D*) directoryPCMEMCGammapPb->Get("GammaResolCorr");
histoPurity[i][4] = (TH1D*) directoryPCMEMCGammapPb->Get("GammaTruePurity");
histoIncGammaStatErr[i][4] = (TH1D*) directoryPCMEMCGammapPb->Get("IncGammaStatError");
graphIncGammaSysErr[i][4] = (TGraphAsymmErrors*) directoryPCMEMCGammapPb->Get("IncGammaSystError");
histoPileupCorr[i][4] = (TH1D*) directoryPCMEMCGammapPb->Get("PileUpCorrectionFactor");
histoRawGamma[i][4] = (TH1D*) directoryPCMEMCGammapPb->Get("GammaRawYields");
if (histoIncGammaStatErr[i][4])
histoIncGammaStatErr[i][4]->Scale(scalingToNSD[i]);
if (graphIncGammaSysErr[i][4])
graphIncGammaSysErr[i][4] = ScaleGraph(graphIncGammaSysErr[i][4],scalingToNSD[i]);
histoEffSecCorr[i][0][4] = (TH1D*) directoryPCMEMCGammapPb->Get("GammaEffectiveSecondaryCorr_K0s");
histoEffSecCorr[i][1][4] = (TH1D*) directoryPCMEMCGammapPb->Get("GammaEffectiveSecondaryCorr_K0l");
histoEffSecCorr[i][2][4] = (TH1D*) directoryPCMEMCGammapPb->Get("GammaEffectiveSecondaryCorr_Lambda");
histoEffSecCorr[i][3][4] = (TH1D*) directoryPCMEMCGammapPb->Get("GammaEffectiveSecondaryCorr_Rest");
Int_t j = 1;
while (histoEffi[i][4]->GetBinCenter(j) < 0.8){
histoEffi[i][4]->SetBinContent(j,1e-10);
histoEffiMCPt[i][4]->SetBinContent(j,1e-10);
histoResolCorr[i][4]->SetBinContent(j,1e10);
histoPurity[i][4]->SetBinContent(j,1e10);
histoIncGammaStatErr[i][4]->SetBinContent(j,0);
histoDRNonFitStatErr[i][4]->SetBinContent(j,0);
histoIncGammaRatioStatErr[i][4]->SetBinContent(j,0);
histoPileupCorr[i][4]->SetBinContent(j,0);
histoEffSecCorr[i][0][4]->SetBinContent(j,1e10);
histoEffSecCorr[i][1][4]->SetBinContent(j,1e10);
histoEffSecCorr[i][2][4]->SetBinContent(j,1e10);
histoEffSecCorr[i][3][4]->SetBinContent(j,1e10);
j++;
}
histoTotalCorrFactor[i][4] = (TH1D*) histoEffi[i][4]->Clone("GammaTotalCorrFactorPCMEMC");
histoTotalCorrFactor[i][4]->Sumw2();
histoTotalCorrFactor[i][4]->Divide(histoPurity[i][4]);
histoTotalCorrFactor[i][4]->Multiply(histoConvProb[i][4]);
cout << "Successfully loaded all inputs" << endl;
}
}
}
//*******************************************************************************************************************************************
//*********************************************** Load PCM histograms from pPb EMC file ******************************************************
//*******************************************************************************************************************************************
TFile* fileEMCGammapPb = new TFile( inputFileNameEMC.Data());
//________________________________________________ Load EMC pPb 5.023TeV _________________________________________________________________________
if (!fileEMCGammapPb->IsZombie()){
for(Int_t i = 0; i<5; i++){
TDirectory* directoryEMCGammapPb = (TDirectory*)fileEMCGammapPb->Get(Form("Gamma_pPb5TeV%s",multbins[i].Data()));
if(directoryEMCGammapPb){
cout << "found EMC " << multbins[i].Data() << "input folder... loading spectra:" << endl;
histoDRNonFitStatErr[i][2] = (TH1D*) directoryEMCGammapPb->Get("DoubleRatioStatError");
graphDRNonFitSysErr[i][2] = (TGraphAsymmErrors*) directoryEMCGammapPb->Get("DoubleRatioSystError");
histoIncGammaRatioStatErr[i][2] = (TH1D*) directoryEMCGammapPb->Get("IncRatioStatError");
graphIncGammaRatioSysErr[i][2] = (TGraphAsymmErrors*) directoryEMCGammapPb->Get("IncRatioSystError");
histoEffi[i][2] = (TH1D*) directoryEMCGammapPb->Get("GammaRecoEfficiency");
histoEffiMCPt[i][2] = (TH1D*) directoryEMCGammapPb->Get("GammaRecoEfficiencyMCPt");
histoResolCorr[i][2] = (TH1D*) directoryEMCGammapPb->Get("GammaResolCorr");
histoPurity[i][2] = (TH1D*) directoryEMCGammapPb->Get("GammaTruePurity");
histoIncGammaStatErr[i][2] = (TH1D*) directoryEMCGammapPb->Get("IncGammaStatError");
graphIncGammaSysErr[i][2] = (TGraphAsymmErrors*) directoryEMCGammapPb->Get("IncGammaSystError");
histoRawGamma[i][2] = (TH1D*) directoryEMCGammapPb->Get("GammaRawYields");
histoEffSecCorr[i][0][2] = (TH1D*) directoryEMCGammapPb->Get("GammaEffectiveSecondaryCorr_K0s");
histoEffSecCorr[i][1][2] = (TH1D*) directoryEMCGammapPb->Get("GammaEffectiveSecondaryCorr_K0l");
histoEffSecCorr[i][2][2] = (TH1D*) directoryEMCGammapPb->Get("GammaEffectiveSecondaryCorr_Lambda");
histoEffSecCorr[i][3][2] = (TH1D*) directoryEMCGammapPb->Get("GammaEffectiveSecondaryCorr_Rest");
if (histoIncGammaStatErr[i][2])
histoIncGammaStatErr[i][2]->Scale(scalingToNSD[i]);
if (graphIncGammaSysErr[i][2])
graphIncGammaSysErr[i][2] = ScaleGraph(graphIncGammaSysErr[i][2],scalingToNSD[i]);
if(i==4){
while (graphDRNonFitSysErr[i][2]->GetX()[0] < 2.05) graphDRNonFitSysErr[i][2]->RemovePoint(0);
while (graphIncGammaRatioSysErr[i][2]->GetX()[0] < 2.05) graphIncGammaRatioSysErr[i][2]->RemovePoint(0);
while (graphIncGammaSysErr[i][2]->GetX()[0] < 2.05) graphIncGammaSysErr[i][2]->RemovePoint(0);
}
Int_t j = 1;
while (histoDRNonFitStatErr[i][2]->GetBinCenter(j) < 2.05){
histoEffi[i][2]->SetBinContent(j,1e-10);
histoEffiMCPt[i][2]->SetBinContent(j,1e-10);
histoResolCorr[i][2]->SetBinContent(j,1e10);
histoPurity[i][2]->SetBinContent(j,1e10);
histoIncGammaStatErr[i][2]->SetBinContent(j,0);
histoDRNonFitStatErr[i][2]->SetBinContent(j,0);
histoDRNonFitStatErr[i][2]->SetBinError(j,0);
histoIncGammaRatioStatErr[i][2]->SetBinContent(j,0);
histoEffSecCorr[i][0][2]->SetBinContent(j,1e10);
histoEffSecCorr[i][1][2]->SetBinContent(j,1e10);
histoEffSecCorr[i][2][2]->SetBinContent(j,1e10);
histoEffSecCorr[i][3][2]->SetBinContent(j,1e10);
j++;
}
while (graphDRNonFitSysErr[i][2]->GetX()[0] < 2.05) graphDRNonFitSysErr[i][2]->RemovePoint(0);
while (graphIncGammaRatioSysErr[i][2]->GetX()[0] < 2.05) graphIncGammaRatioSysErr[i][2]->RemovePoint(0);
while (graphIncGammaSysErr[i][2]->GetX()[0] < 2.05) graphIncGammaSysErr[i][2]->RemovePoint(0);
histoTotalCorrFactor[i][2] = (TH1D*) histoEffi[i][2]->Clone("GammaTotalCorrFactorEMC");
histoTotalCorrFactor[i][2]->Sumw2();
histoTotalCorrFactor[i][2]->Divide(histoPurity[i][2]);
histoTotalCorrFactor[i][2]->Scale(100/360.*0.66/0.9);
histoTotalCorrFactor[i][2]->GetYaxis()->SetRangeUser(0.01,2);
cout << "Successfully loaded all inputs" << endl;
}
}
}
//*******************************************************************************************************************************************
//*********************************************** Load PHOS histograms from PHOS file *******************************************************
//*******************************************************************************************************************************************
TFile* filePHOSGamma = new TFile( inputFileNamePHOS.Data());
TFile* filePHOSGamma2 = new TFile( inputFileNamePHOS2.Data());
if (!filePHOSGamma->IsZombie()){
for(Int_t i = 0; i<5; i++){
TDirectory* directoryPHOSGammapPb = (TDirectory*)filePHOSGamma->Get(Form("PHOS_pPb_5020_Centrality_%s",multbinsPHOS[i].Data()));
if(i==4)
directoryPHOSGammapPb = (TDirectory*)filePHOSGamma2->Get(Form("PHOS_pPb_5020_Centrality_%s",multbinsPHOS[i].Data()));
if(directoryPHOSGammapPb){
cout << "found PHOS " << multbins[i].Data() << "input folder... loading spectra:" << endl;
histoDRNonFitStatErr[i][1] = (TH1D*) directoryPHOSGammapPb->Get(Form("hPHOS_DoubleRatio_pPb_cen%s_Stat",multbinsPHOS[i].Data()));
TH1D* histoPHOSDRNonFitSysErrpPb = (TH1D*) directoryPHOSGammapPb->Get(Form("hPHOS_DoubleRatio_pPb_cen%s_Syst",multbinsPHOS[i].Data()));
graphDRNonFitSysErr[i][1] = new TGraphAsymmErrors(histoPHOSDRNonFitSysErrpPb);
TF1* fitEffiTimesAccPHOSINT7 = (TF1*) directoryPHOSGammapPb->Get(Form("hPHOS_gammaIncl_pPb_cen%s_Efficiency",multbinsPHOS[i].Data()));
TF1* fitEffiTimesAccPHOSPHI7 = (TF1*) directoryPHOSGammapPb->Get(Form("hPHOS_gammaIncl_pPb_PHI7_cen%s_Efficiency",multbinsPHOS[i].Data()));
histoPurity[i][1] = (TH1D*) histoPHOSDRNonFitSysErrpPb->Clone("GammaTruePurity");
histoEffi[i][1] = (TH1D*) histoPHOSDRNonFitSysErrpPb->Clone("GammaRecoEfficiency");
histoIncGammaStatErr[i][1] = (TH1D*) directoryPHOSGammapPb->Get(Form("hPHOS_gammaIncl_pPb_cen%s_Stat",multbinsPHOS[i].Data()));
TH1D* histoPHOSIncGammaPi0FitSysErrpPb = (TH1D*) directoryPHOSGammapPb->Get(Form("hPHOS_gammaIncl_pPb_cen%s_Syst",multbinsPHOS[i].Data()));
graphIncGammaSysErr[i][1] = new TGraphAsymmErrors(histoPHOSIncGammaPi0FitSysErrpPb);
// if(histoIncGammaStatErr[i][1]->GetBinCenter(histoIncGammaStatErr[i][1]->GetNbinsX()) > 32 ){
// histoIncGammaStatErr[i][1]->SetBinContent(histoIncGammaStatErr[i][1]->GetNbinsX(),0);
// if(histoDRNonFitStatErr[i][1]->GetBinCenter(histoDRNonFitStatErr[i][1]->GetNbinsX()) > 32 )histoDRNonFitStatErr[i][1]->SetBinContent(histoDRNonFitStatErr[i][1]->GetNbinsX(),0);
histoIncGammaStatErr[i][1]->GetXaxis()->SetRangeUser(1.0,32.0);
histoDRNonFitStatErr[i][1]->GetXaxis()->SetRangeUser(1.0,32.0);
while (graphDRNonFitSysErr[i][1]->GetX()[graphDRNonFitSysErr[i][1]->GetN()-1] > 32)
graphDRNonFitSysErr[i][1]->RemovePoint(graphDRNonFitSysErr[i][1]->GetN()-1);
while (graphIncGammaSysErr[i][1]->GetX()[graphIncGammaSysErr[i][1]->GetN()-1] > 32)
graphIncGammaSysErr[i][1]->RemovePoint(graphIncGammaSysErr[i][1]->GetN()-1);
histoTotalCorrFactor[i][1] = (TH1D*) histoEffi[i][1]->Clone("GammaTotalCorrFactorEMC");
histoTotalCorrFactor[i][1]->Sumw2();
histoTotalCorrFactor[i][1]->Scale(60/360.*0.1/0.9);
histoTotalCorrFactor[i][1]->Divide(histoPurity[i][1]);
histoTotalCorrFactor[i][1]->GetYaxis()->SetRangeUser(0.01,2);
cout << "Successfully loaded all inputs" << endl;
}
}
}
multbins[4]="0-100%";
//*******************************************************************************************************************************************
//************************************************ Load theory curves from external input ***************************************************
//*******************************************************************************************************************************************
TFile* fileTheory = new TFile( fileNameTheorypPb.Data());
TGraphAsymmErrors* graphTheoryNLODRpPb[5];
TGraph* graphTheoryNLODRpPbCenter[5];
for(Int_t ncent=0; ncent<4; ncent++){
graphTheoryNLODRpPb[ncent] = (TGraphAsymmErrors*) fileTheory->Get(Form("pPb_5.023TeV/graphRGammaDirectPhotonNLOVogelsangInvYieldINT7_pPb5TeV_CT10_ALICECocktail_%s",multbinsTheory[ncent].Data()));
graphTheoryNLODRpPbCenter[ncent] = (TGraph*) fileTheory->Get(Form("pPb_5.023TeV/graphRGammaDirectPhotonNLOVogelsangInvYieldINT7_pPb5TeV_CT10_ALICECocktail_Center_%s",multbinsTheory[ncent].Data()));
while (graphTheoryNLODRpPb[ncent]->GetX()[0] < 3) graphTheoryNLODRpPb[ncent]->RemovePoint(0);
while (graphTheoryNLODRpPbCenter[ncent]->GetX()[0] < 3) graphTheoryNLODRpPbCenter[ncent]->RemovePoint(0);
}
graphTheoryNLODRpPb[4] = (TGraphAsymmErrors*) fileTheory->Get("pPb_5.023TeV/graphRGammaDirectPhotonNLOVogelsangInvYieldINT7_pPb5TeV_CT10_ALICECocktail");
graphTheoryNLODRpPbCenter[4] = (TGraph*) fileTheory->Get("pPb_5.023TeV/graphRGammaDirectPhotonNLOVogelsangInvYieldINT7_pPb5TeV_CT10_ALICECocktail_Center");
while (graphTheoryNLODRpPb[4]->GetX()[0] < 3) graphTheoryNLODRpPb[4]->RemovePoint(0);
while (graphTheoryNLODRpPbCenter[4]->GetX()[0] < 3) graphTheoryNLODRpPbCenter[4]->RemovePoint(0);
TGraphAsymmErrors* graphTheoryNLOpPb[5];
TGraphAsymmErrors* graphTheoryNLOpPbPrompt[5];
for(Int_t ncent=0; ncent<5; ncent++){
graphTheoryNLOpPb[ncent] = (TGraphAsymmErrors*) fileTheory->Get("pPb_5.023TeV/graphDirectPhotonNLOVogelsangInvYieldINT7_pPb5TeV_CT10");
while (graphTheoryNLOpPb[ncent]->GetX()[0] < 3) graphTheoryNLOpPb[ncent]->RemovePoint(0);
graphTheoryNLOpPb[ncent] = (TGraphAsymmErrors*)ScaleGraph(graphTheoryNLOpPb[ncent], ncollpPb5TeVAllCent[ncent]/ncollpPb5TeVMB);
graphTheoryNLOpPbPrompt[ncent] = (TGraphAsymmErrors*) fileTheory->Get("pPb_5.023TeV/graphPromptPhotonNLOVogelsangInvYieldINT7_pPb5TeV_CT10");
while (graphTheoryNLOpPbPrompt[ncent]->GetX()[0] < 3.5) graphTheoryNLOpPbPrompt[ncent]->RemovePoint(0);
graphTheoryNLOpPbPrompt[ncent] = (TGraphAsymmErrors*)ScaleGraph(graphTheoryNLOpPbPrompt[ncent], ncollpPb5TeVAllCent[ncent]/ncollpPb5TeVMB);
}
TGraphAsymmErrors* graphTheoryMCGillDRpPb = (TGraphAsymmErrors*) fileTheory->Get("pPb_5.023TeV/graphRGammaDirectPhotonSpecMcGill5023GeV_ALICECocktail");
TGraph* graphTheoryMCGillDRpPbCenter = (TGraph*) fileTheory->Get("pPb_5.023TeV/graphRGammaDirectPhotonSpecMcGill5023GeV_ALICECocktail_Center");
TGraphErrors* graphTheoryMCGillpPb = (TGraphErrors*) fileTheory->Get("pPb_5.023TeV/graphDirectPhotonSpecMcGill5023GeV");
TGraphAsymmErrors* graphTheoryMCGillDRpPb0020 = (TGraphAsymmErrors*) fileTheory->Get("pPb_5.023TeV/graphRGammaDirectPhotonSpecMcGill5023GeV_ALICECocktail_0020");
TGraph* graphTheoryMCGillDRpPbCenter0020 = (TGraph*) fileTheory->Get("pPb_5.023TeV/graphRGammaDirectPhotonSpecMcGill5023GeV_ALICECocktail_Center_0020");
TGraphErrors* graphTheoryMCGillpPb0020 = (TGraphErrors*) fileTheory->Get("pPb_5.023TeV/graphDirectPhotonSpecMcGill5023GeV_0020");
TGraphAsymmErrors* graphTheoryPowhegDRnCTEQpPb[5];
TGraph* graphTheoryPowhegDRnCTEQpPbCenter[5];
for(Int_t ncent=0; ncent<4; ncent++){
graphTheoryPowhegDRnCTEQpPb[ncent] = (TGraphAsymmErrors*) fileTheory->Get(Form("pPb_5.023TeV/graphRGammaDirectPhotonPoweheg5023GeV_nCTEQ15_ALICECocktail_%s",multbinsTheory[ncent].Data()));
graphTheoryPowhegDRnCTEQpPbCenter[ncent] = (TGraph*) fileTheory->Get(Form("pPb_5.023TeV/graphRGammaDirectPhotonPoweheg5023GeV_nCTEQ15_ALICECocktail_Center_%s",multbinsTheory[ncent].Data()));
}
graphTheoryPowhegDRnCTEQpPb[4] = (TGraphAsymmErrors*) fileTheory->Get("pPb_5.023TeV/graphRGammaDirectPhotonPoweheg5023GeV_nCTEQ15_ALICECocktail");
graphTheoryPowhegDRnCTEQpPbCenter[4] = (TGraph*) fileTheory->Get("pPb_5.023TeV/graphRGammaDirectPhotonPoweheg5023GeV_nCTEQ15_ALICECocktail_Center");
TGraphAsymmErrors* graphTheoryPowhegDREPPS16pPb[5];
TGraph* graphTheoryPowhegDREPPS16pPbCenter[5];
for(Int_t ncent=0; ncent<4; ncent++){
graphTheoryPowhegDREPPS16pPb[ncent] = (TGraphAsymmErrors*) fileTheory->Get(Form("pPb_5.023TeV/graphRGammaDirectPhotonPoweheg5023GeV_EPPS16_ALICECocktail_%s",multbinsTheory[ncent].Data()));
graphTheoryPowhegDREPPS16pPbCenter[ncent] = (TGraph*) fileTheory->Get(Form("pPb_5.023TeV/graphRGammaDirectPhotonPoweheg5023GeV_EPPS16_ALICECocktail_Center_%s",multbinsTheory[ncent].Data()));
}
graphTheoryPowhegDREPPS16pPb[4] = (TGraphAsymmErrors*) fileTheory->Get("pPb_5.023TeV/graphRGammaDirectPhotonPoweheg5023GeV_EPPS16_ALICECocktail");
graphTheoryPowhegDREPPS16pPbCenter[4] = (TGraph*) fileTheory->Get("pPb_5.023TeV/graphRGammaDirectPhotonPoweheg5023GeV_EPPS16_ALICECocktail_Center");
TGraphAsymmErrors* graphTheoryPowhegnCTEQpPb[5];
TGraphAsymmErrors* graphTheoryPowhegEPPS16pPb[5];
for(Int_t ncent=0; ncent<5; ncent++){
graphTheoryPowhegnCTEQpPb[ncent] = (TGraphAsymmErrors*) fileTheory->Get("pPb_5.023TeV/graphPowhegDirectPhotonInvYieldINT7_pPb5020_nCTEQ15");
graphTheoryPowhegnCTEQpPb[ncent] = (TGraphAsymmErrors*)ScaleGraph(graphTheoryPowhegnCTEQpPb[ncent], ncollpPb5TeVAllCent[ncent]/ncollpPb5TeVMB);
graphTheoryPowhegEPPS16pPb[ncent] = (TGraphAsymmErrors*) fileTheory->Get("pPb_5.023TeV/graphPowhegDirectPhotonInvYieldINT7_pPb5020_EPPS16");
graphTheoryPowhegEPPS16pPb[ncent] = (TGraphAsymmErrors*)ScaleGraph(graphTheoryPowhegEPPS16pPb[ncent], ncollpPb5TeVAllCent[ncent]/ncollpPb5TeVMB);
}
TGraph* graphTheoryDRAlwinaPeTer = (TGraphAsymmErrors*) fileTheory->Get("pPb_5.023TeV/graphRGammaDirectPhotonPeTerAlwina");
TGraph* graphTheoryDRAlwinaPWGGA = (TGraphAsymmErrors*) fileTheory->Get("pPb_5.023TeV/graphRGammaDirectPhotonPWGGAAlwina");
TGraph* graphTheoryDRAlwinaVogelsang = (TGraphAsymmErrors*) fileTheory->Get("pPb_5.023TeV/graphRGammaDirectPhotonVogelsangAlwina");
TGraph* graphTheoryDRAlwinaJetPHOX = (TGraphAsymmErrors*) fileTheory->Get("pPb_5.023TeV/graphRGammaDirectPhotonJETPHOXAlwina");
TFile* fileIsolatedGamma = new TFile(fileNameIsolatedGamma);
TGraphErrors* graphIsolatedGammaStat = (TGraphErrors*) fileIsolatedGamma->Get("invariant_yield_with_stat");
TGraphErrors* graphIsolatedGammaSys = (TGraphErrors*) fileIsolatedGamma->Get("invariant_yield_with_syst");
// Declaration & calculation of combined spectrum
//pcm, phos, emc, pcmphos, pcmemc, dalitz, phosdalitz,emcdalit
Int_t offSetsGamma[5][11] = { { 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{ 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{ 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{ 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{ 2, 8, 2, 0, 0, 0, 0, 0, 0, 0, 0}};
Int_t offSetsGammaSys[5][11] = { { 2, 6, 12, 0, 6, 0, 0, 0, 0, 0, 0},
{ 2, 6, 12, 0, 6, 0, 0, 0, 0, 0, 0},
{ 2, 6, 12, 0, 6, 0, 0, 0, 0, 0, 0},
{ 2, 6, 12, 0, 6, 0, 0, 0, 0, 0, 0},
{ 3, 8, 14, 0, 8, 0, 0, 0, 0, 0, 0}};
TGraphAsymmErrors* statErrorRelCollectionDRNonFit[5][11];
TGraphAsymmErrors* sysErrorRelCollectionDRNonFit[5][11];
TGraph* graphWeightsDR[5][11];
TString fileNameDROutputWeighting[5];
TGraphAsymmErrors* graphCombDRStat[5];
TGraphAsymmErrors* graphCombDRSys[5];
TGraphAsymmErrors* graphCombDRTot[5];
Double_t xValuesDRRead[5][50];
Double_t weightsDRRead[5][11][50];
Int_t availableDRMeas[5][11] = { { -1, -1, -1, -1, -1,-1, -1, -1, -1, -1, -1},
{ -1, -1, -1, -1, -1,-1, -1, -1, -1, -1, -1},
{ -1, -1, -1, -1, -1,-1, -1, -1, -1, -1, -1},
{ -1, -1, -1, -1, -1,-1, -1, -1, -1, -1, -1},
{ -1, -1, -1, -1, -1,-1, -1, -1, -1, -1, -1}};
Int_t nPtBinsDRRead[5] = {0,0,0,0,0};
Int_t textSizeLabelsPixel = 900*0.04;
//pcm, phos, emc, pcmphos, pcmemc, dalitz, phosdalitz,emcdalit
Int_t offSetsIncGamma[5][11] = { { 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{ 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{ 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{ 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{ 2, 8, 2, 0, 0, 0, 0, 0, 0, 0, 0}};
Int_t offSetsIncGammaSys[5][11] = { { 2, 6, 12, 0, 6, 0, 0, 0, 0, 0, 0},
{ 2, 6, 12, 0, 6, 0, 0, 0, 0, 0, 0},
{ 2, 6, 12, 0, 6, 0, 0, 0, 0, 0, 0},
{ 2, 6, 12, 0, 6, 0, 0, 0, 0, 0, 0},
{ 3, 8, 14, 0, 8, 0, 0, 0, 0, 0, 0}};
TGraphAsymmErrors* statErrorGraphCollectionIncGamma[5][11];
TGraphAsymmErrors* statErrorRelCollectionIncGamma[5][11];
TGraphAsymmErrors* sysErrorRelCollectionIncGamma[5][11];
TGraph* graphWeightsIncGamma[5][11];
TString fileNameIncGammaOutputWeighting[5];
TGraphAsymmErrors* graphCombIncGammaStat[5];
TGraphAsymmErrors* graphCombIncGammaSys[5];
TGraphAsymmErrors* graphCombIncGammaTot[5];
Double_t xValuesIncGammaRead[5][50];
Double_t weightsIncGammaRead[5][11][50];
Int_t availableIncGammaMeas[5][11] = { { -1, -1, -1, -1, -1,-1, -1, -1, -1, -1, -1},
{ -1, -1, -1, -1, -1,-1, -1, -1, -1, -1, -1},
{ -1, -1, -1, -1, -1,-1, -1, -1, -1, -1, -1},
{ -1, -1, -1, -1, -1,-1, -1, -1, -1, -1, -1},
{ -1, -1, -1, -1, -1,-1, -1, -1, -1, -1, -1}};
Int_t nPtBinsIncGammaRead[5] = {0,0,0,0,0};
TF1* fitHagGammaComb[5];
TF1* fitTCMGammaComb[5];
TF1* fitTsallisGammaComb[5];
TGraphAsymmErrors* graphCombIncGammaTotUnshi[5];
TGraphAsymmErrors* graphCombIncGammaStatUnshi[5];
TGraphAsymmErrors* graphCombIncGammaSysUnshi[5];
TGraphAsymmErrors* graphIndGammaIncStatUnshi[5][11];
TGraphAsymmErrors* graphIndGammaIncSysUnshi[5][11];
TGraphAsymmErrors* graphIndGammaIncStat[5][11];
TGraphAsymmErrors* graphIndGammaIncSys[5][11];
TGraphAsymmErrors* graphIndGammaIncStat_yShifted[5][11];
TGraphAsymmErrors* graphIndGammaIncSys_yShifted[5][11];
TGraphAsymmErrors* graphRatioGammaIndCombFitStat[5][11];
TGraphAsymmErrors* graphRatioGammaIndCombFitSys[5][11];
TGraphAsymmErrors* graphRatioGammaCombCombFitTot[5];
TGraphAsymmErrors* graphRatioGammaCombCombFitStat[5];
TGraphAsymmErrors* graphRatioGammaCombCombFitSys[5];
TGraphAsymmErrors *graphCombDirGammaSpectrumSystErr[5];
TGraphAsymmErrors *graphCombDirGammaSpectrumStatErr[5];
TGraphAsymmErrors *graphCombDirGammaSpectrumSumErr[5];
TGraphAsymmErrors *graphCombDirGammaSpectrumSumErrConfi[5];
TGraphAsymmErrors *graphCombDirGammaSpectrumSumErrAr[5];
TGraphAsymmErrors* graphCombDRStatPlot[5];
TGraphAsymmErrors* graphCombIncGammaStatPlot[5];
TGraphAsymmErrors* graphCombDirGammaSpectrumStatErrPlot[5];
TGraphAsymmErrors* dummyNLO = new TGraphAsymmErrors(1);
TGraphAsymmErrors* dummyMcGill = new TGraphAsymmErrors(1);
TGraphAsymmErrors* dummyNLOnCTEQ = new TGraphAsymmErrors(1);
TGraphAsymmErrors* dummyNLOEPPS = new TGraphAsymmErrors(1);
//*******************************************************************************************************************************************
//*********************************************** Combining Rgamma ratios ******************************************************************
//*******************************************************************************************************************************************
// Definition of offsets for stat & sys see output of function in shell, make sure pt bins match for Pi0
// {"PCM", "PHOS", "EMCal", "PCM-PHOS", "PCM-EMC", "PCM-Dalitz", "PHOS-Dalitz", "EMCal-Dalitz", "spare", "EMCAL merged","PCMOtherDataset"};
for(Int_t ncent = 0; ncent<5; ncent++){
if(!combineCent[ncent])
continue;
for (Int_t i = 0; i < 11; i++){
statErrorRelCollectionDRNonFit[ncent][i] = NULL;
if (histoDRNonFitStatErr[ncent][i]){
if(ncent==1 && i==1 && fixPHOSspectrum==1){
histoDRNonFitStatErr[ncent][i]->SetBinContent(histoDRNonFitStatErr[ncent][i]->GetNbinsX()-1,histoDRNonFitStatErr[ncent][i]->GetBinContent(histoDRNonFitStatErr[ncent][i]->GetNbinsX()-1)*0.75);
histoDRNonFitStatErr[ncent][i]->SetBinError(histoDRNonFitStatErr[ncent][i]->GetNbinsX()-1,histoDRNonFitStatErr[ncent][i]->GetBinError(histoDRNonFitStatErr[ncent][i]->GetNbinsX()-1)*0.75);
}
statErrorRelCollectionDRNonFit[ncent][i] = new TGraphAsymmErrors(histoDRNonFitStatErr[ncent][i]);
while (statErrorRelCollectionDRNonFit[ncent][i]->GetY()[0] == 0) statErrorRelCollectionDRNonFit[ncent][i]->RemovePoint(0);
while (statErrorRelCollectionDRNonFit[ncent][i]->GetY()[statErrorRelCollectionDRNonFit[ncent][i]->GetN()-1] == 0)
statErrorRelCollectionDRNonFit[ncent][i]->RemovePoint(statErrorRelCollectionDRNonFit[ncent][i]->GetN()-1);
if(i==1){
while (statErrorRelCollectionDRNonFit[ncent][i]->GetX()[statErrorRelCollectionDRNonFit[ncent][i]->GetN()-1] > 33)
statErrorRelCollectionDRNonFit[ncent][i]->RemovePoint(statErrorRelCollectionDRNonFit[ncent][i]->GetN()-1);
}
statErrorRelCollectionDRNonFit[ncent][i] = CalculateRelErrUpAsymmGraph( statErrorRelCollectionDRNonFit[ncent][i], Form("relativeStatErrorDRNonFit_%s", nameMeasGlobal[i].Data()));
}
}
for (Int_t i = 0; i < 11; i++){
sysErrorRelCollectionDRNonFit[ncent][i] = NULL;
cout << i << endl;
if (graphDRNonFitSysErr[ncent][i]){
if(ncent==1 && i==1 && fixPHOSspectrum==1){
graphDRNonFitSysErr[ncent][i]->SetPoint(graphDRNonFitSysErr[ncent][i]->GetN()-1,graphDRNonFitSysErr[ncent][i]->GetX()[graphDRNonFitSysErr[ncent][i]->GetN()-1],graphDRNonFitSysErr[ncent][i]->GetY()[graphDRNonFitSysErr[ncent][i]->GetN()-1]*0.75);
graphDRNonFitSysErr[ncent][i]->SetPointEYhigh(graphDRNonFitSysErr[ncent][i]->GetN()-1,graphDRNonFitSysErr[ncent][i]->GetEYhigh()[graphDRNonFitSysErr[ncent][i]->GetN()-1]*0.75);
graphDRNonFitSysErr[ncent][i]->SetPointEYlow(graphDRNonFitSysErr[ncent][i]->GetN()-1,graphDRNonFitSysErr[ncent][i]->GetEYlow()[graphDRNonFitSysErr[ncent][i]->GetN()-1]*0.75);
}
if(ncent<4 && i==1 && fixPHOSspectrum==2){
for(Int_t bin = 0; bin<graphDRNonFitSysErr[ncent][i]->GetN(); bin++){
graphDRNonFitSysErr[ncent][i]->SetPointEYhigh(bin,graphDRNonFitSysErr[ncent][i]->GetEYhigh()[bin]*1.1);
graphDRNonFitSysErr[ncent][i]->SetPointEYlow(bin,graphDRNonFitSysErr[ncent][i]->GetEYlow()[bin]*1.1);
}
}
sysErrorRelCollectionDRNonFit[ncent][i] = (TGraphAsymmErrors*)graphDRNonFitSysErr[ncent][i]->Clone(Form("relativeSysErrorDRNonFit_%s", nameMeasGlobal[i].Data()));
sysErrorRelCollectionDRNonFit[ncent][i]->Print();
while (sysErrorRelCollectionDRNonFit[ncent][i]->GetY()[0] == 0) sysErrorRelCollectionDRNonFit[ncent][i]->RemovePoint(0);
while (sysErrorRelCollectionDRNonFit[ncent][i]->GetY()[sysErrorRelCollectionDRNonFit[ncent][i]->GetN()-1] == 0) sysErrorRelCollectionDRNonFit[ncent][i]->RemovePoint(sysErrorRelCollectionDRNonFit[ncent][i]->GetN()-1);
sysErrorRelCollectionDRNonFit[ncent][i] = CalculateRelErrUpAsymmGraph( sysErrorRelCollectionDRNonFit[ncent][i], Form("relativeSysErrorDRNonFit_%s", nameMeasGlobal[i].Data()));
cout << "after" << endl;
sysErrorRelCollectionDRNonFit[ncent][i]->Print();
}
}
// **********************************************************************************************************************
// ******************************************* Assuming maximal correlation *********************************************
// **********************************************************************************************************************
for (Int_t i = 0; i< 11; i++){
graphWeightsDR[ncent][i] = NULL;
}
// Declaration & calculation of combined spectrum
fileNameDROutputWeighting[ncent] = Form("%s/DR_WeightingMethod_%s.dat",outputDir.Data(),multbinsPHOS[ncent].Data());
graphCombDRStat[ncent] = NULL;
graphCombDRSys[ncent] = NULL;
graphCombDRTot[ncent] = CombinePtPointsSpectraFullCorrMat( histoDRNonFitStatErr[ncent] , graphDRNonFitSysErr[ncent] ,
xPtLimitsGamma[ncent] , maxNBinsGamma[ncent] ,
offSetsGamma[ncent] , offSetsGammaSys[ncent] ,
graphCombDRStat[ncent] , graphCombDRSys[ncent] ,
fileNameDROutputWeighting[ncent] , "pPb_5.023TeV", "RGamma", kTRUE,
NULL, fileNameCorrelations , multbinsCorrF[ncent].Data());
// NULL, "" );
if (graphCombDRTot[ncent] == NULL) {
cout << "Aborting: something went wrong during the combination of the new spectra for cent " << multbins[ncent].Data() << endl;
return;
}
while (ncent==4 ? graphCombDRStat[ncent]->GetX()[0] < 0.3 : graphCombDRStat[ncent]->GetX()[0] < 0.4){
graphCombDRStat[ncent]->RemovePoint(0);
}
while (ncent==4 ? graphCombDRTot[ncent]->GetX()[0] < 0.3 : graphCombDRTot[ncent]->GetX()[0] < 0.4){
graphCombDRTot[ncent]->RemovePoint(0);
}
while (ncent==4 ? graphCombDRSys[ncent]->GetX()[0] < 0.3 : graphCombDRSys[ncent]->GetX()[0] < 0.4){
graphCombDRSys[ncent]->RemovePoint(0);
}
graphCombDRTot[ncent]->Print();
// return;
// Reading weights from output file for plotting
ifstream fileWeightsDRRead;
fileWeightsDRRead.open(fileNameDROutputWeighting[ncent],ios_base::in);
cout << "reading" << fileNameDROutputWeighting[ncent] << endl;
while(!fileWeightsDRRead.eof() && nPtBinsDRRead[ncent] < 50){
TString garbage = "";
if (nPtBinsDRRead[ncent] == 0){
fileWeightsDRRead >> garbage ;//>> availableDRMeas[0] >> availableDRMeas[1] >> availableDRMeas[2] >> availableDRMeas[3];
for (Int_t i = 0; i < nMeasSetDR[ncent]; i++){
fileWeightsDRRead >> availableDRMeas[ncent][i] ;
}
cout << "read following measurements: ";
for (Int_t i = 0; i < 11; i++){
cout << availableDRMeas[ncent][i] << "\t" ;
}
cout << endl;
} else {
fileWeightsDRRead >> xValuesDRRead[ncent][nPtBinsDRRead[ncent]-1];
for (Int_t i = 0; i < nMeasSetDR[ncent]; i++){
fileWeightsDRRead >> weightsDRRead[ncent][availableDRMeas[ncent][i]][nPtBinsDRRead[ncent]-1] ;
}
cout << "read: "<< nPtBinsDRRead[ncent] << "\t"<< xValuesDRRead[ncent][nPtBinsDRRead[ncent]-1] << "\t" ;
for (Int_t i = 0; i < nMeasSetDR[ncent]; i++){
cout << weightsDRRead[ncent][availableDRMeas[ncent][i]][nPtBinsDRRead[ncent]-1] << "\t";
}
cout << endl;
}
nPtBinsDRRead[ncent]++;
}
nPtBinsDRRead[ncent] = nPtBinsDRRead[ncent]-2 ;
fileWeightsDRRead.close();
for (Int_t i = 0; i < nMeasSetDR[ncent]; i++){
graphWeightsDR[ncent][availableDRMeas[ncent][i]] = new TGraph(nPtBinsDRRead[ncent],xValuesDRRead[ncent],weightsDRRead[ncent][availableDRMeas[ncent][i]]);
Int_t bin = 0;
for (Int_t n = 0; n< nPtBinsDRRead[ncent]; n++){
if (graphWeightsDR[ncent][availableDRMeas[ncent][i]]->GetY()[bin] == 0) graphWeightsDR[ncent][availableDRMeas[ncent][i]]->RemovePoint(bin);
else bin++;
}
}
// **********************************************************************************************************************
// ******************************************* Plotting weights method only EMC *****************************************
// **********************************************************************************************************************
textSizeLabelsPixel = 900*0.04;
TCanvas* canvasWeights = new TCanvas("canvasWeights","",200,10,1350,900); // gives the page size
DrawGammaCanvasSettings( canvasWeights, 0.08, 0.01, 0.01, 0.09);
canvasWeights->SetLogx();
TH1F * histo2DDRWeights;
histo2DDRWeights = new TH1F("histo2DDRWeights","histo2DDRWeights",11000,doubleRatioXpp[0], doubleRatioXpp[1]);
SetStyleHistoTH1ForGraphs(histo2DDRWeights, "#it{p}_{T} (GeV/#it{c})","#omega_{a} for BLUE",0.035,0.04, 0.035,0.04, 1.,1.);
histo2DDRWeights->GetYaxis()->SetRangeUser(-0.7,1.3);
histo2DDRWeights->GetXaxis()->SetMoreLogLabels();
histo2DDRWeights->GetXaxis()->SetLabelOffset(-0.01);
histo2DDRWeights->Draw("copy");
histo2DDRWeights->Draw("copy");
TLegend* legendWeightsDR = GetAndSetLegend2(0.12, 0.14, 0.45, 0.14+(0.04*(nMeasSetDR[ncent]+1)/2), textSizeLabelsPixel, 2, "", 43, 0);
for (Int_t i = 0; i < nMeasSetDR[ncent]; i++){
DrawGammaSetMarkerTGraph(graphWeightsDR[ncent][availableDRMeas[ncent][i]], markerStyleDet[availableDRMeas[ncent][i]], markerSizeDet[availableDRMeas[ncent][i]], colorDet[availableDRMeas[ncent][i]] , colorDet[availableDRMeas[ncent][i]]);
graphWeightsDR[ncent][availableDRMeas[ncent][i]]->Draw("p,same,z");
legendWeightsDR->AddEntry(graphWeightsDR[ncent][availableDRMeas[ncent][i]],nameMeasGlobalLabel[availableDRMeas[ncent][i]],"p");
}
legendWeightsDR->Draw();
TLatex *labelWeightsEnergy = new TLatex(0.95,0.20,Form("%s %s",multbins[ncent].Data(),collisionSystempPb.Data()));
SetStyleTLatex( labelWeightsEnergy, textSizeLabelsPixel, 4, 1, 43, kTRUE, 31);
labelWeightsEnergy->Draw();
TLatex *labelWeightsDR = new TLatex(0.95,0.15,"R_{#gamma}");
SetStyleTLatex( labelWeightsDR, textSizeLabelsPixel, 4, 1, 43, kTRUE, 31);
labelWeightsDR->Draw();
DrawGammaLines(doubleRatioXpp[0], doubleRatioXpp[1], 0.5, 0.5,0.1, kGray, 7);
DrawGammaLines(doubleRatioXpp[0], doubleRatioXpp[1], 0.4, 0.4,0.1, kGray, 1);
DrawGammaLines(doubleRatioXpp[0], doubleRatioXpp[1], 0.3, 0.3,0.1, kGray, 7);
DrawGammaLines(doubleRatioXpp[0], doubleRatioXpp[1], 0.2, 0.2,0.1, kGray, 3);
canvasWeights->SaveAs(Form("%s/RelUncAndWeights/DR_Weights_%s.%s",outputDir.Data(),multbinsPHOS[ncent].Data(),suffix.Data()));
canvasWeights->SaveAs(Form("%s/RelUncAndWeights/DR_Weights_%s.pdf",outputDir.Data(),multbinsPHOS[ncent].Data()));
// *********************************************************************************************************************
// ************************************ Visualize relative errors ******************************************************
// *********************************************************************************************************************
TCanvas* canvasRelSysErr = new TCanvas("canvasRelSysErr","",200,10,1350,900); // gives the page size
DrawGammaCanvasSettings( canvasRelSysErr, 0.08, 0.02, 0.035, 0.09);
canvasRelSysErr->SetLogx();
TH2F * histo2DRelSysErr;
histo2DRelSysErr = new TH2F("histo2DRelSysErr","histo2DRelSysErr",11000,doubleRatioXpp[0], doubleRatioXpp[1],1000,0,50.0);
SetStyleHistoTH2ForGraphs(histo2DRelSysErr, "#it{p}_{T} (GeV/#it{c})","sys Err (%)",0.035,0.04, 0.035,0.04, 1.,1.);
histo2DRelSysErr->GetYaxis()->SetRangeUser(0,24.5);
histo2DRelSysErr->GetXaxis()->SetMoreLogLabels();
histo2DRelSysErr->GetXaxis()->SetLabelOffset(-0.01);
histo2DRelSysErr->Draw("copy");
TLegend* legendRelSysErr2 = GetAndSetLegend2(0.62, 0.92-(0.04*(nMeasSetDR[ncent]+1)/2), 0.95, 0.92, textSizeLabelsPixel, 2, "", 43, 0);
for (Int_t i = 0; i < nMeasSetDR[ncent]; i++){
cout << "sys\t" << nameMeasGlobalLabel[availableDRMeas[ncent][i]] << endl;
DrawGammaSetMarkerTGraph(sysErrorRelCollectionDRNonFit[ncent][availableDRMeas[ncent][i]], markerStyleDet[availableDRMeas[ncent][i]], markerSizeDet[availableDRMeas[ncent][i]], colorDet[availableDRMeas[ncent][i]],
colorDet[availableDRMeas[ncent][i]]);
sysErrorRelCollectionDRNonFit[ncent][availableDRMeas[ncent][i]]->Draw("p,same,z");
sysErrorRelCollectionDRNonFit[ncent][availableDRMeas[ncent][i]]->Print();
legendRelSysErr2->AddEntry(sysErrorRelCollectionDRNonFit[ncent][availableDRMeas[ncent][i]],nameMeasGlobalLabel[availableDRMeas[ncent][i]],"p");
}
legendRelSysErr2->Draw();
TLatex *labelRelSysErrEnergy = new TLatex(0.15,0.89,Form("%s %s",multbins[ncent].Data(),collisionSystempPb.Data()));
SetStyleTLatex( labelRelSysErrEnergy, textSizeLabelsPixel, 4, 1, 43);
labelRelSysErrEnergy->Draw();
TLatex *labelRelSysErrDR = new TLatex(0.15,0.85,"R_{#gamma}");
SetStyleTLatex( labelRelSysErrDR, textSizeLabelsPixel, 4, 1, 43);
labelRelSysErrDR->Draw();
canvasRelSysErr->SaveAs(Form("%s/RelUncAndWeights/DR_RelSysErr_%s.%s",outputDir.Data(),multbinsPHOS[ncent].Data(),suffix.Data()));
canvasRelSysErr->SaveAs(Form("%s/RelUncAndWeights/DR_RelSysErr_%s.pdf",outputDir.Data(),multbinsPHOS[ncent].Data()));
// *********************************************************************************************************************
// ************************************ Visualize relative errors ******************************************************
// *********************************************************************************************************************
TCanvas* canvasRelStatErr = new TCanvas("canvasRelStatErr","",200,10,1350,900); // gives the page size
DrawGammaCanvasSettings( canvasRelStatErr, 0.08, 0.02, 0.035, 0.09);
canvasRelStatErr->SetLogx();
TH2F * histo2DRelStatErr;
histo2DRelStatErr = new TH2F("histo2DRelStatErr","",11000,doubleRatioXpp[0], doubleRatioXpp[1],1000,0,50.5);
SetStyleHistoTH2ForGraphs(histo2DRelStatErr, "#it{p}_{T} (GeV/#it{c})","stat Err (%)",0.035,0.04, 0.035,0.04, 1.,1.);
histo2DRelStatErr->GetYaxis()->SetRangeUser(0,40.5);
histo2DRelStatErr->GetXaxis()->SetMoreLogLabels();
histo2DRelStatErr->GetXaxis()->SetLabelOffset(-0.01);
histo2DRelStatErr->Draw("copy");
TLegend* legendRelStatErr2 = GetAndSetLegend2(0.14, 0.92-(0.04*(nMeasSetDR[ncent]+1)/2), 0.45, 0.92, textSizeLabelsPixel, 2, "", 43, 0);
for (Int_t i = 0; i < nMeasSetDR[ncent]; i++){
DrawGammaSetMarkerTGraph(statErrorRelCollectionDRNonFit[ncent][availableDRMeas[ncent][i]], markerStyleDet[availableDRMeas[ncent][i]], markerSizeDet[availableDRMeas[ncent][i]], colorDet[availableDRMeas[ncent][i]],
colorDet[availableDRMeas[ncent][i]]);
statErrorRelCollectionDRNonFit[ncent][availableDRMeas[ncent][i]]->Draw("p,same,z");
legendRelStatErr2->AddEntry(statErrorRelCollectionDRNonFit[ncent][availableDRMeas[ncent][i]],nameMeasGlobalLabel[availableDRMeas[ncent][i]],"p");
}
legendRelStatErr2->Draw();
TLatex *labelRelStatErrEnergy = new TLatex(0.95,0.89,Form("%s %s",multbins[ncent].Data(),collisionSystempPb.Data()));
SetStyleTLatex( labelRelStatErrEnergy, textSizeLabelsPixel, 4, 1, 43, kTRUE, 31);
labelRelStatErrEnergy->Draw();
TLatex *labelRelStatErrDR = new TLatex(0.95,0.85,"R_{#gamma}");
SetStyleTLatex( labelRelStatErrDR, textSizeLabelsPixel, 4, 1, 43, kTRUE, 31);
labelRelStatErrDR->Draw();
canvasRelStatErr->SaveAs(Form("%s/RelUncAndWeights/DR_RelStatErr_%s.%s",outputDir.Data(),multbinsPHOS[ncent].Data(),suffix.Data()));
canvasRelStatErr->SaveAs(Form("%s/RelUncAndWeights/DR_RelStatErr_%s.pdf",outputDir.Data(),multbinsPHOS[ncent].Data()));
// *********************************************************************************************************************
// ************************************ Visualize relative errors ******************************************************
// *********************************************************************************************************************
TGraphAsymmErrors* graphCombDRRelStat = CalculateRelErrUpAsymmGraph( graphCombDRStat[ncent], "relativeStatErrorDR");
TGraphAsymmErrors* graphCombDRRelSys = CalculateRelErrUpAsymmGraph( graphCombDRSys[ncent], "relativeSysErrorDR");
TGraphAsymmErrors* graphCombDRRelTot = CalculateRelErrUpAsymmGraph( graphCombDRTot[ncent], "relativeTotalErrorDR");
canvasRelSysErr->cd();
TH2F * histo2DRelErr;
histo2DRelErr = new TH2F("histo2DRelErr","histo2DRelErr",11000,doubleRatioXpp[0], doubleRatioXpp[1],1000,0,50.0);
SetStyleHistoTH2ForGraphs(histo2DRelErr, "#it{p}_{T} (GeV/#it{c})","Err (%)",0.035,0.04, 0.035,0.04, 1.,1.);
histo2DRelErr->GetYaxis()->SetRangeUser(0,40.5);
histo2DRelErr->GetXaxis()->SetMoreLogLabels();
histo2DRelErr->GetXaxis()->SetLabelOffset(-0.01);
histo2DRelErr->Draw("copy");
DrawGammaSetMarkerTGraphAsym(graphCombDRRelTot, markerStyleComb, markerSizeComb, colorComb , colorComb);
graphCombDRRelTot->Draw("p,same,z");
DrawGammaSetMarkerTGraphAsym(graphCombDRRelStat, markerStyleComb, markerSizeComb, colorComb-6 , colorComb-6);
graphCombDRRelStat->Draw("l,x0,same,e1");
DrawGammaSetMarkerTGraphAsym(graphCombDRRelSys, markerStyleComb, markerSizeComb, colorComb+2, colorComb+2);
graphCombDRRelSys->SetLineStyle(7);
graphCombDRRelSys->Draw("l,x0,same,e1");
TLegend* legendRelTotErr = GetAndSetLegend2(0.14, 0.92-(0.035*3), 0.45, 0.92, 32);
legendRelTotErr->AddEntry(graphCombDRRelTot,"tot","p");
legendRelTotErr->AddEntry(graphCombDRRelStat,"stat","l");
legendRelTotErr->AddEntry(graphCombDRRelSys,"sys","l");
legendRelTotErr->Draw();
TLatex *labelRelTotErrEnergy = new TLatex(0.95,0.89,Form("%s %s",multbins[ncent].Data(),collisionSystempPb.Data()));
SetStyleTLatex( labelRelTotErrEnergy, textSizeLabelsPixel, 4, 1, 43, kTRUE, 31);
labelRelTotErrEnergy->Draw();
TLatex *labelRelTotErrDR = new TLatex(0.95,0.85,"R_{#gamma}");
SetStyleTLatex( labelRelTotErrDR, textSizeLabelsPixel, 4, 1, 43, kTRUE, 31);
labelRelTotErrDR->Draw();
canvasRelSysErr->SaveAs(Form("%s/RelUncAndWeights/DR_Reldecomp_%s.%s",outputDir.Data(),multbinsPHOS[ncent].Data(),suffix.Data()));
//*******************************************************************************************************************************************
//*********************************************** Combining Inc gamma spectra **************************************************************
//*******************************************************************************************************************************************
// Definition of offsets for stat & sys see output of function in shell, make sure pt bins match for Pi0
// {"PCM", "PHOS", "EMCal", "PCM-PHOS", "PCM-EMC", "PCM-Dalitz", "PHOS-Dalitz", "EMCal-Dalitz", "spare", "EMCAL merged","PCMOtherDataset"};
for (Int_t i = 0; i< 11; i++){
statErrorGraphCollectionIncGamma[ncent][i] = NULL;
}
for (Int_t i = 0; i < 11; i++){