]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGHF/base/AliPtMothFromPtDaugh.h
updated for photonic electron efficiency
[u/mrichter/AliRoot.git] / PWGHF / base / AliPtMothFromPtDaugh.h
1 #ifndef ALIPTMOTHFROMPTDAUGH_H
2 #define ALIPTMOTHFROMPTDAUGH_H
3 /* Copyright(c) 1998-2009, ALICE Experiment at CERN, All rights reserved. *
4  * See cxx source for full Copyright notice                               */
5
6 /* $Id$ */ 
7
8 ////////////////////////////////////////////////////////////////////////////
9 //  Class to perform pt-spectra (and ptMin-spectra) extraction of mothers //
10 //  particles starting from measured pt-spectra of daughters particles    //
11 //  that come from inclusive decays.                                      //
12 //                                                                        //  
13 //  Contact: Giuseppe.Bruno@ba.infn.it  &  Fiorella.Fionda@ba.infn.it     //
14 ////////////////////////////////////////////////////////////////////////////
15
16 class TH1F;
17 class TNtuple;
18 class AliStack;
19 class TParticle;
20 class TArrayI;
21 #include <TNamed.h>
22 #include <TString.h>
23
24 //________________________________________________________________
25 class AliPtMothFromPtDaugh : public TNamed {
26   
27 public:
28
29   typedef enum {
30           kUserAnalysis,
31           kBtoJPSI,
32           kBtoEle,
33           kBtoMuon,
34           kBtoD0
35           } Analysis_mode;
36   
37   AliPtMothFromPtDaugh();
38   AliPtMothFromPtDaugh(const char* name, const char* title);
39   virtual ~AliPtMothFromPtDaugh();
40   
41   Bool_t CreateWeights(); // method which create the containers for the corrections for the deconvolution
42   void DeleteWeights();   // reset the containers
43   Bool_t ReadHistoPtDaught(const TH1F *hist); // this is input, i.e. the spectrum of the daughter.
44   //
45   // setters  
46   //
47   void SetDefaultAnalysis(Analysis_mode mode){fAnalysisMode = mode; InitDefaultAnalysis();}
48   void SetPdgDaugh(Int_t pdgD); // set the pdg of the daughter particle
49   void SetBeautyMothers(); // all the Beauty particles are considered as "mothers" 
50   void SetPdgMothers(Int_t n_mothers,Int_t *pdgM);  // define which particles are considered as possible mothers 
51   
52   // (here you can set the pt binning of the final spectrum, i.e. that of the mothers )
53   void SetBinsPtMoth(Double_t ptmin, Double_t ptmax,Int_t nbins,Double_t alpha=1.0); // binning of histo pt(Mothers)
54   void SetBinsPtMoth(Int_t nbins, Double_t *edgeBins);                          //   "      "    "      " 
55   void SetBinsPtMinMoth(Double_t ptmin, Double_t ptmax,Int_t nbins,Double_t alpha=1.0); // histo of pt_min(Mothers)
56   void SetBinsPtMinMoth(Int_t nbins, Double_t *edgeBins);                          // histo of pt_min(Mothers)
57   //
58   void SetYmothers(Double_t yMin, Double_t yMax){fyMothMin = yMin;                     // define rapidity range 
59                                                   fyMothMax = yMax; SetUseEta(kFALSE);} // of the mothers
60   void SetYdaughter(Double_t yMin, Double_t yMax){fyDaughMin = yMin;                     // define rapidity range
61                                                    fyDaughMax = yMax; SetUseEta(kFALSE);} // of the daughter
62
63   void SetEtaMothers(Double_t etaMin, Double_t etaMax){fyMothMin = etaMin;   // define pseudo-rapidity range of mothers
64                                                         fyMothMax = etaMax; SetUseEta(kTRUE);}
65   void SetEtaDaughter(Double_t etaMin, Double_t etaMax){fyDaughMin = etaMin; // define pseudo-rapidity range of daughter
66                                                         fyDaughMax = etaMax; SetUseEta(kTRUE);}
67   void SetDecayNtupla(TNtuple *DecKine){fDecayKine = DecKine;}               // define TNtupla with kinematic informations 
68   //getters
69   Double_t* GetBinsSize(const TH1F *hist, Int_t &n) const;
70   Bool_t GetEtaMothers(Double_t &etaMin, Double_t &etaMax) const;  // get pseudorapidity edges for mothers if pseudorapidity
71                                                                     // is used    (return kFALSE if rapidity has been used) 
72   Bool_t GetEtaDaughter(Double_t &etaMin, Double_t &etaMax) const; // get pseudorapidity edges for daughters if pseudorapidity
73                                                                     // is used    (return kFALSE if rapidity has ben used)
74   Bool_t GetYMothers(Double_t &yMin, Double_t &yMax) const;    // get rapidity edges for mothers if rapidity is used
75   Bool_t GetYDaughter(Double_t &yMin, Double_t &yMax) const;   // get rapidity edges for daughters if rapidity is used
76
77   Int_t GetPdgDaugh() const {return fDaughter;} // return the pdg of the daughter particle
78   Int_t* GetPdgMothers(Int_t &n_mothers) const; // return the pdg codes of the mothers particles 
79  
80   // main method to evaluate mothers spectra (for pt and ptMin)
81    Bool_t EvaluatePtMoth();
82    void WritePtMothHistoToFile(TString fileOutName="Mothers.root");
83
84   // return values of correction factors for pt-mothers ditribution
85   Double_t GetW(Int_t i,Int_t j) const;
86   Double_t GetF(Int_t i) const;
87
88   // return values of correction factors for ptMin-mothers ditribution
89   Double_t GetWmin(Int_t i,Int_t j) const;
90   Double_t GetFmin(Int_t i) const;
91    
92   // return errors on correction factors for pt-mothers distribution
93   Double_t GetStatErrW(Int_t i,Int_t j) const; 
94   Double_t GetStatErrF(Int_t i) const;
95  
96   // return errors on correction factors for ptMin-mothers distribution
97   Double_t GetStatErrWmin(Int_t i,Int_t j) const;
98   Double_t GetStatErrFmin(Int_t i) const;
99
100    // return pointers to pt and ptMin mothers histograms 
101    TH1F* GetHistoPtMother() const {return fHistoPtMothers;}
102    TH1F* GetHistoPtMinMother() const {return fHistoPtMinMothers;}
103
104    //method to read kinematic
105    Int_t GiveBinIndex(Double_t Ptpart,const TH1F *ptHist) const;
106    Bool_t Rapidity(const TParticle *particle, Double_t &y);
107    Bool_t IsMothers(Int_t pdgCode);
108    Bool_t IsSelectedDaugh(const TParticle *part, Int_t &labelDaugh, AliStack * const stack);
109    Bool_t CutDaugh(Double_t yD,Double_t ptD);
110
111 private:
112   void InitDefaultAnalysis(); // set the default analysis for one of the specific Analysis_mode, apart kUserAnalysis
113   // methods to evaluate correction factors
114   Bool_t EvaluateWij(); // 
115   Bool_t EvaluateFi();  // 
116  
117   void SetUseEta(Bool_t useEta){fUseEta=useEta;}   // decide whether to use rapidity or pseudo-rapidity cut
118   Double_t* SetBinsSize(Double_t ptmin, Double_t ptmax,Int_t nbins,Double_t alpha);  
119   // method to evaluate raw-mothers spectra (for pt and ptMin)
120   Bool_t EvaluatePtMothRaw(TH1F *histoPt, TH1F *histoPtMin); 
121   //method to evaluate statistical errors on extracted distribution
122   Bool_t EvaluateErrPt(Double_t *erStat);
123   Bool_t EvaluateErrPtMin(Double_t *erStat);
124   void SetPdgMothersPrivate(Int_t n_mothers,Int_t *pdgM);  // define which particles are considered as possible mothers 
125
126   TNtuple*             fDecayKine; //Ntupla to store kinematic information of Decay 
127   Double_t**           fWij; //pointer to store correction factors
128   Double_t*            fFi;  //"            "                "
129   Double_t**           fWijMin; //"        "                "
130   Double_t*            fFiMin; //"         "                "
131   TH1F*                fHistoPtDaughter; //pointers to pt-histogram of Daughther 
132   TH1F*                fHistoPtMothers; //pointers to ptMin-histogram of mothers
133   TH1F*                fHistoPtMinMothers; //pointers for pt_min-histogram of Mothers
134   TArrayI*             fMothers; //Array with pdg codes of mothers
135   Int_t                fDaughter; //pdg code of daughter 
136   Double_t             fyMothMax; //max rapidity (or pseudorapidity) of mothers
137   Double_t             fyMothMin; //min  "             "                 " 
138   Double_t             fyDaughMax; //max "             "             of daughters  
139   Double_t             fyDaughMin; //min "             "                 "
140   Bool_t               fUseEta; //kTRUE if pseudorapidity range is used 
141   Analysis_mode        fAnalysisMode; //analysis mode
142   
143   AliPtMothFromPtDaugh(const AliPtMothFromPtDaugh &c);
144   AliPtMothFromPtDaugh &operator=(const AliPtMothFromPtDaugh &c);
145   
146   ClassDef(AliPtMothFromPtDaugh,1); // mother pt spectrum from daughter pt spectrum
147 };
148
149
150 #endif