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