]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HBTAN/AliHBTAnalysis.cxx
Move to AOD/ESD schema - ITS readers not needed any more
[u/mrichter/AliRoot.git] / HBTAN / AliHBTAnalysis.cxx
CommitLineData
0aca58be 1#include "AliHBTAnalysis.h"
bfb09ece 2//_________________________________________________________
3////////////////////////////////////////////////////////////////////////////
4//
5// class AliHBTAnalysis
6//
7// Central Object Of HBTAnalyser:
8// This class performs main looping within HBT Analysis
78d7c6d3 9// User must plug a reader of Type AliReader
bfb09ece 10// User plugs in coorelation and monitor functions
11// as well as monitor functions
12//
13// HBT Analysis Tool, which is integral part of AliRoot,
14// ALICE Off-Line framework:
15//
16// Piotr.Skowronski@cern.ch
17// more info: http://alisoft.cern.ch/people/skowron/analyzer/index.html
18//
19////////////////////////////////////////////////////////////////////////////
20//_________________________________________________________
21
78d7c6d3 22
23#include "AliAOD.h"
24#include "AliAODParticle.h"
25#include "AliAODPairCut.h"
26
27#include "AliEventBuffer.h"
28
29#include "AliReader.h"
1b446896 30#include "AliHBTPair.h"
1b446896 31#include "AliHBTFunction.h"
5c58441a 32#include "AliHBTMonitorFunction.h"
81b7b887 33
9616170a 34#include <TSystem.h>
e4f2b1da 35
1b446896 36ClassImp(AliHBTAnalysis)
37
38const UInt_t AliHBTAnalysis::fgkFctnArraySize = 100;
81b7b887 39const UInt_t AliHBTAnalysis::fgkDefaultMixingInfo = 1000;
40const Int_t AliHBTAnalysis::fgkDefaultBufferSize = 5;
41
42AliHBTAnalysis::AliHBTAnalysis():
2dc7203b 43 fReader(0x0),
44 fNTrackFunctions(0),
45 fNParticleFunctions(0),
46 fNParticleAndTrackFunctions(0),
47 fNTrackMonitorFunctions(0),
48 fNParticleMonitorFunctions(0),
49 fNParticleAndTrackMonitorFunctions(0),
9616170a 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]),
78d7c6d3 56 fPairCut(new AliAODEmptyPairCut()),//empty cut - accepts all particles
2dc7203b 57 fBufferSize(2),
58 fDisplayMixingInfo(fgkDefaultMixingInfo),
66d1d1a4 59 fIsOwner(kFALSE),
17d74b37 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)
1b446896 64 {
9616170a 65 //default constructor
66d1d1a4 66
1b446896 67 }
491d1b5d 68/*************************************************************************************/
1b446896 69
81b7b887 70AliHBTAnalysis::AliHBTAnalysis(const AliHBTAnalysis& in):
78d7c6d3 71 AliAnalysis(in),
2dc7203b 72 fReader(0x0),
73 fNTrackFunctions(0),
74 fNParticleFunctions(0),
75 fNParticleAndTrackFunctions(0),
76 fNTrackMonitorFunctions(0),
77 fNParticleMonitorFunctions(0),
78 fNParticleAndTrackMonitorFunctions(0),
79 fTrackFunctions(0x0),
80 fParticleFunctions(0x0),
81 fParticleAndTrackFunctions(0x0),
82 fParticleMonitorFunctions(0x0),
83 fTrackMonitorFunctions(0x0),
84 fParticleAndTrackMonitorFunctions(0x0),
85 fPairCut(0x0),
86 fBufferSize(fgkDefaultBufferSize),
87 fDisplayMixingInfo(fgkDefaultMixingInfo),
66d1d1a4 88 fIsOwner(kFALSE),
17d74b37 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)
81b7b887 93 {
2dc7203b 94//copy constructor
81b7b887 95 Fatal("AliHBTAnalysis(const AliHBTAnalysis&)","Sensless");
96 }
97/*************************************************************************************/
34914285 98AliHBTAnalysis& AliHBTAnalysis::operator=(const AliHBTAnalysis& /*right*/)
81b7b887 99 {
2dc7203b 100//operator =
81b7b887 101 Fatal("AliHBTAnalysis(const AliHBTAnalysis&)","Sensless");
102 return *this;
103 }
104/*************************************************************************************/
1b446896 105AliHBTAnalysis::~AliHBTAnalysis()
106 {
107 //destructor
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
e7a04795 111
112 if (fIsOwner)
113 {
78d7c6d3 114 if (AliVAODParticle::GetDebug()>5)Info("~AliHBTAnalysis","Is Owner: Attempting to delete functions");
e7a04795 115 DeleteFunctions();
78d7c6d3 116 if (AliVAODParticle::GetDebug()>5)Info("~AliHBTAnalysis","Delete functions done");
e7a04795 117 }
1b446896 118 delete [] fTrackFunctions;
119 delete [] fParticleFunctions;
120 delete [] fParticleAndTrackFunctions;
121
5c58441a 122 delete [] fParticleMonitorFunctions;
123 delete [] fTrackMonitorFunctions;
124 delete [] fParticleAndTrackMonitorFunctions;
125
1b446896 126 delete fPairCut; // always have an copy of an object - we create we dstroy
127 }
128
129/*************************************************************************************/
78d7c6d3 130Int_t AliHBTAnalysis::ProcessEvent(AliAOD* aodrec, AliAOD* aodsim)
131{
132 //Processes one event
133 if (aodrec == 0x0)
134 {
135 Error("ProcessEvent","Reconstructed AOD is NULL");
136 return 1;
137 }
138
139 if (aodsim == 0x0)
140 {
141 Error("ProcessEvent","Simulated AOD is NULL");
142 return 2;
143 }
144
145 return 0;
146}
147/*************************************************************************************/
148
149Int_t AliHBTAnalysis::Finish()
150{
151 WriteFunctions();
152 return 1;
153}
154/*************************************************************************************/
e4f2b1da 155
81b7b887 156void AliHBTAnalysis::DeleteFunctions()
157{
e4f2b1da 158 //Deletes all functions added to analysis
81b7b887 159 UInt_t ii;
160 for(ii = 0;ii<fNParticleFunctions;ii++)
e7a04795 161 {
78d7c6d3 162 if (AliVAODParticle::GetDebug()>5)
90520373 163 {
164 Info("DeleteFunctions","Deleting ParticleFunction %#x",fParticleFunctions[ii]);
165 Info("DeleteFunctions","Deleting ParticleFunction %s",fParticleFunctions[ii]->Name());
166 }
e7a04795 167 delete fParticleFunctions[ii];
168 }
e4f2b1da 169 fNParticleFunctions = 0;
81b7b887 170
171 for(ii = 0;ii<fNTrackFunctions;ii++)
e7a04795 172 {
78d7c6d3 173 if (AliVAODParticle::GetDebug()>5)
e7a04795 174 {
90520373 175 Info("DeleteFunctions","Deleting TrackFunction %#x",fTrackFunctions[ii]);
176 Info("DeleteFunctions","Deleting TrackFunction %s",fTrackFunctions[ii]->Name());
e7a04795 177 }
178 delete fTrackFunctions[ii];
179 }
e4f2b1da 180 fNTrackFunctions = 0;
181
81b7b887 182 for(ii = 0;ii<fNParticleAndTrackFunctions;ii++)
e7a04795 183 {
78d7c6d3 184 if (AliVAODParticle::GetDebug()>5)
90520373 185 {
186 Info("DeleteFunctions","Deleting ParticleAndTrackFunction %#x",fParticleAndTrackFunctions[ii]);
187 Info("DeleteFunctions","Deleting ParticleAndTrackFunction %s",fParticleAndTrackFunctions[ii]->Name());
188 }
e7a04795 189 delete fParticleAndTrackFunctions[ii];
190 }
e4f2b1da 191 fNParticleAndTrackFunctions = 0;
81b7b887 192
193 for(ii = 0; ii<fNParticleMonitorFunctions; ii++)
e7a04795 194 {
78d7c6d3 195 if (AliVAODParticle::GetDebug()>5)
90520373 196 {
197 Info("DeleteFunctions","Deleting ParticleMonitorFunction %#x",fParticleMonitorFunctions[ii]);
198 Info("DeleteFunctions","Deleting ParticleMonitorFunction %s",fParticleMonitorFunctions[ii]->Name());
199 }
e7a04795 200 delete fParticleMonitorFunctions[ii];
201 }
e4f2b1da 202 fNParticleMonitorFunctions = 0;
81b7b887 203
204 for(ii = 0; ii<fNTrackMonitorFunctions; ii++)
e7a04795 205 {
78d7c6d3 206 if (AliVAODParticle::GetDebug()>5)
90520373 207 {
208 Info("DeleteFunctions","Deleting TrackMonitorFunction %#x",fTrackMonitorFunctions[ii]);
209 Info("DeleteFunctions","Deleting TrackMonitorFunction %s",fTrackMonitorFunctions[ii]->Name());
210 }
e7a04795 211 delete fTrackMonitorFunctions[ii];
212 }
e4f2b1da 213 fNTrackMonitorFunctions = 0;
81b7b887 214
215 for(ii = 0; ii<fNParticleAndTrackMonitorFunctions; ii++)
e7a04795 216 {
78d7c6d3 217 if (AliVAODParticle::GetDebug()>5)
90520373 218 {
219 Info("DeleteFunctions","Deleting ParticleAndTrackMonitorFunction %#x",fParticleAndTrackMonitorFunctions[ii]);
220 Info("DeleteFunctions","Deleting ParticleAndTrackMonitorFunction %s",fParticleAndTrackMonitorFunctions[ii]->Name());
221 }
e7a04795 222 delete fParticleAndTrackMonitorFunctions[ii];
223 }
e4f2b1da 224 fNParticleAndTrackMonitorFunctions = 0;
bfb09ece 225
81b7b887 226}
e4f2b1da 227/*************************************************************************************/
228
78d7c6d3 229Int_t AliHBTAnalysis::Init()
e4f2b1da 230{
2dc7203b 231//Initializeation method
232//calls Init for all functions
e4f2b1da 233 UInt_t ii;
234 for(ii = 0;ii<fNParticleFunctions;ii++)
235 fParticleFunctions[ii]->Init();
236
237 for(ii = 0;ii<fNTrackFunctions;ii++)
238 fTrackFunctions[ii]->Init();
239
240 for(ii = 0;ii<fNParticleAndTrackFunctions;ii++)
241 fParticleAndTrackFunctions[ii]->Init();
242
243 for(ii = 0; ii<fNParticleMonitorFunctions; ii++)
244 fParticleMonitorFunctions[ii]->Init();
245
246 for(ii = 0; ii<fNTrackMonitorFunctions; ii++)
247 fTrackMonitorFunctions[ii]->Init();
248
249 for(ii = 0; ii<fNParticleAndTrackMonitorFunctions; ii++)
250 fParticleAndTrackMonitorFunctions[ii]->Init();
bfb09ece 251
78d7c6d3 252 return 0;
e4f2b1da 253}
254/*************************************************************************************/
255
256void AliHBTAnalysis::ResetFunctions()
257{
258//In case fOwner is true, deletes all functions
259//in other case, just set number of analysis to 0
260 if (fIsOwner) DeleteFunctions();
261 else
262 {
263 fNParticleFunctions = 0;
264 fNTrackFunctions = 0;
265 fNParticleAndTrackFunctions = 0;
266 fNParticleMonitorFunctions = 0;
267 fNTrackMonitorFunctions = 0;
268 fNParticleAndTrackMonitorFunctions = 0;
269 }
270}
271/*************************************************************************************/
272
1b446896 273void AliHBTAnalysis::Process(Option_t* option)
274{
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
282 //
283 // METHOD OPTION
284 //--------------------------------------------------------------------
285 //ProcessTracksAndParticles - "TracksAndParticles"
286 // DEFAULT
287 // it loops over both, tracks(reconstructed) and particles(simulated)
288 // all function gethered in all 3 lists are called for each (double)pair
289 //
290 //ProcessTracks - "Tracks"
291 // it loops only on tracks(reconstructed),
292 // functions ONLY from fTrackFunctions list are called
293 //
294 //ProcessParticles - "Particles"
295 // it loops only on particles(simulated),
296 // functions ONLY from fParticleAndTrackFunctions list are called
297 //
298 //
299 if (!fReader)
300 {
01725374 301 Error("Process","The reader is not set");
1b446896 302 return;
303 }
304
1b446896 305 const char *oT = strstr(option,"Tracks");
306 const char *oP = strstr(option,"Particles");
307
dc2c3f36 308 Bool_t nonid = IsNonIdentAnalysis();
309
bed069a4 310 Init();
311
1b446896 312 if(oT && oP)
313 {
dc2c3f36 314 if (nonid) ProcessTracksAndParticlesNonIdentAnal();
315 else ProcessTracksAndParticles();
1b446896 316 return;
317 }
318
319 if(oT)
320 {
dc2c3f36 321 if (nonid) ProcessTracksNonIdentAnal();
322 else ProcessTracks();
1b446896 323 return;
324 }
325
326 if(oP)
327 {
dc2c3f36 328 if (nonid) ProcessParticlesNonIdentAnal();
329 else ProcessParticles();
1b446896 330 return;
331 }
332
333}
1b446896 334/*************************************************************************************/
491d1b5d 335
1b446896 336void AliHBTAnalysis::ProcessTracksAndParticles()
337{
9616170a 338//Makes analysis for both tracks and particles
339//mainly for resolution study and analysies with weighting algirithms
1b446896 340//In order to minimize calling AliRun::GetEvent (we need at one time particles from different events),
341//the loops are splited
342
66d1d1a4 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
1b446896 346
78d7c6d3 347 AliVAODParticle * part1, * part2;
348 AliVAODParticle * track1, * track2;
1b446896 349
78d7c6d3 350 AliAOD * trackEvent, *partEvent;
351 AliAOD * trackEvent1 = 0x0,*partEvent1 = 0x0;
352 AliAOD * trackEvent2,*partEvent2;
1b446896 353
354// Int_t N1, N2, N=0; //number of particles in current event(we prcess two events in one time)
355
bed069a4 356// Int_t nev = fReader->GetNumberOfTrackEvents();
1b446896 357 AliHBTPair * trackpair = new AliHBTPair();
358 AliHBTPair * partpair = new AliHBTPair();
491d1b5d 359
360 AliHBTPair * tmptrackpair;//temprary pointers to pairs
361 AliHBTPair * tmppartpair;
81b7b887 362
78d7c6d3 363 AliEventBuffer partbuffer(fBufferSize);
364 AliEventBuffer trackbuffer(fBufferSize);
bed069a4 365
81b7b887 366 register UInt_t ii;
7a2c8238 367
bed069a4 368 Bool_t nocorrfctns = (fNParticleFunctions == 0) && (fNTrackFunctions == 0) && (fNParticleAndTrackFunctions == 0);
369
370 fReader->Rewind();
371 Int_t i = -1;
372 while (fReader->Next() == kFALSE)
1b446896 373 {
bed069a4 374 i++;
78d7c6d3 375 partEvent= fReader->GetEventSim();
376 trackEvent = fReader->GetEventRec();
1b446896 377
bed069a4 378 if ( !partEvent || !trackEvent )
379 {
380 Error("ProcessTracksAndParticles","Can not get event");
381 return;
382 }
383
384 if ( partEvent->GetNumberOfParticles() != trackEvent->GetNumberOfParticles() )
385 {
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());
389 return;
390 }
1b446896 391
bed069a4 392 if(partEvent1 == 0x0)
1b446896 393 {
78d7c6d3 394 partEvent1 = new AliAOD();
bed069a4 395 partEvent1->SetOwner(kTRUE);
81b7b887 396
78d7c6d3 397 trackEvent1 = new AliAOD();
bed069a4 398 trackEvent1->SetOwner(kTRUE);
399 }
400 else
401 {
402 partEvent1->Reset();
403 trackEvent1->Reset();
404 }
405
406 for (Int_t j = 0; j<partEvent->GetNumberOfParticles() ; j++)
407 {
408 /***************************************/
409 /****** Looping same events ********/
410 /****** filling numerators ********/
411 /***************************************/
412 if ( (j%fDisplayMixingInfo) == 0)
81b7b887 413 Info("ProcessTracksAndParticles",
414 "Mixing particle %d from event %d with particles from event %d",j,i,i);
1b446896 415
416 part1= partEvent->GetParticle(j);
bed069a4 417 track1= trackEvent->GetParticle(j);
4d91c73a 418
419//PID imperfections ???
420// if( part1->GetPdgCode() != track1->GetPdgCode() )
421// {
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() );
425// return;
426// }
bed069a4 427
17d74b37 428 Bool_t firstcut = (this->*fkPass1)(part1,track1);
9277d10a 429 if (fBufferSize != 0)
17d74b37 430 if ( (firstcut == kFALSE) || ( (this->*fkPass2)(part1,track1) == kFALSE ) )
47d9a058 431 {
432 //accepted by any cut
433 // we have to copy because reader keeps only one event
434
78d7c6d3 435 partEvent1->AddParticle(new AliAODParticle(*part1));
436 trackEvent1->AddParticle(new AliAODParticle(*track1));
47d9a058 437 }
81b7b887 438
bed069a4 439 if (firstcut) continue;
440
81b7b887 441 for(ii = 0; ii<fNParticleMonitorFunctions; ii++)
e4f2b1da 442 fParticleMonitorFunctions[ii]->Process(part1);
81b7b887 443 for(ii = 0; ii<fNTrackMonitorFunctions; ii++)
e4f2b1da 444 fTrackMonitorFunctions[ii]->Process(track1);
81b7b887 445 for(ii = 0; ii<fNParticleAndTrackMonitorFunctions; ii++)
e4f2b1da 446 fParticleAndTrackMonitorFunctions[ii]->Process(track1,part1);
5c58441a 447
bed069a4 448 if (nocorrfctns) continue;
5c58441a 449
1b446896 450 for (Int_t k =j+1; k < partEvent->GetNumberOfParticles() ; k++)
451 {
452 part2= partEvent->GetParticle(k);
d74e6a27 453 if (part1->GetUID() == part2->GetUID()) continue;
1b446896 454 partpair->SetParticles(part1,part2);
455
4d91c73a 456 track2= trackEvent->GetParticle(k);
1b446896 457 trackpair->SetParticles(track1,track2);
458
17d74b37 459 if( (this->*fkPass)(partpair,trackpair) ) //check pair cut
bed069a4 460 { //do not meets crietria of the pair cut, try with swapped pairs
78d7c6d3 461 if( (this->*fkPass)((AliHBTPair*)partpair->GetSwappedPair(),(AliHBTPair*)trackpair->GetSwappedPair()) )
1b446896 462 continue; //swaped pairs do not meet criteria of pair cut as well, take next particle
463 else
bed069a4 464 { //swaped pair meets all the criteria
78d7c6d3 465 tmppartpair = (AliHBTPair*)partpair->GetSwappedPair();
466 tmptrackpair = (AliHBTPair*)trackpair->GetSwappedPair();
1b446896 467 }
468 }
491d1b5d 469 else
470 {//meets criteria of the pair cut
471 tmptrackpair = trackpair;
472 tmppartpair = partpair;
473 }
9616170a 474
1b446896 475 for(ii = 0;ii<fNParticleFunctions;ii++)
491d1b5d 476 fParticleFunctions[ii]->ProcessSameEventParticles(tmppartpair);
1b446896 477
478 for(ii = 0;ii<fNTrackFunctions;ii++)
491d1b5d 479 fTrackFunctions[ii]->ProcessSameEventParticles(tmptrackpair);
1b446896 480
481 for(ii = 0;ii<fNParticleAndTrackFunctions;ii++)
491d1b5d 482 fParticleAndTrackFunctions[ii]->ProcessSameEventParticles(tmptrackpair,tmppartpair);
bed069a4 483 //end of 2nd loop over particles from the same event
484 }//for (Int_t k =j+1; k < partEvent->GetNumberOfParticles() ; k++)
485
486 /***************************************/
487 /***** Filling denominators *********/
488 /***************************************/
489 if (fBufferSize == 0) continue;
490
491 partbuffer.ResetIter();
492 trackbuffer.ResetIter();
493 Int_t m = 0;
494 while (( partEvent2 = partbuffer.Next() ))
495 {
496 trackEvent2 = trackbuffer.Next();
5c58441a 497
bed069a4 498 m++;
499 if ( (j%fDisplayMixingInfo) == 0)
500 Info("ProcessTracksAndParticles",
501 "Mixing particle %d from event %d with particles from event %d",j,i,i-m);
502
503 for(Int_t l = 0; l<partEvent2->GetNumberOfParticles();l++) // ... on all particles
1b446896 504 {
1b446896 505 part2= partEvent2->GetParticle(l);
506 partpair->SetParticles(part1,part2);
507
508 track2= trackEvent2->GetParticle(l);
509 trackpair->SetParticles(track1,track2);
510
17d74b37 511 if( (this->*fkPass)(partpair,trackpair) ) //check pair cut
1b446896 512 { //do not meets crietria of the
78d7c6d3 513 if( (this->*fkPass)((AliHBTPair*)partpair->GetSwappedPair(),(AliHBTPair*)trackpair->GetSwappedPair()) )
81b7b887 514 continue;
515 else
516 {
78d7c6d3 517 tmppartpair = (AliHBTPair*)partpair->GetSwappedPair();
518 tmptrackpair = (AliHBTPair*)trackpair->GetSwappedPair();
81b7b887 519 }
1b446896 520 }
491d1b5d 521 else
522 {//meets criteria of the pair cut
523 tmptrackpair = trackpair;
524 tmppartpair = partpair;
525 }
9616170a 526
1b446896 527 for(ii = 0;ii<fNParticleFunctions;ii++)
491d1b5d 528 fParticleFunctions[ii]->ProcessDiffEventParticles(tmppartpair);
1b446896 529
530 for(ii = 0;ii<fNTrackFunctions;ii++)
491d1b5d 531 fTrackFunctions[ii]->ProcessDiffEventParticles(tmptrackpair);
1b446896 532
533 for(ii = 0;ii<fNParticleAndTrackFunctions;ii++)
491d1b5d 534 fParticleAndTrackFunctions[ii]->ProcessDiffEventParticles(tmptrackpair,tmppartpair);
1b446896 535 }//for(Int_t l = 0; l<N2;l++) // ... on all particles
bed069a4 536
537 }
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)
4cb6e8f7 544
545 delete trackpair;
546 delete partpair;
547
548 partbuffer.SetOwner(kTRUE);
549 trackbuffer.SetOwner(kTRUE);
1b446896 550}
551/*************************************************************************************/
552
553void AliHBTAnalysis::ProcessTracks()
554{
2dc7203b 555//In order to minimize calling AliRun::GetEvent (we need at one time particles from different events),
1b446896 556//the loops are splited
78d7c6d3 557 AliVAODParticle * track1, * track2;
558 AliAOD * trackEvent;
559 AliAOD * trackEvent1 = 0x0;
560 AliAOD * trackEvent2;
81b7b887 561
bed069a4 562 register UInt_t ii;
81b7b887 563
564 AliHBTPair * trackpair = new AliHBTPair();
565 AliHBTPair * tmptrackpair; //temporary pointer
1b446896 566
78d7c6d3 567 AliEventBuffer trackbuffer(fBufferSize);
bed069a4 568
569 fReader->Rewind();
570 Int_t i = -1;
571 while (fReader->Next() == kFALSE)
1b446896 572 {
bed069a4 573 i++;
78d7c6d3 574 trackEvent = fReader->GetEventRec();
1b446896 575 if (!trackEvent) continue;
1b446896 576
bed069a4 577 if(trackEvent1 == 0x0)
578 {
78d7c6d3 579 trackEvent1 = new AliAOD();
bed069a4 580 trackEvent1->SetOwner(kTRUE);
581 }
582 else
583 {
584 trackEvent1->Reset();
585 }
586
1b446896 587 for (Int_t j = 0; j<trackEvent->GetNumberOfParticles() ; j++)
588 {
bed069a4 589 /***************************************/
590 /****** Looping same events ********/
591 /****** filling numerators ********/
592 /***************************************/
81b7b887 593 if ( (j%fDisplayMixingInfo) == 0)
594 Info("ProcessTracks",
595 "Mixing particle %d from event %d with particles from event %d",j,i,i);
596
bed069a4 597 track1= trackEvent->GetParticle(j);
598 Bool_t firstcut = fPairCut->GetFirstPartCut()->Pass(track1);
599
9277d10a 600 if (fBufferSize != 0)
47d9a058 601 if ( (firstcut == kFALSE) || (fPairCut->GetSecondPartCut()->Pass(track1) == kFALSE) )
602 {
603 //accepted by any cut
604 // we have to copy because reader keeps only one event
78d7c6d3 605 trackEvent1->AddParticle(new AliAODParticle(*track1));
47d9a058 606 }
bed069a4 607
608 if (firstcut) continue;
81b7b887 609
610 for(ii = 0; ii<fNTrackMonitorFunctions; ii++)
e4f2b1da 611 fTrackMonitorFunctions[ii]->Process(track1);
5c58441a 612
bed069a4 613 if ( fNTrackFunctions ==0 ) continue;
5c58441a 614
1b446896 615 for (Int_t k =j+1; k < trackEvent->GetNumberOfParticles() ; k++)
616 {
d74e6a27 617 track2= trackEvent->GetParticle(k);
618 if (track1->GetUID() == track2->GetUID()) continue;
619
5c58441a 620 trackpair->SetParticles(track1,track2);
621 if(fPairCut->Pass(trackpair)) //check pair cut
81b7b887 622 { //do not meets crietria of the
78d7c6d3 623 if( fPairCut->Pass((AliHBTPair*)trackpair->GetSwappedPair()) ) continue;
624 else tmptrackpair = (AliHBTPair*)trackpair->GetSwappedPair();
81b7b887 625 }
626 else
627 {
628 tmptrackpair = trackpair;
629 }
630 for(ii = 0;ii<fNTrackFunctions;ii++)
631 fTrackFunctions[ii]->ProcessSameEventParticles(tmptrackpair);
632 }
bed069a4 633 /***************************************/
634 /***** Filling denominators *********/
635 /***************************************/
636
637 if (fBufferSize == 0) continue;
638
639 trackbuffer.ResetIter();
640
40d40d72 641 Int_t m = 0;
bed069a4 642 while (( trackEvent2 = trackbuffer.Next() ))
81b7b887 643 {
40d40d72 644 m++;
645 if ( (j%fDisplayMixingInfo) == 0)
646 Info("ProcessTracks",
647 "Mixing track %d from event %d with tracks from event %d",j,i,i-m);
81b7b887 648 for(Int_t l = 0; l<trackEvent2->GetNumberOfParticles();l++) // ... on all particles
bed069a4 649 {
650
651 track2= trackEvent2->GetParticle(l);
652 trackpair->SetParticles(track1,track2);
653
654 if( fPairCut->Pass(trackpair) ) //check pair cut
655 { //do not meets crietria of the
78d7c6d3 656 if( fPairCut->Pass((AliHBTPair*)trackpair->GetSwappedPair()) )
bed069a4 657 continue;
658 else
659 {
78d7c6d3 660 tmptrackpair = (AliHBTPair*)trackpair->GetSwappedPair();
bed069a4 661 }
662 }
663 else
664 {//meets criteria of the pair cut
81b7b887 665 tmptrackpair = trackpair;
bed069a4 666 }
667
668 for(ii = 0;ii<fNTrackFunctions;ii++)
669 fTrackFunctions[ii]->ProcessDiffEventParticles(tmptrackpair);
670
81b7b887 671 }//for(Int_t l = 0; l<N2;l++) // ... on all particles
bed069a4 672 }
1b446896 673 }
bed069a4 674 trackEvent1 = trackbuffer.Push(trackEvent1);
675 }//while (fReader->Next() == kFALSE)
4cb6e8f7 676
677 delete trackpair;
678 trackbuffer.SetOwner(kTRUE);
1b446896 679}
680
681/*************************************************************************************/
491d1b5d 682
1b446896 683void AliHBTAnalysis::ProcessParticles()
684{
81b7b887 685//In order to minimize calling AliRun::GetEvent (we need at one time particles from different events),
1b446896 686//the loops are splited
78d7c6d3 687 AliVAODParticle * part1, * part2;
688 AliAOD * partEvent;
689 AliAOD * partEvent1 = 0x0;
690 AliAOD * partEvent2;
491d1b5d 691
bed069a4 692 register UInt_t ii;
693
491d1b5d 694 AliHBTPair * partpair = new AliHBTPair();
bed069a4 695 AliHBTPair * tmppartpair; //temporary pointer
1b446896 696
78d7c6d3 697 AliEventBuffer partbuffer(fBufferSize);
4cb6e8f7 698 partbuffer.SetOwner(kTRUE);
1b446896 699
bed069a4 700 fReader->Rewind();
701 Int_t i = -1;
702 while (fReader->Next() == kFALSE)
1b446896 703 {
bed069a4 704 i++;
78d7c6d3 705 partEvent = fReader->GetEventSim();
1b446896 706 if (!partEvent) continue;
bed069a4 707
708 if(partEvent1 == 0x0)
709 {
78d7c6d3 710 partEvent1 = new AliAOD();
bed069a4 711 partEvent1->SetOwner(kTRUE);
712 }
713 else
714 {
715 partEvent1->Reset();
716 }
1b446896 717
718 for (Int_t j = 0; j<partEvent->GetNumberOfParticles() ; j++)
719 {
bed069a4 720 /***************************************/
721 /****** Looping same events ********/
722 /****** filling numerators ********/
723 /***************************************/
81b7b887 724 if ( (j%fDisplayMixingInfo) == 0)
40d40d72 725 Info("ProcessParticles",
bed069a4 726 "Mixing particle %d from event %d with particles from event %d",j,i,i);
727
40d40d72 728 part1 = partEvent->GetParticle(j);
bed069a4 729 Bool_t firstcut = fPairCut->GetFirstPartCut()->Pass(part1);
730
9277d10a 731 if (fBufferSize != 0) //useless in case
47d9a058 732 if ( (firstcut == kFALSE) || (fPairCut->GetSecondPartCut()->Pass(part1) == kFALSE) )
733 {
734 //accepted by any cut
735 // we have to copy because reader keeps only one event
78d7c6d3 736 partEvent1->AddParticle(new AliAODParticle(*part1));
47d9a058 737 }
1b446896 738
bed069a4 739 if (firstcut) continue;
5c58441a 740
bed069a4 741 for(ii = 0; ii<fNParticleMonitorFunctions; ii++)
742 fParticleMonitorFunctions[ii]->Process(part1);
1b446896 743
bed069a4 744 if ( fNParticleFunctions == 0 ) continue;
745
746 for (Int_t k =j+1; k < partEvent->GetNumberOfParticles() ; k++)
747 {
748 part2= partEvent->GetParticle(k);
749 if (part1->GetUID() == part2->GetUID()) continue;
81b7b887 750
bed069a4 751 partpair->SetParticles(part1,part2);
752 if(fPairCut->Pass(partpair)) //check pair cut
753 { //do not meets crietria of the
78d7c6d3 754 if( fPairCut->Pass((AliHBTPair*)partpair->GetSwappedPair()) ) continue;
755 else tmppartpair = (AliHBTPair*)partpair->GetSwappedPair();
7a2c8238 756 }
bed069a4 757 else
7a2c8238 758 {
bed069a4 759 tmppartpair = partpair;
7a2c8238 760 }
bed069a4 761 for(ii = 0;ii<fNParticleFunctions;ii++)
762 fParticleFunctions[ii]->ProcessSameEventParticles(tmppartpair);
763 }
764 /***************************************/
765 /***** Filling denominators *********/
766 /***************************************/
767
768 if (fBufferSize == 0) continue;
769
770 partbuffer.ResetIter();
771
40d40d72 772 Int_t m = 0;
bed069a4 773 while (( partEvent2 = partbuffer.Next() ))
774 {
40d40d72 775 m++;
776 if ( (j%fDisplayMixingInfo) == 0)
777 Info("ProcessParticles",
778 "Mixing particle %d from event %d with particles from event %d",j,i,i-m);
bed069a4 779 for(Int_t l = 0; l<partEvent2->GetNumberOfParticles();l++) // ... on all particles
1b446896 780 {
bed069a4 781
1b446896 782 part2= partEvent2->GetParticle(l);
783 partpair->SetParticles(part1,part2);
bed069a4 784
785 if( fPairCut->Pass(partpair) ) //check pair cut
1b446896 786 { //do not meets crietria of the
78d7c6d3 787 if( fPairCut->Pass((AliHBTPair*)partpair->GetSwappedPair()) )
bed069a4 788 continue;
789 else
790 {
78d7c6d3 791 tmppartpair = (AliHBTPair*)partpair->GetSwappedPair();
bed069a4 792 }
491d1b5d 793 }
794 else
bed069a4 795 {//meets criteria of the pair cut
796 tmppartpair = partpair;
797 }
798
1b446896 799 for(ii = 0;ii<fNParticleFunctions;ii++)
491d1b5d 800 fParticleFunctions[ii]->ProcessDiffEventParticles(tmppartpair);
bed069a4 801
802 }//for(Int_t l = 0; l<N2;l++) // ... on all particles
803 }
1b446896 804 }
bed069a4 805 partEvent1 = partbuffer.Push(partEvent1);
806 }//while (fReader->Next() == kFALSE)
4cb6e8f7 807 delete partpair;
808 partbuffer.SetOwner(kTRUE);
1b446896 809}
1b446896 810/*************************************************************************************/
811
491d1b5d 812void AliHBTAnalysis::WriteFunctions()
1b446896 813{
81b7b887 814//Calls Write for all defined functions in analysis
815//== writes all results
1b446896 816 UInt_t ii;
817 for(ii = 0;ii<fNParticleFunctions;ii++)
90520373 818 {
78d7c6d3 819 if (AliVAODParticle::GetDebug()>5)
90520373 820 {
821 Info("WriteFunctions","Writing ParticleFunction %#x",fParticleFunctions[ii]);
822 Info("WriteFunctions","Writing ParticleFunction %s",fParticleFunctions[ii]->Name());
823 }
824 fParticleFunctions[ii]->Write();
825 }
1b446896 826
827 for(ii = 0;ii<fNTrackFunctions;ii++)
90520373 828 {
78d7c6d3 829 if (AliVAODParticle::GetDebug()>5)
90520373 830 {
831 Info("WriteFunctions","Writing TrackFunction %#x",fTrackFunctions[ii]);
832 Info("WriteFunctions","Writing TrackFunction %s",fTrackFunctions[ii]->Name());
833 }
834 fTrackFunctions[ii]->Write();
835 }
1b446896 836
837 for(ii = 0;ii<fNParticleAndTrackFunctions;ii++)
90520373 838 {
78d7c6d3 839 if (AliVAODParticle::GetDebug()>5)
90520373 840 {
841 Info("WriteFunctions","Writing ParticleAndTrackFunction %#x",fParticleAndTrackFunctions[ii]);
842 Info("WriteFunctions","Writing ParticleAndTrackFunction %s",fParticleAndTrackFunctions[ii]->Name());
843 }
844 fParticleAndTrackFunctions[ii]->Write();
845 }
5c58441a 846
847 for(ii = 0;ii<fNParticleMonitorFunctions;ii++)
90520373 848 {
78d7c6d3 849 if (AliVAODParticle::GetDebug()>5)
90520373 850 {
851 Info("WriteFunctions","Writing ParticleMonitorFunction %#x",fParticleMonitorFunctions[ii]);
852 Info("WriteFunctions","Writing ParticleMonitorFunction %s",fParticleMonitorFunctions[ii]->Name());
853 }
854 fParticleMonitorFunctions[ii]->Write();
855 }
5c58441a 856
857 for(ii = 0;ii<fNTrackMonitorFunctions;ii++)
90520373 858 {
78d7c6d3 859 if (AliVAODParticle::GetDebug()>5)
90520373 860 {
861 Info("WriteFunctions","Writing TrackMonitorFunction %#x",fTrackMonitorFunctions[ii]);
862 Info("WriteFunctions","Writing TrackMonitorFunction %s",fTrackMonitorFunctions[ii]->Name());
863 }
864 fTrackMonitorFunctions[ii]->Write();
865 }
5c58441a 866
867 for(ii = 0;ii<fNParticleAndTrackMonitorFunctions;ii++)
90520373 868 {
78d7c6d3 869 if (AliVAODParticle::GetDebug()>5)
90520373 870 {
871 Info("WriteFunctions","Writing ParticleAndTrackMonitorFunction %#x",fParticleAndTrackMonitorFunctions[ii]);
872 Info("WriteFunctions","Writing ParticleAndTrackMonitorFunction %s",fParticleAndTrackMonitorFunctions[ii]->Name());
873 }
874 fParticleAndTrackMonitorFunctions[ii]->Write();
875 }
1b446896 876}
877/*************************************************************************************/
491d1b5d 878
78d7c6d3 879void AliHBTAnalysis::SetGlobalPairCut(AliAODPairCut* cut)
1b446896 880{
81b7b887 881//Sets the global cut
1b446896 882 if (cut == 0x0)
883 {
884 Error("AliHBTAnalysis::SetGlobalPairCut","Pointer is NULL. Ignoring");
885 }
886 delete fPairCut;
78d7c6d3 887 fPairCut = (AliAODPairCut*)cut->Clone();
1b446896 888}
889
890/*************************************************************************************/
491d1b5d 891
27b3fe5d 892void AliHBTAnalysis::AddTrackFunction(AliHBTOnePairFctn* f)
1b446896 893{
81b7b887 894//Adds track function
1b446896 895 if (f == 0x0) return;
896 if (fNTrackFunctions == fgkFctnArraySize)
897 {
898 Error("AliHBTAnalysis::AddTrackFunction","Can not add this function, not enough place in the array.");
899 }
900 fTrackFunctions[fNTrackFunctions] = f;
901 fNTrackFunctions++;
902}
491d1b5d 903/*************************************************************************************/
904
27b3fe5d 905void AliHBTAnalysis::AddParticleFunction(AliHBTOnePairFctn* f)
1b446896 906{
81b7b887 907//adds particle function
1b446896 908 if (f == 0x0) return;
909
910 if (fNParticleFunctions == fgkFctnArraySize)
911 {
912 Error("AliHBTAnalysis::AddParticleFunction","Can not add this function, not enough place in the array.");
913 }
914 fParticleFunctions[fNParticleFunctions] = f;
915 fNParticleFunctions++;
1b446896 916}
5c58441a 917/*************************************************************************************/
918
27b3fe5d 919void AliHBTAnalysis::AddParticleAndTrackFunction(AliHBTTwoPairFctn* f)
1b446896 920{
81b7b887 921//add resolution function
1b446896 922 if (f == 0x0) return;
923 if (fNParticleAndTrackFunctions == fgkFctnArraySize)
924 {
925 Error("AliHBTAnalysis::AddParticleAndTrackFunction","Can not add this function, not enough place in the array.");
926 }
927 fParticleAndTrackFunctions[fNParticleAndTrackFunctions] = f;
928 fNParticleAndTrackFunctions++;
929}
5c58441a 930/*************************************************************************************/
931
932void AliHBTAnalysis::AddParticleMonitorFunction(AliHBTMonOneParticleFctn* f)
933{
81b7b887 934//add particle monitoring function
5c58441a 935 if (f == 0x0) return;
936
937 if (fNParticleMonitorFunctions == fgkFctnArraySize)
938 {
939 Error("AliHBTAnalysis::AddParticleMonitorFunction","Can not add this function, not enough place in the array.");
940 }
941 fParticleMonitorFunctions[fNParticleMonitorFunctions] = f;
942 fNParticleMonitorFunctions++;
943}
944/*************************************************************************************/
1b446896 945
5c58441a 946void AliHBTAnalysis::AddTrackMonitorFunction(AliHBTMonOneParticleFctn* f)
947{
81b7b887 948//add track monitoring function
5c58441a 949 if (f == 0x0) return;
1b446896 950
5c58441a 951 if (fNTrackMonitorFunctions == fgkFctnArraySize)
952 {
953 Error("AliHBTAnalysis::AddTrackMonitorFunction","Can not add this function, not enough place in the array.");
954 }
955 fTrackMonitorFunctions[fNTrackMonitorFunctions] = f;
956 fNTrackMonitorFunctions++;
957}
1b446896 958/*************************************************************************************/
959
5c58441a 960void AliHBTAnalysis::AddParticleAndTrackMonitorFunction(AliHBTMonTwoParticleFctn* f)
961{
81b7b887 962//add resolution monitoring function
5c58441a 963 if (f == 0x0) return;
964 if (fNParticleAndTrackMonitorFunctions == fgkFctnArraySize)
965 {
966 Error("AliHBTAnalysis::AddParticleAndTrackMonitorFunction","Can not add this function, not enough place in the array.");
967 }
968 fParticleAndTrackMonitorFunctions[fNParticleAndTrackMonitorFunctions] = f;
969 fNParticleAndTrackMonitorFunctions++;
970}
971
1b446896 972
5c58441a 973/*************************************************************************************/
1b446896 974/*************************************************************************************/
491d1b5d 975
1b446896 976Bool_t AliHBTAnalysis::RunCoherencyCheck()
977{
978 //Checks if both HBTRuns are similar
979 //return true if error found
980 //if they seem to be OK return false
78d7c6d3 981/*
982
1b446896 983 Int_t i;
81b7b887 984 Info("RunCoherencyCheck","Checking HBT Runs Coherency");
985
78d7c6d3 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
990// {
991// Info("RunCoherencyCheck","OK. %d found\n",fReader->GetNumberOfTrackEvents());
992// }
993// else
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());
998// return kTRUE;
999// }
1b446896 1000
81b7b887 1001 Info("RunCoherencyCheck","Checking number of Particles AND Particles Types in each event ...");
1b446896 1002
78d7c6d3 1003 AliAOD *partEvent;
1004 AliAOD *trackEvent;
1b446896 1005 for( i = 0; i<fReader->GetNumberOfTrackEvents();i++)
1006 {
78d7c6d3 1007 partEvent= fReader->GetEventSim(i); //gets the "ith" event
1008 trackEvent = fReader->GetEventRec(i);
1b446896 1009
1010 if ( (partEvent == 0x0) && (partEvent == 0x0) ) continue;
1011 if ( (partEvent == 0x0) || (partEvent == 0x0) )
1012 {
78d7c6d3 1013 Error("RunCoherencyCheck",
1b446896 1014 "One event is NULL and the other one not. Event Number %d",i);
1015 return kTRUE;
1016 }
1017
1018 if ( partEvent->GetNumberOfParticles() != trackEvent->GetNumberOfParticles() )
1019 {
78d7c6d3 1020 Error("RunCoherencyCheck",
1b446896 1021 "Event %d: Number of simulated particles (%d) not equal to number of reconstructed tracks (%d)",
1022 i,partEvent->GetNumberOfParticles() , trackEvent->GetNumberOfParticles());
1023 return kTRUE;
1024 }
1025 else
1026 for (Int_t j = 0; j<partEvent->GetNumberOfParticles(); j++)
1027 {
1028 if( partEvent->GetParticle(j)->GetPdgCode() != trackEvent->GetParticle(j)->GetPdgCode() )
1029 {
78d7c6d3 1030 Error("RunCoherencyCheck",
1b446896 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() );
1033 return kTRUE;
1034
1035 }
1036 }
1037 }
81b7b887 1038 Info("RunCoherencyCheck"," Done");
1039 Info("RunCoherencyCheck"," Everything looks OK");
78d7c6d3 1040*/
1b446896 1041 return kFALSE;
1042}
1043
dc2c3f36 1044/*************************************************************************************/
1045
1046void AliHBTAnalysis::ProcessTracksAndParticlesNonIdentAnal()
1047{
81b7b887 1048//Performs analysis for both, tracks and particles
1049
78d7c6d3 1050 AliVAODParticle * part1, * part2;
1051 AliVAODParticle * track1, * track2;
dc2c3f36 1052
78d7c6d3 1053 AliAOD * trackEvent1=0x0,*partEvent1=0x0;
1054 AliAOD * trackEvent2=0x0,*partEvent2=0x0;
1055 AliAOD * trackEvent3=0x0,*partEvent3=0x0;
dc2c3f36 1056
78d7c6d3 1057 AliAOD * rawtrackEvent, *rawpartEvent;//this we get from Reader
dc2c3f36 1058
dc2c3f36 1059 AliHBTPair * trackpair = new AliHBTPair();
1060 AliHBTPair * partpair = new AliHBTPair();
1061
78d7c6d3 1062 AliEventBuffer partbuffer(fBufferSize);
1063 AliEventBuffer trackbuffer(fBufferSize);
bed069a4 1064
1065 register UInt_t ii;
dc2c3f36 1066
78d7c6d3 1067 trackEvent1 = new AliAOD();
1068 partEvent1 = new AliAOD();
dc2c3f36 1069 trackEvent1->SetOwner(kFALSE);
1070 partEvent1->SetOwner(kFALSE);;
1071
bed069a4 1072 Bool_t nocorrfctns = (fNParticleFunctions == 0) && (fNTrackFunctions == 0) && (fNParticleAndTrackFunctions == 0);
1073
1074 fReader->Rewind();
1075
81b7b887 1076 Info("ProcessTracksAndParticlesNonIdentAnal","**************************************");
1077 Info("ProcessTracksAndParticlesNonIdentAnal","***** NON IDENT MODE ****************");
1078 Info("ProcessTracksAndParticlesNonIdentAnal","**************************************");
1079
bed069a4 1080 for (Int_t i = 0;;i++)//infinite loop
dc2c3f36 1081 {
bed069a4 1082 if (fReader->Next()) break; //end when no more events available
1083
78d7c6d3 1084 rawpartEvent = fReader->GetEventSim();
1085 rawtrackEvent = fReader->GetEventRec();
dc2c3f36 1086 if ( (rawpartEvent == 0x0) || (rawtrackEvent == 0x0) ) continue;//in case of any error
bed069a4 1087
1088 if ( rawpartEvent->GetNumberOfParticles() != rawtrackEvent->GetNumberOfParticles() )
1089 {
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());
1093 return;
1094 }
1095
dc2c3f36 1096 /********************************/
1097 /* Filtering out */
1098 /********************************/
bed069a4 1099 if ( ( (partEvent2==0x0) || (trackEvent2==0x0)) )//in case fBufferSize == 0 and pointers are created do not eneter
1100 {
78d7c6d3 1101 partEvent2 = new AliAOD();
1102 trackEvent2 = new AliAOD();
bed069a4 1103 partEvent2->SetOwner(kTRUE);
1104 trackEvent2->SetOwner(kTRUE);
1105 }
1106
dc2c3f36 1107 FilterOut(partEvent1, partEvent2, rawpartEvent, trackEvent1, trackEvent2, rawtrackEvent);
1108
1109 for (Int_t j = 0; j<partEvent1->GetNumberOfParticles() ; j++)
1110 {
81b7b887 1111 if ( (j%fDisplayMixingInfo) == 0)
1112 Info("ProcessTracksAndParticlesNonIdentAnal",
1113 "Mixing particle %d from event %d with particles from event %d",j,i,i);
dc2c3f36 1114
1115 part1= partEvent1->GetParticle(j);
1116 track1= trackEvent1->GetParticle(j);
4d91c73a 1117
1118//PID reconstruction imperfections
1119// if( part1->GetPdgCode() != track1->GetPdgCode() )
1120// {
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() );
1124// return;
1125// }
bed069a4 1126
81b7b887 1127 for(ii = 0; ii<fNParticleMonitorFunctions; ii++)
e4f2b1da 1128 fParticleMonitorFunctions[ii]->Process(part1);
81b7b887 1129 for(ii = 0; ii<fNTrackMonitorFunctions; ii++)
e4f2b1da 1130 fTrackMonitorFunctions[ii]->Process(track1);
81b7b887 1131 for(ii = 0; ii<fNParticleAndTrackMonitorFunctions; ii++)
e4f2b1da 1132 fParticleAndTrackMonitorFunctions[ii]->Process(track1,part1);
dc2c3f36 1133
bed069a4 1134 if (nocorrfctns) continue;
1135
dc2c3f36 1136 /***************************************/
1137 /****** filling numerators ********/
1138 /****** (particles from event2) ********/
1139 /***************************************/
bed069a4 1140
1141 for (Int_t k = 0; k < partEvent2->GetNumberOfParticles() ; k++) //partEvent1 and partEvent2 are particles from the same event but separated to two groups
dc2c3f36 1142 {
1143 part2= partEvent2->GetParticle(k);
d74e6a27 1144 if (part1->GetUID() == part2->GetUID()) continue;//this is the same particle but with different PID
dc2c3f36 1145 partpair->SetParticles(part1,part2);
1146
1147 track2= trackEvent2->GetParticle(k);
1148 trackpair->SetParticles(track1,track2);
1149
17d74b37 1150 if( (this->*fkPassPairProp)(partpair,trackpair) ) //check pair cut
81b7b887 1151 { //do not meets crietria of the pair cut
1152 continue;
1153 }
dc2c3f36 1154 else
1155 {//meets criteria of the pair cut
dc2c3f36 1156 for(ii = 0;ii<fNParticleFunctions;ii++)
1157 fParticleFunctions[ii]->ProcessSameEventParticles(partpair);
1158
1159 for(ii = 0;ii<fNTrackFunctions;ii++)
1160 fTrackFunctions[ii]->ProcessSameEventParticles(trackpair);
1161
1162 for(ii = 0;ii<fNParticleAndTrackFunctions;ii++)
1163 fParticleAndTrackFunctions[ii]->ProcessSameEventParticles(trackpair,partpair);
1164 }
1165 }
5c58441a 1166
81b7b887 1167 if ( fBufferSize == 0) continue;//do not mix diff histograms
dc2c3f36 1168 /***************************************/
1169 /***** Filling denominators *********/
1170 /***************************************/
bed069a4 1171 partbuffer.ResetIter();
1172 trackbuffer.ResetIter();
1173
dc2c3f36 1174 Int_t nmonitor = 0;
1175
bed069a4 1176 while ( (partEvent3 = partbuffer.Next() ) != 0x0)
dc2c3f36 1177 {
bed069a4 1178 trackEvent3 = trackbuffer.Next();
1179
81b7b887 1180 if ( (j%fDisplayMixingInfo) == 0)
1181 Info("ProcessTracksAndParticlesNonIdentAnal",
1182 "Mixing particle %d from event %d with particles from event %d",j,i,i-(++nmonitor));
dc2c3f36 1183
1184 for (Int_t k = 0; k < partEvent3->GetNumberOfParticles() ; k++)
1185 {
1186 part2= partEvent3->GetParticle(k);
1187 partpair->SetParticles(part1,part2);
1b446896 1188
dc2c3f36 1189 track2= trackEvent3->GetParticle(k);
1190 trackpair->SetParticles(track1,track2);
1191
17d74b37 1192 if( (this->*fkPassPairProp)(partpair,trackpair) ) //check pair cut
81b7b887 1193 { //do not meets crietria of the pair cut
1194 continue;
1195 }
dc2c3f36 1196 else
1197 {//meets criteria of the pair cut
1198 UInt_t ii;
1199 for(ii = 0;ii<fNParticleFunctions;ii++)
1200 fParticleFunctions[ii]->ProcessDiffEventParticles(partpair);
1201
1202 for(ii = 0;ii<fNTrackFunctions;ii++)
1203 fTrackFunctions[ii]->ProcessDiffEventParticles(trackpair);
1204
1205 for(ii = 0;ii<fNParticleAndTrackFunctions;ii++)
1206 fParticleAndTrackFunctions[ii]->ProcessDiffEventParticles(trackpair,partpair);
1207 }
1208 }// for particles event2
1209 }//while event2
1210 }//for over particles in event1
1211
bed069a4 1212 partEvent2 = partbuffer.Push(partEvent2);
1213 trackEvent2 = trackbuffer.Push(trackEvent2);
dc2c3f36 1214
1215 }//end of loop over events (1)
bed069a4 1216
1217 partbuffer.SetOwner(kTRUE);
1218 trackbuffer.SetOwner(kTRUE);
1219
b70eb506 1220 delete partEvent1;
1221 delete trackEvent1;
bed069a4 1222 delete partEvent2;
1223 delete trackEvent2;
b70eb506 1224 delete partpair;
1225 delete trackpair;
81b7b887 1226
dc2c3f36 1227}
1b446896 1228/*************************************************************************************/
1229
dc2c3f36 1230void AliHBTAnalysis::ProcessTracksNonIdentAnal()
1231{
2dc7203b 1232//Process Tracks only with non identical mode
78d7c6d3 1233 AliVAODParticle * track1, * track2;
dc2c3f36 1234
78d7c6d3 1235 AliAOD * trackEvent1=0x0;
1236 AliAOD * trackEvent2=0x0;
1237 AliAOD * trackEvent3=0x0;
dc2c3f36 1238
78d7c6d3 1239 AliAOD * rawtrackEvent;
dc2c3f36 1240
dc2c3f36 1241 AliHBTPair * trackpair = new AliHBTPair();
78d7c6d3 1242 AliEventBuffer trackbuffer(fBufferSize);
dc2c3f36 1243
81b7b887 1244 register UInt_t ii;
dc2c3f36 1245
78d7c6d3 1246 trackEvent1 = new AliAOD();
dc2c3f36 1247 trackEvent1->SetOwner(kFALSE);
1248
bed069a4 1249 fReader->Rewind();
1250
81b7b887 1251 Info("ProcessTracksNonIdentAnal","**************************************");
1252 Info("ProcessTracksNonIdentAnal","***** NON IDENT MODE ****************");
1253 Info("ProcessTracksNonIdentAnal","**************************************");
1254
bed069a4 1255
1256 for (Int_t i = 0;;i++)//infinite loop
dc2c3f36 1257 {
bed069a4 1258 if (fReader->Next()) break; //end when no more events available
78d7c6d3 1259 rawtrackEvent = fReader->GetEventRec();
bed069a4 1260
dc2c3f36 1261 if (rawtrackEvent == 0x0) continue;//in case of any error
1262
1263 /********************************/
1264 /* Filtering out */
1265 /********************************/
bed069a4 1266 if ( trackEvent2==0x0 )//in case fBufferSize == 0 and pointers are created do not eneter
1267 {
78d7c6d3 1268 trackEvent2 = new AliAOD();
bed069a4 1269 trackEvent2->SetOwner(kTRUE);
1270 }
1271
dc2c3f36 1272 FilterOut(trackEvent1, trackEvent2, rawtrackEvent);
1273
1274 for (Int_t j = 0; j<trackEvent1->GetNumberOfParticles() ; j++)
1275 {
81b7b887 1276 if ( (j%fDisplayMixingInfo) == 0)
1277 Info("ProcessTracksNonIdentAnal",
1278 "Mixing particle %d from event %d with particles from event %d",j,i,i);
dc2c3f36 1279
1280 track1= trackEvent1->GetParticle(j);
1281
81b7b887 1282 for(ii = 0; ii<fNTrackMonitorFunctions; ii++)
e4f2b1da 1283 fTrackMonitorFunctions[ii]->Process(track1);
bed069a4 1284
1285 if (fNTrackFunctions == 0x0) continue;
1286
dc2c3f36 1287 /***************************************/
1288 /****** filling numerators ********/
1289 /****** (particles from event2) ********/
1290 /***************************************/
1291 for (Int_t k = 0; k < trackEvent2->GetNumberOfParticles() ; k++)
1292 {
1293 track2= trackEvent2->GetParticle(k);
d74e6a27 1294 if (track1->GetUID() == track2->GetUID()) continue;//this is the same particle but with different PID
dc2c3f36 1295 trackpair->SetParticles(track1,track2);
1296
1297
1298 if( fPairCut->PassPairProp(trackpair)) //check pair cut
1299 { //do not meets crietria of the pair cut
1300 continue;
1301 }
1302 else
1303 {//meets criteria of the pair cut
1304 UInt_t ii;
1305 for(ii = 0;ii<fNTrackFunctions;ii++)
1306 fTrackFunctions[ii]->ProcessSameEventParticles(trackpair);
1307 }
1308 }
81b7b887 1309 if ( fBufferSize == 0) continue;//do not mix diff histograms
dc2c3f36 1310 /***************************************/
1311 /***** Filling denominators *********/
1312 /***************************************/
bed069a4 1313 trackbuffer.ResetIter();
dc2c3f36 1314 Int_t nmonitor = 0;
1315
bed069a4 1316 while ( (trackEvent3 = trackbuffer.Next() ) != 0x0)
dc2c3f36 1317 {
1318
81b7b887 1319 if ( (j%fDisplayMixingInfo) == 0)
1320 Info("ProcessTracksNonIdentAnal",
1321 "Mixing particle %d from event %d with particles from event %d",j,i,i-(++nmonitor));
dc2c3f36 1322
1323 for (Int_t k = 0; k < trackEvent3->GetNumberOfParticles() ; k++)
1324 {
1325
1326 track2= trackEvent3->GetParticle(k);
1327 trackpair->SetParticles(track1,track2);
1328
1329
1330 if( fPairCut->PassPairProp(trackpair)) //check pair cut
81b7b887 1331 { //do not meets crietria of the pair cut
1332 continue;
1333 }
dc2c3f36 1334 else
1335 {//meets criteria of the pair cut
81b7b887 1336 for(ii = 0;ii<fNTrackFunctions;ii++)
1337 fTrackFunctions[ii]->ProcessDiffEventParticles(trackpair);
dc2c3f36 1338 }
1339 }// for particles event2
1340 }//while event2
1341 }//for over particles in event1
1342
bed069a4 1343 trackEvent2 = trackbuffer.Push(trackEvent2);
dc2c3f36 1344
1345 }//end of loop over events (1)
b70eb506 1346
bed069a4 1347 trackbuffer.SetOwner(kTRUE);
b70eb506 1348 delete trackpair;
1349 delete trackEvent1;
bed069a4 1350 delete trackEvent2;
dc2c3f36 1351}
1352/*************************************************************************************/
1353
1354void AliHBTAnalysis::ProcessParticlesNonIdentAnal()
1355{
2dc7203b 1356//process paricles only with non identical mode
78d7c6d3 1357 AliVAODParticle * part1 = 0x0, * part2 = 0x0;
dc2c3f36 1358
78d7c6d3 1359 AliAOD * partEvent1 = 0x0;
1360 AliAOD * partEvent2 = 0x0;
1361 AliAOD * partEvent3 = 0x0;
dc2c3f36 1362
78d7c6d3 1363 AliAOD * rawpartEvent = 0x0;
dc2c3f36 1364
dc2c3f36 1365 AliHBTPair * partpair = new AliHBTPair();
78d7c6d3 1366 AliEventBuffer partbuffer(fBufferSize);
dc2c3f36 1367
bed069a4 1368 register UInt_t ii;
dc2c3f36 1369
78d7c6d3 1370 partEvent1 = new AliAOD();
bed069a4 1371 partEvent1->SetOwner(kFALSE);
1372
1373 fReader->Rewind();
dc2c3f36 1374
81b7b887 1375 Info("ProcessParticlesNonIdentAnal","**************************************");
1376 Info("ProcessParticlesNonIdentAnal","***** NON IDENT MODE ****************");
1377 Info("ProcessParticlesNonIdentAnal","**************************************");
dc2c3f36 1378
bed069a4 1379 for (Int_t i = 0;;i++)//infinite loop
dc2c3f36 1380 {
bed069a4 1381 if (fReader->Next()) break; //end when no more events available
1382
78d7c6d3 1383 rawpartEvent = fReader->GetEventSim();
dc2c3f36 1384 if ( rawpartEvent == 0x0 ) continue;//in case of any error
1385
1386 /********************************/
1387 /* Filtering out */
1388 /********************************/
bed069a4 1389 if (partEvent2==0x0)//in case fBufferSize == 0 and pointers are created do not eneter
1390 {
78d7c6d3 1391 partEvent2 = new AliAOD();
bed069a4 1392 partEvent2->SetOwner(kTRUE);
1393 }
1394
dc2c3f36 1395 FilterOut(partEvent1, partEvent2, rawpartEvent);
1396
1397 for (Int_t j = 0; j<partEvent1->GetNumberOfParticles() ; j++)
1398 {
81b7b887 1399 if ( (j%fDisplayMixingInfo) == 0)
1400 Info("ProcessParticlesNonIdentAnal",
1401 "Mixing particle %d from event %d with particles from event %d",j,i,i);
dc2c3f36 1402
1403 part1= partEvent1->GetParticle(j);
1404
bed069a4 1405 for(ii = 0; ii<fNParticleMonitorFunctions; ii++)
1406 fParticleMonitorFunctions[ii]->Process(part1);
1407
1408 if (fNParticleFunctions == 0) continue;
1409
dc2c3f36 1410 /***************************************/
1411 /****** filling numerators ********/
1412 /****** (particles from event2) ********/
1413 /***************************************/
1414 for (Int_t k = 0; k < partEvent2->GetNumberOfParticles() ; k++)
1415 {
1416 part2= partEvent2->GetParticle(k);
d74e6a27 1417 if (part1->GetUID() == part2->GetUID()) continue;//this is the same particle but with different PID
dc2c3f36 1418 partpair->SetParticles(part1,part2);
1419
1420 if(fPairCut->PassPairProp(partpair) ) //check pair cut
1421 { //do not meets crietria of the pair cut
1422 continue;
1423 }
1424 else
1425 {//meets criteria of the pair cut
dc2c3f36 1426 for(ii = 0;ii<fNParticleFunctions;ii++)
5c58441a 1427 fParticleFunctions[ii]->ProcessSameEventParticles(partpair);
dc2c3f36 1428 }
1429 }
b70eb506 1430 if ( fBufferSize == 0) continue;//do not mix diff histograms
dc2c3f36 1431 /***************************************/
1432 /***** Filling denominators *********/
1433 /***************************************/
bed069a4 1434 partbuffer.ResetIter();
dc2c3f36 1435 Int_t nmonitor = 0;
1436
bed069a4 1437 while ( (partEvent3 = partbuffer.Next() ) != 0x0)
dc2c3f36 1438 {
81b7b887 1439 if ( (j%fDisplayMixingInfo) == 0)
1440 Info("ProcessParticlesNonIdentAnal",
1441 "Mixing particle %d from event %d with particles from event %d",j,i,i-(++nmonitor));
1442
dc2c3f36 1443 for (Int_t k = 0; k < partEvent3->GetNumberOfParticles() ; k++)
1444 {
1445 part2= partEvent3->GetParticle(k);
1446 partpair->SetParticles(part1,part2);
1447
dc2c3f36 1448 if(fPairCut->PassPairProp(partpair) ) //check pair cut
1449 { //do not meets crietria of the pair cut
1450 continue;
1451 }
1452 else
1453 {//meets criteria of the pair cut
dc2c3f36 1454 for(ii = 0;ii<fNParticleFunctions;ii++)
5c58441a 1455 {
5c58441a 1456 fParticleFunctions[ii]->ProcessDiffEventParticles(partpair);
1457 }
dc2c3f36 1458 }
1459 }// for particles event2
1460 }//while event2
1461 }//for over particles in event1
bed069a4 1462 partEvent2 = partbuffer.Push(partEvent2);
dc2c3f36 1463 }//end of loop over events (1)
bed069a4 1464
1465 partbuffer.SetOwner(kTRUE);
b70eb506 1466 delete partpair;
1467 delete partEvent1;
bed069a4 1468 delete partEvent2;
dc2c3f36 1469}
1470
1471/*************************************************************************************/
78d7c6d3 1472void AliHBTAnalysis::FilterOut(AliAOD* outpart1, AliAOD* outpart2, AliAOD* inpart,
1473 AliAOD* outtrack1, AliAOD* outtrack2, AliAOD* intrack) const
dc2c3f36 1474{
1475 //Puts particles accepted as a first particle by global cut in out1
1476 //and as a second particle in out2
1477
78d7c6d3 1478 AliVAODParticle* part, *track;
dc2c3f36 1479
1480 outpart1->Reset();
1481 outpart2->Reset();
1482 outtrack1->Reset();
1483 outtrack2->Reset();
1484
dc2c3f36 1485 Bool_t in1, in2;
1486
1487 for (Int_t i = 0; i < inpart->GetNumberOfParticles(); i++)
1488 {
1489 in1 = in2 = kTRUE;
1490 part = inpart->GetParticle(i);
1491 track = intrack->GetParticle(i);
1492
17d74b37 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
dc2c3f36 1495
1496 if (gDebug)//to be removed in real analysis
1497 if ( in1 && in2 ) //both cuts accepted, should never happen, just in case
1498 {
1499 //Particle accpted by both cuts
1500 Error("FilterOut","Particle accepted by both cuts");
1501 continue;
1502 }
1503
1504 if (in1)
1505 {
1506 outpart1->AddParticle(part);
1507 outtrack1->AddParticle(track);
1508 continue;
1509 }
1510
1511 if (in2)
1512 {
78d7c6d3 1513 outpart2->AddParticle(new AliAODParticle(*part));
1514 outtrack2->AddParticle(new AliAODParticle(*track));
dc2c3f36 1515 continue;
1516 }
1517 }
dc2c3f36 1518}
1b446896 1519/*************************************************************************************/
81b7b887 1520
78d7c6d3 1521void AliHBTAnalysis::FilterOut(AliAOD* out1, AliAOD* out2, AliAOD* in) const
dc2c3f36 1522{
1523 //Puts particles accepted as a first particle by global cut in out1
1524 //and as a second particle in out2
78d7c6d3 1525 AliVAODParticle* part;
dc2c3f36 1526
1527 out1->Reset();
1528 out2->Reset();
1529
78d7c6d3 1530 AliAODParticleCut *cut1 = fPairCut->GetFirstPartCut();
1531 AliAODParticleCut *cut2 = fPairCut->GetSecondPartCut();
dc2c3f36 1532
1533 Bool_t in1, in2;
1534
1535 for (Int_t i = 0; i < in->GetNumberOfParticles(); i++)
1536 {
1537 in1 = in2 = kTRUE;
1538 part = in->GetParticle(i);
1539
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
1542
1543 if (gDebug)//to be removed in real analysis
1544 if ( in1 && in2 ) //both cuts accepted, should never happen, just in case
1545 {
1546 //Particle accpted by both cuts
1547 Error("FilterOut","Particle accepted by both cuts");
1548 continue;
1549 }
1b446896 1550
dc2c3f36 1551 if (in1)
1552 {
1553 out1->AddParticle(part);
1554 continue;
1555 }
1556
1557 if (in2)
1558 {
1559 out2->AddParticle(part);
1560 continue;
1561 }
1562 }
1563}
1564/*************************************************************************************/
1b446896 1565
dc2c3f36 1566Bool_t AliHBTAnalysis::IsNonIdentAnalysis()
1567{
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
1573
5c58441a 1574 if (fPairCut->IsEmpty())
1575 return kFALSE;
1576
1577 if (fPairCut->GetFirstPartCut()->IsEmpty())
1578 return kFALSE;
1579
1580 if (fPairCut->GetSecondPartCut()->IsEmpty())
1581 return kFALSE;
dc2c3f36 1582
1583 Int_t id1 = fPairCut->GetFirstPartCut()->GetPID();
1584 Int_t id2 = fPairCut->GetSecondPartCut()->GetPID();
dc2c3f36 1585
5c58441a 1586 if ( (id1==0) || (id2==0) || (id1==id2) )
1587 return kFALSE;
1588
dc2c3f36 1589 return kTRUE;
1590}
66d1d1a4 1591/*************************************************************************************/
9616170a 1592
66d1d1a4 1593void AliHBTAnalysis::SetCutsOnParticles()
1594{
1595 // -- aplies only to Process("TracksAndParticles")
1596 // (ProcessTracksAndParticles and ProcessTracksAndParticlesNonIdentAnal)
1597 // Only particles properties are checkes against cuts
17d74b37 1598 fkPass = &AliHBTAnalysis::PassPart;
1599 fkPass1 = &AliHBTAnalysis::PassPart1;
1600 fkPass2 = &AliHBTAnalysis::PassPart2;
1601 fkPassPairProp = &AliHBTAnalysis::PassPairPropPart;
66d1d1a4 1602
1603}
1604/*************************************************************************************/
1605
1606void AliHBTAnalysis::SetCutsOnTracks()
1607{
1608 // -- aplies only to Process("TracksAndParticles")
1609 // (ProcessTracksAndParticles and ProcessTracksAndParticlesNonIdentAnal)
1610 // Only tracks properties are checkes against cuts
17d74b37 1611 fkPass = &AliHBTAnalysis::PassTrack;
1612 fkPass1 = &AliHBTAnalysis::PassTrack1;
1613 fkPass2 = &AliHBTAnalysis::PassTrack2;
1614 fkPassPairProp = &AliHBTAnalysis::PassPairPropTrack;
66d1d1a4 1615
1616}
1617/*************************************************************************************/
1618
1619void AliHBTAnalysis::SetCutsOnTracksAndParticles()
1620{
1621 // -- aplies only to Process("TracksAndParticles")
1622 // (ProcessTracksAndParticles and ProcessTracksAndParticlesNonIdentAnal)
1623 // Both, tracks and particles, properties are checked against cuts
17d74b37 1624 fkPass = &AliHBTAnalysis::PassPartAndTrack;
1625 fkPass1 = &AliHBTAnalysis::PassPartAndTrack1;
1626 fkPass2 = &AliHBTAnalysis::PassPartAndTrack2;
1627 fkPassPairProp = &AliHBTAnalysis::PassPairPropPartAndTrack;
66d1d1a4 1628}
9616170a 1629/*************************************************************************************/
1630
1631void AliHBTAnalysis::PressAnyKey()
17d74b37 1632{
1633 //small utility function that helps to make comfortable macros
9616170a 1634 char c;
1635 int nread = -1;
1636 fcntl(0, F_SETFL, O_NONBLOCK);
1637 ::Info("","Press Any Key to continue ...");
1638 while (nread<1)
1639 {
1640 nread = read(0, &c, 1);
1641 gSystem->ProcessEvents();
1642 }
1643}
1644
66d1d1a4 1645/*************************************************************************************/
9616170a 1646