-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCombineMesonMeasurementspPb8160GeV_V1.C
7352 lines (6108 loc) · 444 KB
/
CombineMesonMeasurementspPb8160GeV_V1.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 "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/ConversionFunctionsBasicsAndLabeling.h"
#include "CommonHeaders/ConversionFunctions.h"
#include "CommonHeaders/CombinationFunctions.h"
extern TRandom* gRandom;
extern TBenchmark* gBenchmark;
extern TSystem* gSystem;
extern TMinuit* gMinuit;
TGraphAsymmErrors* ScaleGraphAsym (TGraphAsymmErrors* graph, Double_t scaleFac){
TGraphAsymmErrors* dummyGraph = (TGraphAsymmErrors*)graph->Clone(Form("%s_Scaled",graph->GetName()));
Double_t * xValue = dummyGraph->GetX();
Double_t * yValue = dummyGraph->GetY();
Double_t* xErrorLow = dummyGraph->GetEXlow();
Double_t* xErrorHigh = dummyGraph->GetEXhigh();
Double_t* yErrorLow = dummyGraph->GetEYlow();
Double_t* yErrorHigh = dummyGraph->GetEYhigh();
Int_t nPoints = dummyGraph->GetN();
for (Int_t i = 0; i < nPoints; i++){
yValue[i] = yValue[i]*scaleFac;
yErrorLow[i] = yErrorLow[i]*scaleFac;
yErrorHigh[i] = yErrorHigh[i]*scaleFac;
}
TGraphAsymmErrors* returnGraph = new TGraphAsymmErrors(nPoints,xValue,yValue,xErrorLow,xErrorHigh,yErrorLow,yErrorHigh);
return returnGraph;
}
TGraphAsymmErrors* ConvertYieldGraph(TGraphAsymmErrors* inputGraph, Bool_t DivideBy2pi, Bool_t DivideByPt, Bool_t MultiplyBy2pi, Bool_t MultiplyByPt) {
if (!inputGraph) {
cout << "Error: Graph is NULL" << endl;
return NULL;
}
if (DivideBy2pi) inputGraph = ScaleGraph(inputGraph, 1/(2*TMath::Pi()));
if (MultiplyBy2pi) inputGraph = ScaleGraph(inputGraph, 2*TMath::Pi());
Double_t* xValue = inputGraph->GetX();
Double_t* yValue = inputGraph->GetY();
Double_t* xErrorLow = inputGraph->GetEXlow();
Double_t* xErrorHigh = inputGraph->GetEXhigh();
Double_t* yErrorLow = inputGraph->GetEYlow();
Double_t* yErrorHigh = inputGraph->GetEYhigh();
Int_t nPoints = inputGraph->GetN();
if (DivideByPt || MultiplyByPt) {
Double_t correctionValue = 1;
for (Int_t i=0; i<nPoints; i++) {
if (DivideByPt) correctionValue = 1/xValue[i];
if (MultiplyByPt) correctionValue = xValue[i];
yValue[i] = yValue[i]*correctionValue;
yErrorLow[i] = yErrorLow[i]*correctionValue;
yErrorHigh[i] = yErrorHigh[i]*correctionValue;
}
}
inputGraph = new TGraphAsymmErrors(nPoints,xValue,yValue,xErrorLow,xErrorHigh,yErrorLow,yErrorHigh);
return inputGraph;
}
void CombineMesonMeasurementspPb8160GeV_V1(
TString fileNamePCM = "",
TString fileNamePHOS = "",
TString fileNameEMCal = "",
TString fileNamePCMPHOS = "",
TString fileNamePCMEMCal= "",
TString fileNamemEMC = "",
Int_t numbersofmeasPi0 = 3,
Int_t numbersofmeasEta = 2,
Double_t minPtPi0Meas = 0.4,
Double_t maxPtPi0Meas = 60,
Double_t minPtEtaMeas = 0.5,
Double_t maxPtEtaMeas = 60,
TString bWCorrection = "",
TString suffix = "pdf",
TString fileNameReference = "",
Bool_t isNSD = kTRUE
){
TString date = ReturnDateString();
Bool_t doOutput = kTRUE;
gROOT->Reset();
gROOT->SetStyle("Plain");
StyleSettingsThesis();
SetPlotStyle();
TString dateForOutput = ReturnDateStringForOutput();
cout << dateForOutput.Data() << endl;
//___________________________________ Declaration of files _____________________________________________
TString collisionSystempPb5TeV = "p-Pb, #sqrt{#it{s}_{NN}} = 5.02 TeV";
TString collisionSystempPb8TeV = "p-Pb, #sqrt{#it{s}_{NN}} = 8.16 TeV";
TString collisionSystempp8TeV = "pp, #sqrt{#it{s}} = 8 TeV";
TString labelALICEPlot = "ALICE, work-in-progress";
TString outputDir = Form("%s/%s/CombineMesonMeasurementspPb8160GeV_V1",suffix.Data(),dateForOutput.Data());
cout << outputDir.Data() << endl;
TString fileNameTheory = "ExternalInput/Theory/TheoryCompilationPP.root";
TString fileNameTheoryPPb = "ExternalInputpPb/Theory/TheoryCompilationPPb.root";
TString fileNameCHadrons = "/home/nschmidt/AnalysisSoftware/CombinationInput5TeV/20180409_ChargedParticle_pp_5.02TeV.root";
TString fileNameCParticles = "/home/nschmidt/AnalysisSoftware/CombinationInput5TeV/Spectra_ppLHC15n_Combined_Histograms.root";
TString fileNameEtaToPi0 = "ExternalInput/WorldDataPi0Eta.root";
// TString fileNamePP8TeV = "/media/nschmidt/local/ANALYSIS/pp_8TeV_mEMC/pdf/8TeV/2019_01_29/FinalResultsTriggersPatchedLM1EMC-merged/data_EMC-mergedResultsFullCorrection_PP.root";
// TString fileNamePP8TeV = "/media/nschmidt/local/ANALYSIS/pp_8TeV_mEMC_pTweights/pdf/8TeV/2019_07_19/FinalResultsTriggersPatchedLM1EMC-merged/data_EMC-mergedResultsFullCorrection_PP.root";
TString fileNamePP8TeV = "/media/nschmidt/local/ANALYSIS/pp_8TeV_mEMC/pdf/8TeV/2019_06_05/FinalResultsTriggersPatchedLM1EMC-merged/data_EMC-mergedResultsFullCorrection_PP.root";
gSystem->Exec("mkdir -p "+outputDir);
if(fileNamePCM.CompareTo(""))
gSystem->Exec(Form("cp %s %s/InputPCM.root", fileNamePCM.Data(), outputDir.Data()));
if(fileNamePHOS.CompareTo(""))
gSystem->Exec(Form("cp %s %s/InputPHOS.root", fileNamePHOS.Data(), outputDir.Data()));
if(fileNameEMCal.CompareTo(""))
gSystem->Exec(Form("cp %s %s/InputEMC.root", fileNameEMCal.Data(), outputDir.Data()));
if(fileNamePCMPHOS.CompareTo(""))
gSystem->Exec(Form("cp %s %s/InputPCMPHOS.root", fileNamePCMPHOS.Data(), outputDir.Data()));
if(fileNamePCMEMCal.CompareTo(""))
gSystem->Exec(Form("cp %s %s/InputPCMEMC.root", fileNamePCMEMCal.Data(), outputDir.Data()));
if(fileNamemEMC.CompareTo(""))
gSystem->Exec(Form("cp %s %s/InputmEMC.root", fileNamemEMC.Data(), outputDir.Data()));
if(fileNameCHadrons.CompareTo(""))
gSystem->Exec(Form("cp %s %s/ChargedHadrons.root", fileNameCHadrons.Data(), outputDir.Data()));
if(fileNameCParticles.CompareTo(""))
gSystem->Exec(Form("cp %s %s/ChardedParticles.root", fileNameCParticles.Data(), outputDir.Data()));
if(fileNameReference.CompareTo(""))
gSystem->Exec(Form("cp %s %s/ResultsPP8TeV.root", fileNameReference.Data(), outputDir.Data()));
cout << "copied input files" << endl;
fstream fLog;
fLog.open(Form("%s/CombineMesonpPb8TeV.log",outputDir.Data()), ios::out);
fLog << "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" << endl;
fLog << dateForOutput.Data() << endl;
Double_t nCollpPb = GetNCollFromName("00100", "pPb_8TeV");
Double_t nCollErrpPb = GetNCollErrFromName("00100", "pPb_8TeV");
Double_t tpPb = GetTAAFromName("", "pPb_8TeV");
Double_t tpPbErr = GetTAAErrFromName("", "pPb_8TeV");
Double_t mesonMassExpectPi0 = TDatabasePDG::Instance()->GetParticle(111)->Mass();
Double_t mesonMassExpectEta = TDatabasePDG::Instance()->GetParticle(221)->Mass();
Width_t widthLinesBoxes = 1;
Width_t widthCommonFit = 2;
// Definition of colors, styles and markers sizes
Color_t colorComb = kBlue+2;
Style_t markerStyleComb = 20;
Size_t markerSizeComb = 2;
Color_t colorCGC = kCyan-8;
Color_t colorNLO = kAzure-4;
Color_t colorTrigg[10] = {kBlack, kGray+1, kRed+2, kBlue+2, kGreen+3, kCyan+2, kViolet, kMagenta+2, kRed-2, kBlue-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;
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.;
vector<TString>* ptSysRemNames = new vector<TString>[11];
Int_t totalNSets = 13;
TString nameMeasGlobal[13] = {"PCM", "PHOS", "EMCal", "PCM-PHOS", "PCM-EMCal", "PCM-Dalitz", "PHOS-Dalitz", "EMCal-Dalitz", "spare", "EMCAL merged", "PCMOtherDataset", "DCal", "PCM-DCal"};
TString nameMeasGlobalPlot[13] = {"PCM", "PHOS", "EMC", "PCM-PHOS", "PCM-EMC", "PCM-Dalitz", "PHOS-Dalitz", "EMCal-Dalitz", "spare", "mEMC", "PCMOtherDataset", "DMC", "PCM-DMC"};
TString nameMeasReference[13] = {"PCM", "PHOS", "EMCAL", "PCMPHOS", "PCMEMCAL", "PCMDalitz", "PHOSDalitz", "EMCalDalitz", "spare", "EMCALMerged", "PCMOtherDataset", "DMC", "PCM-DMC"};
Color_t colorDet[13];
Color_t colorDetMC[13];
Style_t markerStyleDet[13];
Style_t markerStyleDetMC[13];
Size_t markerSizeDet[13];
Size_t markerSizeDetMC[13];
for (Int_t i = 0; i < totalNSets; 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;
}
cout << "loaded plotting styles" << endl;
TFile* inputFile[13] = {NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};
inputFile[0] = new TFile(fileNamePCM.Data());
inputFile[1] = new TFile(fileNamePHOS.Data());
inputFile[2] = new TFile(fileNameEMCal.Data());
inputFile[3] = new TFile(fileNamePCMPHOS.Data());
inputFile[4] = new TFile(fileNamePCMEMCal.Data());
inputFile[9] = new TFile(fileNamemEMC.Data());
TDirectory* directoryPi0[13] = {NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};
TDirectory* directoryEta[13] = {NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};
for(Int_t i=0;i<13;i++){
if(inputFile[i]){
if(!inputFile[i]->IsZombie()){
cout << "loading directories for " << nameMeasGlobalPlot[i] << endl;
directoryPi0[i] = (TDirectory*)inputFile[i]->Get("Pi00-100%pPb_8TeV_V0A");
directoryEta[i] = (TDirectory*)inputFile[i]->Get("Eta0-100%pPb_8TeV_V0A");
}
}
}
cout << __LINE__<<endl;
TGraphAsymmErrors* graphPi0Mass[13] = {NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};
TGraphAsymmErrors* graphPi0FWHMMeV[13] = {NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};
TGraphAsymmErrors* graphPi0TrueMass[13] = {NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};
TGraphAsymmErrors* graphPi0TrueFWHMMeV[13] = {NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};
TGraphAsymmErrors* graphPi0Acc[13] = {NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};
TGraphAsymmErrors* graphPi0TrueEffPt[13] = {NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};
TGraphAsymmErrors* graphPi0AccTimesEff[13] = {NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};
TH1D* histoPi0InvYield[13] = {NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};
TGraphAsymmErrors* graphPi0InvYieldSys[13] = {NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};
TGraphAsymmErrors* graphPi0InvYieldStat[13] = {NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};
Bool_t havePi0NuclModFac[13] = {kFALSE};
TH1D* histoPi0NuclModFac[13] = {NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};
TGraphAsymmErrors* graphPi0NuclModFacSys[13] = {NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};
TGraphAsymmErrors* graphPi0NuclModFacStat[13] = {NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};
TGraphAsymmErrors* graphEtaMass[13] = {NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};
TGraphAsymmErrors* graphEtaFWHMMeV[13] = {NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};
TGraphAsymmErrors* graphEtaTrueMass[13] = {NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};
TGraphAsymmErrors* graphEtaTrueFWHMMeV[13] = {NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};
TGraphAsymmErrors* graphEtaAcc[13] = {NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};
TGraphAsymmErrors* graphEtaTrueEffPt[13] = {NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};
TGraphAsymmErrors* graphEtaAccTimesEff[13] = {NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};
TH1D* histoEtaInvYield[13] = {NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};
TGraphAsymmErrors* graphEtaInvYieldSys[13] = {NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};
TGraphAsymmErrors* graphEtaInvYieldStat[13] = {NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};
Bool_t haveEtaNuclModFac[13] = {kFALSE};
TH1D* histoEtaNuclModFac[13] = {NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};
TGraphAsymmErrors* graphEtaNuclModFacSys[13] = {NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};
TGraphAsymmErrors* graphEtaNuclModFacStat[13] = {NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};
TH1D* histoEtaToPi0Stat[13] = {NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};
TGraphAsymmErrors* graphEtaToPi0Stat[13] = {NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};
TGraphAsymmErrors* graphEtaToPi0Sys[13] = {NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};
TH1D* histoPi0InvMassSigPlusBG[13] = {NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};
TH1D* histoPi0InvMassSig[13] = {NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};
TH1D* histoPi0InvMassSigRemBGSub[13] = {NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};
TH1D* histoPi0InvMassBG[13] = {NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};
TH1D* histoPi0InvMassRemBG[13] = {NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};
TH1D* histoPi0InvMassBGTot[13] = {NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};
TF1* fitPi0InvMassSig[13] = {NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};
TF1* fitPi0InvMassBG[13] = {NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};
Bool_t haveAllPi0InvMass[13] = {kFALSE,kFALSE,kFALSE,kFALSE,kFALSE,kFALSE,kFALSE,kFALSE,kFALSE,kFALSE,kFALSE};
TString strTriggerExampleBin[13] = {"INT7", "INT7", "INT7", "INT7","INT7","INT7", "INT7", "INT7", "INT7","INT7","INT7", "INT7", "INT7"};
Double_t rapidityMeas[13] = {1.6, 1., 1.6, 1.6, 1.6, 1., 1., 1., 1., 1., 1., 1., 1.};
Double_t minPtPi0 = 0.25;
Double_t maxPtPi0 = 250.0; //75
Double_t maxPtPi0woMerged = 46.0; //75
Double_t maxPtPi0Theory = 200.0; //75
Double_t delaPtPi0 = maxPtPi0 - minPtPi0;
Double_t prodPtPi0 = maxPtPi0 * minPtPi0;
Double_t minInvYieldPi0 = 6e-15;
Double_t maxInvYieldPi0 = 3e1;
Double_t minPtEta = 0.3;
Double_t maxPtEta = 60.0;//60
Double_t maxPtEtaTheory = 45.0;//60
Double_t delaPtEta = maxPtEta - minPtEta;
Double_t prodPtEta = maxPtEta * minPtEta;
Double_t minInvYieldEta = 6e-8;
Double_t maxInvYieldEta = 9e-1;
Double_t scalingToNSD = 0.97;
if (!isNSD)
scalingToNSD = 1;
// *******************************************************************************************************
// ************************** read input files ***********************************************************
// *******************************************************************************************************
Int_t nNuclModFacAvailPi0 = 0;
Int_t nNuclModFacAvailEta = 0;
for (Int_t i = 0; i < totalNSets; i++){
cout << "reading from " << nameMeasGlobalPlot[i].Data() << " measurement..." << endl;
if(directoryPi0[i]){
cout << "loading pi0 inputs" << endl;
// load mass/width/effi plots
graphPi0Mass[i] = (TGraphAsymmErrors*)directoryPi0[i]->Get("Pi0_Mass_data");
graphPi0FWHMMeV[i] = (TGraphAsymmErrors*)directoryPi0[i]->Get("Pi0_Width_data");
graphPi0TrueMass[i] = (TGraphAsymmErrors*)directoryPi0[i]->Get("Pi0_Mass_MC");
graphPi0TrueFWHMMeV[i] = (TGraphAsymmErrors*)directoryPi0[i]->Get("Pi0_Width_MC");
if(graphPi0Mass[i]) graphPi0Mass[i]= ScaleGraphAsym(graphPi0Mass[i],1000.);
if(graphPi0FWHMMeV[i]) graphPi0FWHMMeV[i]= ScaleGraphAsym(graphPi0FWHMMeV[i],1000.);
if(graphPi0TrueMass[i]) graphPi0TrueMass[i]= ScaleGraphAsym(graphPi0TrueMass[i],1000.);
if(graphPi0TrueFWHMMeV[i]) graphPi0TrueFWHMMeV[i]= ScaleGraphAsym(graphPi0TrueFWHMMeV[i],1000.);
graphPi0Acc[i] = (TGraphAsymmErrors*)directoryPi0[i]->Get("AcceptancePi0");
graphPi0TrueEffPt[i] = (TGraphAsymmErrors*)directoryPi0[i]->Get("EfficiencyPi0");
graphPi0AccTimesEff[i] = (TGraphAsymmErrors*)directoryPi0[i]->Get("EffTimesAccPi0");
// graphPi0AccTimesEff[i]= ScaleGraphAsym(graphPi0AccTimesEff[i],2*TMath::Pi()*rapidityMeas[i]);
// load cross section systematics and datapoints
histoPi0InvYield[i] = (TH1D*)directoryPi0[i]->Get("CorrectedYieldPi0");
graphPi0InvYieldStat[i] = new TGraphAsymmErrors(histoPi0InvYield[i]);
graphPi0InvYieldSys[i] = (TGraphAsymmErrors*)directoryPi0[i]->Get("Pi0SystError");
if (isNSD) {
histoPi0InvYield[i]->Scale(scalingToNSD);
graphPi0InvYieldStat[i] = ScaleGraph(graphPi0InvYieldStat[i],scalingToNSD);
graphPi0InvYieldSys[i] = ScaleGraph(graphPi0InvYieldSys[i],scalingToNSD);
}
cout << nameMeasGlobalPlot[i].Data() << " pi0 stat:" << graphPi0InvYieldStat[i] << endl;
if(graphPi0InvYieldStat[i]) graphPi0InvYieldStat[i]->Print();
else {cout << "stat graph missing. returning..." << endl; return;}
cout << nameMeasGlobalPlot[i].Data() << " pi0 sys:" << graphPi0InvYieldSys[i] << endl;
if(graphPi0InvYieldSys[i]) graphPi0InvYieldSys[i]->Print();
else {cout << "sys graph missing. returning..." << endl; return;}
// load cross section systematics and datapoints
histoPi0NuclModFac[i] = (TH1D*)directoryPi0[i]->Get("histoNuclearModFactorPi0Stat");
graphPi0NuclModFacStat[i] = (TGraphAsymmErrors*)directoryPi0[i]->Get("graphNuclearModFactorPi0Stat");
graphPi0NuclModFacSys[i] = (TGraphAsymmErrors*)directoryPi0[i]->Get("graphNuclearModFactorPi0Sys");
if(histoPi0NuclModFac[i] && graphPi0NuclModFacStat[i] && graphPi0NuclModFacSys[i]){
nNuclModFacAvailPi0+=1;
havePi0NuclModFac[i] = kTRUE;
cout << nameMeasGlobalPlot[i].Data() << " Pi0 RpA stat:" << graphPi0NuclModFacStat[i] << endl;
if(doOutput) graphPi0NuclModFacStat[i]->Print();
cout << nameMeasGlobalPlot[i].Data() << " Pi0 RpA sys:" << graphPi0NuclModFacSys[i] << endl;
if(doOutput) graphPi0NuclModFacSys[i]->Print();
}
// load invariant mass example bins
histoPi0InvMassSig[i] = (TH1D*)directoryPi0[i]->Get(Form("Pi0_InvMassSig_Example_%s",strTriggerExampleBin[i].Data()));
histoPi0InvMassSigPlusBG[i] = (TH1D*)directoryPi0[i]->Get(Form("Pi0_InvMassSigPlusBG_Example_%s",strTriggerExampleBin[i].Data()));
histoPi0InvMassBG[i] = (TH1D*)directoryPi0[i]->Get(Form("Pi0_InvMassBG_Example_%s",strTriggerExampleBin[i].Data()));
fitPi0InvMassSig[i] = (TF1*)directoryPi0[i]->Get(Form("Pi0_InvMassSigFit_Example_%s",strTriggerExampleBin[i].Data()));
if (histoPi0InvMassSig[i] && histoPi0InvMassSigPlusBG[i] && histoPi0InvMassBG[i] && fitPi0InvMassSig[i]){
haveAllPi0InvMass[i] = kTRUE;
}
}
if(directoryEta[i]){
cout << "loading eta inputs" << endl;
// load mass/width/effi plots
graphEtaMass[i] = (TGraphAsymmErrors*)directoryEta[i]->Get("Eta_Mass_data");
graphEtaFWHMMeV[i] = (TGraphAsymmErrors*)directoryEta[i]->Get("Eta_Width_data");
graphEtaTrueMass[i] = (TGraphAsymmErrors*)directoryEta[i]->Get("Eta_Mass_MC");
graphEtaTrueFWHMMeV[i] = (TGraphAsymmErrors*)directoryEta[i]->Get("Eta_Width_MC");
if(graphEtaMass[i]) graphEtaMass[i]= ScaleGraphAsym(graphEtaMass[i],1000.);
if(graphEtaFWHMMeV[i]) graphEtaFWHMMeV[i]= ScaleGraphAsym(graphEtaFWHMMeV[i],1000.);
if(graphEtaTrueMass[i]) graphEtaTrueMass[i]= ScaleGraphAsym(graphEtaTrueMass[i],1000.);
if(graphEtaTrueFWHMMeV[i]) graphEtaTrueFWHMMeV[i]= ScaleGraphAsym(graphEtaTrueFWHMMeV[i],1000.);
graphEtaAcc[i] = (TGraphAsymmErrors*)directoryEta[i]->Get("AcceptanceEta");
graphEtaTrueEffPt[i] = (TGraphAsymmErrors*)directoryEta[i]->Get("EfficiencyEta");
graphEtaAccTimesEff[i] = (TGraphAsymmErrors*)directoryEta[i]->Get("EffTimesAccEta");
// graphEtaAccTimesEff[i]= ScaleGraphAsym(graphEtaAccTimesEff[i],2*TMath::Pi()*rapidityMeas[i]);
// load cross section systematics and datapoints
histoEtaInvYield[i] = (TH1D*)directoryEta[i]->Get("CorrectedYieldEta");
graphEtaInvYieldStat[i] = new TGraphAsymmErrors(histoEtaInvYield[i]);
graphEtaInvYieldSys[i] = (TGraphAsymmErrors*)directoryEta[i]->Get("EtaSystError");
if (isNSD) {
histoEtaInvYield[i]->Scale(scalingToNSD);
graphEtaInvYieldStat[i] = ScaleGraph(graphEtaInvYieldStat[i],scalingToNSD);
graphEtaInvYieldSys[i] = ScaleGraph(graphEtaInvYieldSys[i],scalingToNSD);
}
cout << nameMeasGlobalPlot[i].Data() << " eta stat:" << graphEtaInvYieldStat[i] << endl;
if(doOutput) graphEtaInvYieldStat[i]->Print();
cout << nameMeasGlobalPlot[i].Data() << " eta sys:" << graphEtaInvYieldSys[i] << endl;
if(doOutput) graphEtaInvYieldSys[i]->Print();
// load cross section systematics and datapoints
histoEtaNuclModFac[i] = (TH1D*)directoryEta[i]->Get("histoNuclearModFactorEtaStat");
graphEtaNuclModFacStat[i] = (TGraphAsymmErrors*)directoryEta[i]->Get("graphNuclearModFactorEtaStat");
graphEtaNuclModFacSys[i] = (TGraphAsymmErrors*)directoryEta[i]->Get("graphNuclearModFactorEtaSys");
if(histoEtaNuclModFac[i] && graphEtaNuclModFacStat[i] && graphEtaNuclModFacSys[i]){
nNuclModFacAvailEta+=1;
haveEtaNuclModFac[i] = kTRUE;
cout << nameMeasGlobalPlot[i].Data() << " eta RpA stat:" << graphEtaNuclModFacStat[i] << endl;
if(doOutput) graphEtaNuclModFacStat[i]->Print();
cout << nameMeasGlobalPlot[i].Data() << " eta RpA sys:" << graphEtaNuclModFacSys[i] << endl;
if(doOutput) graphEtaNuclModFacSys[i]->Print();
}
histoEtaToPi0Stat[i] = (TH1D*)directoryEta[i]->Get("EtaToPi0StatError");
graphEtaToPi0Stat[i] = (TGraphAsymmErrors*)directoryEta[i]->Get("graphEtaToPi0StatError");
graphEtaToPi0Sys[i] = (TGraphAsymmErrors*)directoryEta[i]->Get("EtaToPi0SystError");
cout << nameMeasGlobalPlot[i].Data() << " eta/pi0 stat:" << histoEtaToPi0Stat[i] << endl;
cout << nameMeasGlobalPlot[i].Data() << " eta/pi0 stat:" << graphEtaToPi0Stat[i] << endl;
if(doOutput) if(graphEtaToPi0Stat[i])graphEtaToPi0Stat[i]->Print();
cout << nameMeasGlobalPlot[i].Data() << " eta/pi0 sys:" << graphEtaToPi0Sys[i] << endl;
if(doOutput) if(graphEtaToPi0Sys[i]) graphEtaToPi0Sys[i]->Print();
}
for (Int_t i = 0; i < totalNSets; i++){
if (haveAllPi0InvMass[i]){
histoPi0InvMassBGTot[i] = (TH1D*)histoPi0InvMassBG[i]->Clone(Form("Pi0_InvMassTotBG_Example_%s",nameMeasGlobalPlot[i].Data()));
histoPi0InvMassSigRemBGSub[i] = (TH1D*)histoPi0InvMassSig[i]->Clone(Form("Pi0_InvMassSigRemBGSub_Example_%s",nameMeasGlobalPlot[i].Data()));
}
}
}
cout << __LINE__ << endl;
// *******************************************************************************************************
// ************************** Loading other energies ************************************************
// *******************************************************************************************************
TFile* filePP8TeV = new TFile(fileNamePP8TeV.Data());
TH1D* histoPP8TeVPi0Stat = (TH1D*) filePP8TeV->Get("Pi08TeV/CorrectedYieldPi0");
TGraphAsymmErrors* graphPP8TeVPi0Stat = (TGraphAsymmErrors*) filePP8TeV->Get("Pi08TeV/graphCorrectedYieldPi0");
TGraphAsymmErrors* graphPP8TeVPi0Sys = (TGraphAsymmErrors*) filePP8TeV->Get("Pi08TeV/Pi0SystError");
TFile* fileTheoryCompilation = new TFile(fileNameTheory.Data());
TFile* fileTheoryCompilationPPb = new TFile(fileNameTheoryPPb.Data());
// *******************************************************************************************************
// ************************** Loading reference spectra ***********************************************
// *******************************************************************************************************
TGraphAsymmErrors* statErrorCollectionPi0PP[11];
TGraphAsymmErrors* systErrorCollectionPi0PP[11];
TGraphAsymmErrors* systErrorUnCorrCollectionPi0PP[11];
TGraphAsymmErrors* systErrorInterCollectionPi0PP[11];
TGraphAsymmErrors* statErrorCollectionPi0PPFitRatio_woXErr[11];
TGraphAsymmErrors* systErrorCollectionPi0PPFitRatio[11];
TGraphAsymmErrors* statErrorCollectionEtaPP[11];
TGraphAsymmErrors* systErrorCollectionEtaPP[11];
TGraphAsymmErrors* systErrorUnCorrCollectionEtaPP[11];
TGraphAsymmErrors* systErrorInterCollectionEtaPP[11];
Bool_t haveRefPPPi0[11] = { kFALSE, kFALSE, kFALSE, kFALSE, kFALSE,
kFALSE, kFALSE, kFALSE, kFALSE, kFALSE,
kFALSE };
Bool_t haveRefPPEta[11] = { kFALSE, kFALSE, kFALSE, kFALSE, kFALSE,
kFALSE, kFALSE, kFALSE, kFALSE, kFALSE,
kFALSE };
for (Int_t i = 0; i< 11; i++){
statErrorCollectionPi0PP[i] = NULL;
systErrorCollectionPi0PP[i] = NULL;
systErrorUnCorrCollectionPi0PP[i] = NULL;
systErrorInterCollectionPi0PP[i] = NULL;
statErrorCollectionEtaPP[i] = NULL;
systErrorCollectionEtaPP[i] = NULL;
systErrorUnCorrCollectionEtaPP[i] = NULL;
systErrorInterCollectionEtaPP[i] = NULL;
}
TFile* fileReference = new TFile(fileNameReference.Data());
TF1* fitPPInvXsectionPi0 = (TF1*)fileReference->Get("Pi08TeV/TwoComponentModelFitPi0");
for (Int_t i = 0; i< 11; i++){
statErrorCollectionPi0PP[i] = (TGraphAsymmErrors*)fileReference->Get(Form("Pi08TeV/graphInvCrossSectionPi0%s8TeVStatErr_yShifted",nameMeasReference[i].Data()));
if(statErrorCollectionPi0PP[i]){
statErrorCollectionPi0PPFitRatio_woXErr[i] = CalculateGraphErrRatioToFit(statErrorCollectionPi0PP[i],fitPPInvXsectionPi0);
ProduceGraphAsymmWithoutXErrors(statErrorCollectionPi0PPFitRatio_woXErr[i]);
}
systErrorCollectionPi0PP[i] = (TGraphAsymmErrors*)fileReference->Get(Form("Pi08TeV/graphInvCrossSectionPi0%s8TeVSysErr_yShifted",nameMeasReference[i].Data()));
if(systErrorCollectionPi0PP[i])
systErrorCollectionPi0PPFitRatio[i] = CalculateGraphErrRatioToFit(systErrorCollectionPi0PP[i],fitPPInvXsectionPi0);
systErrorUnCorrCollectionPi0PP[i] = (TGraphAsymmErrors*)fileReference->Get(Form("Pi08TeV/graphInvCrossSectionPi0%s8TeVSysErr_yShifted",nameMeasReference[i].Data())); //sUnCorrSysErr
systErrorInterCollectionPi0PP[i] = (TGraphAsymmErrors*)fileReference->Get(Form("Pi08TeV/graphInvCrossSectionPi0%s8TeVSysErr_yShifted",nameMeasReference[i].Data())); //sInterpolSysErr
if (statErrorCollectionPi0PP[i] && systErrorCollectionPi0PP[i] && systErrorUnCorrCollectionPi0PP[i] && systErrorInterCollectionPi0PP[i]){
haveRefPPPi0[i] = kTRUE;
// statErrorCollectionPi0PP[i] = ScaleGraphAsym(statErrorCollectionPi0PP[i],xSection8TeVINEL/xSection8TeVV0AND);
// systErrorCollectionPi0PP[i] = ScaleGraphAsym(systErrorCollectionPi0PP[i],xSection8TeVINEL/xSection8TeVV0AND);
// systErrorUnCorrCollectionPi0PP[i] = ScaleGraphAsym(systErrorUnCorrCollectionPi0PP[i],xSection8TeVINEL/xSection8TeVV0AND);
// systErrorInterCollectionPi0PP[i] = ScaleGraphAsym(systErrorInterCollectionPi0PP[i],xSection8TeVINEL/xSection8TeVV0AND);
}
statErrorCollectionEtaPP[i] = (TGraphAsymmErrors*)fileReference->Get(Form("Eta8TeV/graphInvCrossSectionEta%s8TeVStatErr_yShifted",nameMeasReference[i].Data()));
systErrorCollectionEtaPP[i] = (TGraphAsymmErrors*)fileReference->Get(Form("Eta8TeV/graphInvCrossSectionEta%s8TeVSysErr_yShifted",nameMeasReference[i].Data()));
systErrorUnCorrCollectionEtaPP[i] = (TGraphAsymmErrors*)fileReference->Get(Form("Eta8TeV/graphInvCrossSectionEta%s8TeVSysErr_yShifted",nameMeasReference[i].Data())); //sUnCorrSysErr
systErrorInterCollectionEtaPP[i] = (TGraphAsymmErrors*)fileReference->Get(Form("Eta8TeV/graphInvCrossSectionEta%s8TeVSysErr_yShifted",nameMeasReference[i].Data())); //sInterpolSysErr
if (statErrorCollectionEtaPP[i] && systErrorCollectionEtaPP[i] && systErrorUnCorrCollectionEtaPP[i] && systErrorInterCollectionEtaPP[i])
haveRefPPEta[i] = kTRUE;
if (haveRefPPPi0[i])
cout << "found pi0 pp reference for " << nameMeasReference[i].Data() << endl;
if (haveRefPPEta[i])
cout << "found eta pp reference for " << nameMeasReference[i].Data() << endl;
}
Double_t xSection8TeV = ReturnCorrectXSection("8TeV", 1);; // option is wrong fix when possible
Double_t xSection8TeVErr = xSection8TeVErrDown*1e-3;
TGraphAsymmErrors* graphPPCombPi0StatFitRatio_woXErr = NULL;
TGraphAsymmErrors* graphPPCombPi0Stat = (TGraphAsymmErrors*)fileReference->Get("Pi08TeV/graphInvCrossSectionPi0Comb8TeVAStatErr_yShifted");
if(graphPPCombPi0Stat){
graphPPCombPi0StatFitRatio_woXErr = CalculateGraphErrRatioToFit(graphPPCombPi0Stat,fitPPInvXsectionPi0);
ProduceGraphAsymmWithoutXErrors(graphPPCombPi0StatFitRatio_woXErr);
}
TGraphAsymmErrors* graphPPCombPi0UncorrSys = (TGraphAsymmErrors*)fileReference->Get("Pi08TeV/graphInvCrossSectionPi0Comb8TeVASysErr_yShifted"); // uncorr sys
TGraphAsymmErrors* graphPPCombPi0FullSysFitRatio = NULL;
TGraphAsymmErrors* graphPPCombPi0FullSys = (TGraphAsymmErrors*)fileReference->Get("Pi08TeV/graphInvCrossSectionPi0Comb8TeVASysErr_yShifted");
if(graphPPCombPi0FullSys)
graphPPCombPi0FullSysFitRatio = CalculateGraphErrRatioToFit(graphPPCombPi0FullSys,fitPPInvXsectionPi0);
TGraphAsymmErrors* graphPPCombPi0InterSys = (TGraphAsymmErrors*)fileReference->Get("Pi08TeV/graphInvCrossSectionPi0Comb8TeVASysErr_yShifted");
TGraphAsymmErrors* graphPPInvYieldCombPi0Stat = (TGraphAsymmErrors*)graphPPCombPi0Stat->Clone("graphInvYieldStatErrComb");
TGraphAsymmErrors* graphPPInvYieldCombPi0Sys = (TGraphAsymmErrors*)graphPPCombPi0FullSys->Clone("graphInvYieldSystErrComb");
graphPPInvYieldCombPi0Stat = ScaleGraph(graphPPCombPi0Stat,1/(xSection8TeV*recalcBarn));
graphPPInvYieldCombPi0Sys = ScaleGraph(graphPPInvYieldCombPi0Sys,1/(xSection8TeV*recalcBarn));
TGraphAsymmErrors* graphPPInvYieldCombPi0Stat_woXErr = (TGraphAsymmErrors*)graphPPInvYieldCombPi0Stat->Clone("graphPPInvYieldCombPi0Stat_woXErr");
ProduceGraphAsymmWithoutXErrors(graphPPInvYieldCombPi0Stat_woXErr);
TF1* fitPPInvXsectionEta = (TF1*)fileReference->Get("Eta8TeV/TwoComponentModelFitEta");
TGraphAsymmErrors* graphPPCombEtaStat = (TGraphAsymmErrors*)fileReference->Get("Eta8TeV/graphInvCrossSectionEtaComb8TeVAStatErr_yShifted");
TGraphAsymmErrors* graphPPCombEtaUncorrSys = (TGraphAsymmErrors*)fileReference->Get("Eta8TeV/graphInvCrossSectionEtaComb8TeVASysErr_yShifted");
TGraphAsymmErrors* graphPPCombEtaFullSys = (TGraphAsymmErrors*)fileReference->Get("Eta8TeV/graphInvCrossSectionEtaComb8TeVASysErr_yShifted");
TGraphAsymmErrors* graphPPCombEtaInterSys = (TGraphAsymmErrors*)fileReference->Get("Eta8TeV/graphInvCrossSectionEtaComb8TeVASysErr_yShifted");
TGraphAsymmErrors* graphPPInvYieldCombEtaStat = (TGraphAsymmErrors*)graphPPCombEtaStat->Clone("graphInvYieldStatErrComb");
TGraphAsymmErrors* graphPPInvYieldCombEtaSys = (TGraphAsymmErrors*)graphPPCombEtaFullSys->Clone("graphInvYieldSystErrComb");
graphPPInvYieldCombEtaStat = ScaleGraph(graphPPCombEtaStat,1/(xSection8TeV*recalcBarn));
graphPPInvYieldCombEtaSys = ScaleGraph(graphPPInvYieldCombEtaSys,1/(xSection8TeV*recalcBarn));
TGraphAsymmErrors* graphPPInvYieldCombEtaStat_woXErr = (TGraphAsymmErrors*)graphPPInvYieldCombEtaStat->Clone("graphPPInvYieldCombEtaStat_woXErr");
ProduceGraphAsymmWithoutXErrors(graphPPInvYieldCombEtaStat_woXErr);
TFile* fileReferencePub = new TFile("ExternalInput/CombNeutralMesons/CombinedResultsPaperPP8TeV_2017_11_16.root");
TGraphAsymmErrors* graphPPCombPi0StatFitRatioPub_woXErr = (TGraphAsymmErrors*)fileReferencePub->Get("Pi08TeV/graphInvCrossSectionPi0Comb8TeVAStatErr_yShifted");
graphPPCombPi0StatFitRatioPub_woXErr = CalculateGraphErrRatioToFit(graphPPCombPi0StatFitRatioPub_woXErr,fitPPInvXsectionPi0);
ProduceGraphAsymmWithoutXErrors(graphPPCombPi0StatFitRatioPub_woXErr);
TGraphAsymmErrors* graphPPCombPi0FullSysPub = (TGraphAsymmErrors*)fileReferencePub->Get("Pi08TeV/graphInvCrossSectionPi0Comb8TeVASysErr_yShifted");
if(graphPPCombPi0FullSysPub)
graphPPCombPi0FullSysPub = CalculateGraphErrRatioToFit(graphPPCombPi0FullSysPub,fitPPInvXsectionPi0);
// *******************************************************************************************************
// ************************** Loading charged spectra ************************************************
// *******************************************************************************************************
TFile* fileCHadrons = new TFile(fileNameCHadrons.Data());
TFile* fileCParticles = new TFile(fileNameCParticles.Data());
TGraphAsymmErrors* graphChargedHadronsStatpPb8TeV= (TGraphAsymmErrors*) fileCHadrons->Get("g1stat");
graphChargedHadronsStatpPb8TeV = ScaleGraph(graphChargedHadronsStatpPb8TeV,67.6*1e-3*recalcBarn);
TGraphAsymmErrors* graphChargedHadronsSyspPb8TeV = (TGraphAsymmErrors*) fileCHadrons->Get("g1syst");
graphChargedHadronsSyspPb8TeV = ScaleGraph(graphChargedHadronsSyspPb8TeV,67.6*1e-3*recalcBarn);
cout << __LINE__ << endl;
TList* listStatChargedPionpPb8TeVprelim = (TList*)fileCParticles->Get("Summed_Pion");
TList* listSysChargedPionpPb8TeVprelim = (TList*)fileCParticles->Get("Summed_Pion_Sys");
TList* listStatChargedKaonpPb8TeVprelim = (TList*)fileCParticles->Get("Summed_Kaon");
TList* listSysChargedKaonpPb8TeVprelim = (TList*)fileCParticles->Get("Summed_Kaon_Sys");
TGraphAsymmErrors* graphChargedPionStatpPb8TeV = new TGraphAsymmErrors( (TH1D*)listStatChargedPionpPb8TeVprelim->FindObject("hSpectraSummedPion_pp_Combined_MB"));
graphChargedPionStatpPb8TeV = ConvertYieldGraph(graphChargedPionStatpPb8TeV, kTRUE, kTRUE, kFALSE, kFALSE);
graphChargedPionStatpPb8TeV = ScaleGraph(graphChargedPionStatpPb8TeV,0.5*67.6*1e-3*recalcBarn);
TGraphAsymmErrors* graphChargedPionSyspPb8TeV = new TGraphAsymmErrors( (TH1D*)listSysChargedPionpPb8TeVprelim->FindObject("hSpectraSummedPion_pp_Combined_MB"));
graphChargedPionSyspPb8TeV = ConvertYieldGraph(graphChargedPionSyspPb8TeV, kTRUE, kTRUE, kFALSE, kFALSE);
graphChargedPionSyspPb8TeV = ScaleGraph(graphChargedPionSyspPb8TeV,0.5*67.6*1e-3*recalcBarn);
TGraphAsymmErrors* graphChargedKaonStatpPb8TeV = new TGraphAsymmErrors( (TH1D*)listStatChargedKaonpPb8TeVprelim->FindObject("hSpectraSummedKaon_pp_Combined_MB"));
graphChargedKaonStatpPb8TeV = ConvertYieldGraph(graphChargedKaonStatpPb8TeV, kTRUE, kTRUE, kFALSE, kFALSE);
graphChargedKaonStatpPb8TeV = ScaleGraph(graphChargedKaonStatpPb8TeV,0.5*67.6*1e-3*recalcBarn);
TGraphAsymmErrors* graphChargedKaonSyspPb8TeV = new TGraphAsymmErrors( (TH1D*)listSysChargedKaonpPb8TeVprelim->FindObject("hSpectraSummedKaon_pp_Combined_MB"));
graphChargedKaonSyspPb8TeV = ConvertYieldGraph(graphChargedKaonSyspPb8TeV, kTRUE, kTRUE, kFALSE, kFALSE);
graphChargedKaonSyspPb8TeV = ScaleGraph(graphChargedKaonSyspPb8TeV,0.5*67.6*1e-3*recalcBarn);
// *******************************************************************************************************
// ************************** Loading theory calculations ************************************************
// *******************************************************************************************************
TFile* fileEtaToPi = new TFile(fileNameEtaToPi0.Data());
TH1F* histoHIJINGPi0 = (TH1F*) fileTheoryCompilationPPb->Get("pPb_8.16TeV/histoPi0SpecHIJING_MCGenpPb8TeV");
TH1F* histoHIJINGEta = (TH1F*) fileTheoryCompilationPPb->Get("pPb_8.16TeV/histoEtaSpecHIJING_MCGenpPb8TeV");
TH1F* histoHIJINGEtaToPi0 = (TH1F*) fileTheoryCompilationPPb->Get("pPb_8.16TeV/histoEtaToPi0HIJING_MCGenpPb8TeV");
TH1F* histoHIJINGPi0ToPiCh = (TH1F*) fileTheoryCompilationPPb->Get("pPb_8.16TeV/histoPi0ToPiChHIJING_MCGenpPb8TeV");
// EPOS JJ From LHC18b9bc
TH1F* histoEPOSJJInvYield = (TH1F*) fileTheoryCompilationPPb->Get("pPb_8.16TeV/histoPi0SpecEPOSJJpPb8TeV_Reb");
histoEPOSJJInvYield->GetXaxis()->SetRangeUser(10,maxPtPi0Theory-5);
TH1F* histoEPOSJJInvYieldEta = (TH1F*) fileTheoryCompilationPPb->Get("pPb_8.16TeV/histoEtaSpecEPOSJJpPb8TeV_Reb");
histoEPOSJJInvYieldEta->GetXaxis()->SetRangeUser(10,maxPtEta-1);
TGraphErrors* graphEPOSJJInvYield = new TGraphErrors((TH1F*) fileTheoryCompilationPPb->Get("pPb_8.16TeV/histoPi0SpecEPOSJJpPb8TeV_Reb"));
while(graphEPOSJJInvYield->GetX()[0] < 10) graphEPOSJJInvYield->RemovePoint(0);
while(graphEPOSJJInvYield->GetX()[graphEPOSJJInvYield->GetN()-1] > maxPtPi0Theory-5) graphEPOSJJInvYield->RemovePoint(graphEPOSJJInvYield->GetN()-1);
TGraphErrors* graphEPOSJJInvYieldEta = new TGraphErrors((TH1F*) fileTheoryCompilationPPb->Get("pPb_8.16TeV/histoEtaSpecEPOSJJpPb8TeV_Reb"));
while(graphEPOSJJInvYieldEta->GetX()[0] < 10) graphEPOSJJInvYieldEta->RemovePoint(0);
while(graphEPOSJJInvYieldEta->GetX()[graphEPOSJJInvYieldEta->GetN()-1] > maxPtEta-1) graphEPOSJJInvYieldEta->RemovePoint(graphEPOSJJInvYieldEta->GetN()-1);
TH1F* histoEPOSJJEtaToPi0 = (TH1F*) histoEPOSJJInvYieldEta->Clone("Pythia8EtaToPi0_EPOS");
histoEPOSJJEtaToPi0->Divide(histoEPOSJJInvYield);
histoEPOSJJEtaToPi0->GetXaxis()->SetRangeUser(0.4,maxPtEta-1);
TGraphErrors* graphEPOSJJEtaToPi0 = new TGraphErrors(histoEPOSJJEtaToPi0);
while(graphEPOSJJEtaToPi0->GetX()[0] < 10) graphEPOSJJEtaToPi0->RemovePoint(0);
while(graphEPOSJJEtaToPi0->GetX()[graphEPOSJJEtaToPi0->GetN()-1] > maxPtEta-1) graphEPOSJJEtaToPi0->RemovePoint(graphEPOSJJEtaToPi0->GetN()-1);
// DPMJET from LHC18f3bc
TH1F* histoDPMJETInvYield = (TH1F*) fileTheoryCompilationPPb->Get("pPb_8.16TeV/histoPi0SpecDPMJETpPb8TeV_Reb");
histoDPMJETInvYield->GetXaxis()->SetRangeUser(0.3,maxPtPi0Theory-5);
TH1F* histoDPMJETInvYieldEta = (TH1F*) fileTheoryCompilationPPb->Get("pPb_8.16TeV/histoEtaSpecDPMJETpPb8TeV_Reb");
histoDPMJETInvYieldEta->GetXaxis()->SetRangeUser(0.5,maxPtEta-1);
TGraphErrors* graphDPMJETInvYield = new TGraphErrors((TH1F*) fileTheoryCompilationPPb->Get("pPb_8.16TeV/histoPi0SpecDPMJETpPb8TeV_Reb"));
while(graphDPMJETInvYield->GetX()[0] < 0.3) graphDPMJETInvYield->RemovePoint(0);
while(graphDPMJETInvYield->GetX()[graphDPMJETInvYield->GetN()-1] > maxPtPi0Theory-5) graphDPMJETInvYield->RemovePoint(graphDPMJETInvYield->GetN()-1);
TGraphErrors* graphDPMJETInvYieldEta = new TGraphErrors((TH1F*) fileTheoryCompilationPPb->Get("pPb_8.16TeV/histoEtaSpecDPMJETpPb8TeV_Reb"));
while(graphDPMJETInvYieldEta->GetX()[0] < 0.5) graphDPMJETInvYieldEta->RemovePoint(0);
while(graphDPMJETInvYieldEta->GetX()[graphDPMJETInvYieldEta->GetN()-1] > maxPtEta-1) graphDPMJETInvYieldEta->RemovePoint(graphDPMJETInvYieldEta->GetN()-1);
TH1F* histoDPMJETEtaToPi0 = (TH1F*) histoDPMJETInvYieldEta->Clone("Pythia8EtaToPi0_DPMJET");
histoDPMJETEtaToPi0->Divide(histoDPMJETInvYield);
histoDPMJETEtaToPi0->GetXaxis()->SetRangeUser(0.4,maxPtEta-1);
TGraphErrors* graphDPMJETEtaToPi0 = new TGraphErrors(histoDPMJETEtaToPi0);
while(graphDPMJETEtaToPi0->GetX()[0] < 0.4) graphDPMJETEtaToPi0->RemovePoint(0);
while(graphDPMJETEtaToPi0->GetX()[graphDPMJETEtaToPi0->GetN()-1] > maxPtEta-1) graphDPMJETEtaToPi0->RemovePoint(graphDPMJETEtaToPi0->GetN()-1);
TH1F* histoPythia8EPPS16InvYield = (TH1F*) fileTheoryCompilationPPb->Get("pPb_8.16TeV/histoPi0Pythia8EPPS16pPb8TeV");
histoPythia8EPPS16InvYield->Scale(208);
histoPythia8EPPS16InvYield->GetXaxis()->SetRangeUser(0.3,maxPtPi0Theory-5);
TH1F* histoPythia8EPPS16InvYieldEta = (TH1F*) fileTheoryCompilationPPb->Get("pPb_8.16TeV/histoEtaPythia8EPPS16pPb8TeV");
histoPythia8EPPS16InvYieldEta->Scale(208);
histoPythia8EPPS16InvYieldEta->GetXaxis()->SetRangeUser(0.5,maxPtEta-1);
TGraphErrors* graphPythia8EPPS16InvYield = new TGraphErrors((TH1F*) fileTheoryCompilationPPb->Get("pPb_8.16TeV/histoPi0Pythia8EPPS16pPb8TeV"));
graphPythia8EPPS16InvYield=ScaleGraph(graphPythia8EPPS16InvYield,208);
while(graphPythia8EPPS16InvYield->GetX()[0] < 0.3) graphPythia8EPPS16InvYield->RemovePoint(0);
while(graphPythia8EPPS16InvYield->GetX()[graphPythia8EPPS16InvYield->GetN()-1] > maxPtPi0Theory-5) graphPythia8EPPS16InvYield->RemovePoint(graphPythia8EPPS16InvYield->GetN()-1);
TGraphErrors* graphPythia8EPPS16InvYieldEta = new TGraphErrors((TH1F*) fileTheoryCompilationPPb->Get("pPb_8.16TeV/histoEtaPythia8EPPS16pPb8TeV"));
graphPythia8EPPS16InvYieldEta=ScaleGraph(graphPythia8EPPS16InvYieldEta,208);
while(graphPythia8EPPS16InvYieldEta->GetX()[0] < 0.5) graphPythia8EPPS16InvYieldEta->RemovePoint(0);
while(graphPythia8EPPS16InvYieldEta->GetX()[graphPythia8EPPS16InvYieldEta->GetN()-1] > maxPtEta-1) graphPythia8EPPS16InvYieldEta->RemovePoint(graphPythia8EPPS16InvYieldEta->GetN()-1);
TH1F* histoPythia8nCTEQ15InvYield = (TH1F*) fileTheoryCompilationPPb->Get("pPb_8.16TeV/histoPi0Pythia8nCTEQ15pPb8TeV");
histoPythia8nCTEQ15InvYield->Scale(208);
histoPythia8nCTEQ15InvYield->GetXaxis()->SetRangeUser(0.3,maxPtPi0Theory-5);
TH1F* histoPythia8nCTEQ15InvYieldEta = (TH1F*) fileTheoryCompilationPPb->Get("pPb_8.16TeV/histoEtaPythia8nCTEQ15pPb8TeV");
histoPythia8nCTEQ15InvYieldEta->Scale(208);
histoPythia8nCTEQ15InvYieldEta->GetXaxis()->SetRangeUser(0.5,maxPtEta-1);
TGraphErrors* graphPythia8nCTEQ15InvYield = new TGraphErrors((TH1F*) fileTheoryCompilationPPb->Get("pPb_8.16TeV/histoPi0Pythia8nCTEQ15pPb8TeV"));
graphPythia8nCTEQ15InvYield=ScaleGraph(graphPythia8nCTEQ15InvYield,208);
while(graphPythia8nCTEQ15InvYield->GetX()[0] < 0.3) graphPythia8nCTEQ15InvYield->RemovePoint(0);
while(graphPythia8nCTEQ15InvYield->GetX()[graphPythia8nCTEQ15InvYield->GetN()-1] > maxPtPi0Theory-5) graphPythia8nCTEQ15InvYield->RemovePoint(graphPythia8nCTEQ15InvYield->GetN()-1);
TGraphErrors* graphPythia8nCTEQ15InvYieldEta = new TGraphErrors((TH1F*) fileTheoryCompilationPPb->Get("pPb_8.16TeV/histoEtaPythia8nCTEQ15pPb8TeV"));
graphPythia8nCTEQ15InvYieldEta=ScaleGraph(graphPythia8nCTEQ15InvYieldEta,208);
while(graphPythia8nCTEQ15InvYieldEta->GetX()[0] < 0.5) graphPythia8nCTEQ15InvYieldEta->RemovePoint(0);
while(graphPythia8nCTEQ15InvYieldEta->GetX()[graphPythia8nCTEQ15InvYieldEta->GetN()-1] > maxPtEta-1) graphPythia8nCTEQ15InvYieldEta->RemovePoint(graphPythia8nCTEQ15InvYieldEta->GetN()-1);
TH1F* histoPythia8Monash2013InvSecpTh = (TH1F*) fileTheoryCompilation->Get("histoInvSecpThPythia8Monash2013LegoPi08160GeV");
histoPythia8Monash2013InvSecpTh->Scale(1/(2.1*1e12));
histoPythia8Monash2013InvSecpTh->GetXaxis()->SetRangeUser(0.3,maxPtPi0Theory-5);
TH1F* histoPythia8Monash2013InvSecpThEta = (TH1F*) fileTheoryCompilation->Get("histoInvSecpThPythia8Monash2013LegoEta8160GeV");
histoPythia8Monash2013InvSecpThEta->Scale(1/(2.1*1e12));
histoPythia8Monash2013InvSecpThEta->GetXaxis()->SetRangeUser(0.5,maxPtEta-1);
TGraphErrors* graphPythia8Monash2013InvSecpTh = new TGraphErrors((TH1F*) fileTheoryCompilation->Get("histoInvSecpThPythia8Monash2013LegoPi08160GeV"));
while(graphPythia8Monash2013InvSecpTh->GetX()[0] < 0.3) graphPythia8Monash2013InvSecpTh->RemovePoint(0);
while(graphPythia8Monash2013InvSecpTh->GetX()[graphPythia8Monash2013InvSecpTh->GetN()-1] > maxPtPi0Theory-5) graphPythia8Monash2013InvSecpTh->RemovePoint(graphPythia8Monash2013InvSecpTh->GetN()-1);
TGraphErrors* graphPythia8Monash2013InvSecpThEta = new TGraphErrors((TH1F*) fileTheoryCompilation->Get("histoInvSecpThPythia8Monash2013LegoEta8160GeV"));
while(graphPythia8Monash2013InvSecpThEta->GetX()[0] < 0.5) graphPythia8Monash2013InvSecpThEta->RemovePoint(0);
while(graphPythia8Monash2013InvSecpThEta->GetX()[graphPythia8Monash2013InvSecpThEta->GetN()-1] > maxPtEta-1) graphPythia8Monash2013InvSecpThEta->RemovePoint(graphPythia8Monash2013InvSecpThEta->GetN()-1);
// pythia for pp reference (monash 2013)
TH1F* histoPythia8Monash2013InvXSection = (TH1F*) fileTheoryCompilation->Get("histoInvSecPythia8Monash2013LegoPi08TeV");
histoPythia8Monash2013InvXSection->Scale(1/(xSection8TeV*recalcBarn));
histoPythia8Monash2013InvXSection->GetXaxis()->SetRangeUser(0.3,200);
TH1F* histoPythia8Monash2013InvXSectionEta = (TH1F*) fileTheoryCompilation->Get("histoInvSecPythia8Monash2013LegoEta8TeV");
histoPythia8Monash2013InvXSectionEta->Scale(1/(xSection8TeV*recalcBarn));
histoPythia8Monash2013InvXSectionEta->GetXaxis()->SetRangeUser(0.4,35);
TGraphErrors* graphPythia8Monash2013InvXSection = new TGraphErrors((TH1F*) fileTheoryCompilation->Get("histoInvSecPythia8Monash2013LegoPi08TeV"));
graphPythia8Monash2013InvXSection = ScaleGraph(graphPythia8Monash2013InvXSection, 1/(xSection8TeV*recalcBarn));
while(graphPythia8Monash2013InvXSection->GetX()[0] < 0.3) graphPythia8Monash2013InvXSection->RemovePoint(0);
// while(graphPythia8Monash2013InvXSection->GetX()[graphPythia8Monash2013InvXSection->GetN()-1] > 35.) graphPythia8Monash2013InvXSection->RemovePoint(graphPythia8Monash2013InvXSection->GetN()-1);
TGraphErrors* graphPythia8Monash2013InvXSectionEta = new TGraphErrors((TH1F*) fileTheoryCompilation->Get("histoInvSecPythia8Monash2013LegoEta8TeV"));
graphPythia8Monash2013InvXSectionEta = ScaleGraph(graphPythia8Monash2013InvXSectionEta, 1/(xSection8TeV*recalcBarn));
while(graphPythia8Monash2013InvXSectionEta->GetX()[0] < 0.4) graphPythia8Monash2013InvXSectionEta->RemovePoint(0);
while(graphPythia8Monash2013InvXSectionEta->GetX()[graphPythia8Monash2013InvXSectionEta->GetN()-1] > 35.) graphPythia8Monash2013InvXSectionEta->RemovePoint(graphPythia8Monash2013InvXSectionEta->GetN()-1);
// *******************************************************************************************************
// NLO calc
TGraphAsymmErrors* graphPi0DSS14 = (TGraphAsymmErrors*) fileTheoryCompilation->Get("graphNLOCalcDSS14InvSecPi05023GeV");
while (graphPi0DSS14->GetX()[graphPi0DSS14->GetN()-1] > maxPtPi0 ) graphPi0DSS14->RemovePoint(graphPi0DSS14->GetN()-1);
while(graphPi0DSS14->GetX()[0] < 2.0) graphPi0DSS14->RemovePoint(0);
// graphPi0DSS14 = ScaleGraph(graphPi0DSS14,7.118/(xSection8TeVINEL*recalcBarn));
graphPi0DSS14 = ScaleGraph(graphPi0DSS14,7.118/(xSection8TeVV0AND*recalcBarn));
TGraphAsymmErrors* graphEtaAESSS = (TGraphAsymmErrors*) fileTheoryCompilation->Get("graphNLOCalcAESSSInvSecEta5023GeV");
TGraphAsymmErrors* graphEtaToPi02760GeV = (TGraphAsymmErrors*) fileEtaToPi->Get("Alice2760GeV");
ProduceGraphAsymmWithoutXErrors(graphEtaToPi02760GeV);
TGraphAsymmErrors* graphEtaToPi08000GeV = (TGraphAsymmErrors*) fileEtaToPi->Get("Alice8TeV");
ProduceGraphAsymmWithoutXErrors(graphEtaToPi08000GeV);
cout << __LINE__ << endl;
// *******************************************************************************************************
TGraph* graphNLOCalcPi0MuHalf = (TGraph*)fileTheoryCompilation->Get("graphNLOCalcDSS14InvSecPi0MuHalf5023GeV");
graphNLOCalcPi0MuHalf = ScaleGraph(graphNLOCalcPi0MuHalf,7.118/(xSection8TeVINEL*recalcBarn));
TGraph* graphNLOCalcPi0MuOne = (TGraph*)fileTheoryCompilation->Get("graphNLOCalcDSS14InvSecPi0MuOne5023GeV");
graphNLOCalcPi0MuOne = ScaleGraph(graphNLOCalcPi0MuOne,7.118/(xSection8TeVINEL*recalcBarn));
TGraph* graphNLOCalcPi0MuTwo = (TGraph*)fileTheoryCompilation->Get("graphNLOCalcDSS14InvSecPi0MuTwo5023GeV");
graphNLOCalcPi0MuTwo = ScaleGraph(graphNLOCalcPi0MuTwo,7.118/(xSection8TeVINEL*recalcBarn));
TGraph* graphNLOCalcEtaMuHalf = (TGraph*)fileTheoryCompilation->Get("graphNLOCalcAESSSInvSecEtaMuHalf5023GeV");
TGraph* graphNLOCalcEtaMuOne = (TGraph*)fileTheoryCompilation->Get("graphNLOCalcAESSSInvSecEtaMuOne5023GeV");
TGraph* graphNLOCalcEtaMuTwo = (TGraph*)fileTheoryCompilation->Get("graphNLOCalcAESSSInvSecEtaMuTwo5023GeV");
while (graphNLOCalcPi0MuHalf->GetX()[graphNLOCalcPi0MuHalf->GetN()-1] > maxPtPi0-5 )
graphNLOCalcPi0MuHalf->RemovePoint(graphNLOCalcPi0MuHalf->GetN()-1);
while (graphNLOCalcPi0MuOne->GetX()[graphNLOCalcPi0MuOne->GetN()-1] > maxPtPi0-5 )
graphNLOCalcPi0MuOne->RemovePoint(graphNLOCalcPi0MuOne->GetN()-1);
while (graphNLOCalcPi0MuTwo->GetX()[graphNLOCalcPi0MuTwo->GetN()-1] > maxPtPi0-5 )
graphNLOCalcPi0MuTwo->RemovePoint(graphNLOCalcPi0MuTwo->GetN()-1);
while (graphNLOCalcEtaMuHalf->GetX()[graphNLOCalcEtaMuHalf->GetN()-1] > maxPtEta-1 )
graphNLOCalcEtaMuHalf->RemovePoint(graphNLOCalcEtaMuHalf->GetN()-1);
while (graphNLOCalcEtaMuOne->GetX()[graphNLOCalcEtaMuOne->GetN()-1] > maxPtEta-1 )
graphNLOCalcEtaMuOne->RemovePoint(graphNLOCalcEtaMuOne->GetN()-1);
while (graphNLOCalcEtaMuTwo->GetX()[graphNLOCalcEtaMuTwo->GetN()-1] > maxPtEta-1 )
graphNLOCalcEtaMuTwo->RemovePoint(graphNLOCalcEtaMuTwo->GetN()-1);
TGraphAsymmErrors* graphNLOEtaToPi0 = (TGraphAsymmErrors*) fileTheoryCompilation->Get("graphNLOCalcEtaOverPi05023GeV_AESSS_DSS14");
while (graphNLOEtaToPi0->GetX()[graphNLOEtaToPi0->GetN()-1] > maxPtEta-1 ) graphNLOEtaToPi0->RemovePoint(graphNLOEtaToPi0->GetN()-1);
while(graphNLOEtaToPi0->GetX()[0] < 2.0) graphNLOEtaToPi0->RemovePoint(0);
cout << __LINE__ << endl;
// *******************************************************************************************************
// ************************** Combination of different measurements **************************************
// *******************************************************************************************************
// Int_t nBinsPi0 = 34;//36
Int_t nBinsPi0 = 58;//36
Double_t xPtLimits[59]= {
0.0, 0.3, 0.4, 0.5, 0.6, 0.8, 1.0, 1.2, 1.4, 1.6,
1.8, 2.0, 2.2, 2.4, 2.6, 2.8, 3.0, 3.2, 3.4, 3.6,
3.8, 4.0, 4.5, 5.0, 5.5, 6.0, 6.5, 7.0, 7.5, 8.0,
8.5, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0,
18.0, 20.0, 22.0, 26.0, 30.0, 35.0, 40.0 ,45.0, 50.0,
55.0, 60.0, 65.0, 70.0, 80.0, 100.0, 125.0, 150.0, 175.0, 200.0
// 0.0, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 1.0, 1.2, 1.4,
// 1.6, 1.8, 2.0, 2.2, 2.4, 2.6, 2.8, 3.0, 3.2, 3.4,
// 3.6, 3.8, 4.0, 4.5, 5.0, 5.5, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0,
// 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0, 22.0, 24.0,
// 26.0, 28.0, 30.0, 32.0, 34.0, 36.0, 38.0, 40.0, 45.0, 50.0,
// 55.0, 60.0, 65.0, 70.0, 80.0, 100.0, 125.0, 150.0, 175.0, 200.0
};
// Int_t nBinsPi0 = 60;//36
// Double_t xPtLimits[61]= {
// 0.0, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 1.0, 1.2, 1.4,
// 1.6, 1.8, 2.0, 2.2, 2.4, 2.6, 2.8, 3.0, 3.2, 3.4,
// 3.6, 3.8, 4.0, 4.5, 5.0, 5.5, 6.0, 7.0, 8.0, 10.0, 12.0,
// 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0, 22.0, 24.0,
// 26.0, 28.0, 30.0, 32.0, 34.0, 36.0, 38.0, 40.0, 45.0, 50.0,
// 55.0, 60.0, 65.0, 70.0, 80.0, 100.0, 125.0, 150.0, 175.0, 200.0
// };
Int_t nBinsEta = 25;//15
Double_t xPtLimitsEta[29] = {
0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5,
4.0, 4.5, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 12.0, 14.0, 16.0, 18.0,
20.0, 25.0, 30.0, 35.0, 40.0,50.,60.
};
Double_t xPtLimitsEtaToPi0[29] = {
0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5,
4.0, 4.5, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 12.0, 14.0, 16.0, 18.0,
20.0, 25.0, 30.0, 35.0, 40.0,50.,60.
};
// Double_t xPtLimitsEta[29] = {
// 0.5, 0.8, 1.1, 1.4, 1.7, 2.0, 2.4, 2.8, 3.2, 3.6,
// 4.0, 4.5, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 12.0, 14.0, 16.0,
// 18.0, 20.0, 25.0, 30.0, 35.0, 40.0,50.,60.
// };
// Double_t xPtLimitsEtaToPi0[29] = {
// 0.5, 0.8, 1.1, 1.4, 1.7, 2.0, 2.4, 2.8, 3.2, 3.6,
// 4.0, 4.5, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 12.0, 14.0, 16.0,
// 18.0, 20.0, 25.0, 30.0, 35.0, 40.0,50.,60.
// };
// *******************************************************************************************************
// ************************** Combination of different 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
// 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
cout << __LINE__ << endl;
TH1D* statErrorCollection[13];
TH1D* statErrorCollectionEta[13];
TH1D* statErrorCollectionEtaToPi0[13];
for (Int_t i = 0; i< totalNSets; i++){
statErrorCollection[i] = NULL;
statErrorCollectionEta[i] = NULL;
statErrorCollectionEtaToPi0[i] = NULL;
}
for (Int_t i = 0; i< totalNSets; i++){
if(directoryPi0[i]&&histoPi0InvYield[i]) statErrorCollection[i] = (TH1D*)histoPi0InvYield[i]->Clone(Form("statErr%sPi0",nameMeasGlobalPlot[i].Data()));
if(directoryEta[i]&&histoEtaInvYield[i]) statErrorCollectionEta[i] = (TH1D*)histoEtaInvYield[i]->Clone(Form("statErr%sEta",nameMeasGlobalPlot[i].Data()));
if(directoryEta[i]&&histoEtaToPi0Stat[i]) statErrorCollectionEtaToPi0[i]= (TH1D*)histoEtaToPi0Stat[i]->Clone(Form("statErr%sEtaToPi0",nameMeasGlobalPlot[i].Data()));
}
cout << __LINE__ << endl;
// 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* sysErrorCollection[13];
TGraphAsymmErrors* sysErrorCollectionEta[13];
TGraphAsymmErrors* sysErrorCollectionEtaToPi0[13];
for (Int_t i = 0; i< totalNSets; i++){
sysErrorCollection[i] = NULL;
sysErrorCollectionEta[i] = NULL;
sysErrorCollectionEtaToPi0[i] = NULL;
}
for (Int_t i = 0; i< totalNSets; i++){
if(directoryPi0[i]&&graphPi0InvYieldSys[i]) sysErrorCollection[i] = (TGraphAsymmErrors*)graphPi0InvYieldSys[i]->Clone(Form("sysErr%sPi0",nameMeasGlobalPlot[i].Data()));
if(directoryEta[i]&&graphEtaInvYieldSys[i]) sysErrorCollectionEta[i]= (TGraphAsymmErrors*)graphEtaInvYieldSys[i]->Clone(Form("sysErr%sEta",nameMeasGlobalPlot[i].Data()));
if(directoryEta[i]&&graphEtaToPi0Sys[i]) sysErrorCollectionEtaToPi0[i] = (TGraphAsymmErrors*)graphEtaToPi0Sys[i]->Clone(Form("sysErr%sEtaToPi0",nameMeasGlobalPlot[i].Data()));
}
cout << __LINE__ << endl;
// Definition of offsets for stat & sys see output of function in shell, make sure pt bins match
// PCM,PHOS,EMC,PCMPHOS,PCMEMC, mEMC
Int_t offSets[13] = { 0, 2, 0, 2, 0, 0,0,0,8, 0,0,0,0};
Int_t offSetsSys[13] = { 1, 2, 7, 3, 5, 0,0,0,6, 38,0,0,0};
// Int_t offSets[13] = { 0, 2, 7, 2, 5, 0,0,0, 8,3,0,0,0};
// Int_t offSetsSys[13] = { 1, 2, 9, 3, 6, 0,0,0, 9,36,0,0,0};
Int_t offSetPi0Shifting[13] = { 0, 0, 0, 0, 0,
0, 0, 0, 0, 0,
0, 0, 0 };
Int_t nComBinsPi0Shifting[13] = { 0, 0, 0, 0, 0,
0, 0, 0, 0, 0,
0, 0, 0 };
// PCM,PHOS,EMC,PCMPHOS,PCMEMC, mEMC
Int_t offSetsEta[13] = { -1, 1, 0, 2, 0, 0,0,0, 4,0,0,0,0};
Int_t offSetsSysEta[13] = { 0, 1, 4, 3, 1, 0,0,0, 9,0,0,0,0};
// Int_t offSetsEtaRpA[13] = { -4, 1, 0, 2, -4, 0,0,0, 4,0,0,0,0};
// Int_t offSetsSysEtaRpA[13] = { 0, 1, 5, 3, 2, 0,0,0, 9,0,0,0,0};
// Int_t offSetsEta[13] = { -3, 1, 2, 2, -3, 0,0,0, 4,0,0,0,0};
// Int_t offSetsSysEta[13] = { 0, 1, 5, 3, 3, 0,0,0, 9,0,0,0,0};
Int_t offSetEtaShifting[13] = { 0, 0, 0, 0, 0,
0, 0, 0, 0, 0,
0, 0, 0 };
Int_t nComBinsEtaShifting[13] = { 0, 0, 0, 0, 0,
0, 0, 0, 0, 0,
0, 0, 0 };
// PCM,PHOS,EMC,PCMPHOS,PCMEMC, mEMC
Int_t offSetsEtaToPi0[13] = { -1, 1, 0, 2, 0, 0,0,0, 4,0,0,0,0};
Int_t offSetsSysEtaToPi0[13] = { 0, 1, 4, 3, 1, 0,0,0, 9,0,0,0,0};
// Int_t offSetsEtaToPi0[13] = { -3, 1, 2, 2, -3, 0,0,0, 4,0,0,0,0};
// Int_t offSetsSysEtaToPi0[13] = { 0, 1, 5, 3, 3, 0,0,0, 9,0,0,0,0};
//**********************************************************************************************************************
//**********************************************************************************************************************
//**********************************************************************************************************************
TH1D* statErrorRelCollection[13];
TH1D* statErrorRelCollectionEta[13];
TH1D* statErrorRelCollectionEtaToPi0[13];
for (Int_t i = 0; i < totalNSets; i++){
if (statErrorCollection[i])
statErrorRelCollection[i] = CalculateRelErrUpTH1D( statErrorCollection[i], Form("relativeStatError_%s", nameMeasGlobalPlot[i].Data()));
else statErrorRelCollection[i] = NULL;
if (statErrorCollectionEta[i])
statErrorRelCollectionEta[i] = CalculateRelErrUpTH1D( statErrorCollectionEta[i], Form("relativeStatError_%s", nameMeasGlobalPlot[i].Data()));
else statErrorRelCollectionEta[i] = NULL;
if (statErrorCollectionEtaToPi0[i])
statErrorRelCollectionEtaToPi0[i] = CalculateRelErrUpTH1D( statErrorCollectionEtaToPi0[i], Form("relativeStatError_%s", nameMeasGlobalPlot[i].Data()));
else statErrorRelCollectionEtaToPi0[i] = NULL;
}
cout << __LINE__ << endl;
TGraphAsymmErrors* sysErrorRelCollection[13];
TGraphAsymmErrors* sysErrorRelCollectionEta[13];
TGraphAsymmErrors* sysErrorRelCollectionEtaToPi0[13];
for (Int_t i = 0; i < totalNSets; i++){
if (sysErrorCollection[i])
sysErrorRelCollection[i] = CalculateRelErrUpAsymmGraph( sysErrorCollection[i], Form("relativeSysError_%s", nameMeasGlobalPlot[i].Data()));
else sysErrorRelCollection[i] = NULL;
if (sysErrorCollectionEta[i])
sysErrorRelCollectionEta[i] = CalculateRelErrUpAsymmGraph( sysErrorCollectionEta[i], Form("relativeSysError_%s", nameMeasGlobalPlot[i].Data()));
else sysErrorRelCollectionEta[i] = NULL;
if (sysErrorCollectionEtaToPi0[i])
sysErrorRelCollectionEtaToPi0[i] = CalculateRelErrUpAsymmGraph( sysErrorCollectionEtaToPi0[i], Form("relativeSysError_%s", nameMeasGlobalPlot[i].Data()));
else sysErrorRelCollectionEtaToPi0[i] = NULL;
}
cout << __LINE__ << endl;
TGraph* graphWeights[13];
TGraph* graphWeightsEta[13];
TGraph* graphWeightsEtaToPi0[13];
for (Int_t i = 0; i< totalNSets; i++){
graphWeights[i] = NULL;
graphWeightsEta[i] = NULL;
graphWeightsEtaToPi0[i] = NULL;
}
// Declaration & calculation of combined spectrum
TString fileNameOutputWeighting = Form("%s/Weighting.dat",outputDir.Data());
TString fileNameOutputWeightingEta = Form("%s/WeightingEta.dat",outputDir.Data());
TString fileNameOutputWeightingEtaToPi0 = Form("%s/WeightingEtaToPi0.dat",outputDir.Data());
TGraphAsymmErrors* graphCombPi0InvYieldStat = NULL;
TGraphAsymmErrors* graphCombPi0InvYieldSys = NULL;
TGraphAsymmErrors* graphCombPi0InvYieldTot = CombinePtPointsSpectraFullCorrMat( statErrorCollection, sysErrorCollection,
xPtLimits, nBinsPi0,
offSets, offSetsSys,
graphCombPi0InvYieldStat, graphCombPi0InvYieldSys,
fileNameOutputWeighting,"pPb_8TeV", "Pi0", kTRUE,
0x0, ""
);
// return;
cout << __LINE__ << endl;
while (graphCombPi0InvYieldStat->GetX()[0] < minPtPi0Meas ) graphCombPi0InvYieldStat->RemovePoint(0);
while (graphCombPi0InvYieldStat->GetX()[graphCombPi0InvYieldStat->GetN()-1] > maxPtPi0Meas) graphCombPi0InvYieldStat->RemovePoint(graphCombPi0InvYieldStat->GetN()-1);
while (graphCombPi0InvYieldSys->GetX()[0] < minPtPi0Meas ) graphCombPi0InvYieldSys->RemovePoint(0);
while (graphCombPi0InvYieldSys->GetX()[graphCombPi0InvYieldSys->GetN()-1] > maxPtPi0Meas) graphCombPi0InvYieldSys->RemovePoint(graphCombPi0InvYieldSys->GetN()-1);
while (graphCombPi0InvYieldTot->GetX()[0] < minPtPi0Meas ) graphCombPi0InvYieldTot->RemovePoint(0);
while (graphCombPi0InvYieldTot->GetX()[graphCombPi0InvYieldTot->GetN()-1] > maxPtPi0Meas) graphCombPi0InvYieldTot->RemovePoint(graphCombPi0InvYieldTot->GetN()-1);
if(doOutput) graphCombPi0InvYieldStat->Print();
TGraphAsymmErrors* graphCombEtaInvYieldStat = NULL;
TGraphAsymmErrors* graphCombEtaInvYieldSys = NULL;
TGraphAsymmErrors* graphCombEtaInvYieldTot = CombinePtPointsSpectraFullCorrMat( statErrorCollectionEta, sysErrorCollectionEta,
xPtLimitsEta, nBinsEta,
offSetsEta, offSetsSysEta,
graphCombEtaInvYieldStat, graphCombEtaInvYieldSys,
fileNameOutputWeightingEta,"pPb_8TeV", "Eta", kTRUE,
0x0, ""
);
// return;
cout << __LINE__ << endl;
while (graphCombEtaInvYieldStat->GetX()[0] < minPtEtaMeas ) graphCombEtaInvYieldStat->RemovePoint(0);
while (graphCombEtaInvYieldStat->GetX()[graphCombEtaInvYieldStat->GetN()-1] > maxPtEtaMeas) graphCombEtaInvYieldStat->RemovePoint(graphCombEtaInvYieldStat->GetN()-1);
while (graphCombEtaInvYieldSys->GetX()[0] < minPtEtaMeas ) graphCombEtaInvYieldSys->RemovePoint(0);
while (graphCombEtaInvYieldSys->GetX()[graphCombEtaInvYieldSys->GetN()-1] > maxPtEtaMeas) graphCombEtaInvYieldSys->RemovePoint(graphCombEtaInvYieldSys->GetN()-1);
while (graphCombEtaInvYieldTot->GetX()[0] < minPtEtaMeas ) graphCombEtaInvYieldTot->RemovePoint(0);
while (graphCombEtaInvYieldTot->GetX()[graphCombEtaInvYieldTot->GetN()-1] > maxPtEtaMeas) graphCombEtaInvYieldTot->RemovePoint(graphCombEtaInvYieldTot->GetN()-1);
if(doOutput) graphCombEtaInvYieldStat->Print();
TGraphAsymmErrors* graphCombEtaToPi0Stat = NULL;
TGraphAsymmErrors* graphCombEtaToPi0Sys = NULL;
TGraphAsymmErrors* graphCombEtaToPi0Tot = CombinePtPointsSpectraFullCorrMat( statErrorCollectionEtaToPi0, sysErrorCollectionEtaToPi0,
xPtLimitsEtaToPi0, nBinsEta,
offSetsEtaToPi0, offSetsSysEtaToPi0,
graphCombEtaToPi0Stat, graphCombEtaToPi0Sys,
fileNameOutputWeightingEtaToPi0,"pPb_8TeV", "EtaToPi0", kTRUE,
0x0, ""
);
// return;
cout << __LINE__ << endl;
while (graphCombEtaToPi0Stat->GetX()[0] < minPtEtaMeas ) graphCombEtaToPi0Stat->RemovePoint(0);
while (graphCombEtaToPi0Stat->GetX()[graphCombEtaToPi0Stat->GetN()-1] > maxPtEtaMeas) graphCombEtaToPi0Stat->RemovePoint(graphCombEtaToPi0Stat->GetN()-1);
while (graphCombEtaToPi0Sys->GetX()[0] < minPtEtaMeas ) graphCombEtaToPi0Sys->RemovePoint(0);
while (graphCombEtaToPi0Sys->GetX()[graphCombEtaToPi0Sys->GetN()-1] > maxPtEtaMeas) graphCombEtaToPi0Sys->RemovePoint(graphCombEtaToPi0Sys->GetN()-1);
while (graphCombEtaToPi0Tot->GetX()[0] < minPtEtaMeas ) graphCombEtaToPi0Tot->RemovePoint(0);
while (graphCombEtaToPi0Tot->GetX()[graphCombEtaToPi0Tot->GetN()-1] > maxPtEtaMeas) graphCombEtaToPi0Tot->RemovePoint(graphCombEtaToPi0Tot->GetN()-1);
if(doOutput) graphCombEtaToPi0Stat->Print();