]>
Commit | Line | Data |
---|---|---|
d0e92d9a | 1 | /////////////////////////////////////////////////////////////////////////// |
2 | // // | |
3 | // AliFemtoCutMonitorHandler: a handler for cut monitors // | |
4 | // You add cut monitors to the collection which are stored in two // | |
5 | // separate collections - one which stores characteristics of the // | |
6 | // entities (tracks, particles, pairs, events) that pass the respective // | |
7 | // cuts and the other for the ones that fail the cut. // | |
8 | // // | |
9 | /////////////////////////////////////////////////////////////////////////// | |
67427ff7 | 10 | |
0b3bd1ac | 11 | #include <TList.h> |
d0e92d9a | 12 | #include "AliFemtoCutMonitorHandler.h" |
13 | #include "AliFemtoTypes.h" | |
67427ff7 | 14 | |
15 | #ifdef __ROOT__ | |
16 | ClassImp(AliFemtoCutMonitorHandler) | |
17 | #endif | |
18 | // --------------------------------------------------------------------------- | |
0215f606 | 19 | AliFemtoCutMonitorHandler::AliFemtoCutMonitorHandler(): |
20 | fCollectionsEmpty(0), fPassColl(0), fFailColl(0) | |
d0e92d9a | 21 | { |
22 | // Default constructor | |
67427ff7 | 23 | cout << " *** AliFemtoCutMonitorHandler::AliFemtoCutMonitorHandler() " << endl; |
24 | fCollectionsEmpty = 0; | |
25 | fPassColl = new AliFemtoCutMonitorCollection(); | |
26 | fFailColl = new AliFemtoCutMonitorCollection(); | |
27 | } | |
0215f606 | 28 | // --------------------------------------------------------------------------- |
29 | AliFemtoCutMonitorHandler::AliFemtoCutMonitorHandler(const AliFemtoCutMonitorHandler& aHan): | |
30 | fCollectionsEmpty(0), fPassColl(0), fFailColl(0) | |
31 | { | |
d0e92d9a | 32 | // Copy constructor |
0215f606 | 33 | fCollectionsEmpty = aHan.fCollectionsEmpty; |
34 | fPassColl = new AliFemtoCutMonitorCollection(); | |
35 | AliFemtoCutMonitorIterator iter; | |
36 | for (iter=aHan.fPassColl->begin(); iter!=aHan.fPassColl->end(); iter++){ | |
37 | fPassColl->push_back(*iter); | |
38 | } | |
39 | fFailColl = new AliFemtoCutMonitorCollection(); | |
40 | for (iter=aHan.fFailColl->begin(); iter!=aHan.fFailColl->end(); iter++){ | |
41 | fFailColl->push_back(*iter); | |
42 | } | |
43 | } | |
44 | ||
67427ff7 | 45 | // --------------------------------------------------------------------------- |
46 | AliFemtoCutMonitorHandler::~AliFemtoCutMonitorHandler() { | |
d0e92d9a | 47 | // Default destructor |
67427ff7 | 48 | delete fPassColl; |
49 | delete fFailColl; | |
50 | } | |
0215f606 | 51 | //__________________________ |
52 | AliFemtoCutMonitorHandler& AliFemtoCutMonitorHandler::operator=(const AliFemtoCutMonitorHandler& aHan) | |
53 | { | |
d0e92d9a | 54 | // assignment operator |
0215f606 | 55 | if (this == &aHan) |
56 | return *this; | |
57 | ||
58 | AliFemtoCutMonitorIterator iter; | |
59 | if (fPassColl) { | |
60 | fPassColl->clear(); | |
61 | delete fPassColl; | |
62 | } | |
63 | if (fFailColl) { | |
64 | fFailColl->clear(); | |
65 | delete fFailColl; | |
66 | } | |
67 | fPassColl = new AliFemtoCutMonitorCollection(); | |
68 | for (iter=aHan.fPassColl->begin(); iter!=aHan.fPassColl->end(); iter++){ | |
69 | fPassColl->push_back(*iter); | |
70 | } | |
71 | fFailColl = new AliFemtoCutMonitorCollection(); | |
72 | for (iter=aHan.fFailColl->begin(); iter!=aHan.fFailColl->end(); iter++){ | |
73 | fFailColl->push_back(*iter); | |
74 | } | |
75 | return *this; | |
76 | } | |
77 | ||
67427ff7 | 78 | // --------------------------------------------------------------------------- |
79 | void AliFemtoCutMonitorHandler::FillCutMonitor(const AliFemtoEvent* event, bool pass) { | |
d0e92d9a | 80 | // fill event cut monitors |
67427ff7 | 81 | if (fCollectionsEmpty) return; |
82 | AliFemtoCutMonitorIterator iter; | |
d0e92d9a | 83 | AliFemtoCutMonitor* tCM; |
67427ff7 | 84 | if ( pass) { |
85 | for (iter=fPassColl->begin(); iter!=fPassColl->end(); iter++){ | |
d0e92d9a | 86 | tCM = *iter; |
87 | tCM->Fill(event); | |
67427ff7 | 88 | } |
89 | } else { | |
90 | for (iter=fFailColl->begin(); iter!=fFailColl->end(); iter++){ | |
d0e92d9a | 91 | tCM = *iter; |
92 | tCM->Fill(event); | |
67427ff7 | 93 | } |
94 | } | |
95 | } | |
96 | // --------------------------------------------------------------------------- | |
97 | void AliFemtoCutMonitorHandler::FillCutMonitor(const AliFemtoTrack* track, bool pass) { | |
d0e92d9a | 98 | // Fill track cut monitors |
67427ff7 | 99 | if (fCollectionsEmpty) return; |
100 | AliFemtoCutMonitorIterator iter; | |
d0e92d9a | 101 | AliFemtoCutMonitor* tCM; |
67427ff7 | 102 | if ( pass) { |
103 | for (iter=fPassColl->begin(); iter!=fPassColl->end(); iter++){ | |
d0e92d9a | 104 | tCM = *iter; |
105 | tCM->Fill(track); | |
67427ff7 | 106 | } |
107 | } else { | |
108 | for (iter=fFailColl->begin(); iter!=fFailColl->end(); iter++){ | |
d0e92d9a | 109 | tCM = *iter; |
110 | tCM->Fill(track); | |
67427ff7 | 111 | } |
112 | } | |
113 | } | |
114 | // --------------------------------------------------------------------------- | |
115 | void AliFemtoCutMonitorHandler::FillCutMonitor(const AliFemtoV0* v0, bool pass) { | |
d0e92d9a | 116 | // fill V0 cut monitors |
67427ff7 | 117 | if (fCollectionsEmpty) return; |
118 | AliFemtoCutMonitorIterator iter; | |
d0e92d9a | 119 | AliFemtoCutMonitor* tCM; |
67427ff7 | 120 | if ( pass) { |
121 | for (iter=fPassColl->begin(); iter!=fPassColl->end(); iter++){ | |
d0e92d9a | 122 | tCM = *iter; |
123 | tCM->Fill(v0); | |
67427ff7 | 124 | } |
125 | } else { | |
126 | for (iter=fFailColl->begin(); iter!=fFailColl->end(); iter++){ | |
d0e92d9a | 127 | tCM = *iter; |
128 | tCM->Fill(v0); | |
67427ff7 | 129 | } |
130 | } | |
131 | } | |
132 | // --------------------------------------------------------------------------- | |
133 | void AliFemtoCutMonitorHandler::FillCutMonitor(const AliFemtoKink* kink, bool pass) { | |
d0e92d9a | 134 | // fill kink cut monitors |
67427ff7 | 135 | if (fCollectionsEmpty) return; |
136 | AliFemtoCutMonitorIterator iter; | |
d0e92d9a | 137 | AliFemtoCutMonitor* tCM; |
67427ff7 | 138 | if ( pass) { |
139 | for (iter=fPassColl->begin(); iter!=fPassColl->end(); iter++){ | |
d0e92d9a | 140 | tCM = *iter; |
141 | tCM->Fill(kink); | |
67427ff7 | 142 | } |
143 | } else { | |
144 | for (iter=fFailColl->begin(); iter!=fFailColl->end(); iter++){ | |
d0e92d9a | 145 | tCM = *iter; |
146 | tCM->Fill(kink); | |
67427ff7 | 147 | } |
148 | } | |
149 | } | |
150 | // ---------------------------------Gael/12/04/02----------------------------- | |
151 | void AliFemtoCutMonitorHandler::FillCutMonitor(const AliFemtoPair* pair, bool pass) { | |
d0e92d9a | 152 | // fill pair cut monitors |
67427ff7 | 153 | if (fCollectionsEmpty) return; |
154 | AliFemtoCutMonitorIterator iter; | |
d0e92d9a | 155 | AliFemtoCutMonitor* tCM; |
67427ff7 | 156 | if ( pass) { |
157 | for (iter=fPassColl->begin(); iter!=fPassColl->end(); iter++){ | |
d0e92d9a | 158 | tCM = *iter; |
159 | tCM->Fill(pair); | |
67427ff7 | 160 | } |
161 | } else { | |
162 | for (iter=fFailColl->begin(); iter!=fFailColl->end(); iter++){ | |
d0e92d9a | 163 | tCM = *iter; |
164 | tCM->Fill(pair); | |
67427ff7 | 165 | } |
166 | } | |
167 | } | |
168 | // ---------------------------------Gael/19/06/02----------------------------- | |
169 | void AliFemtoCutMonitorHandler::FillCutMonitor(const AliFemtoParticleCollection* partColl) { | |
d0e92d9a | 170 | // fill particle collection cut monitor |
67427ff7 | 171 | if (fCollectionsEmpty) return; |
172 | AliFemtoCutMonitorIterator iter; | |
d0e92d9a | 173 | AliFemtoCutMonitor* tCM; |
67427ff7 | 174 | |
175 | for (iter=fPassColl->begin(); iter!=fPassColl->end(); iter++){ | |
d0e92d9a | 176 | tCM = *iter; |
177 | tCM->Fill(partColl); | |
67427ff7 | 178 | } |
179 | } | |
180 | // ------------------------------------Gael/19/06/02------------------------- | |
181 | void AliFemtoCutMonitorHandler::FillCutMonitor(const AliFemtoEvent* event,const AliFemtoParticleCollection* partColl) { | |
d0e92d9a | 182 | // Fill event particle collection |
67427ff7 | 183 | cout<<"In AliFemtoCutMonitorHandler::FillCutMonitor(const AliFemtoEvent* event, AliFemtoPicoEvent* picoEvent)"<<endl; |
184 | if (fCollectionsEmpty) return; | |
185 | AliFemtoCutMonitorIterator iter; | |
d0e92d9a | 186 | AliFemtoCutMonitor* tCM; |
67427ff7 | 187 | |
188 | for (iter=fPassColl->begin(); iter!=fPassColl->end(); iter++){ | |
d0e92d9a | 189 | tCM = *iter; |
190 | tCM->Fill(event,partColl); | |
67427ff7 | 191 | } |
192 | } | |
193 | // --------------------------------------------------------------------------- | |
194 | void AliFemtoCutMonitorHandler::Finish() { | |
d0e92d9a | 195 | // Perform finish operations on cut monitors |
67427ff7 | 196 | AliFemtoCutMonitorIterator iter; |
197 | for (iter=fPassColl->begin(); iter!=fPassColl->end(); iter++){ | |
198 | (*iter)->Finish(); | |
199 | } | |
200 | for (iter=fFailColl->begin(); iter!=fFailColl->end(); iter++){ | |
201 | (*iter)->Finish(); | |
202 | } | |
203 | } | |
204 | // --------------------------------------------------------------------------- | |
205 | void AliFemtoCutMonitorHandler::AddCutMonitor(AliFemtoCutMonitor* cutMoni1, AliFemtoCutMonitor* cutMoni2) { | |
d0e92d9a | 206 | // Add cut monitors to collections |
67427ff7 | 207 | fPassColl->push_back(cutMoni1); |
208 | fFailColl->push_back(cutMoni2); | |
209 | fCollectionsEmpty=false; | |
210 | } | |
211 | // --------------------------------------------------------------------------- | |
212 | void AliFemtoCutMonitorHandler::AddCutMonitor(AliFemtoCutMonitor* cutMoni) { | |
d0e92d9a | 213 | // make a copy of the cut monitor |
67427ff7 | 214 | cout << " make a copy of the cutmonitor and push both into the collections " << endl; |
215 | cout << " not yet implemented" << endl; | |
216 | fPassColl->push_back(cutMoni); | |
217 | cout << " only pass collection pushed" << endl; | |
218 | fCollectionsEmpty=false; | |
219 | } | |
220 | // --------------------------------------------------------------------------- | |
221 | void AliFemtoCutMonitorHandler::AddCutMonitorPass(AliFemtoCutMonitor* cutMoni) { | |
d0e92d9a | 222 | // add monitors to pass |
67427ff7 | 223 | fPassColl->push_back(cutMoni); |
224 | fCollectionsEmpty=false; | |
225 | } | |
226 | // --------------------------------------------------------------------------- | |
227 | void AliFemtoCutMonitorHandler::AddCutMonitorFail(AliFemtoCutMonitor* cutMoni) { | |
d0e92d9a | 228 | // add monitors to fail |
67427ff7 | 229 | fFailColl->push_back(cutMoni); |
230 | fCollectionsEmpty=false; | |
231 | } | |
232 | // --------------------------------------------------------------------------- | |
233 | AliFemtoCutMonitor* AliFemtoCutMonitorHandler::PassMonitor(int n) { | |
d0e92d9a | 234 | // return pass monitor number n |
67427ff7 | 235 | AliFemtoCutMonitorIterator iter = fPassColl->begin(); |
236 | if ( (int)fPassColl->size() <= n ) return NULL; | |
237 | for ( int i=0; i<n; i++) | |
238 | iter++; | |
239 | return *iter; | |
240 | } | |
241 | // --------------------------------------------------------------------------- | |
242 | AliFemtoCutMonitor* AliFemtoCutMonitorHandler::FailMonitor(int n) { | |
d0e92d9a | 243 | // return fail monitor number n |
67427ff7 | 244 | AliFemtoCutMonitorIterator iter = fFailColl->begin(); |
245 | if ( (int)fFailColl->size() <= n ) return NULL; | |
246 | for ( int i=0; i<n; i++) | |
247 | iter++; | |
248 | return *iter; | |
249 | } | |
0b3bd1ac | 250 | //_____________________________________________________________________________ |
251 | TList *AliFemtoCutMonitorHandler::GetOutputList() | |
252 | { | |
253 | TList *tOutputList = new TList(); | |
254 | ||
fcda1d4e | 255 | for (unsigned int ipass=0; ipass<fPassColl->size(); ipass++) { |
0b3bd1ac | 256 | TList *tLp = PassMonitor(ipass)->GetOutputList(); |
257 | ||
258 | TIter nextLp(tLp); | |
259 | while (TObject *obj = nextLp()) { | |
260 | tOutputList->Add(obj); | |
261 | } | |
262 | ||
263 | delete tLp; | |
264 | } | |
67427ff7 | 265 | |
fcda1d4e | 266 | for (unsigned int ipass=0; ipass<fFailColl->size(); ipass++) { |
0b3bd1ac | 267 | TList *tLf = FailMonitor(ipass)->GetOutputList(); |
268 | ||
269 | TIter nextLf(tLf); | |
270 | while (TObject *obj = nextLf()) { | |
271 | tOutputList->Add(obj); | |
272 | } | |
273 | ||
274 | delete tLf; | |
275 | } | |
276 | ||
277 | return tOutputList; | |
278 | } | |
95150c4b | 279 | //_____________________________________________________________________________ |
280 | void AliFemtoCutMonitorHandler::EventBegin(const AliFemtoEvent* aEvent) | |
281 | { | |
282 | if (fCollectionsEmpty) return; | |
283 | ||
284 | AliFemtoCutMonitorIterator iter; | |
285 | AliFemtoCutMonitor* tCM; | |
286 | ||
287 | for (iter=fPassColl->begin(); iter!=fPassColl->end(); iter++){ | |
288 | tCM = *iter; | |
289 | tCM->EventBegin(aEvent); | |
290 | } | |
291 | ||
292 | for (iter=fFailColl->begin(); iter!=fFailColl->end(); iter++){ | |
293 | tCM = *iter; | |
294 | tCM->EventBegin(aEvent); | |
295 | } | |
296 | } | |
297 | //_____________________________________________________________________________ | |
298 | void AliFemtoCutMonitorHandler::EventEnd(const AliFemtoEvent* aEvent) | |
299 | { | |
300 | if (fCollectionsEmpty) return; | |
301 | ||
302 | AliFemtoCutMonitorIterator iter; | |
303 | AliFemtoCutMonitor* tCM; | |
304 | ||
305 | for (iter=fPassColl->begin(); iter!=fPassColl->end(); iter++){ | |
306 | tCM = *iter; | |
307 | tCM->EventEnd(aEvent); | |
308 | } | |
309 | ||
310 | for (iter=fFailColl->begin(); iter!=fFailColl->end(); iter++){ | |
311 | tCM = *iter; | |
312 | tCM->EventEnd(aEvent); | |
313 | } | |
314 | } | |
67427ff7 | 315 | |
316 | ||
317 | ||
318 |