]>
Commit | Line | Data |
---|---|---|
e473e8b0 | 1 | // -*- mode: C++ -*- |
5fe09262 | 2 | #ifndef ALIMCEVENTHANDLER_H |
3 | #define ALIMCEVENTHANDLER_H | |
033693d3 | 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. | |
415d9f5c | 13 | // Monte Carlo truth is contained in the kinematics tree (produced particles) and |
033693d3 | 14 | // the tree of reference hits. |
15 | // | |
16 | // Origin: Andreas Morsch, CERN, andreas.morsch@cern.ch | |
17 | //------------------------------------------------------------------------- | |
e473e8b0 | 18 | #include "AliInputEventHandler.h" |
47b95647 | 19 | #include "AliHeader.h" |
da97a08a | 20 | #include <TExMap.h> |
21 | ||
033693d3 | 22 | class TFile; |
23 | class TTree; | |
93836e1b | 24 | class TList; |
43072535 | 25 | class TTreeCache; |
93836e1b | 26 | |
033693d3 | 27 | class TParticle; |
0a05cd41 | 28 | class TString; |
033693d3 | 29 | class TClonesArray; |
5efedd31 | 30 | class TDirectoryFile; |
31 | ||
415d9f5c | 32 | class AliMCEvent; |
33 | ||
033693d3 | 34 | |
35 | ||
e473e8b0 | 36 | class AliMCEventHandler : public AliInputEventHandler |
033693d3 | 37 | { |
38 | public: | |
35152e4b | 39 | |
40 | enum PreReadMode_t {kNoPreRead = 0, kLmPreRead = 1, kHmPreRead = 2}; | |
41 | ||
5fe09262 | 42 | AliMCEventHandler(); |
43 | AliMCEventHandler(const char* name, const char* title); | |
44 | virtual ~AliMCEventHandler(); | |
0931e76a | 45 | virtual void SetOutputFileName(const char* /* fname */) {;} |
fdbaa4ce | 46 | virtual const char* GetOutputFileName() const {return 0;} |
0931e76a | 47 | virtual void SetInputPath(const char* fname); |
933fd60f | 48 | virtual void SetInputTree(TTree* /*tree*/) {;} |
d0916b2f | 49 | virtual TString* GetInputPath() const {return fPathName;} |
300d5701 | 50 | virtual Bool_t Init(Option_t* opt); |
0d6a82a5 | 51 | virtual Bool_t GetEntry() {return kTRUE;} |
300d5701 | 52 | virtual Bool_t InitIO(Option_t* opt) {return Init(opt);}; |
53 | virtual Bool_t Init(TTree* /*tree*/, Option_t* /*opt*/) {return kTRUE;} | |
ed97dc98 | 54 | virtual Bool_t BeginEvent(Long64_t entry); |
24e577e5 | 55 | virtual Bool_t Notify() { return AliVEventHandler::Notify(); }; |
890126ab | 56 | virtual Bool_t Notify(const char* path); |
033693d3 | 57 | virtual Bool_t FinishEvent(); |
58 | virtual Bool_t Terminate(); | |
59 | virtual Bool_t TerminateIO(); | |
5fe09262 | 60 | virtual void ResetIO(); |
e473e8b0 | 61 | virtual Bool_t LoadEvent(Int_t iev); |
59e0dcd5 | 62 | virtual void SetReadTR(Bool_t flag) { Changed(); fReadTR = flag; } |
93836e1b | 63 | virtual void AddSubsidiaryHandler(AliMCEventHandler* handler); |
64 | virtual void SetNumberOfEventsInContainer(Int_t nev) {fEventsInContainer = nev;} | |
59e0dcd5 | 65 | virtual void SetPreReadMode(PreReadMode_t mode) {Changed(); fPreReadMode = mode;} |
43072535 | 66 | virtual void SetCacheSize(Long64_t size) {if (fCacheSize==0) fCacheSize = size;} |
033693d3 | 67 | // |
e473e8b0 | 68 | AliMCEvent* MCEvent() const {return fMCEvent;} |
d0916b2f | 69 | TTree* TreeTR() const {return fTreeTR;} |
70 | TTree* TreeK() const {return fTreeK;} | |
8dd6eba0 | 71 | virtual TTree* GetTree() const {return fTreeE;} |
415d9f5c | 72 | Int_t GetParticleAndTR(Int_t i, TParticle*& particle, TClonesArray*& trefs); |
73 | void DrawCheck(Int_t i, Int_t search=0); | |
aa7e002c | 74 | Bool_t InitOk() const {return fInitOk;} |
b72029a3 | 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); | |
da97a08a | 80 | |
5fe09262 | 81 | private: |
415d9f5c | 82 | Bool_t OpenFile(Int_t i); |
da97a08a | 83 | void VerifySelectedParticles(); |
87d395bd | 84 | AliMCEventHandler(const AliMCEventHandler& handler); |
85 | AliMCEventHandler& operator=(const AliMCEventHandler& handler); | |
033693d3 | 86 | private: |
93836e1b | 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 | |
89afaa5a | 101 | const Char_t *fkExtension; //! File name extension |
93836e1b | 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) | |
35152e4b | 107 | Int_t fEventsInContainer; //! Number of events in container class |
ad336f69 | 108 | PreReadMode_t fPreReadMode; // Pre reading mode |
43072535 | 109 | Long64_t fCacheSize; // Cache size for kinematics tree |
110 | TTreeCache *fCacheTK; //! Cache for kinematics tree | |
111 | TTreeCache *fCacheTR; //! Cache for track references tree | |
35152e4b | 112 | |
43072535 | 113 | ClassDef(AliMCEventHandler,3) //MC Truth EventHandler class |
033693d3 | 114 | }; |
115 | #endif | |
116 |