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 AliReader
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 //_________________________________________________________
24 #include "AliAODParticle.h"
25 #include "AliAODPairCut.h"
27 #include "AliEventBuffer.h"
29 #include "AliReader.h"
30 #include "AliHBTPair.h"
31 #include "AliHBTFunction.h"
32 #include "AliHBTMonitorFunction.h"
36 ClassImp(AliHBTAnalysis)
38 const UInt_t AliHBTAnalysis::fgkFctnArraySize = 100;
39 const UInt_t AliHBTAnalysis::fgkDefaultMixingInfo = 1000;
40 const Int_t AliHBTAnalysis::fgkDefaultBufferSize = 5;
42 AliHBTAnalysis::AliHBTAnalysis():
45 fNParticleFunctions(0),
46 fNParticleAndTrackFunctions(0),
47 fNTrackMonitorFunctions(0),
48 fNParticleMonitorFunctions(0),
49 fNParticleAndTrackMonitorFunctions(0),
50 fTrackFunctions ( new AliHBTOnePairFctn* [fgkFctnArraySize]),
51 fParticleFunctions ( new AliHBTOnePairFctn* [fgkFctnArraySize]),
52 fParticleAndTrackFunctions ( new AliHBTTwoPairFctn* [fgkFctnArraySize]),
53 fParticleMonitorFunctions ( new AliHBTMonOneParticleFctn* [fgkFctnArraySize]),
54 fTrackMonitorFunctions ( new AliHBTMonOneParticleFctn* [fgkFctnArraySize]),
55 fParticleAndTrackMonitorFunctions ( new AliHBTMonTwoParticleFctn* [fgkFctnArraySize]),
56 fPairCut(new AliAODEmptyPairCut()),//empty cut - accepts all particles
58 fDisplayMixingInfo(fgkDefaultMixingInfo),
60 fkPass(&AliHBTAnalysis::PassPartAndTrack), //by default perform cut on both track and particle pair
61 fkPass1(&AliHBTAnalysis::PassPartAndTrack1), //used onluy by ProcessTracksAndParticles
62 fkPass2(&AliHBTAnalysis::PassPartAndTrack2),
63 fkPassPairProp(&AliHBTAnalysis::PassPairPropPartAndTrack)
68 /*************************************************************************************/
70 AliHBTAnalysis::AliHBTAnalysis(const AliHBTAnalysis& in):
74 fNParticleFunctions(0),
75 fNParticleAndTrackFunctions(0),
76 fNTrackMonitorFunctions(0),
77 fNParticleMonitorFunctions(0),
78 fNParticleAndTrackMonitorFunctions(0),
80 fParticleFunctions(0x0),
81 fParticleAndTrackFunctions(0x0),
82 fParticleMonitorFunctions(0x0),
83 fTrackMonitorFunctions(0x0),
84 fParticleAndTrackMonitorFunctions(0x0),
86 fBufferSize(fgkDefaultBufferSize),
87 fDisplayMixingInfo(fgkDefaultMixingInfo),
89 fkPass(&AliHBTAnalysis::PassPartAndTrack), //by default perform cut on both track and particle pair
90 fkPass1(&AliHBTAnalysis::PassPartAndTrack1),
91 fkPass2(&AliHBTAnalysis::PassPartAndTrack2),
92 fkPassPairProp(&AliHBTAnalysis::PassPairPropPartAndTrack)
95 Fatal("AliHBTAnalysis(const AliHBTAnalysis&)","Sensless");
97 /*************************************************************************************/
98 AliHBTAnalysis& AliHBTAnalysis::operator=(const AliHBTAnalysis& /*right*/)
101 Fatal("AliHBTAnalysis(const AliHBTAnalysis&)","Sensless");
104 /*************************************************************************************/
105 AliHBTAnalysis::~AliHBTAnalysis()
108 //note that we do not delete functions itself
109 // they should be deleted by whom where created
110 //we only store pointers, and we use "new" only for pointers array
114 if (AliVAODParticle::GetDebug()>5)Info("~AliHBTAnalysis","Is Owner: Attempting to delete functions");
116 if (AliVAODParticle::GetDebug()>5)Info("~AliHBTAnalysis","Delete functions done");
118 delete [] fTrackFunctions;
119 delete [] fParticleFunctions;
120 delete [] fParticleAndTrackFunctions;
122 delete [] fParticleMonitorFunctions;
123 delete [] fTrackMonitorFunctions;
124 delete [] fParticleAndTrackMonitorFunctions;
126 delete fPairCut; // always have an copy of an object - we create we dstroy
129 /*************************************************************************************/
130 Int_t AliHBTAnalysis::ProcessEvent(AliAOD* aodrec, AliAOD* aodsim)
132 //Processes one event
135 Error("ProcessEvent","Reconstructed AOD is NULL");
141 Error("ProcessEvent","Simulated AOD is NULL");
147 /*************************************************************************************/
149 Int_t AliHBTAnalysis::Finish()
154 /*************************************************************************************/
156 void AliHBTAnalysis::DeleteFunctions()
158 //Deletes all functions added to analysis
160 for(ii = 0;ii<fNParticleFunctions;ii++)
162 if (AliVAODParticle::GetDebug()>5)
164 Info("DeleteFunctions","Deleting ParticleFunction %#x",fParticleFunctions[ii]);
165 Info("DeleteFunctions","Deleting ParticleFunction %s",fParticleFunctions[ii]->Name());
167 delete fParticleFunctions[ii];
169 fNParticleFunctions = 0;
171 for(ii = 0;ii<fNTrackFunctions;ii++)
173 if (AliVAODParticle::GetDebug()>5)
175 Info("DeleteFunctions","Deleting TrackFunction %#x",fTrackFunctions[ii]);
176 Info("DeleteFunctions","Deleting TrackFunction %s",fTrackFunctions[ii]->Name());
178 delete fTrackFunctions[ii];
180 fNTrackFunctions = 0;
182 for(ii = 0;ii<fNParticleAndTrackFunctions;ii++)
184 if (AliVAODParticle::GetDebug()>5)
186 Info("DeleteFunctions","Deleting ParticleAndTrackFunction %#x",fParticleAndTrackFunctions[ii]);
187 Info("DeleteFunctions","Deleting ParticleAndTrackFunction %s",fParticleAndTrackFunctions[ii]->Name());
189 delete fParticleAndTrackFunctions[ii];
191 fNParticleAndTrackFunctions = 0;
193 for(ii = 0; ii<fNParticleMonitorFunctions; ii++)
195 if (AliVAODParticle::GetDebug()>5)
197 Info("DeleteFunctions","Deleting ParticleMonitorFunction %#x",fParticleMonitorFunctions[ii]);
198 Info("DeleteFunctions","Deleting ParticleMonitorFunction %s",fParticleMonitorFunctions[ii]->Name());
200 delete fParticleMonitorFunctions[ii];
202 fNParticleMonitorFunctions = 0;
204 for(ii = 0; ii<fNTrackMonitorFunctions; ii++)
206 if (AliVAODParticle::GetDebug()>5)
208 Info("DeleteFunctions","Deleting TrackMonitorFunction %#x",fTrackMonitorFunctions[ii]);
209 Info("DeleteFunctions","Deleting TrackMonitorFunction %s",fTrackMonitorFunctions[ii]->Name());
211 delete fTrackMonitorFunctions[ii];
213 fNTrackMonitorFunctions = 0;
215 for(ii = 0; ii<fNParticleAndTrackMonitorFunctions; ii++)
217 if (AliVAODParticle::GetDebug()>5)
219 Info("DeleteFunctions","Deleting ParticleAndTrackMonitorFunction %#x",fParticleAndTrackMonitorFunctions[ii]);
220 Info("DeleteFunctions","Deleting ParticleAndTrackMonitorFunction %s",fParticleAndTrackMonitorFunctions[ii]->Name());
222 delete fParticleAndTrackMonitorFunctions[ii];
224 fNParticleAndTrackMonitorFunctions = 0;
227 /*************************************************************************************/
229 Int_t AliHBTAnalysis::Init()
231 //Initializeation method
232 //calls Init for all functions
234 for(ii = 0;ii<fNParticleFunctions;ii++)
235 fParticleFunctions[ii]->Init();
237 for(ii = 0;ii<fNTrackFunctions;ii++)
238 fTrackFunctions[ii]->Init();
240 for(ii = 0;ii<fNParticleAndTrackFunctions;ii++)
241 fParticleAndTrackFunctions[ii]->Init();
243 for(ii = 0; ii<fNParticleMonitorFunctions; ii++)
244 fParticleMonitorFunctions[ii]->Init();
246 for(ii = 0; ii<fNTrackMonitorFunctions; ii++)
247 fTrackMonitorFunctions[ii]->Init();
249 for(ii = 0; ii<fNParticleAndTrackMonitorFunctions; ii++)
250 fParticleAndTrackMonitorFunctions[ii]->Init();
254 /*************************************************************************************/
256 void AliHBTAnalysis::ResetFunctions()
258 //In case fOwner is true, deletes all functions
259 //in other case, just set number of analysis to 0
260 if (fIsOwner) DeleteFunctions();
263 fNParticleFunctions = 0;
264 fNTrackFunctions = 0;
265 fNParticleAndTrackFunctions = 0;
266 fNParticleMonitorFunctions = 0;
267 fNTrackMonitorFunctions = 0;
268 fNParticleAndTrackMonitorFunctions = 0;
271 /*************************************************************************************/
273 void AliHBTAnalysis::Process(Option_t* option)
275 //default option = "TracksAndParticles"
276 //Main method of the HBT Analysis Package
277 //It triggers reading with the global cut (default is an empty cut)
278 //Than it checks options and data which are read
279 //if everything is OK, then it calls one of the looping methods
280 //depending on tfReaderhe option
281 //These methods differs on what thay are looping on
284 //--------------------------------------------------------------------
285 //ProcessTracksAndParticles - "TracksAndParticles"
287 // it loops over both, tracks(reconstructed) and particles(simulated)
288 // all function gethered in all 3 lists are called for each (double)pair
290 //ProcessTracks - "Tracks"
291 // it loops only on tracks(reconstructed),
292 // functions ONLY from fTrackFunctions list are called
294 //ProcessParticles - "Particles"
295 // it loops only on particles(simulated),
296 // functions ONLY from fParticleAndTrackFunctions list are called
301 Error("Process","The reader is not set");
305 const char *oT = strstr(option,"Tracks");
306 const char *oP = strstr(option,"Particles");
308 Bool_t nonid = IsNonIdentAnalysis();
314 if (nonid) ProcessTracksAndParticlesNonIdentAnal();
315 else ProcessTracksAndParticles();
321 if (nonid) ProcessTracksNonIdentAnal();
322 else ProcessTracks();
328 if (nonid) ProcessParticlesNonIdentAnal();
329 else ProcessParticles();
334 /*************************************************************************************/
336 void AliHBTAnalysis::ProcessTracksAndParticles()
338 //Makes analysis for both tracks and particles
339 //mainly for resolution study and analysies with weighting algirithms
340 //In order to minimize calling AliRun::GetEvent (we need at one time particles from different events),
341 //the loops are splited
343 // cut on particles only -- why?
344 // - PID: when we make resolution analysis we want to take only tracks with correct PID
345 // We need cut on tracks because there are data characteristic to
347 AliVAODParticle * part1, * part2;
348 AliVAODParticle * track1, * track2;
350 AliAOD * trackEvent, *partEvent;
351 AliAOD * trackEvent1 = 0x0,*partEvent1 = 0x0;
352 AliAOD * trackEvent2,*partEvent2;
354 // Int_t N1, N2, N=0; //number of particles in current event(we prcess two events in one time)
356 // Int_t nev = fReader->GetNumberOfTrackEvents();
357 AliHBTPair * trackpair = new AliHBTPair();
358 AliHBTPair * partpair = new AliHBTPair();
360 AliHBTPair * tmptrackpair;//temprary pointers to pairs
361 AliHBTPair * tmppartpair;
363 AliEventBuffer partbuffer(fBufferSize);
364 AliEventBuffer trackbuffer(fBufferSize);
368 Bool_t nocorrfctns = (fNParticleFunctions == 0) && (fNTrackFunctions == 0) && (fNParticleAndTrackFunctions == 0);
372 while (fReader->Next() == kFALSE)
375 partEvent= fReader->GetEventSim();
376 trackEvent = fReader->GetEventRec();
378 if ( !partEvent || !trackEvent )
380 Error("ProcessTracksAndParticles","Can not get event");
384 if ( partEvent->GetNumberOfParticles() != trackEvent->GetNumberOfParticles() )
386 Fatal("ProcessTracksAndParticles",
387 "Event %d: Number of simulated particles (%d) not equal to number of reconstructed tracks (%d)",
388 i,partEvent->GetNumberOfParticles() , trackEvent->GetNumberOfParticles());
392 if(partEvent1 == 0x0)
394 partEvent1 = new AliAOD();
395 partEvent1->SetOwner(kTRUE);
397 trackEvent1 = new AliAOD();
398 trackEvent1->SetOwner(kTRUE);
403 trackEvent1->Reset();
406 for (Int_t j = 0; j<partEvent->GetNumberOfParticles() ; j++)
408 /***************************************/
409 /****** Looping same events ********/
410 /****** filling numerators ********/
411 /***************************************/
412 if ( (j%fDisplayMixingInfo) == 0)
413 Info("ProcessTracksAndParticles",
414 "Mixing particle %d from event %d with particles from event %d",j,i,i);
416 part1= partEvent->GetParticle(j);
417 track1= trackEvent->GetParticle(j);
419 //PID imperfections ???
420 // if( part1->GetPdgCode() != track1->GetPdgCode() )
422 // Fatal("ProcessTracksAndParticles",
423 // "Event %d: Particle %d: PID of simulated particle (%d) not the same of reconstructed track (%d)",
424 // i,j, part1->GetPdgCode(),track1->GetPdgCode() );
428 Bool_t firstcut = (this->*fkPass1)(part1,track1);
429 if (fBufferSize != 0)
430 if ( (firstcut == kFALSE) || ( (this->*fkPass2)(part1,track1) == kFALSE ) )
432 //accepted by any cut
433 // we have to copy because reader keeps only one event
435 partEvent1->AddParticle(new AliAODParticle(*part1));
436 trackEvent1->AddParticle(new AliAODParticle(*track1));
439 if (firstcut) continue;
441 for(ii = 0; ii<fNParticleMonitorFunctions; ii++)
442 fParticleMonitorFunctions[ii]->Process(part1);
443 for(ii = 0; ii<fNTrackMonitorFunctions; ii++)
444 fTrackMonitorFunctions[ii]->Process(track1);
445 for(ii = 0; ii<fNParticleAndTrackMonitorFunctions; ii++)
446 fParticleAndTrackMonitorFunctions[ii]->Process(track1,part1);
448 if (nocorrfctns) continue;
450 for (Int_t k =j+1; k < partEvent->GetNumberOfParticles() ; k++)
452 part2= partEvent->GetParticle(k);
453 if (part1->GetUID() == part2->GetUID()) continue;
454 partpair->SetParticles(part1,part2);
456 track2= trackEvent->GetParticle(k);
457 trackpair->SetParticles(track1,track2);
459 if( (this->*fkPass)(partpair,trackpair) ) //check pair cut
460 { //do not meets crietria of the pair cut, try with swapped pairs
461 if( (this->*fkPass)((AliHBTPair*)partpair->GetSwappedPair(),(AliHBTPair*)trackpair->GetSwappedPair()) )
462 continue; //swaped pairs do not meet criteria of pair cut as well, take next particle
464 { //swaped pair meets all the criteria
465 tmppartpair = (AliHBTPair*)partpair->GetSwappedPair();
466 tmptrackpair = (AliHBTPair*)trackpair->GetSwappedPair();
470 {//meets criteria of the pair cut
471 tmptrackpair = trackpair;
472 tmppartpair = partpair;
475 for(ii = 0;ii<fNParticleFunctions;ii++)
476 fParticleFunctions[ii]->ProcessSameEventParticles(tmppartpair);
478 for(ii = 0;ii<fNTrackFunctions;ii++)
479 fTrackFunctions[ii]->ProcessSameEventParticles(tmptrackpair);
481 for(ii = 0;ii<fNParticleAndTrackFunctions;ii++)
482 fParticleAndTrackFunctions[ii]->ProcessSameEventParticles(tmptrackpair,tmppartpair);
483 //end of 2nd loop over particles from the same event
484 }//for (Int_t k =j+1; k < partEvent->GetNumberOfParticles() ; k++)
486 /***************************************/
487 /***** Filling denominators *********/
488 /***************************************/
489 if (fBufferSize == 0) continue;
491 partbuffer.ResetIter();
492 trackbuffer.ResetIter();
494 while (( partEvent2 = partbuffer.Next() ))
496 trackEvent2 = trackbuffer.Next();
499 if ( (j%fDisplayMixingInfo) == 0)
500 Info("ProcessTracksAndParticles",
501 "Mixing particle %d from event %d with particles from event %d",j,i,i-m);
503 for(Int_t l = 0; l<partEvent2->GetNumberOfParticles();l++) // ... on all particles
505 part2= partEvent2->GetParticle(l);
506 partpair->SetParticles(part1,part2);
508 track2= trackEvent2->GetParticle(l);
509 trackpair->SetParticles(track1,track2);
511 if( (this->*fkPass)(partpair,trackpair) ) //check pair cut
512 { //do not meets crietria of the
513 if( (this->*fkPass)((AliHBTPair*)partpair->GetSwappedPair(),(AliHBTPair*)trackpair->GetSwappedPair()) )
517 tmppartpair = (AliHBTPair*)partpair->GetSwappedPair();
518 tmptrackpair = (AliHBTPair*)trackpair->GetSwappedPair();
522 {//meets criteria of the pair cut
523 tmptrackpair = trackpair;
524 tmppartpair = partpair;
527 for(ii = 0;ii<fNParticleFunctions;ii++)
528 fParticleFunctions[ii]->ProcessDiffEventParticles(tmppartpair);
530 for(ii = 0;ii<fNTrackFunctions;ii++)
531 fTrackFunctions[ii]->ProcessDiffEventParticles(tmptrackpair);
533 for(ii = 0;ii<fNParticleAndTrackFunctions;ii++)
534 fParticleAndTrackFunctions[ii]->ProcessDiffEventParticles(tmptrackpair,tmppartpair);
535 }//for(Int_t l = 0; l<N2;l++) // ... on all particles
538 //end of loop over particles from first event
539 }//for (Int_t j = 0; j<partEvent->GetNumberOfParticles() ; j++)
540 partEvent1 = partbuffer.Push(partEvent1);
541 trackEvent1 = trackbuffer.Push(trackEvent1);
542 //end of loop over events
543 }//while (fReader->Next() == kFALSE)
548 partbuffer.SetOwner(kTRUE);
549 trackbuffer.SetOwner(kTRUE);
551 /*************************************************************************************/
553 void AliHBTAnalysis::ProcessTracks()
555 //In order to minimize calling AliRun::GetEvent (we need at one time particles from different events),
556 //the loops are splited
557 AliVAODParticle * track1, * track2;
559 AliAOD * trackEvent1 = 0x0;
560 AliAOD * trackEvent2;
564 AliHBTPair * trackpair = new AliHBTPair();
565 AliHBTPair * tmptrackpair; //temporary pointer
567 AliEventBuffer trackbuffer(fBufferSize);
571 while (fReader->Next() == kFALSE)
574 trackEvent = fReader->GetEventRec();
575 if (!trackEvent) continue;
577 if(trackEvent1 == 0x0)
579 trackEvent1 = new AliAOD();
580 trackEvent1->SetOwner(kTRUE);
584 trackEvent1->Reset();
587 for (Int_t j = 0; j<trackEvent->GetNumberOfParticles() ; j++)
589 /***************************************/
590 /****** Looping same events ********/
591 /****** filling numerators ********/
592 /***************************************/
593 if ( (j%fDisplayMixingInfo) == 0)
594 Info("ProcessTracks",
595 "Mixing particle %d from event %d with particles from event %d",j,i,i);
597 track1= trackEvent->GetParticle(j);
598 Bool_t firstcut = fPairCut->GetFirstPartCut()->Pass(track1);
600 if (fBufferSize != 0)
601 if ( (firstcut == kFALSE) || (fPairCut->GetSecondPartCut()->Pass(track1) == kFALSE) )
603 //accepted by any cut
604 // we have to copy because reader keeps only one event
605 trackEvent1->AddParticle(new AliAODParticle(*track1));
608 if (firstcut) continue;
610 for(ii = 0; ii<fNTrackMonitorFunctions; ii++)
611 fTrackMonitorFunctions[ii]->Process(track1);
613 if ( fNTrackFunctions ==0 ) continue;
615 for (Int_t k =j+1; k < trackEvent->GetNumberOfParticles() ; k++)
617 track2= trackEvent->GetParticle(k);
618 if (track1->GetUID() == track2->GetUID()) continue;
620 trackpair->SetParticles(track1,track2);
621 if(fPairCut->Pass(trackpair)) //check pair cut
622 { //do not meets crietria of the
623 if( fPairCut->Pass((AliHBTPair*)trackpair->GetSwappedPair()) ) continue;
624 else tmptrackpair = (AliHBTPair*)trackpair->GetSwappedPair();
628 tmptrackpair = trackpair;
630 for(ii = 0;ii<fNTrackFunctions;ii++)
631 fTrackFunctions[ii]->ProcessSameEventParticles(tmptrackpair);
633 /***************************************/
634 /***** Filling denominators *********/
635 /***************************************/
637 if (fBufferSize == 0) continue;
639 trackbuffer.ResetIter();
642 while (( trackEvent2 = trackbuffer.Next() ))
645 if ( (j%fDisplayMixingInfo) == 0)
646 Info("ProcessTracks",
647 "Mixing track %d from event %d with tracks from event %d",j,i,i-m);
648 for(Int_t l = 0; l<trackEvent2->GetNumberOfParticles();l++) // ... on all particles
651 track2= trackEvent2->GetParticle(l);
652 trackpair->SetParticles(track1,track2);
654 if( fPairCut->Pass(trackpair) ) //check pair cut
655 { //do not meets crietria of the
656 if( fPairCut->Pass((AliHBTPair*)trackpair->GetSwappedPair()) )
660 tmptrackpair = (AliHBTPair*)trackpair->GetSwappedPair();
664 {//meets criteria of the pair cut
665 tmptrackpair = trackpair;
668 for(ii = 0;ii<fNTrackFunctions;ii++)
669 fTrackFunctions[ii]->ProcessDiffEventParticles(tmptrackpair);
671 }//for(Int_t l = 0; l<N2;l++) // ... on all particles
674 trackEvent1 = trackbuffer.Push(trackEvent1);
675 }//while (fReader->Next() == kFALSE)
678 trackbuffer.SetOwner(kTRUE);
681 /*************************************************************************************/
683 void AliHBTAnalysis::ProcessParticles()
685 //In order to minimize calling AliRun::GetEvent (we need at one time particles from different events),
686 //the loops are splited
687 AliVAODParticle * part1, * part2;
689 AliAOD * partEvent1 = 0x0;
694 AliHBTPair * partpair = new AliHBTPair();
695 AliHBTPair * tmppartpair; //temporary pointer
697 AliEventBuffer partbuffer(fBufferSize);
698 partbuffer.SetOwner(kTRUE);
702 while (fReader->Next() == kFALSE)
705 partEvent = fReader->GetEventSim();
706 if (!partEvent) continue;
708 if(partEvent1 == 0x0)
710 partEvent1 = new AliAOD();
711 partEvent1->SetOwner(kTRUE);
718 for (Int_t j = 0; j<partEvent->GetNumberOfParticles() ; j++)
720 /***************************************/
721 /****** Looping same events ********/
722 /****** filling numerators ********/
723 /***************************************/
724 if ( (j%fDisplayMixingInfo) == 0)
725 Info("ProcessParticles",
726 "Mixing particle %d from event %d with particles from event %d",j,i,i);
728 part1 = partEvent->GetParticle(j);
729 Bool_t firstcut = fPairCut->GetFirstPartCut()->Pass(part1);
731 if (fBufferSize != 0) //useless in case
732 if ( (firstcut == kFALSE) || (fPairCut->GetSecondPartCut()->Pass(part1) == kFALSE) )
734 //accepted by any cut
735 // we have to copy because reader keeps only one event
736 partEvent1->AddParticle(new AliAODParticle(*part1));
739 if (firstcut) continue;
741 for(ii = 0; ii<fNParticleMonitorFunctions; ii++)
742 fParticleMonitorFunctions[ii]->Process(part1);
744 if ( fNParticleFunctions == 0 ) continue;
746 for (Int_t k =j+1; k < partEvent->GetNumberOfParticles() ; k++)
748 part2= partEvent->GetParticle(k);
749 if (part1->GetUID() == part2->GetUID()) continue;
751 partpair->SetParticles(part1,part2);
752 if(fPairCut->Pass(partpair)) //check pair cut
753 { //do not meets crietria of the
754 if( fPairCut->Pass((AliHBTPair*)partpair->GetSwappedPair()) ) continue;
755 else tmppartpair = (AliHBTPair*)partpair->GetSwappedPair();
759 tmppartpair = partpair;
761 for(ii = 0;ii<fNParticleFunctions;ii++)
762 fParticleFunctions[ii]->ProcessSameEventParticles(tmppartpair);
764 /***************************************/
765 /***** Filling denominators *********/
766 /***************************************/
768 if (fBufferSize == 0) continue;
770 partbuffer.ResetIter();
773 while (( partEvent2 = partbuffer.Next() ))
776 if ( (j%fDisplayMixingInfo) == 0)
777 Info("ProcessParticles",
778 "Mixing particle %d from event %d with particles from event %d",j,i,i-m);
779 for(Int_t l = 0; l<partEvent2->GetNumberOfParticles();l++) // ... on all particles
782 part2= partEvent2->GetParticle(l);
783 partpair->SetParticles(part1,part2);
785 if( fPairCut->Pass(partpair) ) //check pair cut
786 { //do not meets crietria of the
787 if( fPairCut->Pass((AliHBTPair*)partpair->GetSwappedPair()) )
791 tmppartpair = (AliHBTPair*)partpair->GetSwappedPair();
795 {//meets criteria of the pair cut
796 tmppartpair = partpair;
799 for(ii = 0;ii<fNParticleFunctions;ii++)
800 fParticleFunctions[ii]->ProcessDiffEventParticles(tmppartpair);
802 }//for(Int_t l = 0; l<N2;l++) // ... on all particles
805 partEvent1 = partbuffer.Push(partEvent1);
806 }//while (fReader->Next() == kFALSE)
808 partbuffer.SetOwner(kTRUE);
810 /*************************************************************************************/
812 void AliHBTAnalysis::WriteFunctions()
814 //Calls Write for all defined functions in analysis
815 //== writes all results
817 for(ii = 0;ii<fNParticleFunctions;ii++)
819 if (AliVAODParticle::GetDebug()>5)
821 Info("WriteFunctions","Writing ParticleFunction %#x",fParticleFunctions[ii]);
822 Info("WriteFunctions","Writing ParticleFunction %s",fParticleFunctions[ii]->Name());
824 fParticleFunctions[ii]->Write();
827 for(ii = 0;ii<fNTrackFunctions;ii++)
829 if (AliVAODParticle::GetDebug()>5)
831 Info("WriteFunctions","Writing TrackFunction %#x",fTrackFunctions[ii]);
832 Info("WriteFunctions","Writing TrackFunction %s",fTrackFunctions[ii]->Name());
834 fTrackFunctions[ii]->Write();
837 for(ii = 0;ii<fNParticleAndTrackFunctions;ii++)
839 if (AliVAODParticle::GetDebug()>5)
841 Info("WriteFunctions","Writing ParticleAndTrackFunction %#x",fParticleAndTrackFunctions[ii]);
842 Info("WriteFunctions","Writing ParticleAndTrackFunction %s",fParticleAndTrackFunctions[ii]->Name());
844 fParticleAndTrackFunctions[ii]->Write();
847 for(ii = 0;ii<fNParticleMonitorFunctions;ii++)
849 if (AliVAODParticle::GetDebug()>5)
851 Info("WriteFunctions","Writing ParticleMonitorFunction %#x",fParticleMonitorFunctions[ii]);
852 Info("WriteFunctions","Writing ParticleMonitorFunction %s",fParticleMonitorFunctions[ii]->Name());
854 fParticleMonitorFunctions[ii]->Write();
857 for(ii = 0;ii<fNTrackMonitorFunctions;ii++)
859 if (AliVAODParticle::GetDebug()>5)
861 Info("WriteFunctions","Writing TrackMonitorFunction %#x",fTrackMonitorFunctions[ii]);
862 Info("WriteFunctions","Writing TrackMonitorFunction %s",fTrackMonitorFunctions[ii]->Name());
864 fTrackMonitorFunctions[ii]->Write();
867 for(ii = 0;ii<fNParticleAndTrackMonitorFunctions;ii++)
869 if (AliVAODParticle::GetDebug()>5)
871 Info("WriteFunctions","Writing ParticleAndTrackMonitorFunction %#x",fParticleAndTrackMonitorFunctions[ii]);
872 Info("WriteFunctions","Writing ParticleAndTrackMonitorFunction %s",fParticleAndTrackMonitorFunctions[ii]->Name());
874 fParticleAndTrackMonitorFunctions[ii]->Write();
877 /*************************************************************************************/
879 void AliHBTAnalysis::SetGlobalPairCut(AliAODPairCut* cut)
881 //Sets the global cut
884 Error("AliHBTAnalysis::SetGlobalPairCut","Pointer is NULL. Ignoring");
887 fPairCut = (AliAODPairCut*)cut->Clone();
890 /*************************************************************************************/
892 void AliHBTAnalysis::AddTrackFunction(AliHBTOnePairFctn* f)
894 //Adds track function
895 if (f == 0x0) return;
896 if (fNTrackFunctions == fgkFctnArraySize)
898 Error("AliHBTAnalysis::AddTrackFunction","Can not add this function, not enough place in the array.");
900 fTrackFunctions[fNTrackFunctions] = f;
903 /*************************************************************************************/
905 void AliHBTAnalysis::AddParticleFunction(AliHBTOnePairFctn* f)
907 //adds particle function
908 if (f == 0x0) return;
910 if (fNParticleFunctions == fgkFctnArraySize)
912 Error("AliHBTAnalysis::AddParticleFunction","Can not add this function, not enough place in the array.");
914 fParticleFunctions[fNParticleFunctions] = f;
915 fNParticleFunctions++;
917 /*************************************************************************************/
919 void AliHBTAnalysis::AddParticleAndTrackFunction(AliHBTTwoPairFctn* f)
921 //add resolution function
922 if (f == 0x0) return;
923 if (fNParticleAndTrackFunctions == fgkFctnArraySize)
925 Error("AliHBTAnalysis::AddParticleAndTrackFunction","Can not add this function, not enough place in the array.");
927 fParticleAndTrackFunctions[fNParticleAndTrackFunctions] = f;
928 fNParticleAndTrackFunctions++;
930 /*************************************************************************************/
932 void AliHBTAnalysis::AddParticleMonitorFunction(AliHBTMonOneParticleFctn* f)
934 //add particle monitoring function
935 if (f == 0x0) return;
937 if (fNParticleMonitorFunctions == fgkFctnArraySize)
939 Error("AliHBTAnalysis::AddParticleMonitorFunction","Can not add this function, not enough place in the array.");
941 fParticleMonitorFunctions[fNParticleMonitorFunctions] = f;
942 fNParticleMonitorFunctions++;
944 /*************************************************************************************/
946 void AliHBTAnalysis::AddTrackMonitorFunction(AliHBTMonOneParticleFctn* f)
948 //add track monitoring function
949 if (f == 0x0) return;
951 if (fNTrackMonitorFunctions == fgkFctnArraySize)
953 Error("AliHBTAnalysis::AddTrackMonitorFunction","Can not add this function, not enough place in the array.");
955 fTrackMonitorFunctions[fNTrackMonitorFunctions] = f;
956 fNTrackMonitorFunctions++;
958 /*************************************************************************************/
960 void AliHBTAnalysis::AddParticleAndTrackMonitorFunction(AliHBTMonTwoParticleFctn* f)
962 //add resolution monitoring function
963 if (f == 0x0) return;
964 if (fNParticleAndTrackMonitorFunctions == fgkFctnArraySize)
966 Error("AliHBTAnalysis::AddParticleAndTrackMonitorFunction","Can not add this function, not enough place in the array.");
968 fParticleAndTrackMonitorFunctions[fNParticleAndTrackMonitorFunctions] = f;
969 fNParticleAndTrackMonitorFunctions++;
973 /*************************************************************************************/
974 /*************************************************************************************/
976 Bool_t AliHBTAnalysis::RunCoherencyCheck()
978 //Checks if both HBTRuns are similar
979 //return true if error found
980 //if they seem to be OK return false
984 Info("RunCoherencyCheck","Checking HBT Runs Coherency");
986 //When we use non-buffering reader this is a big waste of time -> We need to read all data to check it
987 //and reader is implemented safe in this case anyway
988 // Info("RunCoherencyCheck","Number of events ...");
989 // if (fReader->GetNumberOfPartEvents() == fReader->GetNumberOfTrackEvents() ) //check whether there is the same number of events
991 // Info("RunCoherencyCheck","OK. %d found\n",fReader->GetNumberOfTrackEvents());
994 // { //if not the same - ERROR
995 // Error("RunCoherencyCheck",
996 // "Number of simulated events (%d) is not equal to number of reconstructed events(%d)",
997 // fReader->GetNumberOfPartEvents(),fReader->GetNumberOfTrackEvents());
1001 Info("RunCoherencyCheck","Checking number of Particles AND Particles Types in each event ...");
1005 for( i = 0; i<fReader->GetNumberOfTrackEvents();i++)
1007 partEvent= fReader->GetEventSim(i); //gets the "ith" event
1008 trackEvent = fReader->GetEventRec(i);
1010 if ( (partEvent == 0x0) && (partEvent == 0x0) ) continue;
1011 if ( (partEvent == 0x0) || (partEvent == 0x0) )
1013 Error("RunCoherencyCheck",
1014 "One event is NULL and the other one not. Event Number %d",i);
1018 if ( partEvent->GetNumberOfParticles() != trackEvent->GetNumberOfParticles() )
1020 Error("RunCoherencyCheck",
1021 "Event %d: Number of simulated particles (%d) not equal to number of reconstructed tracks (%d)",
1022 i,partEvent->GetNumberOfParticles() , trackEvent->GetNumberOfParticles());
1026 for (Int_t j = 0; j<partEvent->GetNumberOfParticles(); j++)
1028 if( partEvent->GetParticle(j)->GetPdgCode() != trackEvent->GetParticle(j)->GetPdgCode() )
1030 Error("RunCoherencyCheck",
1031 "Event %d: Particle %d: PID of simulated particle (%d) not the same of reconstructed track (%d)",
1032 i,j, partEvent->GetParticle(j)->GetPdgCode(),trackEvent->GetParticle(j)->GetPdgCode() );
1038 Info("RunCoherencyCheck"," Done");
1039 Info("RunCoherencyCheck"," Everything looks OK");
1044 /*************************************************************************************/
1046 void AliHBTAnalysis::ProcessTracksAndParticlesNonIdentAnal()
1048 //Performs analysis for both, tracks and particles
1050 AliVAODParticle * part1, * part2;
1051 AliVAODParticle * track1, * track2;
1053 AliAOD * trackEvent1=0x0,*partEvent1=0x0;
1054 AliAOD * trackEvent2=0x0,*partEvent2=0x0;
1055 AliAOD * trackEvent3=0x0,*partEvent3=0x0;
1057 AliAOD * rawtrackEvent, *rawpartEvent;//this we get from Reader
1059 AliHBTPair * trackpair = new AliHBTPair();
1060 AliHBTPair * partpair = new AliHBTPair();
1062 AliEventBuffer partbuffer(fBufferSize);
1063 AliEventBuffer trackbuffer(fBufferSize);
1067 trackEvent1 = new AliAOD();
1068 partEvent1 = new AliAOD();
1069 trackEvent1->SetOwner(kFALSE);
1070 partEvent1->SetOwner(kFALSE);;
1072 Bool_t nocorrfctns = (fNParticleFunctions == 0) && (fNTrackFunctions == 0) && (fNParticleAndTrackFunctions == 0);
1076 Info("ProcessTracksAndParticlesNonIdentAnal","**************************************");
1077 Info("ProcessTracksAndParticlesNonIdentAnal","***** NON IDENT MODE ****************");
1078 Info("ProcessTracksAndParticlesNonIdentAnal","**************************************");
1080 for (Int_t i = 0;;i++)//infinite loop
1082 if (fReader->Next()) break; //end when no more events available
1084 rawpartEvent = fReader->GetEventSim();
1085 rawtrackEvent = fReader->GetEventRec();
1086 if ( (rawpartEvent == 0x0) || (rawtrackEvent == 0x0) ) continue;//in case of any error
1088 if ( rawpartEvent->GetNumberOfParticles() != rawtrackEvent->GetNumberOfParticles() )
1090 Fatal("ProcessTracksAndParticlesNonIdentAnal",
1091 "Event %d: Number of simulated particles (%d) not equal to number of reconstructed tracks (%d)",
1092 i,rawpartEvent->GetNumberOfParticles() , rawtrackEvent->GetNumberOfParticles());
1096 /********************************/
1098 /********************************/
1099 if ( ( (partEvent2==0x0) || (trackEvent2==0x0)) )//in case fBufferSize == 0 and pointers are created do not eneter
1101 partEvent2 = new AliAOD();
1102 trackEvent2 = new AliAOD();
1103 partEvent2->SetOwner(kTRUE);
1104 trackEvent2->SetOwner(kTRUE);
1107 FilterOut(partEvent1, partEvent2, rawpartEvent, trackEvent1, trackEvent2, rawtrackEvent);
1109 for (Int_t j = 0; j<partEvent1->GetNumberOfParticles() ; j++)
1111 if ( (j%fDisplayMixingInfo) == 0)
1112 Info("ProcessTracksAndParticlesNonIdentAnal",
1113 "Mixing particle %d from event %d with particles from event %d",j,i,i);
1115 part1= partEvent1->GetParticle(j);
1116 track1= trackEvent1->GetParticle(j);
1118 //PID reconstruction imperfections
1119 // if( part1->GetPdgCode() != track1->GetPdgCode() )
1121 // Fatal("ProcessTracksAndParticlesNonIdentAnal",
1122 // "Event %d: Particle %d: PID of simulated particle (%d) not the same of reconstructed track (%d)",
1123 // i,j, part1->GetPdgCode(),track1->GetPdgCode() );
1127 for(ii = 0; ii<fNParticleMonitorFunctions; ii++)
1128 fParticleMonitorFunctions[ii]->Process(part1);
1129 for(ii = 0; ii<fNTrackMonitorFunctions; ii++)
1130 fTrackMonitorFunctions[ii]->Process(track1);
1131 for(ii = 0; ii<fNParticleAndTrackMonitorFunctions; ii++)
1132 fParticleAndTrackMonitorFunctions[ii]->Process(track1,part1);
1134 if (nocorrfctns) continue;
1136 /***************************************/
1137 /****** filling numerators ********/
1138 /****** (particles from event2) ********/
1139 /***************************************/
1141 for (Int_t k = 0; k < partEvent2->GetNumberOfParticles() ; k++) //partEvent1 and partEvent2 are particles from the same event but separated to two groups
1143 part2= partEvent2->GetParticle(k);
1144 if (part1->GetUID() == part2->GetUID()) continue;//this is the same particle but with different PID
1145 partpair->SetParticles(part1,part2);
1147 track2= trackEvent2->GetParticle(k);
1148 trackpair->SetParticles(track1,track2);
1150 if( (this->*fkPassPairProp)(partpair,trackpair) ) //check pair cut
1151 { //do not meets crietria of the pair cut
1155 {//meets criteria of the pair cut
1156 for(ii = 0;ii<fNParticleFunctions;ii++)
1157 fParticleFunctions[ii]->ProcessSameEventParticles(partpair);
1159 for(ii = 0;ii<fNTrackFunctions;ii++)
1160 fTrackFunctions[ii]->ProcessSameEventParticles(trackpair);
1162 for(ii = 0;ii<fNParticleAndTrackFunctions;ii++)
1163 fParticleAndTrackFunctions[ii]->ProcessSameEventParticles(trackpair,partpair);
1167 if ( fBufferSize == 0) continue;//do not mix diff histograms
1168 /***************************************/
1169 /***** Filling denominators *********/
1170 /***************************************/
1171 partbuffer.ResetIter();
1172 trackbuffer.ResetIter();
1176 while ( (partEvent3 = partbuffer.Next() ) != 0x0)
1178 trackEvent3 = trackbuffer.Next();
1180 if ( (j%fDisplayMixingInfo) == 0)
1181 Info("ProcessTracksAndParticlesNonIdentAnal",
1182 "Mixing particle %d from event %d with particles from event %d",j,i,i-(++nmonitor));
1184 for (Int_t k = 0; k < partEvent3->GetNumberOfParticles() ; k++)
1186 part2= partEvent3->GetParticle(k);
1187 partpair->SetParticles(part1,part2);
1189 track2= trackEvent3->GetParticle(k);
1190 trackpair->SetParticles(track1,track2);
1192 if( (this->*fkPassPairProp)(partpair,trackpair) ) //check pair cut
1193 { //do not meets crietria of the pair cut
1197 {//meets criteria of the pair cut
1199 for(ii = 0;ii<fNParticleFunctions;ii++)
1200 fParticleFunctions[ii]->ProcessDiffEventParticles(partpair);
1202 for(ii = 0;ii<fNTrackFunctions;ii++)
1203 fTrackFunctions[ii]->ProcessDiffEventParticles(trackpair);
1205 for(ii = 0;ii<fNParticleAndTrackFunctions;ii++)
1206 fParticleAndTrackFunctions[ii]->ProcessDiffEventParticles(trackpair,partpair);
1208 }// for particles event2
1210 }//for over particles in event1
1212 partEvent2 = partbuffer.Push(partEvent2);
1213 trackEvent2 = trackbuffer.Push(trackEvent2);
1215 }//end of loop over events (1)
1217 partbuffer.SetOwner(kTRUE);
1218 trackbuffer.SetOwner(kTRUE);
1228 /*************************************************************************************/
1230 void AliHBTAnalysis::ProcessTracksNonIdentAnal()
1232 //Process Tracks only with non identical mode
1233 AliVAODParticle * track1, * track2;
1235 AliAOD * trackEvent1=0x0;
1236 AliAOD * trackEvent2=0x0;
1237 AliAOD * trackEvent3=0x0;
1239 AliAOD * rawtrackEvent;
1241 AliHBTPair * trackpair = new AliHBTPair();
1242 AliEventBuffer trackbuffer(fBufferSize);
1246 trackEvent1 = new AliAOD();
1247 trackEvent1->SetOwner(kFALSE);
1251 Info("ProcessTracksNonIdentAnal","**************************************");
1252 Info("ProcessTracksNonIdentAnal","***** NON IDENT MODE ****************");
1253 Info("ProcessTracksNonIdentAnal","**************************************");
1256 for (Int_t i = 0;;i++)//infinite loop
1258 if (fReader->Next()) break; //end when no more events available
1259 rawtrackEvent = fReader->GetEventRec();
1261 if (rawtrackEvent == 0x0) continue;//in case of any error
1263 /********************************/
1265 /********************************/
1266 if ( trackEvent2==0x0 )//in case fBufferSize == 0 and pointers are created do not eneter
1268 trackEvent2 = new AliAOD();
1269 trackEvent2->SetOwner(kTRUE);
1272 FilterOut(trackEvent1, trackEvent2, rawtrackEvent);
1274 for (Int_t j = 0; j<trackEvent1->GetNumberOfParticles() ; j++)
1276 if ( (j%fDisplayMixingInfo) == 0)
1277 Info("ProcessTracksNonIdentAnal",
1278 "Mixing particle %d from event %d with particles from event %d",j,i,i);
1280 track1= trackEvent1->GetParticle(j);
1282 for(ii = 0; ii<fNTrackMonitorFunctions; ii++)
1283 fTrackMonitorFunctions[ii]->Process(track1);
1285 if (fNTrackFunctions == 0x0) continue;
1287 /***************************************/
1288 /****** filling numerators ********/
1289 /****** (particles from event2) ********/
1290 /***************************************/
1291 for (Int_t k = 0; k < trackEvent2->GetNumberOfParticles() ; k++)
1293 track2= trackEvent2->GetParticle(k);
1294 if (track1->GetUID() == track2->GetUID()) continue;//this is the same particle but with different PID
1295 trackpair->SetParticles(track1,track2);
1298 if( fPairCut->PassPairProp(trackpair)) //check pair cut
1299 { //do not meets crietria of the pair cut
1303 {//meets criteria of the pair cut
1305 for(ii = 0;ii<fNTrackFunctions;ii++)
1306 fTrackFunctions[ii]->ProcessSameEventParticles(trackpair);
1309 if ( fBufferSize == 0) continue;//do not mix diff histograms
1310 /***************************************/
1311 /***** Filling denominators *********/
1312 /***************************************/
1313 trackbuffer.ResetIter();
1316 while ( (trackEvent3 = trackbuffer.Next() ) != 0x0)
1319 if ( (j%fDisplayMixingInfo) == 0)
1320 Info("ProcessTracksNonIdentAnal",
1321 "Mixing particle %d from event %d with particles from event %d",j,i,i-(++nmonitor));
1323 for (Int_t k = 0; k < trackEvent3->GetNumberOfParticles() ; k++)
1326 track2= trackEvent3->GetParticle(k);
1327 trackpair->SetParticles(track1,track2);
1330 if( fPairCut->PassPairProp(trackpair)) //check pair cut
1331 { //do not meets crietria of the pair cut
1335 {//meets criteria of the pair cut
1336 for(ii = 0;ii<fNTrackFunctions;ii++)
1337 fTrackFunctions[ii]->ProcessDiffEventParticles(trackpair);
1339 }// for particles event2
1341 }//for over particles in event1
1343 trackEvent2 = trackbuffer.Push(trackEvent2);
1345 }//end of loop over events (1)
1347 trackbuffer.SetOwner(kTRUE);
1352 /*************************************************************************************/
1354 void AliHBTAnalysis::ProcessParticlesNonIdentAnal()
1356 //process paricles only with non identical mode
1357 AliVAODParticle * part1 = 0x0, * part2 = 0x0;
1359 AliAOD * partEvent1 = 0x0;
1360 AliAOD * partEvent2 = 0x0;
1361 AliAOD * partEvent3 = 0x0;
1363 AliAOD * rawpartEvent = 0x0;
1365 AliHBTPair * partpair = new AliHBTPair();
1366 AliEventBuffer partbuffer(fBufferSize);
1370 partEvent1 = new AliAOD();
1371 partEvent1->SetOwner(kFALSE);
1375 Info("ProcessParticlesNonIdentAnal","**************************************");
1376 Info("ProcessParticlesNonIdentAnal","***** NON IDENT MODE ****************");
1377 Info("ProcessParticlesNonIdentAnal","**************************************");
1379 for (Int_t i = 0;;i++)//infinite loop
1381 if (fReader->Next()) break; //end when no more events available
1383 rawpartEvent = fReader->GetEventSim();
1384 if ( rawpartEvent == 0x0 ) continue;//in case of any error
1386 /********************************/
1388 /********************************/
1389 if (partEvent2==0x0)//in case fBufferSize == 0 and pointers are created do not eneter
1391 partEvent2 = new AliAOD();
1392 partEvent2->SetOwner(kTRUE);
1395 FilterOut(partEvent1, partEvent2, rawpartEvent);
1397 for (Int_t j = 0; j<partEvent1->GetNumberOfParticles() ; j++)
1399 if ( (j%fDisplayMixingInfo) == 0)
1400 Info("ProcessParticlesNonIdentAnal",
1401 "Mixing particle %d from event %d with particles from event %d",j,i,i);
1403 part1= partEvent1->GetParticle(j);
1405 for(ii = 0; ii<fNParticleMonitorFunctions; ii++)
1406 fParticleMonitorFunctions[ii]->Process(part1);
1408 if (fNParticleFunctions == 0) continue;
1410 /***************************************/
1411 /****** filling numerators ********/
1412 /****** (particles from event2) ********/
1413 /***************************************/
1414 for (Int_t k = 0; k < partEvent2->GetNumberOfParticles() ; k++)
1416 part2= partEvent2->GetParticle(k);
1417 if (part1->GetUID() == part2->GetUID()) continue;//this is the same particle but with different PID
1418 partpair->SetParticles(part1,part2);
1420 if(fPairCut->PassPairProp(partpair) ) //check pair cut
1421 { //do not meets crietria of the pair cut
1425 {//meets criteria of the pair cut
1426 for(ii = 0;ii<fNParticleFunctions;ii++)
1427 fParticleFunctions[ii]->ProcessSameEventParticles(partpair);
1430 if ( fBufferSize == 0) continue;//do not mix diff histograms
1431 /***************************************/
1432 /***** Filling denominators *********/
1433 /***************************************/
1434 partbuffer.ResetIter();
1437 while ( (partEvent3 = partbuffer.Next() ) != 0x0)
1439 if ( (j%fDisplayMixingInfo) == 0)
1440 Info("ProcessParticlesNonIdentAnal",
1441 "Mixing particle %d from event %d with particles from event %d",j,i,i-(++nmonitor));
1443 for (Int_t k = 0; k < partEvent3->GetNumberOfParticles() ; k++)
1445 part2= partEvent3->GetParticle(k);
1446 partpair->SetParticles(part1,part2);
1448 if(fPairCut->PassPairProp(partpair) ) //check pair cut
1449 { //do not meets crietria of the pair cut
1453 {//meets criteria of the pair cut
1454 for(ii = 0;ii<fNParticleFunctions;ii++)
1456 fParticleFunctions[ii]->ProcessDiffEventParticles(partpair);
1459 }// for particles event2
1461 }//for over particles in event1
1462 partEvent2 = partbuffer.Push(partEvent2);
1463 }//end of loop over events (1)
1465 partbuffer.SetOwner(kTRUE);
1471 /*************************************************************************************/
1472 void AliHBTAnalysis::FilterOut(AliAOD* outpart1, AliAOD* outpart2, AliAOD* inpart,
1473 AliAOD* outtrack1, AliAOD* outtrack2, AliAOD* intrack) const
1475 //Puts particles accepted as a first particle by global cut in out1
1476 //and as a second particle in out2
1478 AliVAODParticle* part, *track;
1487 for (Int_t i = 0; i < inpart->GetNumberOfParticles(); i++)
1490 part = inpart->GetParticle(i);
1491 track = intrack->GetParticle(i);
1493 if ( ((this->*fkPass1)(part,track)) ) in1 = kFALSE; //if part is rejected by cut1, in1 is false
1494 if ( ((this->*fkPass2)(part,track)) ) in2 = kFALSE; //if part is rejected by cut2, in2 is false
1496 if (gDebug)//to be removed in real analysis
1497 if ( in1 && in2 ) //both cuts accepted, should never happen, just in case
1499 //Particle accpted by both cuts
1500 Error("FilterOut","Particle accepted by both cuts");
1506 outpart1->AddParticle(part);
1507 outtrack1->AddParticle(track);
1513 outpart2->AddParticle(new AliAODParticle(*part));
1514 outtrack2->AddParticle(new AliAODParticle(*track));
1519 /*************************************************************************************/
1521 void AliHBTAnalysis::FilterOut(AliAOD* out1, AliAOD* out2, AliAOD* in) const
1523 //Puts particles accepted as a first particle by global cut in out1
1524 //and as a second particle in out2
1525 AliVAODParticle* part;
1530 AliAODParticleCut *cut1 = fPairCut->GetFirstPartCut();
1531 AliAODParticleCut *cut2 = fPairCut->GetSecondPartCut();
1535 for (Int_t i = 0; i < in->GetNumberOfParticles(); i++)
1538 part = in->GetParticle(i);
1540 if ( cut1->Pass(part) ) in1 = kFALSE; //if part is rejected by cut1, in1 is false
1541 if ( cut2->Pass(part) ) in2 = kFALSE; //if part is rejected by cut2, in2 is false
1543 if (gDebug)//to be removed in real analysis
1544 if ( in1 && in2 ) //both cuts accepted, should never happen, just in case
1546 //Particle accpted by both cuts
1547 Error("FilterOut","Particle accepted by both cuts");
1553 out1->AddParticle(part);
1559 out2->AddParticle(part);
1564 /*************************************************************************************/
1566 Bool_t AliHBTAnalysis::IsNonIdentAnalysis()
1568 //checks if it is possible to use special analysis for non identical particles
1569 //it means - in global pair cut first particle id is different than second one
1570 //and both are different from 0
1571 //in the future is possible to perform more sophisticated check
1572 //if cuts have excluding requirements
1574 if (fPairCut->IsEmpty())
1577 if (fPairCut->GetFirstPartCut()->IsEmpty())
1580 if (fPairCut->GetSecondPartCut()->IsEmpty())
1583 Int_t id1 = fPairCut->GetFirstPartCut()->GetPID();
1584 Int_t id2 = fPairCut->GetSecondPartCut()->GetPID();
1586 if ( (id1==0) || (id2==0) || (id1==id2) )
1591 /*************************************************************************************/
1593 void AliHBTAnalysis::SetCutsOnParticles()
1595 // -- aplies only to Process("TracksAndParticles")
1596 // (ProcessTracksAndParticles and ProcessTracksAndParticlesNonIdentAnal)
1597 // Only particles properties are checkes against cuts
1598 fkPass = &AliHBTAnalysis::PassPart;
1599 fkPass1 = &AliHBTAnalysis::PassPart1;
1600 fkPass2 = &AliHBTAnalysis::PassPart2;
1601 fkPassPairProp = &AliHBTAnalysis::PassPairPropPart;
1604 /*************************************************************************************/
1606 void AliHBTAnalysis::SetCutsOnTracks()
1608 // -- aplies only to Process("TracksAndParticles")
1609 // (ProcessTracksAndParticles and ProcessTracksAndParticlesNonIdentAnal)
1610 // Only tracks properties are checkes against cuts
1611 fkPass = &AliHBTAnalysis::PassTrack;
1612 fkPass1 = &AliHBTAnalysis::PassTrack1;
1613 fkPass2 = &AliHBTAnalysis::PassTrack2;
1614 fkPassPairProp = &AliHBTAnalysis::PassPairPropTrack;
1617 /*************************************************************************************/
1619 void AliHBTAnalysis::SetCutsOnTracksAndParticles()
1621 // -- aplies only to Process("TracksAndParticles")
1622 // (ProcessTracksAndParticles and ProcessTracksAndParticlesNonIdentAnal)
1623 // Both, tracks and particles, properties are checked against cuts
1624 fkPass = &AliHBTAnalysis::PassPartAndTrack;
1625 fkPass1 = &AliHBTAnalysis::PassPartAndTrack1;
1626 fkPass2 = &AliHBTAnalysis::PassPartAndTrack2;
1627 fkPassPairProp = &AliHBTAnalysis::PassPairPropPartAndTrack;
1629 /*************************************************************************************/
1631 void AliHBTAnalysis::PressAnyKey()
1633 //small utility function that helps to make comfortable macros
1636 fcntl(0, F_SETFL, O_NONBLOCK);
1637 ::Info("","Press Any Key to continue ...");
1640 nread = read(0, &c, 1);
1641 gSystem->ProcessEvents();
1645 /*************************************************************************************/