1 #include "AliHBTAnalysis.h"
2 //_________________________________________________________
3 ////////////////////////////////////////////////////////////////////////////
5 // class AliHBTAnalysis
7 // Central Object Of HBTAnalyser:
8 // This class performs main looping within HBT Analysis
9 // User must plug a reader of Type AliHBTReader
10 // User plugs in coorelation and monitor functions
11 // as well as monitor functions
13 // HBT Analysis Tool, which is integral part of AliRoot,
14 // ALICE Off-Line framework:
16 // Piotr.Skowronski@cern.ch
17 // more info: http://alisoft.cern.ch/people/skowron/analyzer/index.html
19 ////////////////////////////////////////////////////////////////////////////
20 //_________________________________________________________
22 #include "AliHBTEvent.h"
23 #include "AliHBTReader.h"
24 #include "AliHBTPair.h"
25 #include "AliHBTFunction.h"
26 #include "AliHBTMonitorFunction.h"
27 #include "AliHBTEventBuffer.h"
28 #include "AliHBTPairCut.h"
32 ClassImp(AliHBTAnalysis)
34 const UInt_t AliHBTAnalysis::fgkFctnArraySize = 100;
35 const UInt_t AliHBTAnalysis::fgkDefaultMixingInfo = 1000;
36 const Int_t AliHBTAnalysis::fgkDefaultBufferSize = 5;
38 AliHBTAnalysis::AliHBTAnalysis():
41 fNParticleFunctions(0),
42 fNParticleAndTrackFunctions(0),
43 fNTrackMonitorFunctions(0),
44 fNParticleMonitorFunctions(0),
45 fNParticleAndTrackMonitorFunctions(0),
46 fTrackFunctions ( new AliHBTOnePairFctn* [fgkFctnArraySize]),
47 fParticleFunctions ( new AliHBTOnePairFctn* [fgkFctnArraySize]),
48 fParticleAndTrackFunctions ( new AliHBTTwoPairFctn* [fgkFctnArraySize]),
49 fParticleMonitorFunctions ( new AliHBTMonOneParticleFctn* [fgkFctnArraySize]),
50 fTrackMonitorFunctions ( new AliHBTMonOneParticleFctn* [fgkFctnArraySize]),
51 fParticleAndTrackMonitorFunctions ( new AliHBTMonTwoParticleFctn* [fgkFctnArraySize]),
52 fPairCut(new AliHBTEmptyPairCut()),//empty cut - accepts all particles
54 fDisplayMixingInfo(fgkDefaultMixingInfo),
56 fkPass(&AliHBTAnalysis::PassPartAndTrack), //by default perform cut on both track and particle pair
57 fkPass1(&AliHBTAnalysis::PassPartAndTrack1), //used onluy by ProcessTracksAndParticles
58 fkPass2(&AliHBTAnalysis::PassPartAndTrack2),
59 fkPassPairProp(&AliHBTAnalysis::PassPairPropPartAndTrack)
64 /*************************************************************************************/
66 AliHBTAnalysis::AliHBTAnalysis(const AliHBTAnalysis& in):
70 fNParticleFunctions(0),
71 fNParticleAndTrackFunctions(0),
72 fNTrackMonitorFunctions(0),
73 fNParticleMonitorFunctions(0),
74 fNParticleAndTrackMonitorFunctions(0),
76 fParticleFunctions(0x0),
77 fParticleAndTrackFunctions(0x0),
78 fParticleMonitorFunctions(0x0),
79 fTrackMonitorFunctions(0x0),
80 fParticleAndTrackMonitorFunctions(0x0),
82 fBufferSize(fgkDefaultBufferSize),
83 fDisplayMixingInfo(fgkDefaultMixingInfo),
85 fkPass(&AliHBTAnalysis::PassPartAndTrack), //by default perform cut on both track and particle pair
86 fkPass1(&AliHBTAnalysis::PassPartAndTrack1),
87 fkPass2(&AliHBTAnalysis::PassPartAndTrack2),
88 fkPassPairProp(&AliHBTAnalysis::PassPairPropPartAndTrack)
91 Fatal("AliHBTAnalysis(const AliHBTAnalysis&)","Sensless");
93 /*************************************************************************************/
94 AliHBTAnalysis& AliHBTAnalysis::operator=(const AliHBTAnalysis& /*right*/)
97 Fatal("AliHBTAnalysis(const AliHBTAnalysis&)","Sensless");
100 /*************************************************************************************/
101 AliHBTAnalysis::~AliHBTAnalysis()
104 //note that we do not delete functions itself
105 // they should be deleted by whom where created
106 //we only store pointers, and we use "new" only for pointers array
110 if (AliHBTParticle::GetDebug()>5)Info("~AliHBTAnalysis","Is Owner: Attempting to delete functions");
112 if (AliHBTParticle::GetDebug()>5)Info("~AliHBTAnalysis","Delete functions done");
114 delete [] fTrackFunctions;
115 delete [] fParticleFunctions;
116 delete [] fParticleAndTrackFunctions;
118 delete [] fParticleMonitorFunctions;
119 delete [] fTrackMonitorFunctions;
120 delete [] fParticleAndTrackMonitorFunctions;
122 delete fPairCut; // always have an copy of an object - we create we dstroy
125 /*************************************************************************************/
127 void AliHBTAnalysis::DeleteFunctions()
129 //Deletes all functions added to analysis
131 for(ii = 0;ii<fNParticleFunctions;ii++)
133 if (AliHBTParticle::GetDebug()>5)
135 Info("DeleteFunctions","Deleting ParticleFunction %#x",fParticleFunctions[ii]);
136 Info("DeleteFunctions","Deleting ParticleFunction %s",fParticleFunctions[ii]->Name());
138 delete fParticleFunctions[ii];
140 fNParticleFunctions = 0;
142 for(ii = 0;ii<fNTrackFunctions;ii++)
144 if (AliHBTParticle::GetDebug()>5)
146 Info("DeleteFunctions","Deleting TrackFunction %#x",fTrackFunctions[ii]);
147 Info("DeleteFunctions","Deleting TrackFunction %s",fTrackFunctions[ii]->Name());
149 delete fTrackFunctions[ii];
151 fNTrackFunctions = 0;
153 for(ii = 0;ii<fNParticleAndTrackFunctions;ii++)
155 if (AliHBTParticle::GetDebug()>5)
157 Info("DeleteFunctions","Deleting ParticleAndTrackFunction %#x",fParticleAndTrackFunctions[ii]);
158 Info("DeleteFunctions","Deleting ParticleAndTrackFunction %s",fParticleAndTrackFunctions[ii]->Name());
160 delete fParticleAndTrackFunctions[ii];
162 fNParticleAndTrackFunctions = 0;
164 for(ii = 0; ii<fNParticleMonitorFunctions; ii++)
166 if (AliHBTParticle::GetDebug()>5)
168 Info("DeleteFunctions","Deleting ParticleMonitorFunction %#x",fParticleMonitorFunctions[ii]);
169 Info("DeleteFunctions","Deleting ParticleMonitorFunction %s",fParticleMonitorFunctions[ii]->Name());
171 delete fParticleMonitorFunctions[ii];
173 fNParticleMonitorFunctions = 0;
175 for(ii = 0; ii<fNTrackMonitorFunctions; ii++)
177 if (AliHBTParticle::GetDebug()>5)
179 Info("DeleteFunctions","Deleting TrackMonitorFunction %#x",fTrackMonitorFunctions[ii]);
180 Info("DeleteFunctions","Deleting TrackMonitorFunction %s",fTrackMonitorFunctions[ii]->Name());
182 delete fTrackMonitorFunctions[ii];
184 fNTrackMonitorFunctions = 0;
186 for(ii = 0; ii<fNParticleAndTrackMonitorFunctions; ii++)
188 if (AliHBTParticle::GetDebug()>5)
190 Info("DeleteFunctions","Deleting ParticleAndTrackMonitorFunction %#x",fParticleAndTrackMonitorFunctions[ii]);
191 Info("DeleteFunctions","Deleting ParticleAndTrackMonitorFunction %s",fParticleAndTrackMonitorFunctions[ii]->Name());
193 delete fParticleAndTrackMonitorFunctions[ii];
195 fNParticleAndTrackMonitorFunctions = 0;
198 /*************************************************************************************/
200 void AliHBTAnalysis::Init()
202 //Initializeation method
203 //calls Init for all functions
205 for(ii = 0;ii<fNParticleFunctions;ii++)
206 fParticleFunctions[ii]->Init();
208 for(ii = 0;ii<fNTrackFunctions;ii++)
209 fTrackFunctions[ii]->Init();
211 for(ii = 0;ii<fNParticleAndTrackFunctions;ii++)
212 fParticleAndTrackFunctions[ii]->Init();
214 for(ii = 0; ii<fNParticleMonitorFunctions; ii++)
215 fParticleMonitorFunctions[ii]->Init();
217 for(ii = 0; ii<fNTrackMonitorFunctions; ii++)
218 fTrackMonitorFunctions[ii]->Init();
220 for(ii = 0; ii<fNParticleAndTrackMonitorFunctions; ii++)
221 fParticleAndTrackMonitorFunctions[ii]->Init();
225 /*************************************************************************************/
227 void AliHBTAnalysis::ResetFunctions()
229 //In case fOwner is true, deletes all functions
230 //in other case, just set number of analysis to 0
231 if (fIsOwner) DeleteFunctions();
234 fNParticleFunctions = 0;
235 fNTrackFunctions = 0;
236 fNParticleAndTrackFunctions = 0;
237 fNParticleMonitorFunctions = 0;
238 fNTrackMonitorFunctions = 0;
239 fNParticleAndTrackMonitorFunctions = 0;
242 /*************************************************************************************/
244 void AliHBTAnalysis::Process(Option_t* option)
246 //default option = "TracksAndParticles"
247 //Main method of the HBT Analysis Package
248 //It triggers reading with the global cut (default is an empty cut)
249 //Than it checks options and data which are read
250 //if everything is OK, then it calls one of the looping methods
251 //depending on tfReaderhe option
252 //These methods differs on what thay are looping on
255 //--------------------------------------------------------------------
256 //ProcessTracksAndParticles - "TracksAndParticles"
258 // it loops over both, tracks(reconstructed) and particles(simulated)
259 // all function gethered in all 3 lists are called for each (double)pair
261 //ProcessTracks - "Tracks"
262 // it loops only on tracks(reconstructed),
263 // functions ONLY from fTrackFunctions list are called
265 //ProcessParticles - "Particles"
266 // it loops only on particles(simulated),
267 // functions ONLY from fParticleAndTrackFunctions list are called
272 Error("Process","The reader is not set");
276 const char *oT = strstr(option,"Tracks");
277 const char *oP = strstr(option,"Particles");
279 Bool_t nonid = IsNonIdentAnalysis();
285 if (nonid) ProcessTracksAndParticlesNonIdentAnal();
286 else ProcessTracksAndParticles();
292 if (nonid) ProcessTracksNonIdentAnal();
293 else ProcessTracks();
299 if (nonid) ProcessParticlesNonIdentAnal();
300 else ProcessParticles();
305 /*************************************************************************************/
307 void AliHBTAnalysis::ProcessTracksAndParticles()
309 //Makes analysis for both tracks and particles
310 //mainly for resolution study and analysies with weighting algirithms
311 //In order to minimize calling AliRun::GetEvent (we need at one time particles from different events),
312 //the loops are splited
314 // cut on particles only -- why?
315 // - PID: when we make resolution analysis we want to take only tracks with correct PID
316 // We need cut on tracks because there are data characteristic to
318 AliHBTParticle * part1, * part2;
319 AliHBTParticle * track1, * track2;
321 AliHBTEvent * trackEvent, *partEvent;
322 AliHBTEvent * trackEvent1 = 0x0,*partEvent1 = 0x0;
323 AliHBTEvent * trackEvent2,*partEvent2;
325 // Int_t N1, N2, N=0; //number of particles in current event(we prcess two events in one time)
327 // Int_t nev = fReader->GetNumberOfTrackEvents();
328 AliHBTPair * trackpair = new AliHBTPair();
329 AliHBTPair * partpair = new AliHBTPair();
331 AliHBTPair * tmptrackpair;//temprary pointers to pairs
332 AliHBTPair * tmppartpair;
334 AliHBTEventBuffer partbuffer(fBufferSize);
335 AliHBTEventBuffer trackbuffer(fBufferSize);
339 Bool_t nocorrfctns = (fNParticleFunctions == 0) && (fNTrackFunctions == 0) && (fNParticleAndTrackFunctions == 0);
343 while (fReader->Next() == kFALSE)
346 partEvent= fReader->GetParticleEvent();
347 trackEvent = fReader->GetTrackEvent();
349 if ( !partEvent || !trackEvent )
351 Error("ProcessTracksAndParticles","Can not get event");
355 if ( partEvent->GetNumberOfParticles() != trackEvent->GetNumberOfParticles() )
357 Fatal("ProcessTracksAndParticles",
358 "Event %d: Number of simulated particles (%d) not equal to number of reconstructed tracks (%d)",
359 i,partEvent->GetNumberOfParticles() , trackEvent->GetNumberOfParticles());
363 if(partEvent1 == 0x0)
365 partEvent1 = new AliHBTEvent();
366 partEvent1->SetOwner(kTRUE);
368 trackEvent1 = new AliHBTEvent();
369 trackEvent1->SetOwner(kTRUE);
374 trackEvent1->Reset();
377 for (Int_t j = 0; j<partEvent->GetNumberOfParticles() ; j++)
379 /***************************************/
380 /****** Looping same events ********/
381 /****** filling numerators ********/
382 /***************************************/
383 if ( (j%fDisplayMixingInfo) == 0)
384 Info("ProcessTracksAndParticles",
385 "Mixing particle %d from event %d with particles from event %d",j,i,i);
387 part1= partEvent->GetParticle(j);
388 track1= trackEvent->GetParticle(j);
390 //PID imperfections ???
391 // if( part1->GetPdgCode() != track1->GetPdgCode() )
393 // Fatal("ProcessTracksAndParticles",
394 // "Event %d: Particle %d: PID of simulated particle (%d) not the same of reconstructed track (%d)",
395 // i,j, part1->GetPdgCode(),track1->GetPdgCode() );
399 Bool_t firstcut = (this->*fkPass1)(part1,track1);
400 if (fBufferSize != 0)
401 if ( (firstcut == kFALSE) || ( (this->*fkPass2)(part1,track1) == kFALSE ) )
403 //accepted by any cut
404 // we have to copy because reader keeps only one event
406 partEvent1->AddParticle(new AliHBTParticle(*part1));
407 trackEvent1->AddParticle(new AliHBTParticle(*track1));
410 if (firstcut) continue;
412 for(ii = 0; ii<fNParticleMonitorFunctions; ii++)
413 fParticleMonitorFunctions[ii]->Process(part1);
414 for(ii = 0; ii<fNTrackMonitorFunctions; ii++)
415 fTrackMonitorFunctions[ii]->Process(track1);
416 for(ii = 0; ii<fNParticleAndTrackMonitorFunctions; ii++)
417 fParticleAndTrackMonitorFunctions[ii]->Process(track1,part1);
419 if (nocorrfctns) continue;
421 for (Int_t k =j+1; k < partEvent->GetNumberOfParticles() ; k++)
423 part2= partEvent->GetParticle(k);
424 if (part1->GetUID() == part2->GetUID()) continue;
425 partpair->SetParticles(part1,part2);
427 track2= trackEvent->GetParticle(k);
428 trackpair->SetParticles(track1,track2);
430 if( (this->*fkPass)(partpair,trackpair) ) //check pair cut
431 { //do not meets crietria of the pair cut, try with swapped pairs
432 if( (this->*fkPass)(partpair->GetSwapedPair(),trackpair->GetSwapedPair()) )
433 continue; //swaped pairs do not meet criteria of pair cut as well, take next particle
435 { //swaped pair meets all the criteria
436 tmppartpair = partpair->GetSwapedPair();
437 tmptrackpair = trackpair->GetSwapedPair();
441 {//meets criteria of the pair cut
442 tmptrackpair = trackpair;
443 tmppartpair = partpair;
446 for(ii = 0;ii<fNParticleFunctions;ii++)
447 fParticleFunctions[ii]->ProcessSameEventParticles(tmppartpair);
449 for(ii = 0;ii<fNTrackFunctions;ii++)
450 fTrackFunctions[ii]->ProcessSameEventParticles(tmptrackpair);
452 for(ii = 0;ii<fNParticleAndTrackFunctions;ii++)
453 fParticleAndTrackFunctions[ii]->ProcessSameEventParticles(tmptrackpair,tmppartpair);
454 //end of 2nd loop over particles from the same event
455 }//for (Int_t k =j+1; k < partEvent->GetNumberOfParticles() ; k++)
457 /***************************************/
458 /***** Filling denominators *********/
459 /***************************************/
460 if (fBufferSize == 0) continue;
462 partbuffer.ResetIter();
463 trackbuffer.ResetIter();
465 while (( partEvent2 = partbuffer.Next() ))
467 trackEvent2 = trackbuffer.Next();
470 if ( (j%fDisplayMixingInfo) == 0)
471 Info("ProcessTracksAndParticles",
472 "Mixing particle %d from event %d with particles from event %d",j,i,i-m);
474 for(Int_t l = 0; l<partEvent2->GetNumberOfParticles();l++) // ... on all particles
476 part2= partEvent2->GetParticle(l);
477 partpair->SetParticles(part1,part2);
479 track2= trackEvent2->GetParticle(l);
480 trackpair->SetParticles(track1,track2);
482 if( (this->*fkPass)(partpair,trackpair) ) //check pair cut
483 { //do not meets crietria of the
484 if( (this->*fkPass)(partpair->GetSwapedPair(),trackpair->GetSwapedPair()) )
488 tmppartpair = partpair->GetSwapedPair();
489 tmptrackpair = trackpair->GetSwapedPair();
493 {//meets criteria of the pair cut
494 tmptrackpair = trackpair;
495 tmppartpair = partpair;
498 for(ii = 0;ii<fNParticleFunctions;ii++)
499 fParticleFunctions[ii]->ProcessDiffEventParticles(tmppartpair);
501 for(ii = 0;ii<fNTrackFunctions;ii++)
502 fTrackFunctions[ii]->ProcessDiffEventParticles(tmptrackpair);
504 for(ii = 0;ii<fNParticleAndTrackFunctions;ii++)
505 fParticleAndTrackFunctions[ii]->ProcessDiffEventParticles(tmptrackpair,tmppartpair);
506 }//for(Int_t l = 0; l<N2;l++) // ... on all particles
509 //end of loop over particles from first event
510 }//for (Int_t j = 0; j<partEvent->GetNumberOfParticles() ; j++)
511 partEvent1 = partbuffer.Push(partEvent1);
512 trackEvent1 = trackbuffer.Push(trackEvent1);
513 //end of loop over events
514 }//while (fReader->Next() == kFALSE)
519 partbuffer.SetOwner(kTRUE);
520 trackbuffer.SetOwner(kTRUE);
522 /*************************************************************************************/
524 void AliHBTAnalysis::ProcessTracks()
526 //In order to minimize calling AliRun::GetEvent (we need at one time particles from different events),
527 //the loops are splited
528 AliHBTParticle * track1, * track2;
529 AliHBTEvent * trackEvent;
530 AliHBTEvent * trackEvent1 = 0x0;
531 AliHBTEvent * trackEvent2;
535 AliHBTPair * trackpair = new AliHBTPair();
536 AliHBTPair * tmptrackpair; //temporary pointer
538 AliHBTEventBuffer trackbuffer(fBufferSize);
542 while (fReader->Next() == kFALSE)
545 trackEvent = fReader->GetTrackEvent();
546 if (!trackEvent) continue;
548 if(trackEvent1 == 0x0)
550 trackEvent1 = new AliHBTEvent();
551 trackEvent1->SetOwner(kTRUE);
555 trackEvent1->Reset();
558 for (Int_t j = 0; j<trackEvent->GetNumberOfParticles() ; j++)
560 /***************************************/
561 /****** Looping same events ********/
562 /****** filling numerators ********/
563 /***************************************/
564 if ( (j%fDisplayMixingInfo) == 0)
565 Info("ProcessTracks",
566 "Mixing particle %d from event %d with particles from event %d",j,i,i);
568 track1= trackEvent->GetParticle(j);
569 Bool_t firstcut = fPairCut->GetFirstPartCut()->Pass(track1);
571 if (fBufferSize != 0)
572 if ( (firstcut == kFALSE) || (fPairCut->GetSecondPartCut()->Pass(track1) == kFALSE) )
574 //accepted by any cut
575 // we have to copy because reader keeps only one event
576 trackEvent1->AddParticle(new AliHBTParticle(*track1));
579 if (firstcut) continue;
581 for(ii = 0; ii<fNTrackMonitorFunctions; ii++)
582 fTrackMonitorFunctions[ii]->Process(track1);
584 if ( fNTrackFunctions ==0 ) continue;
586 for (Int_t k =j+1; k < trackEvent->GetNumberOfParticles() ; k++)
588 track2= trackEvent->GetParticle(k);
589 if (track1->GetUID() == track2->GetUID()) continue;
591 trackpair->SetParticles(track1,track2);
592 if(fPairCut->Pass(trackpair)) //check pair cut
593 { //do not meets crietria of the
594 if( fPairCut->Pass(trackpair->GetSwapedPair()) ) continue;
595 else tmptrackpair = trackpair->GetSwapedPair();
599 tmptrackpair = trackpair;
601 for(ii = 0;ii<fNTrackFunctions;ii++)
602 fTrackFunctions[ii]->ProcessSameEventParticles(tmptrackpair);
604 /***************************************/
605 /***** Filling denominators *********/
606 /***************************************/
608 if (fBufferSize == 0) continue;
610 trackbuffer.ResetIter();
613 while (( trackEvent2 = trackbuffer.Next() ))
616 if ( (j%fDisplayMixingInfo) == 0)
617 Info("ProcessTracks",
618 "Mixing track %d from event %d with tracks from event %d",j,i,i-m);
619 for(Int_t l = 0; l<trackEvent2->GetNumberOfParticles();l++) // ... on all particles
622 track2= trackEvent2->GetParticle(l);
623 trackpair->SetParticles(track1,track2);
625 if( fPairCut->Pass(trackpair) ) //check pair cut
626 { //do not meets crietria of the
627 if( fPairCut->Pass(trackpair->GetSwapedPair()) )
631 tmptrackpair = trackpair->GetSwapedPair();
635 {//meets criteria of the pair cut
636 tmptrackpair = trackpair;
639 for(ii = 0;ii<fNTrackFunctions;ii++)
640 fTrackFunctions[ii]->ProcessDiffEventParticles(tmptrackpair);
642 }//for(Int_t l = 0; l<N2;l++) // ... on all particles
645 trackEvent1 = trackbuffer.Push(trackEvent1);
646 }//while (fReader->Next() == kFALSE)
649 trackbuffer.SetOwner(kTRUE);
652 /*************************************************************************************/
654 void AliHBTAnalysis::ProcessParticles()
656 //In order to minimize calling AliRun::GetEvent (we need at one time particles from different events),
657 //the loops are splited
658 AliHBTParticle * part1, * part2;
659 AliHBTEvent * partEvent;
660 AliHBTEvent * partEvent1 = 0x0;
661 AliHBTEvent * partEvent2;
665 AliHBTPair * partpair = new AliHBTPair();
666 AliHBTPair * tmppartpair; //temporary pointer
668 AliHBTEventBuffer partbuffer(fBufferSize);
669 partbuffer.SetOwner(kTRUE);
673 while (fReader->Next() == kFALSE)
676 partEvent = fReader->GetParticleEvent();
677 if (!partEvent) continue;
679 if(partEvent1 == 0x0)
681 partEvent1 = new AliHBTEvent();
682 partEvent1->SetOwner(kTRUE);
689 for (Int_t j = 0; j<partEvent->GetNumberOfParticles() ; j++)
691 /***************************************/
692 /****** Looping same events ********/
693 /****** filling numerators ********/
694 /***************************************/
695 if ( (j%fDisplayMixingInfo) == 0)
696 Info("ProcessParticles",
697 "Mixing particle %d from event %d with particles from event %d",j,i,i);
699 part1 = partEvent->GetParticle(j);
700 Bool_t firstcut = fPairCut->GetFirstPartCut()->Pass(part1);
702 if (fBufferSize != 0) //useless in case
703 if ( (firstcut == kFALSE) || (fPairCut->GetSecondPartCut()->Pass(part1) == kFALSE) )
705 //accepted by any cut
706 // we have to copy because reader keeps only one event
707 partEvent1->AddParticle(new AliHBTParticle(*part1));
710 if (firstcut) continue;
712 for(ii = 0; ii<fNParticleMonitorFunctions; ii++)
713 fParticleMonitorFunctions[ii]->Process(part1);
715 if ( fNParticleFunctions == 0 ) continue;
717 for (Int_t k =j+1; k < partEvent->GetNumberOfParticles() ; k++)
719 part2= partEvent->GetParticle(k);
720 if (part1->GetUID() == part2->GetUID()) continue;
722 partpair->SetParticles(part1,part2);
723 if(fPairCut->Pass(partpair)) //check pair cut
724 { //do not meets crietria of the
725 if( fPairCut->Pass(partpair->GetSwapedPair()) ) continue;
726 else tmppartpair = partpair->GetSwapedPair();
730 tmppartpair = partpair;
732 for(ii = 0;ii<fNParticleFunctions;ii++)
733 fParticleFunctions[ii]->ProcessSameEventParticles(tmppartpair);
735 /***************************************/
736 /***** Filling denominators *********/
737 /***************************************/
739 if (fBufferSize == 0) continue;
741 partbuffer.ResetIter();
744 while (( partEvent2 = partbuffer.Next() ))
747 if ( (j%fDisplayMixingInfo) == 0)
748 Info("ProcessParticles",
749 "Mixing particle %d from event %d with particles from event %d",j,i,i-m);
750 for(Int_t l = 0; l<partEvent2->GetNumberOfParticles();l++) // ... on all particles
753 part2= partEvent2->GetParticle(l);
754 partpair->SetParticles(part1,part2);
756 if( fPairCut->Pass(partpair) ) //check pair cut
757 { //do not meets crietria of the
758 if( fPairCut->Pass(partpair->GetSwapedPair()) )
762 tmppartpair = partpair->GetSwapedPair();
766 {//meets criteria of the pair cut
767 tmppartpair = partpair;
770 for(ii = 0;ii<fNParticleFunctions;ii++)
771 fParticleFunctions[ii]->ProcessDiffEventParticles(tmppartpair);
773 }//for(Int_t l = 0; l<N2;l++) // ... on all particles
776 partEvent1 = partbuffer.Push(partEvent1);
777 }//while (fReader->Next() == kFALSE)
779 partbuffer.SetOwner(kTRUE);
781 /*************************************************************************************/
783 void AliHBTAnalysis::WriteFunctions()
785 //Calls Write for all defined functions in analysis
786 //== writes all results
788 for(ii = 0;ii<fNParticleFunctions;ii++)
790 if (AliHBTParticle::GetDebug()>5)
792 Info("WriteFunctions","Writing ParticleFunction %#x",fParticleFunctions[ii]);
793 Info("WriteFunctions","Writing ParticleFunction %s",fParticleFunctions[ii]->Name());
795 fParticleFunctions[ii]->Write();
798 for(ii = 0;ii<fNTrackFunctions;ii++)
800 if (AliHBTParticle::GetDebug()>5)
802 Info("WriteFunctions","Writing TrackFunction %#x",fTrackFunctions[ii]);
803 Info("WriteFunctions","Writing TrackFunction %s",fTrackFunctions[ii]->Name());
805 fTrackFunctions[ii]->Write();
808 for(ii = 0;ii<fNParticleAndTrackFunctions;ii++)
810 if (AliHBTParticle::GetDebug()>5)
812 Info("WriteFunctions","Writing ParticleAndTrackFunction %#x",fParticleAndTrackFunctions[ii]);
813 Info("WriteFunctions","Writing ParticleAndTrackFunction %s",fParticleAndTrackFunctions[ii]->Name());
815 fParticleAndTrackFunctions[ii]->Write();
818 for(ii = 0;ii<fNParticleMonitorFunctions;ii++)
820 if (AliHBTParticle::GetDebug()>5)
822 Info("WriteFunctions","Writing ParticleMonitorFunction %#x",fParticleMonitorFunctions[ii]);
823 Info("WriteFunctions","Writing ParticleMonitorFunction %s",fParticleMonitorFunctions[ii]->Name());
825 fParticleMonitorFunctions[ii]->Write();
828 for(ii = 0;ii<fNTrackMonitorFunctions;ii++)
830 if (AliHBTParticle::GetDebug()>5)
832 Info("WriteFunctions","Writing TrackMonitorFunction %#x",fTrackMonitorFunctions[ii]);
833 Info("WriteFunctions","Writing TrackMonitorFunction %s",fTrackMonitorFunctions[ii]->Name());
835 fTrackMonitorFunctions[ii]->Write();
838 for(ii = 0;ii<fNParticleAndTrackMonitorFunctions;ii++)
840 if (AliHBTParticle::GetDebug()>5)
842 Info("WriteFunctions","Writing ParticleAndTrackMonitorFunction %#x",fParticleAndTrackMonitorFunctions[ii]);
843 Info("WriteFunctions","Writing ParticleAndTrackMonitorFunction %s",fParticleAndTrackMonitorFunctions[ii]->Name());
845 fParticleAndTrackMonitorFunctions[ii]->Write();
848 /*************************************************************************************/
850 void AliHBTAnalysis::SetGlobalPairCut(AliHBTPairCut* cut)
852 //Sets the global cut
855 Error("AliHBTAnalysis::SetGlobalPairCut","Pointer is NULL. Ignoring");
858 fPairCut = (AliHBTPairCut*)cut->Clone();
861 /*************************************************************************************/
863 void AliHBTAnalysis::AddTrackFunction(AliHBTOnePairFctn* f)
865 //Adds track function
866 if (f == 0x0) return;
867 if (fNTrackFunctions == fgkFctnArraySize)
869 Error("AliHBTAnalysis::AddTrackFunction","Can not add this function, not enough place in the array.");
871 fTrackFunctions[fNTrackFunctions] = f;
874 /*************************************************************************************/
876 void AliHBTAnalysis::AddParticleFunction(AliHBTOnePairFctn* f)
878 //adds particle function
879 if (f == 0x0) return;
881 if (fNParticleFunctions == fgkFctnArraySize)
883 Error("AliHBTAnalysis::AddParticleFunction","Can not add this function, not enough place in the array.");
885 fParticleFunctions[fNParticleFunctions] = f;
886 fNParticleFunctions++;
888 /*************************************************************************************/
890 void AliHBTAnalysis::AddParticleAndTrackFunction(AliHBTTwoPairFctn* f)
892 //add resolution function
893 if (f == 0x0) return;
894 if (fNParticleAndTrackFunctions == fgkFctnArraySize)
896 Error("AliHBTAnalysis::AddParticleAndTrackFunction","Can not add this function, not enough place in the array.");
898 fParticleAndTrackFunctions[fNParticleAndTrackFunctions] = f;
899 fNParticleAndTrackFunctions++;
901 /*************************************************************************************/
903 void AliHBTAnalysis::AddParticleMonitorFunction(AliHBTMonOneParticleFctn* f)
905 //add particle monitoring function
906 if (f == 0x0) return;
908 if (fNParticleMonitorFunctions == fgkFctnArraySize)
910 Error("AliHBTAnalysis::AddParticleMonitorFunction","Can not add this function, not enough place in the array.");
912 fParticleMonitorFunctions[fNParticleMonitorFunctions] = f;
913 fNParticleMonitorFunctions++;
915 /*************************************************************************************/
917 void AliHBTAnalysis::AddTrackMonitorFunction(AliHBTMonOneParticleFctn* f)
919 //add track monitoring function
920 if (f == 0x0) return;
922 if (fNTrackMonitorFunctions == fgkFctnArraySize)
924 Error("AliHBTAnalysis::AddTrackMonitorFunction","Can not add this function, not enough place in the array.");
926 fTrackMonitorFunctions[fNTrackMonitorFunctions] = f;
927 fNTrackMonitorFunctions++;
929 /*************************************************************************************/
931 void AliHBTAnalysis::AddParticleAndTrackMonitorFunction(AliHBTMonTwoParticleFctn* f)
933 //add resolution monitoring function
934 if (f == 0x0) return;
935 if (fNParticleAndTrackMonitorFunctions == fgkFctnArraySize)
937 Error("AliHBTAnalysis::AddParticleAndTrackMonitorFunction","Can not add this function, not enough place in the array.");
939 fParticleAndTrackMonitorFunctions[fNParticleAndTrackMonitorFunctions] = f;
940 fNParticleAndTrackMonitorFunctions++;
944 /*************************************************************************************/
945 /*************************************************************************************/
947 Bool_t AliHBTAnalysis::RunCoherencyCheck()
949 //Checks if both HBTRuns are similar
950 //return true if error found
951 //if they seem to be OK return false
953 Info("RunCoherencyCheck","Checking HBT Runs Coherency");
955 Info("RunCoherencyCheck","Number of events ...");
956 if (fReader->GetNumberOfPartEvents() == fReader->GetNumberOfTrackEvents() ) //check whether there is the same number of events
958 Info("RunCoherencyCheck","OK. %d found\n",fReader->GetNumberOfTrackEvents());
961 { //if not the same - ERROR
962 Error("AliHBTAnalysis::RunCoherencyCheck()",
963 "Number of simulated events (%d) is not equal to number of reconstructed events(%d)",
964 fReader->GetNumberOfPartEvents(),fReader->GetNumberOfTrackEvents());
968 Info("RunCoherencyCheck","Checking number of Particles AND Particles Types in each event ...");
970 AliHBTEvent *partEvent;
971 AliHBTEvent *trackEvent;
972 for( i = 0; i<fReader->GetNumberOfTrackEvents();i++)
974 partEvent= fReader->GetParticleEvent(i); //gets the "ith" event
975 trackEvent = fReader->GetTrackEvent(i);
977 if ( (partEvent == 0x0) && (partEvent == 0x0) ) continue;
978 if ( (partEvent == 0x0) || (partEvent == 0x0) )
980 Error("AliHBTAnalysis::RunCoherencyCheck()",
981 "One event is NULL and the other one not. Event Number %d",i);
985 if ( partEvent->GetNumberOfParticles() != trackEvent->GetNumberOfParticles() )
987 Error("AliHBTAnalysis::RunCoherencyCheck()",
988 "Event %d: Number of simulated particles (%d) not equal to number of reconstructed tracks (%d)",
989 i,partEvent->GetNumberOfParticles() , trackEvent->GetNumberOfParticles());
993 for (Int_t j = 0; j<partEvent->GetNumberOfParticles(); j++)
995 if( partEvent->GetParticle(j)->GetPdgCode() != trackEvent->GetParticle(j)->GetPdgCode() )
997 Error("AliHBTAnalysis::RunCoherencyCheck()",
998 "Event %d: Particle %d: PID of simulated particle (%d) not the same of reconstructed track (%d)",
999 i,j, partEvent->GetParticle(j)->GetPdgCode(),trackEvent->GetParticle(j)->GetPdgCode() );
1005 Info("RunCoherencyCheck"," Done");
1006 Info("RunCoherencyCheck"," Everything looks OK");
1010 /*************************************************************************************/
1012 void AliHBTAnalysis::ProcessTracksAndParticlesNonIdentAnal()
1014 //Performs analysis for both, tracks and particles
1016 AliHBTParticle * part1, * part2;
1017 AliHBTParticle * track1, * track2;
1019 AliHBTEvent * trackEvent1=0x0,*partEvent1=0x0;
1020 AliHBTEvent * trackEvent2=0x0,*partEvent2=0x0;
1021 AliHBTEvent * trackEvent3=0x0,*partEvent3=0x0;
1023 AliHBTEvent * rawtrackEvent, *rawpartEvent;//this we get from Reader
1025 AliHBTPair * trackpair = new AliHBTPair();
1026 AliHBTPair * partpair = new AliHBTPair();
1028 AliHBTEventBuffer partbuffer(fBufferSize);
1029 AliHBTEventBuffer trackbuffer(fBufferSize);
1033 trackEvent1 = new AliHBTEvent();
1034 partEvent1 = new AliHBTEvent();
1035 trackEvent1->SetOwner(kFALSE);
1036 partEvent1->SetOwner(kFALSE);;
1038 Bool_t nocorrfctns = (fNParticleFunctions == 0) && (fNTrackFunctions == 0) && (fNParticleAndTrackFunctions == 0);
1042 Info("ProcessTracksAndParticlesNonIdentAnal","**************************************");
1043 Info("ProcessTracksAndParticlesNonIdentAnal","***** NON IDENT MODE ****************");
1044 Info("ProcessTracksAndParticlesNonIdentAnal","**************************************");
1046 for (Int_t i = 0;;i++)//infinite loop
1048 if (fReader->Next()) break; //end when no more events available
1050 rawpartEvent = fReader->GetParticleEvent();
1051 rawtrackEvent = fReader->GetTrackEvent();
1052 if ( (rawpartEvent == 0x0) || (rawtrackEvent == 0x0) ) continue;//in case of any error
1054 if ( rawpartEvent->GetNumberOfParticles() != rawtrackEvent->GetNumberOfParticles() )
1056 Fatal("ProcessTracksAndParticlesNonIdentAnal",
1057 "Event %d: Number of simulated particles (%d) not equal to number of reconstructed tracks (%d)",
1058 i,rawpartEvent->GetNumberOfParticles() , rawtrackEvent->GetNumberOfParticles());
1062 /********************************/
1064 /********************************/
1065 if ( ( (partEvent2==0x0) || (trackEvent2==0x0)) )//in case fBufferSize == 0 and pointers are created do not eneter
1067 partEvent2 = new AliHBTEvent();
1068 trackEvent2 = new AliHBTEvent();
1069 partEvent2->SetOwner(kTRUE);
1070 trackEvent2->SetOwner(kTRUE);
1073 FilterOut(partEvent1, partEvent2, rawpartEvent, trackEvent1, trackEvent2, rawtrackEvent);
1075 for (Int_t j = 0; j<partEvent1->GetNumberOfParticles() ; j++)
1077 if ( (j%fDisplayMixingInfo) == 0)
1078 Info("ProcessTracksAndParticlesNonIdentAnal",
1079 "Mixing particle %d from event %d with particles from event %d",j,i,i);
1081 part1= partEvent1->GetParticle(j);
1082 track1= trackEvent1->GetParticle(j);
1084 //PID reconstruction imperfections
1085 // if( part1->GetPdgCode() != track1->GetPdgCode() )
1087 // Fatal("ProcessTracksAndParticlesNonIdentAnal",
1088 // "Event %d: Particle %d: PID of simulated particle (%d) not the same of reconstructed track (%d)",
1089 // i,j, part1->GetPdgCode(),track1->GetPdgCode() );
1093 for(ii = 0; ii<fNParticleMonitorFunctions; ii++)
1094 fParticleMonitorFunctions[ii]->Process(part1);
1095 for(ii = 0; ii<fNTrackMonitorFunctions; ii++)
1096 fTrackMonitorFunctions[ii]->Process(track1);
1097 for(ii = 0; ii<fNParticleAndTrackMonitorFunctions; ii++)
1098 fParticleAndTrackMonitorFunctions[ii]->Process(track1,part1);
1100 if (nocorrfctns) continue;
1102 /***************************************/
1103 /****** filling numerators ********/
1104 /****** (particles from event2) ********/
1105 /***************************************/
1107 for (Int_t k = 0; k < partEvent2->GetNumberOfParticles() ; k++) //partEvent1 and partEvent2 are particles from the same event but separated to two groups
1109 part2= partEvent2->GetParticle(k);
1110 if (part1->GetUID() == part2->GetUID()) continue;//this is the same particle but with different PID
1111 partpair->SetParticles(part1,part2);
1113 track2= trackEvent2->GetParticle(k);
1114 trackpair->SetParticles(track1,track2);
1116 if( (this->*fkPassPairProp)(partpair,trackpair) ) //check pair cut
1117 { //do not meets crietria of the pair cut
1121 {//meets criteria of the pair cut
1122 for(ii = 0;ii<fNParticleFunctions;ii++)
1123 fParticleFunctions[ii]->ProcessSameEventParticles(partpair);
1125 for(ii = 0;ii<fNTrackFunctions;ii++)
1126 fTrackFunctions[ii]->ProcessSameEventParticles(trackpair);
1128 for(ii = 0;ii<fNParticleAndTrackFunctions;ii++)
1129 fParticleAndTrackFunctions[ii]->ProcessSameEventParticles(trackpair,partpair);
1133 if ( fBufferSize == 0) continue;//do not mix diff histograms
1134 /***************************************/
1135 /***** Filling denominators *********/
1136 /***************************************/
1137 partbuffer.ResetIter();
1138 trackbuffer.ResetIter();
1142 while ( (partEvent3 = partbuffer.Next() ) != 0x0)
1144 trackEvent3 = trackbuffer.Next();
1146 if ( (j%fDisplayMixingInfo) == 0)
1147 Info("ProcessTracksAndParticlesNonIdentAnal",
1148 "Mixing particle %d from event %d with particles from event %d",j,i,i-(++nmonitor));
1150 for (Int_t k = 0; k < partEvent3->GetNumberOfParticles() ; k++)
1152 part2= partEvent3->GetParticle(k);
1153 partpair->SetParticles(part1,part2);
1155 track2= trackEvent3->GetParticle(k);
1156 trackpair->SetParticles(track1,track2);
1158 if( (this->*fkPassPairProp)(partpair,trackpair) ) //check pair cut
1159 { //do not meets crietria of the pair cut
1163 {//meets criteria of the pair cut
1165 for(ii = 0;ii<fNParticleFunctions;ii++)
1166 fParticleFunctions[ii]->ProcessDiffEventParticles(partpair);
1168 for(ii = 0;ii<fNTrackFunctions;ii++)
1169 fTrackFunctions[ii]->ProcessDiffEventParticles(trackpair);
1171 for(ii = 0;ii<fNParticleAndTrackFunctions;ii++)
1172 fParticleAndTrackFunctions[ii]->ProcessDiffEventParticles(trackpair,partpair);
1174 }// for particles event2
1176 }//for over particles in event1
1178 partEvent2 = partbuffer.Push(partEvent2);
1179 trackEvent2 = trackbuffer.Push(trackEvent2);
1181 }//end of loop over events (1)
1183 partbuffer.SetOwner(kTRUE);
1184 trackbuffer.SetOwner(kTRUE);
1194 /*************************************************************************************/
1196 void AliHBTAnalysis::ProcessTracksNonIdentAnal()
1198 //Process Tracks only with non identical mode
1199 AliHBTParticle * track1, * track2;
1201 AliHBTEvent * trackEvent1=0x0;
1202 AliHBTEvent * trackEvent2=0x0;
1203 AliHBTEvent * trackEvent3=0x0;
1205 AliHBTEvent * rawtrackEvent;
1207 AliHBTPair * trackpair = new AliHBTPair();
1208 AliHBTEventBuffer trackbuffer(fBufferSize);
1212 trackEvent1 = new AliHBTEvent();
1213 trackEvent1->SetOwner(kFALSE);
1217 Info("ProcessTracksNonIdentAnal","**************************************");
1218 Info("ProcessTracksNonIdentAnal","***** NON IDENT MODE ****************");
1219 Info("ProcessTracksNonIdentAnal","**************************************");
1222 for (Int_t i = 0;;i++)//infinite loop
1224 if (fReader->Next()) break; //end when no more events available
1225 rawtrackEvent = fReader->GetTrackEvent();
1227 if (rawtrackEvent == 0x0) continue;//in case of any error
1229 /********************************/
1231 /********************************/
1232 if ( trackEvent2==0x0 )//in case fBufferSize == 0 and pointers are created do not eneter
1234 trackEvent2 = new AliHBTEvent();
1235 trackEvent2->SetOwner(kTRUE);
1238 FilterOut(trackEvent1, trackEvent2, rawtrackEvent);
1240 for (Int_t j = 0; j<trackEvent1->GetNumberOfParticles() ; j++)
1242 if ( (j%fDisplayMixingInfo) == 0)
1243 Info("ProcessTracksNonIdentAnal",
1244 "Mixing particle %d from event %d with particles from event %d",j,i,i);
1246 track1= trackEvent1->GetParticle(j);
1248 for(ii = 0; ii<fNTrackMonitorFunctions; ii++)
1249 fTrackMonitorFunctions[ii]->Process(track1);
1251 if (fNTrackFunctions == 0x0) continue;
1253 /***************************************/
1254 /****** filling numerators ********/
1255 /****** (particles from event2) ********/
1256 /***************************************/
1257 for (Int_t k = 0; k < trackEvent2->GetNumberOfParticles() ; k++)
1259 track2= trackEvent2->GetParticle(k);
1260 if (track1->GetUID() == track2->GetUID()) continue;//this is the same particle but with different PID
1261 trackpair->SetParticles(track1,track2);
1264 if( fPairCut->PassPairProp(trackpair)) //check pair cut
1265 { //do not meets crietria of the pair cut
1269 {//meets criteria of the pair cut
1271 for(ii = 0;ii<fNTrackFunctions;ii++)
1272 fTrackFunctions[ii]->ProcessSameEventParticles(trackpair);
1275 if ( fBufferSize == 0) continue;//do not mix diff histograms
1276 /***************************************/
1277 /***** Filling denominators *********/
1278 /***************************************/
1279 trackbuffer.ResetIter();
1282 while ( (trackEvent3 = trackbuffer.Next() ) != 0x0)
1285 if ( (j%fDisplayMixingInfo) == 0)
1286 Info("ProcessTracksNonIdentAnal",
1287 "Mixing particle %d from event %d with particles from event %d",j,i,i-(++nmonitor));
1289 for (Int_t k = 0; k < trackEvent3->GetNumberOfParticles() ; k++)
1292 track2= trackEvent3->GetParticle(k);
1293 trackpair->SetParticles(track1,track2);
1296 if( fPairCut->PassPairProp(trackpair)) //check pair cut
1297 { //do not meets crietria of the pair cut
1301 {//meets criteria of the pair cut
1302 for(ii = 0;ii<fNTrackFunctions;ii++)
1303 fTrackFunctions[ii]->ProcessDiffEventParticles(trackpair);
1305 }// for particles event2
1307 }//for over particles in event1
1309 trackEvent2 = trackbuffer.Push(trackEvent2);
1311 }//end of loop over events (1)
1313 trackbuffer.SetOwner(kTRUE);
1318 /*************************************************************************************/
1320 void AliHBTAnalysis::ProcessParticlesNonIdentAnal()
1322 //process paricles only with non identical mode
1323 AliHBTParticle * part1 = 0x0, * part2 = 0x0;
1325 AliHBTEvent * partEvent1 = 0x0;
1326 AliHBTEvent * partEvent2 = 0x0;
1327 AliHBTEvent * partEvent3 = 0x0;
1329 AliHBTEvent * rawpartEvent = 0x0;
1331 AliHBTPair * partpair = new AliHBTPair();
1332 AliHBTEventBuffer partbuffer(fBufferSize);
1336 partEvent1 = new AliHBTEvent();
1337 partEvent1->SetOwner(kFALSE);
1341 Info("ProcessParticlesNonIdentAnal","**************************************");
1342 Info("ProcessParticlesNonIdentAnal","***** NON IDENT MODE ****************");
1343 Info("ProcessParticlesNonIdentAnal","**************************************");
1345 for (Int_t i = 0;;i++)//infinite loop
1347 if (fReader->Next()) break; //end when no more events available
1349 rawpartEvent = fReader->GetParticleEvent();
1350 if ( rawpartEvent == 0x0 ) continue;//in case of any error
1352 /********************************/
1354 /********************************/
1355 if (partEvent2==0x0)//in case fBufferSize == 0 and pointers are created do not eneter
1357 partEvent2 = new AliHBTEvent();
1358 partEvent2->SetOwner(kTRUE);
1361 FilterOut(partEvent1, partEvent2, rawpartEvent);
1363 for (Int_t j = 0; j<partEvent1->GetNumberOfParticles() ; j++)
1365 if ( (j%fDisplayMixingInfo) == 0)
1366 Info("ProcessParticlesNonIdentAnal",
1367 "Mixing particle %d from event %d with particles from event %d",j,i,i);
1369 part1= partEvent1->GetParticle(j);
1371 for(ii = 0; ii<fNParticleMonitorFunctions; ii++)
1372 fParticleMonitorFunctions[ii]->Process(part1);
1374 if (fNParticleFunctions == 0) continue;
1376 /***************************************/
1377 /****** filling numerators ********/
1378 /****** (particles from event2) ********/
1379 /***************************************/
1380 for (Int_t k = 0; k < partEvent2->GetNumberOfParticles() ; k++)
1382 part2= partEvent2->GetParticle(k);
1383 if (part1->GetUID() == part2->GetUID()) continue;//this is the same particle but with different PID
1384 partpair->SetParticles(part1,part2);
1386 if(fPairCut->PassPairProp(partpair) ) //check pair cut
1387 { //do not meets crietria of the pair cut
1391 {//meets criteria of the pair cut
1392 for(ii = 0;ii<fNParticleFunctions;ii++)
1393 fParticleFunctions[ii]->ProcessSameEventParticles(partpair);
1396 if ( fBufferSize == 0) continue;//do not mix diff histograms
1397 /***************************************/
1398 /***** Filling denominators *********/
1399 /***************************************/
1400 partbuffer.ResetIter();
1403 while ( (partEvent3 = partbuffer.Next() ) != 0x0)
1405 if ( (j%fDisplayMixingInfo) == 0)
1406 Info("ProcessParticlesNonIdentAnal",
1407 "Mixing particle %d from event %d with particles from event %d",j,i,i-(++nmonitor));
1409 for (Int_t k = 0; k < partEvent3->GetNumberOfParticles() ; k++)
1411 part2= partEvent3->GetParticle(k);
1412 partpair->SetParticles(part1,part2);
1414 if(fPairCut->PassPairProp(partpair) ) //check pair cut
1415 { //do not meets crietria of the pair cut
1419 {//meets criteria of the pair cut
1420 for(ii = 0;ii<fNParticleFunctions;ii++)
1422 fParticleFunctions[ii]->ProcessDiffEventParticles(partpair);
1425 }// for particles event2
1427 }//for over particles in event1
1428 partEvent2 = partbuffer.Push(partEvent2);
1429 }//end of loop over events (1)
1431 partbuffer.SetOwner(kTRUE);
1437 /*************************************************************************************/
1438 void AliHBTAnalysis::FilterOut(AliHBTEvent* outpart1, AliHBTEvent* outpart2, AliHBTEvent* inpart,
1439 AliHBTEvent* outtrack1, AliHBTEvent* outtrack2, AliHBTEvent* intrack) const
1441 //Puts particles accepted as a first particle by global cut in out1
1442 //and as a second particle in out2
1444 AliHBTParticle* part, *track;
1453 for (Int_t i = 0; i < inpart->GetNumberOfParticles(); i++)
1456 part = inpart->GetParticle(i);
1457 track = intrack->GetParticle(i);
1459 if ( ((this->*fkPass1)(part,track)) ) in1 = kFALSE; //if part is rejected by cut1, in1 is false
1460 if ( ((this->*fkPass2)(part,track)) ) in2 = kFALSE; //if part is rejected by cut2, in2 is false
1462 if (gDebug)//to be removed in real analysis
1463 if ( in1 && in2 ) //both cuts accepted, should never happen, just in case
1465 //Particle accpted by both cuts
1466 Error("FilterOut","Particle accepted by both cuts");
1472 outpart1->AddParticle(part);
1473 outtrack1->AddParticle(track);
1479 outpart2->AddParticle(new AliHBTParticle(*part));
1480 outtrack2->AddParticle(new AliHBTParticle(*track));
1485 /*************************************************************************************/
1487 void AliHBTAnalysis::FilterOut(AliHBTEvent* out1, AliHBTEvent* out2, AliHBTEvent* in) const
1489 //Puts particles accepted as a first particle by global cut in out1
1490 //and as a second particle in out2
1491 AliHBTParticle* part;
1496 AliHBTParticleCut *cut1 = fPairCut->GetFirstPartCut();
1497 AliHBTParticleCut *cut2 = fPairCut->GetSecondPartCut();
1501 for (Int_t i = 0; i < in->GetNumberOfParticles(); i++)
1504 part = in->GetParticle(i);
1506 if ( cut1->Pass(part) ) in1 = kFALSE; //if part is rejected by cut1, in1 is false
1507 if ( cut2->Pass(part) ) in2 = kFALSE; //if part is rejected by cut2, in2 is false
1509 if (gDebug)//to be removed in real analysis
1510 if ( in1 && in2 ) //both cuts accepted, should never happen, just in case
1512 //Particle accpted by both cuts
1513 Error("FilterOut","Particle accepted by both cuts");
1519 out1->AddParticle(part);
1525 out2->AddParticle(part);
1530 /*************************************************************************************/
1532 Bool_t AliHBTAnalysis::IsNonIdentAnalysis()
1534 //checks if it is possible to use special analysis for non identical particles
1535 //it means - in global pair cut first particle id is different than second one
1536 //and both are different from 0
1537 //in the future is possible to perform more sophisticated check
1538 //if cuts have excluding requirements
1540 if (fPairCut->IsEmpty())
1543 if (fPairCut->GetFirstPartCut()->IsEmpty())
1546 if (fPairCut->GetSecondPartCut()->IsEmpty())
1549 Int_t id1 = fPairCut->GetFirstPartCut()->GetPID();
1550 Int_t id2 = fPairCut->GetSecondPartCut()->GetPID();
1552 if ( (id1==0) || (id2==0) || (id1==id2) )
1557 /*************************************************************************************/
1559 void AliHBTAnalysis::SetCutsOnParticles()
1561 // -- aplies only to Process("TracksAndParticles")
1562 // (ProcessTracksAndParticles and ProcessTracksAndParticlesNonIdentAnal)
1563 // Only particles properties are checkes against cuts
1564 fkPass = &AliHBTAnalysis::PassPart;
1565 fkPass1 = &AliHBTAnalysis::PassPart1;
1566 fkPass2 = &AliHBTAnalysis::PassPart2;
1567 fkPassPairProp = &AliHBTAnalysis::PassPairPropPart;
1570 /*************************************************************************************/
1572 void AliHBTAnalysis::SetCutsOnTracks()
1574 // -- aplies only to Process("TracksAndParticles")
1575 // (ProcessTracksAndParticles and ProcessTracksAndParticlesNonIdentAnal)
1576 // Only tracks properties are checkes against cuts
1577 fkPass = &AliHBTAnalysis::PassTrack;
1578 fkPass1 = &AliHBTAnalysis::PassTrack1;
1579 fkPass2 = &AliHBTAnalysis::PassTrack2;
1580 fkPassPairProp = &AliHBTAnalysis::PassPairPropTrack;
1583 /*************************************************************************************/
1585 void AliHBTAnalysis::SetCutsOnTracksAndParticles()
1587 // -- aplies only to Process("TracksAndParticles")
1588 // (ProcessTracksAndParticles and ProcessTracksAndParticlesNonIdentAnal)
1589 // Both, tracks and particles, properties are checked against cuts
1590 fkPass = &AliHBTAnalysis::PassPartAndTrack;
1591 fkPass1 = &AliHBTAnalysis::PassPartAndTrack1;
1592 fkPass2 = &AliHBTAnalysis::PassPartAndTrack2;
1593 fkPassPairProp = &AliHBTAnalysis::PassPairPropPartAndTrack;
1595 /*************************************************************************************/
1597 void AliHBTAnalysis::PressAnyKey()
1599 //small utility function that helps to make comfortable macros
1602 fcntl(0, F_SETFL, O_NONBLOCK);
1603 ::Info("","Press Any Key to continue ...");
1606 nread = read(0, &c, 1);
1607 gSystem->ProcessEvents();
1611 /*************************************************************************************/