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