AliPhysics  c2ade29 (c2ade29)
HFPtSpectrum.C
Go to the documentation of this file.
1 #if !defined(__CINT__) || defined(__MAKECINT__)
2 #include <Riostream.h>
3 #include "TH1D.h"
4 #include "TH1.h"
5 #include "TH2F.h"
6 #include "TNtuple.h"
7 #include "TFile.h"
8 #include "TSystem.h"
9 #include "TGraphAsymmErrors.h"
10 #include "TCanvas.h"
11 #include "TROOT.h"
12 #include "TStyle.h"
13 #include "TLegend.h"
14 #include "AliHFSystErr.h"
15 #include "AliHFPtSpectrum.h"
16 #endif
17 
18 /* $Id$ */
19 
20 //
21 // Macro to use the AliHFPtSpectrum class
22 // to compute the feed-down corrections for heavy-flavor
23 //
24 // Z.Conesa, September 2010 (zconesa@in2p3.fr)
25 //
26 
27 
28 
29 //
30 // Macro execution parameters:
31 // 0) filename with the theoretical predictions (direct & feed-down)
32 // 1) acceptance and reconstruction efficiencies file name (direct & feed-down)
33 // 2) reconstructed spectra file name
34 // 3) output file name
35 // 4) Set the feed-down calculation option flag: knone=none, kfc=fc only, kNb=Nb only
36 // 5-6) Set the luminosity: the number of events analyzed, and the cross-section of the sample [pb]
37 // 7) Set whether the yield is for particle + anti-particles or only one of the 'charges'
38 // 8) Set the centrality class
39 // 9) Flag to decide if there is need to evaluate the dependence on the energy loss
40 //
41 
45 enum energy{ k276, k5dot023, k55 };
51 
52 void HFPtSpectrum ( Int_t decayChan=kDplusKpipi,
53  const char *mcfilename="FeedDownCorrectionMC.root",
54  const char *efffilename="Efficiencies.root",
55  const char *recofilename="Reconstructed.root",
56  const char *recohistoname="hRawSpectrumD0",
57  const char *outfilename="HFPtSpectrum.root",
58  Int_t fdMethod=kNb,
59  Double_t nevents=1.0,
60  Double_t sigma=1.0, // sigma[pb]
61  Bool_t isParticlePlusAntiParticleYield=true,
62  Int_t cc=kpp7,
63  Int_t year=k2010,
64  Bool_t PbPbEloss=false,
65  Int_t Energy=k276,
66  Int_t ccestimator = kV0M,
67  Int_t isRaavsEP=kPhiIntegrated,
68  const char *epResolfile="",
69  Int_t rapiditySlice=kdefault,
70  Int_t analysisSpeciality=kTopological,
71  Bool_t setUsePtDependentEffUncertainty=true) {
72 
73 
74  // gROOT->Macro("$ALICE_PHYSICS/PWGHF/vertexingHF/macros/LoadLibraries.C");
75 
76  // Set if calculation considers asymmetric uncertainties or not
77  Bool_t asym = true;
78 
79  Int_t option=3;
80  if (fdMethod==kfc) option=1;
81  else if (fdMethod==kNb) option=2;
82  else if (fdMethod==knone) { option=0; asym=false; PbPbEloss=false; }
83  else option=3;
84 
85  if (option>2) {
86  cout<< "Bad calculation option, should be <=2"<<endl;
87  return;
88  }
89 
90 
91  //
92  // Defining the Tab values for the given centrality class
93  // https://twiki.cern.ch/twiki/bin/viewauth/ALICE/CentStudies
94  //
95  Double_t tab = 1., tabUnc = 0.;
96  if( (ccestimator == kV0M) && (Energy==k276) ) {
97  if ( cc == k07half ) {
98  tab = 24.81; tabUnc = 0.8037;
99  } else if ( cc == k010 ) {
100  tab = 23.48; tabUnc = 0.97;
101  } else if ( cc == k1020 ) {
102  tab = 14.4318; tabUnc = 0.5733;
103  } else if ( cc == k020 ) {
104  tab = 18.93; tabUnc = 0.74;
105  } else if ( cc == k1030 ) {
106  tab = 11.4; tabUnc = 0.36;
107  } else if ( cc == k2040 ) {
108  tab = 6.86; tabUnc = 0.28;
109  } else if ( cc == k2030 ) {
110  tab = 8.73769; tabUnc = 0.370219;
111  } else if ( cc == k3040 ) {
112  tab = 5.02755; tabUnc = 0.22099;
113  } else if ( cc == k4050 ) {
114  tab = 2.68327; tabUnc = 0.137073;
115  } else if ( cc == k3050 ) {
116  tab = 3.87011; tabUnc = 0.183847;
117  } else if ( cc == k4060 ) {
118  tab = 2.00; tabUnc= 0.11;
119  } else if ( cc == k4080 ) {
120  tab = 1.20451; tabUnc = 0.071843;
121  } else if ( cc == k5060 ) {
122  tab = 1.32884; tabUnc = 0.0929536;
123  } else if ( cc == k6080 ) {
124  tab = 0.419; tabUnc = 0.033;
125  } else if ( cc == k5080 ) {
126  tab = 0.719; tabUnc = 0.054;
127  } else if ( cc == k80100 ){
128  tab = 0.0690; tabUnc = 0.0062;
129  }
130  }
131  if( (ccestimator == kV0M) && (Energy==k5dot023) ) {
132  if ( cc == k010 ) {
133  tab = 23.07; tabUnc = 0.44;
134  } else if ( cc == k3050 ) {
135  tab = 3.897; tabUnc = 0.11;
136  } else if ( cc == k6080 ) {
137  tab = 0.4173; tabUnc = 0.014;
138  }
139  }
140 
141  // pPb Glauber (A. Toia)
142  // https://twiki.cern.ch/twiki/bin/viewauth/ALICE/PACentStudies#Glauber_Calculations_with_sigma
143  if( cc == kpPb0100 ){
144  tab = 0.098334; tabUnc = 0.0070679;
145  // A=207.2; B=1.;
146  }
147  else if( ccestimator == kV0A ){
148  if ( cc == kpPb020 ) {
149  tab = 0.183; tabUnc = 0.006245;
150  } else if ( cc == kpPb2040 ) {
151  tab = 0.134; tabUnc = 0.004899;
152  } else if ( cc == kpPb4060 ) {
153  tab = 0.092; tabUnc = 0.004796;
154  } else if ( cc == kpPb60100 ) {
155  tab = 0.041; tabUnc = 0.008832;
156  }
157  }
158  else if( ccestimator == kZNA ){
159  if ( cc == kpPb010 ) {
160  tab = 0.1812; tabUnc = 0.01413;
161  } else if ( cc == kpPb020 ) {
162  tab = 0.1742; tabUnc = 0.00992;
163  } else if ( cc == kpPb1020 ) {
164  tab = 0.1672; tabUnc = 0.005852;
165  } else if ( cc == kpPb2040 ) {
166  tab = 0.1453; tabUnc = 0.002615;
167  } else if ( cc == kpPb4060 ) {
168  tab = 0.1074; tabUnc = 0.004726;
169  } else if ( cc == kpPb60100 ) {
170  tab = 0.0486; tabUnc = 0.002430;
171  }
172  }
173  else if( ccestimator == kCL1 ){
174  if ( cc == kpPb020 ) {
175  tab = 0.19; tabUnc = 0.007;
176  } else if ( cc == kpPb2040 ) {
177  tab = 0.136; tabUnc = 0.005;
178  } else if ( cc == kpPb4060 ) {
179  tab = 0.088; tabUnc = 0.005;
180  } else if ( cc == kpPb60100 ) {
181  tab = 0.0369; tabUnc = 0.0085;
182  }
183  }
184 
185  tab *= 1e-9; // to pass from mb^{-1} to pb^{-1}
186  tabUnc *= 1e-9;
187 
188 
189 
190  //
191  // Get the histograms from the files
192  //
193  TH1D *hDirectMCpt=0; // Input MC c-->D spectra
194  TH1D *hFeedDownMCpt=0; // Input MC b-->D spectra
195  TH1D *hDirectMCptMax=0; // Input MC maximum c-->D spectra
196  TH1D *hDirectMCptMin=0; // Input MC minimum c-->D spectra
197  TH1D *hFeedDownMCptMax=0; // Input MC maximum b-->D spectra
198  TH1D *hFeedDownMCptMin=0; // Input MC minimum b-->D spectra
199  // TGraphAsymmErrors *gPrediction=0; // Input MC c-->D spectra
200  TH1D *hDirectEffpt=0; // c-->D Acceptance and efficiency correction
201  TH1D *hFeedDownEffpt=0; // b-->D Acceptance and efficiency correction
202  TH1D *hRECpt=0; // all reconstructed D
203 
204  //
205  // Define/Get the input histograms
206  //
207  Int_t decay=0;
208 
209  if(gSystem->Exec(Form("ls -l %s > /dev/null 2>&1",mcfilename)) !=0){
210  printf("File %s with FONLL predictions does not exist -> exiting\n",mcfilename);
211  return;
212  }
213  TFile * mcfile = new TFile(mcfilename,"read");
214  if(!mcfile){
215  printf("File %s with FONLL predictions not opened -> exiting\n",mcfilename);
216  return;
217  }
218  if (decayChan==kD0Kpi){
219  decay = 1;
220  hDirectMCpt = (TH1D*)mcfile->Get("hD0Kpipred_central");
221  hFeedDownMCpt = (TH1D*)mcfile->Get("hD0KpifromBpred_central_corr");
222  hDirectMCptMax = (TH1D*)mcfile->Get("hD0Kpipred_max");
223  hDirectMCptMin = (TH1D*)mcfile->Get("hD0Kpipred_min");
224  hFeedDownMCptMax = (TH1D*)mcfile->Get("hD0KpifromBpred_max_corr");
225  hFeedDownMCptMin = (TH1D*)mcfile->Get("hD0KpifromBpred_min_corr");
226  // gPrediction = (TGraphAsymmErrors*)mcfile->Get("D0Kpiprediction");
227  }
228  else if (decayChan==kDplusKpipi){
229  decay = 2;
230  hDirectMCpt = (TH1D*)mcfile->Get("hDpluskpipipred_central");
231  hFeedDownMCpt = (TH1D*)mcfile->Get("hDpluskpipifromBpred_central_corr");
232  hDirectMCptMax = (TH1D*)mcfile->Get("hDpluskpipipred_max");
233  hDirectMCptMin = (TH1D*)mcfile->Get("hDpluskpipipred_min");
234  hFeedDownMCptMax = (TH1D*)mcfile->Get("hDpluskpipifromBpred_max_corr");
235  hFeedDownMCptMin = (TH1D*)mcfile->Get("hDpluskpipifromBpred_min_corr");
236  // gPrediction = (TGraphAsymmErrors*)mcfile->Get("Dpluskpipiprediction");
237  }
238  else if(decayChan==kDstarD0pi){
239  decay = 3;
240  hDirectMCpt = (TH1D*)mcfile->Get("hDstarD0pipred_central");
241  hFeedDownMCpt = (TH1D*)mcfile->Get("hDstarD0pifromBpred_central_corr");
242  hDirectMCptMax = (TH1D*)mcfile->Get("hDstarD0pipred_max");
243  hDirectMCptMin = (TH1D*)mcfile->Get("hDstarD0pipred_min");
244  hFeedDownMCptMax = (TH1D*)mcfile->Get("hDstarD0pifromBpred_max_corr");
245  hFeedDownMCptMin = (TH1D*)mcfile->Get("hDstarD0pifromBpred_min_corr");
246  // gPrediction = (TGraphAsymmErrors*)mcfile->Get("DstarD0piprediction");
247  }
248  else if (decayChan==kDsKKpi){
249  decay = 4;
250  hDirectMCpt = (TH1D*)mcfile->Get("hDsPhipitoKkpipred_central");
251  hFeedDownMCpt = (TH1D*)mcfile->Get("hDsPhipitoKkpifromBpred_central_corr");
252  hDirectMCptMax = (TH1D*)mcfile->Get("hDsPhipitoKkpipred_max");
253  hDirectMCptMin = (TH1D*)mcfile->Get("hDsPhipitoKkpipred_min");
254  hFeedDownMCptMax = (TH1D*)mcfile->Get("hDsPhipitoKkpifromBpred_max_corr");
255  hFeedDownMCptMin = (TH1D*)mcfile->Get("hDsPhipitoKkpifromBpred_min_corr");
256  }
257  else if (decayChan==kLctopKpi){
258  decay = 5;
259  hDirectMCpt = (TH1D*)mcfile->Get("hLcpkpipred_central");
260  hFeedDownMCpt = (TH1D*)mcfile->Get("hLcpkpifromBpred_central_corr");
261  hDirectMCptMax = (TH1D*)mcfile->Get("hLcpkpipred_max");
262  hDirectMCptMin = (TH1D*)mcfile->Get("hLcpkpipred_min");
263  hFeedDownMCptMax = (TH1D*)mcfile->Get("hLcpkpifromBpred_max_corr");
264  hFeedDownMCptMin = (TH1D*)mcfile->Get("hLcpkpifromBpred_min_corr");
265  }
266  else if (decayChan==kLcK0Sp){
267  decay = 6;
268  hDirectMCpt = (TH1D*)mcfile->Get("hLcK0sppred_central");
269  hFeedDownMCpt = (TH1D*)mcfile->Get("hLcK0spfromBpred_central_corr");
270  hDirectMCptMax = (TH1D*)mcfile->Get("hLcK0sppred_max");
271  hDirectMCptMin = (TH1D*)mcfile->Get("hLcK0sppred_min");
272  hFeedDownMCptMax = (TH1D*)mcfile->Get("hLcK0spfromBpred_max_corr");
273  hFeedDownMCptMin = (TH1D*)mcfile->Get("hLcK0spfromBpred_min_corr");
274  }
275  //
276  hDirectMCpt->SetNameTitle("hDirectMCpt","direct MC spectra");
277  hFeedDownMCpt->SetNameTitle("hFeedDownMCpt","feed-down MC spectra");
278  hDirectMCptMax->SetNameTitle("hDirectMCptMax","max direct MC spectra");
279  hDirectMCptMin->SetNameTitle("hDirectMCptMin","min direct MC spectra");
280  hFeedDownMCptMax->SetNameTitle("hFeedDownMCptMax","max feed-down MC spectra");
281  hFeedDownMCptMin->SetNameTitle("hFeedDownMCptMin","min feed-down MC spectra");
282  //
283  // Scale FONLL inputs if we do the analysis in y-slices
284  //
285  if(rapiditySlice!=kdefault){
286  Double_t scaleFONLL = 1.0;
287  switch(rapiditySlice) {
288  case k08to04: scaleFONLL = (0.093+0.280)/1.0; break;
289  case k07to04: scaleFONLL = 0.280/1.0; break;
290  case k04to01: scaleFONLL = 0.284/1.0; break;
291  case k01to01: scaleFONLL = 0.191/1.0; break;
292  case k01to04: scaleFONLL = 0.288/1.0; break;
293  case k04to07: scaleFONLL = 0.288/1.0; break;
294  case k04to08: scaleFONLL = (0.288+0.096)/1.0; break;
295  case k01to05: scaleFONLL = (0.4)/1.0; break;
296  }
297  hDirectMCpt->Scale(scaleFONLL);
298  hDirectMCptMax->Scale(scaleFONLL);
299  hDirectMCptMin->Scale(scaleFONLL);
300  switch(rapiditySlice) {
301  case k08to04: scaleFONLL = (0.089+0.274)/1.0; break;
302  case k07to04: scaleFONLL = 0.274/1.0; break;
303  case k04to01: scaleFONLL = 0.283/1.0; break;
304  case k01to01: scaleFONLL = 0.192/1.0; break;
305  case k01to04: scaleFONLL = 0.290/1.0; break;
306  case k04to07: scaleFONLL = 0.291/1.0; break;
307  case k04to08: scaleFONLL = (0.291+0.097)/1.0; break;
308  case k01to05: scaleFONLL = (0.4)/1.0; break;
309  }
310  hFeedDownMCpt->Scale(scaleFONLL);
311  hFeedDownMCptMax->Scale(scaleFONLL);
312  hFeedDownMCptMin->Scale(scaleFONLL);
313  }
314 
315  //
316  //
317  if(gSystem->Exec(Form("ls -l %s > /dev/null 2>&1",recofilename)) !=0){
318  printf("File %s with raw yield does not exist -> exiting\n",recofilename);
319  return;
320  }
321  if(gSystem->Exec(Form("ls -l %s > /dev/null 2>&1",efffilename)) !=0){
322  printf("File %s with efficiencies does not exist -> exiting\n",efffilename);
323  return;
324  }
325  TFile * efffile = new TFile(efffilename,"read");
326  if(!efffile){
327  printf("File %s with efficiencies not opened -> exiting\n",efffilename);
328  return;
329  }
330  hDirectEffpt = (TH1D*)efffile->Get("hEffD");
331  hDirectEffpt->SetNameTitle("hDirectEffpt","direct acc x eff");
332  hFeedDownEffpt = (TH1D*)efffile->Get("hEffB");
333  hFeedDownEffpt->SetNameTitle("hFeedDownEffpt","feed-down acc x eff");
334  //
335  //
336  TFile * recofile = new TFile(recofilename,"read");
337  if(!recofile){
338  printf("File %s with raw yields not opened -> exiting\n",recofilename);
339  return;
340  }
341  hRECpt = (TH1D*)recofile->Get(recohistoname);
342  hRECpt->SetNameTitle("hRECpt","Reconstructed spectra");
343  //
344  // Read the file of the EP resolution correction
345  TFile *EPf=0;
346  TH1D *hEPresolCorr=0;
347  if(isRaavsEP>0.){
348  EPf = new TFile(epResolfile,"read");
349  if(isRaavsEP==kInPlane) hEPresolCorr = (TH1D*)EPf->Get("hCorrEPresol_InPlane");
350  else if(isRaavsEP==kOutOfPlane) hEPresolCorr = (TH1D*)EPf->Get("hCorrEPresol_OutOfPlane");
351  for(Int_t i=1; i<=hRECpt->GetNbinsX(); i++) {
352  Double_t value = hRECpt->GetBinContent(i);
353  Double_t error = hRECpt->GetBinError(i);
354  Double_t pt = hRECpt->GetBinCenter(i);
355  Int_t epbin = hEPresolCorr->FindBin( pt );
356  Double_t epcorr = hEPresolCorr->GetBinContent( epbin );
357  value = value*epcorr;
358  error = error*epcorr;
359  hRECpt->SetBinContent(i,value);
360  hRECpt->SetBinError(i,error);
361  }
362  }
363 
364  //
365  // Define the output histograms
366  //
367  TFile *out = new TFile(outfilename,"recreate");
368  //
369  TH1D *histofc=0;
370  TH1D *histofcMax=0;
371  TH1D *histofcMin=0;
372  TH1D *histoYieldCorr=0;
373  TH1D *histoYieldCorrMax=0;
374  TH1D *histoYieldCorrMin=0;
375  TH1D *histoSigmaCorr=0;
376  TH1D *histoSigmaCorrMax=0;
377  TH1D *histoSigmaCorrMin=0;
378  //
379  TH2D *histofcRcb=0;
380  TH1D *histofcRcb_px=0;
381  TH2D *histoYieldCorrRcb=0;
382  TH2D *histoSigmaCorrRcb=0;
383  //
384  TGraphAsymmErrors * gYieldCorr = 0;
385  TGraphAsymmErrors * gSigmaCorr = 0;
386  TGraphAsymmErrors * gFcExtreme = 0;
387  TGraphAsymmErrors * gFcConservative = 0;
388  TGraphAsymmErrors * gYieldCorrExtreme = 0;
389  TGraphAsymmErrors * gSigmaCorrExtreme = 0;
390  TGraphAsymmErrors * gYieldCorrConservative = 0;
391  TGraphAsymmErrors * gSigmaCorrConservative = 0;
392  //
393  TNtuple * nSigma = 0;
394 
395 
396  //
397  // Main functionalities for the calculation
398  //
399 
400  // Define and set the basic option flags
401  AliHFPtSpectrum * spectra = new AliHFPtSpectrum("AliHFPtSpectrum","AliHFPtSpectrum",option);
402  spectra->SetFeedDownCalculationOption(option);
403  spectra->SetComputeAsymmetricUncertainties(asym);
404  // Set flag on whether to additional PbPb Eloss hypothesis have to be computed
405  spectra->SetComputeElossHypothesis(PbPbEloss);
406 
407  spectra->SetUsePtDependentEffUncertainty(setUsePtDependentEffUncertainty);
408 
409  // Feed the input histograms
410  // reconstructed spectra
411  cout << " Setting the reconstructed spectrum,";
412  spectra->SetReconstructedSpectrum(hRECpt);
413  // acceptance and efficiency corrections
414  cout << " the efficiency,";
415  spectra->SetAccEffCorrection(hDirectEffpt,hFeedDownEffpt);
416  // spectra->SetfIsStatUncEff(false);
417  // option specific histos (theory)
418  cout << " the theoretical spectra";
419  if(option==1){
420  spectra->SetMCptSpectra(hDirectMCpt,hFeedDownMCpt);
421  if(asym) spectra->SetMCptDistributionsBounds(hDirectMCptMax,hDirectMCptMin,hFeedDownMCptMax,hFeedDownMCptMin);
422  }
423  else if(option==2){
424  spectra->SetFeedDownMCptSpectra(hFeedDownMCpt);
425  if(asym) spectra->SetFeedDownMCptDistributionsBounds(hFeedDownMCptMax,hFeedDownMCptMin);
426  }
427 
428  cout << " and the normalization" <<endl;
429  // Set normalization factors (uncertainties set to 0. as example)
430  spectra->SetNormalization(nevents,sigma);
431  Double_t lumi = nevents / sigma ;
432  Double_t lumiUnc = 0.04*lumi; // 10% uncertainty on the luminosity
433  spectra->SetLuminosity(lumi,lumiUnc);
434  Double_t effTrig = 1.0;
435  spectra->SetTriggerEfficiency(effTrig,0.);
436  if(isRaavsEP>0.) spectra->SetIsEventPlaneAnalysis(kTRUE);
437 
438  // Set the global uncertainties on the efficiencies (in percent)
439  Double_t globalEffUnc = 0.05;
440  Double_t globalBCEffRatioUnc = 0.05;
441  if(analysisSpeciality==kLowPt) globalBCEffRatioUnc = 0.;
442  spectra->SetAccEffPercentageUncertainty(globalEffUnc,globalBCEffRatioUnc);
443 
444  // Set if the yield is for particle+anti-particle or only one type
445  spectra->SetIsParticlePlusAntiParticleYield(isParticlePlusAntiParticleYield);
446 
447  // Set the Tab parameter and uncertainties
448  if ( (cc != kpp7) && (cc != kpp8) && (cc != kpp276) && (cc != kpp5) ) {
449  spectra->SetTabParameter(tab,tabUnc);
450  }
451  if ( cc == kpPb0100 || cc == kpPb020 || cc == kpPb1020 || cc == kpPb2040 || cc == kpPb4060 || cc == kpPb60100 ) {
452  spectra->SetCollisionType(2);
453  } else if ( !( cc==kpp7 || cc==kpp8 || cc==kpp276 || cc==kpp5 ) ) {
454  spectra->SetCollisionType(1);
455  }
456 
457  // Set the systematics externally
458 
459  Bool_t combineFeedDown = true;
460  AliHFSystErr *systematics = new AliHFSystErr();
461  if(year==k2010) systematics->SetRunNumber(10);
462  else if(year==k2011) systematics->SetRunNumber(11);
463  else if(year==k2012) systematics->SetRunNumber(12);
464  else if(year==k2013) systematics->SetRunNumber(13);
465  else if(year==k2015) systematics->SetRunNumber(15);
466  else if(year==k2016) systematics->SetRunNumber(16);
467  else if(year==k2017) systematics->SetRunNumber(17);
468  else if(year==k2018) systematics->SetRunNumber(18);
469 
470  if( cc==kpp276 ) {
471  systematics->SetIsLowEnergy(true);
472  }
473  else if (cc==kpp8){
474  systematics->SetRunNumber(12);
475  }
476  else if (cc==kpp5){
477  systematics->SetIs5TeVAnalysis(true);
478  systematics->SetCollisionType(0);
479  }
480  else if ( cc == kpPb0100 || cc == kpPb010 || cc == kpPb020 || cc == kpPb1020 || cc == kpPb2040 || cc == kpPb4060 || cc == kpPb60100 ) {
481  systematics->SetCollisionType(2);
482 
483  // Rapidity slices
484  if(rapiditySlice!=kdefault){
485  systematics->SetIspPb2011RapidityScan(true);
486  TString rapidity="";
487  switch(rapiditySlice) {
488  case k08to04: rapidity="0804"; break;
489  case k07to04: rapidity="0804"; break;
490  case k04to01: rapidity="0401"; break;
491  case k01to01: rapidity="0101"; break;
492  case k01to04: rapidity="0104"; break;
493  case k04to07: rapidity="0408"; break;
494  case k04to08: rapidity="0408"; break;
495  case k01to05: rapidity="0401"; break;
496  }
497  systematics->SetRapidity(rapidity);
498  }
499  // Centrality slices
500  if(ccestimator==kV0A) {
501  if(cc == kpPb020) systematics->SetCentrality("020V0A");
502  else if(cc == kpPb2040) systematics->SetCentrality("2040V0A");
503  else if(cc == kpPb4060) systematics->SetCentrality("4060V0A");
504  else if(cc == kpPb60100) systematics->SetCentrality("60100V0A");
505  } else if (ccestimator==kZNA) {
506  if(cc == kpPb010) {systematics->SetCentrality("010ZNA");}
507  else if(cc == kpPb020) systematics->SetCentrality("020ZNA");
508  else if(cc == kpPb1020) systematics->SetCentrality("1020ZNA");
509  else if(cc == kpPb2040) systematics->SetCentrality("2040ZNA");
510  else if(cc == kpPb4060) systematics->SetCentrality("4060ZNA");
511  else if(cc == kpPb60100) systematics->SetCentrality("60100ZNA");
512  } else if (ccestimator==kCL1) {
513  if(cc == kpPb020) systematics->SetCentrality("020CL1");
514  else if(cc == kpPb2040) systematics->SetCentrality("2040CL1");
515  else if(cc == kpPb4060) systematics->SetCentrality("4060CL1");
516  else if(cc == kpPb60100) systematics->SetCentrality("60100CL1");
517  } else {
518  if(!(cc == kpPb0100)) {
519  cout <<" Error on the pPb options"<<endl;
520  return;
521  }
522  }
523  }
524  //
525  else if( cc!=kpp7 ) {
526  systematics->SetCollisionType(1);
527  if(Energy==k276){
528  if ( cc == k07half ) systematics->SetCentrality("07half");
529  else if ( cc == k010 ) systematics->SetCentrality("010");
530  else if ( cc == k1020 ) systematics->SetCentrality("1020");
531  else if ( cc == k020 ) systematics->SetCentrality("020");
532  else if ( cc == k2040 || cc == k2030 || cc == k3040 ) {
533  systematics->SetCentrality("2040");
534  systematics->SetIsPbPb2010EnergyScan(true);
535  }
536  else if ( cc == k3050 ) {
537  if (isRaavsEP == kPhiIntegrated) systematics->SetCentrality("4080");
538  else if (isRaavsEP == kInPlane) systematics->SetCentrality("3050InPlane");
539  else if (isRaavsEP == kOutOfPlane) systematics->SetCentrality("3050OutOfPlane");
540  }
541  else if ( cc == k4060 || cc == k4050 || cc == k5060 ) systematics->SetCentrality("4060");
542  else if ( cc == k6080 ) systematics->SetCentrality("6080");
543  else if ( cc == k4080 ) systematics->SetCentrality("4080");
544  } else if (Energy==k5dot023){
545  if ( cc == k010 ){
546  systematics->SetCentrality("010");
547  } else if ( cc == k1030 ) {
548  systematics->SetCentrality("3050"); //no systematics available for 10--30
549  } else if ( cc == k3050 ) {
550  systematics->SetCentrality("3050");
551  } else if ( cc == k6080 ) {
552  systematics->SetCentrality("6080");
553  }
554  }
555  else {
556  cout << " Systematics not yet implemented " << endl;
557  return;
558  }
559  } else { systematics->SetCollisionType(0); }
560  if(analysisSpeciality==kLowPt){
561  systematics->SetIsLowPtAnalysis(true);
562  }
563  else if(analysisSpeciality==kPP7TeVPass4){
564  systematics->SetIsPass4Analysis(kTRUE);
565  }
566  else if(analysisSpeciality==kBDT){
567  systematics->SetIsBDTAnalysis(kTRUE);
568  }
569  //
570  systematics->Init(decay);
571  spectra->SetSystematicUncertainty(systematics);
572 
573  // Do the calculations
574  cout << " Doing the calculation... "<< endl;
575  Double_t deltaY = 1.0;
576  Double_t branchingRatioC = 1.0;
577  Double_t branchingRatioBintoFinalDecay = 1.0; // this is relative to the input theoretical prediction
578  spectra->ComputeHFPtSpectrum(deltaY,branchingRatioC,branchingRatioBintoFinalDecay);
579  spectra->ComputeSystUncertainties(combineFeedDown);
580  cout << " ended the calculation, getting the histograms back " << endl;
581 
582 
583 
584  //
585  // Get the output histograms
586  //
587  // the corrected yield and cross-section
588  histoYieldCorr = (TH1D*)spectra->GetHistoFeedDownCorrectedSpectrum();
589  histoSigmaCorr = (TH1D*)spectra->GetHistoCrossSectionFromYieldSpectrum();
590  histoYieldCorrMax = (TH1D*)spectra->GetHistoUpperLimitFeedDownCorrectedSpectrum();
591  histoYieldCorrMin = (TH1D*)spectra->GetHistoLowerLimitFeedDownCorrectedSpectrum();
592  histoSigmaCorrMax = (TH1D*)spectra->GetHistoUpperLimitCrossSectionFromYieldSpectrum();
593  histoSigmaCorrMin = (TH1D*)spectra->GetHistoLowerLimitCrossSectionFromYieldSpectrum();
594  histoYieldCorr->SetNameTitle("histoYieldCorr","corrected yield");
595  histoYieldCorrMax->SetNameTitle("histoYieldCorrMax","max corrected yield");
596  histoYieldCorrMin->SetNameTitle("histoYieldCorrMin","min corrected yield");
597  histoSigmaCorr->SetNameTitle("histoSigmaCorr","corrected invariant cross-section");
598  histoSigmaCorrMax->SetNameTitle("histoSigmaCorrMax","max corrected invariant cross-section");
599  histoSigmaCorrMin->SetNameTitle("histoSigmaCorrMin","min corrected invariant cross-section");
600  // the efficiencies
601  if(!hDirectEffpt) hDirectEffpt = (TH1D*)spectra->GetDirectAccEffCorrection();
602  if(!hFeedDownEffpt) hFeedDownEffpt = (TH1D*)spectra->GetFeedDownAccEffCorrection();
603  // Get the PbPb Eloss hypothesis histograms
604  if(PbPbEloss){
605  histofcRcb = spectra->GetHistoFeedDownCorrectionFcVsEloss();
606  histoYieldCorrRcb = spectra->GetHistoFeedDownCorrectedSpectrumVsEloss();
607  histoSigmaCorrRcb = spectra->GetHistoCrossSectionFromYieldSpectrumVsEloss();
608  histofcRcb->SetName("histofcRcb");
609  histoYieldCorrRcb->SetName("histoYieldCorrRcb");
610  histoSigmaCorrRcb->SetName("histoSigmaCorrRcb");
611  }
612 
613  // Get & Rename the TGraphs
614  gSigmaCorr = spectra->GetCrossSectionFromYieldSpectrum();
615  gYieldCorr = spectra->GetFeedDownCorrectedSpectrum();
616  if (asym) {
617  gSigmaCorrExtreme = spectra->GetCrossSectionFromYieldSpectrumExtreme();
618  gYieldCorrExtreme = spectra->GetFeedDownCorrectedSpectrumExtreme();
619  gSigmaCorrConservative = spectra->GetCrossSectionFromYieldSpectrumConservative();
620  gYieldCorrConservative = spectra->GetFeedDownCorrectedSpectrumConservative();
621  }
622 
623  // Get & Rename the TGraphs
624  if (option==0){
625  gYieldCorr->SetNameTitle("gYieldCorr","gYieldCorr (uncorr)");
626  gSigmaCorr->SetNameTitle("gSigmaCorr","gSigmaCorr (uncorr)");
627  }
628  if (option==1){
629  // fc histos
630  histofc = (TH1D*)spectra->GetHistoFeedDownCorrectionFc();
631  histofcMax = (TH1D*)spectra->GetHistoUpperLimitFeedDownCorrectionFc();
632  histofcMin = (TH1D*)spectra->GetHistoLowerLimitFeedDownCorrectionFc();
633  histofc->SetNameTitle("histofc","fc correction factor");
634  histofcMax->SetNameTitle("histofcMax","max fc correction factor");
635  histofcMin->SetNameTitle("histofcMin","min fc correction factor");
636  if (asym) {
637  gYieldCorr->SetNameTitle("gYieldCorr","gYieldCorr (by fc)");
638  gSigmaCorr->SetNameTitle("gSigmaCorr","gSigmaCorr (by fc)");
639  gFcExtreme = spectra->GetFeedDownCorrectionFcExtreme();
640  gFcExtreme->SetNameTitle("gFcExtreme","gFcExtreme");
641  gYieldCorrExtreme->SetNameTitle("gYieldCorrExtreme","Extreme gYieldCorr (by fc)");
642  gSigmaCorrExtreme->SetNameTitle("gSigmaCorrExtreme","Extreme gSigmaCorr (by fc)");
643  gFcConservative = spectra->GetFeedDownCorrectionFcConservative();
644  gFcConservative->SetNameTitle("gFcConservative","gFcConservative");
645  gYieldCorrConservative->SetNameTitle("gYieldCorrConservative","Conservative gYieldCorr (by fc)");
646  gSigmaCorrConservative->SetNameTitle("gSigmaCorrConservative","Conservative gSigmaCorr (by fc)");
647  }
648  }
649  if (option==2 && asym) {
650  gYieldCorr->SetNameTitle("gYieldCorr","gYieldCorr (by Nb)");
651  gSigmaCorr->SetNameTitle("gSigmaCorr","gSigmaCorr (by Nb)");
652  gYieldCorrExtreme->SetNameTitle("gYieldCorrExtreme","Extreme gYieldCorr (by Nb)");
653  gSigmaCorrExtreme->SetNameTitle("gSigmaCorrExtreme","Extreme gSigmaCorr (by Nb)");
654  gYieldCorrConservative->SetNameTitle("gYieldCorrConservative","Conservative gYieldCorr (by Nb)");
655  gSigmaCorrConservative->SetNameTitle("gSigmaCorrConservative","Conservative gSigmaCorr (by Nb)");
656  gFcConservative = spectra->GetFeedDownCorrectionFcConservative();
657  gFcConservative->SetNameTitle("gFcConservative","gFcConservative");
658  }
659 
660  if(PbPbEloss){
661  nSigma = spectra->GetNtupleCrossSectionVsEloss();
662  }
663 
664  //
665  // Now, plot the results ! :)
666  //
667 
668  gROOT->SetStyle("Plain");
669 
670  cout << " Drawing the results ! " << endl;
671 
672  // control plots
673  if (option==1) {
674 
675  TCanvas *ceff = new TCanvas("ceff","efficiency drawing");
676  ceff->Divide(1,2);
677  ceff->cd(1);
678  hDirectEffpt->Draw();
679  ceff->cd(2);
680  hFeedDownEffpt->Draw();
681  ceff->Update();
682 
683  TCanvas *cTheoryRebin = new TCanvas("cTheoryRebin","control the theoretical spectra rebin");
684  cTheoryRebin->Divide(1,2);
685  cTheoryRebin->cd(1);
686  hDirectMCpt->Draw("");
687  TH1D *hDirectMCptRebin = (TH1D*)spectra->GetDirectTheoreticalSpectrum();
688  hDirectMCptRebin->SetLineColor(2);
689  hDirectMCptRebin->Draw("same");
690  cTheoryRebin->cd(2);
691  hFeedDownMCpt->Draw("");
692  TH1D *hFeedDownRebin = (TH1D*)spectra->GetFeedDownTheoreticalSpectrum();
693  hFeedDownRebin->SetLineColor(2);
694  hFeedDownRebin->Draw("same");
695  cTheoryRebin->Update();
696 
697  TCanvas *cTheoryRebinLimits = new TCanvas("cTheoryRebinLimits","control the theoretical spectra limits rebin");
698  cTheoryRebinLimits->Divide(1,2);
699  cTheoryRebinLimits->cd(1);
700  hDirectMCptMax->Draw("");
701  TH1D *hDirectMCptMaxRebin = (TH1D*)spectra->GetDirectTheoreticalUpperLimitSpectrum();
702  hDirectMCptMaxRebin->SetLineColor(2);
703  hDirectMCptMaxRebin->Draw("same");
704  hDirectMCptMin->Draw("same");
705  TH1D *hDirectMCptMinRebin = (TH1D*)spectra->GetDirectTheoreticalLowerLimitSpectrum();
706  hDirectMCptMinRebin->SetLineColor(2);
707  hDirectMCptMinRebin->Draw("same");
708  cTheoryRebinLimits->cd(2);
709  hFeedDownMCptMax->Draw("");
710  TH1D *hFeedDownMaxRebin = (TH1D*)spectra->GetFeedDownTheoreticalUpperLimitSpectrum();
711  hFeedDownMaxRebin->SetLineColor(2);
712  hFeedDownMaxRebin->Draw("same");
713  hFeedDownMCptMin->Draw("same");
714  TH1D *hFeedDownMinRebin = (TH1D*)spectra->GetFeedDownTheoreticalLowerLimitSpectrum();
715  hFeedDownMinRebin->SetLineColor(2);
716  hFeedDownMinRebin->Draw("same");
717  cTheoryRebinLimits->Update();
718  }
719 
720  if (option==1) {
721 
722  TCanvas * cfc = new TCanvas("cfc","Fc");
723  histofcMax->Draw("c");
724  histofc->Draw("csame");
725  histofcMin->Draw("csame");
726  cfc->Update();
727 
728  if (asym) {
729  TH2F *histofcDraw= new TH2F("histofcDraw","histofc (for drawing)",100,0,33.25,100,0.01,1.25);
730  histofcDraw->SetStats(0);
731  histofcDraw->GetXaxis()->SetTitle("p_{T} [GeV]");
732  histofcDraw ->GetXaxis()->SetTitleSize(0.05);
733  histofcDraw->GetXaxis()->SetTitleOffset(0.95);
734  histofcDraw->GetYaxis()->SetTitle(" fc ");
735  histofcDraw->GetYaxis()->SetTitleSize(0.05);
736 
737  if (gFcExtreme){
738 
739 // for(Int_t item=0; item<gSigmaCorr->GetN(); item++){
740 // Double_t center=0., value=0.;
741 // gFcExtreme->GetPoint(item,center,value);
742 // Double_t highunc = gFcExtreme->GetErrorYhigh(item) / value ;
743 // Double_t lowunc = gFcExtreme->GetErrorYlow(item) / value ;
744 // cout << "Fc extreme: i=" << item << ", center=" << center <<", value=" << value << " high unc=" << highunc*100 << "%, low unc=" << lowunc*100 << "%"<<endl;
745 // }
746 // for(Int_t item=0; item<gSigmaCorr->GetN(); item++){
747 // Double_t center=0., value=0.;
748 // gFcConservative->GetPoint(item,center,value);
749 // Double_t highunc = gFcConservative->GetErrorYhigh(item) / value ;
750 // Double_t lowunc = gFcConservative->GetErrorYlow(item) / value ;
751 // cout << "Fc conservative: i=" << item << ", center=" << center <<", value=" << value << " high unc=" << highunc*100 << "%, low unc=" << lowunc*100 << "%"<<endl;
752 // }
753  TCanvas *cfcExtreme = new TCanvas("cfcExtreme","Extreme Asymmetric fc (TGraphAsymmErr)");
754  gFcExtreme->SetFillStyle(3006);
755  gFcExtreme->SetLineWidth(3);
756  gFcExtreme->SetMarkerStyle(20);
757  gFcExtreme->SetFillColor(2);
758  histofcDraw->Draw();
759  gFcExtreme->Draw("3same");
760 
761  if(gFcConservative){
762  gFcConservative->SetFillStyle(3007);
763  gFcConservative->SetFillColor(4);
764  gFcConservative->Draw("3same");
765  }
766 
767  cfcExtreme->Update();
768  }
769  }
770 
771  }
772 
773  //
774  // Drawing the results (the raw-reconstructed, the expected, and the corrected spectra)
775  //
776  TCanvas * cresult = new TCanvas("cresult","corrected yields & sigma");
777  hDirectMCpt->SetMarkerStyle(20);
778  hDirectMCpt->SetMarkerColor(4);
779  hDirectMCpt->Draw("p");
780  histoSigmaCorr->SetMarkerStyle(21);
781  histoSigmaCorr->SetMarkerColor(2);
782  histoSigmaCorr->Draw("psame");
783  histoYieldCorr->SetMarkerStyle(22);
784  histoYieldCorr->SetMarkerColor(6);
785  histoYieldCorr->Draw("psame");
786  hRECpt->SetMarkerStyle(23);
787  hRECpt->SetMarkerColor(3);
788  hRECpt->Draw("psame");
789  cresult->SetLogy();
790  cresult->Update();
791 
792  TCanvas * cresult2 = new TCanvas("cresult2","corrected yield & sigma");
793  histoSigmaCorr->SetMarkerStyle(21);
794  histoSigmaCorr->SetMarkerColor(2);
795  histoSigmaCorr->Draw("p");
796  histoYieldCorr->SetMarkerStyle(22);
797  histoYieldCorr->SetMarkerColor(6);
798  histoYieldCorr->Draw("psame");
799  hRECpt->SetMarkerStyle(23);
800  hRECpt->SetMarkerColor(3);
801  hRECpt->Draw("psame");
802  cresult2->SetLogy();
803  cresult2->Update();
804 
805 
806  if (asym) {
807 
808  TH2F *histoDraw = new TH2F("histoDraw","histo (for drawing)",100,0,33.25,100,50.,1e7);
809  float max = 1.1*gYieldCorr->GetMaximum();
810  histoDraw->SetAxisRange(0.1,max,"Y");
811  histoDraw->SetStats(0);
812  histoDraw->GetXaxis()->SetTitle("p_{T} [GeV]");
813  histoDraw->GetXaxis()->SetTitleSize(0.05);
814  histoDraw->GetXaxis()->SetTitleOffset(0.95);
815  histoDraw->GetYaxis()->SetTitle("#frac{d#N}{dp_{T}} |_{|y|<1} [L & trigger uncorr]");
816  histoDraw->GetYaxis()->SetTitleSize(0.05);
817  TCanvas * cyieldAsym = new TCanvas("cyieldAsym","Asymmetric corrected yield (TGraphAsymmErr)");
818  gYieldCorr->SetFillStyle(3001);
819  gYieldCorr->SetLineWidth(3);
820  gYieldCorr->SetMarkerStyle(20);
821  gYieldCorr->SetFillColor(3);
822  histoDraw->Draw();
823  gYieldCorr->Draw("3LPsame");
824  gYieldCorr->Draw("Xsame");
825  cyieldAsym->SetLogy();
826  cyieldAsym->Update();
827 
828  TCanvas * cyieldExtreme = new TCanvas("cyieldExtreme","Extreme Asymmetric corrected yield (TGraphAsymmErr)");
829  histoYieldCorr->Draw();
830  gYieldCorrExtreme->SetFillStyle(3002);
831  gYieldCorrExtreme->SetLineWidth(3);
832  gYieldCorrExtreme->SetMarkerStyle(20);
833  gYieldCorrExtreme->SetFillColor(2);
834  histoYieldCorr->Draw();
835  gYieldCorr->Draw("3same");
836  gYieldCorrExtreme->Draw("3same");
837  cyieldExtreme->SetLogy();
838  cyieldExtreme->Update();
839 
840  TH2F *histo2Draw = new TH2F("histo2Draw","histo2 (for drawing)",100,0,33.25,100,50.,1e9);
841  max = 1.1*gSigmaCorr->GetMaximum();
842  histo2Draw->SetAxisRange(0.1,max,"Y");
843  histo2Draw->SetStats(0);
844  histo2Draw->GetXaxis()->SetTitle("p_{T} [GeV]");
845  histo2Draw->GetXaxis()->SetTitleSize(0.05);
846  histo2Draw->GetXaxis()->SetTitleOffset(0.95);
847  histo2Draw->GetYaxis()->SetTitle("#frac{1}{BR} #times #frac{d#sigma}{dp_{T}} |_{|y|<1}");
848  histo2Draw->GetYaxis()->SetTitleSize(0.05);
849  TCanvas * csigmaAsym = new TCanvas("csigmaAsym","Asymmetric corrected sigma (TGraphAsymmErr)");
850  gSigmaCorr->SetFillStyle(3001);
851  gSigmaCorr->SetLineWidth(3);
852  gSigmaCorr->SetMarkerStyle(21);
853  gSigmaCorr->SetFillColor(3);
854  histo2Draw->Draw();
855  gSigmaCorr->Draw("3LPsame");
856  gSigmaCorr->Draw("Xsame");
857  csigmaAsym->SetLogy();
858  csigmaAsym->Update();
859 
860 // cout << endl <<" Sytematics (stat approach) " <<endl;
861 // for(Int_t item=0; item<gSigmaCorr->GetN(); item++){
862 // Double_t center=0., value=0.;
863 // gSigmaCorr->GetPoint(item,center,value);
864 // Double_t highunc = gSigmaCorr->GetErrorYhigh(item) / value ;
865 // Double_t lowunc = gSigmaCorr->GetErrorYlow(item) / value ;
866 // cout << "Sigma syst (stat), i=" << item << ", center=" << center <<", value=" << value << " high unc=" << highunc*100 << "%, low unc=" << lowunc*100 << "%"<<endl;
867 // }
868 
869  TCanvas * csigmaExtreme = new TCanvas("csigmaExtreme","Asymmetric extreme corrected sigma (TGraphAsymmErr)");
870  histoSigmaCorr->Draw();
871  gSigmaCorr->Draw("3Psame");
872  gSigmaCorrExtreme->SetFillStyle(3002);
873  gSigmaCorrExtreme->SetLineWidth(3);
874  gSigmaCorrExtreme->SetMarkerStyle(21);
875  gSigmaCorrExtreme->SetFillColor(2);
876  gSigmaCorrExtreme->Draw("3Psame");
877  csigmaExtreme->SetLogy();
878  csigmaExtreme->Update();
879 
880 // cout << endl << " Sytematics (Extreme approach)" <<endl;
881 // for(Int_t item=0; item<gSigmaCorrExtreme->GetN(); item++){
882 // Double_t center=0., value=0.;
883 // gSigmaCorrExtreme->GetPoint(item,center,value);
884 // Double_t highunc = gSigmaCorrExtreme->GetErrorYhigh(item) / value ;
885 // Double_t lowunc = gSigmaCorrExtreme->GetErrorYlow(item) / value ;
886 // cout << "Sigma syst (extreme) i=" << item << ", center=" << center <<", value=" << value << " high unc=" << highunc*100 << "%, low unc=" << lowunc*100 << "%"<<endl;
887 // }
888 
889 // cout << endl << " Sytematics (Conservative approach)" <<endl;
890 // for(Int_t item=0; item<gSigmaCorrConservative->GetN(); item++){
891 // Double_t center=0., value=0.;
892 // gSigmaCorrConservative->GetPoint(item,center,value);
893 // Double_t highunc = gSigmaCorrConservative->GetErrorYhigh(item) / value ;
894 // Double_t lowunc = gSigmaCorrConservative->GetErrorYlow(item) / value ;
895 // cout << "Sigma syst (conservative) i=" << item << ", center=" << center <<", value=" << value << " high unc=" << highunc*100 << "%, low unc=" << lowunc*100 << "%"<<endl;
896 // }
897 
898  }
899 
900  // Draw the PbPb Eloss hypothesis histograms
901  if(PbPbEloss){
902  AliHFPtSpectrum *CalcBins=NULL;
903  gStyle->SetPalette(1);
904  TCanvas *canvasfcRcb = new TCanvas("canvasfcRcb","fc vs pt vs Rcb");
905  // histofcRcb->Draw("cont4z");
906  histofcRcb->Draw("colz");
907  canvasfcRcb->Update();
908  canvasfcRcb->cd(2);
909  TCanvas *canvasfcRcb1 = new TCanvas("canvasfcRcb1","fc vs pt vs Rcb=1");
910  histofcRcb_px = (TH1D*)histofcRcb->ProjectionX("histofcRcb_px",40,40);
911  histofcRcb_px->SetLineColor(2);
912  if (option==1) {
913  histofc->Draw();
914  histofcRcb_px->Draw("same");
915  } else histofcRcb_px->Draw("");
916  canvasfcRcb1->Update();
917  TCanvas *canvasfcRcb2 = new TCanvas("canvasfcRcb2","fc vs pt vs Rcb fixed Rcb");
918  Int_t bin0 = CalcBins->FindTH2YBin(histofcRcb,0.25);
919  Int_t bin1 = CalcBins->FindTH2YBin(histofcRcb,0.5);
920  Int_t bin2 = CalcBins->FindTH2YBin(histofcRcb,1.0);
921  Int_t bin3 = CalcBins->FindTH2YBin(histofcRcb,1.5);
922  Int_t bin4 = CalcBins->FindTH2YBin(histofcRcb,2.0);
923  Int_t bin5 = CalcBins->FindTH2YBin(histofcRcb,3.0);
924  Int_t bin6 = CalcBins->FindTH2YBin(histofcRcb,4.0);
925  TH1D * histofcRcb_px0a = (TH1D*)histofcRcb->ProjectionX("histofcRcb_px0a",bin0,bin0);
926  TH1D * histofcRcb_px0 = (TH1D*)histofcRcb->ProjectionX("histofcRcb_px0",bin1,bin1);
927  TH1D * histofcRcb_px1 = (TH1D*)histofcRcb->ProjectionX("histofcRcb_px1",bin2,bin2);
928  TH1D * histofcRcb_px2 = (TH1D*)histofcRcb->ProjectionX("histofcRcb_px2",bin3,bin3);
929  TH1D * histofcRcb_px3 = (TH1D*)histofcRcb->ProjectionX("histofcRcb_px3",bin4,bin4);
930  TH1D * histofcRcb_px4 = (TH1D*)histofcRcb->ProjectionX("histofcRcb_px4",bin5,bin5);
931  TH1D * histofcRcb_px5 = (TH1D*)histofcRcb->ProjectionX("histofcRcb_px5",bin6,bin6);
932  if (option==1) {
933  histofc->Draw();
934  // histofcRcb_px->Draw("same");
935  } else {
936  // histofcRcb_px->Draw("");
937  histofcRcb_px0a->SetLineColor(2);
938  histofcRcb_px0a->Draw("");
939  }
940  histofcRcb_px0a->SetLineColor(2);
941  histofcRcb_px0a->Draw("same");
942  histofcRcb_px0->SetLineColor(4);
943  histofcRcb_px0->Draw("same");
944  histofcRcb_px1->SetLineColor(3);
945  histofcRcb_px1->Draw("same");
946  histofcRcb_px2->SetLineColor(kCyan);
947  histofcRcb_px2->Draw("same");
948  histofcRcb_px3->SetLineColor(kMagenta+1);
949  histofcRcb_px3->Draw("same");
950  histofcRcb_px4->SetLineColor(kOrange+7);
951  histofcRcb_px4->Draw("same");
952  histofcRcb_px5->SetLineColor(kGreen+3);
953  histofcRcb_px5->Draw("same");
954  TLegend *legrcc = new TLegend(0.8,0.8,0.95,0.9);
955  legrcc->SetFillColor(0);
956  if (option==1) {
957  legrcc->AddEntry(histofcRcb_px0a,"Rc/b=0.25","l");
958  legrcc->AddEntry(histofcRcb_px0,"Rc/b=0.5","l");
959  legrcc->AddEntry(histofcRcb_px1,"Rc/b=1.0","l");
960  legrcc->AddEntry(histofcRcb_px2,"Rc/b=1.5","l");
961  legrcc->AddEntry(histofcRcb_px3,"Rc/b=2.0","l");
962  legrcc->AddEntry(histofcRcb_px4,"Rc/b=3.0","l");
963  legrcc->AddEntry(histofcRcb_px5,"Rc/b=4.0","l");
964  }else{
965  legrcc->AddEntry(histofcRcb_px0a,"Rb=0.25","l");
966  legrcc->AddEntry(histofcRcb_px0,"Rb=0.5","l");
967  legrcc->AddEntry(histofcRcb_px1,"Rb=1.0","l");
968  legrcc->AddEntry(histofcRcb_px2,"Rb=1.5","l");
969  legrcc->AddEntry(histofcRcb_px3,"Rb=2.0","l");
970  legrcc->AddEntry(histofcRcb_px4,"Rb=3.0","l");
971  legrcc->AddEntry(histofcRcb_px5,"Rb=4.0","l");
972  }
973  legrcc->Draw();
974  canvasfcRcb2->Update();
975  TCanvas *canvasYRcb = new TCanvas("canvasYRcb","corrected yield vs pt vs Rcb");
976  histoYieldCorrRcb->Draw("cont4z");
977  canvasYRcb->Update();
978  TCanvas *canvasSRcb = new TCanvas("canvasSRcb","sigma vs pt vs Rcb");
979  histoSigmaCorrRcb->Draw("cont4z");
980  canvasSRcb->Update();
981  TCanvas *canvasSRcb1 = new TCanvas("canvasSRcb1","sigma vs pt vs Rcb fixed Rcb");
982  TH1D * histoSigmaCorrRcb_px0a = (TH1D*)histoSigmaCorrRcb->ProjectionX("histoSigmaCorrRcb_px0a",bin0,bin0);
983  TH1D * histoSigmaCorrRcb_px0 = (TH1D*)histoSigmaCorrRcb->ProjectionX("histoSigmaCorrRcb_px0",bin1,bin1);
984  TH1D * histoSigmaCorrRcb_px1 = (TH1D*)histoSigmaCorrRcb->ProjectionX("histoSigmaCorrRcb_px1",bin2,bin2);
985  TH1D * histoSigmaCorrRcb_px2 = (TH1D*)histoSigmaCorrRcb->ProjectionX("histoSigmaCorrRcb_px2",bin3,bin3);
986  TH1D * histoSigmaCorrRcb_px3 = (TH1D*)histoSigmaCorrRcb->ProjectionX("histoSigmaCorrRcb_px3",bin4,bin4);
987  TH1D * histoSigmaCorrRcb_px4 = (TH1D*)histoSigmaCorrRcb->ProjectionX("histoSigmaCorrRcb_px4",bin5,bin5);
988  TH1D * histoSigmaCorrRcb_px5 = (TH1D*)histoSigmaCorrRcb->ProjectionX("histoSigmaCorrRcb_px5",bin6,bin6);
989  histoSigmaCorr->Draw();
990  histoSigmaCorrRcb_px0a->SetLineColor(2);
991  histoSigmaCorrRcb_px0a->Draw("hsame");
992  histoSigmaCorrRcb_px0->SetLineColor(4);
993  histoSigmaCorrRcb_px0->Draw("hsame");
994  histoSigmaCorrRcb_px1->SetLineColor(3);
995  histoSigmaCorrRcb_px1->Draw("hsame");
996  histoSigmaCorrRcb_px2->SetLineColor(kCyan);
997  histoSigmaCorrRcb_px2->Draw("hsame");
998  histoSigmaCorrRcb_px3->SetLineColor(kMagenta+1);
999  histoSigmaCorrRcb_px3->Draw("hsame");
1000  histoSigmaCorrRcb_px4->SetLineColor(kOrange+7);
1001  histoSigmaCorrRcb_px4->Draw("same");
1002  histoSigmaCorrRcb_px5->SetLineColor(kGreen+3);
1003  histoSigmaCorrRcb_px5->Draw("same");
1004  TLegend *legrcb = new TLegend(0.8,0.8,0.95,0.9);
1005  legrcb->SetFillColor(0);
1006  if (option==1) {
1007  legrcb->AddEntry(histoSigmaCorrRcb_px0a,"Rc/b=0.25","l");
1008  legrcb->AddEntry(histoSigmaCorrRcb_px0,"Rc/b=0.5","l");
1009  legrcb->AddEntry(histoSigmaCorrRcb_px1,"Rc/b=1.0","l");
1010  legrcb->AddEntry(histoSigmaCorrRcb_px2,"Rc/b=1.5","l");
1011  legrcb->AddEntry(histoSigmaCorrRcb_px3,"Rc/b=2.0","l");
1012  legrcb->AddEntry(histoSigmaCorrRcb_px4,"Rc/b=3.0","l");
1013  legrcb->AddEntry(histoSigmaCorrRcb_px5,"Rc/b=4.0","l");
1014  }else{
1015  legrcb->AddEntry(histoSigmaCorrRcb_px0a,"Rb=0.25","l");
1016  legrcb->AddEntry(histoSigmaCorrRcb_px0,"Rb=0.5","l");
1017  legrcb->AddEntry(histoSigmaCorrRcb_px1,"Rb=1.0","l");
1018  legrcb->AddEntry(histoSigmaCorrRcb_px2,"Rb=1.5","l");
1019  legrcb->AddEntry(histoSigmaCorrRcb_px3,"Rb=2.0","l");
1020  legrcb->AddEntry(histoSigmaCorrRcb_px4,"Rb=3.0","l");
1021  legrcb->AddEntry(histoSigmaCorrRcb_px5,"Rb=4.0","l");
1022  }
1023  legrcb->Draw();
1024  canvasSRcb1->Update();
1025  }
1026 
1027 
1028  //
1029  // Write the histograms to the output file
1030  //
1031  cout << " Saving the results ! " << endl<< endl;
1032 
1033  out->cd();
1034  //
1035  hDirectMCpt->Write(); hFeedDownMCpt->Write();
1036  hDirectMCptMax->Write(); hDirectMCptMin->Write();
1037  hFeedDownMCptMax->Write(); hFeedDownMCptMin->Write();
1038  if(hDirectEffpt) hDirectEffpt->Write(); if(hFeedDownEffpt) hFeedDownEffpt->Write();
1039  hRECpt->Write();
1040  //
1041  histoYieldCorr->Write();
1042  histoYieldCorrMax->Write(); histoYieldCorrMin->Write();
1043  histoSigmaCorr->Write();
1044  histoSigmaCorrMax->Write(); histoSigmaCorrMin->Write();
1045 
1046  if(PbPbEloss){
1047  histofcRcb->Write(); histofcRcb_px->Write();
1048  histoYieldCorrRcb->Write();
1049  histoSigmaCorrRcb->Write();
1050  nSigma->Write();
1051  }
1052 
1053  gYieldCorr->Write();
1054  gSigmaCorr->Write();
1055  if(asym){
1056  if(gYieldCorrExtreme) gYieldCorrExtreme->Write();
1057  if(gSigmaCorrExtreme) gSigmaCorrExtreme->Write();
1058  if(gYieldCorrConservative) gYieldCorrConservative->Write();
1059  if(gSigmaCorrConservative) gSigmaCorrConservative->Write();
1060  if(asym && gFcConservative) gFcConservative->Write();
1061  }
1062 
1063  if(option==1){
1064  histofc->Write();
1065  histofcMax->Write(); histofcMin->Write();
1066  if(asym && gFcExtreme) gFcExtreme->Write();
1067  }
1068 
1069 
1070  TH1D * hStatUncEffcSigma = spectra->GetDirectStatEffUncOnSigma();
1071  TH1D * hStatUncEffbSigma = spectra->GetFeedDownStatEffUncOnSigma();
1072  hStatUncEffcSigma->Write();
1073  hStatUncEffbSigma->Write();
1074  if(option!=0){
1075  TH1D * hStatUncEffcFD = spectra->GetDirectStatEffUncOnFc();
1076  TH1D * hStatUncEffbFD = spectra->GetFeedDownStatEffUncOnFc();
1077  hStatUncEffcFD->Write();
1078  hStatUncEffbFD->Write();
1079  }
1080  systematics->Write();
1081 
1082  // Draw the cross-section
1083  // spectra->DrawSpectrum(gPrediction);
1084 
1085  // out->Close();
1086 
1087 }
particularity
Definition: HFPtSpectrum.C:50
void SetMCptDistributionsBounds(TH1D *hDirectMax, TH1D *hDirectMin, TH1D *hFeedDownMax, TH1D *hFeedDownMin)
Set the theoretical direct & feeddown pt spectrum upper and lower bounds.
void SetIsLowEnergy(Bool_t flag)
Definition: AliHFSystErr.h:79
const Color_t cc[]
Definition: DrawKs.C:1
void SetSystematicUncertainty(AliHFSystErr *syst)
double Double_t
Definition: External.C:58
void SetFeedDownCalculationOption(Int_t option)
Set the calculation option flag for feed-down correction: 0=none, 1=fc , 2=Nb.
Definition: External.C:236
TH1D * GetDirectTheoreticalLowerLimitSpectrum() const
TGraphAsymmErrors * GetFeedDownCorrectionFcExtreme() const
Return the TGraphAsymmErrors of the feed-down correction (extreme systematics)
TGraphAsymmErrors * GetFeedDownCorrectedSpectrumConservative() const
Return the TGraphAsymmErrors of the yield after feed-down correction (feed-down conservative systemat...
BFDSubtrMethod
Definition: HFPtSpectrum.C:47
TH1D * GetHistoFeedDownCorrectionFc() const
Return the histogram of the feed-down correction.
TH1D * GetHistoLowerLimitCrossSectionFromYieldSpectrum() const
energy
Definition: HFPtSpectrum.C:45
TSystem * gSystem
centrality
void SetCentrality(TString centrality)
Definition: AliHFSystErr.h:75
TGraphAsymmErrors * GetFeedDownCorrectionFcConservative() const
Return the TGraphAsymmErrors of the feed-down correction (conservative systematics) ...
TH1D * GetHistoUpperLimitFeedDownCorrectedSpectrum() const
Return the histogram of the yield after feed-down correction bounds.
TH1D * GetFeedDownTheoreticalLowerLimitSpectrum() const
void SetIsPbPb2010EnergyScan(Bool_t flag)
Definition: AliHFSystErr.h:104
TH1D * GetHistoUpperLimitCrossSectionFromYieldSpectrum() const
Return the equivalent invariant cross-section histogram bounds.
TGraphAsymmErrors * GetCrossSectionFromYieldSpectrumConservative() const
Return the equivalent invariant cross-section TGraphAsymmErrors (feed-down conservative systematics) ...
TH1D * GetHistoLowerLimitFeedDownCorrectedSpectrum() const
void SetFeedDownMCptDistributionsBounds(TH1D *hFeedDownMax, TH1D *hFeedDownMin)
Set the theoretical feeddown pt spectrum upper and lower bounds.
TH1D * GetFeedDownStatEffUncOnSigma() const
void SetTriggerEfficiency(Double_t efficiency, Double_t unc)
Set the trigger efficiency and its uncertainty.
void SetIsBDTAnalysis(Bool_t flag)
Definition: AliHFSystErr.h:99
TH1D * GetDirectAccEffCorrection() const
Return the acceptance and efficiency corrections (rebinned if needed)
Double_t * sigma
TH1D * GetHistoUpperLimitFeedDownCorrectionFc() const
Return the histograms of the feed-down correction bounds.
void SetComputeAsymmetricUncertainties(Bool_t flag)
Set if the calculation has to consider asymmetric uncertaInt_ties or not.
int Int_t
Definition: External.C:63
RaavsEP
Definition: HFPtSpectrum.C:48
centestimator
TH2D * GetHistoFeedDownCorrectedSpectrumVsEloss() const
Return the histogram of the yield after feed-down correction vs the Ratio(c/b eloss) ...
TH1D * GetDirectTheoreticalSpectrum() const
TGraphAsymmErrors * GetFeedDownCorrectedSpectrumExtreme() const
Return the TGraphAsymmErrors of the yield after feed-down correction (feed-down extreme systematics) ...
TNtuple * GetNtupleCrossSectionVsEloss()
Return the ntuple of the calculation vs the Ratio(c/b eloss)
void SetAccEffPercentageUncertainty(Double_t globalEffUnc, Double_t globalBCEffRatioUnc)
Set global acceptance x efficiency correction uncertainty (in percentages)
Definition: External.C:228
Definition: External.C:212
TH1D * GetFeedDownAccEffCorrection() const
TH1D * GetHistoFeedDownCorrectedSpectrum() const
Return the histogram of the yield after feed-down correction.
TGraphAsymmErrors * GetCrossSectionFromYieldSpectrum() const
Return the equivalent invariant cross-section TGraphAsymmErrors (systematics but feed-down) ...
TH1D * GetDirectTheoreticalUpperLimitSpectrum() const
rapidity
Definition: HFPtSpectrum.C:49
void SetUsePtDependentEffUncertainty(Bool_t flag)
Setter to switch on the pt dependent efficiency correction uncertainty (feed-down calculation) ...
void SetNormalization(Double_t normalization)
Set the normalization factors.
void SetIsPass4Analysis(Bool_t flag)
Definition: AliHFSystErr.h:87
TGraphAsymmErrors * GetCrossSectionFromYieldSpectrumExtreme() const
Return the equivalent invariant cross-section TGraphAsymmErrors (feed-down extreme systematics) ...
void SetReconstructedSpectrum(TH1D *hRec)
Set the reconstructed spectrum.
TH1D * GetHistoLowerLimitFeedDownCorrectionFc() const
Int_t FindTH2YBin(TH2D *histo, Float_t yvalue)
Functionality to find the y-axis bin of a TH2 for a given y-value.
void SetIsLowPtAnalysis(Bool_t flag)
Definition: AliHFSystErr.h:83
void ComputeSystUncertainties(Bool_t combineFeedDown)
void SetFeedDownMCptSpectra(TH1D *hFeedDown)
Set the theoretical feeddown pt spectrum.
datayear
Definition: HFPtSpectrum.C:46
decay
Definition: HFPtSpectrum.C:42
void Init(Int_t decay)
Function to initialize the variables/histograms.
TH1D * GetDirectStatEffUncOnSigma() const
void SetIspPb2011RapidityScan(Bool_t flag)
Definition: AliHFSystErr.h:114
TH1D * GetHistoCrossSectionFromYieldSpectrum() const
Return the equivalent invariant cross-section histogram.
void SetComputeElossHypothesis(Bool_t flag)
Set if the calculation has to consider Ratio(c/b eloss) hypothesis.
void ComputeHFPtSpectrum(Double_t deltaY=1.0, Double_t branchingRatioC=1.0, Double_t branchingRatioBintoFinalDecay=1.0)
void SetCollisionType(Int_t ct)
void SetAccEffCorrection(TH1D *hDirectEff, TH1D *hFeedDownEff)
Set the acceptance and efficiency corrections for direct & feeddown.
TH1D * GetFeedDownTheoreticalSpectrum() const
Int_t nevents[nsamples]
void SetCollisionType(Int_t type)
Definition: AliHFSystErr.h:66
void HFPtSpectrum(Int_t decayChan=kDplusKpipi, const char *mcfilename="FeedDownCorrectionMC.root", const char *efffilename="Efficiencies.root", const char *recofilename="Reconstructed.root", const char *recohistoname="hRawSpectrumD0", const char *outfilename="HFPtSpectrum.root", Int_t fdMethod=kNb, Double_t nevents=1.0, Double_t sigma=1.0, Bool_t isParticlePlusAntiParticleYield=true, Int_t cc=kpp7, Int_t year=k2010, Bool_t PbPbEloss=false, Int_t Energy=k276, Int_t ccestimator=kV0M, Int_t isRaavsEP=kPhiIntegrated, const char *epResolfile="", Int_t rapiditySlice=kdefault, Int_t analysisSpeciality=kTopological, Bool_t setUsePtDependentEffUncertainty=true)
Definition: HFPtSpectrum.C:52
void SetIs5TeVAnalysis(Bool_t flag)
Definition: AliHFSystErr.h:91
void SetIsEventPlaneAnalysis(Bool_t flag)
TH1D * GetFeedDownTheoreticalUpperLimitSpectrum() const
bool Bool_t
Definition: External.C:53
void SetIsParticlePlusAntiParticleYield(Bool_t flag)
Set if the yield is for particle plus anti-particle or not.
TGraphAsymmErrors * GetFeedDownCorrectedSpectrum() const
Return the TGraphAsymmErrors of the yield after feed-down correction (systematics but feed-down) ...
void SetRapidity(TString rapidity)
Settings of rapidity ranges for pPb 0-100% CC.
Definition: AliHFSystErr.h:110
void SetMCptSpectra(TH1D *hDirect, TH1D *hFeedDown)
TH2D * GetHistoCrossSectionFromYieldSpectrumVsEloss() const
void SetRunNumber(Int_t number)
Definition: AliHFSystErr.h:59
TH2D * GetHistoFeedDownCorrectionFcVsEloss() const
Return the histogram of the feed-down correction times the Ratio(c/b eloss)
void SetLuminosity(Double_t luminosity, Double_t unc)
Set the luminosity and its uncertainty.
TH1D * GetFeedDownStatEffUncOnFc() const
TH1D * GetDirectStatEffUncOnFc() const
Histograms to keep track of the influence of the efficiencies statistical uncertainty on the feed-dow...
void SetTabParameter(Double_t tabvalue, Double_t uncertainty)
Set the Tab parameter and its uncertainty.