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 */
6 //#####################################################
8 //# Class AliDielectronMC #
9 //# Cut Class for Jpsi->e+e- analysis #
11 //# by WooJin J. Park, GSI / W.J.Park@gsi.de #
13 //#####################################################
25 class AliAODMCParticle;
27 #include "AliDielectronPair.h"
29 class AliDielectronMC : public TObject{
32 enum AnalysisType {kUNSET=0, kESD, kAOD};
34 AliDielectronMC(AnalysisType type=kUNSET);
35 virtual ~AliDielectronMC();
37 void SetHasMC(Bool_t hasMC) { fHasMC=hasMC; }
38 Bool_t HasMC() const { return fHasMC; }
40 static AliDielectronMC* Instance();
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
54 Bool_t ConnectMCEvent();
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);
61 Bool_t HaveSameMother(const AliDielectronPair *pair);
63 Int_t GetLabelMotherWithPdg(const AliDielectronPair* pair, Int_t pdgMother);
64 Int_t GetLabelMotherWithPdg(const AliVParticle *particle1, const AliVParticle *particle2, Int_t pdgMother);
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
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
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
80 void GetDaughters(const TObject *mother, AliVParticle* &d1, AliVParticle* &d2);
83 AliMCEvent *fMCEvent; // MC event object
84 AliStack *fStack; // MC stack
86 AnalysisType fAnaType; // Analysis type
87 Bool_t fHasMC; // Do we have an MC handler?
89 static AliDielectronMC* fgInstance; //! singleton pointer
91 AliDielectronMC(const AliDielectronMC &c);
92 AliDielectronMC &operator=(const AliDielectronMC &c);
94 Bool_t IsMCMotherToEEesd(const AliMCParticle *particle, Int_t pdgMother);
95 Bool_t IsMCMotherToEEaod(const AliAODMCParticle *particle, Int_t pdgMother);
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);
100 ClassDef(AliDielectronMC, 0)
106 inline Bool_t AliDielectronMC::IsMotherPdg(const AliDielectronPair* pair, Int_t pdgMother)
108 return IsMotherPdg(pair->GetFirstDaughter(),pair->GetSecondDaughter(),pdgMother);
110 //___________________________________________________________
111 inline Bool_t AliDielectronMC::IsMotherPdg(const AliVParticle *particle1, const AliVParticle *particle2, Int_t pdgMother){
112 return GetLabelMotherWithPdg(particle1,particle2,pdgMother)>=0;
114 //___________________________________________________________
115 inline Int_t AliDielectronMC::GetLabelMotherWithPdg(const AliDielectronPair* pair, Int_t pdgMother){
116 return GetLabelMotherWithPdg(pair->GetFirstDaughter(),pair->GetSecondDaughter(),pdgMother);