2 * @file AliMCAuxHandler.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 AliMCAuxHandler : public AliMCEventHandler
29 * @param clsName Class name of hits
30 * @param parent Parent event handler
32 AliMCAuxHandler(const char* name="FMD",
33 const char* clsName="AliFMDHit",
34 AliMCEventHandler* parent=0);
36 virtual ~AliMCAuxHandler() {}
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() const { return fArray; }
147 * Get the number of entries
149 * @return Entries in array
151 Int_t GetNEntry() const;
153 * Get array of track-refs for an entry
155 * @param entry Entry number
159 TClonesArray* GetEntryArray(Int_t entry);
161 * Static member function to create and attach this handler
163 * @param name Name of the handler
164 * @param what What to get
166 * @return Newly allocated handler or null
168 static AliMCAuxHandler* Create(const char* name="FMD",
169 const char* what="Hits");
171 * Static member function to get the kinamtics array
173 * @param handler Unput handler
174 * @param particle Particle number
176 * @return Array of hits
178 static TClonesArray* GetParticleArray(AliMCAuxHandler* handler,
184 * @param o Object to copy from
186 AliMCAuxHandler(const AliMCAuxHandler& o)
187 : AliMCEventHandler(),
195 fNEventsInContainer(0),
202 * Assignment operator
204 * @param o Object to assign from
206 * @return reference to this object
208 AliMCAuxHandler& operator=(const AliMCAuxHandler& o)
210 if (&o == this) return *this;
211 // AliMCEventHandler::operator=(o);
218 * Get the parent path
220 * @return Parent path
222 TString* GetParentPath() const;
223 AliMCEventHandler* fParent; // Parent MC handler
226 TDirectory* fDir; //!
227 TClonesArray* fArray; //!
229 Int_t fNEventsPerFile; //!
230 Int_t fNEventsInContainer; //!
232 Int_t fFileNumber; //!
233 TString fTreeName; //!
234 TString fFileBase; //!
235 ClassDef(AliMCAuxHandler,1); // Connect FMD hits tree