]>
Commit | Line | Data |
---|---|---|
2e658fb9 | 1 | /** |
2 | * @file AliMCAuxHandler.h | |
3 | * @author Christian Holm Christensen <cholm@master.hehi.nbi.dk> | |
4 | * @date Thu Feb 7 12:04:02 2013 | |
5 | * | |
6 | * @brief | |
7 | * | |
8 | * | |
9 | */ | |
10 | #ifndef ALIFMDMCHITHANDLER_H | |
11 | #define ALIFMDMCHITHANDLER_H | |
12 | #include <AliMCEventHandler.h> | |
13 | class TFile; | |
14 | class TTree; | |
15 | ||
16 | /** | |
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 | |
20 | * | |
21 | */ | |
22 | class AliMCAuxHandler : public AliMCEventHandler | |
23 | { | |
24 | public: | |
25 | /** | |
26 | * Constructor | |
27 | * | |
c8b1a7db | 28 | * @param name Name |
29 | * @param clsName Class name of hits | |
30 | * @param parent Parent event handler | |
2e658fb9 | 31 | */ |
32 | AliMCAuxHandler(const char* name="FMD", | |
33 | const char* clsName="AliFMDHit", | |
34 | AliMCEventHandler* parent=0); | |
c8b1a7db | 35 | /** Destructor */ |
2e658fb9 | 36 | virtual ~AliMCAuxHandler() {} |
37 | /** | |
38 | * @{ | |
39 | * @name Interface member functions | |
40 | */ | |
41 | /** | |
42 | * Intialize | |
43 | * | |
44 | * @param t Not used | |
45 | * @param o Not used | |
46 | * | |
47 | * @return always true | |
48 | */ | |
49 | virtual Bool_t Init(TTree* t,Option_t* o) { return AliMCEventHandler::Init(t,o); } | |
50 | /** | |
51 | * Initialize the input | |
52 | * | |
53 | * @param opt Options | |
54 | * | |
55 | * @return true on success | |
56 | */ | |
57 | virtual Bool_t Init(Option_t* opt); | |
58 | /** | |
59 | * Called at the beginning of an event | |
60 | * | |
61 | * @param entry Entry in tree | |
62 | * | |
63 | * @return true on success | |
64 | */ | |
65 | virtual Bool_t BeginEvent(Long64_t entry); | |
66 | /** | |
67 | * Called when the input file is changed | |
68 | * | |
2e658fb9 | 69 | * @return true on success |
70 | */ | |
71 | virtual Bool_t Notify() { return AliMCEventHandler::Notify(); } | |
72 | /** | |
73 | * Called when the input file is changed | |
74 | * | |
75 | * @param path New path | |
76 | * | |
77 | * @return true on success | |
78 | */ | |
79 | virtual Bool_t Notify(const char* path); | |
80 | /** | |
81 | * Called at the end of an event | |
82 | * | |
83 | * @return true on success | |
84 | */ | |
85 | virtual Bool_t FinishEvent(); | |
86 | /** | |
87 | * Called at the end of a job | |
88 | * | |
89 | * @return true on success | |
90 | */ | |
91 | virtual Bool_t Terminate(); | |
92 | /** | |
93 | * Called at the end of a sub-job | |
94 | * | |
95 | * @return true on success | |
96 | */ | |
97 | virtual Bool_t TerminateIO(); | |
98 | /** | |
99 | * Reset the I/O | |
100 | * | |
101 | */ | |
102 | virtual void ResetIO(); | |
103 | /** | |
104 | * Load an event | |
105 | * | |
106 | * @param iev Event number | |
107 | * | |
108 | * @return true on success | |
109 | */ | |
110 | virtual Bool_t LoadEvent(Int_t iev); | |
111 | /** | |
112 | * Set the number of events in the container | |
113 | * | |
114 | * @param nev Number of events | |
115 | */ | |
116 | virtual void SetNumberOfEventsInContainer(Int_t nev) { | |
117 | this->fNEventsInContainer = nev;} | |
c8b1a7db | 118 | /** |
119 | * Open a file | |
120 | * | |
121 | * @param ev event number | |
122 | * | |
123 | * @return true on success | |
124 | */ | |
2e658fb9 | 125 | virtual Bool_t OpenFile(Int_t ev); |
126 | /* @} */ | |
127 | ||
c8b1a7db | 128 | /** |
129 | * Get the parent handler | |
130 | * | |
131 | * @return Parent handler | |
132 | */ | |
2e658fb9 | 133 | AliMCEventHandler* GetParent() { return fParent; } |
134 | /** | |
135 | * Get the tree | |
136 | * | |
137 | * @return The connected hits tree | |
138 | */ | |
139 | virtual TTree* GetTree() const { return fTree;} | |
c8b1a7db | 140 | /** |
141 | * Get array of hits | |
142 | * | |
143 | * @return Array of hits | |
144 | */ | |
2e658fb9 | 145 | TClonesArray* GetArray() const { return fArray; } |
c8b1a7db | 146 | /** |
147 | * Get the number of entries | |
148 | * | |
149 | * @return Entries in array | |
150 | */ | |
2e658fb9 | 151 | Int_t GetNEntry() const; |
c8b1a7db | 152 | /** |
153 | * Get array of track-refs for an entry | |
154 | * | |
155 | * @param entry Entry number | |
156 | * | |
157 | * @return Array | |
158 | */ | |
2e658fb9 | 159 | TClonesArray* GetEntryArray(Int_t entry); |
160 | /** | |
161 | * Static member function to create and attach this handler | |
162 | * | |
163 | * @param name Name of the handler | |
c8b1a7db | 164 | * @param what What to get |
2e658fb9 | 165 | * |
166 | * @return Newly allocated handler or null | |
167 | */ | |
168 | static AliMCAuxHandler* Create(const char* name="FMD", | |
169 | const char* what="Hits"); | |
c8b1a7db | 170 | /** |
171 | * Static member function to get the kinamtics array | |
172 | * | |
173 | * @param handler Unput handler | |
174 | * @param particle Particle number | |
175 | * | |
176 | * @return Array of hits | |
177 | */ | |
2e658fb9 | 178 | static TClonesArray* GetParticleArray(AliMCAuxHandler* handler, |
179 | Int_t particle); | |
180 | protected: | |
c8b1a7db | 181 | /** |
182 | * Copy constructor | |
183 | * | |
184 | * @param o Object to copy from | |
185 | */ | |
2e658fb9 | 186 | AliMCAuxHandler(const AliMCAuxHandler& o) |
187 | : AliMCEventHandler(), | |
188 | fParent(o.fParent), | |
189 | fFile(0), | |
190 | fTree(0), | |
191 | fDir(0), | |
192 | fArray(0), | |
193 | fNEvents(0), | |
194 | fNEventsPerFile(0), | |
195 | fNEventsInContainer(0), | |
196 | fEvent(0), | |
197 | fFileNumber(0), | |
198 | fTreeName(""), | |
199 | fFileBase("") | |
200 | {} | |
c8b1a7db | 201 | /** |
202 | * Assignment operator | |
203 | * | |
204 | * @param o Object to assign from | |
205 | * | |
206 | * @return reference to this object | |
207 | */ | |
2e658fb9 | 208 | AliMCAuxHandler& operator=(const AliMCAuxHandler& o) |
209 | { | |
210 | if (&o == this) return *this; | |
211 | // AliMCEventHandler::operator=(o); | |
212 | fParent = o.fParent; | |
213 | fFile = o.fFile; | |
214 | fTree = o.fTree; | |
215 | return *this; | |
216 | } | |
c8b1a7db | 217 | /** |
218 | * Get the parent path | |
219 | * | |
220 | * @return Parent path | |
221 | */ | |
2e658fb9 | 222 | TString* GetParentPath() const; |
223 | AliMCEventHandler* fParent; // Parent MC handler | |
224 | TFile* fFile; //! | |
225 | TTree* fTree; //! | |
226 | TDirectory* fDir; //! | |
227 | TClonesArray* fArray; //! | |
228 | Int_t fNEvents; //! | |
229 | Int_t fNEventsPerFile; //! | |
230 | Int_t fNEventsInContainer; //! | |
231 | Int_t fEvent; //! | |
232 | Int_t fFileNumber; //! | |
233 | TString fTreeName; //! | |
234 | TString fFileBase; //! | |
235 | ClassDef(AliMCAuxHandler,1); // Connect FMD hits tree | |
236 | }; | |
237 | ||
238 | #endif | |
239 | // Local Variables: | |
240 | // mode: C++ | |
241 | // End: | |
242 |