]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG3/dielectron/AliDielectronMC.h
Implemented NxM cluster finder
[u/mrichter/AliRoot.git] / PWG3 / 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 #endif
18 class AliESDEvent;
19 class AliHFEpid;
20 class AliStack;
21 class AliMCEvent;
22 class AliESDtrack;
23 class AliAODTrack;
24 class TParticle;
25 class AliMCParticle;
26 class AliAODMCParticle;
27
28 #include "AliDielectronPair.h"
29
30 class AliDielectronMC : public TObject{
31   
32 public:
33   enum AnalysisType {kUNSET=0, kESD, kAOD};
34   
35   AliDielectronMC(AnalysisType type=kUNSET);
36   virtual ~AliDielectronMC();
37
38   void SetHasMC(Bool_t hasMC) { fHasMC=hasMC; }
39   Bool_t HasMC() const { return fHasMC; }
40   
41   static AliDielectronMC* Instance();
42   
43   void Initialize();                              // initialization
44   Int_t GetNMCTracks();                                     // return number of generated tracks
45   Int_t GetNMCTracksFromStack();                            // return number of generated tracks from stack
46   Int_t GetNPrimary();                                            // return number of primary tracks
47   Int_t GetNPrimaryFromStack();                                   // return number of primary tracks from stack
48   Int_t GetMCPID(const AliESDtrack* _track);                      // return MC PID
49   Int_t GetMCPID(const AliAODTrack* _track);                      // return MC PID for AODtrack
50   Int_t GetMCPIDFromStack(const AliESDtrack* _track);             // return MC PID
51   Int_t GetMotherPDG(const AliESDtrack* _track);                  // return mother PID from the MC stack
52   Int_t GetMotherPDG(const AliAODTrack* _track);                  // return mother PID from the MC stack
53   Int_t GetMotherPDGFromStack(const AliESDtrack* _track);         // return mother PID from the MC stack
54   Int_t GetMCProcess(const AliESDtrack* _track);                  // return process number
55   Int_t GetMCProcessFromStack(const AliESDtrack* _track);         // return process number
56   Int_t GetMCProcessMother(const AliESDtrack* _track);            // return process number of the mother track
57   Int_t GetMCProcessMotherFromStack(const AliESDtrack* _track);   // return process number of the mother track
58   
59   Bool_t ConnectMCEvent();
60   Bool_t UpdateStack();
61
62   Bool_t IsMotherPdg(const AliDielectronPair* pair, Int_t pdgMother);
63   Bool_t IsMotherPdg(const AliVParticle *particle1, const AliVParticle *particle2, Int_t pdgMother);
64   Bool_t IsMCMotherToEE(const AliVParticle *particle, Int_t pdgMother);
65
66   Bool_t HaveSameMother(const AliDielectronPair *pair);
67   
68   Int_t GetLabelMotherWithPdg(const AliDielectronPair* pair, Int_t pdgMother);
69   Int_t GetLabelMotherWithPdg(const AliVParticle *particle1, const AliVParticle *particle2, Int_t pdgMother);
70   
71   AliVParticle* GetMCTrackFromMCEvent(AliVParticle *track);   // return MC track directly from MC event
72   AliVParticle* GetMCTrackFromMCEvent(Int_t itrk);           // return MC track directly from MC event
73   TParticle* GetMCTrackFromStack(const AliESDtrack* _track);        // return MC track from stack
74   AliMCParticle* GetMCTrack(const AliESDtrack* _track);             // return MC track associated with reco track
75   AliAODMCParticle* GetMCTrack( const AliAODTrack* _track);          // return MC track associated with reco AOD track
76   
77   TParticle* GetMCTrackMotherFromStack(const AliESDtrack* _track);  // return MC mother track from stack
78   AliMCParticle* GetMCTrackMother(const AliESDtrack* _track);       // return MC mother track from stack
79   AliAODMCParticle* GetMCTrackMother(const AliAODTrack* _track);       // return MC mother fot track AODTrack
80   AliMCParticle* GetMCTrackMother(const AliMCParticle* _particle);       // return MC mother track from stack
81   AliAODMCParticle* GetMCTrackMother(const AliAODMCParticle* _particle);       // return MC mother track from stack
82
83   Int_t NumberOfDaughters(const AliESDtrack* track);                 // return number of daughters
84   Int_t NumberOfDaughters(const AliAODTrack* track);                 // return number of daughters for AOD track
85   Int_t NumberOfDaughters(const AliMCParticle* particle);                 // return number of daughters
86   Int_t NumberOfDaughters(const AliAODMCParticle* particle);                 // return number of daughters
87
88   void GetDaughters(const TObject *mother, AliVParticle* &d1, AliVParticle* &d2);
89   Int_t IsJpsiPrimary(const AliDielectronPair * pair);
90   Int_t IsJpsiPrimary(const AliVParticle * pair);
91   
92 private:
93   AliMCEvent    *fMCEvent;  // MC event object
94   AliStack      *fStack;    // MC stack
95
96   AnalysisType fAnaType;    // Analysis type
97   Bool_t fHasMC;            // Do we have an MC handler?
98   
99   static AliDielectronMC* fgInstance; //! singleton pointer
100   TClonesArray* fMcArray; //mcArray for AOD MC particles 
101
102  
103   AliDielectronMC(const AliDielectronMC &c);
104   AliDielectronMC &operator=(const AliDielectronMC &c);
105
106   Bool_t IsMCMotherToEEesd(const AliMCParticle *particle, Int_t pdgMother);
107   Bool_t IsMCMotherToEEaod(const AliAODMCParticle *particle, Int_t pdgMother);
108
109   Int_t GetLabelMotherWithPdgESD(const AliVParticle *particle1, const AliVParticle *particle2, Int_t pdgMother);
110   Int_t GetLabelMotherWithPdgAOD(const AliVParticle *particle1, const AliVParticle *particle2, Int_t pdgMother);
111   
112   ClassDef(AliDielectronMC, 0)
113 };
114
115 //
116 // inline functions
117 //
118 inline Bool_t AliDielectronMC::IsMotherPdg(const AliDielectronPair* pair, Int_t pdgMother)
119 {
120   return IsMotherPdg(pair->GetFirstDaughter(),pair->GetSecondDaughter(),pdgMother);
121 }
122 //___________________________________________________________
123 inline Bool_t AliDielectronMC::IsMotherPdg(const AliVParticle *particle1, const AliVParticle *particle2, Int_t pdgMother){
124   return GetLabelMotherWithPdg(particle1,particle2,pdgMother)>=0;
125 }
126 //___________________________________________________________
127 inline Int_t AliDielectronMC::GetLabelMotherWithPdg(const AliDielectronPair* pair, Int_t pdgMother){
128   return GetLabelMotherWithPdg(pair->GetFirstDaughter(),pair->GetSecondDaughter(),pdgMother);
129 }
130
131 #endif
132