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