2 * @file AliFMDMCHitHandler.h
3 * @author Christian Holm Christensen <cholm@master.hehi.nbi.dk>
4 * @date Thu Feb 7 12:04:02 2013
10 #ifndef ALIFMDMCHITHANDLER_H
11 #define ALIFMDMCHITHANDLER_H
12 #include <AliMCEventHandler.h>
17 * This class defines an input handler for simulated data which will
18 * connect the FMD Hit tree. It is intended to be added to the global
19 * MC input handler using AliMCEventHandler::AddSubsidiaryHandler
22 class AliFMDMCHitHandler : public AliMCEventHandler
29 * @param clsName Class name of hits
30 * @param parent Parent event handler
32 AliFMDMCHitHandler(const char* name="FMD",
33 const char* clsName="AliFMDHit",
34 AliMCEventHandler* parent=0);
36 virtual ~AliFMDMCHitHandler() {}
39 * @name Interface member functions
49 virtual Bool_t Init(TTree* t,Option_t* o) { return AliMCEventHandler::Init(t,o); }
51 * Initialize the input
55 * @return true on success
57 virtual Bool_t Init(Option_t* opt);
59 * Called at the beginning of an event
61 * @param entry Entry in tree
63 * @return true on success
65 virtual Bool_t BeginEvent(Long64_t entry);
67 * Called when the input file is changed
69 * @return true on success
71 virtual Bool_t Notify() { return AliMCEventHandler::Notify(); }
73 * Called when the input file is changed
75 * @param path New path
77 * @return true on success
79 virtual Bool_t Notify(const char* path);
81 * Called at the end of an event
83 * @return true on success
85 virtual Bool_t FinishEvent();
87 * Called at the end of a job
89 * @return true on success
91 virtual Bool_t Terminate();
93 * Called at the end of a sub-job
95 * @return true on success
97 virtual Bool_t TerminateIO();
102 virtual void ResetIO();
106 * @param iev Event number
108 * @return true on success
110 virtual Bool_t LoadEvent(Int_t iev);
112 * Set the number of events in the container
114 * @param nev Number of events
116 virtual void SetNumberOfEventsInContainer(Int_t nev) {
117 this->fNEventsInContainer = nev;}
121 * @param ev event number
123 * @return true on success
125 virtual Bool_t OpenFile(Int_t ev);
129 * Get the parent handler
131 * @return Parent handler
133 AliMCEventHandler* GetParent() { return fParent; }
137 * @return The connected hits tree
139 virtual TTree* GetTree() const { return fTree;}
143 * @return Array of hits
145 TClonesArray* GetArray() { return fArray; }
147 * Static member function to create and attach this handler
149 * @param name Name of the handler
150 * @param what What to get
152 * @return Newly allocated handler or null
154 static AliFMDMCHitHandler* Create(const char* name="FMD",
155 const char* what="Hits");
157 * Static member function to get the kinamtics array
159 * @param handler Unput handler
160 * @param particle Particle number
162 * @return Array of hits
164 static TClonesArray* GetParticleArray(AliFMDMCHitHandler* handler,
170 * @param o Object to copy from
172 AliFMDMCHitHandler(const AliFMDMCHitHandler& o)
173 : AliMCEventHandler(),
181 fNEventsInContainer(0),
188 * Assignment operator
190 * @param o Object to assign from
192 * @return reference to this object
194 AliFMDMCHitHandler& operator=(const AliFMDMCHitHandler& o)
196 if (&o == this) return *this;
197 // AliMCEventHandler::operator=(o);
204 * Get the parent path
206 * @return Parent path
208 TString* GetParentPath() const;
209 AliMCEventHandler* fParent; // Parent MC handler
212 TDirectory* fDir; //!
213 TClonesArray* fArray; //!
215 Int_t fNEventsPerFile; //!
216 Int_t fNEventsInContainer; //!
218 Int_t fFileNumber; //!
219 TString fTreeName; //!
220 TString fFileBase; //!
221 ClassDef(AliFMDMCHitHandler,1); // Connect FMD hits tree