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