]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGHF/hfe/AliHFEmcQA.h
Moving the signal function (synchronizing GSI svn and Aliroot ))
[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 {
52         kDirectCharm=1,         // electrons from primary charmed hadrons and primary resonance charmed hadrons(primary charmed hadrons, charmed hadrons decaying from the charmed hadron resonances(ex. D*): D->e ) 
53         kDirectBeauty=2,        // electrons from primary beauty hadrons and primary resonance beauty hadrons (primary beauty hadrons, beauty hadrons decaying from the beauty hadron resonances: B->e)
54         kBeautyCharm=3,         // electrons from charmed hadrons decaying from the beauty hadrons (B->D->e)
55         kGamma=4,               // should be obsolete -> please let me know if you see something! 
56         kPi0=5,                 // electrons from p0 Dalitz
57         kElse=6,                // all the other sources which was not in this enumeration
58         kMisID=7,               // not the electrons (hadrons)
59         kEta=8,                 // electrons from eta Dalitz
60         kOmega=9,               // electrons from omega decay (Dalitz and di-electrons)
61         kPhi=10,                // electrons from phi decay (di-electron)
62         kEtaPrime=11,           // electrons from eta prime decay (Dalitz and 2charged-pions&di-electrons) 
63         kRho0=12,               // electrons from rho decay (di-electron)
64         kGammaPi0=13,           // electrons from photon conversion where the photon originated from pi0
65         kGammaEta=14,           // electrons from photon conversion where the photon originated from eta
66         kGammaOmega=15,         // electrons from photon conversion where the photon originated from omega
67         kGammaPhi=16,           // electrons from photon conversion where the photon originated from phi
68         kGammaEtaPrime=17,      // electrons from photon conversion where the photon originated from eta prime
69         kGammaRho0=18,          // electrons from photon conversion where the photon originated from rho
70         kJpsi=19,               // electrons from primary J/psi decay
71         kB2Jpsi=20,             // electrons from J/psi decay where the J/psi originated from the beauty hadrons
72         kKe3=21,                // Ke3 electrons
73         kGammaB2M=22,           // electrons from photon conversion from meson where the meson originated from the beauty hadrons
74         kGammaD2M=23,           // electrons from photon conversion from meson where the meson originated from the charm hadrons
75         kGammaM2M=24,           // electrons from photon conversion from the light meson decay where the light meson originated from other light meson 
76         kB2M=25,                // electrons from the meson where the meson originated from the beauty hadrons 
77         kD2M=26,                // electrons from the meson where the meson originated from the charm hadrons
78         kM2M=27,                // electrons from the light meson decay where the light meson originated from other light meson 
79         kScdryM=28              // secondary mesons (mainly pions but I didn't differentiate the mesons)
80     };
81     enum ProcessType {
82       kPairCreationFromq,  kPairCreationFromg,  kFlavourExitation,  kGluonSplitting, kInitialPartonShower, kLightQuarkShower
83     };
84     enum{
85       kBgPtBins = 44,
86         kElecBgSpecies = 6,
87         kCentBins = 11,
88         kBgLevels = 3
89     };
90
91
92     AliHFEmcQA();
93     AliHFEmcQA(const AliHFEmcQA &p); // copy constructor
94     AliHFEmcQA &operator=(const AliHFEmcQA &); // assignment operator
95
96     virtual ~AliHFEmcQA();
97
98     TList *GetList() const { return fQAhistos; };
99     void PostAnalyze() const;
100     void CreatDefaultHistograms(TList * const qaList); // create default histograms  
101     void CreateHistograms(const Int_t kquark); // create histograms for mc qa analysis
102     void SetMCEvent(AliMCEvent* const mcEvent){fMCEvent = mcEvent;} 
103     void SetGenEventHeader(AliGenEventHeader* const mcHeader){fMCHeader=mcHeader;} // set stack pointer
104     void SetMCArray(TClonesArray* const mcarry){fMCArray=mcarry;} // set mcarray pointer
105     void Init();
106
107     void GetQuarkKine(TParticle *part, Int_t iTrack, const Int_t kquark); // get heavy quark kinematics distribution
108     void GetHadronKine(TParticle *part, const Int_t kquark); // get heavy hadron kinematics distribution
109     void GetDecayedKine(TParticle *part, const Int_t kquark, const Int_t kdecayed); // get decay electron kinematics distribution
110     void GetDecayedKine(AliAODMCParticle *mcpart, const Int_t kquark, Int_t kdecayed); // get decay electron kinematics for AOD 
111     void GetMesonKine(); // get meson and its decay electron pt spectra
112     void EndOfEventAna(const Int_t kquark); // run analysis which should be done at the end of the event loop
113     Int_t GetSource(const TParticle * const mcpart) const; // return source id 
114     Int_t GetElecSource(const AliVParticle * const mctrack, Bool_t isElec) const;
115     Int_t GetElecSource(TParticle * const mcpart, Bool_t isElec) const; // return electron source id 
116     Int_t GetElecSource(const AliAODMCParticle * const mcpart, Bool_t isElec) const;
117     Int_t GetSource(const AliVParticle * const mcpart) const; // return electron source id for AOD
118     Double_t GetWeightFactor(AliMCParticle *mctrack, const Int_t iBgLevel); // return best/lower/upper weighting factor for electron's mother meson
119     Double_t GetWeightFactor(const AliAODMCParticle * const mcpart, const Int_t iBgLevel);
120     Double_t GetWeightFactorForPrimaries(const AliAODMCParticle * const mcpart, const Int_t iBgLevel);
121     Int_t GetWeightCentralityBin(const Float_t percentile) const; //translate the centrality percentile into the centrality bin of the reference weighting histograms for electron background
122     void EnableDebugStreamer() { fIsDebugStreamerON = kTRUE;};
123     void EnableGetWeightHist() { fGetWeightHist = kTRUE;};
124
125     void SetBackgroundWeightFactor(Double_t *elecBackgroundFactor, Double_t *binLimit);
126     void SetContainerStep(Int_t containerStep) { fContainerStep = containerStep;};
127     void SetHFEImpactParameters(Double_t hfeimpactR, Double_t hfeimpactnsigmaR) {fHfeImpactR = hfeimpactR; fHfeImpactnsigmaR = hfeimpactnsigmaR; };
128     void SetTrkKine(Double_t pt, Double_t eta, Double_t phi) {fRecPt = pt; fRecEta = eta; fRecPhi = phi;};
129     void SetITSInfo(Double_t ilyrhit, Double_t ilyrstat) { fLyrhit = ilyrhit; fLyrstat = ilyrstat;};
130
131     void SetCentrality(Int_t centrality) { fCentrality = centrality; };
132     void SetPercentrality(Int_t percentrality) { fPerCentrality = percentrality; };//centrality percentile
133     void SetPbPb() { fIsPbPb = kTRUE; };
134     void SetPP() { fIsPbPb = kFALSE; };
135     void SetPPMultiBin() { fIsppMultiBin = kFALSE; };
136     Bool_t IsPbPb() const { return fIsPbPb; };
137     Bool_t IsPP() const { return !fIsPbPb; };
138     Bool_t IsPPMultiBin() const { return fIsppMultiBin; };
139
140   protected:
141     Int_t GetMother(const AliVParticle * const track) const;
142     void IdentifyMother(Int_t motherlabel, Int_t &motherpdg, Int_t &grandmotherlabel); // 
143     void HardScattering(const Int_t kquark, Int_t &motherID, Int_t &mothertype, Int_t &motherlabel); // check if the quark is produced from hard scattering
144     void ReportStrangeness(Int_t &motherID, Int_t &mothertype, Int_t &motherlabel); // report if the quark production process is unknown
145     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 
146     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
147
148     AliMCEvent* fMCEvent; // mcevent pointer
149     AliGenEventHeader* fMCHeader; // mcheader pointer
150     TClonesArray *fMCArray; // mc array pointer
151
152     static const Int_t fgkGluon=21; // gluon pdg code
153     static const Int_t fgkMaxGener=10; // ancester level wanted to be checked 
154     static const Int_t fgkMaxIter=100; // number of iteration to find out matching particle 
155     static const Int_t fgkqType=7; // number of particle type to be checked
156     static const Int_t fgkEtaRanges=3; // cuts for different eta ranges
157
158     struct AliHists{
159       TH1F *fPdgCode; // histogram to store particle pdg code
160       TH1F *fPt; // histogram to store pt
161       TH1F *fY; // histogram to store rapidity
162       TH1F *fEta; // histogram to store eta
163
164                         AliHists()
165                           : fPdgCode()
166                           , fPt()
167                           , fY()
168                           , fEta()
169       {
170                           // default constructor
171                         };
172                         AliHists(const AliHists & p)
173                           : fPdgCode(p.fPdgCode)
174                           , fPt(p.fPt)
175                           , fY(p.fY)
176                           , fEta(p.fEta)
177       {
178                           // copy constructor
179                         };
180                         AliHists &operator=(const AliHists &)
181                         {
182                           // assignment operator, not yet implemented 
183                           return *this;
184                         }
185       void FillList(TList *l) const;
186     };
187     struct AliHistsComm {
188       TH1F *fNq; // histogram to store number of quark
189       TH1F *fProcessID; // histogram to store process id 
190       TH2F *fePtRatio; // fraction of electron pT from D or B hadron
191       TH2F *fPtCorr; // pt correlation between e and direct D or B 
192       TH2F *fPtCorrDp; // pt correlation between e and direct D+
193       TH2F *fPtCorrD0; // pt correlation between e and direct D0
194       TH2F *fPtCorrDrest; // pt correlation between e and direct D rest
195       TH2F *fDePtRatio; // fraction of D electron pT from B hadron 
196       TH2F *feDistance; // distance between electron production point to mother particle 
197       TH2F *fDeDistance; // distance between D electron production point to mother particle
198
199       TH2F *fPtCorrDinein; // pt correlation between e and direct D or B 
200       TH2F *fPtCorrDineout; // pt correlation between e and direct D or B 
201       TH2F *fPtCorrDoutein; // pt correlation between e and direct D or B 
202       TH2F *fPtCorrDouteout; // pt correlation between e and direct D or B 
203       TH2F *fPtCorrDpDinein; // pt correlation between e and direct D+
204       TH2F *fPtCorrDpDineout; // pt correlation between e and direct D+
205       TH2F *fPtCorrDpDoutein; // pt correlation between e and direct D+
206       TH2F *fPtCorrDpDouteout; // pt correlation between e and direct D+
207       TH2F *fPtCorrD0Dinein; // pt correlation between e and direct D0
208       TH2F *fPtCorrD0Dineout; // pt correlation between e and direct D0
209       TH2F *fPtCorrD0Doutein; // pt correlation between e and direct D0
210       TH2F *fPtCorrD0Douteout; // pt correlation between e and direct D0
211       TH2F *fPtCorrDrestDinein; // pt correlation between e and direct D rest
212       TH2F *fPtCorrDrestDineout; // pt correlation between e and direct D rest
213       TH2F *fPtCorrDrestDoutein; // pt correlation between e and direct D rest
214       TH2F *fPtCorrDrestDouteout; // pt correlation between e and direct D rest
215
216       TH2F *fEtaCorrD; // eta correlation between e and direct D 
217       TH2F *fEtaCorrDp; // eta correlation between e and direct D 
218       TH2F *fEtaCorrD0; // eta correlation between e and direct D 
219       TH2F *fEtaCorrDrest; // eta correlation between e and direct D 
220       TH2F *fEtaCorrGD; // eta correlation between e and direct D 
221       TH2F *fEtaCorrGDp; // eta correlation between e and direct D 
222       TH2F *fEtaCorrGD0; // eta correlation between e and direct D 
223       TH2F *fEtaCorrGDrest; // eta correlation between e and direct D 
224
225       TH2F *fEtaCorrB; // eta correlation between e and B
226       TH2F *fEtaCorrGB; // eta correlation between e and B
227       TH2F *fPtCorrBinein; // eta correlation between e and B
228       TH2F *fPtCorrBineout; // eta correlation between e and B
229       TH2F *fPtCorrBoutein; // eta correlation between e and B
230       TH2F *fPtCorrBouteout; // eta correlation between e and B
231
232                         AliHistsComm()
233                           : fNq()
234                           , fProcessID()
235                           , fePtRatio()
236                           , fPtCorr()
237                           , fPtCorrDp()
238                           , fPtCorrD0()
239                           , fPtCorrDrest()
240                           , fDePtRatio()
241                           , feDistance()
242                           , fDeDistance()
243
244                           , fPtCorrDinein()
245                           , fPtCorrDineout()
246                           , fPtCorrDoutein()
247                           , fPtCorrDouteout()
248                           , fPtCorrDpDinein()
249                           , fPtCorrDpDineout()
250                           , fPtCorrDpDoutein()
251                           , fPtCorrDpDouteout()
252                           , fPtCorrD0Dinein()
253                           , fPtCorrD0Dineout()
254                           , fPtCorrD0Doutein()
255                           , fPtCorrD0Douteout()
256                           , fPtCorrDrestDinein()
257                           , fPtCorrDrestDineout()
258                           , fPtCorrDrestDoutein()
259                           , fPtCorrDrestDouteout()
260
261                           , fEtaCorrD()
262                           , fEtaCorrDp()
263                           , fEtaCorrD0()
264                           , fEtaCorrDrest()
265                           , fEtaCorrGD()
266                           , fEtaCorrGDp()
267                           , fEtaCorrGD0()
268                           , fEtaCorrGDrest()
269
270                           , fEtaCorrB()
271                           , fEtaCorrGB()
272                           , fPtCorrBinein()
273                           , fPtCorrBineout()
274                           , fPtCorrBoutein()
275                           , fPtCorrBouteout()
276       {  
277                           // default constructor
278                         };
279                         AliHistsComm(const AliHistsComm & p)
280                           : fNq(p.fNq)
281                           , fProcessID(p.fProcessID)
282                           , fePtRatio(p.fePtRatio)
283                           , fPtCorr(p.fPtCorr)
284                           , fPtCorrDp(p.fPtCorrDp)
285                           , fPtCorrD0(p.fPtCorrD0)
286                           , fPtCorrDrest(p.fPtCorrDrest)
287                           , fDePtRatio(p.fDePtRatio)
288                           , feDistance(p.feDistance)
289                           , fDeDistance(p.fDeDistance)
290
291                           , fPtCorrDinein(p.fPtCorrDinein)
292                           , fPtCorrDineout(p.fPtCorrDineout)
293                           , fPtCorrDoutein(p.fPtCorrDoutein)
294                           , fPtCorrDouteout(p.fPtCorrDouteout)
295                           , fPtCorrDpDinein(p.fPtCorrDpDinein)
296                           , fPtCorrDpDineout(p.fPtCorrDpDineout)
297                           , fPtCorrDpDoutein(p.fPtCorrDpDoutein)
298                           , fPtCorrDpDouteout(p.fPtCorrDpDouteout)
299                           , fPtCorrD0Dinein(p.fPtCorrD0Dinein)
300                           , fPtCorrD0Dineout(p.fPtCorrD0Dineout)
301                           , fPtCorrD0Doutein(p.fPtCorrD0Doutein)
302                           , fPtCorrD0Douteout(p.fPtCorrD0Douteout)
303                           , fPtCorrDrestDinein(p.fPtCorrDrestDinein)
304                           , fPtCorrDrestDineout(p.fPtCorrDrestDineout)
305                           , fPtCorrDrestDoutein(p.fPtCorrDrestDoutein)
306                           , fPtCorrDrestDouteout(p.fPtCorrDrestDouteout)
307
308                           , fEtaCorrD(p.fEtaCorrD)
309                           , fEtaCorrDp(p.fEtaCorrDp)
310                           , fEtaCorrD0(p.fEtaCorrD0)
311                           , fEtaCorrDrest(p.fEtaCorrDrest)
312                           , fEtaCorrGD(p.fEtaCorrGD)
313                           , fEtaCorrGDp(p.fEtaCorrGDp)
314                           , fEtaCorrGD0(p.fEtaCorrGD0)
315                           , fEtaCorrGDrest(p.fEtaCorrGDrest)
316
317                           , fEtaCorrB(p.fEtaCorrB)
318                           , fEtaCorrGB(p.fEtaCorrGB)
319                           , fPtCorrBinein(p.fPtCorrBinein)
320                           , fPtCorrBineout(p.fPtCorrBineout)
321                           , fPtCorrBoutein(p.fPtCorrBoutein)
322                           , fPtCorrBouteout(p.fPtCorrBouteout)
323       {
324                           // copy constructor
325                         };
326                         AliHistsComm &operator=(const AliHistsComm &)
327                         {
328                           // assignment operator, not yet implemented 
329                           return *this;
330                         }
331       void FillList(TList *l) const;
332     };
333
334     AliHists fHist[3][7][6][11]; // struct of histograms to store kinematics of given particles
335     AliHistsComm fHistComm[2][6]; // struct of additional histograms of given particles
336     TH2F *fhD[9]; // D meson pt,Y spectra
337
338     TList *fQAhistos;           // Container for QA histos
339     AliHFEcollection *fMCQACollection;      //! Tasks own QA collection
340     TParticle *fHeavyQuark[50]; //! store pointer of heavy flavour quark 
341     Int_t fIsHeavy[2]; // count of heavy flavour
342     Int_t fNparents; // number of heavy hadrons to be considered
343     Int_t fParentSelect[2][7]; // heavy hadron species
344     
345     /*
346      -------------------------------------------------------------------------------------
347     fParentSelect[0][0] =  411; //D+  
348     fParentSelect[0][1] =  421; //D0
349     fParentSelect[0][2] =  431; //Ds+
350     fParentSelect[0][3] = 4122; //Lambdac+
351     fParentSelect[0][4] = 4132; //Ksic0
352     fParentSelect[0][5] = 4232; //Ksic+
353     fParentSelect[0][6] = 4332; //OmegaC0
354
355         -------------------------------------------------------------------------------------
356     fParentSelect[1][0] =  511; //B0
357     fParentSelect[1][1] =  521; //B+
358     fParentSelect[1][2] =  531; //Bs0
359     fParentSelect[1][3] = 5122; //Lambdab0
360     fParentSelect[1][4] = 5132; //Ksib-
361     fParentSelect[1][5] = 5232; //Ksib0
362     fParentSelect[1][6] = 5332; //Omegab-
363     */
364
365
366     Double_t fElecBackgroundFactor[kBgLevels][kCentBins][kElecBgSpecies][kBgPtBins];     // Electron background factors
367     Double_t fBinLimit[kBgPtBins+1];       // Electron background bins
368
369 private:
370     Int_t              fCentrality;        // Centrality
371     Int_t              fPerCentrality;     // Centrality percentile
372     Bool_t             fIsPbPb;            // Analysis Type: pp or PbPb
373     Bool_t             fIsppMultiBin;      // pp multiplicity bin analysis
374     Int_t              fContainerStep;     // step the weighting factor called
375     Bool_t             fIsDebugStreamerON; // check if the debugstreamer is on
376
377     Double_t           fRecPt;             //reconstructed pt
378     Double_t           fRecEta;            //reconstructed eta
379     Double_t           fRecPhi;            //reconstructed phi
380     Double_t           fLyrhit;            //its layer hit
381     Double_t           fLyrstat;           //its layer status
382
383     Double_t fHfeImpactR;                  //absolute impact parameter R
384     Double_t fHfeImpactnsigmaR;            //absolute impact parameter sigma R 
385  
386     TTreeSRedirector *fTreeStream;         //! TreeStream
387     Bool_t             fGetWeightHist;     // Write histogram to calculate weights
388
389   ClassDef(AliHFEmcQA,1);
390 };
391
392 #endif