]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/FEMTOSCOPY/AliFemto/AliFemtoSimpleAnalysis.cxx
Less verbose output
[u/mrichter/AliRoot.git] / PWG2 / FEMTOSCOPY / AliFemto / AliFemtoSimpleAnalysis.cxx
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 //    cout << "Event has passed cut with " << hbtEvent->TrackCollection()->size() << " tracks" << endl;
330     // OK, analysis likes the event-- build a pico event from it, using tracks the analysis likes...
331     fPicoEvent = new AliFemtoPicoEvent; // this is what we will make pairs from and put in Mixing Buffer
332     // no memory leak. we will delete picoevents when they come out of the mixing buffer
333     FillHbtParticleCollection(fFirstParticleCut,(AliFemtoEvent*)hbtEvent,fPicoEvent->FirstParticleCollection());
334     if ( !(AnalyzeIdenticalParticles()) )
335       FillHbtParticleCollection(fSecondParticleCut,(AliFemtoEvent*)hbtEvent,fPicoEvent->SecondParticleCollection());
336 //     cout <<"AliFemtoSimpleAnalysis::ProcessEvent - #particles in First, Second Collections: " <<
337 //       fPicoEvent->FirstParticleCollection()->size() << " " <<
338 //       fPicoEvent->SecondParticleCollection()->size() << endl;
339     
340     cout << "#particles in Collection 1, 2: " <<
341       fPicoEvent->FirstParticleCollection()->size() << " " <<
342       fPicoEvent->SecondParticleCollection()->size() << endl;
343     
344     // mal - implement a switch which allows only using events with ParticleCollections containing a minimum
345     // number of entries (jun2002)
346     if ((fPicoEvent->FirstParticleCollection()->size() >= fMinSizePartCollection )
347         && ( AnalyzeIdenticalParticles() || (fPicoEvent->SecondParticleCollection()->size() >= fMinSizePartCollection ))) {
348
349
350 //------------------------------------------------------------------------------
351 //   Temporary comment:
352 //      This whole section rewritten so that all pairs are built using the
353 //      same code... easier to read and manage, and MakePairs() can be called by
354 //      derived classes.  Also, the requirement of a full mixing buffer before
355 //      mixing is removed.
356 //                          Dan Magestro, 11/2002
357
358       //------ Make real pairs. If identical, make pairs for one collection ------//
359
360       if (AnalyzeIdenticalParticles()) {
361         MakePairs("real", fPicoEvent->FirstParticleCollection() );
362       }
363       else {
364         MakePairs("real", fPicoEvent->FirstParticleCollection(),
365                           fPicoEvent->SecondParticleCollection() );
366       }
367       cout << "AliFemtoSimpleAnalysis::ProcessEvent() - reals done ";
368
369       //---- Make pairs for mixed events, looping over events in mixingBuffer ----//
370
371       AliFemtoPicoEvent* storedEvent;
372       AliFemtoPicoEventIterator fPicoEventIter;
373       for (fPicoEventIter=MixingBuffer()->begin();fPicoEventIter!=MixingBuffer()->end();fPicoEventIter++){
374         storedEvent = *fPicoEventIter;
375         if (AnalyzeIdenticalParticles()) {
376           MakePairs("mixed",fPicoEvent->FirstParticleCollection(),
377                             storedEvent->FirstParticleCollection() );
378         }
379         else {
380           MakePairs("mixed",fPicoEvent->FirstParticleCollection(),
381                             storedEvent->SecondParticleCollection() );
382
383           MakePairs("mixed",storedEvent->FirstParticleCollection(),
384                             fPicoEvent->SecondParticleCollection() );
385         }
386       }
387       cout << " - mixed done   " << endl;
388
389       //--------- If mixing buffer is full, delete oldest event ---------//
390
391       if ( MixingBufferFull() ) {
392         delete MixingBuffer()->back();
393         MixingBuffer()->pop_back();
394       }
395
396       //-------- Add current event (fPicoEvent) to mixing buffer --------//
397
398       MixingBuffer()->push_front(fPicoEvent);
399
400
401 // Temporary comment: End of rewritten section... Dan Magestro, 11/2002
402 //------------------------------------------------------------------------------
403
404
405     }  // if ParticleCollections are big enough (mal jun2002)
406     else{
407       delete fPicoEvent;
408     }
409   }   // if currentEvent is accepted by currentAnalysis
410   EventEnd(hbtEvent);  // cleanup for EbyE 
411   //cout << "AliFemtoSimpleAnalysis::ProcessEvent() - return to caller ... " << endl;
412 }
413 //_________________________
414 void AliFemtoSimpleAnalysis::MakePairs(const char* typeIn, AliFemtoParticleCollection *partCollection1,
415                                        AliFemtoParticleCollection *partCollection2){
416 // Build pairs, check pair cuts, and call CFs' AddRealPair() or
417 // AddMixedPair() methods. If no second particle collection is
418 // specfied, make pairs within first particle collection.
419
420   string type = typeIn;
421
422   //  int swpart = ((long int) partCollection1) % 2;
423   int swpart = fNeventsProcessed % 2;
424
425   AliFemtoPair* tPair = new AliFemtoPair;
426
427   AliFemtoCorrFctnIterator tCorrFctnIter;
428
429   AliFemtoParticleIterator tPartIter1, tPartIter2;
430
431   AliFemtoParticleIterator tStartOuterLoop = partCollection1->begin();  // always
432   AliFemtoParticleIterator tEndOuterLoop   = partCollection1->end();    // will be one less if identical
433   AliFemtoParticleIterator tStartInnerLoop;
434   AliFemtoParticleIterator tEndInnerLoop;
435   if (partCollection2) {                        // Two collections:
436     tStartInnerLoop = partCollection2->begin();  //   Full inner & outer loops
437     tEndInnerLoop   = partCollection2->end();    //
438   }
439   else {                                        // One collection:
440     tEndOuterLoop--;                             //   Outer loop goes to next-to-last particle
441     tEndInnerLoop = partCollection1->end() ;     //   Inner loop goes to last particle
442   }
443   for (tPartIter1=tStartOuterLoop;tPartIter1!=tEndOuterLoop;tPartIter1++) {
444     if (!partCollection2){
445       tStartInnerLoop = tPartIter1;
446       tStartInnerLoop++;
447     }
448     tPair->SetTrack1(*tPartIter1);
449     for (tPartIter2 = tStartInnerLoop; tPartIter2!=tEndInnerLoop;tPartIter2++) {
450       tPair->SetTrack2(*tPartIter2);
451
452       // The following lines have to be uncommented if you want pairCutMonitors
453       // they are not in for speed reasons
454       // bool tmpPassPair = fPairCut->Pass(tPair);
455       // fPairCut->FillCutMonitor(tPair, tmpPassPair);
456       // if ( tmpPassPair )
457
458       //---- If pair passes cut, loop over CF's and add pair to real/mixed ----//
459
460       if (!partCollection2) {
461         if (swpart) {
462           tPair->SetTrack1(*tPartIter2);
463           tPair->SetTrack2(*tPartIter1);
464           swpart = 0;
465         }
466         else {
467           tPair->SetTrack1(*tPartIter1);
468           tPair->SetTrack2(*tPartIter2);
469           swpart = 1;
470         }
471       }
472
473       if (fPairCut->Pass(tPair)){
474         for (tCorrFctnIter=fCorrFctnCollection->begin();
475              tCorrFctnIter!=fCorrFctnCollection->end();tCorrFctnIter++){
476           AliFemtoCorrFctn* tCorrFctn = *tCorrFctnIter;
477           if(type == "real")
478             tCorrFctn->AddRealPair(tPair);
479           else if(type == "mixed")
480             tCorrFctn->AddMixedPair(tPair);
481           else
482             cout << "Problem with pair type, type = " << type.c_str() << endl;
483         }
484       }
485
486     }    // loop over second particle
487
488   }      // loop over first particle
489
490   delete tPair;
491
492 }
493 //_________________________
494 void AliFemtoSimpleAnalysis::EventBegin(const AliFemtoEvent* ev){
495   // Perform initialization operations at the beginning of the event processing
496   //cout << " AliFemtoSimpleAnalysis::EventBegin(const AliFemtoEvent* ev) " << endl;
497   fFirstParticleCut->EventBegin(ev);
498   fSecondParticleCut->EventBegin(ev);
499   fPairCut->EventBegin(ev);
500   for (AliFemtoCorrFctnIterator iter=fCorrFctnCollection->begin(); iter!=fCorrFctnCollection->end();iter++){
501     (*iter)->EventBegin(ev);
502   }
503 }
504 //_________________________
505 void AliFemtoSimpleAnalysis::EventEnd(const AliFemtoEvent* ev){
506   // Fiinsh operations at the end of event processing
507   fFirstParticleCut->EventEnd(ev);
508   fSecondParticleCut->EventEnd(ev);
509   fPairCut->EventEnd(ev);
510   for (AliFemtoCorrFctnIterator iter=fCorrFctnCollection->begin(); iter!=fCorrFctnCollection->end();iter++){
511     (*iter)->EventEnd(ev);
512   }
513 }
514 //_________________________
515 void AliFemtoSimpleAnalysis::Finish(){
516   // Perform finishing operations after all events are processed
517   AliFemtoCorrFctnIterator iter;
518   for (iter=fCorrFctnCollection->begin(); iter!=fCorrFctnCollection->end();iter++){
519     (*iter)->Finish();
520   }
521 }
522 //_________________________
523 void AliFemtoSimpleAnalysis::AddEventProcessed() {
524   // Increase count of processed events
525   fNeventsProcessed++;
526 }
527 //_________________________
528 TList* AliFemtoSimpleAnalysis::ListSettings()
529 {
530   // Collect settings list
531   TList *tListSettings = new TList();
532
533   TList *p1Cut = fFirstParticleCut->ListSettings();
534
535   TListIter nextp1(p1Cut);
536   while (TObject *obj = nextp1.Next()) {
537     TString cuts(obj->GetName());
538     cuts.Prepend("AliFemtoSimpleAnalysis.");
539     tListSettings->Add(new TObjString(cuts.Data()));
540   }
541
542   if (fSecondParticleCut != fFirstParticleCut) {
543     TList *p2Cut = fSecondParticleCut->ListSettings();
544     
545     TIter nextp2(p2Cut);
546     while (TObject *obj = nextp2()) {
547       TString cuts(obj->GetName());
548       cuts.Prepend("AliFemtoSimpleAnalysis.");
549       tListSettings->Add(new TObjString(cuts.Data()));
550     }
551   }
552
553   TList *pairCut = fPairCut->ListSettings();
554
555   TIter nextpair(pairCut);
556   while (TObject *obj = nextpair()) {
557     TString cuts(obj->GetName());
558     cuts.Prepend("AliFemtoSimpleAnalysis.");
559     tListSettings->Add(new TObjString(cuts.Data()));
560   }
561
562   return tListSettings;
563   
564 }
565
566 //_________________________
567 TList* AliFemtoSimpleAnalysis::GetOutputList()
568 {
569   // Collect the list of output objects
570   // to be written 
571   TList *tOutputList = new TList();
572
573   TList *p1Cut = fFirstParticleCut->GetOutputList();
574
575   TListIter nextp1(p1Cut);
576   while (TObject *obj = nextp1.Next()) {
577     tOutputList->Add(obj);
578   }
579
580   if (fSecondParticleCut != fFirstParticleCut) {
581     TList *p2Cut = fSecondParticleCut->GetOutputList();
582     
583     TIter nextp2(p2Cut);
584     while (TObject *obj = nextp2()) {
585       tOutputList->Add(obj);
586     }
587   }
588
589   TList *pairCut = fPairCut->GetOutputList();
590
591   TIter nextpair(pairCut);
592   while (TObject *obj = nextpair()) {
593     tOutputList->Add(obj);
594   }
595
596   TList *eventCut = fEventCut->GetOutputList();
597
598   TIter nextevent(eventCut);
599   while (TObject *obj = nextevent()) {
600     tOutputList->Add(obj);
601   }
602
603   AliFemtoCorrFctnIterator iter;
604   for (iter=fCorrFctnCollection->begin(); iter!=fCorrFctnCollection->end();iter++){
605     TList *tListCf = (*iter)->GetOutputList();
606     
607     TIter nextListCf(tListCf);
608     while (TObject *obj = nextListCf()) {
609       tOutputList->Add(obj);
610     }
611   }
612
613   return tOutputList;
614   
615 }