AliPhysics  56f1704 (56f1704)
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) && (cc != kpp5) ) {
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 || cc==kpp5 ) ) {
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==kpp5){
428  systematics->SetIs5TeVAnalysis(true);
429  systematics->SetRunNumber(17);
430  systematics->SetCollisionType(0);
431  }
432  else if ( cc == kpPb0100 || cc == kpPb010 || cc == kpPb020 || cc == kpPb2040 || cc == kpPb4060 || cc == kpPb60100 ) {
433  systematics->SetCollisionType(2);
434  systematics->SetRunNumber(16);//check this
435 
436  // Rapidity slices
437  if(rapiditySlice!=kdefault){
438  systematics->SetIspPb2011RapidityScan(true);
439  TString rapidity="";
440  switch(rapiditySlice) {
441  case k08to04: rapidity="0804"; break;
442  case k07to04: rapidity="0804"; break;
443  case k04to01: rapidity="0401"; break;
444  case k01to01: rapidity="0101"; break;
445  case k01to04: rapidity="0104"; break;
446  case k04to07: rapidity="0408"; break;
447  case k04to08: rapidity="0408"; break;
448  case k01to05: rapidity="0401"; break;
449  }
450  systematics->SetRapidity(rapidity);
451  }
452  // Centrality slices
453  if(ccestimator==kV0A) {
454  if(cc == kpPb020) systematics->SetCentrality("020V0A");
455  else if(cc == kpPb2040) systematics->SetCentrality("2040V0A");
456  else if(cc == kpPb4060) systematics->SetCentrality("4060V0A");
457  else if(cc == kpPb60100) systematics->SetCentrality("60100V0A");
458  } else if (ccestimator==kZNA) {
459  if(cc == kpPb010){systematics->SetRunNumber(2016); systematics->SetCentrality("010ZNA");}
460  else if(cc == kpPb020) systematics->SetCentrality("020ZNA");
461  else if(cc == kpPb2040) systematics->SetCentrality("2040ZNA");
462  else if(cc == kpPb4060) systematics->SetCentrality("4060ZNA");
463  else if(cc == kpPb60100){systematics->SetRunNumber(2016); systematics->SetCentrality("60100ZNA");}
464  } else if (ccestimator==kCL1) {
465  if(cc == kpPb020) systematics->SetCentrality("020CL1");
466  else if(cc == kpPb2040) systematics->SetCentrality("2040CL1");
467  else if(cc == kpPb4060) systematics->SetCentrality("4060CL1");
468  else if(cc == kpPb60100) systematics->SetCentrality("60100CL1");
469  } else {
470  if(!(cc == kpPb0100)) {
471  cout <<" Error on the pPb options"<<endl;
472  return;
473  }
474  }
475  }
476  //
477  else if( cc!=kpp7 ) {
478  systematics->SetCollisionType(1);
479  if(Energy==k276){
480  if ( cc == k07half ) systematics->SetCentrality("07half");
481  else if ( cc == k010 ) systematics->SetCentrality("010");
482  else if ( cc == k1020 ) systematics->SetCentrality("1020");
483  else if ( cc == k020 ) systematics->SetCentrality("020");
484  else if ( cc == k2040 || cc == k2030 || cc == k3040 ) {
485  systematics->SetCentrality("2040");
486  systematics->SetIsPbPb2010EnergyScan(true);
487  }
488  else if ( cc == k3050 ) {
489  if (isRaavsEP == kPhiIntegrated) systematics->SetCentrality("4080");
490  else if (isRaavsEP == kInPlane) systematics->SetCentrality("3050InPlane");
491  else if (isRaavsEP == kOutOfPlane) systematics->SetCentrality("3050OutOfPlane");
492  }
493  else if ( cc == k4060 || cc == k4050 || cc == k5060 ) systematics->SetCentrality("4060");
494  else if ( cc == k6080 ) systematics->SetCentrality("6080");
495  else if ( cc == k4080 ) systematics->SetCentrality("4080");
496  } else if (Energy==k5dot023){
497  systematics->SetRunNumber(15);
498  if ( cc == k3050 ){
499  systematics->SetCentrality("3050");
500  }
501  else if ( cc == k1030 ) {
502  systematics->SetCentrality("3050"); //no systematics available for 10--30
503  }
504  }
505  else {
506  cout << " Systematics not yet implemented " << endl;
507  return;
508  }
509  } else { systematics->SetCollisionType(0); }
510  if(analysisSpeciality==kLowPt){
511  systematics->SetIsLowPtAnalysis(true);
512  }
513  else if(analysisSpeciality==kPP7TeVPass4){
514  systematics->SetIsPass4Analysis(kTRUE);
515  }
516  else if(analysisSpeciality==kBDT){
517  systematics->SetIsBDTAnalysis(kTRUE);
518  }
519  //
520  systematics->Init(decay);
521  spectra->SetSystematicUncertainty(systematics);
522 
523  // Do the calculations
524  cout << " Doing the calculation... "<< endl;
525  Double_t deltaY = 1.0;
526  Double_t branchingRatioC = 1.0;
527  Double_t branchingRatioBintoFinalDecay = 1.0; // this is relative to the input theoretical prediction
528  spectra->ComputeHFPtSpectrum(deltaY,branchingRatioC,branchingRatioBintoFinalDecay);
529  spectra->ComputeSystUncertainties(combineFeedDown);
530  cout << " ended the calculation, getting the histograms back " << endl;
531 
532 
533 
534  //
535  // Get the output histograms
536  //
537  // the corrected yield and cross-section
538  histoYieldCorr = (TH1D*)spectra->GetHistoFeedDownCorrectedSpectrum();
539  histoSigmaCorr = (TH1D*)spectra->GetHistoCrossSectionFromYieldSpectrum();
540  histoYieldCorrMax = (TH1D*)spectra->GetHistoUpperLimitFeedDownCorrectedSpectrum();
541  histoYieldCorrMin = (TH1D*)spectra->GetHistoLowerLimitFeedDownCorrectedSpectrum();
542  histoSigmaCorrMax = (TH1D*)spectra->GetHistoUpperLimitCrossSectionFromYieldSpectrum();
543  histoSigmaCorrMin = (TH1D*)spectra->GetHistoLowerLimitCrossSectionFromYieldSpectrum();
544  histoYieldCorr->SetNameTitle("histoYieldCorr","corrected yield");
545  histoYieldCorrMax->SetNameTitle("histoYieldCorrMax","max corrected yield");
546  histoYieldCorrMin->SetNameTitle("histoYieldCorrMin","min corrected yield");
547  histoSigmaCorr->SetNameTitle("histoSigmaCorr","corrected invariant cross-section");
548  histoSigmaCorrMax->SetNameTitle("histoSigmaCorrMax","max corrected invariant cross-section");
549  histoSigmaCorrMin->SetNameTitle("histoSigmaCorrMin","min corrected invariant cross-section");
550  // the efficiencies
551  if(!hDirectEffpt) hDirectEffpt = (TH1D*)spectra->GetDirectAccEffCorrection();
552  if(!hFeedDownEffpt) hFeedDownEffpt = (TH1D*)spectra->GetFeedDownAccEffCorrection();
553  // Get the PbPb Eloss hypothesis histograms
554  if(PbPbEloss){
555  histofcRcb = spectra->GetHistoFeedDownCorrectionFcVsEloss();
556  histoYieldCorrRcb = spectra->GetHistoFeedDownCorrectedSpectrumVsEloss();
557  histoSigmaCorrRcb = spectra->GetHistoCrossSectionFromYieldSpectrumVsEloss();
558  histofcRcb->SetName("histofcRcb");
559  histoYieldCorrRcb->SetName("histoYieldCorrRcb");
560  histoSigmaCorrRcb->SetName("histoSigmaCorrRcb");
561  }
562 
563  // Get & Rename the TGraphs
564  gSigmaCorr = spectra->GetCrossSectionFromYieldSpectrum();
565  gYieldCorr = spectra->GetFeedDownCorrectedSpectrum();
566  if (asym) {
567  gSigmaCorrExtreme = spectra->GetCrossSectionFromYieldSpectrumExtreme();
568  gYieldCorrExtreme = spectra->GetFeedDownCorrectedSpectrumExtreme();
569  gSigmaCorrConservative = spectra->GetCrossSectionFromYieldSpectrumConservative();
570  gYieldCorrConservative = spectra->GetFeedDownCorrectedSpectrumConservative();
571  }
572 
573  // Get & Rename the TGraphs
574  if (option==0){
575  gYieldCorr->SetNameTitle("gYieldCorr","gYieldCorr (uncorr)");
576  gSigmaCorr->SetNameTitle("gSigmaCorr","gSigmaCorr (uncorr)");
577  }
578  if (option==1){
579  // fc histos
580  histofc = (TH1D*)spectra->GetHistoFeedDownCorrectionFc();
581  histofcMax = (TH1D*)spectra->GetHistoUpperLimitFeedDownCorrectionFc();
582  histofcMin = (TH1D*)spectra->GetHistoLowerLimitFeedDownCorrectionFc();
583  histofc->SetNameTitle("histofc","fc correction factor");
584  histofcMax->SetNameTitle("histofcMax","max fc correction factor");
585  histofcMin->SetNameTitle("histofcMin","min fc correction factor");
586  if (asym) {
587  gYieldCorr->SetNameTitle("gYieldCorr","gYieldCorr (by fc)");
588  gSigmaCorr->SetNameTitle("gSigmaCorr","gSigmaCorr (by fc)");
589  gFcExtreme = spectra->GetFeedDownCorrectionFcExtreme();
590  gFcExtreme->SetNameTitle("gFcExtreme","gFcExtreme");
591  gYieldCorrExtreme->SetNameTitle("gYieldCorrExtreme","Extreme gYieldCorr (by fc)");
592  gSigmaCorrExtreme->SetNameTitle("gSigmaCorrExtreme","Extreme gSigmaCorr (by fc)");
593  gFcConservative = spectra->GetFeedDownCorrectionFcConservative();
594  gFcConservative->SetNameTitle("gFcConservative","gFcConservative");
595  gYieldCorrConservative->SetNameTitle("gYieldCorrConservative","Conservative gYieldCorr (by fc)");
596  gSigmaCorrConservative->SetNameTitle("gSigmaCorrConservative","Conservative gSigmaCorr (by fc)");
597  }
598  }
599  if (option==2 && asym) {
600  gYieldCorr->SetNameTitle("gYieldCorr","gYieldCorr (by Nb)");
601  gSigmaCorr->SetNameTitle("gSigmaCorr","gSigmaCorr (by Nb)");
602  gYieldCorrExtreme->SetNameTitle("gYieldCorrExtreme","Extreme gYieldCorr (by Nb)");
603  gSigmaCorrExtreme->SetNameTitle("gSigmaCorrExtreme","Extreme gSigmaCorr (by Nb)");
604  gYieldCorrConservative->SetNameTitle("gYieldCorrConservative","Conservative gYieldCorr (by Nb)");
605  gSigmaCorrConservative->SetNameTitle("gSigmaCorrConservative","Conservative gSigmaCorr (by Nb)");
606  gFcConservative = spectra->GetFeedDownCorrectionFcConservative();
607  gFcConservative->SetNameTitle("gFcConservative","gFcConservative");
608  }
609 
610  if(PbPbEloss){
611  nSigma = spectra->GetNtupleCrossSectionVsEloss();
612  }
613 
614  //
615  // Now, plot the results ! :)
616  //
617 
618  gROOT->SetStyle("Plain");
619 
620  cout << " Drawing the results ! " << endl;
621 
622  // control plots
623  if (option==1) {
624 
625  TCanvas *ceff = new TCanvas("ceff","efficiency drawing");
626  ceff->Divide(1,2);
627  ceff->cd(1);
628  hDirectEffpt->Draw();
629  ceff->cd(2);
630  hFeedDownEffpt->Draw();
631  ceff->Update();
632 
633  TCanvas *cTheoryRebin = new TCanvas("cTheoryRebin","control the theoretical spectra rebin");
634  cTheoryRebin->Divide(1,2);
635  cTheoryRebin->cd(1);
636  hDirectMCpt->Draw("");
637  TH1D *hDirectMCptRebin = (TH1D*)spectra->GetDirectTheoreticalSpectrum();
638  hDirectMCptRebin->SetLineColor(2);
639  hDirectMCptRebin->Draw("same");
640  cTheoryRebin->cd(2);
641  hFeedDownMCpt->Draw("");
642  TH1D *hFeedDownRebin = (TH1D*)spectra->GetFeedDownTheoreticalSpectrum();
643  hFeedDownRebin->SetLineColor(2);
644  hFeedDownRebin->Draw("same");
645  cTheoryRebin->Update();
646 
647  TCanvas *cTheoryRebinLimits = new TCanvas("cTheoryRebinLimits","control the theoretical spectra limits rebin");
648  cTheoryRebinLimits->Divide(1,2);
649  cTheoryRebinLimits->cd(1);
650  hDirectMCptMax->Draw("");
651  TH1D *hDirectMCptMaxRebin = (TH1D*)spectra->GetDirectTheoreticalUpperLimitSpectrum();
652  hDirectMCptMaxRebin->SetLineColor(2);
653  hDirectMCptMaxRebin->Draw("same");
654  hDirectMCptMin->Draw("same");
655  TH1D *hDirectMCptMinRebin = (TH1D*)spectra->GetDirectTheoreticalLowerLimitSpectrum();
656  hDirectMCptMinRebin->SetLineColor(2);
657  hDirectMCptMinRebin->Draw("same");
658  cTheoryRebinLimits->cd(2);
659  hFeedDownMCptMax->Draw("");
660  TH1D *hFeedDownMaxRebin = (TH1D*)spectra->GetFeedDownTheoreticalUpperLimitSpectrum();
661  hFeedDownMaxRebin->SetLineColor(2);
662  hFeedDownMaxRebin->Draw("same");
663  hFeedDownMCptMin->Draw("same");
664  TH1D *hFeedDownMinRebin = (TH1D*)spectra->GetFeedDownTheoreticalLowerLimitSpectrum();
665  hFeedDownMinRebin->SetLineColor(2);
666  hFeedDownMinRebin->Draw("same");
667  cTheoryRebinLimits->Update();
668  }
669 
670  if (option==1) {
671 
672  TCanvas * cfc = new TCanvas("cfc","Fc");
673  histofcMax->Draw("c");
674  histofc->Draw("csame");
675  histofcMin->Draw("csame");
676  cfc->Update();
677 
678  if (asym) {
679  TH2F *histofcDraw= new TH2F("histofcDraw","histofc (for drawing)",100,0,33.25,100,0.01,1.25);
680  histofcDraw->SetStats(0);
681  histofcDraw->GetXaxis()->SetTitle("p_{T} [GeV]");
682  histofcDraw ->GetXaxis()->SetTitleSize(0.05);
683  histofcDraw->GetXaxis()->SetTitleOffset(0.95);
684  histofcDraw->GetYaxis()->SetTitle(" fc ");
685  histofcDraw->GetYaxis()->SetTitleSize(0.05);
686 
687  if (gFcExtreme){
688 
689 // for(Int_t item=0; item<gSigmaCorr->GetN(); item++){
690 // Double_t center=0., value=0.;
691 // gFcExtreme->GetPoint(item,center,value);
692 // Double_t highunc = gFcExtreme->GetErrorYhigh(item) / value ;
693 // Double_t lowunc = gFcExtreme->GetErrorYlow(item) / value ;
694 // cout << "Fc extreme: i=" << item << ", center=" << center <<", value=" << value << " high unc=" << highunc*100 << "%, low unc=" << lowunc*100 << "%"<<endl;
695 // }
696 // for(Int_t item=0; item<gSigmaCorr->GetN(); item++){
697 // Double_t center=0., value=0.;
698 // gFcConservative->GetPoint(item,center,value);
699 // Double_t highunc = gFcConservative->GetErrorYhigh(item) / value ;
700 // Double_t lowunc = gFcConservative->GetErrorYlow(item) / value ;
701 // cout << "Fc conservative: i=" << item << ", center=" << center <<", value=" << value << " high unc=" << highunc*100 << "%, low unc=" << lowunc*100 << "%"<<endl;
702 // }
703  TCanvas *cfcExtreme = new TCanvas("cfcExtreme","Extreme Asymmetric fc (TGraphAsymmErr)");
704  gFcExtreme->SetFillStyle(3006);
705  gFcExtreme->SetLineWidth(3);
706  gFcExtreme->SetMarkerStyle(20);
707  gFcExtreme->SetFillColor(2);
708  histofcDraw->Draw();
709  gFcExtreme->Draw("3same");
710 
711  if(gFcConservative){
712  gFcConservative->SetFillStyle(3007);
713  gFcConservative->SetFillColor(4);
714  gFcConservative->Draw("3same");
715  }
716 
717  cfcExtreme->Update();
718  }
719  }
720 
721  }
722 
723  //
724  // Drawing the results (the raw-reconstructed, the expected, and the corrected spectra)
725  //
726  TCanvas * cresult = new TCanvas("cresult","corrected yields & sigma");
727  hDirectMCpt->SetMarkerStyle(20);
728  hDirectMCpt->SetMarkerColor(4);
729  hDirectMCpt->Draw("p");
730  histoSigmaCorr->SetMarkerStyle(21);
731  histoSigmaCorr->SetMarkerColor(2);
732  histoSigmaCorr->Draw("psame");
733  histoYieldCorr->SetMarkerStyle(22);
734  histoYieldCorr->SetMarkerColor(6);
735  histoYieldCorr->Draw("psame");
736  hRECpt->SetMarkerStyle(23);
737  hRECpt->SetMarkerColor(3);
738  hRECpt->Draw("psame");
739  cresult->SetLogy();
740  cresult->Update();
741 
742  TCanvas * cresult2 = new TCanvas("cresult2","corrected yield & sigma");
743  histoSigmaCorr->SetMarkerStyle(21);
744  histoSigmaCorr->SetMarkerColor(2);
745  histoSigmaCorr->Draw("p");
746  histoYieldCorr->SetMarkerStyle(22);
747  histoYieldCorr->SetMarkerColor(6);
748  histoYieldCorr->Draw("psame");
749  hRECpt->SetMarkerStyle(23);
750  hRECpt->SetMarkerColor(3);
751  hRECpt->Draw("psame");
752  cresult2->SetLogy();
753  cresult2->Update();
754 
755 
756  if (asym) {
757 
758  TH2F *histoDraw = new TH2F("histoDraw","histo (for drawing)",100,0,33.25,100,50.,1e7);
759  float max = 1.1*gYieldCorr->GetMaximum();
760  histoDraw->SetAxisRange(0.1,max,"Y");
761  histoDraw->SetStats(0);
762  histoDraw->GetXaxis()->SetTitle("p_{T} [GeV]");
763  histoDraw->GetXaxis()->SetTitleSize(0.05);
764  histoDraw->GetXaxis()->SetTitleOffset(0.95);
765  histoDraw->GetYaxis()->SetTitle("#frac{d#N}{dp_{T}} |_{|y|<1} [L & trigger uncorr]");
766  histoDraw->GetYaxis()->SetTitleSize(0.05);
767  TCanvas * cyieldAsym = new TCanvas("cyieldAsym","Asymmetric corrected yield (TGraphAsymmErr)");
768  gYieldCorr->SetFillStyle(3001);
769  gYieldCorr->SetLineWidth(3);
770  gYieldCorr->SetMarkerStyle(20);
771  gYieldCorr->SetFillColor(3);
772  histoDraw->Draw();
773  gYieldCorr->Draw("3LPsame");
774  gYieldCorr->Draw("Xsame");
775  cyieldAsym->SetLogy();
776  cyieldAsym->Update();
777 
778  TCanvas * cyieldExtreme = new TCanvas("cyieldExtreme","Extreme Asymmetric corrected yield (TGraphAsymmErr)");
779  histoYieldCorr->Draw();
780  gYieldCorrExtreme->SetFillStyle(3002);
781  gYieldCorrExtreme->SetLineWidth(3);
782  gYieldCorrExtreme->SetMarkerStyle(20);
783  gYieldCorrExtreme->SetFillColor(2);
784  histoYieldCorr->Draw();
785  gYieldCorr->Draw("3same");
786  gYieldCorrExtreme->Draw("3same");
787  cyieldExtreme->SetLogy();
788  cyieldExtreme->Update();
789 
790  TH2F *histo2Draw = new TH2F("histo2Draw","histo2 (for drawing)",100,0,33.25,100,50.,1e9);
791  max = 1.1*gSigmaCorr->GetMaximum();
792  histo2Draw->SetAxisRange(0.1,max,"Y");
793  histo2Draw->SetStats(0);
794  histo2Draw->GetXaxis()->SetTitle("p_{T} [GeV]");
795  histo2Draw->GetXaxis()->SetTitleSize(0.05);
796  histo2Draw->GetXaxis()->SetTitleOffset(0.95);
797  histo2Draw->GetYaxis()->SetTitle("#frac{1}{BR} #times #frac{d#sigma}{dp_{T}} |_{|y|<1}");
798  histo2Draw->GetYaxis()->SetTitleSize(0.05);
799  TCanvas * csigmaAsym = new TCanvas("csigmaAsym","Asymmetric corrected sigma (TGraphAsymmErr)");
800  gSigmaCorr->SetFillStyle(3001);
801  gSigmaCorr->SetLineWidth(3);
802  gSigmaCorr->SetMarkerStyle(21);
803  gSigmaCorr->SetFillColor(3);
804  histo2Draw->Draw();
805  gSigmaCorr->Draw("3LPsame");
806  gSigmaCorr->Draw("Xsame");
807  csigmaAsym->SetLogy();
808  csigmaAsym->Update();
809 
810 // cout << endl <<" Sytematics (stat approach) " <<endl;
811 // for(Int_t item=0; item<gSigmaCorr->GetN(); item++){
812 // Double_t center=0., value=0.;
813 // gSigmaCorr->GetPoint(item,center,value);
814 // Double_t highunc = gSigmaCorr->GetErrorYhigh(item) / value ;
815 // Double_t lowunc = gSigmaCorr->GetErrorYlow(item) / value ;
816 // cout << "Sigma syst (stat), i=" << item << ", center=" << center <<", value=" << value << " high unc=" << highunc*100 << "%, low unc=" << lowunc*100 << "%"<<endl;
817 // }
818 
819  TCanvas * csigmaExtreme = new TCanvas("csigmaExtreme","Asymmetric extreme corrected sigma (TGraphAsymmErr)");
820  histoSigmaCorr->Draw();
821  gSigmaCorr->Draw("3Psame");
822  gSigmaCorrExtreme->SetFillStyle(3002);
823  gSigmaCorrExtreme->SetLineWidth(3);
824  gSigmaCorrExtreme->SetMarkerStyle(21);
825  gSigmaCorrExtreme->SetFillColor(2);
826  gSigmaCorrExtreme->Draw("3Psame");
827  csigmaExtreme->SetLogy();
828  csigmaExtreme->Update();
829 
830 // cout << endl << " Sytematics (Extreme approach)" <<endl;
831 // for(Int_t item=0; item<gSigmaCorrExtreme->GetN(); item++){
832 // Double_t center=0., value=0.;
833 // gSigmaCorrExtreme->GetPoint(item,center,value);
834 // Double_t highunc = gSigmaCorrExtreme->GetErrorYhigh(item) / value ;
835 // Double_t lowunc = gSigmaCorrExtreme->GetErrorYlow(item) / value ;
836 // cout << "Sigma syst (extreme) i=" << item << ", center=" << center <<", value=" << value << " high unc=" << highunc*100 << "%, low unc=" << lowunc*100 << "%"<<endl;
837 // }
838 
839 // cout << endl << " Sytematics (Conservative approach)" <<endl;
840 // for(Int_t item=0; item<gSigmaCorrConservative->GetN(); item++){
841 // Double_t center=0., value=0.;
842 // gSigmaCorrConservative->GetPoint(item,center,value);
843 // Double_t highunc = gSigmaCorrConservative->GetErrorYhigh(item) / value ;
844 // Double_t lowunc = gSigmaCorrConservative->GetErrorYlow(item) / value ;
845 // cout << "Sigma syst (conservative) i=" << item << ", center=" << center <<", value=" << value << " high unc=" << highunc*100 << "%, low unc=" << lowunc*100 << "%"<<endl;
846 // }
847 
848  }
849 
850  // Draw the PbPb Eloss hypothesis histograms
851  if(PbPbEloss){
852  AliHFPtSpectrum *CalcBins=NULL;
853  gStyle->SetPalette(1);
854  TCanvas *canvasfcRcb = new TCanvas("canvasfcRcb","fc vs pt vs Rcb");
855  // histofcRcb->Draw("cont4z");
856  histofcRcb->Draw("colz");
857  canvasfcRcb->Update();
858  canvasfcRcb->cd(2);
859  TCanvas *canvasfcRcb1 = new TCanvas("canvasfcRcb1","fc vs pt vs Rcb=1");
860  histofcRcb_px = (TH1D*)histofcRcb->ProjectionX("histofcRcb_px",40,40);
861  histofcRcb_px->SetLineColor(2);
862  if (option==1) {
863  histofc->Draw();
864  histofcRcb_px->Draw("same");
865  } else histofcRcb_px->Draw("");
866  canvasfcRcb1->Update();
867  TCanvas *canvasfcRcb2 = new TCanvas("canvasfcRcb2","fc vs pt vs Rcb fixed Rcb");
868  Int_t bin0 = CalcBins->FindTH2YBin(histofcRcb,0.25);
869  Int_t bin1 = CalcBins->FindTH2YBin(histofcRcb,0.5);
870  Int_t bin2 = CalcBins->FindTH2YBin(histofcRcb,1.0);
871  Int_t bin3 = CalcBins->FindTH2YBin(histofcRcb,1.5);
872  Int_t bin4 = CalcBins->FindTH2YBin(histofcRcb,2.0);
873  Int_t bin5 = CalcBins->FindTH2YBin(histofcRcb,3.0);
874  Int_t bin6 = CalcBins->FindTH2YBin(histofcRcb,4.0);
875  TH1D * histofcRcb_px0a = (TH1D*)histofcRcb->ProjectionX("histofcRcb_px0a",bin0,bin0);
876  TH1D * histofcRcb_px0 = (TH1D*)histofcRcb->ProjectionX("histofcRcb_px0",bin1,bin1);
877  TH1D * histofcRcb_px1 = (TH1D*)histofcRcb->ProjectionX("histofcRcb_px1",bin2,bin2);
878  TH1D * histofcRcb_px2 = (TH1D*)histofcRcb->ProjectionX("histofcRcb_px2",bin3,bin3);
879  TH1D * histofcRcb_px3 = (TH1D*)histofcRcb->ProjectionX("histofcRcb_px3",bin4,bin4);
880  TH1D * histofcRcb_px4 = (TH1D*)histofcRcb->ProjectionX("histofcRcb_px4",bin5,bin5);
881  TH1D * histofcRcb_px5 = (TH1D*)histofcRcb->ProjectionX("histofcRcb_px5",bin6,bin6);
882  if (option==1) {
883  histofc->Draw();
884  // histofcRcb_px->Draw("same");
885  } else {
886  // histofcRcb_px->Draw("");
887  histofcRcb_px0a->SetLineColor(2);
888  histofcRcb_px0a->Draw("");
889  }
890  histofcRcb_px0a->SetLineColor(2);
891  histofcRcb_px0a->Draw("same");
892  histofcRcb_px0->SetLineColor(4);
893  histofcRcb_px0->Draw("same");
894  histofcRcb_px1->SetLineColor(3);
895  histofcRcb_px1->Draw("same");
896  histofcRcb_px2->SetLineColor(kCyan);
897  histofcRcb_px2->Draw("same");
898  histofcRcb_px3->SetLineColor(kMagenta+1);
899  histofcRcb_px3->Draw("same");
900  histofcRcb_px4->SetLineColor(kOrange+7);
901  histofcRcb_px4->Draw("same");
902  histofcRcb_px5->SetLineColor(kGreen+3);
903  histofcRcb_px5->Draw("same");
904  TLegend *legrcc = new TLegend(0.8,0.8,0.95,0.9);
905  legrcc->SetFillColor(0);
906  if (option==1) {
907  legrcc->AddEntry(histofcRcb_px0a,"Rc/b=0.25","l");
908  legrcc->AddEntry(histofcRcb_px0,"Rc/b=0.5","l");
909  legrcc->AddEntry(histofcRcb_px1,"Rc/b=1.0","l");
910  legrcc->AddEntry(histofcRcb_px2,"Rc/b=1.5","l");
911  legrcc->AddEntry(histofcRcb_px3,"Rc/b=2.0","l");
912  legrcc->AddEntry(histofcRcb_px4,"Rc/b=3.0","l");
913  legrcc->AddEntry(histofcRcb_px5,"Rc/b=4.0","l");
914  }else{
915  legrcc->AddEntry(histofcRcb_px0a,"Rb=0.25","l");
916  legrcc->AddEntry(histofcRcb_px0,"Rb=0.5","l");
917  legrcc->AddEntry(histofcRcb_px1,"Rb=1.0","l");
918  legrcc->AddEntry(histofcRcb_px2,"Rb=1.5","l");
919  legrcc->AddEntry(histofcRcb_px3,"Rb=2.0","l");
920  legrcc->AddEntry(histofcRcb_px4,"Rb=3.0","l");
921  legrcc->AddEntry(histofcRcb_px5,"Rb=4.0","l");
922  }
923  legrcc->Draw();
924  canvasfcRcb2->Update();
925  TCanvas *canvasYRcb = new TCanvas("canvasYRcb","corrected yield vs pt vs Rcb");
926  histoYieldCorrRcb->Draw("cont4z");
927  canvasYRcb->Update();
928  TCanvas *canvasSRcb = new TCanvas("canvasSRcb","sigma vs pt vs Rcb");
929  histoSigmaCorrRcb->Draw("cont4z");
930  canvasSRcb->Update();
931  TCanvas *canvasSRcb1 = new TCanvas("canvasSRcb1","sigma vs pt vs Rcb fixed Rcb");
932  TH1D * histoSigmaCorrRcb_px0a = (TH1D*)histoSigmaCorrRcb->ProjectionX("histoSigmaCorrRcb_px0a",bin0,bin0);
933  TH1D * histoSigmaCorrRcb_px0 = (TH1D*)histoSigmaCorrRcb->ProjectionX("histoSigmaCorrRcb_px0",bin1,bin1);
934  TH1D * histoSigmaCorrRcb_px1 = (TH1D*)histoSigmaCorrRcb->ProjectionX("histoSigmaCorrRcb_px1",bin2,bin2);
935  TH1D * histoSigmaCorrRcb_px2 = (TH1D*)histoSigmaCorrRcb->ProjectionX("histoSigmaCorrRcb_px2",bin3,bin3);
936  TH1D * histoSigmaCorrRcb_px3 = (TH1D*)histoSigmaCorrRcb->ProjectionX("histoSigmaCorrRcb_px3",bin4,bin4);
937  TH1D * histoSigmaCorrRcb_px4 = (TH1D*)histoSigmaCorrRcb->ProjectionX("histoSigmaCorrRcb_px4",bin5,bin5);
938  TH1D * histoSigmaCorrRcb_px5 = (TH1D*)histoSigmaCorrRcb->ProjectionX("histoSigmaCorrRcb_px5",bin6,bin6);
939  histoSigmaCorr->Draw();
940  histoSigmaCorrRcb_px0a->SetLineColor(2);
941  histoSigmaCorrRcb_px0a->Draw("hsame");
942  histoSigmaCorrRcb_px0->SetLineColor(4);
943  histoSigmaCorrRcb_px0->Draw("hsame");
944  histoSigmaCorrRcb_px1->SetLineColor(3);
945  histoSigmaCorrRcb_px1->Draw("hsame");
946  histoSigmaCorrRcb_px2->SetLineColor(kCyan);
947  histoSigmaCorrRcb_px2->Draw("hsame");
948  histoSigmaCorrRcb_px3->SetLineColor(kMagenta+1);
949  histoSigmaCorrRcb_px3->Draw("hsame");
950  histoSigmaCorrRcb_px4->SetLineColor(kOrange+7);
951  histoSigmaCorrRcb_px4->Draw("same");
952  histoSigmaCorrRcb_px5->SetLineColor(kGreen+3);
953  histoSigmaCorrRcb_px5->Draw("same");
954  TLegend *legrcb = new TLegend(0.8,0.8,0.95,0.9);
955  legrcb->SetFillColor(0);
956  if (option==1) {
957  legrcb->AddEntry(histoSigmaCorrRcb_px0a,"Rc/b=0.25","l");
958  legrcb->AddEntry(histoSigmaCorrRcb_px0,"Rc/b=0.5","l");
959  legrcb->AddEntry(histoSigmaCorrRcb_px1,"Rc/b=1.0","l");
960  legrcb->AddEntry(histoSigmaCorrRcb_px2,"Rc/b=1.5","l");
961  legrcb->AddEntry(histoSigmaCorrRcb_px3,"Rc/b=2.0","l");
962  legrcb->AddEntry(histoSigmaCorrRcb_px4,"Rc/b=3.0","l");
963  legrcb->AddEntry(histoSigmaCorrRcb_px5,"Rc/b=4.0","l");
964  }else{
965  legrcb->AddEntry(histoSigmaCorrRcb_px0a,"Rb=0.25","l");
966  legrcb->AddEntry(histoSigmaCorrRcb_px0,"Rb=0.5","l");
967  legrcb->AddEntry(histoSigmaCorrRcb_px1,"Rb=1.0","l");
968  legrcb->AddEntry(histoSigmaCorrRcb_px2,"Rb=1.5","l");
969  legrcb->AddEntry(histoSigmaCorrRcb_px3,"Rb=2.0","l");
970  legrcb->AddEntry(histoSigmaCorrRcb_px4,"Rb=3.0","l");
971  legrcb->AddEntry(histoSigmaCorrRcb_px5,"Rb=4.0","l");
972  }
973  legrcb->Draw();
974  canvasSRcb1->Update();
975  }
976 
977 
978  //
979  // Write the histograms to the output file
980  //
981  cout << " Saving the results ! " << endl<< endl;
982 
983  out->cd();
984  //
985  hDirectMCpt->Write(); hFeedDownMCpt->Write();
986  hDirectMCptMax->Write(); hDirectMCptMin->Write();
987  hFeedDownMCptMax->Write(); hFeedDownMCptMin->Write();
988  if(hDirectEffpt) hDirectEffpt->Write(); if(hFeedDownEffpt) hFeedDownEffpt->Write();
989  hRECpt->Write();
990  //
991  histoYieldCorr->Write();
992  histoYieldCorrMax->Write(); histoYieldCorrMin->Write();
993  histoSigmaCorr->Write();
994  histoSigmaCorrMax->Write(); histoSigmaCorrMin->Write();
995 
996  if(PbPbEloss){
997  histofcRcb->Write(); histofcRcb_px->Write();
998  histoYieldCorrRcb->Write();
999  histoSigmaCorrRcb->Write();
1000  nSigma->Write();
1001  }
1002 
1003  gYieldCorr->Write();
1004  gSigmaCorr->Write();
1005  if(asym){
1006  if(gYieldCorrExtreme) gYieldCorrExtreme->Write();
1007  if(gSigmaCorrExtreme) gSigmaCorrExtreme->Write();
1008  if(gYieldCorrConservative) gYieldCorrConservative->Write();
1009  if(gSigmaCorrConservative) gSigmaCorrConservative->Write();
1010  if(asym && gFcConservative) gFcConservative->Write();
1011  }
1012 
1013  if(option==1){
1014  histofc->Write();
1015  histofcMax->Write(); histofcMin->Write();
1016  if(asym && gFcExtreme) gFcExtreme->Write();
1017  }
1018 
1019 
1020  TH1D * hStatUncEffcSigma = spectra->GetDirectStatEffUncOnSigma();
1021  TH1D * hStatUncEffbSigma = spectra->GetFeedDownStatEffUncOnSigma();
1022  hStatUncEffcSigma->Write();
1023  hStatUncEffbSigma->Write();
1024  if(option!=0){
1025  TH1D * hStatUncEffcFD = spectra->GetDirectStatEffUncOnFc();
1026  TH1D * hStatUncEffbFD = spectra->GetFeedDownStatEffUncOnFc();
1027  hStatUncEffcFD->Write();
1028  hStatUncEffbFD->Write();
1029  }
1030  systematics->Write();
1031 
1032  // Draw the cross-section
1033  // spectra->DrawSpectrum(gPrediction);
1034 
1035  // out->Close();
1036 
1037 }
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 SetIs5TeVAnalysis(Bool_t flag)
Definition: AliHFSystErr.h:76
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.