]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGDQ/dielectron/AliDielectronMC.h
add proptections (marcel), add GEANT process for MC
[u/mrichter/AliRoot.git] / PWGDQ / dielectron / AliDielectronMC.h
1 #ifndef ALIDIELECTRONMC_H
2 #define ALIDIELECTRONMC_H
3 /* Copyright(c) 1998-2009, ALICE Experiment at CERN, All rights reserved. *
4  * See cxx source for full Copyright notice                               */
5
6 //#####################################################
7 //#                                                   # 
8 //#              Class AliDielectronMC                #
9 //#       Cut Class for Jpsi->e+e- analysis           #
10 //#                                                   #
11 //#   by WooJin J. Park, GSI / W.J.Park@gsi.de        #
12 //#                                                   #
13 //#####################################################
14
15 #ifndef ROOT_TObject
16 #include <TObject.h>
17 #include <TMCProcess.h>
18 #endif
19 class AliESDEvent;
20 class AliHFEpid;
21 class AliStack;
22 class AliMCEvent;
23 class AliESDtrack;
24 class AliAODTrack;
25 class TParticle;
26 class AliMCParticle;
27 class AliAODMCParticle;
28 class AliAODMCHeader;
29
30 #include "AliDielectronSignalMC.h"
31 #include "AliDielectronPair.h"
32
33 class AliDielectronMC : public TObject{
34   
35 public:
36   enum AnalysisType {kUNSET=0, kESD, kAOD};
37   
38   AliDielectronMC(AnalysisType type=kUNSET);
39   virtual ~AliDielectronMC();
40
41   void SetHasMC(Bool_t hasMC) { fHasMC=hasMC; }
42   Bool_t HasMC() const { return fHasMC; }
43   
44   static AliDielectronMC* Instance();
45   
46   void Initialize();                              // initialization
47   Int_t GetNMCTracks();                                     // return number of generated tracks
48   Int_t GetNMCTracksFromStack();                            // return number of generated tracks from stack
49   Int_t GetNPrimary() const;                                      // return number of primary tracks
50   Int_t GetNPrimaryFromStack();                                   // return number of primary tracks from stack
51   Int_t GetMCPID(const AliESDtrack* _track);                      // return MC PID
52   Int_t GetMCPID(const AliAODTrack* _track);                      // return MC PID for AODtrack
53   Int_t GetMCPIDFromStack(const AliESDtrack* _track);             // return MC PID
54   Int_t GetMotherPDG(const AliESDtrack* _track);                  // return mother PID from the MC stack
55   Int_t GetMotherPDG(const AliAODTrack* _track);                  // return mother PID from the MC stack
56   Int_t GetMotherPDG(const AliMCParticle* _track);                  // return mother PID from the MC stack
57   Int_t GetMotherPDG(const AliAODMCParticle* _track);                  // return mother PID from the MC stack
58   Int_t GetMotherPDGFromStack(const AliESDtrack* _track);         // return mother PID from the MC stack
59   Int_t GetMCProcess(const AliESDtrack* _track);                  // return process number
60   Int_t GetMCProcessFromStack(const AliESDtrack* _track);         // return process number
61   Int_t GetMCProcessMother(const AliESDtrack* _track);            // return process number of the mother track
62   Int_t GetMCProcessMotherFromStack(const AliESDtrack* _track);   // return process number of the mother track
63   
64   Bool_t ConnectMCEvent();
65   Bool_t UpdateStack();
66
67   Bool_t IsMotherPdg(const AliDielectronPair* pair, Int_t pdgMother);
68   Bool_t IsMotherPdg(const AliVParticle *particle1, const AliVParticle *particle2, Int_t pdgMother);
69   Bool_t IsMCMotherToEE(const AliVParticle *particle, Int_t pdgMother);
70   Bool_t IsMCTruth(const AliDielectronPair* pair, const AliDielectronSignalMC* signalMC) const;
71   Bool_t IsMCTruth(Int_t label, AliDielectronSignalMC* signalMC, Int_t branch) const;
72   Int_t GetMothersLabel(Int_t daughterLabel) const;
73   Int_t GetPdgFromLabel(Int_t label) const;
74
75   Bool_t IsPhysicalPrimary(Int_t label) const;  // checks if a particle is physical primary
76   Bool_t CheckGEANTProcess(Int_t label, TMCProcess process) const;
77   Bool_t IsSecondaryFromWeakDecay(Int_t label) const;
78   Bool_t IsSecondaryFromMaterial(Int_t label) const;
79
80   Bool_t HaveSameMother(const AliDielectronPair *pair) const;
81   
82   Int_t GetLabelMotherWithPdg(const AliDielectronPair* pair, Int_t pdgMother);
83   Int_t GetLabelMotherWithPdg(const AliVParticle *particle1, const AliVParticle *particle2, Int_t pdgMother);
84   
85 //   AliVParticle* GetMCTrackFromMCEvent(const AliVParticle *track);   // return MC track directly from MC event
86   AliVParticle* GetMCTrackFromMCEvent(Int_t label) const;           // return MC track directly from MC event
87   TParticle* GetMCTrackFromStack(const AliESDtrack* _track);        // return MC track from stack
88   AliMCParticle* GetMCTrack(const AliESDtrack* _track);             // return MC track associated with reco track
89   AliAODMCParticle* GetMCTrack( const AliAODTrack* _track);          // return MC track associated with reco AOD track
90   
91   TParticle* GetMCTrackMotherFromStack(const AliESDtrack* _track);  // return MC mother track from stack
92   AliMCParticle* GetMCTrackMother(const AliESDtrack* _track);       // return MC mother track from stack
93   AliAODMCParticle* GetMCTrackMother(const AliAODTrack* _track);       // return MC mother fot track AODTrack
94   AliMCParticle* GetMCTrackMother(const AliMCParticle* _particle);       // return MC mother track from stack
95   AliAODMCParticle* GetMCTrackMother(const AliAODMCParticle* _particle);       // return MC mother track from stack
96
97   Int_t NumberOfDaughters(const AliESDtrack* track);                 // return number of daughters
98   Int_t NumberOfDaughters(const AliAODTrack* track);                 // return number of daughters for AOD track
99   Int_t NumberOfDaughters(const AliMCParticle* particle);                 // return number of daughters
100   Int_t NumberOfDaughters(const AliAODMCParticle* particle);                 // return number of daughters
101
102   void GetDaughters(const TObject *mother, AliVParticle* &d1, AliVParticle* &d2);
103   Int_t IsJpsiPrimary(const AliDielectronPair * pair);
104   Int_t IsJpsiPrimary(const AliVParticle * pair);
105   Bool_t CheckParticleSource(Int_t label, AliDielectronSignalMC::ESource source) const;
106   Bool_t GetPrimaryVertex(Double_t &primVtxX, Double_t &primVtxY, Double_t &primVtxZ);
107
108   AliMCEvent* GetMCEvent() { return fMCEvent; }         // return the AliMCEvent
109   
110 private:
111   AliMCEvent    *fMCEvent;  // MC event object
112   AliStack      *fStack;    // MC stack
113
114   AnalysisType fAnaType;    // Analysis type
115   Bool_t fHasMC;            // Do we have an MC handler?
116   
117   static AliDielectronMC* fgInstance; //! singleton pointer
118   TClonesArray* fMcArray; //mcArray for AOD MC particles 
119
120  
121   AliDielectronMC(const AliDielectronMC &c);
122   AliDielectronMC &operator=(const AliDielectronMC &c);
123
124   Bool_t IsMCMotherToEEesd(const AliMCParticle *particle, Int_t pdgMother);
125   Bool_t IsMCMotherToEEaod(const AliAODMCParticle *particle, Int_t pdgMother);
126
127   Int_t GetLabelMotherWithPdgESD(const AliVParticle *particle1, const AliVParticle *particle2, Int_t pdgMother);
128   Int_t GetLabelMotherWithPdgAOD(const AliVParticle *particle1, const AliVParticle *particle2, Int_t pdgMother);
129   
130   Bool_t ComparePDG(Int_t particlePDG, Int_t requiredPDG, Bool_t pdgExclusion, Bool_t checkBothCharges) const;
131   Bool_t CheckIsRadiative(Int_t label) const;
132   Bool_t CheckRadiativeDecision(Int_t mLabel, const AliDielectronSignalMC * const signalMC) const;
133
134   ClassDef(AliDielectronMC, 0)
135 };
136
137 //
138 // inline functions
139 //
140 inline Bool_t AliDielectronMC::IsMotherPdg(const AliDielectronPair* pair, Int_t pdgMother)
141 {
142   return IsMotherPdg(pair->GetFirstDaughterP(),pair->GetSecondDaughterP(),pdgMother);
143 }
144 //___________________________________________________________
145 inline Bool_t AliDielectronMC::IsMotherPdg(const AliVParticle *particle1, const AliVParticle *particle2, Int_t pdgMother){
146   return GetLabelMotherWithPdg(particle1,particle2,pdgMother)>=0;
147 }
148 //___________________________________________________________
149 inline Int_t AliDielectronMC::GetLabelMotherWithPdg(const AliDielectronPair* pair, Int_t pdgMother){
150   return GetLabelMotherWithPdg(pair->GetFirstDaughterP(),pair->GetSecondDaughterP(),pdgMother);
151 }
152
153 #endif
154