1 #if !defined(__CINT__) || defined(__MAKECINT__)
10 #include "TGraphAsymmErrors.h"
19 #include "AliHFSystErr.h"
20 #include <Riostream.h>
24 ///////////////////////////////////////////////////////////////////////////////
26 // Macro to compute the Raa, taking as inputs the output of the corrected yields
27 // and the pp reference
29 // R_AB = [ ( dsigma/dpt )_AB / sigma_AB ] / <TAB> * ( dsigma/dpt )_pp
33 // 1. ppfile = reference pp in the same pt binning
34 // 2. ABfile = corrected AB yields
35 // 3. outfile = output file name
36 // 4. decay = decay as in HFSystErr class
37 // 5. sigmaABCINT1B = cross section for normalization (**USE THE SAME AS ON 2.**)
38 // 6. fdMethod = feed-down subtraction method (kNb, kfc)
39 // 7. cc = centrality class
40 // 8. Energy = colliding energy (k276,k55)
41 // 9. MinHypo = minimum energy loss hypothesis (Default 1./3.)
42 // 10. MaxHypo = maximum energy loss hypothesis (Default 3.0)
43 // 11. MaxRb = maximum Raa(b) hypothesis (Default 6.0, won't do anything)
44 // 12. RbHypo : flag to decide whether the Eloss hypothesis is Rb or Rb/Rc
45 // 13. CentralHypo = central energy loss hypothesis, DEFAULT TO 1.0
46 // 14. isRaavsEP = flag to compute the Raa IN/OUT of plane, divides the reference by 2.0
47 // 15. ScaledAndExtrapRef: flag to tag scaled+reference pp-scaled-data
49 // Complains to : Zaida Conesa del Valle
51 ///////////////////////////////////////////////////////////////////////////////
53 enum centrality{ kpp, k07half, kpPb0100, k010, k1020, k020, k2040, k2030, k3040, k4050, k3050, k5060, k4060, k6080, k4080, k5080, k80100 };
54 enum energy{ k276, k5dot023, k55 };
55 enum BFDSubtrMethod { kfc, kNb };
56 enum RaavsEP {kPhiIntegrated, kInPlane, kOutOfPlane};
58 Bool_t printout = false;
59 Double_t ptprintout = 1.5;
60 Double_t NormPPUnc = 0.035;
61 Double_t NormABUnc = 0.037;
62 Bool_t elossFDQuadSum = true;
64 //____________________________________________________________
65 Bool_t PbPbDataSyst(AliHFSystErr *syst, Double_t pt, Int_t cc, Double_t &dataSystUp, Double_t &dataSystDown);
67 //____________________________________________________________
68 Double_t ExtractFDSyst(Double_t total, Double_t fd) {
69 // total^2 = data^2 + fd^2
70 Double_t data2 = total*total - fd*fd ;
71 return TMath::Sqrt( data2 );
74 //____________________________________________________________
75 Int_t FindGraphBin(TGraphAsymmErrors *gr, Double_t pt)
78 Int_t npoints = gr->GetN();
79 for(Int_t i=0; i<=npoints; i++){
82 if ( TMath::Abs ( x - pt ) < 0.4 ) {
93 // R_AB = [ ( dsigma/dpt )_AB / sigma_AB ] / <TAB> * ( dsigma/dpt )_pp
96 //____________________________________________________________
97 void HFPtSpectrumRaa(const char *ppfile="HFPtSpectrum_D0Kpi_method2_rebinnedth_230311_newsigma.root",
98 const char *ABfile="HFPtSpectrum_D0Kpi_PbPbcuts_method2_rebinnedth_230311_newsigma.root",
99 const char *outfile="HFPtSpectrumRaa.root",
101 Double_t sigmaABCINT1B=54.e9,
102 Int_t fdMethod = kNb, Int_t cc=kpp, Int_t Energy=k276,
103 Double_t MinHypo=1./3., Double_t MaxHypo=3.0, Double_t MaxRb=6.0,
104 Bool_t isRbHypo=false, Double_t CentralHypo = 1.0,
105 Bool_t isUseTaaForRaa=true, const char *shadRbcFile="", Int_t nSigmaShad=3.0,
106 Int_t isRaavsEP=kPhiIntegrated, Bool_t isScaledAndExtrapRef=kFALSE)
109 gROOT->Macro("$ALICE_ROOT/PWGHF/vertexingHF/macros/LoadLibraries.C");
112 // Defining the TAB values for the given centrality class
114 Double_t Tab = 1., TabSyst = 0., A=207.2, B=207.2;
115 if ( Energy!=k276 && Energy!=k5dot023) {
116 printf("\n The Tab values for this cms energy have not yet been implemented, please do it ! \n");
122 // Values from Alberica's twiki:
123 // https://twiki.cern.ch/twiki/bin/viewauth/ALICE/CentStudies
124 if ( cc == k07half ) {
125 Tab = 24.81; TabSyst = 0.8037;
126 } else if ( cc == k010 ) {
127 Tab = 23.48; TabSyst = 0.97;
128 } else if ( cc == k1020 ) {
129 Tab = 14.4318; TabSyst = 0.5733;
130 } else if ( cc == k020 ) {
131 Tab = 18.93; TabSyst = 0.74;
132 } else if ( cc == k2040 ) {
133 Tab = 6.86; TabSyst = 0.28;
134 } else if ( cc == k2030 ) {
135 Tab = 8.73769; TabSyst = 0.370219;
136 } else if ( cc == k3040 ) {
137 Tab = 5.02755; TabSyst = 0.22099;
138 } else if ( cc == k4050 ) {
139 Tab = 2.68327; TabSyst = 0.137073;
140 } else if ( cc == k3050 ) {
141 Tab = 3.87011; TabSyst = 0.183847;
142 } else if ( cc == k4060 ) {
143 Tab = 2.00; TabSyst= 0.11;
144 } else if ( cc == k4080 ) {
145 Tab = 1.20451; TabSyst = 0.071843;
146 } else if ( cc == k5060 ) {
147 Tab = 1.32884; TabSyst = 0.0929536;
148 } else if ( cc == k6080 ) {
149 Tab = 0.419; TabSyst = 0.033;
150 } else if ( cc == k5080 ) {
151 Tab = 0.719; TabSyst = 0.054;
152 } else if ( cc == k80100 ){
153 Tab = 0.0690; TabSyst = 0.0062;
156 // pPb Glauber (A. Toia)
157 // https://twiki.cern.ch/twiki/bin/viewauth/ALICE/PACentStudies#Glauber_Calculations_with_sigma
158 else if( cc == kpPb0100 ){
159 Tab = 0.098334; TabSyst = 0.0070679;
164 // Reading the pp file
166 TFile * ppf = new TFile(ppfile,"read");
168 TGraphAsymmErrors * gSigmaPPSyst;
169 TGraphAsymmErrors * gSigmaPPSystData = (TGraphAsymmErrors*)ppf->Get("gScaledDataSystData");
170 TGraphAsymmErrors * gSigmaPPSystTheory = (TGraphAsymmErrors*)ppf->Get("gScaledDataSystExtrap");
171 TGraphAsymmErrors * gSigmaPPSystFeedDown = (TGraphAsymmErrors*)ppf->Get("gScaledDataSystFeedDown");
172 TH1I * hCombinedReferenceFlag;
173 TGraphAsymmErrors * gReferenceFdSyst;
174 if(isScaledAndExtrapRef){
175 hCombinedReferenceFlag = (TH1I*)ppf->Get("hCombinedReferenceFlag");
176 hSigmaPP = (TH1D*)ppf->Get("hReference");
177 gSigmaPPSyst = (TGraphAsymmErrors*)ppf->Get("gReferenceSyst");
178 gReferenceFdSyst = (TGraphAsymmErrors*)ppf->Get("gReferenceFdSyst");
180 hSigmaPP = (TH1D*)ppf->Get("fhScaledData");
181 gSigmaPPSyst = (TGraphAsymmErrors*)ppf->Get("gScaledData");
184 // Call the systematics uncertainty class for a given decay
185 AliHFSystErr *systematicsPP = new AliHFSystErr();
186 systematicsPP->Init(decay);
189 // Reading the AB collisions file
191 TFile * ABf = new TFile(ABfile,"read");
192 TH1D *hSigmaAB = (TH1D*)ABf->Get("histoSigmaCorr");
193 TH2D *hSigmaABRcb = (TH2D*)ABf->Get("histoSigmaCorrRcb");
194 TGraphAsymmErrors * gSigmaABSyst = (TGraphAsymmErrors*)ABf->Get("gSigmaCorr");
195 TGraphAsymmErrors * gSigmaABSystFeedDown = (TGraphAsymmErrors*)ABf->Get("gSigmaCorrConservative");
196 TNtuple * nSigmaAB = (TNtuple*)ABf->Get("fnSigma");
198 TH1D *hMassAB = (TH1D*)ABf->Get("hRECpt");
199 TH1D *hDirectEffptAB = (TH1D*)ABf->Get("hDirectEffpt");
200 TH1D *histofcAB = (TH1D*)ABf->Get("histofc");
202 TH1D* fhStatUncEffcSigmaAB = (TH1D*)ABf->Get("fhStatUncEffcSigma");
203 TH1D* fhStatUncEffbSigmaAB = (TH1D*)ABf->Get("fhStatUncEffbSigma");
204 TH1D* fhStatUncEffcFDAB = (TH1D*)ABf->Get("fhStatUncEffcFD");
205 TH1D* fhStatUncEffbFDAB = (TH1D*)ABf->Get("fhStatUncEffbFD");
207 TH1D* fhStatUncEffcSigmaAB_Raa = (TH1D*)fhStatUncEffcSigmaAB->Clone("fhStatUncEffcSigmaAB_Raa");
208 TH1D* fhStatUncEffbSigmaAB_Raa = (TH1D*)fhStatUncEffbSigmaAB->Clone("fhStatUncEffbSigmaAB_Raa");
209 TH1D* fhStatUncEffcFDAB_Raa = (TH1D*)fhStatUncEffcFDAB->Clone("fhStatUncEffcFDAB_Raa");
210 TH1D* fhStatUncEffbFDAB_Raa = (TH1D*)fhStatUncEffbFDAB->Clone("fhStatUncEffbFDAB_Raa");
211 fhStatUncEffcSigmaAB_Raa->Reset();
212 fhStatUncEffbSigmaAB_Raa->Reset();
213 fhStatUncEffcFDAB_Raa->Reset();
214 fhStatUncEffbFDAB_Raa->Reset();
215 fhStatUncEffcSigmaAB_Raa->SetName("fhStatUncEffcSigmaAB_Raa");
216 fhStatUncEffbSigmaAB_Raa->SetName("fhStatUncEffbSigmaAB_Raa");
217 fhStatUncEffcFDAB_Raa->SetName("fhStatUncEffcFDAB_Raa");
218 fhStatUncEffbFDAB_Raa->SetName("fhStatUncEffvFDAB_Raa");
222 // Call the systematics uncertainty class for a given decay
223 AliHFSystErr *systematicsAB = new AliHFSystErr();
224 systematicsAB->SetCollisionType(1);
225 if ( cc == k07half ) systematicsAB->SetCentrality("07half");
226 else if ( cc == k010 ) systematicsAB->SetCentrality("010");
227 else if ( cc == k1020 ) systematicsAB->SetCentrality("1020");
228 else if ( cc == k020 ) systematicsAB->SetCentrality("020");
229 else if ( cc == k2040 || cc == k2030 || cc == k3040 ) {
230 systematicsAB->SetCentrality("2040");
231 systematicsAB->SetIsPbPb2010EnergyScan(true);
233 else if ( cc == k4060 || cc == k4050 || cc == k5060 ) systematicsAB->SetCentrality("4060");
234 else if ( cc == k6080 || cc == k5080 ) systematicsAB->SetCentrality("6080");
235 else if ( cc == k4080 ) systematicsAB->SetCentrality("4080");
236 else if ( cc == k3050 ) {
237 if (isRaavsEP == kPhiIntegrated) systematicsAB->SetCentrality("4080");
238 else if (isRaavsEP == kInPlane) systematicsAB->SetCentrality("3050InPlane");
239 else if (isRaavsEP == kOutOfPlane) systematicsAB->SetCentrality("3050OutOfPlane");
242 else if ( cc == kpPb0100 ){
243 systematicsAB->SetCollisionType(2);
246 cout << " Systematics not yet implemented " << endl;
250 systematicsAB->Init(decay);
253 Int_t entries = nSigmaAB->GetEntries();
254 Float_t pt=0., signal=0., Rb=0., Rcb=0., fcAB=0., yieldAB=0., sigmaAB=0., statUncSigmaAB=0., sigmaABMin=0.,sigmaABMax=0.;
255 nSigmaAB->SetBranchAddress("pt",&pt);
256 nSigmaAB->SetBranchAddress("Signal",&signal);
257 if (fdMethod==kNb) nSigmaAB->SetBranchAddress("Rb",&Rb);
258 else if (fdMethod==kfc) nSigmaAB->SetBranchAddress("Rcb",&Rcb);
259 nSigmaAB->SetBranchAddress("fc",&fcAB);
260 nSigmaAB->SetBranchAddress("Yield",&yieldAB);
261 nSigmaAB->SetBranchAddress("Sigma",&sigmaAB);
262 nSigmaAB->SetBranchAddress("SigmaStatUnc",&statUncSigmaAB);
263 nSigmaAB->SetBranchAddress("SigmaMax",&sigmaABMax);
264 nSigmaAB->SetBranchAddress("SigmaMin",&sigmaABMin);
267 // define the binning
268 Int_t nbins = hSigmaAB->GetNbinsX();
269 Double_t binwidth = hSigmaAB->GetBinWidth(1);
270 Double_t *limits = new Double_t[nbins+1];
271 Double_t *binwidths = new Double_t[nbins];
273 for (Int_t i=1; i<=nbins; i++) {
274 binwidth = hSigmaAB->GetBinWidth(i);
275 xlow = hSigmaAB->GetBinLowEdge(i);
277 binwidths[i-1] = binwidth;
279 limits[nbins] = xlow + binwidth;
283 // Read the shadowing file if given as input
285 Double_t centralRbcShad[nbins+1], minRbcShad[nbins+1], maxRbcShad[nbins+1];
286 for(Int_t i=0; i<=nbins; i++) { centralRbcShad[i]=1.0; minRbcShad[i]=6.0; maxRbcShad[i]=0.0; }
287 Bool_t isShadHypothesis = false;
288 if( strcmp(shadRbcFile,"")!=0 ) {
289 isShadHypothesis = true;
290 cout<<endl<<">> Beware, using the shadowing prediction file with an "<<nSigmaShad<<"*sigma <<"<<endl<<endl;
291 TFile *fshad = new TFile(shadRbcFile,"read");
292 if(!fshad){ cout <<" >> Shadowing file not properly opened!!!"<<endl<<endl; return;}
293 // TH1D *hRbcShadCentral = (TH1D*)fshad->Get("hDfromBoverPromptD_Shadowing_central");
294 // TH1D *hRbcShadMin = (TH1D*)fshad->Get("hDfromBoverPromptD_Shadowing_upper");
295 // TH1D *hRbcShadMax = (TH1D*)fshad->Get("hDfromBoverPromptD_Shadowing_lower");
296 TH1D *hRbcShadCentral = (TH1D*)fshad->Get("hDfromBoverDfromc_L0");
297 TH1D *hRbcShadMin = (TH1D*)fshad->Get("hDfromBoverDfromc_L0");
298 TH1D *hRbcShadMax = (TH1D*)fshad->Get("hDfromBoverDfromc_L1");
301 for(Int_t i=1; i<=nbins; i++) {
302 Double_t xpt = hSigmaAB->GetBinCenter(i);
304 centralRbcShad[i] = hRbcShadCentral->GetBinContent( hRbcShadCentral->FindBin(xpt) );
305 Double_t minValue0 = hRbcShadMin->GetBinContent( hRbcShadMin->FindBin(xpt) );
306 Double_t maxValue0 = hRbcShadMax->GetBinContent( hRbcShadMax->FindBin(xpt) );
307 Double_t arrayEl[3] = {minValue0,maxValue0, centralRbcShad[i]};
308 Double_t minValue = TMath::MinElement(3,arrayEl);
309 Double_t maxValue = TMath::MaxElement(3,arrayEl);
310 cout<<">> Shadowing pt="<<xpt<<" central="<<centralRbcShad[i]<<" min="<<minValue<<" max="<<maxValue<<endl;
311 if(minValue>centralRbcShad[i]){ minValue = centralRbcShad[i]; }
312 if(maxValue<centralRbcShad[i]){ maxValue = centralRbcShad[i]; }
313 minRbcShad[i] = centralRbcShad[i] - nSigmaShad*(centralRbcShad[i] - minValue);
314 maxRbcShad[i] = centralRbcShad[i] + nSigmaShad*(maxValue - centralRbcShad[i]);
315 cout<<">> Shadowing hypothesis pt="<<xpt<<" central="<<centralRbcShad[i]<<" min="<<minRbcShad[i]<<" max="<<maxRbcShad[i]<<endl;
320 // define the bins correspondence bw histos/files/graphs
323 TH2D * hRABvsRcb = new TH2D("hRABvsRcb"," R_{AB}(c) vs Rcb Eloss hypothesis; p_{T} [GeV/c] ; R_{AB}(c) ; Rcb Eloss hypothesis ",nbins,limits,800,0.,4.);
324 TH2D * hRABvsRb = new TH2D("hRABvsRb"," R_{AB}(c) vs Rb Eloss hypothesis; p_{T} [GeV/c] ; R_{AB}(c) ; Rb Eloss hypothesis ",nbins,limits,800,0.,4.);
325 TH2D * hRABBeautyvsRCharm = new TH2D("hRABBeautyvsRCharm"," R_{AB}(c) vs Rb Eloss hypothesis; p_{T} [GeV/c] ; R_{AB}(b) ; R_{AB}(c) ",nbins,limits,800,0.,4.);
326 Int_t nbinsHypo=800;//200;
327 Double_t *limitsHypo = new Double_t[nbinsHypo+1];
328 for(Int_t i=1; i<=nbinsHypo+1; i++) limitsHypo[i-1]= i*4./800.;
329 TH3D * hRABCharmVsRBeautyVsPt = new TH3D("hRABCharmVsRBeautyVsPt"," R_{AB}(c) vs Rb vs p_{T} Eloss hypothesis; p_{T} [GeV/c] ; R_{AB}(b) ; R_{AB}(c) ",nbins,limits,nbinsHypo,limitsHypo,nbinsHypo,limitsHypo);
330 TH2D *hRCharmVsRBeauty[nbins+1];
331 for(Int_t i=0; i<=nbins; i++) hRCharmVsRBeauty[i] = new TH2D(Form("hRCharmVsRBeauty_%i",i),Form("RAB(c) vs RAB(b) for pt bin %i ; R_{AB}(b) ; R_{AB}(c)",i),nbinsHypo,limitsHypo,nbinsHypo,limitsHypo);
332 TH2D *hRCharmVsElossHypo[nbins+1];
333 for(Int_t i=0; i<=nbins; i++) hRCharmVsElossHypo[i] = new TH2D(Form("hRCharmVsElossHypo_%i",i),Form("RAB(c) vs ElossHypo for pt bin %i ; Eloss Hypothesis (c/b) ; R_{AB}(c)",i),nbinsHypo,limitsHypo,nbinsHypo,limitsHypo);
335 TH1D *hRABEloss00= new TH1D("hRABEloss00","hRABEloss00",nbins,limits);
336 TH1D *hRABEloss05= new TH1D("hRABEloss05","hRABEloss05",nbins,limits);
337 TH1D *hRABEloss10= new TH1D("hRABEloss10","hRABEloss10",nbins,limits);
338 TH1D *hRABEloss15= new TH1D("hRABEloss15","hRABEloss15",nbins,limits);
339 TH1D *hRABEloss20= new TH1D("hRABEloss20","hRABEloss20",nbins,limits);
341 TH2D * hRABvsRbFDlow = new TH2D("hRABvsRbFDlow"," R_{AB}(c) vs Rb Eloss hypothesis (FD low); p_{T} [GeV/c] ; Rb Eloss hypothesis ; R_{AB}(c) ",nbins,limits,800,0.,4.);
342 TH2D * hRABvsRbFDhigh = new TH2D("hRABvsRbFDhigh"," R_{AB}(c) vs Rb Eloss hypothesis (FD high); p_{T} [GeV/c] ; Rb Eloss hypothesis ; R_{AB}(c) ",nbins,limits,800,0.,4.);
344 TH1D * hRABvsRbFDhigh_proj = new TH1D("hRABvsRbFDhigh_proj","hRABvsRbFDhigh_proj",nbins,limits);
345 TH1D * hRABvsRbFDlow_proj = new TH1D("hRABvsRbFDlow_proj","hRABvsRbFDlow_proj",nbins,limits);
347 TNtuple *ntupleRAB=0x0 ;
349 ntupleRAB = new TNtuple("ntupleRAB","ntupleRAB (Nb)","pt:TAB:sigmaPP:sigmaAB:invyieldAB:invyieldABFDHigh:invyieldABFDLow:RABCharm:RABCharmFDHigh:RABCharmFDLow:RABBeauty:fc",100000);
350 } else if (fdMethod==kfc) {
351 ntupleRAB = new TNtuple("ntupleRAB","ntupleRAB (fc)","pt:TAB:sigmaPP:sigmaAB:invyieldAB:invyieldABFDHigh:invyieldABFDLow:Rcb:RABCharm:RABCharmFDHigh:RABCharmFDLow:RABBeauty:RABBeautyFDHigh:RABBeautyFDLow:fc",100000);
353 if(!ntupleRAB) printf("ERROR: Wrong method option");
355 TH1D * hYieldABvsPt = new TH1D("hYieldABvsPt"," Yield_{AB}(c) vs p_{T} (no Eloss hypothesis); p_{T} [GeV/c] ; Yield_{charm} ",nbins,limits);
356 TH1D * hRABvsPt = new TH1D("hRABvsPt"," R_{AB}(c) vs p_{T} (no Eloss hypothesis); p_{T} [GeV/c] ; R_{charm} ",nbins,limits);
357 TH1D * hRABvsPt_DataSystematics = new TH1D("hRABvsPt_DataSystematics"," Systematics of R_{AB} (c) vs p_{T} (no Eloss hypothesis); p_{T} [GeV/c] ; R_{charm} ",nbins,limits);
358 TGraphAsymmErrors *gRAB_ElossHypothesis = new TGraphAsymmErrors(nbins+1);
359 gRAB_ElossHypothesis->SetNameTitle("gRAB_ElossHypothesis","RAB Eloss systematics");
360 TGraphAsymmErrors *gRAB_FeedDownSystematics = new TGraphAsymmErrors(nbins+1);
361 gRAB_FeedDownSystematics->SetNameTitle("gRAB_FeedDownSystematics","RAB Feed-Down systematics");
362 TGraphAsymmErrors *gRAB_fcFeedDownOnly = new TGraphAsymmErrors(nbins+1);
363 gRAB_fcFeedDownOnly->SetNameTitle("gRAB_fcFeedDownOnly","RAB fc Feed-Down Only");
364 TGraphAsymmErrors *gRAB_FeedDownSystematicsElossHypothesis = new TGraphAsymmErrors(nbins+1);
365 gRAB_FeedDownSystematicsElossHypothesis->SetNameTitle("gRAB_FeedDownSystematicsElossHypothesis","RAB Feed-Down systematics considering Eloss hypothesis");
366 TGraphAsymmErrors *gRAB_DataSystematics = new TGraphAsymmErrors(nbins+1);
367 gRAB_DataSystematics->SetNameTitle("gRAB_DataSystematics","RAB Measurement (no FD, no Eloss) systematics");
368 TGraphAsymmErrors *gRAB_DataSystematicsPP = new TGraphAsymmErrors(nbins+1);
369 gRAB_DataSystematicsPP->SetNameTitle("gRAB_DataSystematicsPP","RAB Measurement PP meas. systematics (data+scaling)");
370 TGraphAsymmErrors *gRAB_DataSystematicsAB = new TGraphAsymmErrors(nbins+1);
371 gRAB_DataSystematicsAB->SetNameTitle("gRAB_DataSystematicsAB","RAB Measurement AB (no FD, no Eloss, no PP data) systematics");
372 TGraphAsymmErrors *gRAB_GlobalSystematics = new TGraphAsymmErrors(nbins+1);
373 gRAB_GlobalSystematics->SetNameTitle("gRAB_GlobalSystematics","RAB Measurement global (data, FD, Eloss) systematics");
374 Double_t ElossMax[nbins+1], ElossMin[nbins+1];
375 for(Int_t i=0; i<=nbins; i++) { ElossMax[i]=0.; ElossMin[i]=6.; }
376 Double_t fcElossMax[nbins+1], fcElossMin[nbins+1];
377 for(Int_t i=0; i<=nbins; i++) { fcElossMax[i]=0.; fcElossMin[i]=6.; }
378 Double_t FDElossMax[nbins+1], FDElossMin[nbins+1];
379 for(Int_t i=0; i<=nbins; i++) { FDElossMax[i]=0.; FDElossMin[i]=6.; }
381 TGraphAsymmErrors *gRAB_Norm = new TGraphAsymmErrors(1);
382 gRAB_Norm->SetNameTitle("gRAB_Norm","RAB Normalization systematics (pp norm + Tab)");
383 Double_t normUnc = TMath::Sqrt ( NormPPUnc*NormPPUnc + (TabSyst/Tab)*(TabSyst/Tab) );
384 if(!isUseTaaForRaa) normUnc = TMath::Sqrt ( NormPPUnc*NormPPUnc + NormABUnc*NormABUnc );
385 gRAB_Norm->SetPoint(1,0.5,1.);
386 gRAB_Norm->SetPointError(1,0.25,0.25,normUnc,normUnc);
389 // R_AB = ( dN/dpt )_AB / <Ncoll_AB> * ( dN/dpt )_pp ; <Ncoll> = <Tab> * sigma_NN^inel
390 // R_AB = [ ( dsigma/dpt )_AB / sigma_AB ] / <TAB> * ( dsigma/dpt )_pp
392 Int_t istartPPfd=0, istartPPsyst=0, istartABfd=0, istartPPextr=0;
393 Double_t yPPh=0., yPPl=0., yABh=0., yABl=0.;
394 Double_t RaaCharm =0., RaaBeauty=0.;
395 Double_t RaaCharmFDhigh = 0., RaaCharmFDlow = 0.;
396 Double_t RaaBeautyFDhigh = 0., RaaBeautyFDlow = 0.;
397 Double_t systUp=0., systLow=0., systPPUp=0., systPPLow=0., systABUp=0., systABLow=0.;
400 // Search the central value of the energy loss hypothesis Rb = Rc (bin)
402 Double_t ElossCentral[nbins+1];
403 for(Int_t i=0; i<=nbins; i++) { ElossCentral[i]=0.; }
405 for(Int_t ientry=0; ientry<=entries; ientry++){
407 nSigmaAB->GetEntry(ientry);
408 // cout << " pt="<< pt<<" sigma-AB="<<sigmaAB<<endl;
409 if ( !(sigmaAB>0.) ) continue;
410 //if(decay==2 && pt<2.) continue;
412 // Compute RAB and the statistical uncertainty
413 Int_t hppbin = hSigmaPP->FindBin( pt );
414 Int_t hABbin = hSigmaAB->FindBin( pt );
415 Double_t sigmapp = hSigmaPP->GetBinContent( hppbin );
416 // cout << " pt="<< pt<<", sigma-pp="<< sigmapp<<endl;
417 if (isRaavsEP>0.) sigmapp = 0.5*sigmapp;
418 if ( !(sigmapp>0.) ) continue;
420 RaaCharm = ( sigmaAB / sigmaABCINT1B ) / ((Tab*1e3) * sigmapp *1e-12 ) ;
421 if(!isUseTaaForRaa) {
422 RaaCharm = ( sigmaAB ) / ( (A*B) * sigmapp ) ;
428 else if (fdMethod==kfc) {
429 RaaBeauty = ( RaaCharm / Rcb ) ;
432 Double_t ElossHypo = 0.;
433 if (fdMethod==kfc) { ElossHypo = 1. / Rcb; }
434 else { ElossHypo = 1. / (RaaCharm / RaaBeauty) ; }
435 if(isRbHypo) ElossHypo = RaaBeauty;
437 // If using shadowing hypothesis, change the central hypothesis too
438 if(isShadHypothesis) CentralHypo = centralRbcShad[hABbin];
440 // cout <<" pt "<< pt << " Raa charm " << RaaCharm << " Raa beauty " << RaaBeauty << " eloss hypo "<< ElossHypo<<endl;
442 // Find the bin for the central Eloss hypo
444 if( TMath::Abs( ElossHypo - CentralHypo ) < 0.075 ){
445 Double_t DeltaIni = TMath::Abs( ElossCentral[ hABbin ] - CentralHypo );
446 Double_t DeltaV = TMath::Abs( ElossHypo - CentralHypo );
447 // cout << " pt " << pt << " ECentral " << ElossCentral[ hABbin ] << " Ehypo "<< ElossHypo ;
448 if ( DeltaV < DeltaIni ) ElossCentral[ hABbin ] = ElossHypo;
449 // cout << " final ECentral " << ElossCentral[ hABbin ] << endl;
453 // Calculation of the Raa and its uncertainties
455 for(Int_t ientry=0; ientry<entries; ientry++){
457 nSigmaAB->GetEntry(ientry);
458 if ( !(sigmaAB>0.) ) continue;
459 // if ( pt<2 || pt>16) continue;
462 // Compute RAB and the statistical uncertainty
463 Int_t hppbin = hSigmaPP->FindBin( pt );
464 Double_t sigmapp = hSigmaPP->GetBinContent( hppbin );
465 if (isRaavsEP>0.) sigmapp = 0.5*sigmapp;
466 if ( !(sigmapp>0.) ) continue;
468 RaaCharm = ( sigmaAB / sigmaABCINT1B ) / ((Tab*1e3) * sigmapp *1e-12 );
469 if(!isUseTaaForRaa) {
470 RaaCharm = ( sigmaAB ) / ( (A*B) * sigmapp ) ;
473 // Flag to know if it is an scaled or extrapolated point of the pp reference
474 Bool_t isExtrapolatedBin = kFALSE;
475 if(isScaledAndExtrapRef) isExtrapolatedBin = hCombinedReferenceFlag->GetBinContent( hppbin );
477 istartPPsyst = FindGraphBin(gSigmaPPSyst,pt);
480 // FONLL Feed-Down systematics
483 if(!isExtrapolatedBin) istartPPfd = FindGraphBin(gSigmaPPSystFeedDown,pt);
485 istartABfd = FindGraphBin(gSigmaABSystFeedDown,pt);
487 // cout << " Starting bin for pp is "<< istartPPfd <<", for AA is "<<istartABfd << endl;
488 if(isExtrapolatedBin){
489 Int_t ibinfd = FindGraphBin(gReferenceFdSyst,pt);
490 yPPh = gReferenceFdSyst->GetErrorYhigh(ibinfd);
491 yPPl = gReferenceFdSyst->GetErrorYlow(ibinfd);
493 yPPh = gSigmaPPSystFeedDown->GetErrorYhigh(istartPPfd);
494 yPPl = gSigmaPPSystFeedDown->GetErrorYlow(istartPPfd);
501 yABh = gSigmaABSystFeedDown->GetErrorYhigh(istartABfd);
502 yABl = gSigmaABSystFeedDown->GetErrorYlow(istartABfd);
505 RaaCharmFDhigh = ( sigmaABMax / sigmaABCINT1B ) / ((Tab*1e3) * (sigmapp+yPPh) *1e-12 ) ;
506 RaaCharmFDlow = ( sigmaABMin / sigmaABCINT1B ) / ((Tab*1e3) * (sigmapp-yPPl) *1e-12 ) ;
507 if(printout && TMath::Abs(ptprintout-pt)<0.1 ) cout << endl<<" pt "<< pt << " Raa " << RaaCharm <<" high "<< RaaCharmFDhigh << " low "<< RaaCharmFDlow<<endl;
508 if(!isUseTaaForRaa) {
509 RaaCharmFDhigh = ( sigmaABMax ) / ( (A*B)* (sigmapp+yPPh) ) ;
510 RaaCharmFDlow = ( sigmaABMin ) / ( (A*B)* (sigmapp-yPPl) ) ;
516 RaaBeautyFDlow = Rb ;
517 RaaBeautyFDhigh = Rb ;
518 ntupleRAB->Fill( pt, Tab*1e3, sigmapp*1e-12, sigmaAB*1e-12, sigmaAB/sigmaABCINT1B,
519 sigmaABMax / sigmaABCINT1B, sigmaABMin / sigmaABCINT1B,
520 RaaCharm, RaaCharmFDhigh, RaaCharmFDlow, RaaBeauty, fcAB );
522 else if (fdMethod==kfc) {
523 RaaBeauty = ( RaaCharm / Rcb ) ;
524 RaaBeautyFDlow = ( RaaCharmFDlow / Rcb ) ;
525 RaaBeautyFDhigh = ( RaaCharmFDhigh / Rcb ) ;
526 hRABvsRcb->Fill( pt, RaaCharm, RaaBeauty );
527 ntupleRAB->Fill( pt, Tab*1e3, sigmapp*1e-12, sigmaAB*1e-12, sigmaAB/sigmaABCINT1B,
528 sigmaABMax / sigmaABCINT1B, sigmaABMin / sigmaABCINT1B,
529 Rcb, RaaCharm, RaaCharmFDhigh, RaaCharmFDlow, RaaBeauty, RaaBeautyFDhigh, RaaBeautyFDlow, fcAB );
531 hRABvsRb->Fill( pt, RaaCharm, RaaBeauty );
532 hRABvsRbFDlow->Fill( pt, RaaCharmFDlow, RaaBeautyFDlow );
533 hRABvsRbFDhigh->Fill( pt, RaaCharmFDhigh, RaaBeautyFDhigh );
534 if(printout && TMath::Abs(ptprintout-pt)<0.1) cout << " pt "<< pt << " Rb " << RaaBeauty <<" high "<< RaaBeautyFDhigh << " low "<< RaaBeautyFDlow <<endl;
536 hRABCharmVsRBeautyVsPt->Fill( pt, RaaBeauty, RaaCharm );
537 Int_t ptbin = hRABvsPt->FindBin( pt );
538 hRCharmVsRBeauty[ptbin]->Fill( RaaBeauty, RaaCharm );
539 hRCharmVsRBeauty[ptbin]->Fill( RaaBeautyFDlow, RaaCharmFDlow );
540 hRCharmVsRBeauty[ptbin]->Fill( RaaBeautyFDhigh, RaaCharmFDhigh );
544 if( TMath::Abs(Rcb-0.015)<0.009 ) hRABEloss00->Fill(pt,RaaCharm);
545 if( TMath::Abs(Rcb-0.5)<0.009 ) hRABEloss05->Fill(pt,RaaCharm);
546 if( TMath::Abs(Rcb-1.0)<0.009 ) {
547 hRABEloss10->Fill(pt,RaaCharm);
548 hRABvsRbFDhigh_proj->Fill(pt,RaaCharmFDhigh);
549 hRABvsRbFDlow_proj->Fill(pt,RaaCharmFDlow);
551 if( TMath::Abs(Rcb-1.5)<0.009 ) hRABEloss15->Fill(pt,RaaCharm);
552 if( TMath::Abs(Rcb-2.0)<0.009 ) hRABEloss20->Fill(pt,RaaCharm);
554 else if (fdMethod==kNb) {
555 if( TMath::Abs(RaaBeauty-0.015)<0.009 ) hRABEloss00->Fill(pt,RaaCharm);
556 if( TMath::Abs(RaaBeauty-0.5)<0.009 ) hRABEloss05->Fill(pt,RaaCharm);
557 if( TMath::Abs(RaaBeauty-1.0)<0.009 ) {
558 hRABEloss10->Fill(pt,RaaCharm);
559 hRABvsRbFDhigh_proj->Fill(pt,RaaCharmFDhigh);
560 hRABvsRbFDlow_proj->Fill(pt,RaaCharmFDlow);
562 if( TMath::Abs(RaaBeauty-1.5)<0.009 ) hRABEloss15->Fill(pt,RaaCharm);
563 if( TMath::Abs(RaaBeauty-2.0)<0.009 ) hRABEloss20->Fill(pt,RaaCharm);
567 Int_t hABbin = hMassAB->FindBin( pt );
568 if(isShadHypothesis) CentralHypo = centralRbcShad[hABbin];
570 if(printout && TMath::Abs(ptprintout-pt)<0.1)
571 if ( fdMethod==kNb && TMath::Abs(Rb -CentralHypo)< 0.05) {
572 cout << " pt "<< pt <<", at bin "<<hABbin<<endl;
573 cout<<" entries "<<entries<<", i="<<ientry<<", pt="<<pt<<", Rb="<<Rb<<", Tab="<<Tab<<", sigmaAB="<<sigmaAB<<", sigmapp="<<sigmapp<<", Raacharm="<<RaaCharm<<", RaaBeauty="<<RaaBeauty<<endl;
574 cout << " AB basis: mass "<< hMassAB->GetBinContent(hABbin)<<", eff "<< hDirectEffptAB->GetBinContent(hABbin)<<endl;
575 cout<<" FD low, err low AB "<< (sigmaAB-sigmaABMin)<<" err low PP "<< yPPl<<" Raacharm="<<RaaCharmFDlow<<", RaaBeauty="<<RaaBeautyFDlow<<endl;
576 cout<<" FD high, err high AB "<< (sigmaABMax-sigmaAB)<<" err high PP "<< yPPh<<" Raacharm="<<RaaCharmFDhigh<<", RaaBeauty="<<RaaBeautyFDhigh<<endl;
578 if(printout && TMath::Abs(ptprintout-pt)<0.1)
579 if ( fdMethod==kfc) if(TMath::Abs(Rcb -CentralHypo)< 0.05 ){
580 cout << " pt "<< pt <<", at bin "<<hABbin<<endl;
581 cout<<" entries "<<entries<<", i="<<ientry<<", pt="<<pt<<", Rcb="<<Rcb<<", Tab="<<Tab<<", sigmaAB="<<sigmaAB<<", sigmapp="<<sigmapp<<", Raacharm="<<RaaCharm<<", RaaBeauty="<<RaaBeauty<<endl;
582 cout << " AB basis: mass "<< hMassAB->GetBinContent(hABbin)<<", eff "<< hDirectEffptAB->GetBinContent(hABbin)<<", fc "<<histofcAB->GetBinContent(hABbin)<< endl;
583 cout<<" FD low, err low AB "<< (sigmaAB-sigmaABMin)<<" err low PP "<< yPPl<<" Raacharm="<<RaaCharmFDlow<<", RaaBeauty="<<RaaBeautyFDlow<<endl;
584 cout<<" FD high, err high AB "<< (sigmaABMax-sigmaAB)<<" err high PP "<< yPPh<<" Raacharm="<<RaaCharmFDhigh<<", RaaBeauty="<<RaaBeautyFDhigh<<endl;
589 // Fill in the global properties ?
591 Double_t ElossHypo = 0.;
592 if (fdMethod==kfc) { ElossHypo = 1./ Rcb; }
593 else { ElossHypo = 1. / (RaaCharm / RaaBeauty); }
594 if(isRbHypo) ElossHypo = RaaBeauty;
595 hRCharmVsElossHypo[ptbin]->Fill( ElossHypo, RaaCharm );
597 // If using shadowing hypothesis, change the limit hypothesis too
598 if(isShadHypothesis) {
599 MinHypo = minRbcShad[ hABbin ];
600 MaxHypo = maxRbcShad[ hABbin ];
603 // cout <<" pt "<< pt << " Raa charm " << RaaCharm << " Raa beauty " << RaaBeauty << " eloss hypo "<< ElossHypo
604 if(ientry==0) cout<<" pt"<< pt<< " ElossCentral "<< ElossCentral[hABbin] << " min-hypo "<<MinHypo << " max-hypo "<<MaxHypo<<endl;
607 // Fill in histos charm (null Eloss hypothesis)
609 Double_t minFdSyst = 0., maxFdSyst = 0.;
610 if ( ElossHypo == ElossCentral[ hABbin ] ) {
612 // cout <<endl<<">>>>>>>>>>> tete >>>>>>>>>>>>>>"<<endl<<endl;
615 // Data stat uncertainty
617 Double_t sigmappStat = hSigmaPP->GetBinError( hppbin );
618 if (isRaavsEP>0.) sigmappStat = sigmappStat*0.5;
619 Int_t hRABbin = hRABvsPt->FindBin( pt );
620 Double_t stat = RaaCharm * TMath::Sqrt( (statUncSigmaAB/sigmaAB)*(statUncSigmaAB/sigmaAB) +
621 (sigmappStat/sigmapp)*(sigmappStat/sigmapp) ) ;
622 if ( RaaCharm==0 ) stat =0.;
624 hRABvsPt->SetBinContent( hRABbin, RaaCharm );
625 hRABvsPt->SetBinError( hRABbin, stat );
626 hYieldABvsPt->SetBinContent( hRABbin, sigmaAB/sigmaABCINT1B );
627 hYieldABvsPt->SetBinError( hRABbin, statUncSigmaAB/sigmaABCINT1B );
629 cout << "pt="<< pt<< " Raa " << RaaCharm << " stat unc. "<<
630 " sigma-pp "<< sigmapp <<" sigma-AB "<< sigmaAB<<endl;
631 if(printout && TMath::Abs(ptprintout-pt)<0.1) {
632 cout << " Raa " << RaaCharm << " stat unc. "<< stat << " is "<< stat/RaaCharm * 100. <<
633 "%, stat-pp "<< sigmappStat/sigmapp*100. <<"% stat-AB "<< statUncSigmaAB/sigmaAB*100.<<"%"<<endl;
636 Double_t errstatEff = fhStatUncEffcSigmaAB->GetBinError( hRABbin );
637 fhStatUncEffcSigmaAB_Raa->SetBinError( hRABbin, errstatEff*RaaCharm );
638 errstatEff = fhStatUncEffbSigmaAB->GetBinError( hRABbin );
639 fhStatUncEffbSigmaAB_Raa->SetBinError( hRABbin, errstatEff*RaaCharm );
640 errstatEff = fhStatUncEffcFDAB->GetBinError( hRABbin );
641 fhStatUncEffcFDAB_Raa->SetBinError( hRABbin, errstatEff*RaaCharm );
642 errstatEff = fhStatUncEffbFDAB->GetBinError( hRABbin );
643 fhStatUncEffbFDAB_Raa->SetBinError( hRABbin, errstatEff*RaaCharm );
649 // Data systematics (sigma syst-but FD + extrap) syst
652 // Data syst: a) Syst in p-p
654 Double_t ptwidth = hSigmaAB->GetBinWidth(hABbin) / 2. ;
656 if(!isExtrapolatedBin) istartPPextr = FindGraphBin(gSigmaPPSystTheory,pt);
658 Double_t dataPPUp=0., dataPPLow=0.;
659 if(isExtrapolatedBin) {
660 dataPPUp = gSigmaPPSyst->GetErrorYhigh(istartPPsyst);
661 dataPPLow = gSigmaPPSyst->GetErrorYlow(istartPPsyst);
663 systPPLow = dataPPLow;
665 dataPPUp = ExtractFDSyst( gSigmaPPSystData->GetErrorYhigh(istartPPextr), gSigmaPPSystFeedDown->GetErrorYhigh(istartPPfd) );
666 dataPPLow = ExtractFDSyst( gSigmaPPSystData->GetErrorYlow(istartPPextr), gSigmaPPSystFeedDown->GetErrorYlow(istartPPfd) );
667 systPPUp = TMath::Sqrt( dataPPUp*dataPPUp + gSigmaPPSystTheory->GetErrorYhigh(istartPPextr)*gSigmaPPSystTheory->GetErrorYhigh(istartPPextr) );
668 systPPLow = TMath::Sqrt( dataPPLow*dataPPLow + gSigmaPPSystTheory->GetErrorYlow(istartPPextr)*gSigmaPPSystTheory->GetErrorYlow(istartPPextr) );
671 dataPPUp = dataPPUp*0.5;
672 dataPPLow = dataPPLow*0.5;
673 if(isExtrapolatedBin) {
675 systPPLow = dataPPLow;
677 systPPUp = TMath::Sqrt( dataPPUp*dataPPUp + 0.5*gSigmaPPSystTheory->GetErrorYhigh(istartPPextr)*0.5*gSigmaPPSystTheory->GetErrorYhigh(istartPPextr) );
678 systPPLow = TMath::Sqrt( dataPPLow*dataPPLow + 0.5*gSigmaPPSystTheory->GetErrorYlow(istartPPextr)*0.5*gSigmaPPSystTheory->GetErrorYlow(istartPPextr) );
683 if(printout && TMath::Abs(ptprintout-pt)<0.1) {
684 cout << " pt : "<< pt<<" Syst-pp-data "<< dataPPUp/sigmapp << "%, ";
685 if(!isExtrapolatedBin){
686 if (isRaavsEP>0.) cout <<" extr unc + "<< 0.5*gSigmaPPSystTheory->GetErrorYhigh(istartPPextr)/sigmapp <<" - "<< 0.5*gSigmaPPSystTheory->GetErrorYlow(istartPPextr)/sigmapp <<" %";
687 else cout <<" extr unc + "<< gSigmaPPSystTheory->GetErrorYhigh(istartPPextr)/sigmapp <<" - "<< gSigmaPPSystTheory->GetErrorYlow(istartPPextr)/sigmapp <<" %";
693 // Data syst: b) Syst in PbPb
695 Double_t dataSystUp=0., dataSystDown=0.;
696 Bool_t PbPbDataSystOk = PbPbDataSyst(systematicsAB,pt,cc,dataSystUp,dataSystDown);
697 if (!PbPbDataSystOk) { cout <<" There is some issue with the PbPb data systematics, please check and rerun"<<endl; return; }
698 systABUp = sigmaAB * TMath::Sqrt( dataSystUp*dataSystUp +
699 (hDirectEffptAB->GetBinError(hABbin)/hDirectEffptAB->GetBinContent(hABbin))*(hDirectEffptAB->GetBinError(hABbin)/hDirectEffptAB->GetBinContent(hABbin)) );
701 systABLow = sigmaAB * TMath::Sqrt( dataSystDown*dataSystDown +
702 (hDirectEffptAB->GetBinError(hABbin)/hDirectEffptAB->GetBinContent(hABbin))*(hDirectEffptAB->GetBinError(hABbin)/hDirectEffptAB->GetBinContent(hABbin)) );
704 // Data syst : c) combine pp & PbPb
706 systLow = sigmapp>0. ?
707 RaaCharm * TMath::Sqrt( (systABLow/sigmaAB)*(systABLow/sigmaAB) + (systPPUp/sigmapp)*(systPPUp/sigmapp) )
710 systUp = sigmapp>0. ?
711 RaaCharm * TMath::Sqrt( (systABUp/sigmaAB)*(systABUp/sigmaAB) + (systPPLow/sigmapp)*(systPPLow/sigmapp) )
713 if ( RaaCharm==0 ) { systPPUp =0.; systPPLow =0.; }
716 cout << " Syst-pp-up "<< systPPUp/sigmapp <<"%, syst-pp-low "<< systPPLow/sigmapp <<"%, syst-AB-up "<<systABUp/sigmaAB<<"%, syst-AB-low "<<systABLow/sigmaAB<<"%, tot-syst-up "<<systUp/RaaCharm<<"%, tot-syst-low "<<systLow/RaaCharm<<"%"<<endl;
719 hRABvsPt_DataSystematics->SetBinContent( hRABbin, RaaCharm );
720 hRABvsPt_DataSystematics->SetBinError( hRABbin, systUp );
721 gRAB_DataSystematics->SetPoint( hABbin, pt, RaaCharm ); // i, x, y
722 gRAB_DataSystematics->SetPointError( hABbin, ptwidth, ptwidth, systLow, systUp );
723 gRAB_DataSystematics->SetPointEXlow(hABbin, 0.4); gRAB_DataSystematics->SetPointEXhigh(hABbin,0.4);
724 gRAB_DataSystematicsPP->SetPoint( hABbin, pt, RaaCharm ); // i, x, y
725 gRAB_DataSystematicsPP->SetPointError( hABbin, ptwidth, ptwidth, RaaCharm *(systPPUp/sigmapp), RaaCharm *systPPLow/sigmapp );
726 gRAB_DataSystematicsAB->SetPoint( hABbin, pt, RaaCharm ); // i, x, y
727 gRAB_DataSystematicsAB->SetPointError( hABbin, ptwidth, ptwidth, RaaCharm *systABLow/sigmaAB, RaaCharm *systABUp/sigmaAB );
731 // Feed-down Systematics
733 Double_t FDL=0., FDH=0.;
734 if ( RaaCharmFDhigh > RaaCharmFDlow ){
735 FDH = RaaCharmFDhigh; FDL = RaaCharmFDlow;
737 FDL = RaaCharmFDhigh; FDH = RaaCharmFDlow;
740 if(printout && TMath::Abs(ptprintout-pt)<0.1) cout<<" Raa "<<RaaCharm<<", Raa-fd-low "<<RaaCharmFDlow <<", Raa-fd-high "<<RaaCharmFDhigh <<endl;
741 maxFdSyst = TMath::Abs(FDH - RaaCharm);
742 minFdSyst = TMath::Abs(RaaCharm - FDL);
744 gRAB_FeedDownSystematics->SetPoint( hABbin, pt, RaaCharm ); // i, x, y
745 gRAB_FeedDownSystematics->SetPointError( hABbin, 0.3, 0.3, minFdSyst, maxFdSyst ); // i, x, y
746 gRAB_fcFeedDownOnly->SetPoint( hABbin, pt,fcAB );
747 gRAB_fcFeedDownOnly->SetPointError(hABbin, 0.3, 0.3, fcAB-(sigmaABMin/sigmaAB*fcAB), (sigmaABMax/sigmaAB*fcAB)-fcAB );
751 cout<<" FD syst +"<< maxFdSyst/RaaCharm <<" - "<<minFdSyst/RaaCharm<<endl;
752 cout<<" fc = "<<fcAB<<", ("<< sigmaABMax/sigmaAB * fcAB <<","<< sigmaABMin/sigmaAB * fcAB <<")"<<endl;
756 // Filling part of the Eloss scenarii information
759 gRAB_ElossHypothesis->SetPoint( hABbin, pt, RaaCharm ); // i, x, y
760 gRAB_ElossHypothesis->SetPointEXlow( hABbin, ptwidth);
761 gRAB_ElossHypothesis->SetPointEXhigh( hABbin, ptwidth);
762 gRAB_FeedDownSystematicsElossHypothesis->SetPoint( hABbin, pt, RaaCharm ); // i, x, y
763 gRAB_FeedDownSystematicsElossHypothesis->SetPointEXlow( hABbin, ptwidth);
764 gRAB_FeedDownSystematicsElossHypothesis->SetPointEXhigh( hABbin, ptwidth);
765 gRAB_GlobalSystematics->SetPoint( hABbin, pt, RaaCharm ); // i, x, y
766 gRAB_GlobalSystematics->SetPointEXlow(hABbin,0.4); gRAB_GlobalSystematics->SetPointEXhigh(hABbin,0.4);
771 // Filling Eloss scenarii information
773 if( RaaCharm>0 && ElossHypo >= MinHypo && ElossHypo <=MaxHypo && RaaBeauty<=MaxRb ) {
775 // cout <<endl<<">>>>>>>>>>> tetuu >>>>>>>>>>>>>>"<<endl<<endl;
776 Double_t Ehigh = ElossMax[ hABbin ] ;
777 Double_t Elow = ElossMin[ hABbin ] ;
778 if ( RaaCharm > Ehigh ) ElossMax[ hABbin ] = RaaCharm ;
779 if ( RaaCharm < Elow ) ElossMin[ hABbin ] = RaaCharm ;
780 if(printout && TMath::Abs(ptprintout-pt)<0.1) {
781 cout<<" Hypothesis " << ElossHypo << " sigma-AB "<< sigmaAB <<", Raa "<< RaaCharm <<", Raa Eloss max "<< ElossMax[hABbin] <<" Raa Eloss min "<< ElossMin[hABbin] << " Rb="<< RaaBeauty <<endl;
782 cout<<" Rb="<< RaaBeauty <<" max "<< RaaBeautyFDhigh <<" min "<< RaaBeautyFDlow <<endl;
784 Double_t fcEhigh = fcElossMax[ hABbin ] ;
785 Double_t fcElow = fcElossMin[ hABbin ] ;
786 if ( fcAB > fcEhigh ) fcElossMax[ hABbin ] = fcAB ;
787 if ( fcAB < fcElow ) fcElossMin[ hABbin ] = fcAB ;
788 Double_t FDEhigh = FDElossMax[ hABbin ];
789 Double_t FDEmin = FDElossMin[ hABbin ];
790 Double_t RFDhigh = RaaCharmFDhigh>RaaCharmFDlow ? RaaCharmFDhigh : RaaCharmFDlow;
791 Double_t RFDlow = RaaCharmFDlow<RaaCharmFDhigh ? RaaCharmFDlow : RaaCharmFDhigh;
792 if ( RFDhigh > FDEhigh ) FDElossMax[ hABbin ] = RFDhigh ;
793 if ( RFDlow < FDEmin ) FDElossMin[ hABbin ] = RFDlow ;
794 if(printout && TMath::Abs(ptprintout-pt)<0.1)
795 cout<<" Hypothesis " << ElossHypo << " sigma-AB "<< sigmaAB <<", Raa FD-max Eloss max "<< FDElossMax[hABbin] <<" Raa FD-min Eloss min "<< FDElossMin[hABbin] <<endl;
804 // Finish filling the y-uncertainties of the Eloss scenarii
805 for (Int_t ibin=0; ibin<=nbins; ibin++){
806 Double_t ipt=0., value =0.;
807 gRAB_ElossHypothesis->GetPoint(ibin,ipt,value);
810 // Uncertainty on Raa due to the Eloss hypothesis
811 Double_t elossYhigh = TMath::Abs( ElossMax[ibin] - value );
812 Double_t elossYlow = TMath::Abs( value - ElossMin[ibin] );
813 gRAB_ElossHypothesis->SetPointEYhigh(ibin, elossYhigh );
814 gRAB_ElossHypothesis->SetPointEYlow(ibin, elossYlow );
815 gRAB_ElossHypothesis->SetPointEXhigh(ibin, 0.2);
816 gRAB_ElossHypothesis->SetPointEXlow(ibin, 0.2);
817 cout << " pt "<< ipt << " Raa "<< value <<" max "<< ElossMax[ibin] << " min " <<ElossMin[ibin] <<endl;
818 cout<<" Eloss syst +"<< elossYhigh <<" - "<< elossYlow <<endl;
819 // cout << " fc max "<< fcElossMax[ibin] << " fc min " <<fcElossMin[ibin] <<endl;
821 // Uncertainty on Raa due to the FD unc & Eloss hypothesis
822 Double_t fdElossEYhigh = TMath::Abs( FDElossMax[ibin] - value );
823 Double_t fdElossEYlow = TMath::Abs( value - FDElossMin[ibin] );
825 Double_t fdEYhigh = gRAB_FeedDownSystematics->GetErrorYhigh(ibin);
826 fdElossEYhigh = TMath::Sqrt( elossYhigh*elossYhigh + fdEYhigh*fdEYhigh );
827 Double_t fdEYlow = gRAB_FeedDownSystematics->GetErrorYlow(ibin);
828 fdElossEYlow = TMath::Sqrt( elossYlow*elossYlow + fdEYlow*fdEYlow );
830 gRAB_FeedDownSystematicsElossHypothesis->SetPointEYhigh(ibin, fdElossEYhigh );
831 gRAB_FeedDownSystematicsElossHypothesis->SetPointEYlow(ibin, fdElossEYlow );
832 gRAB_FeedDownSystematicsElossHypothesis->SetPointEXhigh(ibin, 0.25);
833 gRAB_FeedDownSystematicsElossHypothesis->SetPointEXlow(ibin, 0.25);
834 cout<<" FD & Eloss syst +"<< fdElossEYhigh <<" - "<< fdElossEYlow
835 <<" = + "<< fdElossEYhigh/value <<" - "<< fdElossEYlow/value <<" %" <<endl;
837 // All uncertainty on Raa (FD unc & Eloss + data)
838 Double_t systdatal = gRAB_DataSystematics->GetErrorYlow(ibin);
839 Double_t systdatah = gRAB_DataSystematics->GetErrorYhigh(ibin);
840 Double_t systgbhUnc = TMath::Sqrt( systdatah*systdatah + fdElossEYhigh*fdElossEYhigh );
841 Double_t systgblUnc = TMath::Sqrt( systdatal*systdatal + fdElossEYlow*fdElossEYlow );
842 gRAB_GlobalSystematics->SetPointEYhigh(ibin,systgbhUnc);
843 gRAB_GlobalSystematics->SetPointEYlow(ibin,systgblUnc);
844 cout<<" Data syst +"<< systdatah <<" - "<< systdatal <<" = + "<< systdatah/value <<" - " << systdatal/value << " % "<<endl;
845 cout<<" Global syst +"<< systgbhUnc <<" - "<< systgblUnc << " = + "<< systgbhUnc/value <<" - "<< systgblUnc/value << " %" <<endl;
850 gROOT->SetStyle("Plain");
851 gStyle->SetPalette(1);
852 gStyle->SetOptStat(0);
855 TCanvas *cRABvsRb = new TCanvas("RABvsRb","RAB vs Rb");
856 hRABvsRb->Draw("colz");
859 TCanvas *cRABvsRbvsPt = new TCanvas("cRABvsRbvsPt","RAB vs Rb vs pt");
860 hRABCharmVsRBeautyVsPt->Draw("lego3z");
861 cRABvsRbvsPt->Update();
864 TCanvas *cRABvsRbFDl = new TCanvas("RABvsRbFDl","RAB vs Rb (FD low)");
865 hRABvsRbFDlow->Draw("cont4z");
866 cRABvsRbFDl->Update();
867 TCanvas *cRABvsRbFDh = new TCanvas("RABvsRbFDh","RAB vs Rb (FD high)");
868 hRABvsRbFDhigh->Draw("cont4z");
869 cRABvsRbFDh->Update();
871 TCanvas * cSigmaABptEloss = new TCanvas("cSigmaABptEloss","SigmaAB vs pt, Eloss hypothesis");
872 TH1D *hSigmaABEloss00= new TH1D("hSigmaABEloss00","hSigmaABEloss00",nbins,limits);
873 TH1D *hSigmaABEloss05= new TH1D("hSigmaABEloss05","hSigmaABEloss05",nbins,limits);
874 TH1D *hSigmaABEloss10= new TH1D("hSigmaABEloss10","hSigmaABEloss10",nbins,limits);
875 TH1D *hSigmaABEloss15= new TH1D("hSigmaABEloss15","hSigmaABEloss15",nbins,limits);
876 TH1D *hSigmaABEloss20= new TH1D("hSigmaABEloss20","hSigmaABEloss20",nbins,limits);
877 for (Int_t i=0; i<=nSigmaAB->GetEntriesFast(); i++) {
878 nSigmaAB->GetEntry(i);
880 if( TMath::Abs(Rcb-0.015)<0.009 ) hSigmaABEloss00->Fill(pt,sigmaAB);
881 if( TMath::Abs(Rcb-0.5)<0.009 ) hSigmaABEloss05->Fill(pt,sigmaAB);
882 if( TMath::Abs(Rcb-1.0)<0.009 ) hSigmaABEloss10->Fill(pt,sigmaAB);
883 if( TMath::Abs(Rcb-1.5)<0.009 ) hSigmaABEloss15->Fill(pt,sigmaAB);
884 if( TMath::Abs(Rcb-2.0)<0.009 ) hSigmaABEloss20->Fill(pt,sigmaAB);
886 else if (fdMethod==kNb) {
887 if( TMath::Abs(Rb-0.015)<0.009 ) hSigmaABEloss00->Fill(pt,sigmaAB);
888 if( TMath::Abs(Rb-0.5)<0.009 ) hSigmaABEloss05->Fill(pt,sigmaAB);
889 if( TMath::Abs(Rb-1.0)<0.009 ) hSigmaABEloss10->Fill(pt,sigmaAB);
890 if( TMath::Abs(Rb-1.5)<0.009 ) hSigmaABEloss15->Fill(pt,sigmaAB);
891 if( TMath::Abs(Rb-2.0)<0.009 ) hSigmaABEloss20->Fill(pt,sigmaAB);
894 hSigmaABEloss00->SetLineColor(2);
895 hSigmaABEloss05->SetLineColor(3);
896 hSigmaABEloss10->SetLineColor(4);
897 hSigmaABEloss15->SetLineColor(kMagenta+1);
898 hSigmaABEloss20->SetLineColor(kGreen+2);
899 hSigmaABEloss00->SetMarkerStyle(22);
900 hSigmaABEloss05->SetMarkerStyle(26);
901 hSigmaABEloss10->SetMarkerStyle(20);
902 hSigmaABEloss15->SetMarkerStyle(25);
903 hSigmaABEloss20->SetMarkerStyle(21);
905 hSigmaABEloss05->Draw("ph");
906 hSigmaABEloss10->Draw("phsame");
907 hSigmaABEloss15->Draw("phsame");
908 hSigmaABEloss20->Draw("phsame");
911 hSigmaABEloss20->Draw("p");
912 hSigmaABEloss00->Draw("phsame");
913 hSigmaABEloss05->Draw("phsame");
914 hSigmaABEloss10->Draw("phsame");
915 hSigmaABEloss15->Draw("phsame");
916 hSigmaABEloss20->Draw("phsame");
918 TLegend *legrcb = new TLegend(0.8,0.8,0.95,0.9);
919 legrcb->SetFillColor(0);
920 legrcb->AddEntry(hSigmaABEloss00,"Rc/b=0.0","lp");
921 legrcb->AddEntry(hSigmaABEloss05,"Rc/b=0.5","lp");
922 legrcb->AddEntry(hSigmaABEloss10,"Rc/b=1.0","lp");
923 legrcb->AddEntry(hSigmaABEloss15,"Rc/b=1.5","lp");
924 legrcb->AddEntry(hSigmaABEloss20,"Rc/b=2.0","lp");
926 cSigmaABptEloss->Update();
929 TCanvas * cRABptEloss = new TCanvas("cRABptEloss","RAB vs pt, Eloss hypothesis");
930 hRABEloss00->SetLineColor(2);
931 hRABEloss05->SetLineColor(3);
932 hRABEloss10->SetLineColor(4);
933 hRABEloss15->SetLineColor(kMagenta+1);
934 hRABEloss20->SetLineColor(kGreen+2);
935 hRABEloss00->SetMarkerStyle(22);
936 hRABEloss05->SetMarkerStyle(26);
937 hRABEloss10->SetMarkerStyle(20);
938 hRABEloss15->SetMarkerStyle(25);
939 hRABEloss20->SetMarkerStyle(21);
941 hRABEloss05->Draw("ph");
942 hRABEloss10->Draw("phsame");
943 hRABEloss15->Draw("phsame");
944 hRABEloss20->Draw("phsame");
947 hRABEloss20->Draw("p");
948 hRABEloss00->Draw("phsame");
949 hRABEloss05->Draw("phsame");
950 hRABEloss10->Draw("phsame");
951 hRABEloss15->Draw("phsame");
952 hRABEloss20->Draw("phsame");
954 legrcb = new TLegend(0.8,0.8,0.95,0.9);
955 legrcb->SetFillColor(0);
957 legrcb->AddEntry(hRABEloss00,"Rc/b=0.0","lp");
958 legrcb->AddEntry(hRABEloss05,"Rc/b=0.5","lp");
959 legrcb->AddEntry(hRABEloss10,"Rc/b=1.0","lp");
960 legrcb->AddEntry(hRABEloss15,"Rc/b=0.5","lp");
961 legrcb->AddEntry(hRABEloss20,"Rc/b=2.0","lp");
963 else if (fdMethod==kNb) {
964 legrcb->AddEntry(hRABEloss00,"Rb=0.0","lp");
965 legrcb->AddEntry(hRABEloss05,"Rb=0.5","lp");
966 legrcb->AddEntry(hRABEloss10,"Rb=1.0","lp");
967 legrcb->AddEntry(hRABEloss15,"Rb=0.5","lp");
968 legrcb->AddEntry(hRABEloss20,"Rb=2.0","lp");
971 cRABptEloss->Update();
974 TCanvas * cRABpt = new TCanvas("cRABpt","RAB vs pt, no hypothesis");
975 hRABEloss10->Draw("");
978 TCanvas * cRABptFDUnc = new TCanvas("cRABptFDUnc","RAB vs pt, FD Uncertainties");
979 hRABvsRbFDlow_proj->Draw("");
980 hRABEloss10->Draw("phsame");
981 hRABvsRbFDhigh_proj->SetLineColor(kMagenta+1);
982 hRABvsRbFDhigh_proj->Draw("same");
983 hRABvsRbFDlow_proj->SetLineColor(kGreen+2);
984 hRABvsRbFDlow_proj->Draw("same");
985 legrcb = new TLegend(0.8,0.8,0.95,0.9);
986 legrcb->SetFillColor(0);
987 legrcb->AddEntry(hRABEloss10,"FD Central","lp");
988 legrcb->AddEntry(hRABvsRbFDhigh_proj,"FD Upper unc.","l");
989 legrcb->AddEntry(hRABvsRbFDlow_proj,"FD Lower unc.","l");
991 cRABptFDUnc->Update();
993 TCanvas *RaaPlot = new TCanvas("RaaPlot","RAB vs pt, plot all");
994 RaaPlot->SetTopMargin(0.085);
995 RaaPlot->SetBottomMargin(0.1);
998 TH2D *hRaaCanvas = new TH2D("hRaaCanvas"," R_{AB}(c) vs p_{T} (no Eloss hypothesis); p_{t} [GeV/c] ; R_{AA} prompt D",40,0.,40.,100,0.,3.0);
999 hRaaCanvas->GetXaxis()->SetTitleSize(0.05);
1000 hRaaCanvas->GetXaxis()->SetTitleOffset(0.9);
1001 hRaaCanvas->GetYaxis()->SetTitleSize(0.05);
1002 hRaaCanvas->GetYaxis()->SetTitleOffset(0.9);
1004 gRAB_Norm->SetFillStyle(1001);
1005 gRAB_Norm->SetFillColor(kGray+2);
1006 gRAB_Norm->Draw("2");
1007 TLine *line = new TLine(0.0172415,1.0,40.,1.0);
1008 line->SetLineStyle(2);
1010 hRABvsPt->SetMarkerColor(kBlue);
1011 hRABvsPt->SetMarkerColor(kBlue);
1012 hRABvsPt->SetMarkerStyle(21);
1013 hRABvsPt->SetMarkerSize(1.1);
1014 hRABvsPt->SetLineWidth(2);
1015 hRABvsPt->Draw("psame");
1016 gRAB_DataSystematics->SetLineColor(kBlue);
1017 gRAB_DataSystematics->SetLineWidth(3);
1018 gRAB_DataSystematics->SetLineWidth(2);
1019 gRAB_DataSystematics->SetFillColor(kRed);
1020 gRAB_DataSystematics->SetFillStyle(0);
1021 gRAB_DataSystematics->Draw("2");
1022 gRAB_FeedDownSystematics->SetFillColor(kViolet+1);
1023 gRAB_FeedDownSystematics->SetFillStyle(1001);
1024 gRAB_FeedDownSystematics->Draw("2");
1025 gRAB_ElossHypothesis->SetLineColor(kMagenta-7);
1026 gRAB_ElossHypothesis->SetFillColor(kMagenta-7);
1027 gRAB_ElossHypothesis->SetFillStyle(1001);
1028 gRAB_ElossHypothesis->Draw("2");
1029 hRABvsPt->Draw("psame");
1030 gRAB_DataSystematics->Draw("2");
1031 legrcb = new TLegend(0.5517241,0.6504237,0.8520115,0.8728814,NULL,"brNDC");
1032 legrcb->SetBorderSize(0);
1033 legrcb->SetTextSize(0.03389831);
1034 legrcb->SetLineColor(1);
1035 legrcb->SetLineStyle(1);
1036 legrcb->SetLineWidth(1);
1037 legrcb->SetFillColor(0);
1038 legrcb->SetFillStyle(1001);
1039 if(cc==k020) legrcb->AddEntry(hRABvsPt,"R_{AA} 0-20% CC","pe");
1040 else if(cc==k4080) legrcb->AddEntry(hRABvsPt,"R_{AA} 40-80% CC","pe");
1041 else legrcb->AddEntry(hRABvsPt,"R_{AA} and stat. unc.","pe");
1042 legrcb->AddEntry(gRAB_DataSystematics,"Syst. from data","f");
1043 legrcb->AddEntry(gRAB_ElossHypothesis,"Syst. from R_{AA}(B)","f");
1044 legrcb->AddEntry(gRAB_FeedDownSystematics,"Syst. from B feed-down","f");
1047 TString system = "Pb-Pb #sqrt{s_{NN}}=2.76 TeV";
1048 if(cc==kpPb0100) system = "p-Pb #sqrt{s_{NN}}=5.023 TeV";
1049 if(decay==1) tc =new TLatex(0.18,0.82,Form("D^{0}, %s ",system.Data()));
1050 else if(decay==2) tc =new TLatex(0.18,0.82,Form("D^{+}, %s ",system.Data()));
1051 else if(decay==3) tc =new TLatex(0.18,0.82,Form("D^{*+}, %s ",system.Data()));
1052 else if(decay==4) tc =new TLatex(0.18,0.82,Form("D_{s}^{+}, %s ",system.Data()));
1053 else tc =new TLatex(0.18,0.82,Form("any (?) D meson, %s ",system.Data()));
1055 tc->SetTextSize(0.038);
1056 tc->SetTextFont(42);
1061 TCanvas *RaaPlotFDEloss = new TCanvas("RaaPlotFDEloss","RAB vs pt, plot FD & ElossUnc");
1062 RaaPlotFDEloss->SetTopMargin(0.085);
1063 RaaPlotFDEloss->SetBottomMargin(0.1);
1066 hRABvsPt->Draw("psame");
1067 gRAB_FeedDownSystematics->SetFillColor(kViolet+1);
1068 gRAB_FeedDownSystematics->SetFillStyle(1001);
1069 gRAB_FeedDownSystematics->Draw("2");
1070 gRAB_ElossHypothesis->SetLineColor(kMagenta-7);
1071 gRAB_ElossHypothesis->SetFillColor(kMagenta-7);
1072 gRAB_ElossHypothesis->SetFillStyle(1001);
1073 gRAB_ElossHypothesis->Draw("2");
1074 gRAB_FeedDownSystematicsElossHypothesis->SetLineColor(kBlack);
1075 gRAB_FeedDownSystematicsElossHypothesis->SetFillStyle(0);
1076 gRAB_FeedDownSystematicsElossHypothesis->SetFillColor(kViolet+1);
1077 gRAB_FeedDownSystematicsElossHypothesis->Draw("2");
1078 hRABvsPt->Draw("psame");
1079 legrcb = new TLegend(0.6,0.6,0.9,0.9);
1080 legrcb->SetBorderSize(0);
1081 legrcb->SetTextSize(0.03389831);
1082 legrcb->SetLineColor(1);
1083 legrcb->SetLineStyle(1);
1084 legrcb->SetLineWidth(1);
1085 legrcb->SetFillColor(0);
1086 legrcb->SetFillStyle(1001);
1087 legrcb->AddEntry(hRABvsPt,"R_{PbPb} and stat. unc.","pe");
1088 legrcb->AddEntry(gRAB_ElossHypothesis,"Energy loss syst.","f");
1089 legrcb->AddEntry(gRAB_FeedDownSystematics,"Feed down syst.","f");
1090 legrcb->AddEntry(gRAB_FeedDownSystematicsElossHypothesis,"Feed down & Eloss syst.","f");
1092 RaaPlotFDEloss->Update();
1095 TCanvas *RaaPlotGlob = new TCanvas("RaaPlotGlob","RAB vs pt, plot Global unc");
1096 RaaPlotGlob->SetTopMargin(0.085);
1097 RaaPlotGlob->SetBottomMargin(0.1);
1098 RaaPlotGlob->SetTickx();
1099 RaaPlotGlob->SetTicky();
1102 hRABvsPt->Draw("psame");
1103 gRAB_DataSystematics->Draw("2");
1104 gRAB_FeedDownSystematicsElossHypothesis->Draw("2");
1105 gRAB_GlobalSystematics->SetLineColor(kRed);
1106 gRAB_GlobalSystematics->SetLineWidth(2);
1107 gRAB_GlobalSystematics->SetFillColor(kRed);
1108 gRAB_GlobalSystematics->SetFillStyle(3002);
1109 gRAB_GlobalSystematics->Draw("2");
1110 hRABvsPt->Draw("psame");
1111 legrcb = new TLegend(0.6,0.6,0.9,0.9);
1112 legrcb->SetBorderSize(0);
1113 legrcb->SetTextSize(0.03389831);
1114 legrcb->SetLineColor(1);
1115 legrcb->SetLineStyle(1);
1116 legrcb->SetLineWidth(1);
1117 legrcb->SetFillColor(0);
1118 legrcb->SetFillStyle(1001);
1119 legrcb->AddEntry(hRABvsPt,"R_{PbPb} and stat. unc.","pe");
1120 legrcb->AddEntry(gRAB_DataSystematics,"Data syst.","f");
1121 legrcb->AddEntry(gRAB_FeedDownSystematicsElossHypothesis,"Feed down & Eloss syst.","f");
1122 legrcb->AddEntry(gRAB_GlobalSystematics,"Global syst.","f");
1124 RaaPlotGlob->Update();
1128 TCanvas *RaaPlotSimple = new TCanvas("RaaPlotSimple","RAB vs pt, plot Simple unc");
1129 RaaPlotSimple->SetTopMargin(0.085);
1130 RaaPlotSimple->SetBottomMargin(0.1);
1131 RaaPlotSimple->SetTickx();
1132 RaaPlotSimple->SetTicky();
1135 hRABvsPt->Draw("psame");
1136 gRAB_GlobalSystematics->SetLineColor(kBlue);
1137 gRAB_GlobalSystematics->SetLineWidth(2);
1138 gRAB_GlobalSystematics->SetFillStyle(0);
1139 gRAB_GlobalSystematics->Draw("2");
1140 gRAB_Norm->Draw("2");
1141 hRABvsPt->Draw("psame");
1142 legrcb = new TLegend(0.5991379,0.6949153,0.8534483,0.8559322,NULL,"brNDC");
1143 legrcb->SetBorderSize(0);
1144 legrcb->SetTextSize(0.03389831);
1145 legrcb->SetLineColor(1);
1146 legrcb->SetLineStyle(1);
1147 legrcb->SetLineWidth(1);
1148 legrcb->SetFillColor(0);
1149 legrcb->SetFillStyle(1001);
1150 if(cc==k020) legrcb->AddEntry(hRABvsPt,"R_{AA} 0-20% CC","pe");
1151 else if(cc==k4080) legrcb->AddEntry(hRABvsPt,"R_{AA} 40-80% CC","pe");
1152 else legrcb->AddEntry(hRABvsPt,"R_{AA} and stat. unc.","pe");
1153 legrcb->AddEntry(gRAB_GlobalSystematics,"Systematics","f");
1156 RaaPlotSimple->Update();
1159 TCanvas *c = new TCanvas("c","");
1160 systematicsAB->DrawErrors();
1163 TCanvas *cStatUnc = new TCanvas("cStatUnc","stat unc");
1164 cStatUnc->Divide(2,2);
1166 fhStatUncEffcSigmaAB_Raa->Draw("e");
1168 fhStatUncEffbSigmaAB_Raa->Draw("e");
1170 fhStatUncEffcFDAB_Raa->Draw("e");
1172 fhStatUncEffbFDAB_Raa->Draw("e");
1176 // Write the information to a file
1178 TFile * out = new TFile(outfile,"recreate");
1183 hRABCharmVsRBeautyVsPt->Write();
1184 for(Int_t j=0; j<=nbins; j++) hRCharmVsRBeauty[j]->Write();
1185 // for(Int_t j=0; j<=nbins; j++) hRCharmVsElossHypo[j]->Write();
1187 hRABvsPt_DataSystematics->Write();
1188 gRAB_ElossHypothesis->Write();
1189 gRAB_FeedDownSystematics->Write();
1190 gRAB_fcFeedDownOnly->Write();
1191 gRAB_DataSystematics->Write();
1192 gRAB_DataSystematicsPP->Write();
1193 gSigmaPPSystTheory->Write();
1194 gRAB_DataSystematicsAB->Write();
1196 gRAB_FeedDownSystematicsElossHypothesis->Write();
1197 gRAB_GlobalSystematics->Write();
1198 if(isScaledAndExtrapRef) hCombinedReferenceFlag->Write();
1204 //____________________________________________________________
1205 Bool_t PbPbDataSyst(AliHFSystErr *syst, Double_t pt, Int_t cc, Double_t &dataSystUp, Double_t &dataSystDown)
1208 Double_t err=0., errUp=1., errDown=1.;
1212 err = syst->GetTotalSystErr(pt)*syst->GetTotalSystErr(pt);
1216 // Apply an asymetric PID uncertainty for 2010 PbPb data only
1217 if( syst->GetRunNumber()==10 && syst->GetCollisionType()==1 ) {
1218 if( cc==k07half || cc==k020 || cc==k010 || cc==k1020 || cc==k2040 ) {
1219 if(pt<6) pidunc = 0.15;
1221 errUp = err + pidunc*pidunc - syst->GetPIDEffErr(pt)*syst->GetPIDEffErr(pt);
1224 else if ( cc==k3050 || cc==k4080 || cc==k4060 || cc==k6080 ){
1225 if(pt<3.1) pidunc = 0.10;
1227 errUp = err + pidunc*pidunc - syst->GetPIDEffErr(pt)*syst->GetPIDEffErr(pt);
1231 else { isOk = true; }
1233 dataSystUp = TMath::Sqrt(errUp);
1234 dataSystDown = TMath::Sqrt(errDown);