]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG3/dielectron/AliDielectronMC.h
Updates and additions: Classes for signal and spectrum extraction; saving of
[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(AliESDtrack* _track);                      // return MC PID
46   Int_t GetMCPIDFromStack(AliESDtrack* _track);             // return MC PID
47   Int_t GetMotherPDG(AliESDtrack* _track);                  // return mother PID from the MC stack
48   Int_t GetMotherPDGFromStack(AliESDtrack* _track);         // return mother PID from the MC stack
49   Int_t GetMCProcess(AliESDtrack* _track);                  // return process number
50   Int_t GetMCProcessFromStack(AliESDtrack* _track);         // return process number
51   Int_t GetMCProcessMother(AliESDtrack* _track);            // return process number of the mother track
52   Int_t GetMCProcessMotherFromStack(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   Int_t GetLabelMotherWithPdg(const AliDielectronPair* pair, Int_t pdgMother);
62   Int_t GetLabelMotherWithPdg(const AliVParticle *particle1, const AliVParticle *particle2, Int_t pdgMother);
63   
64   AliVParticle* GetMCTrackFromMCEvent(AliVParticle *track);   // return MC track directly from MC event
65   AliVParticle* GetMCTrackFromMCEvent(Int_t _itrk);           // return MC track directly from MC event
66   TParticle* GetMCTrackFromStack(AliESDtrack* _track);        // return MC track from stack
67   AliMCParticle* GetMCTrack(AliESDtrack* _track);             // return MC track associated with reco track
68   TParticle* GetMCTrackMotherFromStack(AliESDtrack* _track);  // return MC mother track from stack
69   AliMCParticle* GetMCTrackMother(AliESDtrack* _track);       // return MC mother track from stack
70
71   void GetDaughters(const TObject *mother, AliVParticle* &d1, AliVParticle* &d2);
72   
73 private:
74   AliMCEvent    *fMCEvent;  // MC event object
75   AliStack      *fStack;    // MC stack
76
77   AnalysisType fAnaType;    // Analysis type
78   Bool_t fHasMC;            // Do we have an MC handler?
79   
80   static AliDielectronMC* fgInstance; //! singleton pointer
81   
82   AliDielectronMC(const AliDielectronMC &c);
83   AliDielectronMC &operator=(const AliDielectronMC &c);
84
85   Bool_t IsMCMotherToEEesd(const AliMCParticle *particle, Int_t pdgMother);
86   Bool_t IsMCMotherToEEaod(const AliAODMCParticle *particle, Int_t pdgMother);
87
88   Int_t GetLabelMotherWithPdgESD(const AliVParticle *particle1, const AliVParticle *particle2, Int_t pdgMother);
89   Int_t GetLabelMotherWithPdgAOD(const AliVParticle *particle1, const AliVParticle *particle2, Int_t pdgMother);
90   
91   ClassDef(AliDielectronMC, 0)
92 };
93
94 //
95 // inline functions
96 //
97 inline Bool_t AliDielectronMC::IsMotherPdg(const AliDielectronPair* pair, Int_t pdgMother)
98 {
99   return IsMotherPdg(pair->GetFirstDaughter(),pair->GetSecondDaughter(),pdgMother);
100 }
101 //___________________________________________________________
102 inline Bool_t AliDielectronMC::IsMotherPdg(const AliVParticle *particle1, const AliVParticle *particle2, Int_t pdgMother){
103   return GetLabelMotherWithPdg(particle1,particle2,pdgMother)>=0;
104 }
105 //___________________________________________________________
106 inline Int_t AliDielectronMC::GetLabelMotherWithPdg(const AliDielectronPair* pair, Int_t pdgMother){
107   return GetLabelMotherWithPdg(pair->GetFirstDaughter(),pair->GetSecondDaughter(),pdgMother);
108 }
109
110 #endif