-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCombineMesonMeasurements8TeV_2.C
3478 lines (2938 loc) · 239 KB
/
CombineMesonMeasurements8TeV_2.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
/****************************************************************************************************************************
****** provided by Gamma Conversion Group, PWG4, *****
****** Daniel Mühlheim, [email protected] *****
****** Friederike Bock, [email protected] *****
*****************************************************************************************************************************/
#include <Riostream.h>
#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 "TGraphAsymmErrors.h"
#include "TGaxis.h"
#include "TMarker.h"
#include "Math/WrappedTF1.h"
#include "Math/BrentRootFinder.h"
#include "TFitResultPtr.h"
#include "TFitResult.h"
#include "CommonHeaders/PlottingGammaConversionHistos.h"
#include "CommonHeaders/PlottingGammaConversionAdditional.h"
#include "CommonHeaders/FittingGammaConversion.h"
#include "CommonHeaders/ExtractSignalBinning.h"
// #include "CommonHeaders/ConversionFunctionsBasicsAndLabeling.h"
#include "CommonHeaders/ConversionFunctions.h"
#include "CommonHeaders/CombinationFunctions.h"
extern TRandom* gRandom;
extern TBenchmark* gBenchmark;
extern TSystem* gSystem;
extern TMinuit* gMinuit;
struct SysErrorConversion {
Double_t value;
Double_t error;
// TString name;
};
//____________________________________________________________________________________________________________________________________________
void CombineMesonMeasurements8TeV_2( TString fileNamePCM = "",
TString fileNamePCMEMCAL = "",
TString fileNameEMCALLow = "",
TString fileNameEMCALmerged = "",
TString fileNamePHOS = "",
TString suffix = "eps",
TString isMC = "",
TString thesisPlots = "",
TString bWCorrection = "X",
TString fileInputCorrFactors= "",
Bool_t plotInvMassBins = kTRUE
){
TString date = ReturnDateString();
gROOT->Reset();
gROOT->SetStyle("Plain");
StyleSettingsThesis();
SetPlotStyle();
gStyle->SetEndErrorSize(0);
TString dateForOutput = ReturnDateStringForOutput();
cout << dateForOutput.Data() << endl;
//___________________________________ Declaration of files _____________________________________________
TString collisionSystem8TeV = "pp, #sqrt{#it{s}} = 8 TeV";
TString fileNameTheory = "ExternalInput/Theory/TheoryCompilationPP.root";
TString fileNameTheoryPythia8 = "ExternalInput/Theory/Pythia/PYTHIA8_Monash2013Tune_8TeV_Pi0_Eta.root";
TString fileNameTheoryPythia8_4C = "ExternalInput/Theory/Pythia/PYTHIA8_4CTune_8TeV_Pi0_Eta.root";
TString fileNameTheoryPi0DSS14 = "ExternalInput/Theory/pp8TeV_DSS14.root";
TString fileNameEtaToPi07TeV = "ExternalInput/EtaPi0Ratio7000GeV.root";
TString fileNameEtaToPi02760GeV = "ExternalInput/CombNeutralMesons/CombinedResultsPaperPP2760GeV_2017_07_10_Pub2017.root";
TString fileNamePHOSMB = "ExternalInput/PHOS/8TeV/data_PHOS-MBResultsFullCorrection_PP_NoBinShifting.root";
TString fileNamePHOSPHOS = "ExternalInput/PHOS/8TeV/data_PHOS-PHOSResultsFullCorrection_PP_NoBinShifting.root";
TString fileNamePHOSprelim = "ExternalInput/PHOS/8TeV/preliminary/pi0_8TeV_PHOS.root";
TString fileNameChargedPionPP = "ExternalInput/IdentifiedCharged/ChargedIdentifiedSpectraPP_20_May_2015.root";
TString fileNameChargedHadronPP = "ExternalInput/UnidentifiedCharged/ChargedHadrinSpectraPP_20_May_2015.root";
TString outputDir = Form("%s/%s/CombineMesonMeasurements8TeV_merged%s",suffix.Data(),dateForOutput.Data(),bWCorrection.Data());
TString nameFinalResDat = Form("%s/CombinedResults%s_FitResults.dat",outputDir.Data(),bWCorrection.Data());
cout << outputDir.Data() << endl;
cout << fileNamePCM.Data() << endl;
gSystem->Exec("mkdir -p "+outputDir);
gSystem->Exec(Form("cp %s %s/InputPCM.root", fileNamePCM.Data(), outputDir.Data()));
// gSystem->Exec(Form("cp %s %s/InputPCMEta.root", fileNamePCMEta.Data(), outputDir.Data()));
gSystem->Exec(Form("cp %s %s/InputPCMEMCAL.root", fileNamePCMEMCAL.Data(), outputDir.Data()));
gSystem->Exec(Form("cp %s %s/InputPHOS.root", fileNamePHOS.Data(), outputDir.Data()));
gSystem->Exec(Form("cp %s %s/InputEMCALLow.root", fileNameEMCALLow.Data(), outputDir.Data()));
gSystem->Exec(Form("cp %s %s/InputEMCALmerged.root", fileNameEMCALmerged.Data(), outputDir.Data()));
gSystem->Exec(Form("cp %s %s/Theory.root", fileNameTheory.Data(), outputDir.Data()));
gSystem->Exec(Form("cp %s %s/ChargedPionsPP.root", fileNameChargedPionPP.Data(), outputDir.Data()));
gSystem->Exec(Form("cp %s %s/ChargedHadronsPP.root", fileNameChargedHadronPP.Data(), outputDir.Data()));
Bool_t thesis = kFALSE;
if(thesisPlots.CompareTo("thesis") == 0){
thesis = kTRUE;
}
TString prefix2 = "";
if (isMC.CompareTo("kTRUE")==0){
prefix2 = "MC";
} else {
prefix2 = "Data";
}
Double_t mesonMassExpectPi0 = TDatabasePDG::Instance()->GetParticle(111)->Mass();
Double_t mesonMassExpectEta = TDatabasePDG::Instance()->GetParticle(221)->Mass();
Width_t widthLinesBoxes = 1.4;
Width_t widthCommonFit = 2;
// Definition of colors, styles and markers sizes
Color_t colorComb = kMagenta+2;
Style_t markerStyleComb = 20;
Size_t markerSizeComb = 2;
Color_t colorCombLowPt = GetDefaultColorDiffDetectors("Comb", kFALSE, kFALSE, kFALSE);
Color_t colorCombHighPt = GetDefaultColorDiffDetectors("Comb", kFALSE, kFALSE, kTRUE);
Style_t markerStyleCombLowPt = 20;
Style_t markerStyleCombHighPt = 20;
Size_t markerSizeComparison = 2;
Color_t colorTrigg [10] = {kBlack, kGray+1, kRed+2, kBlue+2, kGreen+3, kCyan+2, kViolet, kMagenta+2, kRed-2, kBlue-2};
Color_t colorTriggShade [10] = {kGray+1, kGray, kRed-6, kBlue-6, kGreen-8, kCyan-6, kViolet-8, kMagenta-8, kRed-8, kBlue-8};
Marker_t markerTrigg [10] = {20, 20, 21, 34, 29, 33, 21, 27, 28, 30 };
Marker_t markerTriggMC [10] = {24, 24, 25, 28, 30, 27, 25, 27, 28, 30 };
Size_t sizeTrigg [10] = {1.5, 1.5, 1.5, 2, 2.2, 2., 1.5, 2., 2.5, 1.5 };
TString nameMeasGlobal[11] = { "PCM", "PHOS", "EMCal", "PCM-PHOS", "PCM-EMCal",
"PCM-Dalitz", "PHOS-Dalitz", "EMCal-Dalitz", "EMCal high pT", "EMCal merged",
"PCMOtherDataset"};
TString nameSecPi0SourceRead[4] = {"K0S", "K0L", "Lambda", "Rest"};
TString nameSecPi0SourceLabel[4] = {"K^{0}_{s}", "K^{0}_{l}", "#Lambda", "had. int."};
TString nameTrigger[3] = {"INT7", "EMC7", "EGA"};
TString nameTriggerAlternative[3] = {"MB trigger", "EMC-L0 trigger", "EMC-L1 trigger"};
Color_t colorDet[11];
Color_t colorDetMC[11];
Style_t markerStyleDet[11];
Style_t markerStyleDetMC[11];
Size_t markerSizeDet[11];
Size_t markerSizeDetMC[11];
Color_t colorNLO = kAzure-4;
Style_t styleMarkerNLOMuHalf = 24;
Style_t styleMarkerNLOMuOne = 27;
Style_t styleMarkerNLOMuTwo = 30;
Style_t styleLineNLOMuHalf = 8;
Style_t styleLineNLOMuOne = 7;
Style_t styleLineNLOMuTwo = 4;
Style_t styleLineNLOMuTwoBKK = 3;
Style_t styleLineNLOMuTwoDSS = 6;
Size_t sizeMarkerNLO = 1;
Width_t widthLineNLO = 2.;
Int_t binExInvMass[11] = { 7, 0, 12, 0, 7,
0, 0, 0, 0, 0,
0 };
Double_t rangePtExMin[11] = { 1.6, 1.4, 2.6, 0.0, 1.6,
0.0, 0.0, 0.0, 9.0, 0.0,
20.0 };
Double_t rangePtExMax[11] = { 1.8, 1.6, 3.0, 0.0, 1.8,
0.0, 0.0, 0.0, 10., 0.0,
22.0 };
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)*2;
markerSizeDetMC[i] = GetDefaultMarkerSizeDiffDetectors(nameMeasGlobal[i].Data(), kTRUE)*2;
}
Bool_t haveEffSecCorr[4][11] = { {kFALSE, kFALSE, kFALSE, kFALSE, kFALSE, kFALSE, kFALSE, kFALSE, kFALSE, kFALSE, kFALSE},
{kFALSE, kFALSE, kFALSE, kFALSE, kFALSE, kFALSE, kFALSE, kFALSE, kFALSE, kFALSE, kFALSE},
{kFALSE, kFALSE, kFALSE, kFALSE, kFALSE, kFALSE, kFALSE, kFALSE, kFALSE, kFALSE, kFALSE},
{kFALSE, kFALSE, kFALSE, kFALSE, kFALSE, kFALSE, kFALSE, kFALSE, kFALSE, kFALSE, kFALSE} };
TGraphAsymmErrors* graphPi0EffSecCorrFromX[4][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} };
//************************** Read data for PCM **************************************************
TFile* filePCM = new TFile(fileNamePCM.Data());
TH1D* histoPCMNumberOfEvents = (TH1D*)filePCM->Get("NEvents_MB");
TDirectory* directoryPCMPi0 = (TDirectory*)filePCM->Get("Pi08TeV");
TH1D* histoPCMPi0Mass = (TH1D*)directoryPCMPi0->Get("Pi0_Mass_data_MB");
histoPCMPi0Mass ->Scale(1000.);
TH1D* histoPCMPi0FWHMMeV = (TH1D*)directoryPCMPi0->Get("Pi0_Width_data_MB");
histoPCMPi0FWHMMeV ->Scale(1000.);
TH1D* histoPCMPi0TrueMass = (TH1D*)directoryPCMPi0->Get("Pi0_Mass_MC_MB");
histoPCMPi0TrueMass ->Scale(1000.);
TH1D* histoPCMPi0TrueFWHMMeV = (TH1D*)directoryPCMPi0->Get("Pi0_Width_MC_MB");
histoPCMPi0TrueFWHMMeV ->Scale(1000.);
TH1D* histoPCMPi0Acc = (TH1D*)directoryPCMPi0->Get("AcceptancePi0_MB");
TH1D* histoPCMPi0TrueEffPt = (TH1D*)directoryPCMPi0->Get("EfficiencyPi0_MB");
TGraphAsymmErrors* graphPCMPi0AccTimesEff = (TGraphAsymmErrors*)directoryPCMPi0->Get("EffTimesAccPi0");
for (Int_t k = 0; k < 4; k++){
graphPi0EffSecCorrFromX[k][0] = (TGraphAsymmErrors*)directoryPCMPi0->Get(Form("EffectiveSecondaryPi0CorrFrom%s",nameSecPi0SourceRead[k].Data()));
if (graphPi0EffSecCorrFromX[k][0]){
cout << nameSecPi0SourceRead[k].Data() << endl;
graphPi0EffSecCorrFromX[k][0]->Print();
Int_t nAboveZero = 0;
for (Int_t i = 0; i< graphPi0EffSecCorrFromX[k][0]->GetN(); i++){
if(graphPi0EffSecCorrFromX[k][0]->GetY()[i] > 0) nAboveZero++;
}
if (nAboveZero>0){
haveEffSecCorr[k][0] = kTRUE;
} else {
graphPi0EffSecCorrFromX[k][0] = NULL;
}
}
}
TGraphAsymmErrors* graphPCMPi0InvXSectionStat = (TGraphAsymmErrors*)directoryPCMPi0->Get("graphInvCrossSectionPi0");
TH1D* histoPCMPi0InvXSectionStat = (TH1D*)directoryPCMPi0->Get("InvCrossSectionPi0");
cout << "Pi0 stat PCM" << endl;
graphPCMPi0InvXSectionStat->Print();
TGraphAsymmErrors* graphPCMPi0InvXSectionSys = (TGraphAsymmErrors*)directoryPCMPi0->Get("InvCrossSectionPi0Sys");
cout << "Pi0 sys PCM" << endl;
graphPCMPi0InvXSectionSys->Print();
TH1D* histoPCMPi0AccTimesEff = (TH1D*)histoPCMPi0TrueEffPt->Clone("histoPCMPi0AccTimesEff");
histoPCMPi0AccTimesEff->Multiply(histoPCMPi0Acc);
// normalize to full acceptance (delta y and phi)
histoPCMPi0AccTimesEff->Scale(2*TMath::Pi()*1.6);
TH1D* histoPi0InvMassSigPlusBGPCM[3];
TH1D* histoPi0InvMassSigPCM[3];
TH1D* histoPi0InvMassSigRemBGSubPCM[3];
TH1D* histoPi0InvMassBGPCM[3];
TH1D* histoPi0InvMassRemBGPCM[3];
TH1D* histoPi0InvMassBGTotPCM[3];
TF1* fitPi0InvMassSigPCM[3];
TF1* fitPi0InvMassBGPCM[3];
Bool_t haveAllPi0InvMassPCM[3] = {kFALSE, kFALSE, kFALSE};
if (plotInvMassBins){
for (Int_t i = 0; i < 1; i++){
histoPi0InvMassSigPCM[i] = (TH1D*)directoryPCMPi0->Get("InvMassSig_PtBin07");
histoPi0InvMassSigPlusBGPCM[i] = (TH1D*)directoryPCMPi0->Get("InvMassSigPlusBG_PtBin07");
histoPi0InvMassBGPCM[i] = (TH1D*)directoryPCMPi0->Get("InvMassBG_PtBin07");
fitPi0InvMassSigPCM[i] = (TF1*)directoryPCMPi0->Get("FitInvMassSig_PtBin07");
if (histoPi0InvMassSigPCM[i] && histoPi0InvMassSigPlusBGPCM[i] && histoPi0InvMassBGPCM[i] && fitPi0InvMassSigPCM[i]){
haveAllPi0InvMassPCM[i] = kTRUE;
}
if (haveAllPi0InvMassPCM[i]){
histoPi0InvMassSigPCM[i]->Fit(fitPi0InvMassSigPCM[i],"QRME0");
for (Int_t l=0; l < 6; l++){
cout << fitPi0InvMassSigPCM[i]->GetParameter(l) << "\t +- " << fitPi0InvMassSigPCM[i]->GetParError(l) << endl;
}
fitPi0InvMassBGPCM[i] = new TF1("Linearpp","[0]+[1]*x",0.02,0.25);
fitPi0InvMassBGPCM[i]->SetParameter(0, fitPi0InvMassSigPCM[i]->GetParameter(4));
fitPi0InvMassBGPCM[i]->SetParameter(1, fitPi0InvMassSigPCM[i]->GetParameter(5));
TVirtualFitter * fitterPCM = TVirtualFitter::GetFitter();
Int_t nFreeParPCM = fitPi0InvMassSigPCM[i]->GetNumberFreeParameters();
double * covMatrixPCM = fitterPCM->GetCovarianceMatrix();
histoPi0InvMassRemBGPCM[i] = (TH1D*)histoPi0InvMassBGPCM[i]->Clone(Form("Pi0_InvMassRemBG_Example_%s",nameTrigger[i].Data()));
for (Int_t j = 1; j < histoPi0InvMassRemBGPCM[i]->GetNbinsX()+1; j++){
histoPi0InvMassRemBGPCM[i]->SetBinContent(j,0);
histoPi0InvMassRemBGPCM[i]->SetBinError(j,0);
}
for (Int_t j = histoPi0InvMassSigPCM[i]->GetXaxis()->FindBin(0.01); j < histoPi0InvMassSigPCM[i]->GetXaxis()->FindBin(0.30)+1; j++){
Double_t startBinEdge = histoPi0InvMassSigPCM[i]->GetXaxis()->GetBinLowEdge(j);
Double_t endBinEdge = histoPi0InvMassSigPCM[i]->GetXaxis()->GetBinUpEdge(j);
Double_t intLinearBack = fitPi0InvMassBGPCM[i]->Integral(startBinEdge, endBinEdge)/(endBinEdge-startBinEdge) ;
Double_t errorLinearBck = pow(( pow( (endBinEdge-startBinEdge)*fitPi0InvMassSigPCM[i]->GetParError(4),2) +
pow(0.5*(endBinEdge*endBinEdge-startBinEdge*startBinEdge)*fitPi0InvMassSigPCM[i]->GetParError(5),2)
+2*covMatrixPCM[nFreeParPCM*nFreeParPCM-2]*(endBinEdge-startBinEdge)*0.5*
(endBinEdge*endBinEdge-startBinEdge*startBinEdge)),0.5)/(endBinEdge-startBinEdge);
// cout << j << "\t" << intLinearBack << "\t" << errorLinearBck << endl;
histoPi0InvMassRemBGPCM[i]->SetBinContent(j,intLinearBack);
histoPi0InvMassRemBGPCM[i]->SetBinError(j,errorLinearBck);
}
histoPi0InvMassBGTotPCM[i] = (TH1D*)histoPi0InvMassBGPCM[i]->Clone(Form("Pi0_InvMassTotBG_Example_%s",nameTrigger[i].Data()));
histoPi0InvMassBGTotPCM[i]->Sumw2();
histoPi0InvMassBGTotPCM[i]->Add(histoPi0InvMassRemBGPCM[i]);
histoPi0InvMassSigRemBGSubPCM[i] = (TH1D*)histoPi0InvMassSigPCM[i]->Clone(Form("Pi0_InvMassSigRemBGSub_Example_%s",nameTrigger[i].Data()));
histoPi0InvMassSigRemBGSubPCM[i]->Sumw2();
histoPi0InvMassSigRemBGSubPCM[i]->Add(histoPi0InvMassRemBGPCM[i],-1);
fitPi0InvMassSigPCM[i]->SetParameter(4, 0);
fitPi0InvMassSigPCM[i]->SetParameter(5, 0);
}
cout << nameTrigger[i].Data() << "\t" << histoPi0InvMassSigPCM[i] << "\t" << histoPi0InvMassSigPlusBGPCM[i] << "\t" << histoPi0InvMassBGPCM[i] << "\t" << fitPi0InvMassSigPCM[i]
<< "\t" << haveAllPi0InvMassPCM[i] << endl;
}
}
cout << "here" << endl;
//************************** Read data for PCMEMCAL **************************************************
TFile* filePCMEMCAL = new TFile(fileNamePCMEMCAL.Data());
TH1D* histoPCMEMCALNumberOfEvents = (TH1D*)filePCMEMCAL->Get("histoNumberOfEvents8TeV");
TDirectory* directoryPCMEMCALPi0 = (TDirectory*)filePCMEMCAL->Get("Pi08TeV");
TGraphAsymmErrors* graphPCMEMCALPi0Mass = (TGraphAsymmErrors*)directoryPCMEMCALPi0->Get("Pi0_Mass_data");
graphPCMEMCALPi0Mass = ScaleGraph(graphPCMEMCALPi0Mass, 1000.);
TGraphAsymmErrors* graphPCMEMCALPi0FWHM = (TGraphAsymmErrors*)directoryPCMEMCALPi0->Get("Pi0_Width_data");
graphPCMEMCALPi0FWHM = ScaleGraph(graphPCMEMCALPi0FWHM, 1000.);
TGraphAsymmErrors* graphPCMEMCALPi0MassMC = (TGraphAsymmErrors*)directoryPCMEMCALPi0->Get("Pi0_Mass_MC");
graphPCMEMCALPi0MassMC = ScaleGraph(graphPCMEMCALPi0MassMC, 1000.);
TGraphAsymmErrors* graphPCMEMCALPi0FWHMMC = (TGraphAsymmErrors*)directoryPCMEMCALPi0->Get("Pi0_Width_MC");
graphPCMEMCALPi0FWHMMC = ScaleGraph(graphPCMEMCALPi0FWHMMC, 1000.);
TGraphAsymmErrors* graphPCMEMCALPi0Acc = (TGraphAsymmErrors*)directoryPCMEMCALPi0->Get("AcceptancePi0");
TGraphAsymmErrors* graphPCMEMCALPi0EffPt = (TGraphAsymmErrors*)directoryPCMEMCALPi0->Get("EfficiencyPi0");
TH1D* histoPCMEMCALPi0TriggerEff[4];
for (Int_t i = 0; i < 3; i++){
histoPCMEMCALPi0TriggerEff[i] = (TH1D*)directoryPCMEMCALPi0->Get(Form("TriggerEfficiencyPi0_%s",nameTrigger[i].Data()));
}
TGraphAsymmErrors* graphPCMEMCALPi0AccTimesEff = (TGraphAsymmErrors*)directoryPCMEMCALPi0->Get("EffTimesAccPi0");
TGraphAsymmErrors* graphPCMEMCALPi0InvXSectionStat = (TGraphAsymmErrors*)directoryPCMEMCALPi0->Get("graphInvCrossSectionPi0");
TH1D* histoPCMEMCALPi0InvXSectionStat = (TH1D*)directoryPCMEMCALPi0->Get("InvCrossSectionPi0");
cout << "Pi0 stat PCM-EMC" << endl;
graphPCMEMCALPi0InvXSectionStat->Print();
TGraphAsymmErrors* graphPCMEMCALPi0InvXSectionSys = (TGraphAsymmErrors*)directoryPCMEMCALPi0->Get("InvCrossSectionPi0Sys");
cout << "Pi0 sys PCM-EMC" << endl;
graphPCMEMCALPi0InvXSectionSys->Print();
TH1D* histoPi0InvMassSigPlusBGPCMEMCAL[3];
TH1D* histoPi0InvMassSigPCMEMCAL[3];
TH1D* histoPi0InvMassSigRemBGSubPCMEMCAL[3];
TH1D* histoPi0InvMassBGPCMEMCAL[3];
TH1D* histoPi0InvMassRemBGPCMEMCAL[3];
TH1D* histoPi0InvMassBGTotPCMEMCAL[3];
TF1* fitPi0InvMassSigPCMEMCAL[3];
TF1* fitPi0InvMassBGPCMEMCAL[3];
Bool_t haveAllPi0InvMassPCMEMCAL[3] = {kFALSE, kFALSE, kFALSE};
if (plotInvMassBins){
for (Int_t i = 0; i < 3; i++){
histoPi0InvMassSigPCMEMCAL[i] = (TH1D*)directoryPCMEMCALPi0->Get(Form("Pi0_InvMassSig_Example_%s",nameTrigger[i].Data()));
histoPi0InvMassSigPlusBGPCMEMCAL[i] = (TH1D*)directoryPCMEMCALPi0->Get(Form("Pi0_InvMassSigPlusBG_Example_%s",nameTrigger[i].Data()));
histoPi0InvMassBGPCMEMCAL[i] = (TH1D*)directoryPCMEMCALPi0->Get(Form("Pi0_InvMassBG_Example_%s",nameTrigger[i].Data()));
fitPi0InvMassSigPCMEMCAL[i] = (TF1*)directoryPCMEMCALPi0->Get(Form("Pi0_InvMassSigFit_Example_%s",nameTrigger[i].Data()));
if (histoPi0InvMassSigPCMEMCAL[i] && histoPi0InvMassSigPlusBGPCMEMCAL[i] && histoPi0InvMassBGPCMEMCAL[i] && fitPi0InvMassSigPCMEMCAL[i]){
haveAllPi0InvMassPCMEMCAL[i] = kTRUE;
}
if (haveAllPi0InvMassPCMEMCAL[i]){
histoPi0InvMassSigPCMEMCAL[i]->Fit(fitPi0InvMassSigPCMEMCAL[i],"QRME0");
for (Int_t l=0; l < 6; l++){
cout << fitPi0InvMassSigPCMEMCAL[i]->GetParameter(l) << "\t +- " << fitPi0InvMassSigPCMEMCAL[i]->GetParError(l) << endl;
}
fitPi0InvMassBGPCMEMCAL[i] = new TF1("Linearpp","[0]+[1]*x",0.02,0.25);
fitPi0InvMassBGPCMEMCAL[i]->SetParameter(0, fitPi0InvMassSigPCMEMCAL[i]->GetParameter(4));
fitPi0InvMassBGPCMEMCAL[i]->SetParameter(1, fitPi0InvMassSigPCMEMCAL[i]->GetParameter(5));
TVirtualFitter * fitterPCMEMCAL = TVirtualFitter::GetFitter();
Int_t nFreeParPCMEMCAL = fitPi0InvMassSigPCMEMCAL[i]->GetNumberFreeParameters();
double * covMatrixPCMEMCAL = fitterPCMEMCAL->GetCovarianceMatrix();
histoPi0InvMassRemBGPCMEMCAL[i] = (TH1D*)histoPi0InvMassBGPCMEMCAL[i]->Clone(Form("Pi0_InvMassRemBG_Example_%s",nameTrigger[i].Data()));
for (Int_t j = 1; j < histoPi0InvMassRemBGPCMEMCAL[i]->GetNbinsX()+1; j++){
histoPi0InvMassRemBGPCMEMCAL[i]->SetBinContent(j,0);
histoPi0InvMassRemBGPCMEMCAL[i]->SetBinError(j,0);
}
for (Int_t j = histoPi0InvMassSigPCMEMCAL[i]->GetXaxis()->FindBin(0.01); j < histoPi0InvMassSigPCMEMCAL[i]->GetXaxis()->FindBin(0.30)+1; j++){
Double_t startBinEdge = histoPi0InvMassSigPCMEMCAL[i]->GetXaxis()->GetBinLowEdge(j);
Double_t endBinEdge = histoPi0InvMassSigPCMEMCAL[i]->GetXaxis()->GetBinUpEdge(j);
Double_t intLinearBack = fitPi0InvMassBGPCMEMCAL[i]->Integral(startBinEdge, endBinEdge)/(endBinEdge-startBinEdge) ;
Double_t errorLinearBck = pow(( pow( (endBinEdge-startBinEdge)*fitPi0InvMassSigPCMEMCAL[i]->GetParError(4),2) +
pow(0.5*(endBinEdge*endBinEdge-startBinEdge*startBinEdge)*fitPi0InvMassSigPCMEMCAL[i]->GetParError(5),2)
+2*covMatrixPCMEMCAL[nFreeParPCMEMCAL*nFreeParPCMEMCAL-2]*(endBinEdge-startBinEdge)*0.5*
(endBinEdge*endBinEdge-startBinEdge*startBinEdge)),0.5)/(endBinEdge-startBinEdge);
// cout << j << "\t" << intLinearBack << "\t" << errorLinearBck << endl;
histoPi0InvMassRemBGPCMEMCAL[i]->SetBinContent(j,intLinearBack);
histoPi0InvMassRemBGPCMEMCAL[i]->SetBinError(j,errorLinearBck);
}
histoPi0InvMassBGTotPCMEMCAL[i] = (TH1D*)histoPi0InvMassBGPCMEMCAL[i]->Clone(Form("Pi0_InvMassTotBG_Example_%s",nameTrigger[i].Data()));
histoPi0InvMassBGTotPCMEMCAL[i]->Sumw2();
histoPi0InvMassBGTotPCMEMCAL[i]->Add(histoPi0InvMassRemBGPCMEMCAL[i]);
histoPi0InvMassSigRemBGSubPCMEMCAL[i] = (TH1D*)histoPi0InvMassSigPCMEMCAL[i]->Clone(Form("Pi0_InvMassSigRemBGSub_Example_%s",nameTrigger[i].Data()));
histoPi0InvMassSigRemBGSubPCMEMCAL[i]->Sumw2();
histoPi0InvMassSigRemBGSubPCMEMCAL[i]->Add(histoPi0InvMassRemBGPCMEMCAL[i],-1);
fitPi0InvMassSigPCMEMCAL[i]->SetParameter(4, 0);
fitPi0InvMassSigPCMEMCAL[i]->SetParameter(5, 0);
}
cout << nameTrigger[i].Data() << "\t" << histoPi0InvMassSigPCMEMCAL[i] << "\t" << histoPi0InvMassSigPlusBGPCMEMCAL[i] << "\t" << histoPi0InvMassBGPCMEMCAL[i] << "\t" << fitPi0InvMassSigPCMEMCAL[i]
<< "\t" << haveAllPi0InvMassPCMEMCAL[i] << endl;
}
}
//************************** Read data for EMCAL ****************************************************
TFile* fileEMCALLow = new TFile(fileNameEMCALLow.Data());
TH1D* histoEMCALNumberOfEvents = (TH1D*)fileEMCALLow->Get("histoNumberOfEvents8TeV");
TDirectory* directoryEMCALPi0 = (TDirectory*)fileEMCALLow->Get("Pi08TeV");
TGraphAsymmErrors* graphEMCALPi0Mass = (TGraphAsymmErrors*)directoryEMCALPi0->Get("Pi0_Mass_data");
graphEMCALPi0Mass = ScaleGraph(graphEMCALPi0Mass, 1000.);
TGraphAsymmErrors* graphEMCALPi0FWHM = (TGraphAsymmErrors*)directoryEMCALPi0->Get("Pi0_Width_data");
graphEMCALPi0FWHM = ScaleGraph(graphEMCALPi0FWHM, 1000.);
TGraphAsymmErrors* graphEMCALPi0MassMC = (TGraphAsymmErrors*)directoryEMCALPi0->Get("Pi0_Mass_MC");
graphEMCALPi0MassMC = ScaleGraph(graphEMCALPi0MassMC, 1000.);
TGraphAsymmErrors* graphEMCALPi0FWHMMC = (TGraphAsymmErrors*)directoryEMCALPi0->Get("Pi0_Width_MC");
graphEMCALPi0FWHMMC = ScaleGraph(graphEMCALPi0FWHMMC, 1000.);
TGraphAsymmErrors* graphEMCALPi0Acc = (TGraphAsymmErrors*)directoryEMCALPi0->Get("AcceptancePi0");
TGraphAsymmErrors* graphEMCALPi0EffPt = (TGraphAsymmErrors*)directoryEMCALPi0->Get("EfficiencyPi0");
TGraphAsymmErrors* graphEMCALPi0AccTimesEff = (TGraphAsymmErrors*)directoryEMCALPi0->Get("EffTimesAccPi0");
TH1D* histoEMCALPi0TriggerEff[4];
for (Int_t i = 2; i < 6; i++){
histoEMCALPi0TriggerEff[i-2] = (TH1D*)directoryEMCALPi0->Get(Form("TriggerEfficiencyPi0_%s",nameTrigger[i].Data()));
}
TH1D* histoEMCALPi0InvXSectionStat = (TH1D*)directoryEMCALPi0->Get("InvCrossSectionPi0");
TGraphAsymmErrors* graphEMCALPi0InvXSectionStat = (TGraphAsymmErrors*)directoryEMCALPi0->Get("graphInvCrossSectionPi0");
cout << "Pi0 stat EMC-EMC" << endl;
graphEMCALPi0InvXSectionStat->Print();
TGraphAsymmErrors* graphEMCALPi0InvXSectionSys = (TGraphAsymmErrors*)directoryEMCALPi0->Get("InvCrossSectionPi0Sys");
cout << "Pi0 sys EMC-EMC" << endl;
graphEMCALPi0InvXSectionSys->Print();
TH1D* histoPi0InvMassSigPlusBGEMCAL[3];
TH1D* histoPi0InvMassSigEMCAL[3];
TH1D* histoPi0InvMassSigRemBGSubEMCAL[3];
TH1D* histoPi0InvMassBGEMCAL[3];
TH1D* histoPi0InvMassRemBGEMCAL[3];
TH1D* histoPi0InvMassBGTotEMCAL[3];
TF1* fitPi0InvMassSigEMCAL[3];
TF1* fitPi0InvMassBGEMCAL[3];
Bool_t haveAllPi0InvMassEMCAL[3] = {kFALSE, kFALSE, kFALSE};
if (plotInvMassBins){
for (Int_t i = 0; i < 3; i++){
histoPi0InvMassSigEMCAL[i] = (TH1D*)directoryEMCALPi0->Get(Form("Pi0_InvMassSig_Example_%s",nameTrigger[i].Data()));
histoPi0InvMassSigPlusBGEMCAL[i] = (TH1D*)directoryEMCALPi0->Get(Form("Pi0_InvMassSigPlusBG_Example_%s",nameTrigger[i].Data()));
histoPi0InvMassBGEMCAL[i] = (TH1D*)directoryEMCALPi0->Get(Form("Pi0_InvMassBG_Example_%s",nameTrigger[i].Data()));
fitPi0InvMassSigEMCAL[i] = (TF1*)directoryEMCALPi0->Get(Form("Pi0_InvMassSigFit_Example_%s",nameTrigger[i].Data()));
if (histoPi0InvMassSigEMCAL[i] && histoPi0InvMassSigPlusBGEMCAL[i] && histoPi0InvMassBGEMCAL[i] && fitPi0InvMassSigEMCAL[i]){
haveAllPi0InvMassEMCAL[i] = kTRUE;
}
if (haveAllPi0InvMassEMCAL[i]){
histoPi0InvMassSigEMCAL[i]->Fit(fitPi0InvMassSigEMCAL[i],"QRME0");
for (Int_t l=0; l < 6; l++){
cout << fitPi0InvMassSigEMCAL[i]->GetParameter(l) << "\t +- " << fitPi0InvMassSigEMCAL[i]->GetParError(l) << endl;
}
fitPi0InvMassBGEMCAL[i] = new TF1("Linearpp","[0]+[1]*x",0.08,0.30);
fitPi0InvMassBGEMCAL[i]->SetParameter(0, fitPi0InvMassSigEMCAL[i]->GetParameter(4));
fitPi0InvMassBGEMCAL[i]->SetParameter(1, fitPi0InvMassSigEMCAL[i]->GetParameter(5));
TVirtualFitter * fitterEMCAL = TVirtualFitter::GetFitter();
Int_t nFreeParEMCAL = fitPi0InvMassSigEMCAL[i]->GetNumberFreeParameters();
double * covMatrixEMCAL = fitterEMCAL->GetCovarianceMatrix();
histoPi0InvMassRemBGEMCAL[i] = (TH1D*)histoPi0InvMassBGEMCAL[i]->Clone(Form("Pi0_InvMassRemBG_Example_%s",nameTrigger[i].Data()));
for (Int_t j = 1; j < histoPi0InvMassRemBGEMCAL[i]->GetNbinsX()+1; j++){
histoPi0InvMassRemBGEMCAL[i]->SetBinContent(j,0);
histoPi0InvMassRemBGEMCAL[i]->SetBinError(j,0);
}
for (Int_t j = histoPi0InvMassSigEMCAL[i]->GetXaxis()->FindBin(0.01); j < histoPi0InvMassSigEMCAL[i]->GetXaxis()->FindBin(0.30)+1; j++){
Double_t startBinEdge = histoPi0InvMassSigEMCAL[i]->GetXaxis()->GetBinLowEdge(j);
Double_t endBinEdge = histoPi0InvMassSigEMCAL[i]->GetXaxis()->GetBinUpEdge(j);
Double_t intLinearBack = fitPi0InvMassBGEMCAL[i]->Integral(startBinEdge, endBinEdge)/(endBinEdge-startBinEdge) ;
Double_t errorLinearBck = pow(( pow( (endBinEdge-startBinEdge)*fitPi0InvMassSigEMCAL[i]->GetParError(4),2) +
pow(0.5*(endBinEdge*endBinEdge-startBinEdge*startBinEdge)*fitPi0InvMassSigEMCAL[i]->GetParError(5),2)
+2*covMatrixEMCAL[nFreeParEMCAL*nFreeParEMCAL-2]*(endBinEdge-startBinEdge)*0.5*
(endBinEdge*endBinEdge-startBinEdge*startBinEdge)),0.5)/(endBinEdge-startBinEdge);
// cout << j << "\t" << intLinearBack << "\t" << errorLinearBck << endl;
histoPi0InvMassRemBGEMCAL[i]->SetBinContent(j,intLinearBack);
histoPi0InvMassRemBGEMCAL[i]->SetBinError(j,errorLinearBck);
}
histoPi0InvMassBGTotEMCAL[i] = (TH1D*)histoPi0InvMassBGEMCAL[i]->Clone(Form("Pi0_InvMassTotBG_Example_%s",nameTrigger[i].Data()));
histoPi0InvMassBGTotEMCAL[i]->Sumw2();
histoPi0InvMassBGTotEMCAL[i]->Add(histoPi0InvMassRemBGEMCAL[i]);
histoPi0InvMassSigRemBGSubEMCAL[i] = (TH1D*)histoPi0InvMassSigEMCAL[i]->Clone(Form("Pi0_InvMassSigRemBGSub_Example_%s",nameTrigger[i].Data()));
histoPi0InvMassSigRemBGSubEMCAL[i]->Sumw2();
histoPi0InvMassSigRemBGSubEMCAL[i]->Add(histoPi0InvMassRemBGEMCAL[i],-1);
fitPi0InvMassSigEMCAL[i]->SetParameter(4, 0);
fitPi0InvMassSigEMCAL[i]->SetParameter(5, 0);
}
cout << nameTrigger[i].Data() << "\t" << histoPi0InvMassSigEMCAL[i] << "\t" << histoPi0InvMassSigPlusBGEMCAL[i] << "\t" << histoPi0InvMassBGEMCAL[i] << "\t" << fitPi0InvMassSigEMCAL[i]
<< "\t" << haveAllPi0InvMassEMCAL[i] << endl;
}
}
//************************** Read data for EMCAL merged **************************************************
TFile* fileEMCALmerged = new TFile(fileNameEMCALmerged.Data());
TDirectory* directoryEMCALmergedPi0 = (TDirectory*)fileEMCALmerged->Get("Pi08TeV");
TH1D* histoEMCALMergedPi0Eff = NULL;
//TH1D* histoEMCALMergedPi0Pur = NULL;
TH1D* histoEMCALMergedPi0AccTimesEff = NULL;
TH1D* histoEMCALMergedPi0InvXSectionStat = NULL;
TH1D* histoEMCALMergedPi0InvXSectionSys = NULL;
TGraphAsymmErrors* graphEMCALMergedPi0AccTimesEff = NULL;
TGraphAsymmErrors* graphEMCALMergedPi0Purity = NULL;
//TGraphAsymmErrors* graphEMCALMergedPi0AccTimesEffDivPur = NULL;
TGraphAsymmErrors* graphEMCALMergedPi0InvXSectionStat = NULL;
TGraphAsymmErrors* graphEMCALMergedPi0InvXSectionSys = NULL;
histoEMCALMergedPi0Eff = (TH1D*)directoryEMCALmergedPi0->Get("EfficiencyPi0");
//histoEMCALMergedPi0Pur = (TH1D*)directoryEMCALmergedPi0->Get("PurityPi0");
graphEMCALMergedPi0AccTimesEff = (TGraphAsymmErrors*)directoryEMCALmergedPi0->Get("EffTimesAccPi0_EGA");
//graphEMCALMergedPi0Purity = (TGraphAsymmErrors*)directoryEMCALmergedPi0->Get("PurityPi0");
//graphEMCALMergedPi0AccTimesEffDivPur = CalculateGraphErrRatioToOtherTGraphErr(graphEMCALMergedPi0AccTimesEff, graphEMCALMergedPi0Purity,kTRUE);
graphEMCALMergedPi0InvXSectionStat = (TGraphAsymmErrors*)directoryEMCALmergedPi0->Get("graphInvCrossSectionPi0");
graphEMCALMergedPi0InvXSectionSys = (TGraphAsymmErrors*)directoryEMCALmergedPi0->Get("InvCrossSectionPi0Sys");
cout << "EMCAL merged stat" << endl;
for (Int_t i = 0; graphEMCALMergedPi0InvXSectionStat->GetX()[0]< 14; i++){
graphEMCALMergedPi0InvXSectionStat->RemovePoint(0);
}
graphEMCALMergedPi0InvXSectionStat->Print();
cout << "EMCAL merged sys" << endl;
for (Int_t i = 0; graphEMCALMergedPi0InvXSectionSys->GetX()[0]< 14; i++){
graphEMCALMergedPi0InvXSectionSys->RemovePoint(0);
}
Double_t * yValue = graphEMCALMergedPi0InvXSectionSys->GetY();
Double_t* yErrorLow = graphEMCALMergedPi0InvXSectionSys->GetEYlow();
Double_t* yErrorHigh = graphEMCALMergedPi0InvXSectionSys->GetEYhigh();
Int_t nPoints = graphEMCALMergedPi0InvXSectionSys->GetN();
for (Int_t i = 0; i < nPoints; i++){
yErrorLow[i] = yValue[i]*0.2;
yErrorHigh[i] = yValue[i]*0.2;
}
graphEMCALMergedPi0InvXSectionSys->Print();
// return;
//************************** Read data for PHOS *****************************************************
TFile* filePHOS = new TFile(fileNamePHOS.Data());
TDirectory* directoryPHOSPi0 = (TDirectory*)filePHOS->Get("Pi08TeV");
TH1D* histoPHOSPi0Mass = (TH1D*)directoryPHOSPi0->Get("MassPi0");
histoPHOSPi0Mass->Scale(1000.);
//for(Int_t k=0; k<6; k++) histoPHOSPi0Mass->SetBinContent(k,0.);
//for(Int_t k=histoPHOSPi0Mass->GetNbinsX(), j=k-6; k>=j; k--) histoPHOSPi0Mass->SetBinContent(k,0.);
TH1D* histoPHOSPi0FWHMMeV = (TH1D*)directoryPHOSPi0->Get("FWHMPi0MeV");
//for(Int_t k=0; k<6; k++) histoPHOSPi0FWHMMeV->SetBinContent(k,-1000.);
// for(Int_t k=histoPHOSPi0FWHMMeV->GetNbinsX(), j=k-6; k>=j; k--) histoPHOSPi0FWHMMeV->SetBinContent(k,-1000.);
TH1D* histoPHOSPi0TrueMass = (TH1D*)directoryPHOSPi0->Get("TrueMassPi0");
histoPHOSPi0TrueMass->Scale(1000.);
// for(Int_t k=0; k<1; k++) histoPHOSPi0TrueMass->SetBinContent(k,0.);
// for(Int_t k=histoPHOSPi0TrueMass->GetNbinsX(), j=k-5; k>=j; k--) histoPHOSPi0TrueMass->SetBinContent(k,0.);
TH1D* histoPHOSPi0TrueFWHMMeV = (TH1D*)directoryPHOSPi0->Get("TrueFWHMPi0MeV");
// for(Int_t k=0; k<1; k++) histoPHOSPi0TrueFWHMMeV->SetBinContent(k,-1000.);
// for(Int_t k=histoPHOSPi0TrueFWHMMeV->GetNbinsX(), j=k-5; k>=j; k--) histoPHOSPi0TrueFWHMMeV->SetBinContent(k,-1000.);
TH1D* histoPHOSPi0Acc = (TH1D*)directoryPHOSPi0->Get("AcceptancePi0");
//for(Int_t k=histoPHOSPi0Acc->GetNbinsX(), j=k-5; k>=j; k--) histoPHOSPi0Acc->SetBinContent(k,0.);
TH1D* histoPHOSPi0TrueEffPt = (TH1D*)directoryPHOSPi0->Get("EfficiencyPi0");
// for(Int_t k=histoPHOSPi0TrueEffPt->GetNbinsX(), j=k-5; k>=j; k--) histoPHOSPi0TrueEffPt->SetBinContent(k,0.);
TH1D* histoPHOSPi0AccTimesEff = (TH1D*)histoPHOSPi0TrueEffPt->Clone("histoPHOSPi0AccTimesEff");
histoPHOSPi0AccTimesEff->Multiply(histoPHOSPi0Acc);
histoPHOSPi0AccTimesEff->Scale(2*TMath::Pi());
//TH1D* graphPHOSPi0AccTimesEff = (TH1D*)directoryPHOSPi0->Get("EffTimesAccPi0_MB");
TH1D* histoPHOSPi0InvXSectionStat = (TH1D*)directoryPHOSPi0->Get("InvCrossSectionPi0");
TGraphAsymmErrors* graphPHOSPi0InvXSectionStat = new TGraphAsymmErrors(histoPHOSPi0InvXSectionStat);
cout << "Pi0 stat PHOS" << endl;
graphPHOSPi0InvXSectionStat->Print();
TGraphErrors* dummySysGraphPHOS = (TGraphErrors*)directoryPHOSPi0->Get("InvCrossSectionPi0Sys");
Double_t* xValuePHOS = dummySysGraphPHOS->GetX();
Double_t* yValuePHOS = dummySysGraphPHOS->GetY();
Double_t* xErrPHOS = dummySysGraphPHOS->GetEX();
Double_t* yErrPHOS = dummySysGraphPHOS->GetEY();
TGraphAsymmErrors* graphPHOSPi0InvXSectionSys = new TGraphAsymmErrors(dummySysGraphPHOS->GetN(), xValuePHOS, yValuePHOS, xErrPHOS, xErrPHOS, yErrPHOS, yErrPHOS);
cout << "Pi0 sys PHOS" << endl;
graphPHOSPi0InvXSectionSys->Print();
TFile* filePHOSprelim = new TFile(fileNamePHOSprelim.Data());
// *******************************************************************************************************
// ************************** Loading theory calculations ************************************************
// *******************************************************************************************************
TFile* fileTheoryCompilation = new TFile(fileNameTheory.Data());
TFile* fileTheoryPythia8 = new TFile(fileNameTheoryPythia8.Data());
TFile* fileTheoryPythia8_4C = new TFile(fileNameTheoryPythia8_4C.Data());
TFile* fileEtaToPi07000GeV = new TFile(fileNameEtaToPi07TeV.Data());
TFile* fileEtaToPi02760GeV = new TFile(fileNameEtaToPi02760GeV.Data());
TDirectory* directoryfileEtaToPi02760GeV = (TDirectory*)fileEtaToPi02760GeV->Get("Eta2.76TeV");
TH1F* histoPythia8InvXSection = (TH1F*) fileTheoryPythia8->Get("fHistInvXsec_Pi0");
TH1F* histoPythia8InvXSectionEta = (TH1F*) fileTheoryPythia8->Get("fHistInvXsec_Eta");
TH1F* histoPythia8_4CInvXSection = (TH1F*) fileTheoryPythia8_4C->Get("fHistInvXsec_Pi0");
TH1F* histoPythia8_4CInvXSectionEta = (TH1F*) fileTheoryPythia8_4C->Get("fHistInvXsec_Eta");
TGraphAsymmErrors* graphPi0DSS14 = (TGraphAsymmErrors*) fileTheoryCompilation->Get("graphNLOCalcDSS14InvSecPi08000GeV");
// while (graphPi0DSS14->GetX()[graphPi0DSS14->GetN()-1] > 42. ) graphPi0DSS14->RemovePoint(graphPi0DSS14->GetN()-1);
TGraphAsymmErrors* graphPi0DSS14central = (TGraphAsymmErrors*) fileTheoryCompilation->Get("graphNLOCalcDSS14InvSecPi08000GeV");
// while (graphPi0DSS14central->GetX()[graphPi0DSS14central->GetN()-1] > 42. ) graphPi0DSS14central->RemovePoint(graphPi0DSS14central->GetN()-1);
// for(Int_t iBinD = 0; iBinD<graphPi0DSS14central->GetN(); iBinD++){graphPi0DSS14central->SetPointEYhigh(iBinD,0); graphPi0DSS14central->SetPointEYlow(iBinD,0);}
TGraph* graphEtaToPi07000GeV = (TGraph*) fileEtaToPi07000GeV->Get("EtaPi0Ratio7000GeV");
TGraph* graphEtaToPi02760GeV = (TGraph*) directoryfileEtaToPi02760GeV->Get("graphRatioEtaToPi0Comb2760GeVTotErr");
// TH1F* histoPythia8InvXSection_VarBinning = (TH1F*) fileTheoryCompilation->Get("histoInvSecPythia8Spec8000GeVVarBinning");
TGraph* graphNLOCalcPi0MuHalf = (TGraph*)fileTheoryCompilation->Get("graphNLOCalcInvSecPi0MuHalf8000GeV");
TGraph* graphNLOCalcPi0MuOne = (TGraph*)fileTheoryCompilation->Get("graphNLOCalcInvSecPi0MuOne8000GeV");
TGraph* graphNLOCalcPi0MuTwo = (TGraph*)fileTheoryCompilation->Get("graphNLOCalcInvSecPi0MuTwo8000GeV");
TGraph* graphNLOCalcEtaMuHalf = (TGraph*)fileTheoryCompilation->Get("graphNLOCalcInvSecEtaMuHalf8000GeV");
TGraph* graphNLOCalcEtaMuOne = (TGraph*)fileTheoryCompilation->Get("graphNLOCalcInvSecEtaMuOne8000GeV");
TGraph* graphNLOCalcEtaMuTwo = (TGraph*)fileTheoryCompilation->Get("graphNLOCalcInvSecEtaMuTwo8000GeV");
TGraph* graphNLOEtaToPi0MuHalf = (TGraph*)fileTheoryCompilation->Get("graphNLOCalcEtaOverPi0MuHalf8000GeV");
TGraph* graphNLOEtaToPi0MuOne = (TGraph*)fileTheoryCompilation->Get("graphNLOCalcEtaOverPi0MuOne8000GeV");
TGraph* graphNLOEtaToPi0MuTwo = (TGraph*)fileTheoryCompilation->Get("graphNLOCalcEtaOverPi0MuTwo8000GeV");
//TGraph* graphNLODSSCalcMuTwo = (TGraph*)fileTheoryCompilation->Get("graphNLOCalcDSSInvSecPi0MuTwo8000GeV");
//TGraph* graphNLOCGCCalcMuTwo = (TGraph*)fileTheoryCompilation->Get("graphNLOCalcCGCInvCrossSec8000GeV");
//TGraphAsymmErrors* graphNLODSS14Calc = (TGraphAsymmErrors*)fileTheoryCompilation->Get("graphNLOCalcDSS14InvCrossSec8000GeV");
// while (graphNLOCalcEtaMuHalf->GetX()[graphNLOCalcEtaMuHalf->GetN()-1] > 37. )
// graphNLOCalcEtaMuHalf->RemovePoint(graphNLOCalcEtaMuHalf->GetN()-1);
// while (graphNLOCalcEtaMuOne->GetX()[graphNLOCalcEtaMuOne->GetN()-1] > 37. )
// graphNLOCalcEtaMuOne->RemovePoint(graphNLOCalcEtaMuOne->GetN()-1);
// while (graphNLOCalcEtaMuTwo->GetX()[graphNLOCalcEtaMuTwo->GetN()-1] > 37. )
// graphNLOCalcEtaMuTwo->RemovePoint(graphNLOCalcEtaMuTwo->GetN()-1);
cout << "mu half" << endl;
graphNLOEtaToPi0MuHalf->Print();
cout << "mu one" << endl;
graphNLOEtaToPi0MuOne->Print();
cout << "mu two" << endl;
graphNLOEtaToPi0MuTwo->Print();
// *******************************************************************************************************
// ************************** Loading charged pion results ***********************************************
// *******************************************************************************************************
// TFile* fileChargedPionInputpp = new TFile(fileNameChargedPionPP.Data());
// TH1D* histoChPiInvYieldPubStatPP = (TH1D*)fileChargedPionInputpp->Get("histoChargedPionSpecPubStat7TeV");
// TH1D* histoChPiInvYieldPubSystPP = (TH1D*)fileChargedPionInputpp->Get("histoChargedPionSpecPubSyst7TeV");
// TH1D* histoChPiInvYieldHighPtStatPP = (TH1D*)fileChargedPionInputpp->Get("histoChargedPionSpecHighPtStat7TeV");
// TH1D* histoChPiInvYieldHighPtSystPP = (TH1D*)fileChargedPionInputpp->Get("histoChargedPionSpecHighPtSyst7TeV");
// TH1D* histoChPiInvYieldLowPtStatCMS = (TH1D*)fileChargedPionInputpp->Get("histoChargedPionSpecLowPtStat7TeVCMS");
// TH1D* histoChPiInvYieldLowPtSysCMS = (TH1D*)fileChargedPionInputpp->Get("histoChargedPionSpecLowPtSys7TeVCMS");
// TH1D* histoChPiInvYieldLowPtStatPP = (TH1D*)fileChargedPionInputpp->Get("histoChargedPionSpecLowPtStatPP7TeV");
// TH1D* histoChPiInvYieldLowPtSysPP = (TH1D*)fileChargedPionInputpp->Get("histoChargedPionSpecLowPtSysPP7TeV");
// *******************************************************************************************************
// ************************** Loading charged hadron results ***********************************************
// *******************************************************************************************************
// TFile* fileChargedHadronsInputpp = new TFile(fileNameChargedHadronPP.Data());
// TGraphAsymmErrors* graphChargedHadronsStatPP = (TGraphAsymmErrors*)fileChargedHadronsInputpp->Get("graphChargedHadronsStatPP8TeV");
// graphChargedHadronsStatPP = ScaleGraph(graphChargedHadronsStatPP,0.5*1e9/xSection8TeVINEL);
// TGraphAsymmErrors* graphChargedHadronsSysPP = (TGraphAsymmErrors*)fileChargedHadronsInputpp->Get("graphChargedHadronsSysPP8TeV");
// graphChargedHadronsSysPP = ScaleGraph(graphChargedHadronsSysPP,0.5*1e9/xSection8TeVINEL);
// *******************************************************************************************************
// ************************** Combination of different pi0 measurements **********************************
// *******************************************************************************************************
// REMARKS:
// - order of measurements defined in CombinePtPointsSpectraFullCorrMat from CombinationFunctions.h
// - correlations are defined in CombinePtPointsSpectraFullCorrMat from CombinationFunctions.h
// - currently only PCM-EMCAL vs others fully implemeted energy independent
// - extendable to other energies
// - offsets have to be determined manually, see cout's in shell from combination function, more can be uncommented
// definition of array of histograms (NULL - means we have no measurement at this energy for this rec-method)
// for statistical error and final value from respective method
TH1D* statErrorCollectionPi0[11];
for (Int_t i = 0; i< 11; i++){
statErrorCollectionPi0[i] = NULL;
}
statErrorCollectionPi0[0] = (TH1D*)histoPCMPi0InvXSectionStat->Clone("statErrPCMPi0");
statErrorCollectionPi0[1] = (TH1D*)histoPHOSPi0InvXSectionStat->Clone("statErrPHOSPi0");
statErrorCollectionPi0[2] = (TH1D*)histoEMCALPi0InvXSectionStat->Clone("statErrEMCALPi0");
statErrorCollectionPi0[4] = (TH1D*)histoPCMEMCALPi0InvXSectionStat->Clone("statErrPCMEMCALPi0");
// definition of array of TGraphAsymmErrors (NULL - means we have no measurement at this energy for this rec-method)
// for systematic error from respective method
TGraphAsymmErrors* sysErrorCollectionPi0[11];
for (Int_t i = 0; i< 11; i++){
sysErrorCollectionPi0[i] = NULL;
}
sysErrorCollectionPi0[0] = (TGraphAsymmErrors*)graphPCMPi0InvXSectionSys->Clone("sysErrPCMPi0");
sysErrorCollectionPi0[1] = (TGraphAsymmErrors*)graphPHOSPi0InvXSectionSys->Clone("sysErrPHOSPi0");
sysErrorCollectionPi0[2] = (TGraphAsymmErrors*)graphEMCALPi0InvXSectionSys->Clone("sysErrEMCALPi0");
sysErrorCollectionPi0[4] = (TGraphAsymmErrors*)graphPCMEMCALPi0InvXSectionSys->Clone("sysErrPCMEMCALPi0");
// **********************************************************************************************************************
// ******************************************* Adding EMCal & EMC merged ***********************************************
// **********************************************************************************************************************
// Definition of final pt binning (has to be set manually)
Double_t xPtLimitsPi0[100];
Int_t maxNBinsPi0 = 0;
Int_t maxNBinsPi0Abs = 0;
maxNBinsPi0 = GetBinning( xPtLimitsPi0, maxNBinsPi0Abs, "Pi0", "8TeV", 11 );
// maxNBinsPi0--;
Double_t xPtLimitsPi0WOMerged[70];
Int_t maxNBinsPi0W0Merged = GetBinning( xPtLimitsPi0WOMerged, maxNBinsPi0Abs, "Pi0", "8TeV", 11 );
// 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-EMCal", "PCM-Dalitz", "PHOS-Dalitz", "EMCal-Dalitz", "spare", "EMCAL merged","PCMOtherDataset"};
Int_t offSetsPi0[11] = { 0, 6, 0, 0, 0,
0, 0, 0, 0, 0,
0};
Int_t offSetsPi0Sys[11] = { 1, 6, 7, 0, 5,
0, 0, 0, 0, 36,
0};
Int_t offSetPi0Shifting[11] = { 0, 0, 0, 0, 0,
0, 0, 0, 0, 0,
0 };
Int_t nComBinsPi0Shifting[11] = { 0, 0, 0, 0, 0,
0, 0, 0, 0, 0,
0 };
TH1D* histoEMCALMergedPi0InvXSectionStatCorrBin = new TH1D("histoEMCALMergedPi0InvXSectionStatCorrBin", "", maxNBinsPi0, xPtLimitsPi0);
Int_t firstBinMergedPi0 = 34;
cout << graphEMCALMergedPi0InvXSectionStat->GetX()[0] << endl;
while (histoEMCALMergedPi0InvXSectionStatCorrBin->GetBinCenter(firstBinMergedPi0) < graphEMCALMergedPi0InvXSectionStat->GetX()[0]){
cout << histoEMCALMergedPi0InvXSectionStatCorrBin->GetBinCenter(firstBinMergedPi0) << endl;
histoEMCALMergedPi0InvXSectionStatCorrBin->SetBinContent(firstBinMergedPi0, 0);
histoEMCALMergedPi0InvXSectionStatCorrBin->SetBinError(firstBinMergedPi0, 0);
firstBinMergedPi0++;
}
for (Int_t i = 0; i < graphEMCALMergedPi0InvXSectionStat->GetN(); i++){
histoEMCALMergedPi0InvXSectionStatCorrBin->SetBinContent(i+firstBinMergedPi0, graphEMCALMergedPi0InvXSectionStat->GetY()[i]);
histoEMCALMergedPi0InvXSectionStatCorrBin->SetBinError(i+firstBinMergedPi0, graphEMCALMergedPi0InvXSectionStat->GetEYlow()[i]);
}
graphEMCALMergedPi0InvXSectionStat->Print();
for (Int_t i = 1; i < histoEMCALMergedPi0InvXSectionStatCorrBin->GetNbinsX()+1; i++){
cout << "Bin " << i << "\t" << histoEMCALMergedPi0InvXSectionStatCorrBin->GetBinCenter(i) << "\t" << histoEMCALMergedPi0InvXSectionStatCorrBin->GetBinContent(i)
<< "\t" << histoEMCALMergedPi0InvXSectionStatCorrBin->GetBinError(i) << endl;
}
//return;
statErrorCollectionPi0[9] = (TH1D*)histoEMCALMergedPi0InvXSectionStatCorrBin->Clone("statErrEMCALMergedPi0");
sysErrorCollectionPi0[9] = (TGraphAsymmErrors*)graphEMCALMergedPi0InvXSectionSys->Clone("sysErrEMCALMergedPi0");
// **********************************************************************************************************************
// ************************ Adding PCM-EMCal measurements to matrix & calculating relativ errors ************************
// **********************************************************************************************************************
TGraphAsymmErrors* statErrorRelCollectionPi0[11];
for (Int_t i = 0; i< 11; i++){
statErrorRelCollectionPi0[i] = NULL;
}
for (Int_t i = 0; i < 11; i++){
if (statErrorCollectionPi0[i]){
statErrorRelCollectionPi0[i] = new TGraphAsymmErrors(statErrorCollectionPi0[i]);
statErrorRelCollectionPi0[i] = CalculateRelErrUpAsymmGraph( statErrorRelCollectionPi0[i], Form("relativeStatErrorPi0_%s", nameMeasGlobal[i].Data()));
}
}
TGraphAsymmErrors* sysErrorRelCollectionPi0[11];
for (Int_t i = 0; i< 11; i++){
sysErrorRelCollectionPi0[i] = NULL;
}
for (Int_t i = 0; i < 11; i++){
if (sysErrorCollectionPi0[i]){
sysErrorRelCollectionPi0[i] = CalculateRelErrUpAsymmGraph( sysErrorCollectionPi0[i], Form("relativeSysErrorPi0_%s", nameMeasGlobal[i].Data()));
}
}
// return;
// **********************************************************************************************************************
// ******************************************* Assuming maximal correlation *********************************************
// **********************************************************************************************************************
TGraph* graphWeightsPi0A[11];
for (Int_t i = 0; i< 11; i++){
graphWeightsPi0A[i] = NULL;
}
// Declaration & calculation of combined spectrum
TString fileNamePi0OutputWeightingA = Form("%s/Pi0_WeightingMethodA.dat",outputDir.Data());
TGraphAsymmErrors* graphCombPi0InvXSectionStatA = NULL;
TGraphAsymmErrors* graphCombPi0InvXSectionSysA = NULL;
TGraphAsymmErrors* graphCombPi0InvXSectionTotA = CombinePtPointsSpectraFullCorrMat( statErrorCollectionPi0, sysErrorCollectionPi0,
xPtLimitsPi0, maxNBinsPi0,
offSetsPi0, offSetsPi0Sys,
graphCombPi0InvXSectionStatA, graphCombPi0InvXSectionSysA,
fileNamePi0OutputWeightingA, "8TeV", "Pi0", kTRUE,
0x0, fileInputCorrFactors
);
if (graphCombPi0InvXSectionTotA == NULL) {
cout << "Aborting: something went wrong during the combination of the new spectra" << endl;
return;
}
// remove bin from 0-0.3 (should have been done automatically in principle)
// graphCombPi0InvXSectionStatA->RemovePoint(0);
// graphCombPi0InvXSectionSysA->RemovePoint(0);
// graphCombPi0InvXSectionTotA->RemovePoint(0);
cout << __LINE__ << endl;
graphCombPi0InvXSectionTotA->Print();
// return;
// Reading weights from output file for plotting
ifstream fileWeightsPi0ReadA;
fileWeightsPi0ReadA.open(fileNamePi0OutputWeightingA,ios_base::in);
cout << "reading" << fileNamePi0OutputWeightingA << endl;
Double_t xValuesPi0ReadA[70];
Double_t weightsPi0ReadA[11][70];
Int_t availablePi0MeasA[11] = { -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1,
-1};
Int_t nMeasSetPi0A = 5;
Int_t nPtBinsPi0ReadA = 0;
while(!fileWeightsPi0ReadA.eof() && nPtBinsPi0ReadA < 70){
TString garbage = "";
if (nPtBinsPi0ReadA == 0){
fileWeightsPi0ReadA >> garbage ;//>> availablePi0Meas[0] >> availablePi0Meas[1] >> availablePi0Meas[2] >> availablePi0Meas[3];
for (Int_t i = 0; i < nMeasSetPi0A; i++){
fileWeightsPi0ReadA >> availablePi0MeasA[i] ;
}
cout << "read following measurements: ";
for (Int_t i = 0; i < 11; i++){
cout << availablePi0MeasA[i] << "\t" ;
}
cout << endl;
} else {
fileWeightsPi0ReadA >> xValuesPi0ReadA[nPtBinsPi0ReadA-1];
for (Int_t i = 0; i < nMeasSetPi0A; i++){
fileWeightsPi0ReadA >> weightsPi0ReadA[availablePi0MeasA[i]][nPtBinsPi0ReadA-1] ;
}
cout << "read: "<< nPtBinsPi0ReadA << "\t"<< xValuesPi0ReadA[nPtBinsPi0ReadA-1] << "\t" ;
for (Int_t i = 0; i < nMeasSetPi0A; i++){
cout << weightsPi0ReadA[availablePi0MeasA[i]][nPtBinsPi0ReadA-1] << "\t";
}
cout << endl;
}
nPtBinsPi0ReadA++;
}
nPtBinsPi0ReadA = nPtBinsPi0ReadA-2 ;
fileWeightsPi0ReadA.close();
for (Int_t i = 0; i < nMeasSetPi0A; i++){
graphWeightsPi0A[availablePi0MeasA[i]] = new TGraph(nPtBinsPi0ReadA,xValuesPi0ReadA,weightsPi0ReadA[availablePi0MeasA[i]]);
Int_t bin = 0;
for (Int_t n = 0; n< nPtBinsPi0ReadA; n++){
if (graphWeightsPi0A[availablePi0MeasA[i]]->GetY()[bin] == 0) graphWeightsPi0A[availablePi0MeasA[i]]->RemovePoint(bin);
else bin++;
}
}
// **********************************************************************************************************************
// ******************************************* Plotting weights Method A ************************************************
// **********************************************************************************************************************
Int_t textSizeLabelsPixel = 900*0.04;
TCanvas* canvasWeights = new TCanvas("canvasWeights","",200,10,1350,900); // gives the page size
DrawGammaCanvasSettings( canvasWeights, 0.08, 0.02, 0.035, 0.09);
canvasWeights->SetLogx();
TH2F * histo2DPi0Weights;
histo2DPi0Weights = new TH2F("histo2DPi0Weights","histo2DPi0Weights",11000,0.23,220.,1000,-0.7,1.3);
SetStyleHistoTH2ForGraphs(histo2DPi0Weights, "#it{p}_{T} (GeV/#it{c})","#omega_{a} for BLUE",0.035,0.04, 0.035,0.04, 1.,1.);
histo2DPi0Weights->GetXaxis()->SetMoreLogLabels();
histo2DPi0Weights->GetXaxis()->SetLabelOffset(-0.01);
// histo2DPi0Weights->GetYaxis()->SetRangeUser(-10,10);
histo2DPi0Weights->Draw("copy");
TLatex *labelWeightsEnergy = new TLatex(0.7,0.20,collisionSystem8TeV.Data());
SetStyleTLatex( labelWeightsEnergy, 0.85*textSizeLabelsPixel,4);
labelWeightsEnergy->SetTextFont(43);
labelWeightsEnergy->Draw();
TLatex *labelWeightsPi0 = new TLatex(0.7,0.16,"#pi^{0} #rightarrow #gamma#gamma");
SetStyleTLatex( labelWeightsPi0, 0.85*textSizeLabelsPixel,4);
labelWeightsPi0->SetTextFont(43);
labelWeightsPi0->Draw();
TLegend* legendWeights = GetAndSetLegend2(0.12, 0.14, 0.45, 0.14+(0.035*nMeasSetPi0A), 32);
for (Int_t i = 0; i < nMeasSetPi0A; i++){
DrawGammaSetMarkerTGraph(graphWeightsPi0A[availablePi0MeasA[i]], markerStyleDet[availablePi0MeasA[i]], markerSizeDet[availablePi0MeasA[i]]*0.5, colorDet[availablePi0MeasA[i]] , colorDet[availablePi0MeasA[i]]);
graphWeightsPi0A[availablePi0MeasA[i]]->Draw("p,same,z");
legendWeights->AddEntry(graphWeightsPi0A[availablePi0MeasA[i]],nameMeasGlobal[availablePi0MeasA[i]],"p");
}
legendWeights->Draw();
labelWeightsEnergy->Draw();
labelWeightsPi0->Draw();
// DrawGammaLines(0.23, 220. , 0.8, 0.8,0.1, kGray, 3);
DrawGammaLines(0.23, 220. , 0.5, 0.5,0.1, kGray, 7);
DrawGammaLines(0.23, 220. , 0.4, 0.4,0.1, kGray, 1);
DrawGammaLines(0.23, 220. , 0.3, 0.3,0.1, kGray, 7);
DrawGammaLines(0.23, 220. , 0.2, 0.2,0.1, kGray, 3);
canvasWeights->SaveAs(Form("%s/Pi0_WeightsA.%s",outputDir.Data(),suffix.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,0.23,220.,1000,0,200.5);
SetStyleHistoTH2ForGraphs(histo2DRelSysErr, "#it{p}_{T} (GeV/#it{c})","sys Err (%)",0.035,0.04, 0.035,0.04, 1.,1.);
histo2DRelSysErr->GetXaxis()->SetMoreLogLabels();
histo2DRelSysErr->GetXaxis()->SetLabelOffset(-0.01);
// histo2DRelSysErr->GetYaxis()->SetRangeUser(-10,10);
histo2DRelSysErr->Draw("copy");
TLegend* legendRelSysErr = GetAndSetLegend2(0.62, 0.92-(0.035*nMeasSetPi0A), 0.95, 0.92, 32);
for (Int_t i = 0; i < nMeasSetPi0A; i++){
DrawGammaSetMarkerTGraph(sysErrorRelCollectionPi0[availablePi0MeasA[i]], markerStyleDet[availablePi0MeasA[i]], markerSizeDet[availablePi0MeasA[i]]*0.5, colorDet[availablePi0MeasA[i]],
colorDet[availablePi0MeasA[i]]);
sysErrorRelCollectionPi0[availablePi0MeasA[i]]->Draw("p,same,z");
legendRelSysErr->AddEntry(sysErrorRelCollectionPi0[availablePi0MeasA[i]],nameMeasGlobal[availablePi0MeasA[i]],"p");
}
legendRelSysErr->Draw();
TLatex *labelRelSysErrEnergy = new TLatex(0.15,0.89,collisionSystem8TeV.Data());
SetStyleTLatex( labelRelSysErrEnergy, 0.85*textSizeLabelsPixel,4);
labelRelSysErrEnergy->SetTextFont(43);
labelRelSysErrEnergy->Draw();
TLatex *labelRelSysErrPi0 = new TLatex(0.15,0.85,"#pi^{0} #rightarrow #gamma#gamma");
SetStyleTLatex( labelRelSysErrPi0, 0.85*textSizeLabelsPixel,4);
labelRelSysErrPi0->SetTextFont(43);
labelRelSysErrPi0->Draw();
canvasRelSysErr->SaveAs(Form("%s/Pi0_RelSysErr.%s",outputDir.Data(),suffix.Data()));
histo2DRelSysErr->GetYaxis()->SetRangeUser(0,30.5);
histo2DRelSysErr->Draw("copy");
for (Int_t i = 0; i < nMeasSetPi0A; i++){
sysErrorRelCollectionPi0[availablePi0MeasA[i]]->Draw("p,same,z");
}
legendRelSysErr->Draw();
labelRelSysErrEnergy->Draw();
labelRelSysErrPi0->Draw();
canvasRelSysErr->SaveAs(Form("%s/Pi0_RelSysErrZoomed.%s",outputDir.Data(),suffix.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","histo2DRelStatErr",11000,0.23,220.,1000,0,200.5);
SetStyleHistoTH2ForGraphs(histo2DRelStatErr, "#it{p}_{T} (GeV/#it{c})","stat Err (%)",0.035,0.04, 0.035,0.04, 1.,1.);
histo2DRelStatErr->GetXaxis()->SetMoreLogLabels();
histo2DRelStatErr->GetXaxis()->SetLabelOffset(-0.01);
// histo2DRelStatErr->GetYaxis()->SetRangeUser(-10,10);
histo2DRelStatErr->Draw("copy");
TLegend* legendRelStatErr = GetAndSetLegend2(0.14, 0.92-(0.035*nMeasSetPi0A), 0.45, 0.92, 32);
for (Int_t i = 0; i < nMeasSetPi0A; i++){
DrawGammaSetMarkerTGraph(statErrorRelCollectionPi0[availablePi0MeasA[i]], markerStyleDet[availablePi0MeasA[i]], markerSizeDet[availablePi0MeasA[i]]*0.5, colorDet[availablePi0MeasA[i]],
colorDet[availablePi0MeasA[i]]);
statErrorRelCollectionPi0[availablePi0MeasA[i]]->Draw("p,same,z");
legendRelStatErr->AddEntry(statErrorRelCollectionPi0[availablePi0MeasA[i]],nameMeasGlobal[availablePi0MeasA[i]],"p");
}
legendRelStatErr->Draw();
TLatex *labelRelStatErrEnergy = new TLatex(0.75,0.89,collisionSystem8TeV.Data());
SetStyleTLatex( labelRelStatErrEnergy, 0.85*textSizeLabelsPixel,4);
labelRelStatErrEnergy->SetTextFont(43);
labelRelStatErrEnergy->Draw();
TLatex *labelRelStatErrPi0 = new TLatex(0.75,0.85,"#pi^{0} #rightarrow #gamma#gamma");
SetStyleTLatex( labelRelStatErrPi0, 0.85*textSizeLabelsPixel,4);
labelRelStatErrPi0->SetTextFont(43);
labelRelStatErrPi0->Draw();
canvasRelStatErr->SaveAs(Form("%s/Pi0_RelStatErr.%s",outputDir.Data(),suffix.Data()));