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