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