2 #ifndef ALIMCEVENTHANDLER_H
3 #define ALIMCEVENTHANDLER_H
4 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5 * See cxx source for full Copyright notice */
10 //-------------------------------------------------------------------------
12 // This class gives access to MC truth during the analysis.
13 // Monte Carlo truth is contained in the kinematics tree (produced particles) and
14 // the tree of reference hits.
16 // Origin: Andreas Morsch, CERN, andreas.morsch@cern.ch
17 //-------------------------------------------------------------------------
18 #include "AliVEventHandler.h"
19 #include "AliHeader.h"
35 class AliMCEventHandler : public AliVEventHandler
39 enum PreReadMode_t {kNoPreRead = 0, kLmPreRead = 1, kHmPreRead = 2};
42 AliMCEventHandler(const char* name, const char* title);
43 virtual ~AliMCEventHandler();
44 virtual void SetOutputFileName(const char* /* fname */) {;}
45 virtual const char* GetOutputFileName() {return 0;}
46 virtual void SetInputPath(const char* fname);
47 virtual void SetInputTree(TTree* /*tree*/) {;}
48 virtual TString* GetInputPath() const {return fPathName;}
49 virtual Bool_t Init(Option_t* opt);
50 virtual Bool_t GetEntry() {return kTRUE;}
51 virtual Bool_t InitIO(Option_t* opt) {return Init(opt);};
52 virtual Bool_t Init(TTree* /*tree*/, Option_t* /*opt*/) {return kTRUE;}
53 virtual Bool_t BeginEvent(Long64_t entry);
54 virtual Bool_t Notify() { return AliVEventHandler::Notify(); };
55 virtual Bool_t Notify(const char* path);
56 virtual Bool_t FinishEvent();
57 virtual Bool_t Terminate();
58 virtual Bool_t TerminateIO();
59 virtual void ResetIO();
60 virtual Bool_t GetEvent(Int_t iev);
61 virtual void SetReadTR(Bool_t flag) { fReadTR = flag; }
62 virtual void AddSubsidiaryHandler(AliMCEventHandler* handler);
63 virtual void SetNumberOfEventsInContainer(Int_t nev) {fEventsInContainer = nev;}
64 virtual void SetPreReadMode(PreReadMode_t mode) {fPreReadMode = mode;}
66 AliMCEvent* MCEvent() const {return fMCEvent;}
67 TTree* TreeTR() const {return fTreeTR;}
68 TTree* TreeK() const {return fTreeK;}
69 virtual TTree* GetTree() const {return fTreeE;}
70 Int_t GetParticleAndTR(Int_t i, TParticle*& particle, TClonesArray*& trefs);
71 void DrawCheck(Int_t i, Int_t search=0);
72 Bool_t InitOk() {return fInitOk;}
74 void SelectParticle(Int_t i);
75 Bool_t IsParticleSelected(Int_t i);
76 void CreateLabelMap();
77 Int_t GetNewLabel(Int_t i);
80 Bool_t OpenFile(Int_t i);
81 void VerifySelectedParticles();
82 AliMCEventHandler(const AliMCEventHandler& handler);
83 AliMCEventHandler& operator=(const AliMCEventHandler& handler);
85 AliMCEvent *fMCEvent; //! MC Event
86 TFile *fFileE; //! File with TreeE
87 TFile *fFileK; //! File with TreeK
88 TFile *fFileTR; //! File with TreeTR
89 TTree *fTreeE; //! TreeE (Event Headers)
90 TTree *fTreeK; //! TreeK (kinematics tree)
91 TTree *fTreeTR; //! TreeTR (track references tree)
92 TDirectoryFile *fDirK; //! Directory for Kine Tree
93 TDirectoryFile *fDirTR; //! Directory for TR Tree
94 TExMap fParticleSelected; //! List of selected MC particles for t
95 TExMap fLabelMap; //! Stores the Map of MC (ESDLabel,AODlabel)
96 Int_t fNEvent; //! Number of events
97 Int_t fEvent; //! Current event
98 TString *fPathName; //! Input file path
99 const Char_t *fExtension; //! File name extension
100 Int_t fFileNumber; //! Input file number
101 Int_t fEventsPerFile; //! Number of events per file
102 Bool_t fReadTR; // determines if TR shall be read
103 Bool_t fInitOk; // Initialization ok
104 TList *fSubsidiaryHandlers; //! List of subsidiary MC handlers (for example for Background)
105 Int_t fEventsInContainer; //! Number of events in container class
106 PreReadMode_t fPreReadMode; //! Pre reading mode
108 ClassDef(AliMCEventHandler,1) //MC Truth EventHandler class