AliRoot Core  3dc7879 (3dc7879)
AliMCEventHandler.h
Go to the documentation of this file.
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 
37 {
38 public:
39 
41 
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  AliVEvent* GetEvent() const {return (AliVEvent*)fMCEvent;}
69  AliMCEvent* MCEvent() const {return fMCEvent;}
70  TTree* TreeTR() const {return fTreeTR;}
71  TTree* TreeK() const {return fTreeK;}
72  virtual TTree* GetTree() const {return fTreeE;}
73  Int_t GetParticleAndTR(Int_t i, TParticle*& particle, TClonesArray*& trefs);
74  void DrawCheck(Int_t i, Int_t search=0);
75  Bool_t InitOk() const {return fInitOk;}
76  // Label manipulation
77  void SelectParticle(Int_t i);
78  Bool_t IsParticleSelected(Int_t i);
79  void CreateLabelMap();
80  Int_t GetNewLabel(Int_t i);
81 
82 private:
83  Bool_t OpenFile(Int_t i);
85  AliMCEventHandler(const AliMCEventHandler& handler);
87 private:
89  TFile *fFileE;
90  TFile *fFileK;
91  TFile *fFileTR;
92  TTree *fTreeE;
93  TTree *fTreeK;
94  TTree *fTreeTR;
95  TDirectoryFile *fDirK;
96  TDirectoryFile *fDirTR;
98  TExMap fLabelMap;
99  Int_t fNEvent;
100  Int_t fEvent;
101  TString *fPathName;
102  const Char_t *fkExtension;
103  Int_t fFileNumber;
105  Bool_t fReadTR; // determines if TR shall be read
106  Bool_t fInitOk; // Initialization ok
109  PreReadMode_t fPreReadMode; // Pre reading mode
110  Long64_t fCacheSize; // Cache size for kinematics tree
111  TTreeCache *fCacheTK;
112  TTreeCache *fCacheTR;
113 
114  ClassDef(AliMCEventHandler,3) //MC Truth EventHandler class
115 };
116 #endif
117 
TFile * fFileTR
File with TreeK.
virtual void SetPreReadMode(PreReadMode_t mode)
virtual void SetReadTR(Bool_t flag)
AliVEvent * GetEvent() const
TTree * fTreeE
File with TreeTR.
TTree * TreeTR() const
Bool_t IsParticleSelected(Int_t i)
const char * path
Int_t fFileNumber
File name extension.
TTree * fTreeK
TreeE (Event Headers)
TExMap fParticleSelected
Directory for TR Tree.
virtual Bool_t FinishEvent()
virtual void SetOutputFileName(const char *)
TString * fPathName
Current event.
virtual void SetCacheSize(Long64_t size)
void DrawCheck(Int_t i, Int_t search=0)
virtual Bool_t GetEntry()
virtual Bool_t LoadEvent(Int_t iev)
TExMap fLabelMap
List of selected MC particles for t.
virtual Bool_t BeginEvent(Long64_t entry)
Int_t fEventsPerFile
Input file number.
Int_t fNEvent
Stores the Map of MC (ESDLabel,AODlabel)
virtual Bool_t Notify()
virtual Bool_t Init(TTree *, Option_t *)
TDirectoryFile * fDirTR
Directory for Kine Tree.
const Char_t * fkExtension
Input file path.
virtual void ResetIO()
TTreeCache * fCacheTR
Cache for kinematics tree.
Int_t fEvent
Number of events.
virtual Bool_t Init(Option_t *opt)
TTree * TreeK() const
void SelectParticle(Int_t i)
Int_t fEventsInContainer
List of subsidiary MC handlers (for example for Background)
TTree * fTreeTR
TreeK (kinematics tree)
PreReadMode_t fPreReadMode
Number of events in container class.
Int_t GetNewLabel(Int_t i)
virtual Bool_t InitIO(Option_t *opt)
TFile * fFileE
MC Event.
AliMCEvent * MCEvent() const
Bool_t OpenFile(Int_t i)
Bool_t InitOk() const
AliMCEventHandler & operator=(const AliMCEventHandler &handler)
TFile * fFileK
File with TreeE.
Int_t GetParticleAndTR(Int_t i, TParticle *&particle, TClonesArray *&trefs)
virtual void AddSubsidiaryHandler(AliMCEventHandler *handler)
virtual Bool_t TerminateIO()
virtual void SetInputPath(const char *fname)
Bool_t fReadTR
Number of events per file.
virtual Bool_t Notify()
virtual TTree * GetTree() const
virtual void SetNumberOfEventsInContainer(Int_t nev)
TDirectoryFile * fDirK
TreeTR (track references tree)
virtual Bool_t Terminate()
char * fname
virtual const char * GetOutputFileName() const
virtual TString * GetInputPath() const
virtual void SetInputTree(TTree *)
AliMCEvent * fMCEvent