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