1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15 /////////////////////////////////////////////////////////////////////////
16 // AliFlowEventSimpleMaker:
18 // Class to fill the AliFlowEventSimple
19 // with AliFlowTrackSimple objects
20 // Has fill methods for TTree, AliMCEvent, AliESDEvent and AliAODEvent
21 // author: N. van der Kolk (kolk@nikhef.nl)
22 /////////////////////////////////////////////////////////////////////////
24 #include "Riostream.h"
26 #include "TParticle.h"
27 #include "AliFlowEventSimpleMaker.h"
28 #include "AliFlowEventSimple.h"
29 #include "AliFlowTrackSimple.h"
30 #include "AliMCEvent.h"
31 #include "AliMCParticle.h"
32 #include "AliESDEvent.h"
33 #include "AliESDtrack.h"
34 #include "AliAODEvent.h"
35 #include "AliAODTrack.h"
36 #include "AliCFManager.h"
37 #include "AliFlowTrackSimpleCuts.h"
42 ClassImp(AliFlowEventSimpleMaker)
43 //-----------------------------------------------------------------------
44 AliFlowEventSimpleMaker::AliFlowEventSimpleMaker() :
45 fMCReactionPlaneAngle(0.),
48 fEllipticFlowValue(0.),
49 fMultiplicityOfEvent(1000000000),
60 //-----------------------------------------------------------------------
61 AliFlowEventSimpleMaker::~AliFlowEventSimpleMaker()
66 //-----------------------------------------------------------------------
67 AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks( AliMCEvent* anInput, const AliCFManager* intCFManager, const AliCFManager* diffCFManager)
69 //Fills the event from the MC kinematic information
71 Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
73 if (iNumberOfInputTracks==-1) {
74 cout<<"Skipping Event -- No MC information available for this event"<<endl;
78 Int_t iN = iNumberOfInputTracks; //maximum number of tracks in AliFlowEventSimple
79 Int_t iGoodTracks = 0; //number of good tracks
80 Int_t itrkN = 0; //track counter
81 Int_t iSelParticlesPOI = 0; //number of tracks selected for Diff
82 Int_t iSelParticlesRP = 0; //number of tracks selected for Int
84 // cut on the multiplicity
85 if (intCFManager->CheckEventCuts(AliCFManager::kEvtGenCuts,anInput)) {
86 // cout<<"iNumberOfInputTracks = "<<iNumberOfInputTracks<<endl;
87 // create an AliFlowEventSimple
88 AliFlowEventSimple* pEvent = new AliFlowEventSimple(10);
91 while (iGoodTracks < iN && itrkN < iNumberOfInputTracks) {
93 AliMCParticle* pParticle = (AliMCParticle*) anInput->GetTrack(itrkN);
94 //make new AliFlowTrackSimple
95 AliFlowTrackSimple* pTrack = new AliFlowTrackSimple();
96 pTrack->SetPt(pParticle->Pt() );
97 pTrack->SetEta(pParticle->Eta() );
98 pTrack->SetPhi(pParticle->Phi() );
100 //check if pParticle passes the cuts
101 if (intCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pParticle)) {
102 pTrack->SetForRPSelection(kTRUE);
103 //cout<<"integrated selection. PID = "<<pParticle->Particle()->GetPdgCode()<<endl;
105 if (diffCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pParticle)) {
106 pTrack->SetForPOISelection(kTRUE);
107 //cout<<"differential selection. PID = "<<pParticle->Particle()->GetPdgCode()<<endl;
110 //check if any bits are set
111 const TBits* bFlowBits = pTrack->GetFlowBits();
112 if (bFlowBits->CountBits() ==0) {
113 delete pTrack; } //track will not be used anymore
115 pEvent->AddTrack(pTrack) ;
118 if (pTrack->InRPSelection())
119 { iSelParticlesRP++; }
120 if (pTrack->InPOISelection())
121 { iSelParticlesPOI++; }
127 pEvent-> SetEventNSelTracksRP(iSelParticlesRP);
128 pEvent->SetMCReactionPlaneAngle(fMCReactionPlaneAngle);
130 if (iSelParticlesRP >= fMinMult && iSelParticlesRP <= fMaxMult) {
131 if ( (++fCount % 100) == 0) {
132 cout<<" MC Reaction Plane Angle = "<< fMCReactionPlaneAngle << endl;
134 cout<<" iGoodTracks = "<<iGoodTracks<<endl;
135 cout<<" # of RP selected tracks = "<<iSelParticlesRP<<endl;
136 cout<<" # of POI selected tracks = "<<iSelParticlesPOI<<endl;
137 cout << "# " << fCount << " events processed" << endl;
142 cout<<"Not enough tracks in the FlowEventSimple"<<endl;
147 cout<<"Event does not pass multiplicity cuts"<<endl;
153 //-----------------------------------------------------------------------
155 AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliESDEvent* anInput, const AliCFManager* intCFManager, const AliCFManager* diffCFManager)
157 //Fills the event from the ESD
159 //flags for particles passing int. and diff. flow cuts
160 Bool_t bPassedRPFlowCuts = kFALSE;
161 Bool_t bPassedPOIFlowCuts = kFALSE;
163 Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
165 Int_t iGoodTracks = 0; //number of good tracks
166 Int_t itrkN = 0; //track counter
167 Int_t iSelParticlesRP = 0; //number of tracks selected for Int
168 Int_t iSelParticlesPOI = 0; //number of tracks selected for Diff
170 // cut on the multiplicity
171 if (intCFManager->CheckEventCuts(AliCFManager::kEvtRecCuts,anInput)) {
172 // cout<<"iNumberOfInputTracks = "<<iNumberOfInputTracks<<endl;
173 // create an AliFlowEventSimple
174 AliFlowEventSimple* pEvent = new AliFlowEventSimple(10);
177 while (itrkN < iNumberOfInputTracks) {
178 AliESDtrack* pParticle = anInput->GetTrack(itrkN); //get input particle
180 //check if pParticle passes the cuts
181 if (intCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle) &&
182 intCFManager->CheckParticleCuts(AliCFManager::kPartSelCuts,pParticle)) {
183 bPassedRPFlowCuts = kTRUE;
185 if (diffCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle) &&
186 diffCFManager->CheckParticleCuts(AliCFManager::kPartSelCuts,pParticle)) {
187 bPassedPOIFlowCuts = kTRUE;
190 if (bPassedRPFlowCuts || bPassedPOIFlowCuts) {
191 //make new AliFLowTrackSimple
192 AliFlowTrackSimple* pTrack = new AliFlowTrackSimple();
193 pTrack->SetPt(pParticle->Pt() );
194 pTrack->SetEta(pParticle->Eta() );
195 if (fEllipticFlowValue>0.)
196 { pTrack->SetPhi(pParticle->Phi()-fEllipticFlowValue*TMath::Sin(2*(pParticle->Phi()-fMCReactionPlaneAngle))); cout<<"Added flow to particle"<<endl; }
197 else { pTrack->SetPhi(pParticle->Phi() ); }
199 //marking the particles used for int. flow:
200 if(bPassedRPFlowCuts) {
201 pTrack->SetForRPSelection(kTRUE);
203 // assign particles to subevents
204 if (pTrack->Eta()>=fEtaMinA && pTrack->Eta()<=fEtaMaxA) {
205 pTrack->SetForSubevent(0);
207 if (pTrack->Eta()>=fEtaMinB && pTrack->Eta()<=fEtaMaxB) {
208 pTrack->SetForSubevent(1);
212 //marking the particles used for diff. flow:
213 if(bPassedPOIFlowCuts) {
214 pTrack->SetForPOISelection(kTRUE);
217 //adding particles which were used either for int. or diff. flow to the list
218 pEvent->AddTrack(pTrack);
220 }//end of if(bPassedIntFlowCuts || bPassedDiffFlowCuts)
222 bPassedRPFlowCuts = kFALSE;
223 bPassedPOIFlowCuts = kFALSE;
224 }//end of while (itrkN < iNumberOfInputTracks)
226 pEvent->SetEventNSelTracksRP(iSelParticlesRP);
227 pEvent->SetMCReactionPlaneAngle(fMCReactionPlaneAngle);
230 if (iSelParticlesRP >= fMinMult && iSelParticlesRP <= fMaxMult) {
231 if ( (++fCount % 100) == 0) {
232 if (!fMCReactionPlaneAngle == 0) cout<<" MC Reaction Plane Angle = "<< fMCReactionPlaneAngle << endl;
233 else cout<<" MC Reaction Plane Angle = unknown "<< endl;
234 cout<<" iGoodTracks = "<<iGoodTracks<<endl;
235 cout<<" # of RP selected tracks = "<<iSelParticlesRP<<endl;
236 cout<<" # of POI selected tracks = "<<iSelParticlesPOI<<endl;
237 cout << "# " << fCount << " events processed" << endl;
242 cout<<"Not enough tracks in the FlowEventSimple"<<endl;
247 cout<<"Event does not pass multiplicity cuts"<<endl;
253 //-----------------------------------------------------------------------
254 AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliAODEvent* anInput, const AliCFManager* intCFManager, const AliCFManager* diffCFManager)
256 //Fills the event from the AOD
258 Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
260 Int_t iN = iNumberOfInputTracks; //maximum number of tracks in AliFlowEventSimple
261 Int_t iGoodTracks = 0; //number of good tracks
262 Int_t itrkN = 0; //track counter
263 Int_t iSelParticlesPOI = 0; //number of tracks selected for Diff
264 Int_t iSelParticlesRP = 0; //number of tracks selected for Int
266 // cut on the multiplicity
267 if (intCFManager->CheckEventCuts(AliCFManager::kEvtRecCuts,anInput)) {
268 // cout<<"iNumberOfInputTracks = "<<iNumberOfInputTracks<<endl;
269 // create an AliFlowEventSimple
270 AliFlowEventSimple* pEvent = new AliFlowEventSimple(10);
273 while (iGoodTracks < iN && itrkN < iNumberOfInputTracks) {
274 AliAODTrack* pParticle = dynamic_cast<AliAODTrack*>(anInput->GetTrack(itrkN));
275 assert((pParticle)&&"Not a standard AOD"); //get input particle
276 //make new AliFlowTrackSimple
277 AliFlowTrackSimple* pTrack = new AliFlowTrackSimple();
278 pTrack->SetPt(pParticle->Pt() );
279 pTrack->SetEta(pParticle->Eta() );
280 pTrack->SetPhi(pParticle->Phi() );
282 //check if pParticle passes the cuts
283 if (intCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle) &&
284 intCFManager->CheckParticleCuts(AliCFManager::kPartSelCuts,pParticle)) {
285 pTrack->SetForRPSelection(kTRUE); }
286 if (diffCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle) &&
287 diffCFManager->CheckParticleCuts(AliCFManager::kPartSelCuts,pParticle)) {
288 pTrack->SetForPOISelection(kTRUE);}
291 //check if any bits are set
292 const TBits* bFlowBits = pTrack->GetFlowBits();
293 if (bFlowBits->CountBits() ==0) {
294 delete pTrack; } //track will not be used anymore
296 pEvent->AddTrack(pTrack) ;
299 if (pTrack->InRPSelection())
300 { iSelParticlesRP++; }
301 if (pTrack->InPOISelection())
302 { iSelParticlesPOI++; }
309 pEvent-> SetEventNSelTracksRP(iSelParticlesRP);
310 pEvent->SetMCReactionPlaneAngle(fMCReactionPlaneAngle);
312 if (iSelParticlesRP >= fMinMult && iSelParticlesRP <= fMaxMult) {
313 if ( (++fCount % 100) == 0) {
314 if (!fMCReactionPlaneAngle == 0) cout<<" MC Reaction Plane Angle = "<< fMCReactionPlaneAngle << endl;
315 else cout<<" MC Reaction Plane Angle = unknown "<< endl;
316 cout<<" iGoodTracks = "<<iGoodTracks<<endl;
317 cout<<" # of RP selected tracks = "<<iSelParticlesRP<<endl;
318 cout<<" # of POI selected tracks = "<<iSelParticlesPOI<<endl;
319 cout << "# " << fCount << " events processed" << endl;
324 cout<<"Not enough tracks in the FlowEventSimple"<<endl;
329 cout<<"Event does not pass multiplicity cuts"<<endl;
335 //-----------------------------------------------------------------------
336 AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliESDEvent* anInput, const AliMCEvent* anInputMc, const AliCFManager* intCFManager, const AliCFManager* diffCFManager, Int_t anOption)
338 //fills the event with tracks from the ESD and kinematics from the MC info via the track label
341 if (!(anOption ==0 || anOption ==1)) {
342 cout<<"WRONG OPTION IN AliFlowEventSimpleMaker::FillTracks(AliESDEvent* anInput, AliMCEvent* anInputMc, Int_t anOption)"<<endl;
346 Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
348 Int_t iNumberOfInputTracksMC = anInputMc->GetNumberOfTracks() ;
349 if (iNumberOfInputTracksMC==-1) {
350 cout<<"Skipping Event -- No MC information available for this event"<<endl;
354 Int_t iN = iNumberOfInputTracks; //maximum number of tracks in AliFlowEventSimple
355 Int_t iGoodTracks = 0; //number of good tracks
356 Int_t itrkN = 0; //track counter
357 Int_t iSelParticlesPOI = 0; //number of tracks selected for Diff
358 Int_t iSelParticlesRP = 0; //number of tracks selected for Int
360 // cut on the multiplicity
361 if (intCFManager->CheckEventCuts(AliCFManager::kEvtRecCuts,anInput)) {
362 // cout<<"iNumberOfInputTracks = "<<iNumberOfInputTracks<<endl;
363 // create an AliFlowEventSimple
364 AliFlowEventSimple* pEvent = new AliFlowEventSimple(10);
366 //loop over ESD tracks
367 while (iGoodTracks < iN && itrkN < iNumberOfInputTracks) {
368 AliESDtrack* pParticle = anInput->GetTrack(itrkN); //get input particle
370 Int_t iLabel = pParticle->GetLabel();
371 //match to mc particle
372 AliMCParticle* pMcParticle = (AliMCParticle*) anInputMc->GetTrack(TMath::Abs(iLabel));
375 if (TMath::Abs(pParticle->GetLabel())!=pMcParticle->Label()) cout<<"pParticle->GetLabel()!=pMcParticle->Label() "<<pParticle->GetLabel()<<" "<<pMcParticle->Label()<<endl;
377 //make new AliFlowTrackSimple
378 AliFlowTrackSimple* pTrack = new AliFlowTrackSimple();
379 if(anOption == 0) { //take the PID from the MC & the kinematics from the ESD
380 pTrack->SetPt(pParticle->Pt() );
381 pTrack->SetEta(pParticle->Eta() );
382 pTrack->SetPhi(pParticle->Phi() );
384 else if (anOption == 1) { //take the PID and kinematics from the MC
385 pTrack->SetPt(pMcParticle->Pt() );
386 pTrack->SetEta(pMcParticle->Eta() );
387 pTrack->SetPhi(pMcParticle->Phi() );
389 else { cout<<"Not a valid option"<<endl; }
391 //check if pParticle passes the cuts
393 //cout<<"take the PID from the MC & the kinematics from the ESD"<<endl;
394 if (intCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pMcParticle,"mcGenCuts1") &&
395 intCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle)) {
396 pTrack->SetForRPSelection(kTRUE); }
397 if (diffCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pMcParticle,"mcGenCuts2") &&
398 diffCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle)) {
399 pTrack->SetForPOISelection(kTRUE);}
401 else if (anOption == 1) {
402 //cout<<"take the PID and kinematics from the MC"<<endl;
403 if (intCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pMcParticle)) {
404 pTrack->SetForRPSelection(kTRUE); }
405 if (diffCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pMcParticle)) {
406 pTrack->SetForPOISelection(kTRUE);}
408 else { cout<<"Not a valid option"<<endl; }
410 //check if any bits are set
411 const TBits* bFlowBits = pTrack->GetFlowBits();
412 if (bFlowBits->CountBits() ==0) {
413 delete pTrack; } //track will not be used anymore
415 pEvent->AddTrack(pTrack) ;
418 if (pTrack->InRPSelection())
419 { iSelParticlesRP++; }
420 if (pTrack->InPOISelection())
421 { iSelParticlesPOI++; }
428 pEvent->SetEventNSelTracksRP(iSelParticlesRP);
429 pEvent->SetMCReactionPlaneAngle(fMCReactionPlaneAngle);
431 if (iSelParticlesRP >= fMinMult && iSelParticlesRP <= fMaxMult) {
432 if ( (++fCount % 100) == 0) {
433 if (!fMCReactionPlaneAngle == 0) cout<<" MC Reaction Plane Angle = "<< fMCReactionPlaneAngle << endl;
434 else cout<<" MC Reaction Plane Angle = unknown "<< endl;
435 cout << " Number of MC input tracks = " << iNumberOfInputTracksMC << endl;
436 cout<<" iGoodTracks = "<<iGoodTracks<<endl;
437 cout<<" # of RP selected tracks = "<<iSelParticlesRP<<endl;
438 cout<<" # of POI selected tracks = "<<iSelParticlesPOI<<endl;
439 cout << "# " << fCount << " events processed" << endl;
444 cout<<"Not enough tracks in the FlowEventSimple"<<endl;
449 cout<<"Event does not pass multiplicity cuts"<<endl;
456 //-----------------------------------------------------------------------
457 AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(TTree* anInput, const AliFlowTrackSimpleCuts* rpCuts, const AliFlowTrackSimpleCuts* poiCuts)
459 //fills the event from a TTree of kinematic.root files
461 // number of times to use the same particle (trick to introduce nonflow)
463 //flags for particles passing int. and diff. flow cuts
464 Bool_t bPassedRPFlowCuts = kFALSE;
465 Bool_t bPassedPOIFlowCuts = kFALSE;
468 Double_t dPtMaxRP = rpCuts->GetPtMax();
469 Double_t dPtMinRP = rpCuts->GetPtMin();
470 Double_t dEtaMaxRP = rpCuts->GetEtaMax();
471 Double_t dEtaMinRP = rpCuts->GetEtaMin();
472 Double_t dPhiMaxRP = rpCuts->GetPhiMax();
473 Double_t dPhiMinRP = rpCuts->GetPhiMin();
474 Int_t iPIDRP = rpCuts->GetPID();
476 Double_t dPtMaxPOI = poiCuts->GetPtMax();
477 Double_t dPtMinPOI = poiCuts->GetPtMin();
478 Double_t dEtaMaxPOI = poiCuts->GetEtaMax();
479 Double_t dEtaMinPOI = poiCuts->GetEtaMin();
480 Double_t dPhiMaxPOI = poiCuts->GetPhiMax();
481 Double_t dPhiMinPOI = poiCuts->GetPhiMin();
482 Int_t iPIDPOI = poiCuts->GetPID();
484 Int_t iNumberOfInputTracks = anInput->GetEntries() ;
486 TParticle* pParticle = new TParticle();
487 anInput->SetBranchAddress("Particles",&pParticle);
488 // AliFlowEventSimple* pEvent = new AliFlowEventSimple(iNumberOfInputTracks);
489 AliFlowEventSimple* pEvent = new AliFlowEventSimple(10);
491 // Int_t fMultiplicityOfEvent = 576; //multiplicity for chi=1.5
492 // Int_t fMultiplicityOfEvent = 256; //multiplicity for chi=1
493 // Int_t fMultiplicityOfEvent = 164; //multiplicity for chi=0.8
495 Int_t iGoodTracks = 0;
497 Int_t iSelParticlesRP = 0;
498 Int_t iSelParticlesPOI = 0;
500 while (itrkN < iNumberOfInputTracks) {
501 anInput->GetEntry(itrkN); //get input particle
502 if (pParticle->IsPrimary()) {
503 //checking the cuts for int. and diff. flow
504 if (pParticle->Pt() > dPtMinRP && pParticle->Pt() < dPtMaxRP &&
505 pParticle->Eta() > dEtaMinRP && pParticle->Eta() < dEtaMaxRP &&
506 pParticle->Phi() > dPhiMinRP && pParticle->Phi() < dPhiMaxRP &&
507 TMath::Abs(pParticle->GetPdgCode()) == iPIDRP) {
508 bPassedRPFlowCuts = kTRUE;
511 if (pParticle->Pt() > dPtMinPOI && pParticle->Pt() < dPtMaxPOI &&
512 pParticle->Eta() > dEtaMinPOI && pParticle->Eta() < dEtaMaxPOI &&
513 pParticle->Phi() > dPhiMinPOI && pParticle->Phi() < dPhiMaxPOI &&
514 TMath::Abs(pParticle->GetPdgCode()) == iPIDPOI){
515 bPassedPOIFlowCuts = kTRUE;
518 if (bPassedRPFlowCuts || bPassedPOIFlowCuts) {
519 for(Int_t d=0;d<fNoOfLoops;d++) {
520 AliFlowTrackSimple* pTrack = new AliFlowTrackSimple();
521 pTrack->SetPt(pParticle->Pt());
522 pTrack->SetEta(pParticle->Eta());
523 pTrack->SetPhi(pParticle->Phi()-fEllipticFlowValue*TMath::Sin(2*(pParticle->Phi()-fMCReactionPlaneAngle)));
525 //marking the particles used for int. flow:
526 if(bPassedRPFlowCuts && iSelParticlesRP < fMultiplicityOfEvent) {
527 pTrack->SetForRPSelection(kTRUE);
530 //marking the particles used for diff. flow:
531 if(bPassedPOIFlowCuts && iGoodTracks%fNoOfLoops==0) {
532 pTrack->SetForPOISelection(kTRUE);
535 //adding a particles which were used either for int. or diff. flow to the list
536 pEvent->AddTrack(pTrack);
538 }//end of for(Int_t d=0;d<iLoops;d++)
539 }//end of if(bPassedIntFlowCuts || bPassedDiffFlowCuts)
541 bPassedRPFlowCuts = kFALSE;
542 bPassedPOIFlowCuts = kFALSE;
543 }//end of while (itrkN < iNumberOfInputTracks)
545 pEvent->SetEventNSelTracksRP(iSelParticlesRP);
546 pEvent->SetMCReactionPlaneAngle(fMCReactionPlaneAngle);
548 if ( (++fCount % 100) == 0) {
549 if (!fMCReactionPlaneAngle == 0) cout<<" MC Reaction Plane Angle = "<< fMCReactionPlaneAngle << endl;
550 else cout<<" MC Reaction Plane Angle = unknown "<< endl;
551 cout<<" iGoodTracks = "<< iGoodTracks << endl;
552 cout<<" # of RP selected tracks = "<<iSelParticlesRP<<endl;
553 cout<<" # of POI selected tracks = "<<iSelParticlesPOI<<endl;
554 cout << "# " << fCount << " events processed" << endl;
561 //-----------------------------------------------------------------------
562 AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliMCEvent* anInput)
564 //Fills the event from the MC kinematic information
566 Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
568 AliFlowEventSimple* pEvent = new AliFlowEventSimple(10);
570 //Int_t iN = 256; //multiplicity for chi=1
571 Int_t iN = iNumberOfInputTracks;
572 Int_t iGoodTracks = 0;
574 Int_t iSelParticlesPOI = 0;
575 Int_t iSelParticlesRP = 0;
578 while (iGoodTracks < iN && itrkN < iNumberOfInputTracks) {
579 AliMCParticle* pParticle = (AliMCParticle*) anInput->GetTrack(itrkN); //get input particle
581 if (TMath::Abs(pParticle->Eta()) < 0.9)
584 TMath::Abs(pParticle->Particle()->GetPdgCode()) == 211
585 // TMath::Abs(pParticle->Particle()->GetPdgCode()) == 211 ||
586 // TMath::Abs(pParticle->Particle()->GetPdgCode()) == 321 ||
587 // TMath::Abs(pParticle->Particle()->GetPdgCode()) == 2212
590 AliFlowTrackSimple* pTrack = new AliFlowTrackSimple();
591 pTrack->SetPt(pParticle->Pt() );
592 pTrack->SetEta(pParticle->Eta() );
593 pTrack->SetPhi(pParticle->Phi() );
594 pTrack->SetForRPSelection(kTRUE);
595 pTrack->SetForPOISelection(kTRUE);
597 if (pTrack->InRPSelection())
598 { iSelParticlesRP++; }
599 if (pTrack->InPOISelection())
600 { iSelParticlesPOI++; }
602 pEvent->AddTrack(pTrack) ;
605 TMath::Abs(pParticle->Particle()->GetPdgCode()) == 211
608 AliFlowTrackSimple* pTrack = new AliFlowTrackSimple();
609 pTrack->SetPt(pParticle->Pt() );
610 pTrack->SetEta(pParticle->Eta() );
611 pTrack->SetPhi(pParticle->Phi() );
612 pTrack->SetForRPSelection(kFALSE);
613 pTrack->SetForPOISelection(kTRUE);
615 if (pTrack->InRPSelection())
616 { iSelParticlesRP++; }
617 if (pTrack->InPOISelection())
618 { iSelParticlesPOI++; }
620 pEvent->AddTrack(pTrack);
628 pEvent-> SetEventNSelTracksRP(iSelParticlesRP);
629 pEvent->SetMCReactionPlaneAngle(fMCReactionPlaneAngle);
631 if ( (++fCount % 100) == 0) {
632 if (!fMCReactionPlaneAngle == 0) cout<<" MC Reaction Plane Angle = "<< fMCReactionPlaneAngle << endl;
633 else cout<<" MC Reaction Plane Angle = unknown "<< endl;
634 cout<<" iGoodTracks = "<<iGoodTracks<<endl;
635 cout<<" # of RP selected tracks = "<<iSelParticlesRP<<endl;
636 cout<<" # of POI selected tracks = "<<iSelParticlesPOI<<endl;
637 cout << "# " << fCount << " events processed" << endl;
644 //-----------------------------------------------------------------------
645 AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliESDEvent* anInput)
647 //Fills the event from the ESD
649 Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
651 AliFlowEventSimple* pEvent = new AliFlowEventSimple(10);
653 //Int_t iN = 256; //multiplicity for chi=1
654 Int_t iN = iNumberOfInputTracks;
655 Int_t iGoodTracks = 0;
657 Int_t iSelParticlesPOI = 0;
658 Int_t iSelParticlesRP = 0;
663 while (iGoodTracks < iN && itrkN < iNumberOfInputTracks) {
664 AliESDtrack* pParticle = anInput->GetTrack(itrkN); //get input particle
666 if (TMath::Abs(pParticle->Eta()) < 0.9)
671 AliFlowTrackSimple* pTrack = new AliFlowTrackSimple();
672 pTrack->SetPt(pParticle->Pt() );
673 pTrack->SetEta(pParticle->Eta() );
674 pTrack->SetPhi(pParticle->Phi() );
675 pTrack->SetForRPSelection(kTRUE);
676 pTrack->SetForPOISelection(kTRUE);
678 if (pTrack->InRPSelection())
679 { iSelParticlesRP++; }
680 if (pTrack->InPOISelection())
681 { iSelParticlesPOI++; }
683 pEvent->AddTrack(pTrack) ;
689 pEvent-> SetEventNSelTracksRP(iSelParticlesRP);
690 pEvent->SetMCReactionPlaneAngle(fMCReactionPlaneAngle);
692 if ( (++fCount % 100) == 0) {
693 if (!fMCReactionPlaneAngle == 0) cout<<" MC Reaction Plane Angle = "<< fMCReactionPlaneAngle << endl;
694 else cout<<" MC Reaction Plane Angle = unknown "<< endl;
695 cout<<" iGoodTracks = "<<iGoodTracks<<endl;
696 cout<<" # of RP selected tracks = "<<iSelParticlesRP<<endl;
697 cout<<" # of POI selected tracks = "<<iSelParticlesPOI<<endl;
698 cout << "# " << fCount << " events processed" << endl;
704 //-----------------------------------------------------------------------
706 AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliAODEvent* anInput)
708 //Fills the event from the AOD
710 Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
712 AliFlowEventSimple* pEvent = new AliFlowEventSimple(10);
714 //Int_t iN = 256; //multiplicity for chi=1
715 Int_t iN = iNumberOfInputTracks;
716 Int_t iGoodTracks = 0;
718 Int_t iSelParticlesPOI = 0;
719 Int_t iSelParticlesRP = 0;
722 while (iGoodTracks < iN && itrkN < iNumberOfInputTracks) {
723 AliAODTrack* pParticle = dynamic_cast<AliAODTrack*>(anInput->GetTrack(itrkN));
724 assert((pParticle)&&"Not a standard AOD"); //get input particle
726 if (TMath::Abs(pParticle->Eta()) < 0.9)
728 AliFlowTrackSimple* pTrack = new AliFlowTrackSimple();
729 pTrack->SetPt(pParticle->Pt() );
730 pTrack->SetEta(pParticle->Eta() );
731 pTrack->SetPhi(pParticle->Phi() );
732 pTrack->SetForRPSelection(kTRUE);
733 pTrack->SetForPOISelection(kTRUE);
735 if (pTrack->InRPSelection())
736 { iSelParticlesRP++; }
737 if (pTrack->InPOISelection())
738 { iSelParticlesPOI++; }
740 pEvent->AddTrack(pTrack) ;
746 pEvent-> SetEventNSelTracksRP(iSelParticlesRP);
747 pEvent->SetMCReactionPlaneAngle(fMCReactionPlaneAngle);
749 if ( (++fCount % 100) == 0) {
750 if (!fMCReactionPlaneAngle == 0) cout<<" MC Reaction Plane Angle = "<< fMCReactionPlaneAngle << endl;
751 else cout<<" MC Reaction Plane Angle = unknown "<< endl;
752 cout<<" iGoodTracks = "<<iGoodTracks<<endl;
753 cout<<" # of RP selected tracks = "<<iSelParticlesRP<<endl;
754 cout<<" # of POI selected tracks = "<<iSelParticlesPOI<<endl;
755 cout << "# " << fCount << " events processed" << endl;
761 //-----------------------------------------------------------------------
762 AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliESDEvent* anInput, const AliMCEvent* anInputMc, Int_t anOption)
764 //fills the event with tracks from the ESD and kinematics from the MC info via the track label
766 if (!(anOption ==0 || anOption ==1)) {
767 cout<<"WRONG OPTION IN AliFlowEventSimpleMaker::FillTracks(AliESDEvent* anInput, AliMCEvent* anInputMc, Int_t anOption)"<<endl;
771 Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
773 AliFlowEventSimple* pEvent = new AliFlowEventSimple(10);
775 //Int_t iN = 256; //multiplicity for chi=1
776 Int_t iN = iNumberOfInputTracks;
777 Int_t iGoodTracks = 0;
779 Int_t iSelParticlesPOI = 0;
780 Int_t iSelParticlesRP = 0;
783 while (iGoodTracks < iN && itrkN < iNumberOfInputTracks) {
784 AliESDtrack* pParticle = anInput->GetTrack(itrkN); //get input particle
786 Int_t iLabel = pParticle->GetLabel();
787 //match to mc particle
788 AliMCParticle* pMcParticle = (AliMCParticle*) anInputMc->GetTrack(TMath::Abs(iLabel));
791 if (TMath::Abs(pParticle->GetLabel())!=pMcParticle->Label()) cout<<"pParticle->GetLabel()!=pMcParticle->Label() "<<pParticle->GetLabel()<<" "<<pMcParticle->Label()<<endl;
794 if (TMath::Abs(pParticle->Eta()) < 0.2)
797 TMath::Abs(pMcParticle->Particle()->GetPdgCode()) == 211 //pions
798 // TMath::Abs(pMcParticle->Particle()->GetPdgCode()) == 211 ||
799 // TMath::Abs(pMcParticle->Particle()->GetPdgCode()) == 321 ||
800 // TMath::Abs(pMcParticle->Particle()->GetPdgCode()) == 2212
803 AliFlowTrackSimple* pTrack = new AliFlowTrackSimple();
804 if(anOption == 0) { //take the PID from the MC & the kinematics from the ESD
805 pTrack->SetPt(pParticle->Pt() );
806 pTrack->SetEta(pParticle->Eta() );
807 pTrack->SetPhi(pParticle->Phi() );
808 pTrack->SetForRPSelection(kTRUE);
809 pTrack->SetForPOISelection(kTRUE);
811 else if (anOption == 1) { //take the PID and kinematics from the MC
812 pTrack->SetPt(pMcParticle->Pt() );
813 pTrack->SetEta(pMcParticle->Eta() );
814 pTrack->SetPhi(pMcParticle->Phi() );
815 pTrack->SetForRPSelection(kTRUE);
816 pTrack->SetForPOISelection(kTRUE);
818 else { cout<<"Not a valid option"<<endl; }
819 if (pTrack->InRPSelection())
820 { iSelParticlesRP++; }
821 if (pTrack->InPOISelection())
822 { iSelParticlesPOI++; }
824 pEvent->AddTrack(pTrack) ;
830 pEvent-> SetEventNSelTracksRP(iSelParticlesRP);
831 pEvent->SetMCReactionPlaneAngle(fMCReactionPlaneAngle);
833 if ( (++fCount % 100) == 0) {
834 if (!fMCReactionPlaneAngle == 0) cout<<" MC Reaction Plane Angle = "<< fMCReactionPlaneAngle << endl;
835 else cout<<" MC Reaction Plane Angle = unknown "<< endl;
836 cout<<" iGoodTracks = "<<iGoodTracks<<endl;
837 cout<<" # of RP selected tracks = "<<iSelParticlesRP<<endl;
838 cout<<" # of POI selected tracks = "<<iSelParticlesPOI<<endl;
839 cout << "# " << fCount << " events processed" << endl;