Add dielectron framework to PWG3
[u/mrichter/AliRoot.git] / PWG3 / dielectron / AliDielectronMC.h
CommitLineData
b2a297fa 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
18class AliESDEvent;
19class AliHFEpid;
20class AliStack;
21class AliMCEvent;
22class AliESDtrack;
23class TParticle;
24class AliMCParticle;
25class AliAODMCParticle;
26
27#include "AliDielectronPair.h"
28
29class AliDielectronMC : public TObject{
30
31public:
32 enum AnalysisType {kUNSET=0, kESD, kAOD};
33
34 AliDielectronMC(AnalysisType type=kUNSET);
35 virtual ~AliDielectronMC();
36
37 static AliDielectronMC* Instance();
38
39 void Initialize(); // initialization
40 Int_t GetNMCTracks(); // return number of generated tracks
41 Int_t GetNMCTracksFromStack(); // return number of generated tracks from stack
42 Int_t GetMCPID(AliESDtrack* _track); // return MC PID
43 Int_t GetMCPIDFromStack(AliESDtrack* _track); // return MC PID
44 Int_t GetMotherPDG(AliESDtrack* _track); // return mother PID from the MC stack
45 Int_t GetMotherPDGFromStack(AliESDtrack* _track); // return mother PID from the MC stack
46 Int_t GetMCProcess(AliESDtrack* _track); // return process number
47 Int_t GetMCProcessFromStack(AliESDtrack* _track); // return process number
48 Int_t GetMCProcessMother(AliESDtrack* _track); // return process number of the mother track
49 Int_t GetMCProcessMotherFromStack(AliESDtrack* _track); // return process number of the mother track
50
51 Bool_t ConnectMCEvent();
52 Bool_t UpdateStack();
53
54 Bool_t IsMotherPdg(const TObject* particle, Int_t pdgMother);
55 Bool_t IsMotherPdg(const AliVParticle *particle1, const AliVParticle *particle2, Int_t pdgMother);
56 Bool_t IsMCMotherToEE(const AliVParticle *particle, Int_t pdgMother);
57
58 AliVParticle* GetMCTrackFromMCEvent(AliVParticle *track); // return MC track directly from MC event
59 AliVParticle* GetMCTrackFromMCEvent(Int_t _itrk); // return MC track directly from MC event
60 TParticle* GetMCTrackFromStack(AliESDtrack* _track); // return MC track from stack
61 AliMCParticle* GetMCTrack(AliESDtrack* _track); // return MC track associated with reco track
62 TParticle* GetMCTrackMotherFromStack(AliESDtrack* _track); // return MC mother track from stack
63 AliMCParticle* GetMCTrackMother(AliESDtrack* _track); // return MC mother track from stack
64
65private:
66 AliMCEvent *fMCEvent; // MC event object
67 AliStack *fStack; // MC stack
68
69 AnalysisType fAnaType; // Analysis type
70
71 static AliDielectronMC* fgInstance; //! singleton pointer
72
73 AliDielectronMC(const AliDielectronMC &c);
74 AliDielectronMC &operator=(const AliDielectronMC &c);
75
76 Bool_t IsMCMotherToEEesd(const AliMCParticle *particle, Int_t pdgMother);
77 Bool_t IsMCMotherToEEaod(const AliAODMCParticle *particle, Int_t pdgMother);
78
79 Bool_t IsMotherPdgESD(const AliVParticle *particle1, const AliVParticle *particle2, Int_t pdgMother);
80 Bool_t IsMotherPdgAOD(const AliVParticle *particle1, const AliVParticle *particle2, Int_t pdgMother);
81
82 ClassDef(AliDielectronMC, 0)
83};
84
85inline Bool_t AliDielectronMC::IsMotherPdg(const TObject* particle, Int_t pdgMother)
86{
87 //
88 //
89 //
90 if (particle->IsA()!=AliDielectronPair::Class()) return kFALSE;
91 const AliDielectronPair *pair=static_cast<const AliDielectronPair*>(particle);
92 return IsMotherPdg(pair->GetFirstDaughter(),pair->GetSecondDaughter(),pdgMother);
93}
94
95#endif