]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HBTAN/AliHBTAnalysisStavinskyMixing.cxx
Bug correction
[u/mrichter/AliRoot.git] / HBTAN / AliHBTAnalysisStavinskyMixing.cxx
1 #include "AliHBTAnalysisStavinskyMixing.h"
2 //_________________________________________________________
3 ////////////////////////////////////////////////////////////////////////////
4 //
5 // class AliHBTAnalysisStavinskyMixing
6 //
7 // Central Object Of HBTAnalyser: 
8 // This class performs main looping within HBT Analysis
9 // User must plug a reader of Type AliReader
10 // User plugs in coorelation and monitor functions
11 // as well as monitor functions
12 //
13 // HBT Analysis Tool, which is integral part of AliRoot,
14 // ALICE Off-Line framework:
15 //
16 // Piotr.Skowronski@cern.ch
17 // more info: http://alisoft.cern.ch/people/skowron/analyzer/index.html
18 //
19 ////////////////////////////////////////////////////////////////////////////
20 //_________________________________________________________
21
22
23 #include <TSystem.h>
24 #include <TFile.h>
25
26 #include "AliAOD.h"
27 #include "AliAODParticle.h"
28 #include "AliAODPairCut.h"
29 #include "AliEventCut.h"
30
31 #include "AliEventBuffer.h"
32
33 #include "AliReader.h"
34 #include "AliHBTPair.h"
35 #include "AliHBTFunction.h"
36 #include "AliHBTMonitorFunction.h"
37  
38
39 ClassImp(AliHBTAnalysisStavinskyMixing)
40
41
42 Int_t AliHBTAnalysisStavinskyMixing::ProcessRecAndSim(AliAOD* aodrec, AliAOD* aodsim)
43 {
44 //Does analysis for both tracks and particles
45 //mainly for resolution study and analysies with weighting algirithms
46   
47 // cut on particles only -- why?
48 // - PID: when we make resolution analysis we want to take only tracks with correct PID
49 // We need cut on tracks because there are data characteristic
50   
51   AliVAODParticle * part1, * part2;
52   AliVAODParticle * track1, * track2;
53   
54   AliAOD * trackEvent = aodrec, *partEvent = aodsim;
55   AliAOD* trackEvent1 = new AliAOD();
56   AliAOD* partEvent1 = new AliAOD();
57
58   
59 //  Int_t N1, N2, N=0; //number of particles in current event(we prcess two events in one time)
60   
61 //  Int_t nev = fReader->GetNumberOfTrackEvents();
62   static AliHBTPair tpair;
63   static AliHBTPair ppair;
64
65   AliHBTPair* trackpair = &tpair;
66   AliHBTPair* partpair = &ppair;
67  
68   AliHBTPair * tmptrackpair;//temprary pointers to pairs
69   AliHBTPair * tmppartpair;
70   
71   register UInt_t ii;
72   
73   
74
75   if ( !partEvent || !trackEvent ) 
76    {
77      Error("ProcessRecAndSim","<<%s>> Can not get event",GetName());
78      return 1;
79    }
80
81   if ( partEvent->GetNumberOfParticles() != trackEvent->GetNumberOfParticles() )
82    {
83      Error("ProcessRecAndSim",
84            "Number of simulated particles (%d) not equal to number of reconstructed tracks (%d). Skipping Event.",
85             partEvent->GetNumberOfParticles() , trackEvent->GetNumberOfParticles());
86      return 2;
87    }
88
89
90   for (Int_t j = 0; j<partEvent->GetNumberOfParticles() ; j++)
91    {
92      /***************************************/
93      /******   Looping same events   ********/
94      /******   filling numerators    ********/
95      /***************************************/
96      if ( (j%fDisplayMixingInfo) == 0)
97         Info("ProcessTracksAndParticles",
98              "Mixing particle %d with particles from the same event",j);
99
100      part1= partEvent->GetParticle(j);
101      track1= trackEvent->GetParticle(j);
102      
103      Bool_t firstcut = (this->*fkPass1)(part1,track1);
104      if (fBufferSize != 0) 
105        if ( (firstcut == kFALSE) || ( (this->*fkPass2)(part1,track1) == kFALSE ) )
106         {
107           //accepted by any cut
108           // we have to copy because reader keeps only one event
109
110           partEvent1->AddParticle(part1);
111           trackEvent1->AddParticle(track1);
112         }
113
114      if (firstcut) continue;
115
116      for(ii = 0; ii<fNParticleMonitorFunctions; ii++)
117        fParticleMonitorFunctions[ii]->Process(part1);
118      for(ii = 0; ii<fNTrackMonitorFunctions; ii++)
119        fTrackMonitorFunctions[ii]->Process(track1);
120      for(ii = 0; ii<fNParticleAndTrackMonitorFunctions; ii++)
121        fParticleAndTrackMonitorFunctions[ii]->Process(track1,part1);
122
123      if (fNoCorrfctns) continue;
124
125      for (Int_t k =j+1; k < partEvent->GetNumberOfParticles() ; k++)
126       {
127         part2= partEvent->GetParticle(k);
128         if (part1->GetUID() == part2->GetUID()) continue;
129         partpair->SetParticles(part1,part2);
130
131         track2= trackEvent->GetParticle(k);
132         trackpair->SetParticles(track1,track2);
133
134         if( (this->*fkPass)(partpair,trackpair) ) //check pair cut 
135           { //do not meets crietria of the pair cut, try with swapped pairs
136             if( (this->*fkPass)((AliHBTPair*)partpair->GetSwappedPair(),(AliHBTPair*)trackpair->GetSwappedPair()) )
137               continue; //swaped pairs do not meet criteria of pair cut as well, take next particle
138             else 
139              { //swaped pair meets all the criteria
140                tmppartpair = (AliHBTPair*)partpair->GetSwappedPair();
141                tmptrackpair = (AliHBTPair*)trackpair->GetSwappedPair();
142              }
143           }
144         else
145          {//meets criteria of the pair cut
146            tmptrackpair = trackpair;
147            tmppartpair = partpair;
148          }
149
150         for(ii = 0;ii<fNParticleFunctions;ii++)
151                fParticleFunctions[ii]->ProcessSameEventParticles(tmppartpair);
152
153         for(ii = 0;ii<fNTrackFunctions;ii++)
154                fTrackFunctions[ii]->ProcessSameEventParticles(tmptrackpair);
155
156         for(ii = 0;ii<fNParticleAndTrackFunctions;ii++)
157                fParticleAndTrackFunctions[ii]->ProcessSameEventParticles(tmptrackpair,tmppartpair);
158
159
160         /***************************************/
161         /***** Filling denominators    *********/
162         /***************************************/
163
164         tmppartpair->MirrorSecond();
165         tmptrackpair->MirrorSecond();
166         
167         if((this->*fkPass)(tmppartpair,tmptrackpair) == kFALSE)
168          {
169             for(ii = 0;ii<fNParticleFunctions;ii++)
170               fParticleFunctions[ii]->ProcessDiffEventParticles(tmppartpair);
171
172             for(ii = 0;ii<fNTrackFunctions;ii++)
173               fTrackFunctions[ii]->ProcessDiffEventParticles(tmptrackpair);
174
175             for(ii = 0;ii<fNParticleAndTrackFunctions;ii++)
176               fParticleAndTrackFunctions[ii]->ProcessDiffEventParticles(tmptrackpair,tmppartpair);
177
178          } 
179         
180         tmppartpair->DeleteSecond();
181         tmptrackpair->DeleteSecond();
182         
183        //end of 2nd loop over particles from the same event  
184       }//for (Int_t k =j+1; k < partEvent->GetNumberOfParticles() ; k++)
185
186     //end of loop over particles from first event
187    }//for (Int_t j = 0; j<partEvent->GetNumberOfParticles() ; j++)
188   delete fPartBuffer->Push(partEvent1);
189   delete fTrackBuffer->Push(trackEvent1);
190  //end of loop over events  
191   return 0;
192 }
193 /*************************************************************************************/ 
194
195 Int_t AliHBTAnalysisStavinskyMixing::ProcessSim(AliAOD* /*aodrec*/, AliAOD* aodsim)
196 {
197   //Does analysis of simulated data
198   AliVAODParticle * part1, * part2;
199   
200   AliAOD* partEvent = aodsim;
201   AliAOD* partEvent1 = new AliAOD();
202
203  
204   AliHBTPair * tmppartpair;
205   
206   register UInt_t ii;
207   
208
209   if ( !partEvent )
210    {
211      Error("ProcessRecAndSim","Can not get event");
212      return 1;
213    }
214
215
216   for (Int_t j = 0; j<partEvent->GetNumberOfParticles() ; j++)
217    {
218      /***************************************/
219      /******   Looping same events   ********/
220      /******   filling numerators    ********/
221      /***************************************/
222      Warning("ProcessTracksAndParticles","Non-std MIXING");
223      if ( (j%fDisplayMixingInfo) == 0)
224         Info("ProcessTracksAndParticles",
225              "Mixing particle %d with particles from the same event",j);
226
227      part1= partEvent->GetParticle(j);
228
229      Bool_t firstcut = fPairCut->GetFirstPartCut()->Rejected(part1);
230
231      if (fBufferSize != 0) 
232        if ( (firstcut == kFALSE) || ( fPairCut->GetSecondPartCut()->Rejected(part1) == kFALSE ) )
233         {
234           //accepted by any cut
235           // we have to copy because reader keeps only one event
236
237           partEvent1->AddParticle(part1);
238         }
239
240      if (firstcut) continue;
241
242      for(ii = 0; ii<fNParticleMonitorFunctions; ii++)
243        fParticleMonitorFunctions[ii]->Process(part1);
244
245      if ( fNParticleFunctions == 0 ) continue;
246
247      for (Int_t k =j+1; k < partEvent->GetNumberOfParticles() ; k++)
248       {
249         part2= partEvent->GetParticle(k);
250         if (part1->GetUID() == part2->GetUID()) continue;
251         partpair->SetParticles(part1,part2);
252
253            if(fPairCut->Rejected(partpair)) //check pair cut
254             { //do not meets crietria of the 
255               if( fPairCut->Rejected((AliHBTPair*)partpair->GetSwappedPair()) ) continue;
256               else tmppartpair = (AliHBTPair*)partpair->GetSwappedPair();
257             }
258            else
259             {
260               tmppartpair = partpair;
261             }
262
263         for(ii = 0;ii<fNParticleFunctions;ii++)
264                fParticleFunctions[ii]->ProcessSameEventParticles(tmppartpair);
265
266
267         /***************************************/
268         /***** Filling denominators    *********/
269         /***************************************/
270         
271         tmppartpair->MirrorSecond();
272         
273         if(fPairCut->Rejected(partpair) == kFALSE)
274          {
275            for(ii = 0;ii<fNParticleFunctions;ii++)
276              fParticleFunctions[ii]->ProcessDiffEventParticles(tmppartpair);
277          }  
278         tmppartpair->DeleteSecond();
279         
280        //end of 2nd loop over particles from the same event  
281       }//for (Int_t k =j+1; k < partEvent->GetNumberOfParticles() ; k++)
282
283        }
284   delete fPartBuffer->Push(partEvent1);
285  //end of loop over events  
286   return 0;
287 }
288 /*************************************************************************************/ 
289 Int_t AliHBTAnalysisStavinskyMixing::ProcessRec(AliAOD* aodrec, AliAOD* /*aodsim*/)
290 {
291   //Does analysis of reconstructed data
292   AliVAODParticle * track1, * track2;
293   
294   AliAOD* trackEvent = aodrec;
295   AliAOD* trackEvent1 = new AliAOD();
296
297   AliAOD* trackEvent2;
298   
299   AliHBTPair tpair;
300
301   AliHBTPair* trackpair = &tpair;
302  
303   AliHBTPair * tmptrackpair;
304   
305   register UInt_t ii;
306   
307
308   if ( !trackEvent )
309    {
310      Error("ProcessRecAndSim","Can not get event");
311      return 1;
312    }
313
314
315   for (Int_t j = 0; j<trackEvent->GetNumberOfParticles() ; j++)
316    {
317      /***************************************/
318      /******   Looping same events   ********/
319      /******   filling numerators    ********/
320      /***************************************/
321      if ( (j%fDisplayMixingInfo) == 0)
322         Info("ProcessTracksAndParticles",
323              "Mixing Particle %d with Particles from the same event",j);
324
325      track1= trackEvent->GetParticle(j);
326
327      Bool_t firstcut = fPairCut->GetFirstPartCut()->Rejected(track1);
328
329      if (fBufferSize != 0) 
330        if ( (firstcut == kFALSE) || ( fPairCut->GetSecondPartCut()->Rejected(track1) == kFALSE ) )
331         {
332           //accepted by any cut
333           // we have to copy because reader keeps only one event
334
335           trackEvent1->AddParticle(track1);
336         }
337
338      if (firstcut) continue;
339
340      for(ii = 0; ii<fNParticleMonitorFunctions; ii++)
341        fParticleMonitorFunctions[ii]->Process(track1);
342
343      if ( fNParticleFunctions == 0 ) continue;
344
345      for (Int_t k =j+1; k < trackEvent->GetNumberOfParticles() ; k++)
346       {
347         track2= trackEvent->GetParticle(k);
348         if (track1->GetUID() == track2->GetUID()) continue;
349         trackpair->SetParticles(track1,track2);
350
351            if(fPairCut->Rejected(trackpair)) //check pair cut
352             { //do not meets crietria of the 
353               if( fPairCut->Rejected((AliHBTPair*)trackpair->GetSwappedPair()) ) continue;
354               else tmptrackpair = (AliHBTPair*)trackpair->GetSwappedPair();
355             }
356            else
357             {
358               tmptrackpair = trackpair;
359             }
360
361         for(ii = 0;ii<fNTrackFunctions;ii++)
362                fParticleFunctions[ii]->ProcessSameEventParticles(tmptrackpair);
363
364        //end of 2nd loop over Particles from the same event  
365       }//for (Int_t k =j+1; k < trackEvent->GetNumberOfParticles() ; k++)
366
367      /***************************************/
368      /***** Filling denominators    *********/
369      /***************************************/
370      if (fBufferSize == 0) continue;
371
372      fTrackBuffer->ResetIter();
373          Int_t m = 0;
374          while (( trackEvent2 = fTrackBuffer->Next() ))
375           {
376             m++;
377             if ( (j%fDisplayMixingInfo) == 0)
378                Info("ProcessParticles",
379                     "Mixing Particle %d from current event with Particles from event %d",j,-m);
380             for(Int_t l = 0; l<trackEvent2->GetNumberOfParticles();l++)   //  ... on all Particles
381               {
382
383                 track2= trackEvent2->GetParticle(l);
384                 trackpair->SetParticles(track1,track2);
385
386                 if( fPairCut->Rejected(trackpair) ) //check pair cut
387                   { //do not meets crietria of the 
388                     if( fPairCut->Rejected((AliHBTPair*)trackpair->GetSwappedPair()) )
389                       continue;
390                     else 
391                      {
392                        tmptrackpair = (AliHBTPair*)trackpair->GetSwappedPair();
393                      }
394                   }
395                 else
396                  {//meets criteria of the pair cut
397                   tmptrackpair = trackpair;
398                  }
399                  
400                 for(ii = 0;ii<fNTrackFunctions;ii++)
401                   fTrackFunctions[ii]->ProcessDiffEventParticles(tmptrackpair);
402                  
403              }//for(Int_t l = 0; l<N2;l++)   //  ... on all Particles
404           }
405        }
406   delete fTrackBuffer->Push(trackEvent1);
407  //end of loop over events  
408   return 0;
409 }
410 /*************************************************************************************/ 
411      
412 Int_t AliHBTAnalysisStavinskyMixing::ProcessRecAndSimNonId(AliAOD* aodrec, AliAOD* aodsim)
413 {
414 //Analyzes both reconstructed and simulated data
415   if (aodrec == 0x0) 
416    {
417      Error("ProcessTracksAndParticlesNonIdentAnal","Reconstructed event is NULL");
418      return 1;
419    }
420
421   if (aodsim == 0x0) 
422    {
423      Error("ProcessTracksAndParticlesNonIdentAnal","Simulated event is NULL");
424      return 1;
425    }
426
427   if ( aodrec->GetNumberOfParticles() != aodsim->GetNumberOfParticles() )
428    {
429      Error("ProcessTracksAndParticlesNonIdentAnal",
430            "Number of simulated particles (%d) not equal to number of reconstructed tracks (%d)",
431            aodsim->GetNumberOfParticles() , aodrec->GetNumberOfParticles());
432      return 2;
433    }
434
435  
436   AliVAODParticle * part1, * part2;
437   AliVAODParticle * track1, * track2;
438
439   static AliAOD aodrec1;
440   static AliAOD aodsim1;
441
442   AliAOD * trackEvent1=&aodrec1,*partEvent1=&aodsim1;//Particle that passes first particle cut, this event
443   trackEvent1->Reset();
444   partEvent1->Reset();
445   AliAOD * trackEvent2=0x0,*partEvent2=0x0;//Particle that passes second particle cut, this event
446   AliAOD * trackEvent3=0x0,*partEvent3=0x0;//Particle that passes second particle cut, events from buffer
447
448   AliAOD* rawtrackEvent = aodrec;//this we get from Reader
449   AliAOD* rawpartEvent = aodsim;//this we get from Reader
450
451   static AliHBTPair tpair;
452   static AliHBTPair ppair;
453   
454   AliHBTPair* trackpair = &tpair;
455   AliHBTPair* partpair = &ppair;
456
457   register UInt_t ii;
458   
459   /********************************/
460   /*      Filtering out           */
461   /********************************/
462   if ( ( (partEvent2==0x0) || (trackEvent2==0x0)) )//in case fBufferSize == 0 and pointers are created do not eneter
463    {
464      partEvent2  = new AliAOD();
465      trackEvent2 = new AliAOD();
466    }
467
468   FilterOut(partEvent1, partEvent2, rawpartEvent, trackEvent1, trackEvent2, rawtrackEvent);
469
470   for (Int_t j = 0; j<partEvent1->GetNumberOfParticles() ; j++)
471    {
472      if ( (j%fDisplayMixingInfo) == 0) 
473         Info("ProcessTracksAndParticlesNonIdentAnal",
474              "Mixing particle %d from current event with particles from current event",j);
475
476      part1= partEvent1->GetParticle(j);
477      track1= trackEvent1->GetParticle(j);
478
479
480      for(ii = 0; ii<fNParticleMonitorFunctions; ii++)
481        fParticleMonitorFunctions[ii]->Process(part1);
482      for(ii = 0; ii<fNTrackMonitorFunctions; ii++)
483        fTrackMonitorFunctions[ii]->Process(track1);
484      for(ii = 0; ii<fNParticleAndTrackMonitorFunctions; ii++)
485        fParticleAndTrackMonitorFunctions[ii]->Process(track1,part1);
486
487      if (fNoCorrfctns) continue;
488
489      /***************************************/
490      /******   filling numerators    ********/
491      /****** (particles from event2) ********/
492      /***************************************/
493
494      for (Int_t k = 0; k < partEvent2->GetNumberOfParticles() ; k++) //partEvent1 and partEvent2 are particles from the same event but separated to two groups 
495       {
496         part2= partEvent2->GetParticle(k);
497         if (part1->GetUID() == part2->GetUID()) continue;//this is the same particle but with different PID
498         partpair->SetParticles(part1,part2);
499
500         track2= trackEvent2->GetParticle(k);
501         trackpair->SetParticles(track1,track2);
502
503         if( (this->*fkPassPairProp)(partpair,trackpair) ) //check pair cut
504          { //do not meets crietria of the pair cut
505           continue; 
506          }
507         else
508          {//meets criteria of the pair cut
509           for(ii = 0;ii<fNParticleFunctions;ii++)
510                  fParticleFunctions[ii]->ProcessSameEventParticles(partpair);
511
512           for(ii = 0;ii<fNTrackFunctions;ii++)
513                  fTrackFunctions[ii]->ProcessSameEventParticles(trackpair);
514
515           for(ii = 0;ii<fNParticleAndTrackFunctions;ii++)
516                  fParticleAndTrackFunctions[ii]->ProcessSameEventParticles(trackpair,partpair);
517          }
518        }
519
520    if ( fBufferSize == 0) continue;//do not mix diff histograms
521    /***************************************/
522    /***** Filling denominators    *********/
523    /***************************************/
524    fPartBuffer->ResetIter();
525    fTrackBuffer->ResetIter();
526
527    Int_t nmonitor = 0;
528
529    while ( (partEvent3 = fPartBuffer->Next() ) != 0x0)
530     {
531       trackEvent3 = fTrackBuffer->Next();
532
533       if ( (j%fDisplayMixingInfo) == 0) 
534         Info("ProcessTracksAndParticlesNonIdentAnal",
535              "Mixing particle %d from current event with particles from event%d",j,-(++nmonitor));
536
537       for (Int_t k = 0; k < partEvent3->GetNumberOfParticles() ; k++)
538         {
539           part2= partEvent3->GetParticle(k);
540           partpair->SetParticles(part1,part2);
541
542           track2= trackEvent3->GetParticle(k);
543           trackpair->SetParticles(track1,track2);
544
545           if( (this->*fkPassPairProp)(partpair,trackpair) ) //check pair cut
546            { //do not meets crietria of the pair cut
547             continue; 
548            }
549           else
550            {//meets criteria of the pair cut
551             UInt_t ii;
552             for(ii = 0;ii<fNParticleFunctions;ii++)
553                    fParticleFunctions[ii]->ProcessDiffEventParticles(partpair);
554
555             for(ii = 0;ii<fNTrackFunctions;ii++)
556                    fTrackFunctions[ii]->ProcessDiffEventParticles(trackpair);
557
558             for(ii = 0;ii<fNParticleAndTrackFunctions;ii++)
559                    fParticleAndTrackFunctions[ii]->ProcessDiffEventParticles(trackpair,partpair);
560            }
561          }// for particles event2
562        }//while event2
563    }//for over particles in event1
564
565  delete fPartBuffer->Push(partEvent2);
566  delete fTrackBuffer->Push(trackEvent2);
567  
568  return 0;
569 }
570 /*************************************************************************************/ 
571 Int_t AliHBTAnalysisStavinskyMixing::ProcessSimNonId(AliAOD* /*aodrec*/, AliAOD* aodsim)
572 {
573 //does analysis of simulated (MC) data in non-identical mode
574 //i.e. when particles selected by first part. cut are a disjunctive set than particles
575 //passed by the second part. cut
576  if (aodsim == 0x0) 
577   {
578     return 1;
579   }
580  
581  
582   AliVAODParticle * part1, * part2;
583
584   static AliAOD aodsim1;
585
586   AliAOD* partEvent1=&aodsim1;//Particle that passes first particle cut, this event
587   partEvent1->Reset();
588   AliAOD* partEvent2=0x0;//Particle that passes second particle cut, this event
589   AliAOD* partEvent3=0x0;//Particle that passes second particle cut, events from buffer
590
591   AliAOD* rawpartEvent = aodsim;//this we get from Reader
592
593   static AliHBTPair ppair;
594   
595   AliHBTPair* partpair = &ppair;
596
597   register UInt_t ii;
598   
599   /********************************/
600   /*      Filtering out           */
601   /********************************/
602   if (partEvent2==0x0)//in case fBufferSize == 0 and pointers are created do not eneter
603    {
604      partEvent2  = new AliAOD();
605    }
606
607   FilterOut(partEvent1, partEvent2, rawpartEvent);
608
609   for (Int_t j = 0; j<partEvent1->GetNumberOfParticles() ; j++)
610    {
611      if ( (j%fDisplayMixingInfo) == 0) 
612         Info("ProcessParticlesNonIdentAnal",
613              "Mixing particle %d from current event with particles from current event",j);
614
615      part1= partEvent1->GetParticle(j);
616
617
618      for(ii = 0; ii<fNParticleMonitorFunctions; ii++)
619        fParticleMonitorFunctions[ii]->Process(part1);
620
621      if (fNParticleFunctions == 0) continue;
622
623      /***************************************/
624      /******   filling numerators    ********/
625      /****** (particles from event2) ********/
626      /***************************************/
627
628      for (Int_t k = 0; k < partEvent2->GetNumberOfParticles() ; k++) //partEvent1 and partEvent2 are particles from the same event but separated to two groups 
629       {
630         part2= partEvent2->GetParticle(k);
631         if (part1->GetUID() == part2->GetUID()) continue;//this is the same particle but with different PID
632         partpair->SetParticles(part1,part2);
633
634
635         if(fPairCut->PassPairProp(partpair) ) //check pair cut
636           { //do not meets crietria of the pair cut
637               continue; 
638           }
639         else
640          {//meets criteria of the pair cut
641           for(ii = 0;ii<fNParticleFunctions;ii++)
642               fParticleFunctions[ii]->ProcessSameEventParticles(partpair);
643          }
644        }
645
646  if ( fBufferSize == 0) continue;//do not mix diff histograms
647  /***************************************/
648  /***** Filling denominators    *********/
649  /***************************************/
650  fPartBuffer->ResetIter();
651
652  Int_t nmonitor = 0;
653
654  while ( (partEvent3 = fPartBuffer->Next() ) != 0x0)
655   {
656
657     if ( (j%fDisplayMixingInfo) == 0) 
658       Info("ProcessParticlesNonIdentAnal",
659            "Mixing particle %d from current event with particles from event%d",j,-(++nmonitor));
660
661     for (Int_t k = 0; k < partEvent3->GetNumberOfParticles() ; k++)
662       {
663         part2= partEvent3->GetParticle(k);
664         partpair->SetParticles(part1,part2);
665
666
667         if(fPairCut->PassPairProp(partpair) ) //check pair cut
668           { //do not meets crietria of the pair cut
669               continue; 
670           }
671         else
672          {//meets criteria of the pair cut
673           for(ii = 0;ii<fNParticleFunctions;ii++)
674            {
675              fParticleFunctions[ii]->ProcessDiffEventParticles(partpair);
676            }
677          }
678        }// for particles event2
679      }//while event2
680    }//for over particles in event1
681
682  delete fPartBuffer->Push(partEvent2);
683  
684  return 0;
685 }
686 /*************************************************************************************/ 
687 Int_t AliHBTAnalysisStavinskyMixing::ProcessRecNonId(AliAOD* aodrec, AliAOD* /*aodsim*/)
688 {
689 //Analyzes both reconstructed and simulated data
690  if (aodrec == 0x0) 
691   {
692     return 1;
693   }
694  
695   AliVAODParticle * track1, * track2;
696
697   static AliAOD aodrec1;
698   AliAOD * trackEvent1=&aodrec1;//Particle that passes first particle cut, this event
699   trackEvent1->Reset();
700   AliAOD * trackEvent2=0x0;//Particle that passes second particle cut, this event
701   AliAOD * trackEvent3=0x0;//Particle that passes second particle cut, events from buffer
702   AliAOD* rawtrackEvent = aodrec;//this we get from Reader
703
704   static AliHBTPair tpair;
705   
706   AliHBTPair* trackpair = &tpair;
707
708   register UInt_t ii;
709   
710   
711   /********************************/
712   /*      Filtering out           */
713   /********************************/
714   if ( trackEvent2==0x0 )//in case fBufferSize == 0 and pointers are created do not eneter
715    {
716      trackEvent2 = new AliAOD();
717    }
718
719   FilterOut(trackEvent1, trackEvent2, rawtrackEvent);
720
721   for (Int_t j = 0; j<trackEvent1->GetNumberOfParticles() ; j++)
722    {
723      if ( (j%fDisplayMixingInfo) == 0) 
724         Info("ProcessTracksNonIdentAnal",
725              "Mixing particle %d from current event with particles from current event",j);
726
727      track1= trackEvent1->GetParticle(j);
728
729
730      for(ii = 0; ii<fNTrackMonitorFunctions; ii++)
731        fTrackMonitorFunctions[ii]->Process(track1);
732
733      if (fNTrackFunctions == 0x0) continue;
734
735      /***************************************/
736      /******   filling numerators    ********/
737      /****** (particles from event2) ********/
738      /***************************************/
739
740      for (Int_t k = 0; k < trackEvent2->GetNumberOfParticles() ; k++) //partEvent1 and partEvent2 are particles from the same event but separated to two groups 
741       {
742         track2= trackEvent2->GetParticle(k);
743         if (track1->GetUID() == track2->GetUID()) continue;//this is the same particle but with different PID
744         trackpair->SetParticles(track1,track2);
745
746
747         if( fPairCut->PassPairProp(trackpair)) //check pair cut
748          { //do not meets crietria of the pair cut
749            continue; 
750          }
751         else
752          {//meets criteria of the pair cut
753            UInt_t ii;
754            for(ii = 0;ii<fNTrackFunctions;ii++)
755                   fTrackFunctions[ii]->ProcessSameEventParticles(trackpair);
756          }
757        }
758
759  if ( fBufferSize == 0) continue;//do not mix diff histograms
760  /***************************************/
761  /***** Filling denominators    *********/
762  /***************************************/
763  fTrackBuffer->ResetIter();
764
765  Int_t nmonitor = 0;
766
767  while ( (trackEvent3 = fTrackBuffer->Next() ) != 0x0)
768   {
769     if ( (j%fDisplayMixingInfo) == 0) 
770       Info("ProcessTracksNonIdentAnal",
771            "Mixing particle %d from current event with particles from event%d",j,-(++nmonitor));
772
773     for (Int_t k = 0; k < trackEvent3->GetNumberOfParticles() ; k++)
774       {
775         track2= trackEvent3->GetParticle(k);
776         trackpair->SetParticles(track1,track2);
777
778         if( fPairCut->PassPairProp(trackpair)) //check pair cut
779          { //do not meets crietria of the pair cut
780            continue; 
781          }
782         else
783          {//meets criteria of the pair cut
784            for(ii = 0;ii<fNTrackFunctions;ii++)
785                fTrackFunctions[ii]->ProcessDiffEventParticles(trackpair);
786          }
787        }// for particles event2
788      }//while event2
789    }//for over particles in event1
790
791  delete fTrackBuffer->Push(trackEvent2);
792  
793  return 0;
794 }
795 /*************************************************************************************/