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