]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG3/dielectron/AliDielectronMC.h
cc0edef124e247ec65a1043f5ece8bfb7e33dd9a
[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   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
65   void GetDaughters(const TObject *mother, AliVParticle* &d1, AliVParticle* &d2);
66   
67 private:
68   AliMCEvent    *fMCEvent;  // MC event object
69   AliStack      *fStack;    // MC stack
70
71   AnalysisType fAnaType;    // Analysis type
72   
73   static AliDielectronMC* fgInstance; //! singleton pointer
74   
75   AliDielectronMC(const AliDielectronMC &c);
76   AliDielectronMC &operator=(const AliDielectronMC &c);
77
78   Bool_t IsMCMotherToEEesd(const AliMCParticle *particle, Int_t pdgMother);
79   Bool_t IsMCMotherToEEaod(const AliAODMCParticle *particle, Int_t pdgMother);
80
81   Bool_t IsMotherPdgESD(const AliVParticle *particle1, const AliVParticle *particle2, Int_t pdgMother);
82   Bool_t IsMotherPdgAOD(const AliVParticle *particle1, const AliVParticle *particle2, Int_t pdgMother);
83   
84   ClassDef(AliDielectronMC, 0)
85 };
86
87 inline Bool_t AliDielectronMC::IsMotherPdg(const TObject* particle, Int_t pdgMother)
88 {
89   //
90   //
91   //
92   if (particle->IsA()!=AliDielectronPair::Class()) return kFALSE;
93   const AliDielectronPair *pair=static_cast<const AliDielectronPair*>(particle);
94   return IsMotherPdg(pair->GetFirstDaughter(),pair->GetSecondDaughter(),pdgMother);
95 }
96
97 #endif