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 //#####################################################
26 class AliAODMCParticle;
28 #include "AliDielectronSignalMC.h"
29 #include "AliDielectronPair.h"
31 class AliDielectronMC : public TObject{
34 enum AnalysisType {kUNSET=0, kESD, kAOD};
36 AliDielectronMC(AnalysisType type=kUNSET);
37 virtual ~AliDielectronMC();
39 void SetHasMC(Bool_t hasMC) { fHasMC=hasMC; }
40 Bool_t HasMC() const { return fHasMC; }
42 static AliDielectronMC* Instance();
44 void Initialize(); // initialization
45 Int_t GetNMCTracks(); // return number of generated tracks
46 Int_t GetNMCTracksFromStack(); // return number of generated tracks from stack
47 Int_t GetNPrimary(); // return number of primary tracks
48 Int_t GetNPrimaryFromStack(); // return number of primary tracks from stack
49 Int_t GetMCPID(const AliESDtrack* _track); // return MC PID
50 Int_t GetMCPID(const AliAODTrack* _track); // return MC PID for AODtrack
51 Int_t GetMCPIDFromStack(const AliESDtrack* _track); // return MC PID
52 Int_t GetMotherPDG(const AliESDtrack* _track); // return mother PID from the MC stack
53 Int_t GetMotherPDG(const AliAODTrack* _track); // return mother PID from the MC stack
54 Int_t GetMotherPDGFromStack(const AliESDtrack* _track); // return mother PID from the MC stack
55 Int_t GetMCProcess(const AliESDtrack* _track); // return process number
56 Int_t GetMCProcessFromStack(const AliESDtrack* _track); // return process number
57 Int_t GetMCProcessMother(const AliESDtrack* _track); // return process number of the mother track
58 Int_t GetMCProcessMotherFromStack(const AliESDtrack* _track); // return process number of the mother track
60 Bool_t ConnectMCEvent();
63 Bool_t IsMotherPdg(const AliDielectronPair* pair, Int_t pdgMother);
64 Bool_t IsMotherPdg(const AliVParticle *particle1, const AliVParticle *particle2, Int_t pdgMother);
65 Bool_t IsMCMotherToEE(const AliVParticle *particle, Int_t pdgMother);
66 Bool_t IsMCTruth(const AliDielectronPair* pair, AliDielectronSignalMC* signalMC);
67 Bool_t IsMCTruth(Int_t ipart, AliDielectronSignalMC* signalMC, Int_t branch);
68 Int_t GetMothersLabel(Int_t daughterLabel);
69 Int_t GetPdgFromLabel(Int_t label);
71 Bool_t HaveSameMother(const AliDielectronPair *pair);
73 Int_t GetLabelMotherWithPdg(const AliDielectronPair* pair, Int_t pdgMother);
74 Int_t GetLabelMotherWithPdg(const AliVParticle *particle1, const AliVParticle *particle2, Int_t pdgMother);
76 AliVParticle* GetMCTrackFromMCEvent(AliVParticle *track); // return MC track directly from MC event
77 AliVParticle* GetMCTrackFromMCEvent(Int_t itrk); // return MC track directly from MC event
78 TParticle* GetMCTrackFromStack(const AliESDtrack* _track); // return MC track from stack
79 AliMCParticle* GetMCTrack(const AliESDtrack* _track); // return MC track associated with reco track
80 AliAODMCParticle* GetMCTrack( const AliAODTrack* _track); // return MC track associated with reco AOD track
82 TParticle* GetMCTrackMotherFromStack(const AliESDtrack* _track); // return MC mother track from stack
83 AliMCParticle* GetMCTrackMother(const AliESDtrack* _track); // return MC mother track from stack
84 AliAODMCParticle* GetMCTrackMother(const AliAODTrack* _track); // return MC mother fot track AODTrack
85 AliMCParticle* GetMCTrackMother(const AliMCParticle* _particle); // return MC mother track from stack
86 AliAODMCParticle* GetMCTrackMother(const AliAODMCParticle* _particle); // return MC mother track from stack
88 Int_t NumberOfDaughters(const AliESDtrack* track); // return number of daughters
89 Int_t NumberOfDaughters(const AliAODTrack* track); // return number of daughters for AOD track
90 Int_t NumberOfDaughters(const AliMCParticle* particle); // return number of daughters
91 Int_t NumberOfDaughters(const AliAODMCParticle* particle); // return number of daughters
93 void GetDaughters(const TObject *mother, AliVParticle* &d1, AliVParticle* &d2);
94 Int_t IsJpsiPrimary(const AliDielectronPair * pair);
95 Int_t IsJpsiPrimary(const AliVParticle * pair);
97 AliMCEvent* GetMCEvent() { return fMCEvent; } // return the AliMCEvent
100 AliMCEvent *fMCEvent; // MC event object
101 AliStack *fStack; // MC stack
103 AnalysisType fAnaType; // Analysis type
104 Bool_t fHasMC; // Do we have an MC handler?
106 static AliDielectronMC* fgInstance; //! singleton pointer
107 TClonesArray* fMcArray; //mcArray for AOD MC particles
110 AliDielectronMC(const AliDielectronMC &c);
111 AliDielectronMC &operator=(const AliDielectronMC &c);
113 Bool_t IsMCMotherToEEesd(const AliMCParticle *particle, Int_t pdgMother);
114 Bool_t IsMCMotherToEEaod(const AliAODMCParticle *particle, Int_t pdgMother);
116 Int_t GetLabelMotherWithPdgESD(const AliVParticle *particle1, const AliVParticle *particle2, Int_t pdgMother);
117 Int_t GetLabelMotherWithPdgAOD(const AliVParticle *particle1, const AliVParticle *particle2, Int_t pdgMother);
119 Bool_t ComparePDG(Int_t particlePDG, Int_t requiredPDG, Bool_t checkBothCharges) const;
120 Bool_t CheckParticleSource(Int_t label, AliDielectronSignalMC::ESource source);
121 ClassDef(AliDielectronMC, 0)
127 inline Bool_t AliDielectronMC::IsMotherPdg(const AliDielectronPair* pair, Int_t pdgMother)
129 return IsMotherPdg(pair->GetFirstDaughter(),pair->GetSecondDaughter(),pdgMother);
131 //___________________________________________________________
132 inline Bool_t AliDielectronMC::IsMotherPdg(const AliVParticle *particle1, const AliVParticle *particle2, Int_t pdgMother){
133 return GetLabelMotherWithPdg(particle1,particle2,pdgMother)>=0;
135 //___________________________________________________________
136 inline Int_t AliDielectronMC::GetLabelMotherWithPdg(const AliDielectronPair* pair, Int_t pdgMother){
137 return GetLabelMotherWithPdg(pair->GetFirstDaughter(),pair->GetSecondDaughter(),pdgMother);