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