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