]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HBTAN/AliHBTAnalysis.cxx
Dummy copy constructor
[u/mrichter/AliRoot.git] / HBTAN / AliHBTAnalysis.cxx
CommitLineData
1b446896 1#include "AliHBTAnalysis.h"
1b446896 2#include "AliHBTRun.h"
dc2c3f36 3#include "AliHBTEvent.h"
1b446896 4#include "AliHBTReader.h"
5#include "AliHBTParticle.h"
6#include "AliHBTParticleCut.h"
7#include "AliHBTPair.h"
8#include "AliHBTPairCut.h"
9#include "AliHBTFunction.h"
5c58441a 10#include "AliHBTMonitorFunction.h"
81b7b887 11
dc2c3f36 12#include <TBenchmark.h>
1b446896 13#include <TList.h>
14
e4f2b1da 15//_________________________________________________________
16///////////////////////////////////////////////////////////
17//
18//Central Object Of HBTAnalyser:
19//This class performs main looping within HBT Analysis
20//User must plug a reader of Type AliHBTReader
21//User plugs in coorelation and monitor functions
22//as well as monitor functions
23//
24//HBT Analysis Tool, which is integral part of AliRoot,
25//ALICE Off-Line framework:
26//
27//Piotr.Skowronski@cern.ch
28//more info: http://alisoft.cern.ch/people/skowron/analyzer/index.html
29//
30//_________________________________________________________
31
1b446896 32ClassImp(AliHBTAnalysis)
33
34const UInt_t AliHBTAnalysis::fgkFctnArraySize = 100;
81b7b887 35const UInt_t AliHBTAnalysis::fgkDefaultMixingInfo = 1000;
36const Int_t AliHBTAnalysis::fgkDefaultBufferSize = 5;
37
38AliHBTAnalysis::AliHBTAnalysis():
2dc7203b 39 fReader(0x0),
40 fNTrackFunctions(0),
41 fNParticleFunctions(0),
42 fNParticleAndTrackFunctions(0),
43 fNTrackMonitorFunctions(0),
44 fNParticleMonitorFunctions(0),
45 fNParticleAndTrackMonitorFunctions(0),
46 fBufferSize(2),
47 fDisplayMixingInfo(fgkDefaultMixingInfo),
48 fIsOwner(kFALSE)
1b446896 49 {
2dc7203b 50//default constructor
27b3fe5d 51 fTrackFunctions = new AliHBTOnePairFctn* [fgkFctnArraySize];
52 fParticleFunctions = new AliHBTOnePairFctn* [fgkFctnArraySize];
53 fParticleAndTrackFunctions = new AliHBTTwoPairFctn* [fgkFctnArraySize];
1b446896 54
5c58441a 55 fParticleMonitorFunctions = new AliHBTMonOneParticleFctn* [fgkFctnArraySize];
56 fTrackMonitorFunctions = new AliHBTMonOneParticleFctn* [fgkFctnArraySize];
57 fParticleAndTrackMonitorFunctions = new AliHBTMonTwoParticleFctn* [fgkFctnArraySize];
58
1b446896 59 fPairCut = new AliHBTEmptyPairCut();//empty cut - accepts all particles
1b446896 60 }
491d1b5d 61/*************************************************************************************/
1b446896 62
81b7b887 63AliHBTAnalysis::AliHBTAnalysis(const AliHBTAnalysis& in):
bdec021f 64 TObject(in),
2dc7203b 65 fReader(0x0),
66 fNTrackFunctions(0),
67 fNParticleFunctions(0),
68 fNParticleAndTrackFunctions(0),
69 fNTrackMonitorFunctions(0),
70 fNParticleMonitorFunctions(0),
71 fNParticleAndTrackMonitorFunctions(0),
72 fTrackFunctions(0x0),
73 fParticleFunctions(0x0),
74 fParticleAndTrackFunctions(0x0),
75 fParticleMonitorFunctions(0x0),
76 fTrackMonitorFunctions(0x0),
77 fParticleAndTrackMonitorFunctions(0x0),
78 fPairCut(0x0),
79 fBufferSize(fgkDefaultBufferSize),
80 fDisplayMixingInfo(fgkDefaultMixingInfo),
81 fIsOwner(kFALSE)
81b7b887 82 {
2dc7203b 83//copy constructor
81b7b887 84 Fatal("AliHBTAnalysis(const AliHBTAnalysis&)","Sensless");
85 }
86/*************************************************************************************/
bdec021f 87const AliHBTAnalysis& AliHBTAnalysis::operator=(const AliHBTAnalysis& /*right*/)
81b7b887 88 {
2dc7203b 89//operator =
81b7b887 90 Fatal("AliHBTAnalysis(const AliHBTAnalysis&)","Sensless");
91 return *this;
92 }
93/*************************************************************************************/
1b446896 94AliHBTAnalysis::~AliHBTAnalysis()
95 {
96 //destructor
97 //note that we do not delete functions itself
98 // they should be deleted by whom where created
99 //we only store pointers, and we use "new" only for pointers array
b70eb506 100 if (fIsOwner)
101 DeleteFunctions();
1b446896 102 delete [] fTrackFunctions;
103 delete [] fParticleFunctions;
104 delete [] fParticleAndTrackFunctions;
105
5c58441a 106 delete [] fParticleMonitorFunctions;
107 delete [] fTrackMonitorFunctions;
108 delete [] fParticleAndTrackMonitorFunctions;
109
1b446896 110 delete fPairCut; // always have an copy of an object - we create we dstroy
111 }
112
113/*************************************************************************************/
e4f2b1da 114
81b7b887 115void AliHBTAnalysis::DeleteFunctions()
116{
e4f2b1da 117 //Deletes all functions added to analysis
81b7b887 118 UInt_t ii;
119 for(ii = 0;ii<fNParticleFunctions;ii++)
120 delete fParticleFunctions[ii];
e4f2b1da 121 fNParticleFunctions = 0;
81b7b887 122
123 for(ii = 0;ii<fNTrackFunctions;ii++)
124 delete fTrackFunctions[ii];
e4f2b1da 125 fNTrackFunctions = 0;
126
81b7b887 127 for(ii = 0;ii<fNParticleAndTrackFunctions;ii++)
128 delete fParticleAndTrackFunctions[ii];
e4f2b1da 129 fNParticleAndTrackFunctions = 0;
81b7b887 130
131 for(ii = 0; ii<fNParticleMonitorFunctions; ii++)
132 delete fParticleMonitorFunctions[ii];
e4f2b1da 133 fNParticleMonitorFunctions = 0;
81b7b887 134
135 for(ii = 0; ii<fNTrackMonitorFunctions; ii++)
136 delete fTrackMonitorFunctions[ii];
e4f2b1da 137 fNTrackMonitorFunctions = 0;
81b7b887 138
139 for(ii = 0; ii<fNParticleAndTrackMonitorFunctions; ii++)
140 delete fParticleAndTrackMonitorFunctions[ii];
e4f2b1da 141 fNParticleAndTrackMonitorFunctions = 0;
81b7b887 142}
e4f2b1da 143/*************************************************************************************/
144
145void AliHBTAnalysis::Init()
146{
2dc7203b 147//Initializeation method
148//calls Init for all functions
e4f2b1da 149 UInt_t ii;
150 for(ii = 0;ii<fNParticleFunctions;ii++)
151 fParticleFunctions[ii]->Init();
152
153 for(ii = 0;ii<fNTrackFunctions;ii++)
154 fTrackFunctions[ii]->Init();
155
156 for(ii = 0;ii<fNParticleAndTrackFunctions;ii++)
157 fParticleAndTrackFunctions[ii]->Init();
158
159 for(ii = 0; ii<fNParticleMonitorFunctions; ii++)
160 fParticleMonitorFunctions[ii]->Init();
161
162 for(ii = 0; ii<fNTrackMonitorFunctions; ii++)
163 fTrackMonitorFunctions[ii]->Init();
164
165 for(ii = 0; ii<fNParticleAndTrackMonitorFunctions; ii++)
166 fParticleAndTrackMonitorFunctions[ii]->Init();
167}
168/*************************************************************************************/
169
170void AliHBTAnalysis::ResetFunctions()
171{
172//In case fOwner is true, deletes all functions
173//in other case, just set number of analysis to 0
174 if (fIsOwner) DeleteFunctions();
175 else
176 {
177 fNParticleFunctions = 0;
178 fNTrackFunctions = 0;
179 fNParticleAndTrackFunctions = 0;
180 fNParticleMonitorFunctions = 0;
181 fNTrackMonitorFunctions = 0;
182 fNParticleAndTrackMonitorFunctions = 0;
183 }
184}
185/*************************************************************************************/
186
1b446896 187void AliHBTAnalysis::Process(Option_t* option)
188{
189 //default option = "TracksAndParticles"
190 //Main method of the HBT Analysis Package
191 //It triggers reading with the global cut (default is an empty cut)
192 //Than it checks options and data which are read
193 //if everything is OK, then it calls one of the looping methods
194 //depending on tfReaderhe option
195 //These methods differs on what thay are looping on
196 //
197 // METHOD OPTION
198 //--------------------------------------------------------------------
199 //ProcessTracksAndParticles - "TracksAndParticles"
200 // DEFAULT
201 // it loops over both, tracks(reconstructed) and particles(simulated)
202 // all function gethered in all 3 lists are called for each (double)pair
203 //
204 //ProcessTracks - "Tracks"
205 // it loops only on tracks(reconstructed),
206 // functions ONLY from fTrackFunctions list are called
207 //
208 //ProcessParticles - "Particles"
209 // it loops only on particles(simulated),
210 // functions ONLY from fParticleAndTrackFunctions list are called
211 //
212 //
213 if (!fReader)
214 {
01725374 215 Error("Process","The reader is not set");
1b446896 216 return;
217 }
218
1b446896 219 const char *oT = strstr(option,"Tracks");
220 const char *oP = strstr(option,"Particles");
221
dc2c3f36 222 Bool_t nonid = IsNonIdentAnalysis();
223
1b446896 224 if(oT && oP)
225 {
226 if (fReader->GetNumberOfPartEvents() <1)
227 {
01725374 228 Error("Process","There is no Particles. Maybe change the option?");
1b446896 229 return;
230 }
231 if (fReader->GetNumberOfTrackEvents() <1)
232 {
01725374 233 Error("Process","There is no Tracks. Maybe change the option?");
1b446896 234 return;
235 }
236
237 if ( RunCoherencyCheck() )
238 {
01725374 239 Error("Process",
1b446896 240 "Coherency check not passed. Maybe change the option?\n");
241 return;
242 }
2c33acf3 243 Init();
dc2c3f36 244 if (nonid) ProcessTracksAndParticlesNonIdentAnal();
245 else ProcessTracksAndParticles();
1b446896 246 return;
247 }
248
249 if(oT)
250 {
7836ee94 251 if (fReader->GetNumberOfTrackEvents() <1)
252 {
253 Error("Process","There is no data to analyze.");
254 return;
255 }
2c33acf3 256 Init();
dc2c3f36 257 if (nonid) ProcessTracksNonIdentAnal();
258 else ProcessTracks();
1b446896 259 return;
260 }
261
262 if(oP)
263 {
7836ee94 264 if (fReader->GetNumberOfPartEvents() <1)
265 {
266 Error("Process","There is no data to analyze.");
267 return;
268 }
2c33acf3 269 Init();
dc2c3f36 270 if (nonid) ProcessParticlesNonIdentAnal();
271 else ProcessParticles();
1b446896 272 return;
273 }
274
275}
1b446896 276/*************************************************************************************/
491d1b5d 277
1b446896 278void AliHBTAnalysis::ProcessTracksAndParticles()
279{
1b446896 280//In order to minimize calling AliRun::GetEvent (we need at one time particles from different events),
281//the loops are splited
282
283
284 AliHBTParticle * part1, * part2;
285 AliHBTParticle * track1, * track2;
286
287 AliHBTEvent * trackEvent, *partEvent;
288 AliHBTEvent * trackEvent2,*partEvent2;
289
290// Int_t N1, N2, N=0; //number of particles in current event(we prcess two events in one time)
291
2dc7203b 292 Int_t nev = fReader->GetNumberOfTrackEvents();
1b446896 293
294 /***************************************/
295 /****** Looping same events ********/
296 /****** filling numerators ********/
297 /***************************************/
298 AliHBTPair * trackpair = new AliHBTPair();
299 AliHBTPair * partpair = new AliHBTPair();
491d1b5d 300
301 AliHBTPair * tmptrackpair;//temprary pointers to pairs
302 AliHBTPair * tmppartpair;
81b7b887 303
304 register UInt_t ii;
7a2c8238 305
2dc7203b 306 for (Int_t i = 0;i<nev;i++)
1b446896 307 {
308 partEvent= fReader->GetParticleEvent(i);
309 trackEvent = fReader->GetTrackEvent(i);
310
311 if (!partEvent) continue;
312
313 //N = 0;
314
315 for (Int_t j = 0; j<partEvent->GetNumberOfParticles() ; j++)
316 {
81b7b887 317
318 if ( (j%fDisplayMixingInfo) == 0)
319 Info("ProcessTracksAndParticles",
320 "Mixing particle %d from event %d with particles from event %d",j,i,i);
1b446896 321
322 part1= partEvent->GetParticle(j);
5c58441a 323 track1= trackEvent->GetParticle(j);
81b7b887 324
325 if (fPairCut->GetFirstPartCut()->Pass(part1)) continue;
326
327 for(ii = 0; ii<fNParticleMonitorFunctions; ii++)
e4f2b1da 328 fParticleMonitorFunctions[ii]->Process(part1);
81b7b887 329 for(ii = 0; ii<fNTrackMonitorFunctions; ii++)
e4f2b1da 330 fTrackMonitorFunctions[ii]->Process(track1);
81b7b887 331 for(ii = 0; ii<fNParticleAndTrackMonitorFunctions; ii++)
e4f2b1da 332 fParticleAndTrackMonitorFunctions[ii]->Process(track1,part1);
5c58441a 333
334 if ( (fNParticleFunctions == 0) && (fNTrackFunctions ==0) && (fNParticleAndTrackFunctions == 0))
335 continue;
336
1b446896 337 for (Int_t k =j+1; k < partEvent->GetNumberOfParticles() ; k++)
338 {
339 part2= partEvent->GetParticle(k);
d74e6a27 340 if (part1->GetUID() == part2->GetUID()) continue;
1b446896 341 partpair->SetParticles(part1,part2);
342
5c58441a 343 track2= trackEvent->GetParticle(k);
1b446896 344 trackpair->SetParticles(track1,track2);
345
81b7b887 346 if(fPairCut->Pass(partpair) ) //check pair cut
1b446896 347 { //do not meets crietria of the pair cut, try with swaped pairs
81b7b887 348 if( fPairCut->Pass(partpair->GetSwapedPair()) )
1b446896 349 continue; //swaped pairs do not meet criteria of pair cut as well, take next particle
350 else
5c58441a 351 { //swaped pair meets all the criteria
491d1b5d 352 tmppartpair = partpair->GetSwapedPair();
353 tmptrackpair = trackpair->GetSwapedPair();
1b446896 354 }
355 }
491d1b5d 356 else
357 {//meets criteria of the pair cut
358 tmptrackpair = trackpair;
359 tmppartpair = partpair;
360 }
1b446896 361 for(ii = 0;ii<fNParticleFunctions;ii++)
491d1b5d 362 fParticleFunctions[ii]->ProcessSameEventParticles(tmppartpair);
1b446896 363
364 for(ii = 0;ii<fNTrackFunctions;ii++)
491d1b5d 365 fTrackFunctions[ii]->ProcessSameEventParticles(tmptrackpair);
1b446896 366
367 for(ii = 0;ii<fNParticleAndTrackFunctions;ii++)
491d1b5d 368 fParticleAndTrackFunctions[ii]->ProcessSameEventParticles(tmptrackpair,tmppartpair);
1b446896 369 }
370 }
371 }
372
d74e6a27 373
1b446896 374 /***** Filling denominators *********/
375 /***************************************/
81b7b887 376 if (fBufferSize != 0)
2dc7203b 377 for (Int_t i = 0;i<nev-1;i++) //In each event (but last) ....
1b446896 378 {
5c58441a 379
380 if ((fNParticleFunctions == 0) && (fNTrackFunctions ==0) && (fNParticleAndTrackFunctions == 0))
381 continue;
382
1b446896 383 partEvent= fReader->GetParticleEvent(i);
384 if (!partEvent) continue;
385
386 trackEvent = fReader->GetTrackEvent(i);
387
1b446896 388 for (Int_t j = 0; j< partEvent->GetNumberOfParticles(); j++) // ... Loop over all particles ...
389 {
1b446896 390 part1= partEvent->GetParticle(j);
1b446896 391 track1= trackEvent->GetParticle(j);
81b7b887 392
393 if (fPairCut->GetFirstPartCut()->Pass(part1)) continue;
1b446896 394
2dc7203b 395 Int_t maxeventnumber;
7a2c8238 396
2dc7203b 397 if ( ((i+fBufferSize) >= nev) ||( fBufferSize < 0) ) //if buffer size is negative
7a2c8238 398 //or current event+buffersize is greater
399 //than max nuber of events
81b7b887 400 {
2dc7203b 401 maxeventnumber = nev; //set the max event number
81b7b887 402 }
7a2c8238 403 else
81b7b887 404 {
2dc7203b 405 maxeventnumber = i+fBufferSize; //set the current event number + fBufferSize
81b7b887 406 }
1b446896 407
2dc7203b 408 for (Int_t k = i+1; k<maxeventnumber;k++) // ... Loop over next event
1b446896 409 {
410
81b7b887 411 partEvent2= fReader->GetParticleEvent(k);
412 if (!partEvent2) continue;
1b446896 413
81b7b887 414 trackEvent2 = fReader->GetTrackEvent(k);
1b446896 415
81b7b887 416 if ( (j%fDisplayMixingInfo) == 0)
417 Info("ProcessTracksAndParticles",
418 "Mixing particle %d from event %d with particles from event %d",j,i,k);
5c58441a 419
1b446896 420 for(Int_t l = 0; l<partEvent2->GetNumberOfParticles();l++) // ... on all particles
421 {
1b446896 422 part2= partEvent2->GetParticle(l);
423 partpair->SetParticles(part1,part2);
424
425 track2= trackEvent2->GetParticle(l);
426 trackpair->SetParticles(track1,track2);
427
81b7b887 428 if( fPairCut->Pass(partpair) ) //check pair cut
1b446896 429 { //do not meets crietria of the
81b7b887 430 if( fPairCut->Pass(partpair->GetSwapedPair()) )
431 continue;
432 else
433 {
434 tmppartpair = partpair->GetSwapedPair();
435 tmptrackpair = trackpair->GetSwapedPair();
436 }
1b446896 437 }
491d1b5d 438 else
439 {//meets criteria of the pair cut
440 tmptrackpair = trackpair;
441 tmppartpair = partpair;
442 }
1b446896 443 for(ii = 0;ii<fNParticleFunctions;ii++)
491d1b5d 444 fParticleFunctions[ii]->ProcessDiffEventParticles(tmppartpair);
1b446896 445
446 for(ii = 0;ii<fNTrackFunctions;ii++)
491d1b5d 447 fTrackFunctions[ii]->ProcessDiffEventParticles(tmptrackpair);
1b446896 448
449 for(ii = 0;ii<fNParticleAndTrackFunctions;ii++)
491d1b5d 450 fParticleAndTrackFunctions[ii]->ProcessDiffEventParticles(tmptrackpair,tmppartpair);
1b446896 451 }//for(Int_t l = 0; l<N2;l++) // ... on all particles
2dc7203b 452 }//for (Int_t k = i+1; k<maxeventnumber;k++) // ... Loop over next event
1b446896 453 }
1b446896 454 }
1b446896 455 /***************************************/
1b446896 456}
457/*************************************************************************************/
458
459void AliHBTAnalysis::ProcessTracks()
460{
2dc7203b 461//In order to minimize calling AliRun::GetEvent (we need at one time particles from different events),
1b446896 462//the loops are splited
463 AliHBTParticle * track1, * track2;
1b446896 464 AliHBTEvent * trackEvent;
465 AliHBTEvent * trackEvent2;
81b7b887 466
467 UInt_t ii;
2dc7203b 468 Int_t nev = fReader->GetNumberOfTrackEvents();
81b7b887 469
470 AliHBTPair * trackpair = new AliHBTPair();
471 AliHBTPair * tmptrackpair; //temporary pointer
1b446896 472
473 /***************************************/
474 /****** Looping same events ********/
475 /****** filling numerators ********/
476 /***************************************/
2dc7203b 477 for (Int_t i = 0;i<nev;i++)
1b446896 478 {
479 trackEvent = fReader->GetTrackEvent(i);
480 if (!trackEvent) continue;
1b446896 481
482 for (Int_t j = 0; j<trackEvent->GetNumberOfParticles() ; j++)
483 {
81b7b887 484 if ( (j%fDisplayMixingInfo) == 0)
485 Info("ProcessTracks",
486 "Mixing particle %d from event %d with particles from event %d",j,i,i);
487
5c58441a 488 track1= trackEvent->GetParticle(j);
81b7b887 489 if (fPairCut->GetFirstPartCut()->Pass(track1)) continue;
490
491 for(ii = 0; ii<fNTrackMonitorFunctions; ii++)
e4f2b1da 492 fTrackMonitorFunctions[ii]->Process(track1);
5c58441a 493
494 if ( fNTrackFunctions ==0 )
495 continue;
496
1b446896 497 for (Int_t k =j+1; k < trackEvent->GetNumberOfParticles() ; k++)
498 {
d74e6a27 499 track2= trackEvent->GetParticle(k);
500 if (track1->GetUID() == track2->GetUID()) continue;
501
5c58441a 502 trackpair->SetParticles(track1,track2);
503 if(fPairCut->Pass(trackpair)) //check pair cut
81b7b887 504 { //do not meets crietria of the
5c58441a 505 if( fPairCut->Pass(trackpair->GetSwapedPair()) ) continue;
506 else tmptrackpair = trackpair->GetSwapedPair();
81b7b887 507 }
508 else
509 {
510 tmptrackpair = trackpair;
511 }
512 for(ii = 0;ii<fNTrackFunctions;ii++)
513 fTrackFunctions[ii]->ProcessSameEventParticles(tmptrackpair);
514 }
1b446896 515 }
516 }
517
518 /***************************************/
519 /***** Filling diff histogram *********/
520 /***************************************/
81b7b887 521 if (fBufferSize != 0)
2dc7203b 522 for (Int_t i = 0;i<nev-1;i++) //In each event (but last) ....
1b446896 523 {
5c58441a 524 if ( fNTrackFunctions ==0 )
525 continue;
526
1b446896 527 trackEvent = fReader->GetTrackEvent(i);
528 if (!trackEvent) continue;
81b7b887 529
1b446896 530 for (Int_t j = 0; j< trackEvent->GetNumberOfParticles(); j++) // ... Loop over all particles ...
531 {
81b7b887 532 track1= trackEvent->GetParticle(j);
533 if (fPairCut->GetFirstPartCut()->Pass(track1)) continue;
534
2dc7203b 535 Int_t maxeventnumber;
7a2c8238 536
2dc7203b 537 if ( ((i+fBufferSize) >= nev) ||( fBufferSize < 0) ) //if buffer size is negative
81b7b887 538 //or current event+buffersize is greater
539 //than max nuber of events
540 {
2dc7203b 541 maxeventnumber = nev; //set the max event number
81b7b887 542 }
543 else
544 {
2dc7203b 545 maxeventnumber = i+fBufferSize; //set the current event number + fBufferSize
81b7b887 546 }
1b446896 547
2dc7203b 548 for (Int_t k = i+1; k<maxeventnumber;k++) // ... Loop over next event
81b7b887 549 {
550 trackEvent2 = fReader->GetTrackEvent(k);
551 if (!trackEvent2) continue;
1b446896 552
81b7b887 553 if ( (j%fDisplayMixingInfo) == 0)
0465f84a 554 Info("ProcessTracks",
81b7b887 555 "Mixing particle %d from event %d with particles from event %d",j,i,k);
5c58441a 556
81b7b887 557 for(Int_t l = 0; l<trackEvent2->GetNumberOfParticles();l++) // ... on all particles
558 {
559 track2= trackEvent2->GetParticle(l);
560 trackpair->SetParticles(track1,track2);
1b446896 561
81b7b887 562 if(fPairCut->Pass(trackpair)) //check pair cut
563 { //do not meets crietria of the
564 if( fPairCut->Pass(trackpair->GetSwapedPair()) ) continue;
565 else tmptrackpair = trackpair->GetSwapedPair();
566 }
567 else
568 {
569 tmptrackpair = trackpair;
570 }
571 for(ii = 0;ii<fNTrackFunctions;ii++)
572 fTrackFunctions[ii]->ProcessDiffEventParticles(tmptrackpair);
1b446896 573
81b7b887 574 }//for(Int_t l = 0; l<N2;l++) // ... on all particles
2dc7203b 575 }//for (Int_t k = i+1; k<maxeventnumber;k++) // ... Loop over next event
1b446896 576 }
1b446896 577 }
1b446896 578 /***************************************/
1b446896 579}
580
581/*************************************************************************************/
491d1b5d 582
1b446896 583void AliHBTAnalysis::ProcessParticles()
584{
81b7b887 585//In order to minimize calling AliRun::GetEvent (we need at one time particles from different events),
1b446896 586//the loops are splited
587 AliHBTParticle * part1, * part2;
588
589 AliHBTEvent * partEvent;
590 AliHBTEvent * partEvent2;
491d1b5d 591
592 AliHBTPair * partpair = new AliHBTPair();
593 AliHBTPair * tmppartpair; //temporary pointer to the pair
1b446896 594
2dc7203b 595 Int_t nev = fReader->GetNumberOfPartEvents();
1b446896 596
597 /***************************************/
598 /****** Looping same events ********/
599 /****** filling numerators ********/
600 /***************************************/
2dc7203b 601 for (Int_t i = 0;i<nev;i++)
1b446896 602 {
603 partEvent= fReader->GetParticleEvent(i);
604 if (!partEvent) continue;
605 //N = 0;
606
607 for (Int_t j = 0; j<partEvent->GetNumberOfParticles() ; j++)
608 {
81b7b887 609 if ( (j%fDisplayMixingInfo) == 0)
610 Info("ProcessParticles",
611 "Mixing particle %d from event %d with particles from event %d",j,i,i);
1b446896 612
613 part1= partEvent->GetParticle(j);
81b7b887 614 if (fPairCut->GetFirstPartCut()->Pass(part1)) continue;
5c58441a 615
616 UInt_t zz;
617 for(zz = 0; zz<fNParticleMonitorFunctions; zz++)
e4f2b1da 618 fParticleMonitorFunctions[zz]->Process(part1);
5c58441a 619
620 if ( fNParticleFunctions ==0 )
621 continue;
622
1b446896 623 for (Int_t k =j+1; k < partEvent->GetNumberOfParticles() ; k++)
624 {
625 part2= partEvent->GetParticle(k);
d74e6a27 626 if (part1->GetUID() == part2->GetUID()) continue; //this is the same particle but different incarnation (PID)
1b446896 627 partpair->SetParticles(part1,part2);
628
629 if( fPairCut->Pass(partpair) ) //check pair cut
630 { //do not meets crietria of the pair cut, try with swaped pairs
631 if( fPairCut->Pass(partpair->GetSwapedPair() ) )
632 continue; //swaped pairs do not meet criteria of pair cut as well, take next particle
633 else
634 { //swaped pair meets all the criteria
491d1b5d 635 tmppartpair = partpair->GetSwapedPair();
1b446896 636 }
637 }
491d1b5d 638 else
639 {
640 tmppartpair = partpair;
641 }
5c58441a 642
1b446896 643 UInt_t ii;
1b446896 644 for(ii = 0;ii<fNParticleFunctions;ii++)
491d1b5d 645 fParticleFunctions[ii]->ProcessSameEventParticles(tmppartpair);
1b446896 646 }
647 }
648 }
649
650 /***************************************/
651 /***** Filling diff histogram *********/
652 /***************************************/
81b7b887 653 if (fBufferSize != 0) //less then 0 mix everything, == 0 do not mix denominator
2dc7203b 654 for (Int_t i = 0;i<nev-1;i++) //In each event (but last)....
1b446896 655 {
5c58441a 656 if ( fNParticleFunctions ==0 )
657 continue;
658
1b446896 659 partEvent= fReader->GetParticleEvent(i);
660 if (!partEvent) continue;
661
1b446896 662 for (Int_t j = 0; j< partEvent->GetNumberOfParticles(); j++) // ... Loop over all particles ...
663 {
1b446896 664 part1= partEvent->GetParticle(j);
81b7b887 665 if (fPairCut->GetFirstPartCut()->Pass(part1)) continue;
2dc7203b 666 Int_t maxeventnumber;
81b7b887 667
2dc7203b 668 if ( ((i+fBufferSize) >= nev) ||( fBufferSize < 0) ) //if buffer size is negative
7a2c8238 669 //or current event+buffersize is greater
670 //than max nuber of events
671 {
2dc7203b 672 maxeventnumber = nev; //set the max event number
7a2c8238 673 }
674 else
675 {
2dc7203b 676 maxeventnumber = i+fBufferSize; //set the current event number + fBufferSize
7a2c8238 677 }
678
2dc7203b 679 for (Int_t k = i+1; k<maxeventnumber;k++) // ... Loop over next event
1b446896 680 {
681
682 partEvent2= fReader->GetParticleEvent(k);
683 if (!partEvent2) continue;
684
81b7b887 685 if ( (j%fDisplayMixingInfo) == 0)
686 Info("ProcessParticles",
687 "Mixing particle %d from event %d with particles from event %d",j,i,k);
5c58441a 688
1b446896 689 for(Int_t l = 0; l<partEvent2->GetNumberOfParticles();l++) // ... on all particles
690 {
1b446896 691 part2= partEvent2->GetParticle(l);
692 partpair->SetParticles(part1,part2);
693
694 if(fPairCut->Pass(partpair)) //check pair cut
695 { //do not meets crietria of the
696 if( fPairCut->Pass(partpair->GetSwapedPair()) ) continue;
81b7b887 697 else tmppartpair = partpair->GetSwapedPair();
491d1b5d 698 }
699 else
700 {
701 tmppartpair = partpair;
1b446896 702 }
703 UInt_t ii;
704 for(ii = 0;ii<fNParticleFunctions;ii++)
491d1b5d 705 fParticleFunctions[ii]->ProcessDiffEventParticles(tmppartpair);
1b446896 706
707 }//for(Int_t l = 0; l<N2;l++) // ... on all particles
2dc7203b 708 }//for (Int_t k = i+1; k<maxeventnumber;k++) // ... Loop over next event
1b446896 709 }
1b446896 710 }
1b446896 711 /***************************************/
1b446896 712
713}
1b446896 714/*************************************************************************************/
715
491d1b5d 716void AliHBTAnalysis::WriteFunctions()
1b446896 717{
81b7b887 718//Calls Write for all defined functions in analysis
719//== writes all results
1b446896 720 UInt_t ii;
721 for(ii = 0;ii<fNParticleFunctions;ii++)
722 fParticleFunctions[ii]->Write();
723
724 for(ii = 0;ii<fNTrackFunctions;ii++)
725 fTrackFunctions[ii]->Write();
726
727 for(ii = 0;ii<fNParticleAndTrackFunctions;ii++)
728 fParticleAndTrackFunctions[ii]->Write();
5c58441a 729
730 for(ii = 0;ii<fNParticleMonitorFunctions;ii++)
731 fParticleMonitorFunctions[ii]->Write();
732
733 for(ii = 0;ii<fNTrackMonitorFunctions;ii++)
734 fTrackMonitorFunctions[ii]->Write();
735
736 for(ii = 0;ii<fNParticleAndTrackMonitorFunctions;ii++)
737 fParticleAndTrackMonitorFunctions[ii]->Write();
1b446896 738}
739/*************************************************************************************/
491d1b5d 740
1b446896 741void AliHBTAnalysis::SetGlobalPairCut(AliHBTPairCut* cut)
742{
81b7b887 743//Sets the global cut
1b446896 744 if (cut == 0x0)
745 {
746 Error("AliHBTAnalysis::SetGlobalPairCut","Pointer is NULL. Ignoring");
747 }
748 delete fPairCut;
749 fPairCut = (AliHBTPairCut*)cut->Clone();
750}
751
752/*************************************************************************************/
491d1b5d 753
27b3fe5d 754void AliHBTAnalysis::AddTrackFunction(AliHBTOnePairFctn* f)
1b446896 755{
81b7b887 756//Adds track function
1b446896 757 if (f == 0x0) return;
758 if (fNTrackFunctions == fgkFctnArraySize)
759 {
760 Error("AliHBTAnalysis::AddTrackFunction","Can not add this function, not enough place in the array.");
761 }
762 fTrackFunctions[fNTrackFunctions] = f;
763 fNTrackFunctions++;
764}
491d1b5d 765/*************************************************************************************/
766
27b3fe5d 767void AliHBTAnalysis::AddParticleFunction(AliHBTOnePairFctn* f)
1b446896 768{
81b7b887 769//adds particle function
1b446896 770 if (f == 0x0) return;
771
772 if (fNParticleFunctions == fgkFctnArraySize)
773 {
774 Error("AliHBTAnalysis::AddParticleFunction","Can not add this function, not enough place in the array.");
775 }
776 fParticleFunctions[fNParticleFunctions] = f;
777 fNParticleFunctions++;
1b446896 778}
5c58441a 779/*************************************************************************************/
780
27b3fe5d 781void AliHBTAnalysis::AddParticleAndTrackFunction(AliHBTTwoPairFctn* f)
1b446896 782{
81b7b887 783//add resolution function
1b446896 784 if (f == 0x0) return;
785 if (fNParticleAndTrackFunctions == fgkFctnArraySize)
786 {
787 Error("AliHBTAnalysis::AddParticleAndTrackFunction","Can not add this function, not enough place in the array.");
788 }
789 fParticleAndTrackFunctions[fNParticleAndTrackFunctions] = f;
790 fNParticleAndTrackFunctions++;
791}
5c58441a 792/*************************************************************************************/
793
794void AliHBTAnalysis::AddParticleMonitorFunction(AliHBTMonOneParticleFctn* f)
795{
81b7b887 796//add particle monitoring function
5c58441a 797 if (f == 0x0) return;
798
799 if (fNParticleMonitorFunctions == fgkFctnArraySize)
800 {
801 Error("AliHBTAnalysis::AddParticleMonitorFunction","Can not add this function, not enough place in the array.");
802 }
803 fParticleMonitorFunctions[fNParticleMonitorFunctions] = f;
804 fNParticleMonitorFunctions++;
805}
806/*************************************************************************************/
1b446896 807
5c58441a 808void AliHBTAnalysis::AddTrackMonitorFunction(AliHBTMonOneParticleFctn* f)
809{
81b7b887 810//add track monitoring function
5c58441a 811 if (f == 0x0) return;
1b446896 812
5c58441a 813 if (fNTrackMonitorFunctions == fgkFctnArraySize)
814 {
815 Error("AliHBTAnalysis::AddTrackMonitorFunction","Can not add this function, not enough place in the array.");
816 }
817 fTrackMonitorFunctions[fNTrackMonitorFunctions] = f;
818 fNTrackMonitorFunctions++;
819}
1b446896 820/*************************************************************************************/
821
5c58441a 822void AliHBTAnalysis::AddParticleAndTrackMonitorFunction(AliHBTMonTwoParticleFctn* f)
823{
81b7b887 824//add resolution monitoring function
5c58441a 825 if (f == 0x0) return;
826 if (fNParticleAndTrackMonitorFunctions == fgkFctnArraySize)
827 {
828 Error("AliHBTAnalysis::AddParticleAndTrackMonitorFunction","Can not add this function, not enough place in the array.");
829 }
830 fParticleAndTrackMonitorFunctions[fNParticleAndTrackMonitorFunctions] = f;
831 fNParticleAndTrackMonitorFunctions++;
832}
833
1b446896 834
5c58441a 835/*************************************************************************************/
1b446896 836/*************************************************************************************/
491d1b5d 837
1b446896 838Bool_t AliHBTAnalysis::RunCoherencyCheck()
839{
840 //Checks if both HBTRuns are similar
841 //return true if error found
842 //if they seem to be OK return false
843 Int_t i;
81b7b887 844 Info("RunCoherencyCheck","Checking HBT Runs Coherency");
845
846 Info("RunCoherencyCheck","Number of events ...");
1b446896 847 if (fReader->GetNumberOfPartEvents() == fReader->GetNumberOfTrackEvents() ) //check whether there is the same number of events
848 {
81b7b887 849 Info("RunCoherencyCheck","OK. %d found\n",fReader->GetNumberOfTrackEvents());
1b446896 850 }
851 else
852 { //if not the same - ERROR
853 Error("AliHBTAnalysis::RunCoherencyCheck()",
854 "Number of simulated events (%d) is not equal to number of reconstructed events(%d)",
855 fReader->GetNumberOfPartEvents(),fReader->GetNumberOfTrackEvents());
856 return kTRUE;
857 }
858
81b7b887 859 Info("RunCoherencyCheck","Checking number of Particles AND Particles Types in each event ...");
1b446896 860
861 AliHBTEvent *partEvent;
862 AliHBTEvent *trackEvent;
863 for( i = 0; i<fReader->GetNumberOfTrackEvents();i++)
864 {
865 partEvent= fReader->GetParticleEvent(i); //gets the "ith" event
866 trackEvent = fReader->GetTrackEvent(i);
867
868 if ( (partEvent == 0x0) && (partEvent == 0x0) ) continue;
869 if ( (partEvent == 0x0) || (partEvent == 0x0) )
870 {
871 Error("AliHBTAnalysis::RunCoherencyCheck()",
872 "One event is NULL and the other one not. Event Number %d",i);
873 return kTRUE;
874 }
875
876 if ( partEvent->GetNumberOfParticles() != trackEvent->GetNumberOfParticles() )
877 {
878 Error("AliHBTAnalysis::RunCoherencyCheck()",
879 "Event %d: Number of simulated particles (%d) not equal to number of reconstructed tracks (%d)",
880 i,partEvent->GetNumberOfParticles() , trackEvent->GetNumberOfParticles());
881 return kTRUE;
882 }
883 else
884 for (Int_t j = 0; j<partEvent->GetNumberOfParticles(); j++)
885 {
886 if( partEvent->GetParticle(j)->GetPdgCode() != trackEvent->GetParticle(j)->GetPdgCode() )
887 {
888 Error("AliHBTAnalysis::RunCoherencyCheck()",
889 "Event %d: Particle %d: PID of simulated particle (%d) not the same of reconstructed track (%d)",
890 i,j, partEvent->GetParticle(j)->GetPdgCode(),trackEvent->GetParticle(j)->GetPdgCode() );
891 return kTRUE;
892
893 }
894 }
895 }
81b7b887 896 Info("RunCoherencyCheck"," Done");
897 Info("RunCoherencyCheck"," Everything looks OK");
1b446896 898 return kFALSE;
899}
900
dc2c3f36 901/*************************************************************************************/
902
903void AliHBTAnalysis::ProcessTracksAndParticlesNonIdentAnal()
904{
81b7b887 905//Performs analysis for both, tracks and particles
906
dc2c3f36 907 AliHBTParticle * part1, * part2;
908 AliHBTParticle * track1, * track2;
909
aeba88d7 910 AliHBTEvent * trackEvent1=0x0,*partEvent1=0x0;
911 AliHBTEvent * trackEvent2=0x0,*partEvent2=0x0;
912 AliHBTEvent * trackEvent3=0x0,*partEvent3=0x0;
dc2c3f36 913
914 AliHBTEvent * rawtrackEvent, *rawpartEvent;
dc2c3f36 915
2dc7203b 916 Int_t nev = fReader->GetNumberOfTrackEvents();
dc2c3f36 917
918 AliHBTPair * trackpair = new AliHBTPair();
919 AliHBTPair * partpair = new AliHBTPair();
920
921 TList tbuffer;
922 TList pbuffer;
923 Int_t ninbuffer = 0;
81b7b887 924 UInt_t ii;
dc2c3f36 925
926 trackEvent1 = new AliHBTEvent();
927 partEvent1 = new AliHBTEvent();
928 trackEvent1->SetOwner(kFALSE);
929 partEvent1->SetOwner(kFALSE);;
930
81b7b887 931 Info("ProcessTracksAndParticlesNonIdentAnal","**************************************");
932 Info("ProcessTracksAndParticlesNonIdentAnal","***** NON IDENT MODE ****************");
933 Info("ProcessTracksAndParticlesNonIdentAnal","**************************************");
934
2dc7203b 935 for (Int_t i = 0;i<nev;i++)
dc2c3f36 936 {
937 rawpartEvent = fReader->GetParticleEvent(i);
938 rawtrackEvent = fReader->GetTrackEvent(i);
939 if ( (rawpartEvent == 0x0) || (rawtrackEvent == 0x0) ) continue;//in case of any error
940
941 /********************************/
942 /* Filtering out */
943 /********************************/
81b7b887 944 if ( (fBufferSize != 0) || ( (partEvent2==0x0)||(trackEvent2==0x0)) )//in case fBufferSize == 0 and pointers are created do not eneter
945 if ((ninbuffer > fBufferSize) && (fBufferSize > 0))
946 {//if we have in buffer desired number of events, use the last. If fBufferSize<0 mix all events for background
947 partEvent2 = (AliHBTEvent*)pbuffer.Remove(pbuffer.Last()); //remove from the end to be reset, filled and put on the beginning
948 trackEvent2 = (AliHBTEvent*)tbuffer.Remove(tbuffer.Last());
949 ninbuffer--;
950 }
951 else
952 {
953 partEvent2 = new AliHBTEvent();
954 trackEvent2 = new AliHBTEvent();
955 partEvent2->SetOwner(kFALSE);
956 trackEvent2->SetOwner(kFALSE);
957 }
dc2c3f36 958 FilterOut(partEvent1, partEvent2, rawpartEvent, trackEvent1, trackEvent2, rawtrackEvent);
959
960 for (Int_t j = 0; j<partEvent1->GetNumberOfParticles() ; j++)
961 {
81b7b887 962 if ( (j%fDisplayMixingInfo) == 0)
963 Info("ProcessTracksAndParticlesNonIdentAnal",
964 "Mixing particle %d from event %d with particles from event %d",j,i,i);
dc2c3f36 965
966 part1= partEvent1->GetParticle(j);
967 track1= trackEvent1->GetParticle(j);
968
81b7b887 969 for(ii = 0; ii<fNParticleMonitorFunctions; ii++)
e4f2b1da 970 fParticleMonitorFunctions[ii]->Process(part1);
81b7b887 971 for(ii = 0; ii<fNTrackMonitorFunctions; ii++)
e4f2b1da 972 fTrackMonitorFunctions[ii]->Process(track1);
81b7b887 973 for(ii = 0; ii<fNParticleAndTrackMonitorFunctions; ii++)
e4f2b1da 974 fParticleAndTrackMonitorFunctions[ii]->Process(track1,part1);
dc2c3f36 975
976 /***************************************/
977 /****** filling numerators ********/
978 /****** (particles from event2) ********/
979 /***************************************/
980 for (Int_t k = 0; k < partEvent2->GetNumberOfParticles() ; k++)
981 {
982 part2= partEvent2->GetParticle(k);
d74e6a27 983 if (part1->GetUID() == part2->GetUID()) continue;//this is the same particle but with different PID
dc2c3f36 984 partpair->SetParticles(part1,part2);
985
986 track2= trackEvent2->GetParticle(k);
987 trackpair->SetParticles(track1,track2);
988
81b7b887 989 if( (fPairCut->PassPairProp(partpair)) ) //check pair cut
990 { //do not meets crietria of the pair cut
991 continue;
992 }
dc2c3f36 993 else
994 {//meets criteria of the pair cut
dc2c3f36 995 for(ii = 0;ii<fNParticleFunctions;ii++)
996 fParticleFunctions[ii]->ProcessSameEventParticles(partpair);
997
998 for(ii = 0;ii<fNTrackFunctions;ii++)
999 fTrackFunctions[ii]->ProcessSameEventParticles(trackpair);
1000
1001 for(ii = 0;ii<fNParticleAndTrackFunctions;ii++)
1002 fParticleAndTrackFunctions[ii]->ProcessSameEventParticles(trackpair,partpair);
1003 }
1004 }
5c58441a 1005
81b7b887 1006 if ( fBufferSize == 0) continue;//do not mix diff histograms
dc2c3f36 1007 /***************************************/
1008 /***** Filling denominators *********/
1009 /***************************************/
1010 TIter piter(&pbuffer);
1011 TIter titer(&tbuffer);
1012 Int_t nmonitor = 0;
1013
1014 while ( (partEvent3 = (AliHBTEvent*)piter.Next()) != 0x0)
1015 {
1016 trackEvent3 = (AliHBTEvent*)titer.Next();
81b7b887 1017 if ( (j%fDisplayMixingInfo) == 0)
1018 Info("ProcessTracksAndParticlesNonIdentAnal",
1019 "Mixing particle %d from event %d with particles from event %d",j,i,i-(++nmonitor));
dc2c3f36 1020
1021 for (Int_t k = 0; k < partEvent3->GetNumberOfParticles() ; k++)
1022 {
1023 part2= partEvent3->GetParticle(k);
1024 partpair->SetParticles(part1,part2);
1b446896 1025
dc2c3f36 1026 track2= trackEvent3->GetParticle(k);
1027 trackpair->SetParticles(track1,track2);
1028
81b7b887 1029 if( (fPairCut->PassPairProp(partpair)) ) //check pair cut
1030 { //do not meets crietria of the pair cut
1031 continue;
1032 }
dc2c3f36 1033 else
1034 {//meets criteria of the pair cut
1035 UInt_t ii;
1036 for(ii = 0;ii<fNParticleFunctions;ii++)
1037 fParticleFunctions[ii]->ProcessDiffEventParticles(partpair);
1038
1039 for(ii = 0;ii<fNTrackFunctions;ii++)
1040 fTrackFunctions[ii]->ProcessDiffEventParticles(trackpair);
1041
1042 for(ii = 0;ii<fNParticleAndTrackFunctions;ii++)
1043 fParticleAndTrackFunctions[ii]->ProcessDiffEventParticles(trackpair,partpair);
1044 }
1045 }// for particles event2
1046 }//while event2
1047 }//for over particles in event1
1048
b70eb506 1049 if ( fBufferSize == 0) continue;//do not mix diff histograms-> do not add to buffer list
dc2c3f36 1050 pbuffer.AddFirst(partEvent2);
1051 tbuffer.AddFirst(trackEvent2);
81b7b887 1052 partEvent2 = 0x0;
1053 trackEvent2 = 0x0;
dc2c3f36 1054 ninbuffer++;
1055
1056 }//end of loop over events (1)
dc2c3f36 1057 pbuffer.SetOwner(); //to clean stored events by the way of buffer destruction
1058 tbuffer.SetOwner();
b70eb506 1059 delete partEvent1;
1060 delete trackEvent1;
1061 delete partpair;
1062 delete trackpair;
1063 if ( fBufferSize == 0)
1064 {//in that case we did not add these events to list
1065 delete partEvent2;
1066 delete trackEvent2;
1067 }
81b7b887 1068
dc2c3f36 1069}
1b446896 1070/*************************************************************************************/
1071
dc2c3f36 1072void AliHBTAnalysis::ProcessTracksNonIdentAnal()
1073{
2dc7203b 1074//Process Tracks only with non identical mode
dc2c3f36 1075 AliHBTParticle * track1, * track2;
1076
aeba88d7 1077 AliHBTEvent * trackEvent1=0x0;
1078 AliHBTEvent * trackEvent2=0x0;
1079 AliHBTEvent * trackEvent3=0x0;
dc2c3f36 1080
d74e6a27 1081
dc2c3f36 1082 AliHBTEvent * rawtrackEvent;
dc2c3f36 1083
2dc7203b 1084 Int_t nev = fReader->GetNumberOfTrackEvents();
dc2c3f36 1085
1086 AliHBTPair * trackpair = new AliHBTPair();
1087
1088 TList tbuffer;
1089 Int_t ninbuffer = 0;
81b7b887 1090 register UInt_t ii;
dc2c3f36 1091
1092 trackEvent1 = new AliHBTEvent();
1093 trackEvent1->SetOwner(kFALSE);
1094
81b7b887 1095 Info("ProcessTracksNonIdentAnal","**************************************");
1096 Info("ProcessTracksNonIdentAnal","***** NON IDENT MODE ****************");
1097 Info("ProcessTracksNonIdentAnal","**************************************");
1098
2dc7203b 1099 for (Int_t i = 0;i<nev;i++)
dc2c3f36 1100 {
1101 rawtrackEvent = fReader->GetTrackEvent(i);
1102 if (rawtrackEvent == 0x0) continue;//in case of any error
1103
1104 /********************************/
1105 /* Filtering out */
1106 /********************************/
81b7b887 1107 if ( (fBufferSize != 0) || ( trackEvent2==0x0) )//in case fBufferSize == 0 and pointers are created do not eneter
1108 if ((ninbuffer > fBufferSize) && (fBufferSize > 0))
1109 {//if we have in buffer desired number of events, use the last. If fBufferSize<0 mix all events for background
1110 trackEvent2 = (AliHBTEvent*)tbuffer.Remove(tbuffer.Last());
1111 ninbuffer--;
1112 }
1113 else
1114 {
1115 trackEvent2 = new AliHBTEvent();
1116 trackEvent2->SetOwner(kFALSE);
1117 }
dc2c3f36 1118 FilterOut(trackEvent1, trackEvent2, rawtrackEvent);
1119
1120 for (Int_t j = 0; j<trackEvent1->GetNumberOfParticles() ; j++)
1121 {
81b7b887 1122 if ( (j%fDisplayMixingInfo) == 0)
1123 Info("ProcessTracksNonIdentAnal",
1124 "Mixing particle %d from event %d with particles from event %d",j,i,i);
dc2c3f36 1125
1126 track1= trackEvent1->GetParticle(j);
1127
81b7b887 1128 for(ii = 0; ii<fNTrackMonitorFunctions; ii++)
e4f2b1da 1129 fTrackMonitorFunctions[ii]->Process(track1);
dc2c3f36 1130
1131 /***************************************/
1132 /****** filling numerators ********/
1133 /****** (particles from event2) ********/
1134 /***************************************/
1135 for (Int_t k = 0; k < trackEvent2->GetNumberOfParticles() ; k++)
1136 {
1137 track2= trackEvent2->GetParticle(k);
d74e6a27 1138 if (track1->GetUID() == track2->GetUID()) continue;//this is the same particle but with different PID
dc2c3f36 1139 trackpair->SetParticles(track1,track2);
1140
1141
1142 if( fPairCut->PassPairProp(trackpair)) //check pair cut
1143 { //do not meets crietria of the pair cut
1144 continue;
1145 }
1146 else
1147 {//meets criteria of the pair cut
1148 UInt_t ii;
1149 for(ii = 0;ii<fNTrackFunctions;ii++)
1150 fTrackFunctions[ii]->ProcessSameEventParticles(trackpair);
1151 }
1152 }
81b7b887 1153 if ( fBufferSize == 0) continue;//do not mix diff histograms
dc2c3f36 1154 /***************************************/
1155 /***** Filling denominators *********/
1156 /***************************************/
1157 TIter titer(&tbuffer);
1158 Int_t nmonitor = 0;
1159
1160 while ( (trackEvent3 = (AliHBTEvent*)titer.Next()) != 0x0)
1161 {
1162
81b7b887 1163 if ( (j%fDisplayMixingInfo) == 0)
1164 Info("ProcessTracksNonIdentAnal",
1165 "Mixing particle %d from event %d with particles from event %d",j,i,i-(++nmonitor));
dc2c3f36 1166
1167 for (Int_t k = 0; k < trackEvent3->GetNumberOfParticles() ; k++)
1168 {
1169
1170 track2= trackEvent3->GetParticle(k);
1171 trackpair->SetParticles(track1,track2);
1172
1173
1174 if( fPairCut->PassPairProp(trackpair)) //check pair cut
81b7b887 1175 { //do not meets crietria of the pair cut
1176 continue;
1177 }
dc2c3f36 1178 else
1179 {//meets criteria of the pair cut
81b7b887 1180 for(ii = 0;ii<fNTrackFunctions;ii++)
1181 fTrackFunctions[ii]->ProcessDiffEventParticles(trackpair);
dc2c3f36 1182 }
1183 }// for particles event2
1184 }//while event2
1185 }//for over particles in event1
1186
b70eb506 1187 if ( fBufferSize == 0) continue;//do not mix diff histograms
dc2c3f36 1188 tbuffer.AddFirst(trackEvent2);
b70eb506 1189 trackEvent2 = 0x0;
dc2c3f36 1190 ninbuffer++;
1191
1192 }//end of loop over events (1)
b70eb506 1193
1194 delete trackpair;
1195 delete trackEvent1;
1196 if (fBufferSize == 0) delete trackEvent2;
dc2c3f36 1197 tbuffer.SetOwner();
1198}
1199/*************************************************************************************/
1200
1201void AliHBTAnalysis::ProcessParticlesNonIdentAnal()
1202{
2dc7203b 1203//process paricles only with non identical mode
dc2c3f36 1204 AliHBTParticle * part1 = 0x0, * part2 = 0x0;
1205
1206 AliHBTEvent * partEvent1 = 0x0;
1207 AliHBTEvent * partEvent2 = 0x0;
1208 AliHBTEvent * partEvent3 = 0x0;
1209
1210 AliHBTEvent * rawpartEvent = 0x0;
1211
2dc7203b 1212 Int_t nev = fReader->GetNumberOfPartEvents();
dc2c3f36 1213
1214 AliHBTPair * partpair = new AliHBTPair();
1215
1216 TList pbuffer;
1217 Int_t ninbuffer = 0;
1218
1219 partEvent1 = new AliHBTEvent();
1220 partEvent1->SetOwner(kFALSE);;
1221
81b7b887 1222 Info("ProcessParticlesNonIdentAnal","**************************************");
1223 Info("ProcessParticlesNonIdentAnal","***** NON IDENT MODE ****************");
1224 Info("ProcessParticlesNonIdentAnal","**************************************");
dc2c3f36 1225
2dc7203b 1226 for (Int_t i = 0;i<nev;i++)
dc2c3f36 1227 {
1228 rawpartEvent = fReader->GetParticleEvent(i);
1229 if ( rawpartEvent == 0x0 ) continue;//in case of any error
1230
1231 /********************************/
1232 /* Filtering out */
1233 /********************************/
b70eb506 1234 if ( (fBufferSize != 0) || ( partEvent2==0x0) )//in case fBufferSize == 0 and pointers are created do not eneter
1235 if ((ninbuffer > fBufferSize) && (fBufferSize > 0))
1236 {//if we have in buffer desired number of events, use the last. If fBufferSize<0 mix all events for background
1237 partEvent2 = (AliHBTEvent*)pbuffer.Remove(pbuffer.Last()); //remove from the end to be reset, filled and put on the beginning
1238 ninbuffer--;
1239 }
1240 else
1241 {
1242 partEvent2 = new AliHBTEvent();
1243 partEvent2->SetOwner(kFALSE);
1244 }
dc2c3f36 1245 FilterOut(partEvent1, partEvent2, rawpartEvent);
1246
1247 for (Int_t j = 0; j<partEvent1->GetNumberOfParticles() ; j++)
1248 {
81b7b887 1249 if ( (j%fDisplayMixingInfo) == 0)
1250 Info("ProcessParticlesNonIdentAnal",
1251 "Mixing particle %d from event %d with particles from event %d",j,i,i);
dc2c3f36 1252
1253 part1= partEvent1->GetParticle(j);
1254
5c58441a 1255 UInt_t zz;
1256 for(zz = 0; zz<fNParticleMonitorFunctions; zz++)
e4f2b1da 1257 fParticleMonitorFunctions[zz]->Process(part1);
dc2c3f36 1258
1259 /***************************************/
1260 /****** filling numerators ********/
1261 /****** (particles from event2) ********/
1262 /***************************************/
1263 for (Int_t k = 0; k < partEvent2->GetNumberOfParticles() ; k++)
1264 {
1265 part2= partEvent2->GetParticle(k);
d74e6a27 1266 if (part1->GetUID() == part2->GetUID()) continue;//this is the same particle but with different PID
dc2c3f36 1267 partpair->SetParticles(part1,part2);
1268
1269 if(fPairCut->PassPairProp(partpair) ) //check pair cut
1270 { //do not meets crietria of the pair cut
1271 continue;
1272 }
1273 else
1274 {//meets criteria of the pair cut
1275 UInt_t ii;
1276 for(ii = 0;ii<fNParticleFunctions;ii++)
5c58441a 1277 {
5c58441a 1278 fParticleFunctions[ii]->ProcessSameEventParticles(partpair);
1279 }
dc2c3f36 1280 }
1281 }
b70eb506 1282 if ( fBufferSize == 0) continue;//do not mix diff histograms
dc2c3f36 1283 /***************************************/
1284 /***** Filling denominators *********/
1285 /***************************************/
1286 TIter piter(&pbuffer);
1287 Int_t nmonitor = 0;
1288
1289 while ( (partEvent3 = (AliHBTEvent*)piter.Next()) != 0x0)
1290 {
81b7b887 1291 if ( (j%fDisplayMixingInfo) == 0)
1292 Info("ProcessParticlesNonIdentAnal",
1293 "Mixing particle %d from event %d with particles from event %d",j,i,i-(++nmonitor));
1294
dc2c3f36 1295 for (Int_t k = 0; k < partEvent3->GetNumberOfParticles() ; k++)
1296 {
1297 part2= partEvent3->GetParticle(k);
1298 partpair->SetParticles(part1,part2);
1299
dc2c3f36 1300 if(fPairCut->PassPairProp(partpair) ) //check pair cut
1301 { //do not meets crietria of the pair cut
1302 continue;
1303 }
1304 else
1305 {//meets criteria of the pair cut
1306 UInt_t ii;
1307 for(ii = 0;ii<fNParticleFunctions;ii++)
5c58441a 1308 {
5c58441a 1309 fParticleFunctions[ii]->ProcessDiffEventParticles(partpair);
1310 }
dc2c3f36 1311 }
1312 }// for particles event2
1313 }//while event2
1314 }//for over particles in event1
b70eb506 1315 if ( fBufferSize == 0) continue;//do not mix diff histograms
dc2c3f36 1316 pbuffer.AddFirst(partEvent2);
b70eb506 1317 partEvent2 = 0x0;
dc2c3f36 1318 ninbuffer++;
1319
1320 }//end of loop over events (1)
b70eb506 1321 delete partpair;
1322 delete partEvent1;
1323 if ( fBufferSize == 0) delete partEvent2;
dc2c3f36 1324 pbuffer.SetOwner();//to delete stered events.
1325}
1326
1327/*************************************************************************************/
1328void AliHBTAnalysis::FilterOut(AliHBTEvent* outpart1, AliHBTEvent* outpart2, AliHBTEvent* inpart,
1329 AliHBTEvent* outtrack1, AliHBTEvent* outtrack2, AliHBTEvent* intrack)
1330{
1331 //Puts particles accepted as a first particle by global cut in out1
1332 //and as a second particle in out2
1333
1334 AliHBTParticle* part, *track;
1335
1336 outpart1->Reset();
1337 outpart2->Reset();
1338 outtrack1->Reset();
1339 outtrack2->Reset();
1340
1341 AliHBTParticleCut *cut1 = fPairCut->GetFirstPartCut();
1342 AliHBTParticleCut *cut2 = fPairCut->GetSecondPartCut();
1343
1344 Bool_t in1, in2;
1345
1346 for (Int_t i = 0; i < inpart->GetNumberOfParticles(); i++)
1347 {
1348 in1 = in2 = kTRUE;
1349 part = inpart->GetParticle(i);
1350 track = intrack->GetParticle(i);
1351
81b7b887 1352 if ( (cut1->Pass(part)) ) in1 = kFALSE; //if part is rejected by cut1, in1 is false
1353 if ( (cut2->Pass(part)) ) in2 = kFALSE; //if part is rejected by cut2, in2 is false
dc2c3f36 1354
1355 if (gDebug)//to be removed in real analysis
1356 if ( in1 && in2 ) //both cuts accepted, should never happen, just in case
1357 {
1358 //Particle accpted by both cuts
1359 Error("FilterOut","Particle accepted by both cuts");
1360 continue;
1361 }
1362
1363 if (in1)
1364 {
1365 outpart1->AddParticle(part);
1366 outtrack1->AddParticle(track);
1367 continue;
1368 }
1369
1370 if (in2)
1371 {
1372 outpart2->AddParticle(part);
1373 outtrack2->AddParticle(track);
1374 continue;
1375 }
1376 }
dc2c3f36 1377}
1b446896 1378/*************************************************************************************/
81b7b887 1379
dc2c3f36 1380void AliHBTAnalysis::FilterOut(AliHBTEvent* out1, AliHBTEvent* out2, AliHBTEvent* in)
1381{
1382 //Puts particles accepted as a first particle by global cut in out1
1383 //and as a second particle in out2
1384 AliHBTParticle* part;
1385
1386 out1->Reset();
1387 out2->Reset();
1388
1389 AliHBTParticleCut *cut1 = fPairCut->GetFirstPartCut();
1390 AliHBTParticleCut *cut2 = fPairCut->GetSecondPartCut();
1391
1392 Bool_t in1, in2;
1393
1394 for (Int_t i = 0; i < in->GetNumberOfParticles(); i++)
1395 {
1396 in1 = in2 = kTRUE;
1397 part = in->GetParticle(i);
1398
1399 if ( cut1->Pass(part) ) in1 = kFALSE; //if part is rejected by cut1, in1 is false
1400 if ( cut2->Pass(part) ) in2 = kFALSE; //if part is rejected by cut2, in2 is false
1401
1402 if (gDebug)//to be removed in real analysis
1403 if ( in1 && in2 ) //both cuts accepted, should never happen, just in case
1404 {
1405 //Particle accpted by both cuts
1406 Error("FilterOut","Particle accepted by both cuts");
1407 continue;
1408 }
1b446896 1409
dc2c3f36 1410 if (in1)
1411 {
1412 out1->AddParticle(part);
1413 continue;
1414 }
1415
1416 if (in2)
1417 {
1418 out2->AddParticle(part);
1419 continue;
1420 }
1421 }
1422}
1423/*************************************************************************************/
1b446896 1424
dc2c3f36 1425Bool_t AliHBTAnalysis::IsNonIdentAnalysis()
1426{
1427 //checks if it is possible to use special analysis for non identical particles
1428 //it means - in global pair cut first particle id is different than second one
1429 //and both are different from 0
1430 //in the future is possible to perform more sophisticated check
1431 //if cuts have excluding requirements
1432
5c58441a 1433 if (fPairCut->IsEmpty())
1434 return kFALSE;
1435
1436 if (fPairCut->GetFirstPartCut()->IsEmpty())
1437 return kFALSE;
1438
1439 if (fPairCut->GetSecondPartCut()->IsEmpty())
1440 return kFALSE;
dc2c3f36 1441
1442 Int_t id1 = fPairCut->GetFirstPartCut()->GetPID();
1443 Int_t id2 = fPairCut->GetSecondPartCut()->GetPID();
dc2c3f36 1444
5c58441a 1445 if ( (id1==0) || (id2==0) || (id1==id2) )
1446 return kFALSE;
1447
dc2c3f36 1448 return kTRUE;
1449}