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