1 #if !defined(__CINT__) || defined(__MAKECINT__)
8 #include "TGraphAsymmErrors.h"
13 #include "AliHFSystErr.h"
14 #include "AliHFPtSpectrum.h"
20 // Macro to use the AliHFPtSpectrum class
21 // to compute the feed-down corrections for heavy-flavor
23 // Z.Conesa, September 2010 (zconesa@in2p3.fr)
29 // Macro execution parameters:
30 // 0) filename with the theoretical predictions (direct & feed-down)
31 // 1) acceptance and reconstruction efficiencies file name (direct & feed-down)
32 // 2) reconstructed spectra file name
33 // 3) output file name
34 // 4) Set the feed-down calculation option flag: knone=none, kfc=fc only, kNb=Nb only
35 // 5-6) Set the luminosity: the number of events analyzed, and the cross-section of the sample [pb]
36 // 7) Set whether the yield is for particle + anti-particles or only one of the 'charges'
37 // 8) Set the centrality class
38 // 9) Flag to decide if there is need to evaluate the dependence on the energy loss
41 enum centrality{ kpp7, kpp276, k07half, kpPb0100, k010, k1020, k020, k2040, k2030, k3040, k4050, k3050, k5060, k4060, k6080, k4080, k5080, k80100 };
42 enum BFDSubtrMethod { knone, kfc, kNb };
43 enum RaavsEP {kPhiIntegrated, kInPlane, kOutOfPlane};
44 enum rapidity{ kdefault, k08to04, k07to04, k04to01, k01to01, k01to04, k04to07, k04to08 };
46 void HFPtSpectrum ( const char *mcfilename="FeedDownCorrectionMC.root",
47 const char *efffilename="Efficiencies.root",
48 const char *recofilename="Reconstructed.root", const char *recohistoname="hRawSpectrumD0",
49 const char *outfilename="HFPtSpectrum.root",
50 Int_t fdMethod=kNb, Double_t nevents=1.0, Double_t sigma=1.0, // sigma[pb]
51 Bool_t isParticlePlusAntiParticleYield=true, Int_t cc=kpp7, Bool_t PbPbEloss=false,
52 Int_t isRaavsEP=kPhiIntegrated,const char *epResolfile="",
53 Int_t rapiditySlice=kdefault) {
56 gROOT->Macro("$ALICE_ROOT/PWGHF/vertexingHF/macros/LoadLibraries.C");
58 // Set if calculation considers asymmetric uncertainties or not
61 // Set the meson and decay
62 // (only D0 -> K pi, D+--> K pi pi & D* --> D0 pi & D+s -->KKpi implemented here)
63 Bool_t isD0Kpi = true;
64 Bool_t isDplusKpipi = false;
65 Bool_t isDstarD0pi = false;
66 Bool_t isDsKKpi = false;
67 Bool_t isLctopKpi = false;
68 if (isD0Kpi && isDplusKpipi && isDstarD0pi && isDsKKpi) {
69 cout << "Sorry, can not deal with more than one correction at the same time"<<endl;
74 if (fdMethod==kfc) option=1;
75 else if (fdMethod==kNb) option=2;
76 else if (fdMethod==knone) { option=0; asym=false; }
80 cout<< "Bad calculation option, should be <=2"<<endl;
86 // Defining the Tab values for the given centrality class
87 // https://twiki.cern.ch/twiki/bin/viewauth/ALICE/CentStudies
89 Double_t tab = 1., tabUnc = 0.;
90 if ( cc == k07half ) {
91 tab = 24.81; tabUnc = 0.8037;
92 } else if ( cc == k010 ) {
93 tab = 23.48; tabUnc = 0.97;
94 } else if ( cc == k1020 ) {
95 tab = 14.4318; tabUnc = 0.5733;
96 } else if ( cc == k020 ) {
97 tab = 18.93; tabUnc = 0.74;
98 } else if ( cc == k2040 ) {
99 tab = 6.86; tabUnc = 0.28;
100 } else if ( cc == k2030 ) {
101 tab = 8.73769; tabUnc = 0.370219;
102 } else if ( cc == k3040 ) {
103 tab = 5.02755; tabUnc = 0.22099;
104 } else if ( cc == k4050 ) {
105 tab = 2.68327; tabUnc = 0.137073;
106 } else if ( cc == k3050 ) {
107 tab = 3.87011; tabUnc = 0.183847;
108 } else if ( cc == k4060 ) {
109 tab = 2.00; tabUnc= 0.11;
110 } else if ( cc == k4080 ) {
111 tab = 1.20451; tabUnc = 0.071843;
112 } else if ( cc == k5060 ) {
113 tab = 1.32884; tabUnc = 0.0929536;
114 } else if ( cc == k5080 ) {
115 tab = 0.719; tabUnc = 0.054;
116 } else if ( cc == k6080 ) {
117 tab = 0.419; tabUnc = 0.033;
118 } else if ( cc == k80100 ){
119 tab = 0.0690; tabUnc = 0.0062;
122 // pPb Glauber (A. Toia)
123 // https://twiki.cern.ch/twiki/bin/viewauth/ALICE/PACentStudies#Glauber_Calculations_with_sigma
124 else if( cc == kpPb0100 ){
125 tab = 0.098334; tabUnc = 0.0070679;
127 tab *= 1e-9; // to pass from mb^{-1} to pb^{-1}
133 // Get the histograms from the files
135 TH1D *hDirectMCpt=0; // Input MC c-->D spectra
136 TH1D *hFeedDownMCpt=0; // Input MC b-->D spectra
137 TH1D *hDirectMCptMax=0; // Input MC maximum c-->D spectra
138 TH1D *hDirectMCptMin=0; // Input MC minimum c-->D spectra
139 TH1D *hFeedDownMCptMax=0; // Input MC maximum b-->D spectra
140 TH1D *hFeedDownMCptMin=0; // Input MC minimum b-->D spectra
141 // TGraphAsymmErrors *gPrediction=0; // Input MC c-->D spectra
142 TH1D *hDirectEffpt=0; // c-->D Acceptance and efficiency correction
143 TH1D *hFeedDownEffpt=0; // b-->D Acceptance and efficiency correction
144 TH1D *hRECpt=0; // all reconstructed D
147 // Define/Get the input histograms
150 TFile * mcfile = new TFile(mcfilename,"read");
153 hDirectMCpt = (TH1D*)mcfile->Get("hD0Kpipred_central");
154 hFeedDownMCpt = (TH1D*)mcfile->Get("hD0KpifromBpred_central_corr");
155 hDirectMCptMax = (TH1D*)mcfile->Get("hD0Kpipred_max");
156 hDirectMCptMin = (TH1D*)mcfile->Get("hD0Kpipred_min");
157 hFeedDownMCptMax = (TH1D*)mcfile->Get("hD0KpifromBpred_max_corr");
158 hFeedDownMCptMin = (TH1D*)mcfile->Get("hD0KpifromBpred_min_corr");
159 // gPrediction = (TGraphAsymmErrors*)mcfile->Get("D0Kpiprediction");
161 else if (isDplusKpipi){
163 hDirectMCpt = (TH1D*)mcfile->Get("hDpluskpipipred_central");
164 hFeedDownMCpt = (TH1D*)mcfile->Get("hDpluskpipifromBpred_central_corr");
165 hDirectMCptMax = (TH1D*)mcfile->Get("hDpluskpipipred_max");
166 hDirectMCptMin = (TH1D*)mcfile->Get("hDpluskpipipred_min");
167 hFeedDownMCptMax = (TH1D*)mcfile->Get("hDpluskpipifromBpred_max_corr");
168 hFeedDownMCptMin = (TH1D*)mcfile->Get("hDpluskpipifromBpred_min_corr");
169 // gPrediction = (TGraphAsymmErrors*)mcfile->Get("Dpluskpipiprediction");
171 else if(isDstarD0pi){
173 hDirectMCpt = (TH1D*)mcfile->Get("hDstarD0pipred_central");
174 hFeedDownMCpt = (TH1D*)mcfile->Get("hDstarD0pifromBpred_central_corr");
175 hDirectMCptMax = (TH1D*)mcfile->Get("hDstarD0pipred_max");
176 hDirectMCptMin = (TH1D*)mcfile->Get("hDstarD0pipred_min");
177 hFeedDownMCptMax = (TH1D*)mcfile->Get("hDstarD0pifromBpred_max_corr");
178 hFeedDownMCptMin = (TH1D*)mcfile->Get("hDstarD0pifromBpred_min_corr");
179 // gPrediction = (TGraphAsymmErrors*)mcfile->Get("DstarD0piprediction");
183 hDirectMCpt = (TH1D*)mcfile->Get("hDsPhipitoKkpipred_central");
184 hFeedDownMCpt = (TH1D*)mcfile->Get("hDsPhipitoKkpifromBpred_central_corr");
185 hDirectMCptMax = (TH1D*)mcfile->Get("hDsPhipitoKkpipred_max");
186 hDirectMCptMin = (TH1D*)mcfile->Get("hDsPhipitoKkpipred_min");
187 hFeedDownMCptMax = (TH1D*)mcfile->Get("hDsPhipitoKkpifromBpred_max_corr");
188 hFeedDownMCptMin = (TH1D*)mcfile->Get("hDsPhipitoKkpifromBpred_min_corr");
190 else if (isLctopKpi){
192 hDirectMCpt = (TH1D*)mcfile->Get("hLcpkpipred_central");
193 hFeedDownMCpt = (TH1D*)mcfile->Get("hLcpkpifromBpred_central_corr");
194 hDirectMCptMax = (TH1D*)mcfile->Get("hLcpkpipred_max");
195 hDirectMCptMin = (TH1D*)mcfile->Get("hLcpkpipred_min");
196 hFeedDownMCptMax = (TH1D*)mcfile->Get("hLcpkpifromBpred_max_corr");
197 hFeedDownMCptMin = (TH1D*)mcfile->Get("hLcpkpifromBpred_min_corr");
200 hDirectMCpt->SetNameTitle("hDirectMCpt","direct MC spectra");
201 hFeedDownMCpt->SetNameTitle("hFeedDownMCpt","feed-down MC spectra");
202 hDirectMCptMax->SetNameTitle("hDirectMCptMax","max direct MC spectra");
203 hDirectMCptMin->SetNameTitle("hDirectMCptMin","min direct MC spectra");
204 hFeedDownMCptMax->SetNameTitle("hFeedDownMCptMax","max feed-down MC spectra");
205 hFeedDownMCptMin->SetNameTitle("hFeedDownMCptMin","min feed-down MC spectra");
207 // Scale FONLL inputs if we do the analysis in y-slices
209 if(rapiditySlice!=kdefault){
210 Double_t scaleFONLL = 1.0;
211 switch(rapiditySlice) {
212 case k08to04: scaleFONLL = (0.093+0.280)/1.0; break;
213 case k07to04: scaleFONLL = 0.280/1.0; break;
214 case k04to01: scaleFONLL = 0.284/1.0; break;
215 case k01to01: scaleFONLL = 0.191/1.0; break;
216 case k01to04: scaleFONLL = 0.288/1.0; break;
217 case k04to07: scaleFONLL = 0.288/1.0; break;
218 case k04to08: scaleFONLL = (0.288+0.096)/1.0; break;
220 hDirectMCpt->Scale(scaleFONLL);
221 hDirectMCptMax->Scale(scaleFONLL);
222 hDirectMCptMin->Scale(scaleFONLL);
223 switch(rapiditySlice) {
224 case k08to04: scaleFONLL = (0.089+0.274)/1.0; break;
225 case k07to04: scaleFONLL = 0.274/1.0; break;
226 case k04to01: scaleFONLL = 0.283/1.0; break;
227 case k01to01: scaleFONLL = 0.192/1.0; break;
228 case k01to04: scaleFONLL = 0.290/1.0; break;
229 case k04to07: scaleFONLL = 0.291/1.0; break;
230 case k04to08: scaleFONLL = (0.291+0.097)/1.0; break;
232 hFeedDownMCpt->Scale(scaleFONLL);
233 hFeedDownMCptMax->Scale(scaleFONLL);
234 hFeedDownMCptMin->Scale(scaleFONLL);
239 TFile * efffile = new TFile(efffilename,"read");
240 hDirectEffpt = (TH1D*)efffile->Get("hEffD");
241 hDirectEffpt->SetNameTitle("hDirectEffpt","direct acc x eff");
242 hFeedDownEffpt = (TH1D*)efffile->Get("hEffB");
243 hFeedDownEffpt->SetNameTitle("hFeedDownEffpt","feed-down acc x eff");
246 TFile * recofile = new TFile(recofilename,"read");
247 hRECpt = (TH1D*)recofile->Get(recohistoname);
248 hRECpt->SetNameTitle("hRECpt","Reconstructed spectra");
251 // Read the file of the EP resolution correction
253 TH1D *hEPresolCorr=0;
255 EPf = new TFile(epResolfile,"read");
256 if(isRaavsEP==kInPlane) hEPresolCorr = (TH1D*)EPf->Get("hCorrEPresol_InPlane");
257 else if(isRaavsEP==kOutOfPlane) hEPresolCorr = (TH1D*)EPf->Get("hCorrEPresol_OutOfPlane");
258 for(Int_t i=1; i<=hRECpt->GetNbinsX(); i++) {
259 Double_t value = hRECpt->GetBinContent(i);
260 Double_t error = hRECpt->GetBinError(i);
261 Double_t pt = hRECpt->GetBinCenter(i);
262 Int_t epbin = hEPresolCorr->FindBin( pt );
263 Double_t epcorr = hEPresolCorr->GetBinContent( epbin );
264 value = value*epcorr;
265 error = error*epcorr;
266 hRECpt->SetBinContent(i,value);
267 hRECpt->SetBinError(i,error);
272 // Define the output histograms
274 TFile *out = new TFile(outfilename,"recreate");
279 TH1D *histoYieldCorr=0;
280 TH1D *histoYieldCorrMax=0;
281 TH1D *histoYieldCorrMin=0;
282 TH1D *histoSigmaCorr=0;
283 TH1D *histoSigmaCorrMax=0;
284 TH1D *histoSigmaCorrMin=0;
287 TH1D *histofcRcb_px=0;
288 TH2D *histoYieldCorrRcb=0;
289 TH2D *histoSigmaCorrRcb=0;
291 TGraphAsymmErrors * gYieldCorr = 0;
292 TGraphAsymmErrors * gSigmaCorr = 0;
293 TGraphAsymmErrors * gFcExtreme = 0;
294 TGraphAsymmErrors * gFcConservative = 0;
295 TGraphAsymmErrors * gYieldCorrExtreme = 0;
296 TGraphAsymmErrors * gSigmaCorrExtreme = 0;
297 TGraphAsymmErrors * gYieldCorrConservative = 0;
298 TGraphAsymmErrors * gSigmaCorrConservative = 0;
300 TNtuple * nSigma = 0;
304 // Main functionalities for the calculation
307 // Define and set the basic option flags
308 AliHFPtSpectrum * spectra = new AliHFPtSpectrum("AliHFPtSpectrum","AliHFPtSpectrum",option);
309 spectra->SetFeedDownCalculationOption(option);
310 spectra->SetComputeAsymmetricUncertainties(asym);
311 // Set flag on whether to additional PbPb Eloss hypothesis have to be computed
312 spectra->SetComputeElossHypothesis(PbPbEloss);
314 // Feed the input histograms
315 // reconstructed spectra
316 cout << " Setting the reconstructed spectrum,";
317 spectra->SetReconstructedSpectrum(hRECpt);
318 // acceptance and efficiency corrections
319 cout << " the efficiency,";
320 spectra->SetAccEffCorrection(hDirectEffpt,hFeedDownEffpt);
321 // spectra->SetfIsStatUncEff(false);
322 // option specific histos (theory)
323 cout << " the theoretical spectra";
325 spectra->SetMCptSpectra(hDirectMCpt,hFeedDownMCpt);
326 if(asym) spectra->SetMCptDistributionsBounds(hDirectMCptMax,hDirectMCptMin,hFeedDownMCptMax,hFeedDownMCptMin);
329 spectra->SetFeedDownMCptSpectra(hFeedDownMCpt);
330 if(asym) spectra->SetFeedDownMCptDistributionsBounds(hFeedDownMCptMax,hFeedDownMCptMin);
333 cout << " and the normalization" <<endl;
334 // Set normalization factors (uncertainties set to 0. as example)
335 spectra->SetNormalization(nevents,sigma);
336 Double_t lumi = nevents / sigma ;
337 Double_t lumiUnc = 0.04*lumi; // 10% uncertainty on the luminosity
338 spectra->SetLuminosity(lumi,lumiUnc);
339 Double_t effTrig = 1.0;
340 spectra->SetTriggerEfficiency(effTrig,0.);
341 if(isRaavsEP>0.) spectra->SetIsEventPlaneAnalysis(kTRUE);
343 // Set the global uncertainties on the efficiencies (in percent)
344 Double_t globalEffUnc = 0.15;
345 Double_t globalBCEffRatioUnc = 0.15;
346 spectra->SetAccEffPercentageUncertainty(globalEffUnc,globalBCEffRatioUnc);
348 // Set if the yield is for particle+anti-particle or only one type
349 spectra->SetIsParticlePlusAntiParticleYield(isParticlePlusAntiParticleYield);
351 // Set the Tab parameter and uncertainties
352 if ( (cc != kpp7) && (cc != kpp276) ) {
353 spectra->SetTabParameter(tab,tabUnc);
356 // Do the calculations
357 cout << " Doing the calculation... "<< endl;
358 Double_t deltaY = 1.0;
359 Double_t branchingRatioC = 1.0;
360 Double_t branchingRatioBintoFinalDecay = 1.0; // this is relative to the input theoretical prediction
361 spectra->ComputeHFPtSpectrum(deltaY,branchingRatioC,branchingRatioBintoFinalDecay);
362 cout << " ended the calculation, getting the histograms back " << endl;
364 // Set the systematics externally
365 Bool_t combineFeedDown = true;
366 AliHFSystErr *systematics = new AliHFSystErr();
368 systematics->SetIsLowEnergy(true);
370 else if ( cc == kpPb0100 ){
371 systematics->SetCollisionType(2);
374 else if( cc!=kpp7 ) {
375 systematics->SetCollisionType(1);
376 if ( cc == k07half ) systematics->SetCentrality("07half");
377 else if ( cc == k010 ) systematics->SetCentrality("010");
378 else if ( cc == k1020 ) systematics->SetCentrality("1020");
379 else if ( cc == k020 ) systematics->SetCentrality("020");
380 else if ( cc == k2040 || cc == k2030 || cc == k3040 ) {
381 systematics->SetCentrality("2040");
382 systematics->SetIsPbPb2010EnergyScan(true);
384 else if ( cc == k3050 ) {
385 if (isRaavsEP == kPhiIntegrated) systematics->SetCentrality("4080");
386 else if (isRaavsEP == kInPlane) systematics->SetCentrality("3050InPlane");
387 else if (isRaavsEP == kOutOfPlane) systematics->SetCentrality("3050OutOfPlane");
389 else if ( cc == k4060 || cc == k4050 || cc == k5060 ) systematics->SetCentrality("4060");
390 else if ( cc == k6080 ) systematics->SetCentrality("6080");
391 else if ( cc == k4080 ) systematics->SetCentrality("4080");
393 cout << " Systematics not yet implemented " << endl;
396 } else { systematics->SetCollisionType(0); }
398 systematics->Init(decay);
399 spectra->ComputeSystUncertainties(systematics,combineFeedDown);
402 // Get the output histograms
404 // the corrected yield and cross-section
405 histoYieldCorr = (TH1D*)spectra->GetHistoFeedDownCorrectedSpectrum();
406 histoSigmaCorr = (TH1D*)spectra->GetHistoCrossSectionFromYieldSpectrum();
407 histoYieldCorrMax = (TH1D*)spectra->GetHistoUpperLimitFeedDownCorrectedSpectrum();
408 histoYieldCorrMin = (TH1D*)spectra->GetHistoLowerLimitFeedDownCorrectedSpectrum();
409 histoSigmaCorrMax = (TH1D*)spectra->GetHistoUpperLimitCrossSectionFromYieldSpectrum();
410 histoSigmaCorrMin = (TH1D*)spectra->GetHistoLowerLimitCrossSectionFromYieldSpectrum();
411 histoYieldCorr->SetNameTitle("histoYieldCorr","corrected yield");
412 histoYieldCorrMax->SetNameTitle("histoYieldCorrMax","max corrected yield");
413 histoYieldCorrMin->SetNameTitle("histoYieldCorrMin","min corrected yield");
414 histoSigmaCorr->SetNameTitle("histoSigmaCorr","corrected invariant cross-section");
415 histoSigmaCorrMax->SetNameTitle("histoSigmaCorrMax","max corrected invariant cross-section");
416 histoSigmaCorrMin->SetNameTitle("histoSigmaCorrMin","min corrected invariant cross-section");
418 if(!hDirectEffpt) hDirectEffpt = (TH1D*)spectra->GetDirectAccEffCorrection();
419 if(!hFeedDownEffpt) hFeedDownEffpt = (TH1D*)spectra->GetFeedDownAccEffCorrection();
420 // Get the PbPb Eloss hypothesis histograms
422 histofcRcb = spectra->GetHistoFeedDownCorrectionFcVsEloss();
423 histoYieldCorrRcb = spectra->GetHistoFeedDownCorrectedSpectrumVsEloss();
424 histoSigmaCorrRcb = spectra->GetHistoCrossSectionFromYieldSpectrumVsEloss();
425 histofcRcb->SetName("histofcRcb");
426 histoYieldCorrRcb->SetName("histoYieldCorrRcb");
427 histoSigmaCorrRcb->SetName("histoSigmaCorrRcb");
430 // Get & Rename the TGraphs
431 gSigmaCorr = spectra->GetCrossSectionFromYieldSpectrum();
432 gYieldCorr = spectra->GetFeedDownCorrectedSpectrum();
434 gSigmaCorrExtreme = spectra->GetCrossSectionFromYieldSpectrumExtreme();
435 gYieldCorrExtreme = spectra->GetFeedDownCorrectedSpectrumExtreme();
436 gSigmaCorrConservative = spectra->GetCrossSectionFromYieldSpectrumConservative();
437 gYieldCorrConservative = spectra->GetFeedDownCorrectedSpectrumConservative();
440 // Get & Rename the TGraphs
442 gYieldCorr->SetNameTitle("gYieldCorr","gYieldCorr (uncorr)");
443 gSigmaCorr->SetNameTitle("gSigmaCorr","gSigmaCorr (uncorr)");
447 histofc = (TH1D*)spectra->GetHistoFeedDownCorrectionFc();
448 histofcMax = (TH1D*)spectra->GetHistoUpperLimitFeedDownCorrectionFc();
449 histofcMin = (TH1D*)spectra->GetHistoLowerLimitFeedDownCorrectionFc();
450 histofc->SetNameTitle("histofc","fc correction factor");
451 histofcMax->SetNameTitle("histofcMax","max fc correction factor");
452 histofcMin->SetNameTitle("histofcMin","min fc correction factor");
454 gYieldCorr->SetNameTitle("gYieldCorr","gYieldCorr (by fc)");
455 gSigmaCorr->SetNameTitle("gSigmaCorr","gSigmaCorr (by fc)");
456 gFcExtreme = spectra->GetFeedDownCorrectionFcExtreme();
457 gFcExtreme->SetNameTitle("gFcExtreme","gFcExtreme");
458 gYieldCorrExtreme->SetNameTitle("gYieldCorrExtreme","Extreme gYieldCorr (by fc)");
459 gSigmaCorrExtreme->SetNameTitle("gSigmaCorrExtreme","Extreme gSigmaCorr (by fc)");
460 gFcConservative = spectra->GetFeedDownCorrectionFcConservative();
461 gFcConservative->SetNameTitle("gFcConservative","gFcConservative");
462 gYieldCorrConservative->SetNameTitle("gYieldCorrConservative","Conservative gYieldCorr (by fc)");
463 gSigmaCorrConservative->SetNameTitle("gSigmaCorrConservative","Conservative gSigmaCorr (by fc)");
466 if (option==2 && asym) {
467 gYieldCorr->SetNameTitle("gYieldCorr","gYieldCorr (by Nb)");
468 gSigmaCorr->SetNameTitle("gSigmaCorr","gSigmaCorr (by Nb)");
469 gYieldCorrExtreme->SetNameTitle("gYieldCorrExtreme","Extreme gYieldCorr (by Nb)");
470 gSigmaCorrExtreme->SetNameTitle("gSigmaCorrExtreme","Extreme gSigmaCorr (by Nb)");
471 gYieldCorrConservative->SetNameTitle("gYieldCorrConservative","Conservative gYieldCorr (by Nb)");
472 gSigmaCorrConservative->SetNameTitle("gSigmaCorrConservative","Conservative gSigmaCorr (by Nb)");
473 gFcConservative = spectra->GetFeedDownCorrectionFcConservative();
474 gFcConservative->SetNameTitle("gFcConservative","gFcConservative");
478 nSigma = spectra->GetNtupleCrossSectionVsEloss();
482 // Now, plot the results ! :)
485 gROOT->SetStyle("Plain");
487 cout << " Drawing the results ! " << endl;
492 TCanvas *ceff = new TCanvas("ceff","efficiency drawing");
495 hDirectEffpt->Draw();
497 hFeedDownEffpt->Draw();
500 TCanvas *cTheoryRebin = new TCanvas("cTheoryRebin","control the theoretical spectra rebin");
501 cTheoryRebin->Divide(1,2);
503 hDirectMCpt->Draw("");
504 TH1D *hDirectMCptRebin = (TH1D*)spectra->GetDirectTheoreticalSpectrum();
505 hDirectMCptRebin->SetLineColor(2);
506 hDirectMCptRebin->Draw("same");
508 hFeedDownMCpt->Draw("");
509 TH1D *hFeedDownRebin = (TH1D*)spectra->GetFeedDownTheoreticalSpectrum();
510 hFeedDownRebin->SetLineColor(2);
511 hFeedDownRebin->Draw("same");
512 cTheoryRebin->Update();
514 TCanvas *cTheoryRebinLimits = new TCanvas("cTheoryRebinLimits","control the theoretical spectra limits rebin");
515 cTheoryRebinLimits->Divide(1,2);
516 cTheoryRebinLimits->cd(1);
517 hDirectMCptMax->Draw("");
518 TH1D *hDirectMCptMaxRebin = (TH1D*)spectra->GetDirectTheoreticalUpperLimitSpectrum();
519 hDirectMCptMaxRebin->SetLineColor(2);
520 hDirectMCptMaxRebin->Draw("same");
521 hDirectMCptMin->Draw("same");
522 TH1D *hDirectMCptMinRebin = (TH1D*)spectra->GetDirectTheoreticalLowerLimitSpectrum();
523 hDirectMCptMinRebin->SetLineColor(2);
524 hDirectMCptMinRebin->Draw("same");
525 cTheoryRebinLimits->cd(2);
526 hFeedDownMCptMax->Draw("");
527 TH1D *hFeedDownMaxRebin = (TH1D*)spectra->GetFeedDownTheoreticalUpperLimitSpectrum();
528 hFeedDownMaxRebin->SetLineColor(2);
529 hFeedDownMaxRebin->Draw("same");
530 hFeedDownMCptMin->Draw("same");
531 TH1D *hFeedDownMinRebin = (TH1D*)spectra->GetFeedDownTheoreticalLowerLimitSpectrum();
532 hFeedDownMinRebin->SetLineColor(2);
533 hFeedDownMinRebin->Draw("same");
534 cTheoryRebinLimits->Update();
539 TCanvas * cfc = new TCanvas("cfc","Fc");
540 histofcMax->Draw("c");
541 histofc->Draw("csame");
542 histofcMin->Draw("csame");
546 TH2F *histofcDraw= new TH2F("histofcDraw","histofc (for drawing)",100,0,33.25,100,0.01,1.25);
547 histofcDraw->SetStats(0);
548 histofcDraw->GetXaxis()->SetTitle("p_{T} [GeV]");
549 histofcDraw ->GetXaxis()->SetTitleSize(0.05);
550 histofcDraw->GetXaxis()->SetTitleOffset(0.95);
551 histofcDraw->GetYaxis()->SetTitle(" fc ");
552 histofcDraw->GetYaxis()->SetTitleSize(0.05);
556 // for(Int_t item=0; item<gSigmaCorr->GetN(); item++){
557 // Double_t center=0., value=0.;
558 // gFcExtreme->GetPoint(item,center,value);
559 // Double_t highunc = gFcExtreme->GetErrorYhigh(item) / value ;
560 // Double_t lowunc = gFcExtreme->GetErrorYlow(item) / value ;
561 // cout << "Fc extreme: i=" << item << ", center=" << center <<", value=" << value << " high unc=" << highunc*100 << "%, low unc=" << lowunc*100 << "%"<<endl;
563 // for(Int_t item=0; item<gSigmaCorr->GetN(); item++){
564 // Double_t center=0., value=0.;
565 // gFcConservative->GetPoint(item,center,value);
566 // Double_t highunc = gFcConservative->GetErrorYhigh(item) / value ;
567 // Double_t lowunc = gFcConservative->GetErrorYlow(item) / value ;
568 // cout << "Fc conservative: i=" << item << ", center=" << center <<", value=" << value << " high unc=" << highunc*100 << "%, low unc=" << lowunc*100 << "%"<<endl;
570 TCanvas *cfcExtreme = new TCanvas("cfcExtreme","Extreme Asymmetric fc (TGraphAsymmErr)");
571 gFcExtreme->SetFillStyle(3006);
572 gFcExtreme->SetLineWidth(3);
573 gFcExtreme->SetMarkerStyle(20);
574 gFcExtreme->SetFillColor(2);
576 gFcExtreme->Draw("3same");
579 gFcConservative->SetFillStyle(3007);
580 gFcConservative->SetFillColor(4);
581 gFcConservative->Draw("3same");
584 cfcExtreme->Update();
591 // Drawing the results (the raw-reconstructed, the expected, and the corrected spectra)
593 TCanvas * cresult = new TCanvas("cresult","corrected yields & sigma");
594 hDirectMCpt->SetMarkerStyle(20);
595 hDirectMCpt->SetMarkerColor(4);
596 hDirectMCpt->Draw("p");
597 histoSigmaCorr->SetMarkerStyle(21);
598 histoSigmaCorr->SetMarkerColor(2);
599 histoSigmaCorr->Draw("psame");
600 histoYieldCorr->SetMarkerStyle(22);
601 histoYieldCorr->SetMarkerColor(6);
602 histoYieldCorr->Draw("psame");
603 hRECpt->SetMarkerStyle(23);
604 hRECpt->SetMarkerColor(3);
605 hRECpt->Draw("psame");
609 TCanvas * cresult2 = new TCanvas("cresult2","corrected yield & sigma");
610 histoSigmaCorr->SetMarkerStyle(21);
611 histoSigmaCorr->SetMarkerColor(2);
612 histoSigmaCorr->Draw("p");
613 histoYieldCorr->SetMarkerStyle(22);
614 histoYieldCorr->SetMarkerColor(6);
615 histoYieldCorr->Draw("psame");
616 hRECpt->SetMarkerStyle(23);
617 hRECpt->SetMarkerColor(3);
618 hRECpt->Draw("psame");
625 TH2F *histoDraw = new TH2F("histoDraw","histo (for drawing)",100,0,33.25,100,50.,1e7);
626 float max = 1.1*gYieldCorr->GetMaximum();
627 histoDraw->SetAxisRange(0.1,max,"Y");
628 histoDraw->SetStats(0);
629 histoDraw->GetXaxis()->SetTitle("p_{T} [GeV]");
630 histoDraw->GetXaxis()->SetTitleSize(0.05);
631 histoDraw->GetXaxis()->SetTitleOffset(0.95);
632 histoDraw->GetYaxis()->SetTitle("#frac{d#N}{dp_{T}} |_{|y|<1} [L & trigger uncorr]");
633 histoDraw->GetYaxis()->SetTitleSize(0.05);
634 TCanvas * cyieldAsym = new TCanvas("cyieldAsym","Asymmetric corrected yield (TGraphAsymmErr)");
635 gYieldCorr->SetFillStyle(3001);
636 gYieldCorr->SetLineWidth(3);
637 gYieldCorr->SetMarkerStyle(20);
638 gYieldCorr->SetFillColor(3);
640 gYieldCorr->Draw("3LPsame");
641 gYieldCorr->Draw("Xsame");
642 cyieldAsym->SetLogy();
643 cyieldAsym->Update();
645 TCanvas * cyieldExtreme = new TCanvas("cyieldExtreme","Extreme Asymmetric corrected yield (TGraphAsymmErr)");
646 histoYieldCorr->Draw();
647 gYieldCorrExtreme->SetFillStyle(3002);
648 gYieldCorrExtreme->SetLineWidth(3);
649 gYieldCorrExtreme->SetMarkerStyle(20);
650 gYieldCorrExtreme->SetFillColor(2);
651 histoYieldCorr->Draw();
652 gYieldCorr->Draw("3same");
653 gYieldCorrExtreme->Draw("3same");
654 cyieldExtreme->SetLogy();
655 cyieldExtreme->Update();
657 TH2F *histo2Draw = new TH2F("histo2Draw","histo2 (for drawing)",100,0,33.25,100,50.,1e9);
658 max = 1.1*gSigmaCorr->GetMaximum();
659 histo2Draw->SetAxisRange(0.1,max,"Y");
660 histo2Draw->SetStats(0);
661 histo2Draw->GetXaxis()->SetTitle("p_{T} [GeV]");
662 histo2Draw->GetXaxis()->SetTitleSize(0.05);
663 histo2Draw->GetXaxis()->SetTitleOffset(0.95);
664 histo2Draw->GetYaxis()->SetTitle("#frac{1}{BR} #times #frac{d#sigma}{dp_{T}} |_{|y|<1}");
665 histo2Draw->GetYaxis()->SetTitleSize(0.05);
666 TCanvas * csigmaAsym = new TCanvas("csigmaAsym","Asymmetric corrected sigma (TGraphAsymmErr)");
667 gSigmaCorr->SetFillStyle(3001);
668 gSigmaCorr->SetLineWidth(3);
669 gSigmaCorr->SetMarkerStyle(21);
670 gSigmaCorr->SetFillColor(3);
672 gSigmaCorr->Draw("3LPsame");
673 gSigmaCorr->Draw("Xsame");
674 csigmaAsym->SetLogy();
675 csigmaAsym->Update();
677 // cout << endl <<" Sytematics (stat approach) " <<endl;
678 // for(Int_t item=0; item<gSigmaCorr->GetN(); item++){
679 // Double_t center=0., value=0.;
680 // gSigmaCorr->GetPoint(item,center,value);
681 // Double_t highunc = gSigmaCorr->GetErrorYhigh(item) / value ;
682 // Double_t lowunc = gSigmaCorr->GetErrorYlow(item) / value ;
683 // cout << "Sigma syst (stat), i=" << item << ", center=" << center <<", value=" << value << " high unc=" << highunc*100 << "%, low unc=" << lowunc*100 << "%"<<endl;
686 TCanvas * csigmaExtreme = new TCanvas("csigmaExtreme","Asymmetric extreme corrected sigma (TGraphAsymmErr)");
687 histoSigmaCorr->Draw();
688 gSigmaCorr->Draw("3Psame");
689 gSigmaCorrExtreme->SetFillStyle(3002);
690 gSigmaCorrExtreme->SetLineWidth(3);
691 gSigmaCorrExtreme->SetMarkerStyle(21);
692 gSigmaCorrExtreme->SetFillColor(2);
693 gSigmaCorrExtreme->Draw("3Psame");
694 csigmaExtreme->SetLogy();
695 csigmaExtreme->Update();
697 // cout << endl << " Sytematics (Extreme approach)" <<endl;
698 // for(Int_t item=0; item<gSigmaCorrExtreme->GetN(); item++){
699 // Double_t center=0., value=0.;
700 // gSigmaCorrExtreme->GetPoint(item,center,value);
701 // Double_t highunc = gSigmaCorrExtreme->GetErrorYhigh(item) / value ;
702 // Double_t lowunc = gSigmaCorrExtreme->GetErrorYlow(item) / value ;
703 // cout << "Sigma syst (extreme) i=" << item << ", center=" << center <<", value=" << value << " high unc=" << highunc*100 << "%, low unc=" << lowunc*100 << "%"<<endl;
706 // cout << endl << " Sytematics (Conservative approach)" <<endl;
707 // for(Int_t item=0; item<gSigmaCorrConservative->GetN(); item++){
708 // Double_t center=0., value=0.;
709 // gSigmaCorrConservative->GetPoint(item,center,value);
710 // Double_t highunc = gSigmaCorrConservative->GetErrorYhigh(item) / value ;
711 // Double_t lowunc = gSigmaCorrConservative->GetErrorYlow(item) / value ;
712 // cout << "Sigma syst (conservative) i=" << item << ", center=" << center <<", value=" << value << " high unc=" << highunc*100 << "%, low unc=" << lowunc*100 << "%"<<endl;
717 // Draw the PbPb Eloss hypothesis histograms
719 AliHFPtSpectrum *CalcBins=NULL;
720 gStyle->SetPalette(1);
721 TCanvas *canvasfcRcb = new TCanvas("canvasfcRcb","fc vs pt vs Rcb");
722 // histofcRcb->Draw("cont4z");
723 histofcRcb->Draw("colz");
724 canvasfcRcb->Update();
726 TCanvas *canvasfcRcb1 = new TCanvas("canvasfcRcb1","fc vs pt vs Rcb=1");
727 histofcRcb_px = (TH1D*)histofcRcb->ProjectionX("histofcRcb_px",40,40);
728 histofcRcb_px->SetLineColor(2);
731 histofcRcb_px->Draw("same");
732 } else histofcRcb_px->Draw("");
733 canvasfcRcb1->Update();
734 TCanvas *canvasfcRcb2 = new TCanvas("canvasfcRcb2","fc vs pt vs Rcb fixed Rcb");
735 Int_t bin0 = CalcBins->FindTH2YBin(histofcRcb,0.25);
736 Int_t bin1 = CalcBins->FindTH2YBin(histofcRcb,0.5);
737 Int_t bin2 = CalcBins->FindTH2YBin(histofcRcb,1.0);
738 Int_t bin3 = CalcBins->FindTH2YBin(histofcRcb,1.5);
739 Int_t bin4 = CalcBins->FindTH2YBin(histofcRcb,2.0);
740 Int_t bin5 = CalcBins->FindTH2YBin(histofcRcb,3.0);
741 Int_t bin6 = CalcBins->FindTH2YBin(histofcRcb,4.0);
742 TH1D * histofcRcb_px0a = (TH1D*)histofcRcb->ProjectionX("histofcRcb_px0a",bin0,bin0);
743 TH1D * histofcRcb_px0 = (TH1D*)histofcRcb->ProjectionX("histofcRcb_px0",bin1,bin1);
744 TH1D * histofcRcb_px1 = (TH1D*)histofcRcb->ProjectionX("histofcRcb_px1",bin2,bin2);
745 TH1D * histofcRcb_px2 = (TH1D*)histofcRcb->ProjectionX("histofcRcb_px2",bin3,bin3);
746 TH1D * histofcRcb_px3 = (TH1D*)histofcRcb->ProjectionX("histofcRcb_px3",bin4,bin4);
747 TH1D * histofcRcb_px4 = (TH1D*)histofcRcb->ProjectionX("histofcRcb_px4",bin5,bin5);
748 TH1D * histofcRcb_px5 = (TH1D*)histofcRcb->ProjectionX("histofcRcb_px5",bin6,bin6);
751 // histofcRcb_px->Draw("same");
753 // histofcRcb_px->Draw("");
754 histofcRcb_px0a->SetLineColor(2);
755 histofcRcb_px0a->Draw("");
757 histofcRcb_px0a->SetLineColor(2);
758 histofcRcb_px0a->Draw("same");
759 histofcRcb_px0->SetLineColor(4);
760 histofcRcb_px0->Draw("same");
761 histofcRcb_px1->SetLineColor(3);
762 histofcRcb_px1->Draw("same");
763 histofcRcb_px2->SetLineColor(kCyan);
764 histofcRcb_px2->Draw("same");
765 histofcRcb_px3->SetLineColor(kMagenta+1);
766 histofcRcb_px3->Draw("same");
767 histofcRcb_px4->SetLineColor(kOrange+7);
768 histofcRcb_px4->Draw("same");
769 histofcRcb_px5->SetLineColor(kGreen+3);
770 histofcRcb_px5->Draw("same");
771 TLegend *legrcc = new TLegend(0.8,0.8,0.95,0.9);
772 legrcc->SetFillColor(0);
774 legrcc->AddEntry(histofcRcb_px0a,"Rc/b=0.25","l");
775 legrcc->AddEntry(histofcRcb_px0,"Rc/b=0.5","l");
776 legrcc->AddEntry(histofcRcb_px1,"Rc/b=1.0","l");
777 legrcc->AddEntry(histofcRcb_px2,"Rc/b=1.5","l");
778 legrcc->AddEntry(histofcRcb_px3,"Rc/b=2.0","l");
779 legrcc->AddEntry(histofcRcb_px4,"Rc/b=3.0","l");
780 legrcc->AddEntry(histofcRcb_px5,"Rc/b=4.0","l");
782 legrcc->AddEntry(histofcRcb_px0a,"Rb=0.25","l");
783 legrcc->AddEntry(histofcRcb_px0,"Rb=0.5","l");
784 legrcc->AddEntry(histofcRcb_px1,"Rb=1.0","l");
785 legrcc->AddEntry(histofcRcb_px2,"Rb=1.5","l");
786 legrcc->AddEntry(histofcRcb_px3,"Rb=2.0","l");
787 legrcc->AddEntry(histofcRcb_px4,"Rb=3.0","l");
788 legrcc->AddEntry(histofcRcb_px5,"Rb=4.0","l");
791 canvasfcRcb2->Update();
792 TCanvas *canvasYRcb = new TCanvas("canvasYRcb","corrected yield vs pt vs Rcb");
793 histoYieldCorrRcb->Draw("cont4z");
794 canvasYRcb->Update();
795 TCanvas *canvasSRcb = new TCanvas("canvasSRcb","sigma vs pt vs Rcb");
796 histoSigmaCorrRcb->Draw("cont4z");
797 canvasSRcb->Update();
798 TCanvas *canvasSRcb1 = new TCanvas("canvasSRcb1","sigma vs pt vs Rcb fixed Rcb");
799 TH1D * histoSigmaCorrRcb_px0a = (TH1D*)histoSigmaCorrRcb->ProjectionX("histoSigmaCorrRcb_px0a",bin0,bin0);
800 TH1D * histoSigmaCorrRcb_px0 = (TH1D*)histoSigmaCorrRcb->ProjectionX("histoSigmaCorrRcb_px0",bin1,bin1);
801 TH1D * histoSigmaCorrRcb_px1 = (TH1D*)histoSigmaCorrRcb->ProjectionX("histoSigmaCorrRcb_px1",bin2,bin2);
802 TH1D * histoSigmaCorrRcb_px2 = (TH1D*)histoSigmaCorrRcb->ProjectionX("histoSigmaCorrRcb_px2",bin3,bin3);
803 TH1D * histoSigmaCorrRcb_px3 = (TH1D*)histoSigmaCorrRcb->ProjectionX("histoSigmaCorrRcb_px3",bin4,bin4);
804 TH1D * histoSigmaCorrRcb_px4 = (TH1D*)histoSigmaCorrRcb->ProjectionX("histoSigmaCorrRcb_px4",bin5,bin5);
805 TH1D * histoSigmaCorrRcb_px5 = (TH1D*)histoSigmaCorrRcb->ProjectionX("histoSigmaCorrRcb_px5",bin6,bin6);
806 histoSigmaCorr->Draw();
807 histoSigmaCorrRcb_px0a->SetLineColor(2);
808 histoSigmaCorrRcb_px0a->Draw("hsame");
809 histoSigmaCorrRcb_px0->SetLineColor(4);
810 histoSigmaCorrRcb_px0->Draw("hsame");
811 histoSigmaCorrRcb_px1->SetLineColor(3);
812 histoSigmaCorrRcb_px1->Draw("hsame");
813 histoSigmaCorrRcb_px2->SetLineColor(kCyan);
814 histoSigmaCorrRcb_px2->Draw("hsame");
815 histoSigmaCorrRcb_px3->SetLineColor(kMagenta+1);
816 histoSigmaCorrRcb_px3->Draw("hsame");
817 histoSigmaCorrRcb_px4->SetLineColor(kOrange+7);
818 histoSigmaCorrRcb_px4->Draw("same");
819 histoSigmaCorrRcb_px5->SetLineColor(kGreen+3);
820 histoSigmaCorrRcb_px5->Draw("same");
821 TLegend *legrcb = new TLegend(0.8,0.8,0.95,0.9);
822 legrcb->SetFillColor(0);
824 legrcb->AddEntry(histoSigmaCorrRcb_px0a,"Rc/b=0.25","l");
825 legrcb->AddEntry(histoSigmaCorrRcb_px0,"Rc/b=0.5","l");
826 legrcb->AddEntry(histoSigmaCorrRcb_px1,"Rc/b=1.0","l");
827 legrcb->AddEntry(histoSigmaCorrRcb_px2,"Rc/b=1.5","l");
828 legrcb->AddEntry(histoSigmaCorrRcb_px3,"Rc/b=2.0","l");
829 legrcb->AddEntry(histoSigmaCorrRcb_px4,"Rc/b=3.0","l");
830 legrcb->AddEntry(histoSigmaCorrRcb_px5,"Rc/b=4.0","l");
832 legrcb->AddEntry(histoSigmaCorrRcb_px0a,"Rb=0.25","l");
833 legrcb->AddEntry(histoSigmaCorrRcb_px0,"Rb=0.5","l");
834 legrcb->AddEntry(histoSigmaCorrRcb_px1,"Rb=1.0","l");
835 legrcb->AddEntry(histoSigmaCorrRcb_px2,"Rb=1.5","l");
836 legrcb->AddEntry(histoSigmaCorrRcb_px3,"Rb=2.0","l");
837 legrcb->AddEntry(histoSigmaCorrRcb_px4,"Rb=3.0","l");
838 legrcb->AddEntry(histoSigmaCorrRcb_px5,"Rb=4.0","l");
841 canvasSRcb1->Update();
846 // Write the histograms to the output file
848 cout << " Saving the results ! " << endl<< endl;
852 hDirectMCpt->Write(); hFeedDownMCpt->Write();
853 hDirectMCptMax->Write(); hDirectMCptMin->Write();
854 hFeedDownMCptMax->Write(); hFeedDownMCptMin->Write();
855 if(hDirectEffpt) hDirectEffpt->Write(); if(hFeedDownEffpt) hFeedDownEffpt->Write();
858 histoYieldCorr->Write();
859 histoYieldCorrMax->Write(); histoYieldCorrMin->Write();
860 histoSigmaCorr->Write();
861 histoSigmaCorrMax->Write(); histoSigmaCorrMin->Write();
864 histofcRcb->Write(); histofcRcb_px->Write();
865 histoYieldCorrRcb->Write();
866 histoSigmaCorrRcb->Write();
873 if(gYieldCorrExtreme) gYieldCorrExtreme->Write();
874 if(gSigmaCorrExtreme) gSigmaCorrExtreme->Write();
875 if(gYieldCorrConservative) gYieldCorrConservative->Write();
876 if(gSigmaCorrConservative) gSigmaCorrConservative->Write();
877 if(asym && gFcConservative) gFcConservative->Write();
882 histofcMax->Write(); histofcMin->Write();
883 if(asym && gFcExtreme) gFcExtreme->Write();
887 TH1D * hStatUncEffcSigma = spectra->GetDirectStatEffUncOnSigma();
888 TH1D * hStatUncEffbSigma = spectra->GetFeedDownStatEffUncOnSigma();
889 hStatUncEffcSigma->Write();
890 hStatUncEffbSigma->Write();
892 TH1D * hStatUncEffcFD = spectra->GetDirectStatEffUncOnFc();
893 TH1D * hStatUncEffbFD = spectra->GetFeedDownStatEffUncOnFc();
894 hStatUncEffcFD->Write();
895 hStatUncEffbFD->Write();
898 // Draw the cross-section
899 // spectra->DrawSpectrum(gPrediction);