]>
Commit | Line | Data |
---|---|---|
a5b23aa6 | 1 | /////////////////////////////////////////////////////////////////////////// |
2 | // // | |
3 | // AliFemtoSimpleAnalysis - the most basic analysis there is. All other // | |
4 | // inherit from this one. Provides basic functionality for the analysis. // | |
5 | // To properly set up the analysis the following steps should be taken: // | |
6 | // // | |
7 | // - create particle cuts and add them via SetFirstParticleCut and // | |
8 | // SetSecondParticleCut. If one analyzes identical particle // | |
9 | // correlations, the first particle cut must be also the second // | |
10 | // particle cut. // | |
11 | // // | |
12 | // - create pair cuts and add them via SetPairCut // | |
13 | // // | |
14 | // - create one or many correlation functions and add them via // | |
15 | // AddCorrFctn method. // | |
16 | // // | |
17 | // - specify how many events are to be strored in the mixing buffer for // | |
18 | // background construction // | |
19 | // // | |
20 | // Then, when the analysis is run, for each event, the EventBegin is // | |
21 | // called before any processing is done, then the ProcessEvent is called // | |
22 | // which takes care of creating real and mixed pairs and sending them // | |
23 | // to all the registered correlation functions. At the end of each event,// | |
24 | // after all pairs are processed, EventEnd is called. After the whole // | |
25 | // analysis finishes (there is no more events to process) Finish() is // | |
26 | // called. // | |
27 | // // | |
28 | /////////////////////////////////////////////////////////////////////////// | |
29 | #include "AliFemtoSimpleAnalysis.h" | |
30 | #include "AliFemtoTrackCut.h" | |
31 | #include "AliFemtoV0Cut.h" | |
32 | #include "AliFemtoKinkCut.h" | |
33 | #include <string> | |
34 | #include <iostream> | |
35 | ||
36 | // blah blah | |
37 | ||
38 | #ifdef __ROOT__ | |
39 | ClassImp(AliFemtoSimpleAnalysis) | |
40 | #endif | |
41 | ||
42 | AliFemtoEventCut* copyTheCut(AliFemtoEventCut*); | |
43 | AliFemtoParticleCut* copyTheCut(AliFemtoParticleCut*); | |
44 | AliFemtoPairCut* copyTheCut(AliFemtoPairCut*); | |
45 | AliFemtoCorrFctn* copyTheCorrFctn(AliFemtoCorrFctn*); | |
46 | ||
47 | // this little function used to apply ParticleCuts (TrackCuts or V0Cuts) and fill ParticleCollections of picoEvent | |
48 | // it is called from AliFemtoSimpleAnalysis::ProcessEvent() | |
49 | void FillHbtParticleCollection(AliFemtoParticleCut* partCut, | |
50 | AliFemtoEvent* hbtEvent, | |
51 | AliFemtoParticleCollection* partCollection) | |
52 | { | |
53 | // Fill particle collections from the event | |
54 | // by the particles that pass all the cuts | |
55 | switch (partCut->Type()) { | |
56 | case hbtTrack: // cut is cutting on Tracks | |
57 | { | |
58 | AliFemtoTrackCut* pCut = (AliFemtoTrackCut*) partCut; | |
59 | AliFemtoTrack* pParticle; | |
60 | AliFemtoTrackIterator pIter; | |
61 | AliFemtoTrackIterator startLoop = hbtEvent->TrackCollection()->begin(); | |
62 | AliFemtoTrackIterator endLoop = hbtEvent->TrackCollection()->end(); | |
63 | for (pIter=startLoop;pIter!=endLoop;pIter++){ | |
64 | pParticle = *pIter; | |
65 | bool tmpPassParticle = pCut->Pass(pParticle); | |
66 | pCut->FillCutMonitor(pParticle, tmpPassParticle); | |
67 | if (tmpPassParticle){ | |
68 | AliFemtoParticle* particle = new AliFemtoParticle(pParticle,pCut->Mass()); | |
69 | partCollection->push_back(particle); | |
70 | } | |
71 | } | |
72 | break; | |
73 | } | |
74 | case hbtV0: // cut is cutting on V0s | |
75 | { | |
76 | AliFemtoV0Cut* pCut = (AliFemtoV0Cut*) partCut; | |
77 | AliFemtoV0* pParticle; | |
78 | AliFemtoV0Iterator pIter; | |
79 | AliFemtoV0Iterator startLoop = hbtEvent->V0Collection()->begin(); | |
80 | AliFemtoV0Iterator endLoop = hbtEvent->V0Collection()->end(); | |
81 | // this following "for" loop is identical to the one above, but because of scoping, I can's see how to avoid repitition... | |
82 | for (pIter=startLoop;pIter!=endLoop;pIter++){ | |
83 | pParticle = *pIter; | |
84 | bool tmpPassV0 = pCut->Pass(pParticle); | |
85 | pCut->FillCutMonitor(pParticle,tmpPassV0); | |
86 | if (tmpPassV0){ | |
87 | AliFemtoParticle* particle = new AliFemtoParticle(pParticle,partCut->Mass()); | |
88 | partCollection->push_back(particle); | |
89 | } | |
90 | } | |
91 | pCut->FillCutMonitor(hbtEvent,partCollection);// Gael 19/06/02 | |
92 | break; | |
93 | } | |
94 | case hbtKink: // cut is cutting on Kinks -- mal 25May2001 | |
95 | { | |
96 | AliFemtoKinkCut* pCut = (AliFemtoKinkCut*) partCut; | |
97 | AliFemtoKink* pParticle; | |
98 | AliFemtoKinkIterator pIter; | |
99 | AliFemtoKinkIterator startLoop = hbtEvent->KinkCollection()->begin(); | |
100 | AliFemtoKinkIterator endLoop = hbtEvent->KinkCollection()->end(); | |
101 | // this following "for" loop is identical to the one above, but because of scoping, I can's see how to avoid repitition... | |
102 | for (pIter=startLoop;pIter!=endLoop;pIter++){ | |
103 | pParticle = *pIter; | |
104 | bool tmpPass = pCut->Pass(pParticle); | |
105 | pCut->FillCutMonitor(pParticle,tmpPass); | |
106 | if (tmpPass){ | |
107 | AliFemtoParticle* particle = new AliFemtoParticle(pParticle,partCut->Mass()); | |
108 | partCollection->push_back(particle); | |
109 | } | |
110 | } | |
111 | break; | |
112 | } | |
113 | default: | |
114 | cout << "FillHbtParticleCollection function (in AliFemtoSimpleAnalysis.cxx) - undefined Particle Cut type!!! \n"; | |
115 | } | |
116 | } | |
117 | //____________________________ | |
118 | AliFemtoSimpleAnalysis::AliFemtoSimpleAnalysis() : | |
119 | fPicoEventCollectionVectorHideAway(0), | |
120 | fPairCut(0), | |
121 | fCorrFctnCollection(0), | |
122 | fEventCut(0), | |
123 | fFirstParticleCut(0), | |
124 | fSecondParticleCut(0), | |
125 | fMixingBuffer(0), | |
126 | fPicoEvent(0), | |
127 | fNumEventsToMix(0), | |
128 | fNeventsProcessed(0), | |
129 | fMinSizePartCollection(0) | |
130 | { | |
131 | // Default constructor | |
132 | // mControlSwitch = 0; | |
133 | fCorrFctnCollection = new AliFemtoCorrFctnCollection; | |
134 | fMixingBuffer = new AliFemtoPicoEventCollection; | |
135 | } | |
136 | //____________________________ | |
137 | ||
138 | AliFemtoSimpleAnalysis::AliFemtoSimpleAnalysis(const AliFemtoSimpleAnalysis& a) : | |
139 | AliFemtoAnalysis(), | |
140 | fPicoEventCollectionVectorHideAway(0), | |
141 | fPairCut(0), | |
142 | fCorrFctnCollection(0), | |
143 | fEventCut(0), | |
144 | fFirstParticleCut(0), | |
145 | fSecondParticleCut(0), | |
146 | fMixingBuffer(0), | |
147 | fPicoEvent(0), | |
148 | fNumEventsToMix(0), | |
149 | fNeventsProcessed(0), | |
150 | fMinSizePartCollection(0) | |
151 | { | |
152 | // Copy constructor | |
153 | //AliFemtoSimpleAnalysis(); | |
154 | fCorrFctnCollection = new AliFemtoCorrFctnCollection; | |
155 | fMixingBuffer = new AliFemtoPicoEventCollection; | |
156 | ||
157 | // find the right event cut | |
158 | fEventCut = a.fEventCut->Clone(); | |
159 | // find the right first particle cut | |
160 | fFirstParticleCut = a.fFirstParticleCut->Clone(); | |
161 | // find the right second particle cut | |
162 | if (a.fFirstParticleCut==a.fSecondParticleCut) | |
163 | SetSecondParticleCut(fFirstParticleCut); // identical particle hbt | |
164 | else | |
165 | fSecondParticleCut = a.fSecondParticleCut->Clone(); | |
166 | ||
167 | fPairCut = a.fPairCut->Clone(); | |
168 | ||
169 | if ( fEventCut ) { | |
170 | SetEventCut(fEventCut); // this will set the myAnalysis pointer inside the cut | |
171 | cout << " AliFemtoSimpleAnalysis::AliFemtoSimpleAnalysis(const AliFemtoSimpleAnalysis& a) - event cut set " << endl; | |
172 | } | |
173 | if ( fFirstParticleCut ) { | |
174 | SetFirstParticleCut(fFirstParticleCut); // this will set the myAnalysis pointer inside the cut | |
175 | cout << " AliFemtoSimpleAnalysis::AliFemtoSimpleAnalysis(const AliFemtoSimpleAnalysis& a) - first particle cut set " << endl; | |
176 | } | |
177 | if ( fSecondParticleCut ) { | |
178 | SetSecondParticleCut(fSecondParticleCut); // this will set the myAnalysis pointer inside the cut | |
179 | cout << " AliFemtoSimpleAnalysis::AliFemtoSimpleAnalysis(const AliFemtoSimpleAnalysis& a) - second particle cut set " << endl; | |
180 | } if ( fPairCut ) { | |
181 | SetPairCut(fPairCut); // this will set the myAnalysis pointer inside the cut | |
182 | cout << " AliFemtoSimpleAnalysis::AliFemtoSimpleAnalysis(const AliFemtoSimpleAnalysis& a) - pair cut set " << endl; | |
183 | } | |
184 | ||
185 | AliFemtoCorrFctnIterator iter; | |
186 | for (iter=a.fCorrFctnCollection->begin(); iter!=a.fCorrFctnCollection->end();iter++){ | |
187 | cout << " AliFemtoSimpleAnalysis::AliFemtoSimpleAnalysis(const AliFemtoSimpleAnalysis& a) - looking for correlation functions " << endl; | |
188 | AliFemtoCorrFctn* fctn = (*iter)->Clone(); | |
189 | if (fctn) AddCorrFctn(fctn); | |
190 | else cout << " AliFemtoSimpleAnalysis::AliFemtoSimpleAnalysis(const AliFemtoSimpleAnalysis& a) - correlation function not found " << endl; | |
191 | } | |
192 | ||
193 | fNumEventsToMix = a.fNumEventsToMix; | |
194 | ||
195 | fMinSizePartCollection = a.fMinSizePartCollection; // minimum # particles in ParticleCollection | |
196 | ||
197 | cout << " AliFemtoSimpleAnalysis::AliFemtoSimpleAnalysis(const AliFemtoSimpleAnalysis& a) - analysis copied " << endl; | |
198 | ||
199 | } | |
200 | //____________________________ | |
201 | AliFemtoSimpleAnalysis::~AliFemtoSimpleAnalysis(){ | |
202 | // destructor | |
203 | cout << " AliFemtoSimpleAnalysis::~AliFemtoSimpleAnalysis()" << endl; | |
204 | if (fEventCut) delete fEventCut; fEventCut=0; | |
205 | if (fFirstParticleCut == fSecondParticleCut) fSecondParticleCut=0; | |
206 | if (fFirstParticleCut) delete fFirstParticleCut; fFirstParticleCut=0; | |
207 | if (fSecondParticleCut) delete fSecondParticleCut; fSecondParticleCut=0; | |
208 | if (fPairCut) delete fPairCut; fPairCut=0; | |
209 | // now delete every CorrFunction in the Collection, and then the Collection itself | |
210 | AliFemtoCorrFctnIterator iter; | |
211 | for (iter=fCorrFctnCollection->begin(); iter!=fCorrFctnCollection->end();iter++){ | |
212 | delete *iter; | |
213 | } | |
214 | delete fCorrFctnCollection; | |
215 | // now delete every PicoEvent in the EventMixingBuffer and then the Buffer itself | |
216 | if (fMixingBuffer) { | |
217 | AliFemtoPicoEventIterator piter; | |
218 | for (piter=fMixingBuffer->begin();piter!=fMixingBuffer->end();piter++){ | |
219 | delete *piter; | |
220 | } | |
221 | delete fMixingBuffer; | |
222 | } | |
223 | } | |
224 | //______________________ | |
225 | AliFemtoSimpleAnalysis& AliFemtoSimpleAnalysis::operator=(const AliFemtoSimpleAnalysis& aAna) | |
226 | { | |
227 | // Assignment operator | |
228 | if (this == &aAna) | |
229 | return *this; | |
230 | ||
231 | fCorrFctnCollection = new AliFemtoCorrFctnCollection; | |
232 | fMixingBuffer = new AliFemtoPicoEventCollection; | |
233 | ||
234 | // find the right event cut | |
235 | fEventCut = aAna.fEventCut->Clone(); | |
236 | // find the right first particle cut | |
237 | fFirstParticleCut = aAna.fFirstParticleCut->Clone(); | |
238 | // find the right second particle cut | |
239 | if (aAna.fFirstParticleCut==aAna.fSecondParticleCut) | |
240 | SetSecondParticleCut(fFirstParticleCut); // identical particle hbt | |
241 | else | |
242 | fSecondParticleCut = aAna.fSecondParticleCut->Clone(); | |
243 | ||
244 | fPairCut = aAna.fPairCut->Clone(); | |
245 | ||
246 | if ( fEventCut ) { | |
247 | SetEventCut(fEventCut); // this will set the myAnalysis pointer inside the cut | |
248 | cout << " AliFemtoSimpleAnalysis::AliFemtoSimpleAnalysis(const AliFemtoSimpleAnalysis& a) - event cut set " << endl; | |
249 | } | |
250 | if ( fFirstParticleCut ) { | |
251 | SetFirstParticleCut(fFirstParticleCut); // this will set the myAnalysis pointer inside the cut | |
252 | cout << " AliFemtoSimpleAnalysis::AliFemtoSimpleAnalysis(const AliFemtoSimpleAnalysis& a) - first particle cut set " << endl; | |
253 | } | |
254 | if ( fSecondParticleCut ) { | |
255 | SetSecondParticleCut(fSecondParticleCut); // this will set the myAnalysis pointer inside the cut | |
256 | cout << " AliFemtoSimpleAnalysis::AliFemtoSimpleAnalysis(const AliFemtoSimpleAnalysis& a) - second particle cut set " << endl; | |
257 | } if ( fPairCut ) { | |
258 | SetPairCut(fPairCut); // this will set the myAnalysis pointer inside the cut | |
259 | cout << " AliFemtoSimpleAnalysis::AliFemtoSimpleAnalysis(const AliFemtoSimpleAnalysis& a) - pair cut set " << endl; | |
260 | } | |
261 | ||
262 | AliFemtoCorrFctnIterator iter; | |
263 | for (iter=aAna.fCorrFctnCollection->begin(); iter!=aAna.fCorrFctnCollection->end();iter++){ | |
264 | cout << " AliFemtoSimpleAnalysis::AliFemtoSimpleAnalysis(const AliFemtoSimpleAnalysis& a) - looking for correlation functions " << endl; | |
265 | AliFemtoCorrFctn* fctn = (*iter)->Clone(); | |
266 | if (fctn) AddCorrFctn(fctn); | |
267 | else cout << " AliFemtoSimpleAnalysis::AliFemtoSimpleAnalysis(const AliFemtoSimpleAnalysis& a) - correlation function not found " << endl; | |
268 | } | |
269 | ||
270 | fNumEventsToMix = aAna.fNumEventsToMix; | |
271 | ||
272 | fMinSizePartCollection = aAna.fMinSizePartCollection; // minimum # particles in ParticleCollection | |
273 | ||
274 | cout << " AliFemtoSimpleAnalysis::AliFemtoSimpleAnalysis(const AliFemtoSimpleAnalysis& a) - analysis copied " << endl; | |
275 | ||
276 | return *this; | |
277 | } | |
278 | //______________________ | |
279 | AliFemtoCorrFctn* AliFemtoSimpleAnalysis::CorrFctn(int n){ | |
280 | // return pointer to n-th correlation function | |
281 | if ( n<0 || n > (int)fCorrFctnCollection->size() ) | |
282 | return NULL; | |
283 | AliFemtoCorrFctnIterator iter=fCorrFctnCollection->begin(); | |
284 | for (int i=0; i<n ;i++){ | |
285 | iter++; | |
286 | } | |
287 | return *iter; | |
288 | } | |
289 | //____________________________ | |
290 | AliFemtoString AliFemtoSimpleAnalysis::Report() | |
291 | { | |
292 | // Create a simple report from the analysis execution | |
293 | cout << "AliFemtoSimpleAnalysis - constructing Report..."<<endl; | |
294 | string temp = "-----------\nHbt Analysis Report:\n"; | |
295 | temp += "\nEvent Cuts:\n"; | |
296 | temp += fEventCut->Report(); | |
297 | temp += "\nParticle Cuts - First Particle:\n"; | |
298 | temp += fFirstParticleCut->Report(); | |
299 | temp += "\nParticle Cuts - Second Particle:\n"; | |
300 | temp += fSecondParticleCut->Report(); | |
301 | temp += "\nPair Cuts:\n"; | |
302 | temp += fPairCut->Report(); | |
303 | temp += "\nCorrelation Functions:\n"; | |
304 | AliFemtoCorrFctnIterator iter; | |
305 | if ( fCorrFctnCollection->size()==0 ) { | |
306 | cout << "AliFemtoSimpleAnalysis-Warning : no correlations functions in this analysis " << endl; | |
307 | } | |
308 | for (iter=fCorrFctnCollection->begin(); iter!=fCorrFctnCollection->end();iter++){ | |
309 | temp += (*iter)->Report(); | |
310 | temp += "\n"; | |
311 | } | |
312 | temp += "-------------\n"; | |
313 | AliFemtoString returnThis=temp; | |
314 | return returnThis; | |
315 | } | |
316 | //_________________________ | |
317 | void AliFemtoSimpleAnalysis::ProcessEvent(const AliFemtoEvent* hbtEvent) { | |
318 | // Add event to processed events | |
319 | fPicoEvent=0; // we will get a new pico event, if not prevent corr. fctn to access old pico event | |
320 | AddEventProcessed(); | |
321 | // startup for EbyE | |
322 | EventBegin(hbtEvent); | |
323 | // event cut and event cut monitor | |
324 | bool tmpPassEvent = fEventCut->Pass(hbtEvent); | |
325 | fEventCut->FillCutMonitor(hbtEvent, tmpPassEvent); | |
326 | if (tmpPassEvent) { | |
327 | cout << "AliFemtoSimpleAnalysis::ProcessEvent() - Event has passed cut - build picoEvent from " << | |
328 | hbtEvent->TrackCollection()->size() << " tracks in TrackCollection" << endl; | |
329 | // OK, analysis likes the event-- build a pico event from it, using tracks the analysis likes... | |
330 | fPicoEvent = new AliFemtoPicoEvent; // this is what we will make pairs from and put in Mixing Buffer | |
331 | // no memory leak. we will delete picoevents when they come out of the mixing buffer | |
332 | FillHbtParticleCollection(fFirstParticleCut,(AliFemtoEvent*)hbtEvent,fPicoEvent->FirstParticleCollection()); | |
333 | if ( !(AnalyzeIdenticalParticles()) ) | |
334 | FillHbtParticleCollection(fSecondParticleCut,(AliFemtoEvent*)hbtEvent,fPicoEvent->SecondParticleCollection()); | |
335 | cout <<"AliFemtoSimpleAnalysis::ProcessEvent - #particles in First, Second Collections: " << | |
336 | fPicoEvent->FirstParticleCollection()->size() << " " << | |
337 | fPicoEvent->SecondParticleCollection()->size() << endl; | |
338 | ||
339 | // mal - implement a switch which allows only using events with ParticleCollections containing a minimum | |
340 | // number of entries (jun2002) | |
341 | if ((fPicoEvent->FirstParticleCollection()->size() >= fMinSizePartCollection ) | |
342 | && ( AnalyzeIdenticalParticles() || (fPicoEvent->SecondParticleCollection()->size() >= fMinSizePartCollection ))) { | |
343 | ||
344 | ||
345 | //------------------------------------------------------------------------------ | |
346 | // Temporary comment: | |
347 | // This whole section rewritten so that all pairs are built using the | |
348 | // same code... easier to read and manage, and MakePairs() can be called by | |
349 | // derived classes. Also, the requirement of a full mixing buffer before | |
350 | // mixing is removed. | |
351 | // Dan Magestro, 11/2002 | |
352 | ||
353 | //------ Make real pairs. If identical, make pairs for one collection ------// | |
354 | ||
355 | if (AnalyzeIdenticalParticles()) { | |
356 | MakePairs("real", fPicoEvent->FirstParticleCollection() ); | |
357 | } | |
358 | else { | |
359 | MakePairs("real", fPicoEvent->FirstParticleCollection(), | |
360 | fPicoEvent->SecondParticleCollection() ); | |
361 | } | |
362 | cout << "AliFemtoSimpleAnalysis::ProcessEvent() - reals done "; | |
363 | ||
364 | //---- Make pairs for mixed events, looping over events in mixingBuffer ----// | |
365 | ||
366 | AliFemtoPicoEvent* storedEvent; | |
367 | AliFemtoPicoEventIterator fPicoEventIter; | |
368 | for (fPicoEventIter=MixingBuffer()->begin();fPicoEventIter!=MixingBuffer()->end();fPicoEventIter++){ | |
369 | storedEvent = *fPicoEventIter; | |
370 | if (AnalyzeIdenticalParticles()) { | |
371 | MakePairs("mixed",fPicoEvent->FirstParticleCollection(), | |
372 | storedEvent->FirstParticleCollection() ); | |
373 | } | |
374 | else { | |
375 | MakePairs("mixed",fPicoEvent->FirstParticleCollection(), | |
376 | storedEvent->SecondParticleCollection() ); | |
377 | ||
378 | MakePairs("mixed",storedEvent->FirstParticleCollection(), | |
379 | fPicoEvent->SecondParticleCollection() ); | |
380 | } | |
381 | } | |
382 | cout << " - mixed done " << endl; | |
383 | ||
384 | //--------- If mixing buffer is full, delete oldest event ---------// | |
385 | ||
386 | if ( MixingBufferFull() ) { | |
387 | delete MixingBuffer()->back(); | |
388 | MixingBuffer()->pop_back(); | |
389 | } | |
390 | ||
391 | //-------- Add current event (fPicoEvent) to mixing buffer --------// | |
392 | ||
393 | MixingBuffer()->push_front(fPicoEvent); | |
394 | ||
395 | ||
396 | // Temporary comment: End of rewritten section... Dan Magestro, 11/2002 | |
397 | //------------------------------------------------------------------------------ | |
398 | ||
399 | ||
400 | } // if ParticleCollections are big enough (mal jun2002) | |
401 | else{ | |
402 | delete fPicoEvent; | |
403 | } | |
404 | } // if currentEvent is accepted by currentAnalysis | |
405 | EventEnd(hbtEvent); // cleanup for EbyE | |
406 | //cout << "AliFemtoSimpleAnalysis::ProcessEvent() - return to caller ... " << endl; | |
407 | } | |
408 | //_________________________ | |
409 | void AliFemtoSimpleAnalysis::MakePairs(const char* typeIn, AliFemtoParticleCollection *partCollection1, | |
3efcfa2f | 410 | AliFemtoParticleCollection *partCollection2){ |
a5b23aa6 | 411 | // Build pairs, check pair cuts, and call CFs' AddRealPair() or |
412 | // AddMixedPair() methods. If no second particle collection is | |
413 | // specfied, make pairs within first particle collection. | |
414 | ||
415 | string type = typeIn; | |
416 | ||
29bfb3b1 | 417 | // int swpart = ((long int) partCollection1) % 2; |
418 | int swpart = fNeventsProcessed % 2; | |
3efcfa2f | 419 | |
a5b23aa6 | 420 | AliFemtoPair* tPair = new AliFemtoPair; |
421 | ||
422 | AliFemtoCorrFctnIterator tCorrFctnIter; | |
423 | ||
424 | AliFemtoParticleIterator tPartIter1, tPartIter2; | |
425 | ||
426 | AliFemtoParticleIterator tStartOuterLoop = partCollection1->begin(); // always | |
427 | AliFemtoParticleIterator tEndOuterLoop = partCollection1->end(); // will be one less if identical | |
428 | AliFemtoParticleIterator tStartInnerLoop; | |
429 | AliFemtoParticleIterator tEndInnerLoop; | |
430 | if (partCollection2) { // Two collections: | |
431 | tStartInnerLoop = partCollection2->begin(); // Full inner & outer loops | |
432 | tEndInnerLoop = partCollection2->end(); // | |
433 | } | |
434 | else { // One collection: | |
435 | tEndOuterLoop--; // Outer loop goes to next-to-last particle | |
436 | tEndInnerLoop = partCollection1->end() ; // Inner loop goes to last particle | |
437 | } | |
438 | for (tPartIter1=tStartOuterLoop;tPartIter1!=tEndOuterLoop;tPartIter1++) { | |
439 | if (!partCollection2){ | |
440 | tStartInnerLoop = tPartIter1; | |
441 | tStartInnerLoop++; | |
442 | } | |
443 | tPair->SetTrack1(*tPartIter1); | |
444 | for (tPartIter2 = tStartInnerLoop; tPartIter2!=tEndInnerLoop;tPartIter2++) { | |
445 | tPair->SetTrack2(*tPartIter2); | |
446 | ||
447 | // The following lines have to be uncommented if you want pairCutMonitors | |
448 | // they are not in for speed reasons | |
449 | // bool tmpPassPair = fPairCut->Pass(tPair); | |
450 | // fPairCut->FillCutMonitor(tPair, tmpPassPair); | |
451 | // if ( tmpPassPair ) | |
452 | ||
453 | //---- If pair passes cut, loop over CF's and add pair to real/mixed ----// | |
454 | ||
3efcfa2f | 455 | if (!partCollection2) { |
456 | if (swpart) { | |
457 | tPair->SetTrack1(*tPartIter2); | |
458 | tPair->SetTrack2(*tPartIter1); | |
459 | swpart = 0; | |
460 | } | |
461 | else { | |
462 | tPair->SetTrack1(*tPartIter1); | |
463 | tPair->SetTrack2(*tPartIter2); | |
464 | swpart = 1; | |
465 | } | |
466 | } | |
467 | ||
a5b23aa6 | 468 | if (fPairCut->Pass(tPair)){ |
469 | for (tCorrFctnIter=fCorrFctnCollection->begin(); | |
470 | tCorrFctnIter!=fCorrFctnCollection->end();tCorrFctnIter++){ | |
471 | AliFemtoCorrFctn* tCorrFctn = *tCorrFctnIter; | |
472 | if(type == "real") | |
473 | tCorrFctn->AddRealPair(tPair); | |
474 | else if(type == "mixed") | |
475 | tCorrFctn->AddMixedPair(tPair); | |
476 | else | |
477 | cout << "Problem with pair type, type = " << type.c_str() << endl; | |
478 | } | |
479 | } | |
480 | ||
481 | } // loop over second particle | |
482 | ||
483 | } // loop over first particle | |
484 | ||
485 | delete tPair; | |
486 | ||
487 | } | |
488 | //_________________________ | |
489 | void AliFemtoSimpleAnalysis::EventBegin(const AliFemtoEvent* ev){ | |
490 | // Perform initialization operations at the beginning of the event processing | |
491 | //cout << " AliFemtoSimpleAnalysis::EventBegin(const AliFemtoEvent* ev) " << endl; | |
492 | fFirstParticleCut->EventBegin(ev); | |
493 | fSecondParticleCut->EventBegin(ev); | |
494 | fPairCut->EventBegin(ev); | |
495 | for (AliFemtoCorrFctnIterator iter=fCorrFctnCollection->begin(); iter!=fCorrFctnCollection->end();iter++){ | |
496 | (*iter)->EventBegin(ev); | |
497 | } | |
498 | } | |
499 | //_________________________ | |
500 | void AliFemtoSimpleAnalysis::EventEnd(const AliFemtoEvent* ev){ | |
501 | // Fiinsh operations at the end of event processing | |
502 | fFirstParticleCut->EventEnd(ev); | |
503 | fSecondParticleCut->EventEnd(ev); | |
504 | fPairCut->EventEnd(ev); | |
505 | for (AliFemtoCorrFctnIterator iter=fCorrFctnCollection->begin(); iter!=fCorrFctnCollection->end();iter++){ | |
506 | (*iter)->EventEnd(ev); | |
507 | } | |
508 | } | |
509 | //_________________________ | |
510 | void AliFemtoSimpleAnalysis::Finish(){ | |
511 | // Perform finishing operations after all events are processed | |
512 | AliFemtoCorrFctnIterator iter; | |
513 | for (iter=fCorrFctnCollection->begin(); iter!=fCorrFctnCollection->end();iter++){ | |
514 | (*iter)->Finish(); | |
515 | } | |
516 | } | |
517 | //_________________________ | |
518 | void AliFemtoSimpleAnalysis::AddEventProcessed() { | |
519 | // Increase count of processed events | |
520 | fNeventsProcessed++; | |
521 | } | |
522 | //_________________________ | |
523 | TList* AliFemtoSimpleAnalysis::ListSettings() | |
524 | { | |
0b3bd1ac | 525 | // Collect settings list |
a5b23aa6 | 526 | TList *tListSettings = new TList(); |
527 | ||
528 | TList *p1Cut = fFirstParticleCut->ListSettings(); | |
529 | ||
530 | TListIter nextp1(p1Cut); | |
531 | while (TObject *obj = nextp1.Next()) { | |
532 | TString cuts(obj->GetName()); | |
533 | cuts.Prepend("AliFemtoSimpleAnalysis."); | |
534 | tListSettings->Add(new TObjString(cuts.Data())); | |
535 | } | |
536 | ||
537 | if (fSecondParticleCut != fFirstParticleCut) { | |
538 | TList *p2Cut = fSecondParticleCut->ListSettings(); | |
539 | ||
540 | TIter nextp2(p2Cut); | |
541 | while (TObject *obj = nextp2()) { | |
542 | TString cuts(obj->GetName()); | |
543 | cuts.Prepend("AliFemtoSimpleAnalysis."); | |
544 | tListSettings->Add(new TObjString(cuts.Data())); | |
545 | } | |
546 | } | |
547 | ||
548 | TList *pairCut = fPairCut->ListSettings(); | |
549 | ||
550 | TIter nextpair(pairCut); | |
551 | while (TObject *obj = nextpair()) { | |
552 | TString cuts(obj->GetName()); | |
553 | cuts.Prepend("AliFemtoSimpleAnalysis."); | |
554 | tListSettings->Add(new TObjString(cuts.Data())); | |
555 | } | |
556 | ||
557 | return tListSettings; | |
558 | ||
559 | } | |
0b3bd1ac | 560 | |
561 | //_________________________ | |
562 | TList* AliFemtoSimpleAnalysis::GetOutputList() | |
563 | { | |
564 | // Collect the list of output objects | |
565 | // to be written | |
566 | TList *tOutputList = new TList(); | |
567 | ||
568 | TList *p1Cut = fFirstParticleCut->GetOutputList(); | |
569 | ||
570 | TListIter nextp1(p1Cut); | |
571 | while (TObject *obj = nextp1.Next()) { | |
572 | tOutputList->Add(obj); | |
573 | } | |
574 | ||
575 | if (fSecondParticleCut != fFirstParticleCut) { | |
576 | TList *p2Cut = fSecondParticleCut->GetOutputList(); | |
577 | ||
578 | TIter nextp2(p2Cut); | |
579 | while (TObject *obj = nextp2()) { | |
580 | tOutputList->Add(obj); | |
581 | } | |
582 | } | |
583 | ||
584 | TList *pairCut = fPairCut->GetOutputList(); | |
585 | ||
586 | TIter nextpair(pairCut); | |
587 | while (TObject *obj = nextpair()) { | |
588 | tOutputList->Add(obj); | |
589 | } | |
590 | ||
76e2a578 | 591 | TList *eventCut = fEventCut->GetOutputList(); |
592 | ||
593 | TIter nextevent(eventCut); | |
594 | while (TObject *obj = nextevent()) { | |
595 | tOutputList->Add(obj); | |
596 | } | |
597 | ||
0b3bd1ac | 598 | AliFemtoCorrFctnIterator iter; |
599 | for (iter=fCorrFctnCollection->begin(); iter!=fCorrFctnCollection->end();iter++){ | |
600 | TList *tListCf = (*iter)->GetOutputList(); | |
601 | ||
602 | TIter nextListCf(tListCf); | |
603 | while (TObject *obj = nextListCf()) { | |
604 | tOutputList->Add(obj); | |
605 | } | |
606 | } | |
607 | ||
608 | return tOutputList; | |
609 | ||
610 | } |