]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGHF/hfe/AliHFEmcQA.h
Update of hfe code
[u/mrichter/AliRoot.git] / PWGHF / hfe / AliHFEmcQA.h
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15 //
16 // QA class of Heavy Flavor quark and fragmeted/decayed particles
17 // -Check kinematics of Heavy Quarks/hadrons, and decayed leptons
18 //    pT, rapidity
19 //    decay lepton kinematics w/wo acceptance
20 //    heavy hadron decay length, electron pT fraction carried from decay 
21 // -Check yield of Heavy Quarks/hadrons
22 //    Number of produced heavy quark
23 //    Number of produced hadron of given pdg code
24 //
25
26 #ifndef ALIHFEMCQA_H
27 #define ALIHFEMCQA_H
28
29 #ifndef ROOT_TObject
30 //#include <TObject.h>
31 #endif
32
33 class TH1F;
34 class TH2F;
35 class TList;
36 class TParticle;
37 class TString;
38 class AliMCEvent;
39 class AliGenEventHeader;
40 class AliMCParticle;
41 class AliAODMCParticle;
42 class AliHFEcollection;
43 class TTreeSRedirector;
44
45 //________________________________________________________________
46 class AliHFEmcQA: public TObject {
47
48   public: 
49     enum heavyType {kCharm=4, kBeauty=5, kOthers=6, kElectronPDG=11};
50     enum qType {kQuark, kantiQuark, kHadron, keHadron, kDeHadron, kElectron, kElectron2nd};
51     enum SourceType {kDirectCharm=1, kDirectBeauty=2, kBeautyCharm=3, kGamma=4, kPi0=5, kElse=6, kMisID=7, kEta=8, kOmega=9, kPhi=10, kEtaPrime=11, kRho0=12, kGammaPi0=13, kGammaEta=14, kGammaOmega=15, kGammaPhi=16, kGammaEtaPrime=17, kGammaRho0=18, kJpsi=19, kB2Jpsi=20, kKe3=21, kGammaB2M=22, kGammaD2M=23};
52     enum ProcessType {
53       kPairCreationFromq,  kPairCreationFromg,  kFlavourExitation,  kGluonSplitting, kInitialPartonShower, kLightQuarkShower
54     };
55     enum{
56       kBgPtBins = 44,
57         kElecBgSpecies = 6,
58         kCentBins = 11,
59         kBgLevels = 3
60     };
61
62
63     AliHFEmcQA();
64     AliHFEmcQA(const AliHFEmcQA &p); // copy constructor
65     AliHFEmcQA &operator=(const AliHFEmcQA &); // assignment operator
66
67     virtual ~AliHFEmcQA();
68
69     TList *GetList() const { return fQAhistos; };
70     void PostAnalyze() const;
71     void CreatDefaultHistograms(TList * const qaList); // create default histograms  
72     void CreateHistograms(const Int_t kquark); // create histograms for mc qa analysis
73     void SetMCEvent(AliMCEvent* const mcEvent){fMCEvent = mcEvent;} 
74     void SetGenEventHeader(AliGenEventHeader* const mcHeader){fMCHeader=mcHeader;} // set stack pointer
75     void SetMCArray(TClonesArray* const mcarry){fMCArray=mcarry;} // set mcarray pointer
76     void Init();
77
78     void GetQuarkKine(TParticle *part, Int_t iTrack, const Int_t kquark); // get heavy quark kinematics distribution
79     void GetHadronKine(TParticle *part, const Int_t kquark); // get heavy hadron kinematics distribution
80     void GetDecayedKine(TParticle *part, const Int_t kquark, const Int_t kdecayed); // get decay electron kinematics distribution
81     void GetDecayedKine(AliAODMCParticle *mcpart, const Int_t kquark, Int_t kdecayed); // get decay electron kinematics for AOD 
82     void GetMesonKine(); // get meson and its decay electron pt spectra
83     void EndOfEventAna(const Int_t kquark); // run analysis which should be done at the end of the event loop
84     Int_t GetSource(const TParticle * const mcpart); // return source id 
85     Int_t GetElecSource(const AliVParticle * const mctrack);
86     Int_t GetElecSource(TParticle * const mcpart); // return electron source id 
87     Int_t GetElecSource(const AliAODMCParticle * const mcpart);
88     Int_t GetSource(const AliVParticle * const mcpart); // return electron source id for AOD
89     Double_t GetWeightFactor(AliMCParticle *mctrack, const Int_t iBgLevel); // return best/lower/upper weighting factor for electron's mother meson
90     Int_t GetWeightCentralityBin(const Float_t percentile) const; //translate the centrality percentile into the centrality bin of the reference weighting histograms for electron background
91     void EnableDebugStreamer() { fIsDebugStreamerON = kTRUE;};
92
93     void SetBackgroundWeightFactor(Double_t *elecBackgroundFactor, Double_t *binLimit);
94     void SetContainerStep(Int_t containerStep) { fContainerStep = containerStep;};
95     void SetHFEImpactParameters(Double_t hfeimpactR, Double_t hfeimpactnsigmaR) {fHfeImpactR = hfeimpactR; fHfeImpactnsigmaR = hfeimpactnsigmaR; };
96     void SetTrkKine(Double_t pt, Double_t eta, Double_t phi) {fRecPt = pt; fRecEta = eta; fRecPhi = phi;};
97     void SetITSInfo(Double_t ilyrhit, Double_t ilyrstat) { fLyrhit = ilyrhit; fLyrstat = ilyrstat;};
98
99     void SetCentrality(Int_t centrality) { fCentrality = centrality; };
100     void SetPercentrality(Int_t percentrality) { fPerCentrality = percentrality; };//centrality percentile
101     void SetPbPb() { fIsPbPb = kTRUE; };
102     void SetPP() { fIsPbPb = kFALSE; };
103     void SetPPMultiBin() { fIsppMultiBin = kFALSE; };
104     Bool_t IsPbPb() const { return fIsPbPb; };
105     Bool_t IsPP() const { return !fIsPbPb; };
106     Bool_t IsPPMultiBin() const { return fIsppMultiBin; };
107
108   protected:
109     Int_t GetMother(const AliVParticle * const track);
110     void IdentifyMother(Int_t motherlabel, Int_t &motherpdg, Int_t &grandmotherlabel); // 
111     void HardScattering(const Int_t kquark, Int_t &motherID, Int_t &mothertype, Int_t &motherlabel); // check if the quark is produced from hard scattering
112     void ReportStrangeness(Int_t &motherID, Int_t &mothertype, Int_t &motherlabel); // report if the quark production process is unknown
113     Bool_t IsFromInitialShower(Int_t inputmotherlabel, Int_t &motherID, Int_t &mothertype, Int_t &motherlabel); // check if the quark is produced from initial parton shower 
114     Bool_t IsFromFinalParton(Int_t inputmotherlabel, Int_t &motherID, Int_t &mothertype, Int_t &motherlabel); // check if the quark is produced from final parton shower
115
116     AliMCEvent* fMCEvent; // mcevent pointer
117     AliGenEventHeader* fMCHeader; // mcheader pointer
118     TClonesArray *fMCArray; // mc array pointer
119
120     static const Int_t fgkGluon=21; // gluon pdg code
121     static const Int_t fgkMaxGener=10; // ancester level wanted to be checked 
122     static const Int_t fgkMaxIter=100; // number of iteration to find out matching particle 
123     static const Int_t fgkqType=7; // number of particle type to be checked
124     static const Int_t fgkEtaRanges=3; // cuts for different eta ranges
125
126     struct AliHists{
127       TH1F *fPdgCode; // histogram to store particle pdg code
128       TH1F *fPt; // histogram to store pt
129       TH1F *fY; // histogram to store rapidity
130       TH1F *fEta; // histogram to store eta
131
132                         AliHists()
133                           : fPdgCode()
134                           , fPt()
135                           , fY()
136                           , fEta()
137       {
138                           // default constructor
139                         };
140                         AliHists(const AliHists & p)
141                           : fPdgCode(p.fPdgCode)
142                           , fPt(p.fPt)
143                           , fY(p.fY)
144                           , fEta(p.fEta)
145       {
146                           // copy constructor
147                         };
148                         AliHists &operator=(const AliHists &)
149                         {
150                           // assignment operator, not yet implemented 
151                           return *this;
152                         }
153       void FillList(TList *l) const;
154     };
155     struct AliHistsComm {
156       TH1F *fNq; // histogram to store number of quark
157       TH1F *fProcessID; // histogram to store process id 
158       TH2F *fePtRatio; // fraction of electron pT from D or B hadron
159       TH2F *fPtCorr; // pt correlation between e and direct D or B 
160       TH2F *fPtCorrDp; // pt correlation between e and direct D+
161       TH2F *fPtCorrD0; // pt correlation between e and direct D0
162       TH2F *fPtCorrDrest; // pt correlation between e and direct D rest
163       TH2F *fDePtRatio; // fraction of D electron pT from B hadron 
164       TH2F *feDistance; // distance between electron production point to mother particle 
165       TH2F *fDeDistance; // distance between D electron production point to mother particle
166
167       TH2F *fPtCorrDinein; // pt correlation between e and direct D or B 
168       TH2F *fPtCorrDineout; // pt correlation between e and direct D or B 
169       TH2F *fPtCorrDoutein; // pt correlation between e and direct D or B 
170       TH2F *fPtCorrDouteout; // pt correlation between e and direct D or B 
171       TH2F *fPtCorrDpDinein; // pt correlation between e and direct D+
172       TH2F *fPtCorrDpDineout; // pt correlation between e and direct D+
173       TH2F *fPtCorrDpDoutein; // pt correlation between e and direct D+
174       TH2F *fPtCorrDpDouteout; // pt correlation between e and direct D+
175       TH2F *fPtCorrD0Dinein; // pt correlation between e and direct D0
176       TH2F *fPtCorrD0Dineout; // pt correlation between e and direct D0
177       TH2F *fPtCorrD0Doutein; // pt correlation between e and direct D0
178       TH2F *fPtCorrD0Douteout; // pt correlation between e and direct D0
179       TH2F *fPtCorrDrestDinein; // pt correlation between e and direct D rest
180       TH2F *fPtCorrDrestDineout; // pt correlation between e and direct D rest
181       TH2F *fPtCorrDrestDoutein; // pt correlation between e and direct D rest
182       TH2F *fPtCorrDrestDouteout; // pt correlation between e and direct D rest
183
184       TH2F *fEtaCorrD; // eta correlation between e and direct D 
185       TH2F *fEtaCorrDp; // eta correlation between e and direct D 
186       TH2F *fEtaCorrD0; // eta correlation between e and direct D 
187       TH2F *fEtaCorrDrest; // eta correlation between e and direct D 
188       TH2F *fEtaCorrGD; // eta correlation between e and direct D 
189       TH2F *fEtaCorrGDp; // eta correlation between e and direct D 
190       TH2F *fEtaCorrGD0; // eta correlation between e and direct D 
191       TH2F *fEtaCorrGDrest; // eta correlation between e and direct D 
192
193       TH2F *fEtaCorrB; // eta correlation between e and B
194       TH2F *fEtaCorrGB; // eta correlation between e and B
195       TH2F *fPtCorrBinein; // eta correlation between e and B
196       TH2F *fPtCorrBineout; // eta correlation between e and B
197       TH2F *fPtCorrBoutein; // eta correlation between e and B
198       TH2F *fPtCorrBouteout; // eta correlation between e and B
199
200                         AliHistsComm()
201                           : fNq()
202                           , fProcessID()
203                           , fePtRatio()
204                           , fPtCorr()
205                           , fPtCorrDp()
206                           , fPtCorrD0()
207                           , fPtCorrDrest()
208                           , fDePtRatio()
209                           , feDistance()
210                           , fDeDistance()
211
212                           , fPtCorrDinein()
213                           , fPtCorrDineout()
214                           , fPtCorrDoutein()
215                           , fPtCorrDouteout()
216                           , fPtCorrDpDinein()
217                           , fPtCorrDpDineout()
218                           , fPtCorrDpDoutein()
219                           , fPtCorrDpDouteout()
220                           , fPtCorrD0Dinein()
221                           , fPtCorrD0Dineout()
222                           , fPtCorrD0Doutein()
223                           , fPtCorrD0Douteout()
224                           , fPtCorrDrestDinein()
225                           , fPtCorrDrestDineout()
226                           , fPtCorrDrestDoutein()
227                           , fPtCorrDrestDouteout()
228
229                           , fEtaCorrD()
230                           , fEtaCorrDp()
231                           , fEtaCorrD0()
232                           , fEtaCorrDrest()
233                           , fEtaCorrGD()
234                           , fEtaCorrGDp()
235                           , fEtaCorrGD0()
236                           , fEtaCorrGDrest()
237
238                           , fEtaCorrB()
239                           , fEtaCorrGB()
240                           , fPtCorrBinein()
241                           , fPtCorrBineout()
242                           , fPtCorrBoutein()
243                           , fPtCorrBouteout()
244       {  
245                           // default constructor
246                         };
247                         AliHistsComm(const AliHistsComm & p)
248                           : fNq(p.fNq)
249                           , fProcessID(p.fProcessID)
250                           , fePtRatio(p.fePtRatio)
251                           , fPtCorr(p.fPtCorr)
252                           , fPtCorrDp(p.fPtCorrDp)
253                           , fPtCorrD0(p.fPtCorrD0)
254                           , fPtCorrDrest(p.fPtCorrDrest)
255                           , fDePtRatio(p.fDePtRatio)
256                           , feDistance(p.feDistance)
257                           , fDeDistance(p.fDeDistance)
258
259                           , fPtCorrDinein(p.fPtCorrDinein)
260                           , fPtCorrDineout(p.fPtCorrDineout)
261                           , fPtCorrDoutein(p.fPtCorrDoutein)
262                           , fPtCorrDouteout(p.fPtCorrDouteout)
263                           , fPtCorrDpDinein(p.fPtCorrDpDinein)
264                           , fPtCorrDpDineout(p.fPtCorrDpDineout)
265                           , fPtCorrDpDoutein(p.fPtCorrDpDoutein)
266                           , fPtCorrDpDouteout(p.fPtCorrDpDouteout)
267                           , fPtCorrD0Dinein(p.fPtCorrD0Dinein)
268                           , fPtCorrD0Dineout(p.fPtCorrD0Dineout)
269                           , fPtCorrD0Doutein(p.fPtCorrD0Doutein)
270                           , fPtCorrD0Douteout(p.fPtCorrD0Douteout)
271                           , fPtCorrDrestDinein(p.fPtCorrDrestDinein)
272                           , fPtCorrDrestDineout(p.fPtCorrDrestDineout)
273                           , fPtCorrDrestDoutein(p.fPtCorrDrestDoutein)
274                           , fPtCorrDrestDouteout(p.fPtCorrDrestDouteout)
275
276                           , fEtaCorrD(p.fEtaCorrD)
277                           , fEtaCorrDp(p.fEtaCorrDp)
278                           , fEtaCorrD0(p.fEtaCorrD0)
279                           , fEtaCorrDrest(p.fEtaCorrDrest)
280                           , fEtaCorrGD(p.fEtaCorrGD)
281                           , fEtaCorrGDp(p.fEtaCorrGDp)
282                           , fEtaCorrGD0(p.fEtaCorrGD0)
283                           , fEtaCorrGDrest(p.fEtaCorrGDrest)
284
285                           , fEtaCorrB(p.fEtaCorrB)
286                           , fEtaCorrGB(p.fEtaCorrGB)
287                           , fPtCorrBinein(p.fPtCorrBinein)
288                           , fPtCorrBineout(p.fPtCorrBineout)
289                           , fPtCorrBoutein(p.fPtCorrBoutein)
290                           , fPtCorrBouteout(p.fPtCorrBouteout)
291       {
292                           // copy constructor
293                         };
294                         AliHistsComm &operator=(const AliHistsComm &)
295                         {
296                           // assignment operator, not yet implemented 
297                           return *this;
298                         }
299       void FillList(TList *l) const;
300     };
301
302     AliHists fHist[3][7][6][11]; // struct of histograms to store kinematics of given particles
303     AliHistsComm fHistComm[2][6]; // struct of additional histograms of given particles
304     TH2F *fhD[9]; // D meson pt,Y spectra
305
306     TList *fQAhistos;           // Container for QA histos
307     AliHFEcollection *fMCQACollection;      //! Tasks own QA collection
308     TParticle *fHeavyQuark[50]; //! store pointer of heavy flavour quark 
309     Int_t fIsHeavy[2]; // count of heavy flavour
310     Int_t fNparents; // number of heavy hadrons to be considered
311     Int_t fParentSelect[2][7]; // heavy hadron species
312
313     Double_t fElecBackgroundFactor[kBgLevels][kCentBins][kElecBgSpecies][kBgPtBins];     // Electron background factors
314     Double_t fBinLimit[kBgPtBins+1];       // Electron background bins
315
316 private:
317     Int_t              fCentrality;        // Centrality
318     Int_t              fPerCentrality;     // Centrality percentile
319     Bool_t             fIsPbPb;            // Analysis Type: pp or PbPb
320     Bool_t             fIsppMultiBin;      // pp multiplicity bin analysis
321     Int_t              fContainerStep;     // step the weighting factor called
322     Bool_t             fIsDebugStreamerON; // check if the debugstreamer is on
323
324     Double_t           fRecPt;             //reconstructed pt
325     Double_t           fRecEta;            //reconstructed eta
326     Double_t           fRecPhi;            //reconstructed phi
327     Double_t           fLyrhit;            //its layer hit
328     Double_t           fLyrstat;           //its layer status
329
330     Double_t fHfeImpactR;                  //absolute impact parameter R
331     Double_t fHfeImpactnsigmaR;            //absolute impact parameter sigma R 
332  
333     TTreeSRedirector *fTreeStream;         //! TreeStream
334
335   ClassDef(AliHFEmcQA,1);
336 };
337
338 #endif