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"
31 class AliMCEventHandler : public AliVEventHandler
35 AliMCEventHandler(const char* name, const char* title);
36 virtual ~AliMCEventHandler();
37 virtual void SetOutputFileName(char* /* fname */) {;}
38 virtual char* GetOutputFileName() {return 0;}
39 virtual void SetInputPath(char* fname);
40 virtual void SetInputTree(TTree* /*tree*/) {;}
41 virtual TString* GetInputPath() {return fPathName;}
42 virtual Bool_t Init(Option_t* opt);
43 virtual Bool_t InitIO(Option_t* opt) {return Init(opt);};
44 virtual Bool_t Init(TTree* /*tree*/, Option_t* /*opt*/) {return kTRUE;}
45 virtual Bool_t BeginEvent(Long64_t entry);
46 virtual Bool_t Notify() { return AliVEventHandler::Notify(); };
47 virtual Bool_t Notify(const char* path);
48 virtual Bool_t FinishEvent();
49 virtual Bool_t Terminate();
50 virtual Bool_t TerminateIO();
51 virtual void ResetIO();
52 virtual Bool_t GetEvent(Int_t iev);
53 virtual void SetReadTR(Bool_t flag) { fReadTR = flag; }
55 AliMCEvent* MCEvent() {return fMCEvent;}
56 TTree* TreeTR() {return fTreeTR;}
57 Int_t GetParticleAndTR(Int_t i, TParticle*& particle, TClonesArray*& trefs);
58 void DrawCheck(Int_t i, Int_t search=0);
60 Bool_t OpenFile(Int_t i);
62 AliMCEvent *fMCEvent; //! MC Event
63 TFile *fFileE; //! File with TreeE
64 TFile *fFileK; //! File with TreeK
65 TFile *fFileTR; //! File with TreeTR
66 TTree *fTreeE; //! TreeE (Event Headers)
67 TTree *fTreeK; //! TreeK (kinematics tree)
68 TTree *fTreeTR; //! TreeTR (track references tree)
69 TDirectoryFile *fDirK; //! Directory for Kine Tree
70 TDirectoryFile *fDirTR; //! Directory for TR Tree
71 Int_t fNEvent; //! Number of events
72 Int_t fEvent; //! Current event
73 TString *fPathName; //! Input file path
74 char *fExtension; //! File name extension
75 Int_t fFileNumber; //! Input file number
76 Int_t fEventsPerFile; //! Number of events per file
77 Bool_t fReadTR; // determines if TR shall be read
78 ClassDef(AliMCEventHandler,1) //MC Truth EventHandler class