-
Notifications
You must be signed in to change notification settings - Fork 21
/
ComputeDmesonYield.C
1045 lines (959 loc) · 39.2 KB
/
ComputeDmesonYield.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
#if !defined(__CINT__) || defined(__CLING__)
#include <iostream>
#include "TFile.h"
#include "TSystem.h"
#include "TNtuple.h"
#include "TString.h"
#include "TGraphAsymmErrors.h"
#include "TH1.h"
#include "TH2.h"
#include "TLine.h"
#include "TMarker.h"
#include "TStyle.h"
#include "TLatex.h"
#include "TCanvas.h"
#include "TMath.h"
#include "TLegend.h"
#include "TArrayD.h"
#include "AliHFSystErr.h"
#endif
//configuration
enum dspec{kDzero,kDplus,kDstar,kDs};
enum cent{k010,k3050,k6080};
// Graphical styles
const Int_t maxPtBins = 50;
Bool_t draw[maxPtBins]={1,1,1,1,1,1,1,1,1};
Int_t colorarray[maxPtBins]={kGray+2,kMagenta+1,kMagenta,kBlue,kCyan,kGreen+2,kYellow+2,kOrange+1,kRed+1};
Int_t lstyle[maxPtBins]={9,10,3,5,7,1,3,6,2};
Bool_t PbPbDataSyst(AliHFSystErr *syst, TH1D* heff, Double_t pt, Double_t &dataSystUp, Double_t &dataSystDown);
void ComputeDmesonYield(Int_t mesonSpecie=kDs,
Int_t Cent=k010,
Int_t method=2,
Int_t optErrFD=1,
TString filnamPPref="ppreference/Ds_ppreference_pp5TeV_noyshift_pt_1_2_3_4_5_6_8_12_16_24_FONLLextrap_pt_24_36_50_ML_AccFONLLy.root",
TString filnamSpectrumNb="outputs/crosssec/HFPtSpectrum_Ds_centralcuts_LHC18qr.root",
TString filnamSpectrumFc="",
TString filnamRaaNb="outputs/raa/HFPtSpectrumRaa_Ds_centralcuts_LHC18qr.root",
TString filnamRaaFc="",
TString outputdir="outputs/crosssec",
TString suffix="",
Float_t centHypoFdOverPr=1.,
Float_t lowHypoFdOverPr=1./3,
Float_t highHypoFdOverPr=3.,
Bool_t fChangeCentralHypo=kFALSE,
Double_t normToCsec=1.)
{
TString collSyst="Pb-Pb";
// BR from PDG 2020
TString mesName="Dzero";
Int_t mesCode=1;
Double_t brat=0.0395;
TString mesSymb="D^{0}";
Float_t ptForExtrap=36.;
if(mesonSpecie==kDplus){
mesName="Dplus";
mesCode=2;
brat=0.0938;
mesSymb="D^{+}";
ptForExtrap=36.;
}else if(mesonSpecie==kDstar){
mesName="Dstar";
mesCode=3;
brat=0.0395*0.677;
mesSymb="D^{*+}";
ptForExtrap=36.;
}else if(mesonSpecie==kDs){
mesName="Ds";
mesCode=4;
brat=0.0224;
mesSymb="D_{s}^{+}";
if(collSyst=="Pb-Pb"){
centHypoFdOverPr=1.;
lowHypoFdOverPr=1./3.;
highHypoFdOverPr=3.;
}
ptForExtrap=24.;
}
TString centrality = "";
std::cout << Cent << std::endl;
switch(Cent)
{
case k010:
{
centrality = "0-10";
break;
}
case k3050:
{
centrality = "30-50";
break;
}
case k6080:
{
centrality = "60-80";
break;
}
default:
{
std::cerr << "ERROR: centrality not implemented! Exit" << std::endl;
break;
return;
}
}
TString centralityNoDash=centrality.Data();
centralityNoDash.ReplaceAll("-","");
TString filnamChi;
TString filnamCnt;
TString filnamCntS;
Int_t optCombineFDEloss=1; // 0=enevlope, 1= sum in quadrature
Bool_t correctForBR=kTRUE;
Bool_t showRcbSystNorm=kTRUE;
if(method==1){
filnamChi=filnamSpectrumFc.Data();
filnamCnt=filnamRaaFc.Data();
filnamCntS=filnamRaaNb.Data();
}
else if(method==2){
filnamChi=filnamSpectrumNb.Data();
filnamCnt=filnamRaaNb.Data();
filnamCntS=filnamRaaNb.Data();
}
Int_t colorSystFD=kGray+1;
Int_t colorSystRb=kOrange;
Int_t colorSystDatappC=kBlue+1;//kMagenta+1;
Int_t colorSystDataaaC=kRed+1;//kMagenta+1;
Int_t colorppC=kBlue+1;
Int_t coloraaC=kRed+1;
Int_t linestppC=1;
Int_t linestaaC=1;
Int_t linewippC=2;
Int_t linewiaaC=2;
Int_t markerppC=21;
Int_t markeraaC=23;
Double_t msizppC=1.2;
Double_t msizaaC=1.2;
Float_t sizesystdata=0.4;
Float_t sizesystfd=0.3;
Float_t sizesystrb=0.2;
Float_t sizesysttot=0.15;
// extract pt binning from histos
TFile *filChi= new TFile(filnamChi.Data());
TH1D *hSpC = (TH1D*)filChi->Get("hRECpt");
const Int_t nPtBins=hSpC->GetNbinsX();
if(nPtBins>maxPtBins){
printf("Too many pt bins in histo: %d \n",nPtBins);
return;
}
const TArrayD* PtLimsArray = hSpC->GetXaxis()->GetXbins();
const Double_t* PtLims = PtLimsArray->GetArray();
// pp reference
if(gSystem->Exec(Form("ls -l %s > /dev/null 2>&1",filnamPPref.Data())) !=0){
printf("File %s with pp reference not found -> exiting\n",filnamPPref.Data());
return;
}
TFile *filPP=new TFile(filnamPPref.Data());
TH1D *hppRef = (TH1D*)filPP->Get("hReference");
if(!hppRef) hppRef = (TH1D*)filPP->Get("fhScaledData");
TH1D *hppRefSystData = (TH1D*)filPP->Get("fhScaledSystData");
Float_t relsysterrLowDatapp[nPtBins],relsysterrHiDatapp[nPtBins];
TGraphAsymmErrors* gppRefSyst=(TGraphAsymmErrors*)filPP->Get("gReferenceSyst");
if(gppRefSyst){
for(Int_t i=0; i<gppRefSyst->GetN(); i++){
Double_t x,y;
gppRefSyst->GetPoint(i,x,y);
Int_t hBin=TMath::BinarySearch(nPtBins,PtLims,x);
if(x>ptForExtrap){
relsysterrLowDatapp[hBin]=gppRefSyst->GetErrorYlow(i)/y;
relsysterrHiDatapp[hBin]=gppRefSyst->GetErrorYhigh(i)/y;
}
}
}
Float_t relstaterrpp[nPtBins];
for(Int_t ib=0; ib<nPtBins; ib++){
Int_t hBin=hppRef->FindBin(0.5*(PtLims[ib]+PtLims[ib+1]));
relstaterrpp[ib]=hppRef->GetBinError(hBin)/hppRef->GetBinContent(hBin);
printf("-- Relative stat errors PP: Bin %d(%f)--- histobin=%d Err %f\n",ib,0.5*(PtLims[ib]+PtLims[ib+1]),hBin,relstaterrpp[ib]);
Int_t hBin2=hppRefSystData->FindBin(0.5*(PtLims[ib]+PtLims[ib+1]));
if(hppRefSystData->GetBinCenter(hBin2)<ptForExtrap){
Float_t relsysterrDatapp=hppRefSystData->GetBinError(hBin2)/hppRefSystData->GetBinContent(hBin2);
relsysterrLowDatapp[ib]=relsysterrDatapp;
relsysterrHiDatapp[ib]=relsysterrDatapp;
}
printf(" ---- Check SYST err DATA PP Bin %d CS=%f Err+%f -%f\n",ib, hppRef->GetBinContent(hBin),relsysterrHiDatapp[ib],relsysterrLowDatapp[ib]);
}
Float_t relsysterrLowEnScalpp[nPtBins];
Float_t relsysterrHiEnScalpp[nPtBins];
for(Int_t ib=0; ib<nPtBins; ib++){
relsysterrLowEnScalpp[ib]=0.;
relsysterrHiEnScalpp[ib]=0.;
}
TGraphAsymmErrors* gsystppEnSc=(TGraphAsymmErrors*)filPP->Get("gScaledDataSystExtrap");
for(Int_t i=0; i<gsystppEnSc->GetN(); i++){
Double_t x,y;
gsystppEnSc->GetPoint(i,x,y);
Int_t hBin=TMath::BinarySearch(nPtBins,PtLims,x);
if(hBin>=0 && hBin<nPtBins && x<PtLims[nPtBins]){
if(x<ptForExtrap){
relsysterrLowEnScalpp[hBin]=gsystppEnSc->GetErrorYlow(i)/y;
relsysterrHiEnScalpp[hBin]=gsystppEnSc->GetErrorYhigh(i)/y;
}
}
}
TGraphAsymmErrors* gsystppFD=(TGraphAsymmErrors*)filPP->Get("gScaledDataSystFeedDown");
Float_t relsysterrLowFDpp[nPtBins];
Float_t relsysterrHiFDpp[nPtBins];
for(Int_t i=0; i<nPtBins; i++){
relsysterrHiFDpp[i]=0.;
relsysterrLowFDpp[i]=0.;
}
for(Int_t i=0; i<gsystppFD->GetN(); i++){
Double_t x,y;
gsystppFD->GetPoint(i,x,y);
Int_t hBin=TMath::BinarySearch(nPtBins,PtLims,x);
if(hBin>=0 && hBin<nPtBins && x<PtLims[nPtBins] && x>0){
relsysterrLowFDpp[hBin]=gsystppFD->GetErrorYlow(i)/y;
relsysterrHiFDpp[hBin]=gsystppFD->GetErrorYhigh(i)/y;
printf(" ---- Check syst err FD pp (pt=%f) Bin %d Err+%f -%f\n",x,hBin,relsysterrHiFDpp[hBin],relsysterrLowFDpp[hBin]);
// printf("%d %f %f\n",hBin,relsysterrLowFDpp[hBin],relsysterrHiFDpp[hBin]);
}
}
// A-A events
printf("--- %s events ---\n",collSyst.Data());
if(gSystem->Exec(Form("ls -l %s > /dev/null 2>&1",filnamChi.Data())) !=0){
printf("File %s with A-A (p-A) yield not found -> exiting\n",filnamChi.Data());
return;
}
Float_t relstaterrPbPb[nPtBins];
for(Int_t ib=0; ib<nPtBins; ib++){
Int_t hBin=hSpC->FindBin(0.5*(PtLims[ib]+PtLims[ib+1]));
relstaterrPbPb[ib]=hSpC->GetBinError(hBin)/hSpC->GetBinContent(hBin);
printf("-- Relative stat errors AA from yield: Bin %d(%d) pt=%f Err %f\n",ib,hBin,hSpC->GetBinCenter(hBin),relstaterrPbPb[ib]);
}
AliHFSystErr *systematicsABcent =(AliHFSystErr*)filChi->Get("AliHFSystErr");
if(!systematicsABcent){
printf("AliHFSysstErr generated on the fly\n");
systematicsABcent=new AliHFSystErr("AliHFSystErr","on the fly");
if(collSyst=="p-Pb"){
systematicsABcent->SetCollisionType(2);
systematicsABcent->SetRunNumber(16);
}else{
systematicsABcent->SetCollisionType(1);
}
systematicsABcent->SetCentrality(centralityNoDash.Data());
systematicsABcent->Init(mesCode);
}else{
printf("AliHFSystErr read from HFPtSpectrum output\n");
}
TH1D* heffC=(TH1D*)filChi->Get("hDirectEffpt");
TGraphAsymmErrors* gsystaaFDc=(TGraphAsymmErrors*)filChi->Get("gSigmaCorrConservative"); // FD due to scales
Float_t relsysterrLowFDaa[nPtBins];
Float_t relsysterrHiFDaa[nPtBins];
for(Int_t i=0; i<nPtBins; i++){
relsysterrLowFDaa[i]=0.;
relsysterrHiFDaa[i]=0.;
}
for(Int_t i=0; i<gsystaaFDc->GetN(); i++){
Double_t x,y;
gsystaaFDc->GetPoint(i,x,y);
Int_t hBin=TMath::BinarySearch(nPtBins,PtLims,x);
if(hBin>=0 && hBin<nPtBins && x<PtLims[nPtBins]){
relsysterrLowFDaa[hBin]=gsystaaFDc->GetErrorYlow(i)/y;
relsysterrHiFDaa[hBin]=gsystaaFDc->GetErrorYhigh(i)/y;
printf(" ---- Check syst err FD AA Bin %d Err+%f -%f\n",hBin,relsysterrHiFDaa[hBin],relsysterrLowFDaa[hBin]);
}
}
if(gSystem->Exec(Form("ls -l %s > /dev/null 2>&1",filnamCnt.Data())) !=0){
printf("File %s with R_AA not found -> exiting\n",filnamCnt.Data());
return;
}
TFile *filCnt=new TFile(filnamCnt.Data());
Float_t relstaterrPbPb2[nPtBins];
TH1D* hraaCcheck2=(TH1D*)filCnt->Get("hRABvsPt");
for(Int_t ib=0; ib<nPtBins; ib++){
Int_t hBin=hraaCcheck2->FindBin(0.5*(PtLims[ib]+PtLims[ib+1]));
Double_t aux=hraaCcheck2->GetBinError(hBin)/hraaCcheck2->GetBinContent(hBin);
relstaterrPbPb2[ib]=TMath::Sqrt(aux*aux-relstaterrpp[ib]*relstaterrpp[ib]);
printf("-- Relative stat errors AA from RAA-PP: Bin %d(%f)---%d Err %f\n",ib,0.5*(PtLims[ib]+PtLims[ib+1]),hBin,relstaterrPbPb2[ib]);
}
AliHFSystErr *systematicsPP =(AliHFSystErr*)filCnt->Get("AliHFSystErrPP");
TNtuple* ntC=(TNtuple*)filCnt->Get("ntupleRAB");
Float_t pt,TAB,sigmaPP,invyieldAB,RABCharm,RABBeauty;
Float_t invyieldABFDHigh,invyieldABFDLow,fprompt;
ntC->SetBranchAddress("pt",&pt);
ntC->SetBranchAddress("TAB",&TAB);
ntC->SetBranchAddress("sigmaPP",&sigmaPP);
ntC->SetBranchAddress("invyieldAB",&invyieldAB);
ntC->SetBranchAddress("RABCharm",&RABCharm);
ntC->SetBranchAddress("RABBeauty",&RABBeauty);
ntC->SetBranchAddress("invyieldABFDHigh",&invyieldABFDHigh);
ntC->SetBranchAddress("invyieldABFDLow",&invyieldABFDLow);
ntC->SetBranchAddress("fc",&fprompt);
Float_t raac[nPtBins],invypp[nPtBins],invyPbPb[nPtBins],invyPbPbLo[nPtBins],invyPbPbHi[nPtBins],minval[nPtBins];
Float_t raacLowHyp[nPtBins],invyPbPbLowHyp[nPtBins],minvalLowHyp[nPtBins];
Float_t raacHigHyp[nPtBins],invyPbPbHigHyp[nPtBins],minvalHigHyp[nPtBins];
Float_t fPromptCent[nPtBins],fPromptHigHyp[nPtBins],fPromptLowHyp[nPtBins];
Float_t invyPbPbLoSingleSyst[nPtBins],invyPbPbHiSingleSyst[nPtBins];
Float_t centHypoFdOverPrArray[nPtBins], lowHypoFdOverPrArray[nPtBins], highHypoFdOverPrArray[nPtBins];
for(Int_t ib=0; ib<nPtBins; ib++){
if(fChangeCentralHypo && (PtLims[ib]<3 || PtLims[ib]>=24) && (mesonSpecie==kDzero || mesonSpecie==kDplus || mesonSpecie==kDstar)){
centHypoFdOverPrArray[ib]=1.5;
lowHypoFdOverPrArray[ib]=1.;
highHypoFdOverPrArray[ib]=2.;
printf("********* hypothesis for pt<3(>24) (%f): %f, minHypo=%f, maxHypo=%f \n",(PtLims[ib]+PtLims[ib+1])/2,centHypoFdOverPrArray[ib],lowHypoFdOverPrArray[ib],highHypoFdOverPrArray[ib]);
}
else {
centHypoFdOverPrArray[ib]=centHypoFdOverPr;
lowHypoFdOverPrArray[ib]=lowHypoFdOverPr;
highHypoFdOverPrArray[ib]=highHypoFdOverPr;
}
minval[ib]=9999.;
invypp[ib]=-999.;
invyPbPb[ib]=-999.;
invyPbPbLo[ib]=-999.;
invyPbPbHi[ib]=-999.;
invyPbPbLoSingleSyst[ib]=-999.;
invyPbPbHiSingleSyst[ib]=-999.;
raac[ib]=-999.;
raacLowHyp[ib]=-999.;
invyPbPbLowHyp[ib]=-999.;
minvalLowHyp[ib]=9999.;
raacHigHyp[ib]=-999.;
invyPbPbHigHyp[ib]=-999.;
minvalHigHyp[ib]=9999.;
fPromptCent[ib]=-9999.;
fPromptHigHyp[ib]=-9999.;
fPromptLowHyp[ib]=-9999.;
}
TGraph** gcb=new TGraph*[nPtBins];
TGraph** gcrbc=new TGraph*[nPtBins];
for(Int_t ib=0; ib<nPtBins; ib++){
gcb[ib]=new TGraph(0);
gcrbc[ib]=new TGraph(0);
gcrbc[ib]->SetName(Form("gcrbc%d",ib));
}
for(Int_t ie=0; ie<ntC->GetEntries(); ie++){
ntC->GetEvent(ie);
if(correctForBR){
invyieldAB/=brat;
invyieldABFDLow/=brat;
invyieldABFDHigh/=brat;
sigmaPP/=brat;
}
if(pt>PtLims[nPtBins]) continue;
Int_t theBin=TMath::BinarySearch(nPtBins,PtLims,(Double_t)pt);
if(theBin<0 || theBin>=nPtBins) continue;
Float_t rFdPr=RABBeauty/RABCharm;
Float_t dist=TMath::Abs(rFdPr-centHypoFdOverPrArray[theBin]);
if(dist<minval[theBin]){
raac[theBin]=RABCharm;
minval[theBin]=dist;
invyPbPb[theBin]=invyieldAB*normToCsec;
invyPbPbLo[theBin]=invyieldABFDLow*normToCsec;
invyPbPbHi[theBin]=invyieldABFDHigh*normToCsec;
invypp[theBin]=TAB*sigmaPP;
if(collSyst=="p-Pb" && TMath::Abs(normToCsec-1.)>0.001) invypp[theBin]=208.*sigmaPP*1e6;
fPromptCent[theBin]=fprompt;
}
Float_t distLowHyp=TMath::Abs(rFdPr-lowHypoFdOverPrArray[theBin]);
if(distLowHyp<minvalLowHyp[theBin]){
// LowHyp -> lower Raa(feeddown) -> less Fd to be subtracted -> higher fprompt -> higher prompt yield -> higher Raa(prompt)
raacLowHyp[theBin]=RABCharm;
invyPbPbLowHyp[theBin]=invyieldAB*normToCsec;
invyPbPbHiSingleSyst[theBin]=invyieldABFDHigh*normToCsec;
minvalLowHyp[theBin]=distLowHyp;
fPromptLowHyp[theBin]=fprompt;
}
Float_t distHigHyp=TMath::Abs(rFdPr-highHypoFdOverPrArray[theBin]);
if(distHigHyp<minvalHigHyp[theBin]){
// HigHyp -> higher Raa(feeddown) -> more Fd to be subtracted -> lower fprompt -> lower prompt yield -> lower Raa(prompt)
raacHigHyp[theBin]=RABCharm;
invyPbPbHigHyp[theBin]=invyieldAB*normToCsec;
invyPbPbLoSingleSyst[theBin]=invyieldABFDLow*normToCsec;
minvalHigHyp[theBin]=distHigHyp;
fPromptHigHyp[theBin]=fprompt;
}
if(theBin<nPtBins && theBin>=0 && pt<PtLims[nPtBins]){
gcb[theBin]->SetPoint(gcb[theBin]->GetN(),RABBeauty,RABCharm);
if(rFdPr>lowHypoFdOverPrArray[theBin] && rFdPr<highHypoFdOverPrArray[theBin]){
gcrbc[theBin]->SetPoint(gcrbc[theBin]->GetN(),rFdPr,RABCharm);
}
}
}
TH1D* hcheck[nPtBins];
for(Int_t i=0; i<nPtBins; i++){
hcheck[i]=(TH1D*)filCnt->Get(Form("hRCharmVsElossHypo_%d",i+1));
}
TMarker** mC=new TMarker*[nPtBins];
for(Int_t ib=0; ib<nPtBins; ib++){
mC[ib]=new TMarker(1.,raac[ib],20);
mC[ib]->SetMarkerSize(1.2);
if(showRcbSystNorm){
Double_t auxx,auxy;
for(Int_t ip=0; ip<gcrbc[ib]->GetN(); ip++){
gcrbc[ib]->GetPoint(ip,auxx,auxy);
auxy/=raac[ib];
gcrbc[ib]->SetPoint(ip,auxx,(auxy-1)*100.);
}
}
}
if(gSystem->Exec(Form("ls -l %s > /dev/null 2>&1",filnamCntS.Data())) !=0){
printf("File %s with R_AA (for syst) not found -> exiting\n",filnamCntS.Data());
return;
}
TFile *filCntS=new TFile(filnamCntS.Data());
TNtuple* ntCS=(TNtuple*)filCntS->Get("ntupleRAB");
ntCS->SetBranchAddress("pt",&pt);
ntCS->SetBranchAddress("TAB",&TAB);
ntCS->SetBranchAddress("sigmaPP",&sigmaPP);
ntCS->SetBranchAddress("invyieldAB",&invyieldAB);
ntCS->SetBranchAddress("RABCharm",&RABCharm);
ntCS->SetBranchAddress("RABBeauty",&RABBeauty);
ntCS->SetBranchAddress("invyieldABFDHigh",&invyieldABFDHigh);
ntCS->SetBranchAddress("invyieldABFDLow",&invyieldABFDLow);
ntCS->SetBranchAddress("fc",&fprompt);
Float_t invyPbPbS[nPtBins],invyPbPbLoS[nPtBins],invyPbPbHiS[nPtBins],minvalS[nPtBins];
Float_t invyPbPbLoSingleSystS[nPtBins],invyPbPbHiSingleSystS[nPtBins],minvalLowHypS[nPtBins],minvalHigHypS[nPtBins];
Float_t fPromptCentS[nPtBins],fPromptLowHypS[nPtBins],fPromptHigHypS[nPtBins];
for(Int_t ib=0; ib<nPtBins; ib++){
minvalS[ib]=9999.;
minvalLowHypS[ib]=9999.;
minvalHigHypS[ib]=9999.;
invyPbPbS[ib]=-999.;
invyPbPbLoS[ib]=-999.;
invyPbPbHiS[ib]=-999.;
invyPbPbLoSingleSystS[ib]=-999.;
invyPbPbHiSingleSystS[ib]=-999.;
fPromptLowHypS[ib]=-999.;
fPromptHigHypS[ib]=-999.;
}
for(Int_t ie=0; ie<ntCS->GetEntries(); ie++){
ntCS->GetEvent(ie);
if(correctForBR){
invyieldAB/=brat;
invyieldABFDLow/=brat;
invyieldABFDHigh/=brat;
sigmaPP/=brat;
}
if(pt>PtLims[nPtBins]) continue;
Int_t theBin=TMath::BinarySearch(nPtBins,PtLims,(Double_t)pt);
if(theBin<0 || theBin>=nPtBins) continue;
Float_t rFdPr=RABBeauty/RABCharm;
Float_t dist=TMath::Abs(rFdPr-centHypoFdOverPrArray[theBin]);
if(dist<minvalS[theBin]){
minvalS[theBin]=dist;
invyPbPbS[theBin]=invyieldAB*normToCsec;
invyPbPbLoS[theBin]=invyieldABFDLow*normToCsec;
invyPbPbHiS[theBin]=invyieldABFDHigh*normToCsec;
fPromptCentS[theBin]=fprompt;
}
Float_t distLowHyp=TMath::Abs(rFdPr-lowHypoFdOverPrArray[theBin]);
if(distLowHyp<minvalLowHypS[theBin]){
// LowHyp -> lower Raa(feeddown) -> less Fd to be subtracted -> higher fprompt -> higher prompt yield -> higher Raa(prompt)
invyPbPbHiSingleSystS[theBin]=invyieldABFDHigh*normToCsec;
minvalLowHypS[theBin]=distLowHyp;
fPromptLowHypS[theBin]=fprompt;
}
Float_t distHigHyp=TMath::Abs(rFdPr-highHypoFdOverPrArray[theBin]);
if(distHigHyp<minvalHigHypS[theBin]){
// HigHyp -> higher Raa(feeddown) -> more Fd to be subtracted -> lower fprompt -> lower prompt yield -> lower Raa(prompt)
invyPbPbLoSingleSystS[theBin]=invyieldABFDLow*normToCsec;
minvalHigHypS[theBin]=distHigHyp;
fPromptHigHypS[theBin]=fprompt;
}
}
TH1F* hfPromptCent=new TH1F("hfPromptCent"," ; p_{T} (Gev/c) ; f_{prompt}",nPtBins,PtLims);
TH1F* hfPromptMinNb=new TH1F("hfPromptMinNb"," ; p_{T} (Gev/c) ; f_{prompt}",nPtBins,PtLims);
TH1F* hfPromptMinfc=new TH1F("hfPromptMinfc"," ; p_{T} (Gev/c) ; f_{prompt}",nPtBins,PtLims);
TH1F* hfPromptMaxNb=new TH1F("hfPromptMaxNb"," ; p_{T} (Gev/c) ; f_{prompt}",nPtBins,PtLims);
TH1F* hfPromptMaxfc=new TH1F("hfPromptMaxfc"," ; p_{T} (Gev/c) ; f_{prompt}",nPtBins,PtLims);
hfPromptCent->SetStats(0);
hfPromptMinNb->SetStats(0);
hfPromptMaxNb->SetStats(0);
hfPromptMinfc->SetStats(0);
hfPromptMaxfc->SetStats(0);
for(Int_t ib=0; ib<nPtBins; ib++){
printf("Bin %d\n",ib);
printf(" fprompt central=%f --- Nb fpromptmin=%f fpromptmax=%f --- fc fpromptmin=%f fpromptmax=%f\n",fPromptCent[ib],fPromptHigHyp[ib],fPromptLowHyp[ib],fPromptHigHypS[ib],fPromptLowHypS[ib]);
//add error from FONLL scale in quadrature
Double_t relerrFDscaleHigh = (invyPbPbHi[ib]-invyPbPb[ib])/invyPbPb[ib];
Double_t relerrFDscaleLow = (invyPbPb[ib]-invyPbPbLo[ib])/invyPbPb[ib];
Double_t relerrElossHigh = (fPromptLowHyp[ib]-fPromptCent[ib])/fPromptCent[ib];
Double_t relerrElossLow = (fPromptCent[ib]-fPromptHigHyp[ib])/fPromptCent[ib];
Double_t toterrFDhigh = TMath::Sqrt(relerrFDscaleHigh*relerrFDscaleHigh+relerrElossHigh*relerrElossHigh)*fPromptCent[ib];
Double_t toterrFDlow = TMath::Sqrt(relerrFDscaleLow*relerrFDscaleLow+relerrElossLow*relerrElossLow)*fPromptCent[ib];
Double_t relerrFDscaleHighS = (invyPbPbHiS[ib]-invyPbPbS[ib])/invyPbPbS[ib];
Double_t relerrFDscaleLowS = (invyPbPbS[ib]-invyPbPbLoS[ib])/invyPbPbS[ib];
Double_t relerrElossHighS = (fPromptLowHypS[ib]-fPromptCentS[ib])/fPromptCentS[ib];
Double_t relerrElossLowS = (fPromptCentS[ib]-fPromptHigHypS[ib])/fPromptCentS[ib];
Double_t toterrFDhighS = TMath::Sqrt(relerrFDscaleHighS*relerrFDscaleHighS+relerrElossHighS*relerrElossHighS)*fPromptCentS[ib];
Double_t toterrFDlowS = TMath::Sqrt(relerrFDscaleLowS*relerrFDscaleLowS+relerrElossLowS*relerrElossLowS)*fPromptCentS[ib];
hfPromptCent->SetBinContent(ib+1,fPromptCent[ib]);
hfPromptMinNb->SetBinContent(ib+1,fPromptCent[ib]-toterrFDlow);
hfPromptMaxNb->SetBinContent(ib+1,fPromptCent[ib]+toterrFDhigh);
hfPromptMinfc->SetBinContent(ib+1,fPromptCentS[ib]-toterrFDlowS);
hfPromptMaxfc->SetBinContent(ib+1,fPromptCentS[ib]+toterrFDhighS);
printf("Bin %d\n",ib);
printf(" fprompt central=%f --- Nb fpromptmin=%f fpromptmax=%f --- fc fpromptmin=%f fpromptmax=%f\n",fPromptCent[ib],hfPromptMinNb->GetBinContent(ib+1),hfPromptMaxNb->GetBinContent(ib+1),hfPromptMinfc->GetBinContent(ib+1),hfPromptMaxfc->GetBinContent(ib+1));
}
TH1F* hppC=new TH1F("hppC",Form("pp reference for %s%% CC",centrality.Data()),nPtBins,PtLims);
TGraphAsymmErrors *gppCsystdata=new TGraphAsymmErrors(0);
gppCsystdata->SetName("gppCsystdata");
gppCsystdata->SetTitle(Form("Data Syst. Err. pp, scaled to %s%% CC",centrality.Data()));
TGraphAsymmErrors *gppCsystFD=new TGraphAsymmErrors(0);
gppCsystFD->SetName("gppCsystFD");
gppCsystFD->SetTitle(Form("B feed-down Syst. Err. pp, scaled to %s%% CC",centrality.Data()));
TH1F* hAAC=new TH1F("hAAC",Form("PbPb %s%% CC",centrality.Data()),nPtBins,PtLims);
TGraphAsymmErrors *gaaCsystdata=new TGraphAsymmErrors(0);
gaaCsystdata->SetName("gaaCsystdata");
gaaCsystdata->SetTitle(Form("Data Syst. Err. PbPb %s%% CC",centrality.Data()));
TGraphAsymmErrors *gaaCsystFD=new TGraphAsymmErrors(0);
gaaCsystFD->SetName("gaaCsystFD");
gaaCsystFD->SetTitle(Form("B feed-down Syst. Err. PbPb %s%% CC",centrality.Data()));
TGraphAsymmErrors *gaaCsystRb=new TGraphAsymmErrors(0);
gaaCsystRb->SetName("gaaCsystRb");
gaaCsystRb->SetTitle(Form("Raa(B) Syst. Err. PbPb %s%% CC",centrality.Data()));
TGraphAsymmErrors *gaaCsystB=new TGraphAsymmErrors(0);
gaaCsystB->SetName("gaaCsystB");
gaaCsystB->SetTitle(Form("B Syst. Err. PbPb %s%% CC",centrality.Data()));
TGraphAsymmErrors *gaaCsystTot=new TGraphAsymmErrors(0);
gaaCsystTot->SetName("gaaCsystTot");
gaaCsystTot->SetTitle(Form("Tot Syst. Err. PbPb %s%% CC",centrality.Data()));
TH1F* hRAAC=new TH1F("hRAAC","",nPtBins,PtLims);
TGraphAsymmErrors *graaC=new TGraphAsymmErrors(0);
for(Int_t ib=0; ib<nPtBins; ib++){
printf("Bin %d\n",ib);
printf("raa(centHyp)=%f raa(lowHyp)=%f raa(highHyp)=%f RelDiff=%f\n",
raac[ib],raacLowHyp[ib],raacHigHyp[ib],(raacHigHyp[ib]-raacLowHyp[ib])/raac[ib]);
if(raac[ib]>0.){
Float_t relstaterrRaa=TMath::Sqrt(relstaterrpp[ib]*relstaterrpp[ib]+relstaterrPbPb2[ib]*relstaterrPbPb2[ib]);
hRAAC->SetBinContent(ib+1,raac[ib]);
hRAAC->SetBinError(ib+1,relstaterrRaa*raac[ib]);
Int_t nP=graaC->GetN();
graaC->SetPoint(nP,hRAAC->GetBinCenter(ib+1),raac[ib]);
graaC->SetPointEXlow(nP,hRAAC->GetBinCenter(ib+1)-hRAAC->GetBinLowEdge(ib+1));
graaC->SetPointEXhigh(nP,hRAAC->GetBinLowEdge(ib+2)-hRAAC->GetBinCenter(ib+1));
graaC->SetPointEYlow(nP,raac[ib]-raacHigHyp[ib]);
graaC->SetPointEYhigh(nP,raacLowHyp[ib]-raac[ib]);
}
if(invypp[ib]>0.){
hppC->SetBinContent(ib+1,invypp[ib]);
hppC->SetBinError(ib+1,relstaterrpp[ib]*invypp[ib]);
Int_t nP=gppCsystdata->GetN();
gppCsystdata->SetPoint(nP,hppC->GetBinCenter(ib+1),invypp[ib]);
gppCsystdata->SetPointEXlow(nP,sizesystdata);
gppCsystdata->SetPointEXhigh(nP,sizesystdata);
Double_t edatl=relsysterrLowDatapp[ib]*invypp[ib];
Double_t edath=relsysterrHiDatapp[ib]*invypp[ib];
Double_t eenscl=relsysterrLowEnScalpp[ib]*invypp[ib];
Double_t eensch=relsysterrHiEnScalpp[ib]*invypp[ib];
Double_t elow=TMath::Sqrt(edatl*edatl+eenscl*eenscl);
Double_t ehig=TMath::Sqrt(edath*edath+eensch*eensch);
gppCsystdata->SetPointEYlow(nP,elow);
gppCsystdata->SetPointEYhigh(nP,ehig);
nP=gppCsystFD->GetN();
gppCsystFD->SetPoint(nP,hppC->GetBinCenter(ib+1),invypp[ib]);
gppCsystFD->SetPointEXlow(nP,sizesystfd);
gppCsystFD->SetPointEXhigh(nP,sizesystfd);
gppCsystFD->SetPointEYlow(nP,relsysterrLowFDpp[ib]*invypp[ib]);
gppCsystFD->SetPointEYhigh(nP,relsysterrHiFDpp[ib]*invypp[ib]);
}
if(invyPbPb[ib]>0.){
printf("yielddAA(centHyp)=%f yielddAA(lowHyp)=%f yielddAA(highHyp)=%f RelDiff=%f\n",
invyPbPb[ib],invyPbPbLowHyp[ib],invyPbPbHigHyp[ib],(invyPbPbHigHyp[ib]-invyPbPbLowHyp[ib])/invyPbPb[ib]);
hAAC->SetBinContent(ib+1,invyPbPb[ib]);
hAAC->SetBinError(ib+1,relstaterrPbPb2[ib]*invyPbPb[ib]);
Int_t nP=gaaCsystdata->GetN();
gaaCsystdata->SetPoint(nP,hAAC->GetBinCenter(ib+1),invyPbPb[ib]);
gaaCsystdata->SetPointEXlow(nP,sizesystdata);
gaaCsystdata->SetPointEXhigh(nP,sizesystdata);
Double_t systundatalow,systundatahigh;
Bool_t isOk=PbPbDataSyst(systematicsABcent,heffC,hAAC->GetBinCenter(ib+1),systundatahigh,systundatalow);
printf("Check PID syst: %f %f %f\n",systematicsABcent->GetTotalSystErr(hAAC->GetBinCenter(ib+1)),systundatahigh,systundatalow);
systundatalow*=invyPbPb[ib];
systundatahigh*=invyPbPb[ib];
gaaCsystdata->SetPointEYlow(nP,systundatalow);
gaaCsystdata->SetPointEYhigh(nP,systundatahigh);
nP=gaaCsystRb->GetN();
gaaCsystRb->SetPoint(nP,hAAC->GetBinCenter(ib+1),invyPbPb[ib]);
gaaCsystRb->SetPointEXlow(nP,sizesystrb);
gaaCsystRb->SetPointEXhigh(nP,sizesystrb);
gaaCsystRb->SetPointEYlow(nP,invyPbPb[ib]-invyPbPbHigHyp[ib]);
gaaCsystRb->SetPointEYhigh(nP,invyPbPbLowHyp[ib]-invyPbPb[ib]);
nP=gaaCsystFD->GetN();
gaaCsystFD->SetPoint(nP,hAAC->GetBinCenter(ib+1),invyPbPb[ib]);
gaaCsystFD->SetPointEXlow(nP,sizesystfd);
gaaCsystFD->SetPointEXhigh(nP,sizesystfd);
gaaCsystB->SetPoint(nP,hAAC->GetBinCenter(ib+1),invyPbPb[ib]);
gaaCsystB->SetPointEXlow(nP,sizesystfd);
gaaCsystB->SetPointEXhigh(nP,sizesystfd);
gaaCsystTot->SetPoint(nP,hAAC->GetBinCenter(ib+1),invyPbPb[ib]);
gaaCsystTot->SetPointEXlow(nP,sizesysttot);
gaaCsystTot->SetPointEXhigh(nP,sizesysttot);
if(optErrFD==0){
gaaCsystFD->SetPointEYlow(nP,relsysterrLowFDaa[ib]*invyPbPb[ib]);
gaaCsystFD->SetPointEYhigh(nP,relsysterrHiFDaa[ib]*invyPbPb[ib]);
}else{
Double_t minyield,maxyield;
Double_t minyieldsing,maxyieldsing;
if(optErrFD==1){
minyield=invyPbPbLo[ib];
maxyield=invyPbPbHi[ib];
minyieldsing=invyPbPbLoSingleSyst[ib];
maxyieldsing=invyPbPbHiSingleSyst[ib];
}else{
minyield=TMath::Min(invyPbPbLo[ib],invyPbPbLoS[ib]);
maxyield=TMath::Max(invyPbPbHi[ib],invyPbPbHiS[ib]);
minyieldsing=TMath::Min(invyPbPbLoSingleSyst[ib],invyPbPbLoSingleSystS[ib]);
maxyieldsing=TMath::Max(invyPbPbHiSingleSyst[ib],invyPbPbHiSingleSystS[ib]);
}
gaaCsystFD->SetPointEYlow(nP,invyPbPb[ib]-minyield);
gaaCsystFD->SetPointEYhigh(nP,maxyield-invyPbPb[ib]);
printf("Relative syst from FD (FONLL scales+masses)=-%f +%f\n",gaaCsystFD->GetErrorYlow(nP)/invyPbPb[ib],gaaCsystFD->GetErrorYhigh(nP)/invyPbPb[ib]);
Double_t systunBlow=0.;
Double_t systunBhigh=0.;
if(optCombineFDEloss==0){ // envelope
systunBlow=invyPbPb[ib]-minyieldsing;
systunBhigh=maxyieldsing-invyPbPb[ib];
}else{ // sum in quadrature
Double_t e1l=gaaCsystFD->GetErrorYlow(nP);
Double_t e1h=gaaCsystFD->GetErrorYhigh(nP);
Double_t e2l=gaaCsystRb->GetErrorYlow(nP);
Double_t e2h=gaaCsystRb->GetErrorYhigh(nP);
systunBlow=TMath::Sqrt(e1l*e1l+e2l*e2l);
systunBhigh=TMath::Sqrt(e1h*e1h+e2h*e2h);
}
gaaCsystB->SetPointEYlow(nP,systunBlow);
gaaCsystB->SetPointEYhigh(nP,systunBhigh);
Double_t totSystlow=TMath::Sqrt(systunBlow*systunBlow+systundatalow*systundatalow);
Double_t totSysthigh=TMath::Sqrt(systunBhigh*systunBhigh+systundatahigh*systundatahigh);
gaaCsystTot->SetPointEYlow(nP,totSystlow);
gaaCsystTot->SetPointEYhigh(nP,totSysthigh);
}
}
}
TH1F* hcheckRAAC=(TH1F*)hAAC->Clone("hcheckRAAC");
hcheckRAAC->Divide(hppC);
// Plots
gStyle->SetOptTitle(0);
TCanvas* c1=new TCanvas("c1","RcVsRb");
TLegend* leg= new TLegend(0.19,0.18,0.55,0.41);
leg->SetFillColor(0);
leg->SetFillStyle(0);
leg->SetBorderSize(0);
leg->SetTextFont(43);
leg->SetTextSize(28);
leg->SetMargin(0.32);
TLegendEntry* ent;
Bool_t first=kTRUE;
for(Int_t ib=0; ib<nPtBins; ib++){
if(draw[ib] && gcb[ib]->GetN()>0){
gcb[ib]->SetLineColor(colorarray[ib]);
gcb[ib]->SetLineWidth(3);
gcb[ib]->SetLineStyle(lstyle[ib]);
if(first){
gcb[ib]->Draw("AL");
gcb[ib]->GetXaxis()->SetLimits(0.,1.);
gcb[ib]->GetXaxis()->SetTitle("#it{R}_{AA} feed-down");
gcb[ib]->GetYaxis()->SetTitle("#it{R}_{AA} prompt");
gcb[ib]->SetMinimum(0.);
gcb[ib]->SetMaximum(1.);
first=kFALSE;
}else{
gcb[ib]->Draw("lsame");
}
ent=leg->AddEntry(gcb[ib],Form("%.1f<#it{p}_{T}<%.1f GeV/#it{c}",PtLims[ib],PtLims[ib+1]),"L");
}
}
leg->Draw();
first=kTRUE;
TCanvas* c2=new TCanvas("c2x","RcVsRcb",700,700);
c2->SetTickx();
c2->SetTicky();
// c2->SetGridx();
// c2->SetGridy();
c2->SetLeftMargin(0.14);
c2->SetBottomMargin(0.13);
c2->SetTopMargin(0.035);
c2->SetRightMargin(0.045);
for(Int_t ib=0; ib<nPtBins; ib++){
if(draw[ib] && gcrbc[ib]->GetN()>0){
gcrbc[ib]->SetLineColor(colorarray[ib]);
gcrbc[ib]->SetLineWidth(3);
gcrbc[ib]->SetLineStyle(lstyle[ib]);
if(first){
gcrbc[ib]->GetXaxis()->SetLimits(lowHypoFdOverPr,highHypoFdOverPr);
gcrbc[ib]->GetXaxis()->SetTitle("Hypothesis on (#it{R}_{AA} feed-down)/(#it{R}_{AA} prompt)");
gcrbc[ib]->GetYaxis()->SetTitleOffset(1.2);
gcrbc[ib]->GetXaxis()->SetTitleOffset(1.2);
gcrbc[ib]->GetYaxis()->SetTitleFont(43);
gcrbc[ib]->GetXaxis()->SetTitleFont(43);
gcrbc[ib]->GetYaxis()->SetTitleSize(30);
gcrbc[ib]->GetXaxis()->SetTitleSize(30);
gcrbc[ib]->GetYaxis()->SetLabelFont(43);
gcrbc[ib]->GetXaxis()->SetLabelFont(43);
gcrbc[ib]->GetYaxis()->SetLabelSize(28);
gcrbc[ib]->GetXaxis()->SetLabelSize(28);
if(!showRcbSystNorm){
gcrbc[ib]->GetYaxis()->SetTitle("#it{R}_{AA} prompt");
gcrbc[ib]->SetMinimum(0.);
gcrbc[ib]->SetMaximum(0.8);
}else{
gcrbc[ib]->GetYaxis()->SetTitle("Relative variation of #it{R}_{AA} prompt (%)");
gcrbc[ib]->SetMinimum(-20);
gcrbc[ib]->SetMaximum(20);
}
gcrbc[ib]->Draw("AL");
first=kFALSE;
}else{
gcrbc[ib]->Draw("Lsame");
}
if(!showRcbSystNorm){
mC[ib]->SetMarkerColor(colorarray[ib]);
mC[ib]->Draw("same");
}
}
}
// TBox* b=new TBox(0.5,0.,2.,1.);
// b->SetFillColor(kYellow);
// b->SetFillStyle(3003);
// b->Draw("same");
leg->Draw();
TLatex* tali0=new TLatex(0.18,0.89,"ALICE");
tali0->SetNDC();
tali0->SetTextFont(43);
tali0->SetTextSize(28);
tali0->Draw();
TLatex* tpbpb=new TLatex(0.41,0.89,Form("%s, %s%%",collSyst.Data(),centrality.Data()));
tpbpb->SetNDC();
tpbpb->SetTextFont(43);
tpbpb->SetTextSize(28);
tpbpb->Draw();
// TLatex* tdmes=new TLatex(0.63,0.85,Form("%s meson",mesSymb.Data()));
TLatex* tdmes=new TLatex(0.3,0.43,Form("%s meson",mesSymb.Data()));
tdmes->SetNDC();
tdmes->SetTextFont(43);
tdmes->SetTextSize(28);
tdmes->Draw();
TLine* lin0=new TLine(lowHypoFdOverPr,0.,highHypoFdOverPr,0.);
lin0->SetLineStyle(2);
lin0->SetLineColor(kGray+1);
lin0->Draw();
if(method==2 && optErrFD==2){
c2->SaveAs(Form("%s/%s-RcVsRcb_method%d_optErrFD%d_br%d_%s.eps",outputdir.Data(),mesName.Data(),method,optErrFD,correctForBR,suffix.Data()));
}
TCanvas* cfp=new TCanvas("cfp","fprompt",700,700);
gPad->SetTickx();
gPad->SetTicky();
hfPromptCent->SetMinimum(0);
hfPromptCent->SetMaximum(1.05);
hfPromptCent->SetLineWidth(3);
hfPromptCent->Draw();
hfPromptMinNb->SetLineWidth(2);
hfPromptMaxNb->SetLineWidth(2);
hfPromptMinNb->SetLineStyle(2);
hfPromptMaxNb->SetLineStyle(2);
hfPromptMinNb->Draw("same");
hfPromptMaxNb->Draw("same");
hfPromptMinfc->SetLineWidth(2);
hfPromptMaxfc->SetLineWidth(2);
hfPromptMinfc->SetLineStyle(2);
hfPromptMaxfc->SetLineStyle(2);
hfPromptMinfc->SetLineColor(2);
hfPromptMaxfc->SetLineColor(2);
if(optErrFD==2){
hfPromptMinfc->Draw("same");
hfPromptMaxfc->Draw("same");
TLatex* t1=new TLatex(0.17,0.15,"fc");
t1->SetNDC();
t1->SetTextColor(2);
t1->Draw();
}
TLatex* t2=new TLatex(0.17,0.2,"Nb");
t2->SetNDC();
t2->Draw();
cfp->SaveAs(Form("%s/fprompt-%s%s.eps",outputdir.Data(),mesName.Data(),suffix.Data()));
hppC->SetMarkerStyle(markerppC);
hppC->SetMarkerSize(msizppC);
hppC->SetMarkerColor(colorppC);
hppC->SetLineColor(colorppC);
hppC->SetLineWidth(linewippC);
hppC->SetLineStyle(linestppC);
gppCsystdata->SetLineColor(colorSystDatappC);
gppCsystdata->SetLineWidth(2);
gppCsystdata->SetFillStyle(0);
gppCsystdata->SetFillColor(colorSystDatappC);
gppCsystFD->SetLineColor(colorSystFD);
gppCsystFD->SetFillColor(colorSystFD);
hAAC->SetMarkerStyle(markeraaC);
hAAC->SetMarkerSize(msizaaC);
hAAC->SetMarkerColor(coloraaC);
hAAC->SetLineColor(coloraaC);
hAAC->SetLineWidth(linewiaaC);
hAAC->SetLineStyle(linestaaC);
gaaCsystdata->SetLineColor(colorSystDataaaC);
gaaCsystdata->SetLineWidth(2);
gaaCsystdata->SetFillStyle(0);
gaaCsystB->SetFillColor(colorSystRb);
gaaCsystRb->SetFillColor(colorSystRb);
gaaCsystFD->SetFillColor(colorSystFD);
gaaCsystTot->SetLineColor(1);
gaaCsystTot->SetLineWidth(3);
gaaCsystTot->SetFillStyle(0);
Float_t ymax=4.7*hppC->GetMaximum();
Float_t ymin=999.;
Float_t y16C=hAAC->GetBinContent(hAAC->FindBin(14.));
if(y16C>0. && y16C<ymin) ymin=y16C;
Float_t y12C=hAAC->GetBinContent(hAAC->FindBin(10.));
if(y12C>0. && y12C<ymin) ymin=y12C;
ymin*=0.255;
ymax=19.6;
ymin=7E-7;
if(collSyst=="p-Pb" && TMath::Abs(normToCsec-1.)>0.001){
ymax=110000.;
ymin=1.1;
}
else if(collSyst=="Pb-Pb" && centrality=="0-10"){
ymin=1E-8;
}
else if(collSyst=="Pb-Pb" && centrality=="30-50"){
ymin=1E-8;
}
TH2F *hempty=new TH2F("hempty","",100,0.,PtLims[nPtBins]*1.02,100,ymin,ymax);
hempty->GetXaxis()->SetTitle("#it{p}_{T} (GeV/#it{c})");
hempty->GetYaxis()->SetTitle("d#it{N}/d#it{p}_{T}_{ }|_{ |#it{y}|<0.5} (1/GeV/#it{c})");
if(TMath::Abs(normToCsec-1)>0.001) hempty->GetYaxis()->SetTitle("d#sigma/d#it{p}_{T}_{ }|_{ |#it{y}|<0.5} (#mub/GeV/#it{c})");
hempty->GetYaxis()->SetTitleSize(0.05);
hempty->GetXaxis()->SetTitleSize(0.05);
hempty->GetYaxis()->SetTitleOffset(1.3);
hempty->GetYaxis()->SetTitleFont(42);
hempty->GetXaxis()->SetTitleFont(42);
hempty->GetYaxis()->SetLabelFont(42);
hempty->GetXaxis()->SetLabelFont(42);
hempty->SetStats(0);
TLatex* tdec =new TLatex(0.18,0.89,Form("%s",mesSymb.Data()));
tdec->SetNDC();
tdec->SetTextSize(0.038);
tdec->SetTextFont(42);
gStyle->SetMarkerSize(1.8);
TCanvas* c3=new TCanvas("c3","Yield1Pad",750,800);
c3->SetLeftMargin(0.15);
c3->SetRightMargin(0.07);
c3->SetBottomMargin(0.12);
c3->SetTopMargin(0.07);
c3->SetLogy();
c3->SetTicky();
hempty->Draw();
gppCsystFD->Draw("e2same");
gppCsystdata->DrawClone("e2same");
gaaCsystFD->Draw("E2same");
gaaCsystRb->Draw("E2same");
gaaCsystdata->DrawClone("e2same");
hppC->DrawClone("Psame");
hAAC->DrawClone("Psame");
// TLegend* legC= new TLegend(0.59,0.77,0.89,0.91);
TLegend* legC= new TLegend(0.53,0.55,0.89,0.69);
//TLegend* legC= new TLegend(0.59,0.37,0.89,0.51);
legC->SetHeader(Form("Centrality %s",centrality.Data()));
legC->SetFillColor(0);
legC->SetTextFont(42);
ent=legC->AddEntry(hppC,"p-p rescaled reference","PL");
// ent=legC->AddEntry("","(#pm 6% norm. unc. not shown)","");
//ent->SetTextColor(hppC->GetLineColor());
ent=legC->AddEntry(hAAC,collSyst.Data(),"PL");
//ent->SetTextColor(hAAC->GetLineColor());
legC->Draw();
//TLegend* legSy= new TLegend(0.18,0.16,0.45,0.32);
//TLegend* legSy= new TLegend(0.62,0.57,0.89,0.75);
TLegend* legSy= new TLegend(0.566,0.715,0.89,0.86);
legSy->SetFillColor(0);
legSy->SetLineColor(kGray+2);
legSy->SetTextFont(42);
ent=legSy->AddEntry(gppCsystdata,"Syst. unc. from Data","F");
ent=legSy->AddEntry(gppCsystFD,"Syst. unc. from FONLL feed-down corr.","F");
ent=legSy->AddEntry(gaaCsystRb,"Syst. unc. from #it{R}_{AA} feed-down","F");
legSy->Draw();
tdec->Draw();
c3->SaveAs(Form("%s/%s-Yields_1pad_method%d_optErrFD%d_br%d%s.eps",outputdir.Data(),mesName.Data(),method,optErrFD,correctForBR,suffix.Data()));
TH2F *hemptyr=new TH2F("hemptyr","",100,0.,PtLims[nPtBins]*1.02,100,0.,1.7);
hemptyr->GetXaxis()->SetTitle("#it{p}_{T} (GeV/#it{c})");
hemptyr->GetYaxis()->SetTitle(Form("#it{R}_{AA} (prompt %s)",mesSymb.Data()));
hemptyr->GetYaxis()->SetTitleOffset(1.2);
hemptyr->SetStats(0);
TCanvas* c5=new TCanvas("c5","RAAcheck");
c5->SetGridy();
hRAAC->SetLineWidth(2);
hRAAC->SetMarkerStyle(20);
hRAAC->SetMarkerColor(1);
hRAAC->SetLineColor(1);
hRAAC->SetMinimum(0.);
hRAAC->SetMaximum(1.2);
hcheckRAAC->SetMarkerStyle(24);
hcheckRAAC->SetMarkerSize(1.2);
hcheckRAAC->SetMarkerColor(2);
hraaCcheck2->SetMarkerStyle(25);
hraaCcheck2->SetMarkerColor(6);
hraaCcheck2->SetMarkerSize(1.5);
graaC->SetFillColor(kGray);
hemptyr->Draw();
graaC->Draw("E2same");
hRAAC->Draw("PEsame");
hraaCcheck2->Draw("PSAME");
hcheckRAAC->Draw("PSAME");
TLegend* legr=new TLegend(0.7,0.7,0.89,0.89);
ent=legr->AddEntry(hRAAC,Form("%s%%",centrality.Data()),"PL");
legr->SetFillColor(0);
legr->SetTextFont(42);
legr->Draw();
c5->Update();
// c5->SaveAs(Form("%s-RAA_check_method%d.eps",mesName.Data(),method));
// TCanvas* c6=new TCanvas("c6","Rccheck");
// c6->Divide(3,2);
// for(Int_t ib=0; ib<nPtBins; ib++){
// c6->cd(ib+1);
// if(gcrbc[ib]->GetN()>0){
// hcheck[ib]->Draw("col");
// gcrbc[ib]->SetLineColor(colors[ib]);
// gcrbc[ib]->Draw("lsame");
// }
// }
TString type="Yield";
if(TMath::Abs(normToCsec-1)>0.001) type="CrossSec";
TFile* outfil=new TFile(Form("%s/%s%s_method%d_fd%d_br%d%s.root",outputdir.Data(),mesName.Data(),type.Data(),method,optErrFD,correctForBR,suffix.Data()),"recreate");
hAAC->Write();
gppCsystFD->Write();
gppCsystdata->Write();
gaaCsystFD->Write();
gaaCsystRb->Write();