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