]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/FEMTOSCOPY/AliFemto/AliFemtoCutMonitorHandler.cxx
Lines getting the matched track moved to a method in AliCalorimeterUtils. Lines copie...
[u/mrichter/AliRoot.git] / PWG2 / FEMTOSCOPY / AliFemto / AliFemtoCutMonitorHandler.cxx
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 ///////////////////////////////////////////////////////////////////////////
10
11 #include <TList.h>
12 #include "AliFemtoCutMonitorHandler.h"
13 #include "AliFemtoTypes.h"
14
15 #ifdef __ROOT__
16 ClassImp(AliFemtoCutMonitorHandler)
17 #endif
18 // ---------------------------------------------------------------------------
19 AliFemtoCutMonitorHandler::AliFemtoCutMonitorHandler():
20   fCollectionsEmpty(0), fPassColl(0), fFailColl(0)
21 {
22   // Default constructor
23   cout << " *** AliFemtoCutMonitorHandler::AliFemtoCutMonitorHandler() " << endl;
24   fCollectionsEmpty = 0;
25   fPassColl = new AliFemtoCutMonitorCollection();
26   fFailColl = new AliFemtoCutMonitorCollection();
27 }
28 // ---------------------------------------------------------------------------
29 AliFemtoCutMonitorHandler::AliFemtoCutMonitorHandler(const AliFemtoCutMonitorHandler& aHan):
30   fCollectionsEmpty(0), fPassColl(0), fFailColl(0)
31 {
32   // Copy constructor
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
45 // ---------------------------------------------------------------------------
46 AliFemtoCutMonitorHandler::~AliFemtoCutMonitorHandler() { 
47   // Default destructor
48   delete fPassColl;
49   delete fFailColl;
50 }   
51 //__________________________
52 AliFemtoCutMonitorHandler& AliFemtoCutMonitorHandler::operator=(const AliFemtoCutMonitorHandler& aHan)
53 {
54   // assignment operator
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
78 // ---------------------------------------------------------------------------
79 void AliFemtoCutMonitorHandler::FillCutMonitor(const AliFemtoEvent* event, bool pass) { 
80   // fill event cut monitors
81   if (fCollectionsEmpty) return;
82   AliFemtoCutMonitorIterator iter;
83   AliFemtoCutMonitor* tCM;
84   if ( pass) {
85     for (iter=fPassColl->begin(); iter!=fPassColl->end(); iter++){
86       tCM = *iter;
87       tCM->Fill(event);
88     }
89   } else {
90     for (iter=fFailColl->begin(); iter!=fFailColl->end(); iter++){
91       tCM = *iter;
92       tCM->Fill(event);
93     }
94   }
95 }
96 // ---------------------------------------------------------------------------
97 void AliFemtoCutMonitorHandler::FillCutMonitor(const AliFemtoTrack* track, bool pass) { 
98   // Fill track cut monitors
99   if (fCollectionsEmpty) return;
100   AliFemtoCutMonitorIterator iter;
101   AliFemtoCutMonitor* tCM;
102   if ( pass) {
103     for (iter=fPassColl->begin(); iter!=fPassColl->end(); iter++){
104       tCM = *iter;
105       tCM->Fill(track);
106     }
107   } else {
108     for (iter=fFailColl->begin(); iter!=fFailColl->end(); iter++){
109       tCM = *iter;
110       tCM->Fill(track);
111     }
112   }
113 }
114 // ---------------------------------------------------------------------------
115 void AliFemtoCutMonitorHandler::FillCutMonitor(const AliFemtoV0* v0, bool pass) { 
116   // fill V0 cut monitors
117   if (fCollectionsEmpty) return;
118   AliFemtoCutMonitorIterator iter;
119   AliFemtoCutMonitor* tCM;
120   if ( pass) {
121     for (iter=fPassColl->begin(); iter!=fPassColl->end(); iter++){
122       tCM = *iter;
123       tCM->Fill(v0);
124     }
125   } else {
126     for (iter=fFailColl->begin(); iter!=fFailColl->end(); iter++){
127       tCM = *iter;
128       tCM->Fill(v0);
129     }
130   }
131 }
132 // ---------------------------------------------------------------------------
133 void AliFemtoCutMonitorHandler::FillCutMonitor(const AliFemtoKink* kink, bool pass) { 
134   // fill kink cut monitors
135   if (fCollectionsEmpty) return;
136   AliFemtoCutMonitorIterator iter;
137   AliFemtoCutMonitor* tCM;
138   if ( pass) {
139     for (iter=fPassColl->begin(); iter!=fPassColl->end(); iter++){
140       tCM = *iter;
141       tCM->Fill(kink);
142     }
143   } else {
144     for (iter=fFailColl->begin(); iter!=fFailColl->end(); iter++){
145       tCM = *iter;
146       tCM->Fill(kink);
147     }
148   }
149 }
150 // ---------------------------------Gael/12/04/02-----------------------------
151 void AliFemtoCutMonitorHandler::FillCutMonitor(const AliFemtoPair* pair, bool pass) { 
152   // fill pair cut monitors
153   if (fCollectionsEmpty) return;
154   AliFemtoCutMonitorIterator iter;
155   AliFemtoCutMonitor* tCM;
156   if ( pass) {
157     for (iter=fPassColl->begin(); iter!=fPassColl->end(); iter++){
158       tCM = *iter;
159       tCM->Fill(pair);
160     }
161   } else {
162     for (iter=fFailColl->begin(); iter!=fFailColl->end(); iter++){
163       tCM = *iter;
164       tCM->Fill(pair);
165     }
166   }
167 }
168 // ---------------------------------Gael/19/06/02-----------------------------
169 void AliFemtoCutMonitorHandler::FillCutMonitor(const AliFemtoParticleCollection* partColl) {
170   // fill particle collection cut monitor 
171   if (fCollectionsEmpty) return;
172   AliFemtoCutMonitorIterator iter;
173   AliFemtoCutMonitor* tCM;
174   
175   for (iter=fPassColl->begin(); iter!=fPassColl->end(); iter++){
176     tCM = *iter;
177     tCM->Fill(partColl);
178   }
179 }
180 // ------------------------------------Gael/19/06/02-------------------------
181 void AliFemtoCutMonitorHandler::FillCutMonitor(const AliFemtoEvent* event,const AliFemtoParticleCollection* partColl) {
182   // Fill event particle collection
183   cout<<"In AliFemtoCutMonitorHandler::FillCutMonitor(const AliFemtoEvent* event, AliFemtoPicoEvent* picoEvent)"<<endl;
184   if (fCollectionsEmpty) return;
185   AliFemtoCutMonitorIterator iter;
186   AliFemtoCutMonitor* tCM;
187   
188   for (iter=fPassColl->begin(); iter!=fPassColl->end(); iter++){
189     tCM = *iter;
190     tCM->Fill(event,partColl);
191   }
192 }
193 // ---------------------------------------------------------------------------
194 void AliFemtoCutMonitorHandler::Finish() { 
195   // Perform finish operations on cut monitors
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) { 
206   // Add cut monitors to collections
207   fPassColl->push_back(cutMoni1);
208   fFailColl->push_back(cutMoni2);
209   fCollectionsEmpty=false;
210 }
211 // ---------------------------------------------------------------------------
212 void AliFemtoCutMonitorHandler::AddCutMonitor(AliFemtoCutMonitor* cutMoni) { 
213   // make a copy of the cut monitor
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) { 
222   // add monitors to pass
223   fPassColl->push_back(cutMoni);
224   fCollectionsEmpty=false;
225 }
226 // ---------------------------------------------------------------------------
227 void AliFemtoCutMonitorHandler::AddCutMonitorFail(AliFemtoCutMonitor* cutMoni) { 
228   // add monitors to fail
229   fFailColl->push_back(cutMoni);
230   fCollectionsEmpty=false;
231 }
232 // ---------------------------------------------------------------------------
233 AliFemtoCutMonitor* AliFemtoCutMonitorHandler::PassMonitor(int n) { 
234   // return pass monitor number n
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) { 
243   // return fail monitor number n
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 }
250 //_____________________________________________________________________________
251 TList *AliFemtoCutMonitorHandler::GetOutputList()
252 {
253   TList *tOutputList = new TList();
254
255   for (unsigned int ipass=0; ipass<fPassColl->size(); ipass++) {
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   }
265
266   for (unsigned int ipass=0; ipass<fFailColl->size(); ipass++) {
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 }
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 }
315
316
317  
318