]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HBTAN/AliHBTAnalysisStavinskyMixing.cxx
Merging THbtp and HBTP in one library. Comiplation on Windows/Cygwin
[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://aliweb.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 ppair;
205
206   AliHBTPair* partpair = &ppair;
207  
208   AliHBTPair * tmppartpair;
209   
210   register UInt_t ii;
211   
212
213   if ( !partEvent )
214    {
215      Error("ProcessRecAndSim","Can not get event");
216      return 1;
217    }
218
219
220   for (Int_t j = 0; j<partEvent->GetNumberOfParticles() ; j++)
221    {
222      /***************************************/
223      /******   Looping same events   ********/
224      /******   filling numerators    ********/
225      /***************************************/
226      Warning("ProcessTracksAndParticles","Non-std MIXING");
227      if ( (j%fDisplayMixingInfo) == 0)
228         Info("ProcessTracksAndParticles",
229              "Mixing particle %d with particles from the same event",j);
230
231      part1= partEvent->GetParticle(j);
232
233      Bool_t firstcut = fPairCut->GetFirstPartCut()->Rejected(part1);
234
235      if (fBufferSize != 0) 
236        if ( (firstcut == kFALSE) || ( fPairCut->GetSecondPartCut()->Rejected(part1) == kFALSE ) )
237         {
238           //accepted by any cut
239           // we have to copy because reader keeps only one event
240
241           partEvent1->AddParticle(part1);
242         }
243
244      if (firstcut) continue;
245
246      for(ii = 0; ii<fNParticleMonitorFunctions; ii++)
247        fParticleMonitorFunctions[ii]->Process(part1);
248
249      if ( fNParticleFunctions == 0 ) continue;
250
251      for (Int_t k =j+1; k < partEvent->GetNumberOfParticles() ; k++)
252       {
253         part2= partEvent->GetParticle(k);
254         if (part1->GetUID() == part2->GetUID()) continue;
255         partpair->SetParticles(part1,part2);
256
257            if(fPairCut->Rejected(partpair)) //check pair cut
258             { //do not meets crietria of the 
259               if( fPairCut->Rejected((AliHBTPair*)partpair->GetSwappedPair()) ) continue;
260               else tmppartpair = (AliHBTPair*)partpair->GetSwappedPair();
261             }
262            else
263             {
264               tmppartpair = partpair;
265             }
266
267         for(ii = 0;ii<fNParticleFunctions;ii++)
268                fParticleFunctions[ii]->ProcessSameEventParticles(tmppartpair);
269
270
271         /***************************************/
272         /***** Filling denominators    *********/
273         /***************************************/
274         
275         tmppartpair->MirrorSecond();
276         
277         if(fPairCut->Rejected(partpair) == kFALSE)
278          {
279            for(ii = 0;ii<fNParticleFunctions;ii++)
280              fParticleFunctions[ii]->ProcessDiffEventParticles(tmppartpair);
281          }  
282         tmppartpair->DeleteSecond();
283         
284        //end of 2nd loop over particles from the same event  
285       }//for (Int_t k =j+1; k < partEvent->GetNumberOfParticles() ; k++)
286
287        }
288   delete fPartBuffer->Push(partEvent1);
289  //end of loop over events  
290   return 0;
291 }
292 /*************************************************************************************/ 
293 Int_t AliHBTAnalysisStavinskyMixing::ProcessRec(AliAOD* aodrec, AliAOD* /*aodsim*/)
294 {
295   //Does analysis of reconstructed data
296   AliVAODParticle * track1, * track2;
297   
298   AliAOD* trackEvent = aodrec;
299   AliAOD* trackEvent1 = new AliAOD();
300
301   AliAOD* trackEvent2;
302   
303   AliHBTPair tpair;
304
305   AliHBTPair* trackpair = &tpair;
306  
307   AliHBTPair * tmptrackpair;
308   
309   register UInt_t ii;
310   
311
312   if ( !trackEvent )
313    {
314      Error("ProcessRecAndSim","Can not get event");
315      return 1;
316    }
317
318
319   for (Int_t j = 0; j<trackEvent->GetNumberOfParticles() ; j++)
320    {
321      /***************************************/
322      /******   Looping same events   ********/
323      /******   filling numerators    ********/
324      /***************************************/
325      if ( (j%fDisplayMixingInfo) == 0)
326         Info("ProcessTracksAndParticles",
327              "Mixing Particle %d with Particles from the same event",j);
328
329      track1= trackEvent->GetParticle(j);
330
331      Bool_t firstcut = fPairCut->GetFirstPartCut()->Rejected(track1);
332
333      if (fBufferSize != 0) 
334        if ( (firstcut == kFALSE) || ( fPairCut->GetSecondPartCut()->Rejected(track1) == kFALSE ) )
335         {
336           //accepted by any cut
337           // we have to copy because reader keeps only one event
338
339           trackEvent1->AddParticle(track1);
340         }
341
342      if (firstcut) continue;
343
344      for(ii = 0; ii<fNParticleMonitorFunctions; ii++)
345        fParticleMonitorFunctions[ii]->Process(track1);
346
347      if ( fNParticleFunctions == 0 ) continue;
348
349      for (Int_t k =j+1; k < trackEvent->GetNumberOfParticles() ; k++)
350       {
351         track2= trackEvent->GetParticle(k);
352         if (track1->GetUID() == track2->GetUID()) continue;
353         trackpair->SetParticles(track1,track2);
354
355            if(fPairCut->Rejected(trackpair)) //check pair cut
356             { //do not meets crietria of the 
357               if( fPairCut->Rejected((AliHBTPair*)trackpair->GetSwappedPair()) ) continue;
358               else tmptrackpair = (AliHBTPair*)trackpair->GetSwappedPair();
359             }
360            else
361             {
362               tmptrackpair = trackpair;
363             }
364
365         for(ii = 0;ii<fNTrackFunctions;ii++)
366                fParticleFunctions[ii]->ProcessSameEventParticles(tmptrackpair);
367
368        //end of 2nd loop over Particles from the same event  
369       }//for (Int_t k =j+1; k < trackEvent->GetNumberOfParticles() ; k++)
370
371      /***************************************/
372      /***** Filling denominators    *********/
373      /***************************************/
374      if (fBufferSize == 0) continue;
375
376      fTrackBuffer->ResetIter();
377          Int_t m = 0;
378          while (( trackEvent2 = fTrackBuffer->Next() ))
379           {
380             m++;
381             if ( (j%fDisplayMixingInfo) == 0)
382                Info("ProcessParticles",
383                     "Mixing Particle %d from current event with Particles from event %d",j,-m);
384             for(Int_t l = 0; l<trackEvent2->GetNumberOfParticles();l++)   //  ... on all Particles
385               {
386
387                 track2= trackEvent2->GetParticle(l);
388                 trackpair->SetParticles(track1,track2);
389
390                 if( fPairCut->Rejected(trackpair) ) //check pair cut
391                   { //do not meets crietria of the 
392                     if( fPairCut->Rejected((AliHBTPair*)trackpair->GetSwappedPair()) )
393                       continue;
394                     else 
395                      {
396                        tmptrackpair = (AliHBTPair*)trackpair->GetSwappedPair();
397                      }
398                   }
399                 else
400                  {//meets criteria of the pair cut
401                   tmptrackpair = trackpair;
402                  }
403                  
404                 for(ii = 0;ii<fNTrackFunctions;ii++)
405                   fTrackFunctions[ii]->ProcessDiffEventParticles(tmptrackpair);
406                  
407              }//for(Int_t l = 0; l<N2;l++)   //  ... on all Particles
408           }
409        }
410   delete fTrackBuffer->Push(trackEvent1);
411  //end of loop over events  
412   return 0;
413 }
414 /*************************************************************************************/ 
415      
416 Int_t AliHBTAnalysisStavinskyMixing::ProcessRecAndSimNonId(AliAOD* aodrec, AliAOD* aodsim)
417 {
418 //Analyzes both reconstructed and simulated data
419   if (aodrec == 0x0) 
420    {
421      Error("ProcessTracksAndParticlesNonIdentAnal","Reconstructed event is NULL");
422      return 1;
423    }
424
425   if (aodsim == 0x0) 
426    {
427      Error("ProcessTracksAndParticlesNonIdentAnal","Simulated event is NULL");
428      return 1;
429    }
430
431   if ( aodrec->GetNumberOfParticles() != aodsim->GetNumberOfParticles() )
432    {
433      Error("ProcessTracksAndParticlesNonIdentAnal",
434            "Number of simulated particles (%d) not equal to number of reconstructed tracks (%d)",
435            aodsim->GetNumberOfParticles() , aodrec->GetNumberOfParticles());
436      return 2;
437    }
438
439  
440   AliVAODParticle * part1, * part2;
441   AliVAODParticle * track1, * track2;
442
443   static AliAOD aodrec1;
444   static AliAOD aodsim1;
445
446   AliAOD * trackEvent1=&aodrec1,*partEvent1=&aodsim1;//Particle that passes first particle cut, this event
447   trackEvent1->Reset();
448   partEvent1->Reset();
449   AliAOD * trackEvent2=0x0,*partEvent2=0x0;//Particle that passes second particle cut, this event
450   AliAOD * trackEvent3=0x0,*partEvent3=0x0;//Particle that passes second particle cut, events from buffer
451
452   AliAOD* rawtrackEvent = aodrec;//this we get from Reader
453   AliAOD* rawpartEvent = aodsim;//this we get from Reader
454
455   static AliHBTPair tpair;
456   static AliHBTPair ppair;
457   
458   AliHBTPair* trackpair = &tpair;
459   AliHBTPair* partpair = &ppair;
460
461   register UInt_t ii;
462   
463   /********************************/
464   /*      Filtering out           */
465   /********************************/
466   if ( ( (partEvent2==0x0) || (trackEvent2==0x0)) )//in case fBufferSize == 0 and pointers are created do not eneter
467    {
468      partEvent2  = new AliAOD();
469      trackEvent2 = new AliAOD();
470    }
471
472   FilterOut(partEvent1, partEvent2, rawpartEvent, trackEvent1, trackEvent2, rawtrackEvent);
473
474   for (Int_t j = 0; j<partEvent1->GetNumberOfParticles() ; j++)
475    {
476      if ( (j%fDisplayMixingInfo) == 0) 
477         Info("ProcessTracksAndParticlesNonIdentAnal",
478              "Mixing particle %d from current event with particles from current event",j);
479
480      part1= partEvent1->GetParticle(j);
481      track1= trackEvent1->GetParticle(j);
482
483
484      for(ii = 0; ii<fNParticleMonitorFunctions; ii++)
485        fParticleMonitorFunctions[ii]->Process(part1);
486      for(ii = 0; ii<fNTrackMonitorFunctions; ii++)
487        fTrackMonitorFunctions[ii]->Process(track1);
488      for(ii = 0; ii<fNParticleAndTrackMonitorFunctions; ii++)
489        fParticleAndTrackMonitorFunctions[ii]->Process(track1,part1);
490
491      if (fNoCorrfctns) continue;
492
493      /***************************************/
494      /******   filling numerators    ********/
495      /****** (particles from event2) ********/
496      /***************************************/
497
498      for (Int_t k = 0; k < partEvent2->GetNumberOfParticles() ; k++) //partEvent1 and partEvent2 are particles from the same event but separated to two groups 
499       {
500         part2= partEvent2->GetParticle(k);
501         if (part1->GetUID() == part2->GetUID()) continue;//this is the same particle but with different PID
502         partpair->SetParticles(part1,part2);
503
504         track2= trackEvent2->GetParticle(k);
505         trackpair->SetParticles(track1,track2);
506
507         if( (this->*fkPassPairProp)(partpair,trackpair) ) //check pair cut
508          { //do not meets crietria of the pair cut
509           continue; 
510          }
511         else
512          {//meets criteria of the pair cut
513           for(ii = 0;ii<fNParticleFunctions;ii++)
514                  fParticleFunctions[ii]->ProcessSameEventParticles(partpair);
515
516           for(ii = 0;ii<fNTrackFunctions;ii++)
517                  fTrackFunctions[ii]->ProcessSameEventParticles(trackpair);
518
519           for(ii = 0;ii<fNParticleAndTrackFunctions;ii++)
520                  fParticleAndTrackFunctions[ii]->ProcessSameEventParticles(trackpair,partpair);
521          }
522        }
523
524    if ( fBufferSize == 0) continue;//do not mix diff histograms
525    /***************************************/
526    /***** Filling denominators    *********/
527    /***************************************/
528    fPartBuffer->ResetIter();
529    fTrackBuffer->ResetIter();
530
531    Int_t nmonitor = 0;
532
533    while ( (partEvent3 = fPartBuffer->Next() ) != 0x0)
534     {
535       trackEvent3 = fTrackBuffer->Next();
536
537       if ( (j%fDisplayMixingInfo) == 0) 
538         Info("ProcessTracksAndParticlesNonIdentAnal",
539              "Mixing particle %d from current event with particles from event%d",j,-(++nmonitor));
540
541       for (Int_t k = 0; k < partEvent3->GetNumberOfParticles() ; k++)
542         {
543           part2= partEvent3->GetParticle(k);
544           partpair->SetParticles(part1,part2);
545
546           track2= trackEvent3->GetParticle(k);
547           trackpair->SetParticles(track1,track2);
548
549           if( (this->*fkPassPairProp)(partpair,trackpair) ) //check pair cut
550            { //do not meets crietria of the pair cut
551             continue; 
552            }
553           else
554            {//meets criteria of the pair cut
555             UInt_t ii;
556             for(ii = 0;ii<fNParticleFunctions;ii++)
557                    fParticleFunctions[ii]->ProcessDiffEventParticles(partpair);
558
559             for(ii = 0;ii<fNTrackFunctions;ii++)
560                    fTrackFunctions[ii]->ProcessDiffEventParticles(trackpair);
561
562             for(ii = 0;ii<fNParticleAndTrackFunctions;ii++)
563                    fParticleAndTrackFunctions[ii]->ProcessDiffEventParticles(trackpair,partpair);
564            }
565          }// for particles event2
566        }//while event2
567    }//for over particles in event1
568
569  delete fPartBuffer->Push(partEvent2);
570  delete fTrackBuffer->Push(trackEvent2);
571  
572  return 0;
573 }
574 /*************************************************************************************/ 
575 Int_t AliHBTAnalysisStavinskyMixing::ProcessSimNonId(AliAOD* /*aodrec*/, AliAOD* aodsim)
576 {
577 //does analysis of simulated (MC) data in non-identical mode
578 //i.e. when particles selected by first part. cut are a disjunctive set than particles
579 //passed by the second part. cut
580  if (aodsim == 0x0) 
581   {
582     return 1;
583   }
584  
585  
586   AliVAODParticle * part1, * part2;
587
588   static AliAOD aodsim1;
589
590   AliAOD* partEvent1=&aodsim1;//Particle that passes first particle cut, this event
591   partEvent1->Reset();
592   AliAOD* partEvent2=0x0;//Particle that passes second particle cut, this event
593   AliAOD* partEvent3=0x0;//Particle that passes second particle cut, events from buffer
594
595   AliAOD* rawpartEvent = aodsim;//this we get from Reader
596
597   static AliHBTPair ppair;
598   
599   AliHBTPair* partpair = &ppair;
600
601   register UInt_t ii;
602   
603   /********************************/
604   /*      Filtering out           */
605   /********************************/
606   if (partEvent2==0x0)//in case fBufferSize == 0 and pointers are created do not eneter
607    {
608      partEvent2  = new AliAOD();
609    }
610
611   FilterOut(partEvent1, partEvent2, rawpartEvent);
612
613   for (Int_t j = 0; j<partEvent1->GetNumberOfParticles() ; j++)
614    {
615      if ( (j%fDisplayMixingInfo) == 0) 
616         Info("ProcessParticlesNonIdentAnal",
617              "Mixing particle %d from current event with particles from current event",j);
618
619      part1= partEvent1->GetParticle(j);
620
621
622      for(ii = 0; ii<fNParticleMonitorFunctions; ii++)
623        fParticleMonitorFunctions[ii]->Process(part1);
624
625      if (fNParticleFunctions == 0) continue;
626
627      /***************************************/
628      /******   filling numerators    ********/
629      /****** (particles from event2) ********/
630      /***************************************/
631
632      for (Int_t k = 0; k < partEvent2->GetNumberOfParticles() ; k++) //partEvent1 and partEvent2 are particles from the same event but separated to two groups 
633       {
634         part2= partEvent2->GetParticle(k);
635         if (part1->GetUID() == part2->GetUID()) continue;//this is the same particle but with different PID
636         partpair->SetParticles(part1,part2);
637
638
639         if(fPairCut->PassPairProp(partpair) ) //check pair cut
640           { //do not meets crietria of the pair cut
641               continue; 
642           }
643         else
644          {//meets criteria of the pair cut
645           for(ii = 0;ii<fNParticleFunctions;ii++)
646               fParticleFunctions[ii]->ProcessSameEventParticles(partpair);
647          }
648        }
649
650  if ( fBufferSize == 0) continue;//do not mix diff histograms
651  /***************************************/
652  /***** Filling denominators    *********/
653  /***************************************/
654  fPartBuffer->ResetIter();
655
656  Int_t nmonitor = 0;
657
658  while ( (partEvent3 = fPartBuffer->Next() ) != 0x0)
659   {
660
661     if ( (j%fDisplayMixingInfo) == 0) 
662       Info("ProcessParticlesNonIdentAnal",
663            "Mixing particle %d from current event with particles from event%d",j,-(++nmonitor));
664
665     for (Int_t k = 0; k < partEvent3->GetNumberOfParticles() ; k++)
666       {
667         part2= partEvent3->GetParticle(k);
668         partpair->SetParticles(part1,part2);
669
670
671         if(fPairCut->PassPairProp(partpair) ) //check pair cut
672           { //do not meets crietria of the pair cut
673               continue; 
674           }
675         else
676          {//meets criteria of the pair cut
677           for(ii = 0;ii<fNParticleFunctions;ii++)
678            {
679              fParticleFunctions[ii]->ProcessDiffEventParticles(partpair);
680            }
681          }
682        }// for particles event2
683      }//while event2
684    }//for over particles in event1
685
686  delete fPartBuffer->Push(partEvent2);
687  
688  return 0;
689 }
690 /*************************************************************************************/ 
691 Int_t AliHBTAnalysisStavinskyMixing::ProcessRecNonId(AliAOD* aodrec, AliAOD* /*aodsim*/)
692 {
693 //Analyzes both reconstructed and simulated data
694  if (aodrec == 0x0) 
695   {
696     return 1;
697   }
698  
699   AliVAODParticle * track1, * track2;
700
701   static AliAOD aodrec1;
702   AliAOD * trackEvent1=&aodrec1;//Particle that passes first particle cut, this event
703   trackEvent1->Reset();
704   AliAOD * trackEvent2=0x0;//Particle that passes second particle cut, this event
705   AliAOD * trackEvent3=0x0;//Particle that passes second particle cut, events from buffer
706   AliAOD* rawtrackEvent = aodrec;//this we get from Reader
707
708   static AliHBTPair tpair;
709   
710   AliHBTPair* trackpair = &tpair;
711
712   register UInt_t ii;
713   
714   
715   /********************************/
716   /*      Filtering out           */
717   /********************************/
718   if ( trackEvent2==0x0 )//in case fBufferSize == 0 and pointers are created do not eneter
719    {
720      trackEvent2 = new AliAOD();
721    }
722
723   FilterOut(trackEvent1, trackEvent2, rawtrackEvent);
724
725   for (Int_t j = 0; j<trackEvent1->GetNumberOfParticles() ; j++)
726    {
727      if ( (j%fDisplayMixingInfo) == 0) 
728         Info("ProcessTracksNonIdentAnal",
729              "Mixing particle %d from current event with particles from current event",j);
730
731      track1= trackEvent1->GetParticle(j);
732
733
734      for(ii = 0; ii<fNTrackMonitorFunctions; ii++)
735        fTrackMonitorFunctions[ii]->Process(track1);
736
737      if (fNTrackFunctions == 0x0) continue;
738
739      /***************************************/
740      /******   filling numerators    ********/
741      /****** (particles from event2) ********/
742      /***************************************/
743
744      for (Int_t k = 0; k < trackEvent2->GetNumberOfParticles() ; k++) //partEvent1 and partEvent2 are particles from the same event but separated to two groups 
745       {
746         track2= trackEvent2->GetParticle(k);
747         if (track1->GetUID() == track2->GetUID()) continue;//this is the same particle but with different PID
748         trackpair->SetParticles(track1,track2);
749
750
751         if( fPairCut->PassPairProp(trackpair)) //check pair cut
752          { //do not meets crietria of the pair cut
753            continue; 
754          }
755         else
756          {//meets criteria of the pair cut
757            UInt_t ii;
758            for(ii = 0;ii<fNTrackFunctions;ii++)
759                   fTrackFunctions[ii]->ProcessSameEventParticles(trackpair);
760          }
761        }
762
763  if ( fBufferSize == 0) continue;//do not mix diff histograms
764  /***************************************/
765  /***** Filling denominators    *********/
766  /***************************************/
767  fTrackBuffer->ResetIter();
768
769  Int_t nmonitor = 0;
770
771  while ( (trackEvent3 = fTrackBuffer->Next() ) != 0x0)
772   {
773     if ( (j%fDisplayMixingInfo) == 0) 
774       Info("ProcessTracksNonIdentAnal",
775            "Mixing particle %d from current event with particles from event%d",j,-(++nmonitor));
776
777     for (Int_t k = 0; k < trackEvent3->GetNumberOfParticles() ; k++)
778       {
779         track2= trackEvent3->GetParticle(k);
780         trackpair->SetParticles(track1,track2);
781
782         if( fPairCut->PassPairProp(trackpair)) //check pair cut
783          { //do not meets crietria of the pair cut
784            continue; 
785          }
786         else
787          {//meets criteria of the pair cut
788            for(ii = 0;ii<fNTrackFunctions;ii++)
789                fTrackFunctions[ii]->ProcessDiffEventParticles(trackpair);
790          }
791        }// for particles event2
792      }//while event2
793    }//for over particles in event1
794
795  delete fTrackBuffer->Push(trackEvent2);
796  
797  return 0;
798 }
799 /*************************************************************************************/