]> 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 TGraphAsymmErrors of the feed-down correction
74   TGraphAsymmErrors * GetFeedDownCorrectionFc() { return (fgFc ?  fgFc : NULL); }
75   // Return the histogram of the feed-down correction
76   TH1 * GetHistoFeedDownCorrectionFc() { return (fhFc ?  fhFc : NULL); }
77   // Return the histograms of the feed-down correction bounds
78   TH1 * GetHistoUpperLimitFeedDownCorrectionFc() { return (fhFcMax ? fhFcMax : NULL); }
79   TH1 * GetHistoLowerLimitFeedDownCorrectionFc() { return (fhFcMin ? fhFcMin : NULL); }
80   // Return the TGraphAsymmErrors of the yield after feed-down correction 
81   TGraphAsymmErrors * GetFeedDownCorrectedSpectrum() { return (fgYieldCorr ? fgYieldCorr : NULL); }
82   // Return the histogram of the yield after feed-down correction 
83   TH1 * GetHistoFeedDownCorrectedSpectrum() { return (fhYieldCorr ? fhYieldCorr : NULL); }
84   // Return the histogram of the yield after feed-down correction bounds
85   TH1 * GetHistoUpperLimitFeedDownCorrectedSpectrum() { return (fhYieldCorrMax ? fhYieldCorrMax : NULL); }
86   TH1 * GetHistoLowerLimitFeedDownCorrectedSpectrum() { return (fhYieldCorrMin ? fhYieldCorrMin : NULL); }
87   // Return the equivalent invariant cross-section TGraphAsymmErrors
88   TGraphAsymmErrors * GetCrossSectionFromYieldSpectrum() { return (fgSigmaCorr ? fgSigmaCorr : NULL); }
89   // Return the equivalent invariant cross-section histogram
90   TH1 * GetHistoCrossSectionFromYieldSpectrum() { return (fhSigmaCorr ? fhSigmaCorr : NULL); }
91   // Return the equivalent invariant cross-section histogram bounds
92   TH1 * GetHistoUpperLimitCrossSectionFromYieldSpectrum() { return (fhSigmaCorrMax ? fhSigmaCorrMax : NULL); }
93   TH1 * GetHistoLowerLimitCrossSectionFromYieldSpectrum() { return (fhSigmaCorrMin ? fhSigmaCorrMin : NULL); }
94
95   //
96   // Main function:
97   //    Compute the invariant cross-section from the yield (correct it)
98   // variables : analysed delta_y, BR for the final correction, BR b --> decay (relative to the input theoretical prediction)
99   void ComputeHFPtSpectrum(Double_t deltaY=1.0, Double_t branchingRatioC=1.0, Double_t branchingRatioBintoFinalDecay=1.0);
100
101   //
102   // Basic functions
103   // 
104   TH1 * EstimateAndSetDirectEfficiencyRecoBin(TH1 *hSimu, TH1 *hReco);
105   TH1 * EstimateAndSetFeedDownEfficiencyRecoBin(TH1 *hSimu, TH1 *hReco);
106   
107   //
108   // Functions to  reweight histograms for testing purposes: 
109   //   to reweight the simulation: hToReweight is reweighted as hReference/hToReweight
110   TH1 * ReweightHisto(TH1 *hToReweight, TH1 *hReference);
111   //   to reweight the reco-histos: hRecToReweight is reweighted as hReference/hMCToReweight
112   TH1 * ReweightRecHisto(TH1 *hRecToReweight, TH1 *hMCToReweight, TH1 *hMCReference);
113
114
115  protected:
116
117   // Initialization 
118   Bool_t Initialize();
119   
120   // Basic functions
121   //
122   // Compute the feed-down correction via fc-method
123   void CalculateFeedDownCorrectionFc(); 
124   // Correct the yield for feed-down correction via fc-method
125   void CalculateFeedDownCorrectedSpectrumFc(); 
126   // Correct the yield for feed-down correction via Nb-method
127   void CalculateFeedDownCorrectedSpectrumNb(Double_t deltaY, Double_t branchingRatioBintoFinalDecay); 
128
129   // Check histograms consistency function
130   Bool_t CheckHistosConsistency(TH1 *h1, TH1 *h2);
131
132   //
133   // Input spectra
134   //
135   TH1 *fhDirectMCpt;            // Input MC c-->D spectra
136   TH1 *fhFeedDownMCpt;          // Input MC b-->D spectra
137   TH1 *fhDirectMCptMax;         // Input MC maximum c-->D spectra
138   TH1 *fhDirectMCptMin;         // Input MC minimum c-->D spectra
139   TH1 *fhFeedDownMCptMax;       // Input MC maximum b-->D spectra
140   TH1 *fhFeedDownMCptMin;       // Input MC minimum b-->D spectra
141   TH1 *fhDirectEffpt;           // c-->D Acceptance and efficiency correction
142   TH1 *fhFeedDownEffpt;         // b-->D Acceptance and efficiency correction
143   TH1 *fhRECpt;                 // all reconstructed D
144   //
145   // Normalization factors
146   Double_t fLuminosity[2];           // analyzed luminosity & uncertainty
147   Double_t fTrigEfficiency[2];       // trigger efficiency & uncertainty
148
149   //
150   // Output spectra
151   //
152   TH1 *fhFc;                            // Correction histo fc = 1 / ( 1 + (eff_b/eff_c)*(N_b/N_c) ) 
153   TH1 *fhFcMax;                         // Maximum fc histo
154   TH1 *fhFcMin;                         // Minimum fc histo
155   TGraphAsymmErrors * fgFc;             // Correction as TGraphAsymmErrors
156   TH1 *fhYieldCorr;                     // Corrected yield  
157   TH1 *fhYieldCorrMax;                  // Maximum corrected yield  
158   TH1 *fhYieldCorrMin;                  // Minimum corrected yield  
159   TGraphAsymmErrors * fgYieldCorr;      // Corrected yield as TGraphAsymmErrors
160   TH1 *fhSigmaCorr;                     // Corrected cross-section  
161   TH1 *fhSigmaCorrMax;                  // Maximum corrected cross-section  
162   TH1 *fhSigmaCorrMin;                  // Minimum corrected cross-section
163   TGraphAsymmErrors * fgSigmaCorr;      // Corrected cross-section as TGraphAsymmErrors
164
165   //
166   Int_t fFeedDownOption;            // feed-down correction flag: 0=none, 1=fc, 2=Nb 
167   Bool_t fAsymUncertainties;        // flag: asymmetric uncertainties are (1) or not (0) considered
168
169
170   ClassDef(AliHFPtSpectrum,1) // Class for Heavy Flavor spectra corrections
171 };
172
173 #endif