1 #ifndef ALIHFPTSPECTRUM_H
2 #define ALIHFPTSPECTRUM_H
4 /* Copyright(c) 1998-2010, ALICE Experiment at CERN, All rights reserved. *
5 * See cxx source for full Copyright notice */
7 //***********************************************************************
8 // Class AliHFPtSpectrum
9 // Base class for feed-down corrections on heavy-flavour decays
10 // computes the cross-section via one of the three implemented methods:
11 // 0) Consider no feed-down prediction
12 // 1) Subtract the feed-down with the "fc" method
13 // Yield = Reco * fc; where fc = 1 / ( 1 + (eff_b/eff_c)*(N_b/N_c) ) ;
14 // 2) Subtract the feed-down with the "Nb" method
15 // Yield = Reco - Feed-down (exact formula on the function implementation)
17 // (the corrected yields per bin are divided by the bin-width)
19 // Author: Z.Conesa, zconesa@in2p3.fr
20 //***********************************************************************
26 class TGraphAsymmErrors;
29 class AliHFPtSpectrum: public TNamed
35 AliHFPtSpectrum(const char* name="AliHFPtSpectrum", const char* title="HF feed down correction class", Int_t option=1);
37 AliHFPtSpectrum(const AliHFPtSpectrum &rhs);
38 // Assignment operator
39 AliHFPtSpectrum& operator=(const AliHFPtSpectrum &source);
41 virtual ~AliHFPtSpectrum();
46 // Set the theoretical direct & feeddown pt spectrum
47 void SetMCptSpectra(TH1D *hDirect, TH1D *hFeedDown);
48 // Set the theoretical feeddown pt spectrum
49 void SetFeedDownMCptSpectra(TH1D *hFeedDown);
50 // Set the theoretical direct & feeddown pt spectrum upper and lower bounds
51 void SetMCptDistributionsBounds(TH1D *hDirectMax, TH1D *hDirectMin, TH1D *hFeedDownMax, TH1D *hFeedDownMin);
52 // Set the theoretical feeddown pt spectrum upper and lower bounds
53 void SetFeedDownMCptDistributionsBounds(TH1D *hFeedDownMax, TH1D *hFeedDownMin);
54 // Set the acceptance and efficiency corrections for direct
55 void SetDirectAccEffCorrection(TH1D *hDirectEff);
56 // Set the acceptance and efficiency corrections for direct & feeddown
57 void SetAccEffCorrection(TH1D *hDirectEff, TH1D *hFeedDownEff);
58 // Set the reconstructed spectrum
59 void SetReconstructedSpectrum(TH1D *hRec);
60 void SetReconstructedSpectrumSystematics(TGraphAsymmErrors *gRec);
61 // Set the calculation option flag for feed-down correction: 0=none, 1=fc , 2=Nb
62 void SetFeedDownCalculationOption(Int_t option){ fFeedDownOption = option; }
63 // Set if the calculation has to consider asymmetric uncertaInt_ties or not
64 void SetComputeAsymmetricUncertainties(Bool_t flag){ fAsymUncertainties = flag; }
65 // Set the luminosity and its uncertainty
66 void SetLuminosity(Double_t luminosity, Double_t unc){
67 fLuminosity[0]=luminosity; fLuminosity[1]=unc;
69 // Set the trigger efficiency and its uncertainty
70 void SetTriggerEfficiency(Double_t efficiency, Double_t unc){
71 fTrigEfficiency[0]=efficiency; fTrigEfficiency[1]=unc;
73 // Set global acceptance x efficiency correction uncertainty (in percentages)
74 void SetAccEffPercentageUncertainty(Double_t globalEffUnc, Double_t globalBCEffRatioUnc){
75 fGlobalEfficiencyUncertainties[0] = globalEffUnc;
76 fGlobalEfficiencyUncertainties[1] = globalBCEffRatioUnc;
78 // Set the normalization factors
79 void SetNormalization(Double_t normalization){
80 fLuminosity[0]=normalization; fTrigEfficiency[0]=1.0;
82 void SetNormalization(Double_t nevents, Double_t sigma){
83 fLuminosity[0]=nevents/sigma; fTrigEfficiency[0]=1.0;
85 void SetNormalization(Double_t nevents, Double_t sigma, Double_t sigmaunc){
86 fLuminosity[0] = nevents/sigma;
87 fTrigEfficiency[0] = 1.0;
88 fLuminosity[1] = fLuminosity[0] * TMath::Sqrt( (1/nevents) + (sigmaunc/sigma)*(sigmaunc/sigma) );
94 // Return the theoretical predictions used for the calculation (rebinned if needed)
95 TH1D * GetDirectTheoreticalSpectrum() const { return (fhDirectMCpt ? (TH1D*)fhDirectMCpt : NULL); }
96 TH1D * GetDirectTheoreticalUpperLimitSpectrum() const { return (fhDirectMCptMax ? (TH1D*)fhDirectMCptMax : NULL); }
97 TH1D * GetDirectTheoreticalLowerLimitSpectrum() const { return (fhDirectMCptMin ? (TH1D*)fhDirectMCptMin : NULL); }
98 TH1D * GetFeedDownTheoreticalSpectrum() const { return (fhFeedDownMCpt ? (TH1D*)fhFeedDownMCpt : NULL); }
99 TH1D * GetFeedDownTheoreticalUpperLimitSpectrum() const { return (fhFeedDownMCptMax ? (TH1D*)fhFeedDownMCptMax : NULL); }
100 TH1D * GetFeedDownTheoreticalLowerLimitSpectrum() const { return (fhFeedDownMCptMin ? (TH1D*)fhFeedDownMCptMin : NULL); }
101 // Return the acceptance and efficiency corrections (rebinned if needed)
102 TH1D * GetDirectAccEffCorrection() const { return (fhDirectEffpt ? (TH1D*)fhDirectEffpt : NULL); }
103 TH1D * GetFeedDownAccEffCorrection() const { return (fhFeedDownEffpt ? (TH1D*)fhFeedDownEffpt : NULL); }
104 // Return the TGraphAsymmErrors of the feed-down correction (extreme systematics)
105 TGraphAsymmErrors * GetFeedDownCorrectionFcExtreme() const { return (fgFcExtreme ? fgFcExtreme : NULL); }
106 // Return the TGraphAsymmErrors of the feed-down correction (conservative systematics)
107 TGraphAsymmErrors * GetFeedDownCorrectionFcConservative() const { return (fgFcConservative ? fgFcConservative : NULL); }
108 // Return the histogram of the feed-down correction
109 TH1D * GetHistoFeedDownCorrectionFc() const { return (fhFc ? (TH1D*)fhFc : NULL); }
110 // Return the histograms of the feed-down correction bounds
111 TH1D * GetHistoUpperLimitFeedDownCorrectionFc() const { return (fhFcMax ? (TH1D*)fhFcMax : NULL); }
112 TH1D * GetHistoLowerLimitFeedDownCorrectionFc() const { return (fhFcMin ? (TH1D*)fhFcMin : NULL); }
113 // Return the TGraphAsymmErrors of the yield after feed-down correction (systematics but feed-down)
114 TGraphAsymmErrors * GetFeedDownCorrectedSpectrum() const { return (fgYieldCorr ? fgYieldCorr : NULL); }
115 // Return the TGraphAsymmErrors of the yield after feed-down correction (feed-down extreme systematics)
116 TGraphAsymmErrors * GetFeedDownCorrectedSpectrumExtreme() const { return (fgYieldCorrExtreme ? fgYieldCorrExtreme : NULL); }
117 // Return the TGraphAsymmErrors of the yield after feed-down correction (feed-down conservative systematics)
118 TGraphAsymmErrors * GetFeedDownCorrectedSpectrumConservative() const { return (fgYieldCorrConservative ? fgYieldCorrConservative : NULL); }
119 // Return the histogram of the yield after feed-down correction
120 TH1D * GetHistoFeedDownCorrectedSpectrum() const { return (fhYieldCorr ? (TH1D*)fhYieldCorr : NULL); }
121 // Return the histogram of the yield after feed-down correction bounds
122 TH1D * GetHistoUpperLimitFeedDownCorrectedSpectrum() const { return (fhYieldCorrMax ? (TH1D*)fhYieldCorrMax : NULL); }
123 TH1D * GetHistoLowerLimitFeedDownCorrectedSpectrum() const { return (fhYieldCorrMin ? (TH1D*)fhYieldCorrMin : NULL); }
124 // Return the equivalent invariant cross-section TGraphAsymmErrors (systematics but feed-down)
125 TGraphAsymmErrors * GetCrossSectionFromYieldSpectrum() const { return (fgSigmaCorr ? fgSigmaCorr : NULL); }
126 // Return the equivalent invariant cross-section TGraphAsymmErrors (feed-down extreme systematics)
127 TGraphAsymmErrors * GetCrossSectionFromYieldSpectrumExtreme() const { return (fgSigmaCorrExtreme ? fgSigmaCorrExtreme : NULL); }
128 // Return the equivalent invariant cross-section TGraphAsymmErrors (feed-down conservative systematics)
129 TGraphAsymmErrors * GetCrossSectionFromYieldSpectrumConservative() const { return (fgSigmaCorrConservative ? fgSigmaCorrConservative : NULL); }
130 // Return the equivalent invariant cross-section histogram
131 TH1D * GetHistoCrossSectionFromYieldSpectrum() const { return (fhSigmaCorr ? (TH1D*)fhSigmaCorr : NULL); }
132 // Return the equivalent invariant cross-section histogram bounds
133 TH1D * GetHistoUpperLimitCrossSectionFromYieldSpectrum() const { return (fhSigmaCorrMax ? (TH1D*)fhSigmaCorrMax : NULL); }
134 TH1D * GetHistoLowerLimitCrossSectionFromYieldSpectrum() const { return (fhSigmaCorrMin ? (TH1D*)fhSigmaCorrMin : NULL); }
138 // Compute the invariant cross-section from the yield (correct it)
139 // variables : analysed delta_y, BR for the final correction, BR b --> decay (relative to the input theoretical prediction)
140 void ComputeHFPtSpectrum(Double_t deltaY=1.0, Double_t branchingRatioC=1.0, Double_t branchingRatioBintoFinalDecay=1.0);
142 // Compute the systematic uncertainties
143 // taking as input the AliHFSystErr uncertainties
144 void ComputeSystUncertainties(Int_t decay, Bool_t combineFeedDown);
146 // Drawing the corrected spectrum comparing to theoretical prediction
147 void DrawSpectrum(TGraphAsymmErrors *gPrediction);
152 void EstimateAndSetDirectEfficiencyRecoBin(TH1D *hSimu, TH1D *hReco);
153 void EstimateAndSetFeedDownEfficiencyRecoBin(TH1D *hSimu, TH1D *hReco);
156 // Functions to reweight histograms for testing purposes:
157 // to reweight the simulation: hToReweight is reweighted as hReference/hToReweight
158 TH1D * ReweightHisto(TH1D *hToReweight, TH1D *hReference);
159 // to reweight the reco-histos: hRecToReweight is reweighted as hReference/hMCToReweight
160 TH1D * ReweightRecHisto(TH1D *hRecToReweight, TH1D *hMCToReweight, TH1D *hMCReference);
170 // Compute the feed-down correction via fc-method
171 void CalculateFeedDownCorrectionFc();
172 // Correct the yield for feed-down correction via fc-method
173 void CalculateFeedDownCorrectedSpectrumFc();
174 // Correct the yield for feed-down correction via Nb-method
175 void CalculateFeedDownCorrectedSpectrumNb(Double_t deltaY, Double_t branchingRatioBintoFinalDecay);
177 // Check histograms consistency function
178 Bool_t CheckHistosConsistency(TH1D *h1, TH1D *h2);
179 // Function to rebin the theoretical spectra in the data-reconstructed spectra binning
180 TH1D * RebinTheoreticalSpectra(TH1D *hTheory, const char *name);
181 // Function to estimate the efficiency in the data-reconstructed spectra binning
182 TH1D * EstimateEfficiencyRecoBin(TH1D *hSimu, TH1D *hReco, const char *name);
188 TH1D *fhDirectMCpt; // Input MC c-->D spectra
189 TH1D *fhFeedDownMCpt; // Input MC b-->D spectra
190 TH1D *fhDirectMCptMax; // Input MC maximum c-->D spectra
191 TH1D *fhDirectMCptMin; // Input MC minimum c-->D spectra
192 TH1D *fhFeedDownMCptMax; // Input MC maximum b-->D spectra
193 TH1D *fhFeedDownMCptMin; // Input MC minimum b-->D spectra
194 TH1D *fhDirectEffpt; // c-->D Acceptance and efficiency correction
195 TH1D *fhFeedDownEffpt; // b-->D Acceptance and efficiency correction
196 TH1D *fhRECpt; // all reconstructed D
198 TGraphAsymmErrors *fgRECSystematics; // all reconstructed D Systematic uncertainties
200 // Normalization factors
201 Double_t fLuminosity[2]; // analyzed luminosity & uncertainty
202 Double_t fTrigEfficiency[2]; // trigger efficiency & uncertainty
203 Double_t fGlobalEfficiencyUncertainties[2]; // uncertainties on the efficiency [0]=c, b, [1]=b/c
208 TH1D *fhFc; // Correction histo fc = 1 / ( 1 + (eff_b/eff_c)*(N_b/N_c) )
209 TH1D *fhFcMax; // Maximum fc histo
210 TH1D *fhFcMin; // Minimum fc histo
211 TGraphAsymmErrors * fgFcExtreme; // Extreme correction as TGraphAsymmErrors
212 TGraphAsymmErrors * fgFcConservative; // Extreme correction as TGraphAsymmErrors
213 TH1D *fhYieldCorr; // Corrected yield (stat unc. only)
214 TH1D *fhYieldCorrMax; // Maximum corrected yield
215 TH1D *fhYieldCorrMin; // Minimum corrected yield
216 TGraphAsymmErrors * fgYieldCorr; // Corrected yield as TGraphAsymmErrors (syst but feed-down)
217 TGraphAsymmErrors * fgYieldCorrExtreme; // Extreme corrected yield as TGraphAsymmErrors (syst from feed-down)
218 TGraphAsymmErrors * fgYieldCorrConservative; // Conservative corrected yield as TGraphAsymmErrors (syst from feed-down)
219 TH1D *fhSigmaCorr; // Corrected cross-section (stat unc. only)
220 TH1D *fhSigmaCorrMax; // Maximum corrected cross-section
221 TH1D *fhSigmaCorrMin; // Minimum corrected cross-section
222 TGraphAsymmErrors * fgSigmaCorr; // Corrected cross-section as TGraphAsymmErrors (syst but feed-down)
223 TGraphAsymmErrors * fgSigmaCorrExtreme; // Extreme corrected cross-section as TGraphAsymmErrors (syst from feed-down)
224 TGraphAsymmErrors * fgSigmaCorrConservative; // Conservative corrected cross-section as TGraphAsymmErrors (syst from feed-down)
227 Int_t fFeedDownOption; // feed-down correction flag: 0=none, 1=fc, 2=Nb
228 Bool_t fAsymUncertainties; // flag: asymmetric uncertainties are (1) or not (0) considered
231 ClassDef(AliHFPtSpectrum,1) // Class for Heavy Flavor spectra corrections