]>
Commit | Line | Data |
---|---|---|
2e658fb9 | 1 | /** |
2 | * @file AliFMDMCHitHandler.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 AliFMDMCHitHandler : 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 | AliFMDMCHitHandler(const char* name="FMD", | |
33 | const char* clsName="AliFMDHit", | |
34 | AliMCEventHandler* parent=0); | |
c8b1a7db | 35 | /** Destructor */ |
2e658fb9 | 36 | virtual ~AliFMDMCHitHandler() {} |
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() { return fArray; } |
146 | /** | |
147 | * Static member function to create and attach this handler | |
148 | * | |
149 | * @param name Name of the handler | |
c8b1a7db | 150 | * @param what What to get |
2e658fb9 | 151 | * |
152 | * @return Newly allocated handler or null | |
153 | */ | |
154 | static AliFMDMCHitHandler* Create(const char* name="FMD", | |
155 | const char* what="Hits"); | |
c8b1a7db | 156 | /** |
157 | * Static member function to get the kinamtics array | |
158 | * | |
159 | * @param handler Unput handler | |
160 | * @param particle Particle number | |
161 | * | |
162 | * @return Array of hits | |
163 | */ | |
2e658fb9 | 164 | static TClonesArray* GetParticleArray(AliFMDMCHitHandler* handler, |
165 | Int_t particle); | |
166 | protected: | |
c8b1a7db | 167 | /** |
168 | * Copy constructor | |
169 | * | |
170 | * @param o Object to copy from | |
171 | */ | |
2e658fb9 | 172 | AliFMDMCHitHandler(const AliFMDMCHitHandler& o) |
173 | : AliMCEventHandler(), | |
174 | fParent(o.fParent), | |
175 | fFile(0), | |
176 | fTree(0), | |
177 | fDir(0), | |
178 | fArray(0), | |
179 | fNEvents(0), | |
180 | fNEventsPerFile(0), | |
181 | fNEventsInContainer(0), | |
182 | fEvent(0), | |
183 | fFileNumber(0), | |
184 | fTreeName(""), | |
185 | fFileBase("") | |
186 | {} | |
c8b1a7db | 187 | /** |
188 | * Assignment operator | |
189 | * | |
190 | * @param o Object to assign from | |
191 | * | |
192 | * @return reference to this object | |
193 | */ | |
2e658fb9 | 194 | AliFMDMCHitHandler& operator=(const AliFMDMCHitHandler& o) |
195 | { | |
196 | if (&o == this) return *this; | |
197 | // AliMCEventHandler::operator=(o); | |
198 | fParent = o.fParent; | |
199 | fFile = o.fFile; | |
200 | fTree = o.fTree; | |
201 | return *this; | |
202 | } | |
c8b1a7db | 203 | /** |
204 | * Get the parent path | |
205 | * | |
206 | * @return Parent path | |
207 | */ | |
2e658fb9 | 208 | TString* GetParentPath() const; |
209 | AliMCEventHandler* fParent; // Parent MC handler | |
210 | TFile* fFile; //! | |
211 | TTree* fTree; //! | |
212 | TDirectory* fDir; //! | |
213 | TClonesArray* fArray; //! | |
214 | Int_t fNEvents; //! | |
215 | Int_t fNEventsPerFile; //! | |
216 | Int_t fNEventsInContainer; //! | |
217 | Int_t fEvent; //! | |
218 | Int_t fFileNumber; //! | |
219 | TString fTreeName; //! | |
220 | TString fFileBase; //! | |
221 | ClassDef(AliFMDMCHitHandler,1); // Connect FMD hits tree | |
222 | }; | |
223 | ||
224 | #endif | |
225 | // Local Variables: | |
226 | // mode: C++ | |
227 | // End: | |
228 |