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