]>
Commit | Line | Data |
---|---|---|
1 | // -*- mode: C++ -*- | |
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 */ | |
6 | ||
7 | ||
8 | /* $Id$ */ | |
9 | ||
10 | //------------------------------------------------------------------------- | |
11 | // Class AliMCEvent | |
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. | |
15 | // | |
16 | // Origin: Andreas Morsch, CERN, andreas.morsch@cern.ch | |
17 | //------------------------------------------------------------------------- | |
18 | #include "AliInputEventHandler.h" | |
19 | #include "AliHeader.h" | |
20 | #include <TExMap.h> | |
21 | ||
22 | class TFile; | |
23 | class TTree; | |
24 | class TList; | |
25 | class TTreeCache; | |
26 | ||
27 | class TParticle; | |
28 | class TString; | |
29 | class TClonesArray; | |
30 | class TDirectoryFile; | |
31 | ||
32 | class AliMCEvent; | |
33 | ||
34 | ||
35 | ||
36 | class AliMCEventHandler : public AliInputEventHandler | |
37 | { | |
38 | public: | |
39 | ||
40 | enum PreReadMode_t {kNoPreRead = 0, kLmPreRead = 1, kHmPreRead = 2}; | |
41 | ||
42 | AliMCEventHandler(); | |
43 | AliMCEventHandler(const char* name, const char* title); | |
44 | virtual ~AliMCEventHandler(); | |
45 | virtual void SetOutputFileName(const char* /* fname */) {;} | |
46 | virtual const char* GetOutputFileName() const {return 0;} | |
47 | virtual void SetInputPath(const char* fname); | |
48 | virtual void SetInputTree(TTree* /*tree*/) {;} | |
49 | virtual TString* GetInputPath() const {return fPathName;} | |
50 | virtual Bool_t Init(Option_t* opt); | |
51 | virtual Bool_t GetEntry() {return kTRUE;} | |
52 | virtual Bool_t InitIO(Option_t* opt) {return Init(opt);}; | |
53 | virtual Bool_t Init(TTree* /*tree*/, Option_t* /*opt*/) {return kTRUE;} | |
54 | virtual Bool_t BeginEvent(Long64_t entry); | |
55 | virtual Bool_t Notify() { return AliVEventHandler::Notify(); }; | |
56 | virtual Bool_t Notify(const char* path); | |
57 | virtual Bool_t FinishEvent(); | |
58 | virtual Bool_t Terminate(); | |
59 | virtual Bool_t TerminateIO(); | |
60 | virtual void ResetIO(); | |
61 | virtual Bool_t LoadEvent(Int_t iev); | |
62 | virtual void SetReadTR(Bool_t flag) { Changed(); fReadTR = flag; } | |
63 | virtual void AddSubsidiaryHandler(AliMCEventHandler* handler); | |
64 | virtual void SetNumberOfEventsInContainer(Int_t nev) {fEventsInContainer = nev;} | |
65 | virtual void SetPreReadMode(PreReadMode_t mode) {Changed(); fPreReadMode = mode;} | |
66 | virtual void SetCacheSize(Long64_t size) {if (fCacheSize==0) fCacheSize = size;} | |
67 | // | |
68 | AliMCEvent* MCEvent() const {return fMCEvent;} | |
69 | TTree* TreeTR() const {return fTreeTR;} | |
70 | TTree* TreeK() const {return fTreeK;} | |
71 | virtual TTree* GetTree() const {return fTreeE;} | |
72 | Int_t GetParticleAndTR(Int_t i, TParticle*& particle, TClonesArray*& trefs); | |
73 | void DrawCheck(Int_t i, Int_t search=0); | |
74 | Bool_t InitOk() const {return fInitOk;} | |
75 | // Label manipulation | |
76 | void SelectParticle(Int_t i); | |
77 | Bool_t IsParticleSelected(Int_t i); | |
78 | void CreateLabelMap(); | |
79 | Int_t GetNewLabel(Int_t i); | |
80 | ||
81 | private: | |
82 | Bool_t OpenFile(Int_t i); | |
83 | void VerifySelectedParticles(); | |
84 | AliMCEventHandler(const AliMCEventHandler& handler); | |
85 | AliMCEventHandler& operator=(const AliMCEventHandler& handler); | |
86 | private: | |
87 | AliMCEvent *fMCEvent; //! MC Event | |
88 | TFile *fFileE; //! File with TreeE | |
89 | TFile *fFileK; //! File with TreeK | |
90 | TFile *fFileTR; //! File with TreeTR | |
91 | TTree *fTreeE; //! TreeE (Event Headers) | |
92 | TTree *fTreeK; //! TreeK (kinematics tree) | |
93 | TTree *fTreeTR; //! TreeTR (track references tree) | |
94 | TDirectoryFile *fDirK; //! Directory for Kine Tree | |
95 | TDirectoryFile *fDirTR; //! Directory for TR Tree | |
96 | TExMap fParticleSelected; //! List of selected MC particles for t | |
97 | TExMap fLabelMap; //! Stores the Map of MC (ESDLabel,AODlabel) | |
98 | Int_t fNEvent; //! Number of events | |
99 | Int_t fEvent; //! Current event | |
100 | TString *fPathName; //! Input file path | |
101 | const Char_t *fkExtension; //! File name extension | |
102 | Int_t fFileNumber; //! Input file number | |
103 | Int_t fEventsPerFile; //! Number of events per file | |
104 | Bool_t fReadTR; // determines if TR shall be read | |
105 | Bool_t fInitOk; // Initialization ok | |
106 | TList *fSubsidiaryHandlers; //! List of subsidiary MC handlers (for example for Background) | |
107 | Int_t fEventsInContainer; //! Number of events in container class | |
108 | PreReadMode_t fPreReadMode; // Pre reading mode | |
109 | Long64_t fCacheSize; // Cache size for kinematics tree | |
110 | TTreeCache *fCacheTK; //! Cache for kinematics tree | |
111 | TTreeCache *fCacheTR; //! Cache for track references tree | |
112 | ||
113 | ClassDef(AliMCEventHandler,3) //MC Truth EventHandler class | |
114 | }; | |
115 | #endif | |
116 |