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