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 **************************************************************************/
17 #include "Riostream.h"
18 #include "AliFlowEventSimpleMaker.h"
19 #include "AliFlowEventSimple.h"
20 #include "AliFlowTrackSimple.h"
22 #include "TParticle.h"
23 #include "AliMCEvent.h"
24 #include "AliMCParticle.h"
25 #include "AliESDEvent.h"
26 #include "AliESDtrack.h"
27 #include "AliAODEvent.h"
28 #include "AliAODTrack.h"
30 #include "AliCFManager.h"
31 #include "AliFlowTrackSimpleCuts.h"
35 // AliFlowEventSimpleMaker:
36 // Class to fill the AliFlowEventSimple
37 // with AliFlowTrackSimple objects
38 // Has fill methods for TTree, AliMCEvent, AliESDEvent and AliAODEvent
39 // author: N. van der Kolk (kolk@nikhef.nl)
41 ClassImp(AliFlowEventSimpleMaker)
42 //-----------------------------------------------------------------------
43 AliFlowEventSimpleMaker::AliFlowEventSimpleMaker()
48 //-----------------------------------------------------------------------
49 AliFlowEventSimpleMaker::~AliFlowEventSimpleMaker()
54 //-----------------------------------------------------------------------
55 AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(TTree* anInput, AliFlowTrackSimpleCuts* intCuts, AliFlowTrackSimpleCuts* diffCuts)
57 //fills the event from a TTree of kinematic.root files
59 // number of times to use the same particle (trick to introduce nonflow)
62 //flags for particles passing int. and diff. flow cuts
63 Bool_t bPassedIntFlowCuts = kFALSE;
64 Bool_t bPassedDiffFlowCuts = kFALSE;
67 Double_t dPtMaxInt = intCuts->GetPtMax();
68 Double_t dPtMinInt = intCuts->GetPtMin();
69 Double_t dEtaMaxInt = intCuts->GetEtaMax();
70 Double_t dEtaMinInt = intCuts->GetEtaMin();
71 Double_t dPhiMaxInt = intCuts->GetPhiMax();
72 Double_t dPhiMinInt = intCuts->GetPhiMin();
73 Int_t iPIDInt = intCuts->GetPID();
75 Double_t dPtMaxDiff = diffCuts->GetPtMax();
76 Double_t dPtMinDiff = diffCuts->GetPtMin();
77 Double_t dEtaMaxDiff = diffCuts->GetEtaMax();
78 Double_t dEtaMinDiff = diffCuts->GetEtaMin();
79 Double_t dPhiMaxDiff = diffCuts->GetPhiMax();
80 Double_t dPhiMinDiff = diffCuts->GetPhiMin();
81 Int_t iPIDDiff = diffCuts->GetPID();
83 Int_t iNumberOfInputTracks = anInput->GetEntries() ;
84 //cerr<<"iNumberOfInputTracks = "<<iNumberOfInputTracks<<endl;
85 TParticle* pParticle = new TParticle();
86 anInput->SetBranchAddress("Particles",&pParticle);
87 // AliFlowEventSimple* pEvent = new AliFlowEventSimple(iNumberOfInputTracks);
88 AliFlowEventSimple* pEvent = new AliFlowEventSimple(10);
89 //cerr<<pEvent<<" pEvent "<<endl;
91 Int_t iN = iNumberOfInputTracks; // additional variable to artificially fix the number of tracks
92 // Int_t iN = 576; //multiplicity for chi=1.5
93 // Int_t iN = 256; //multiplicity for chi=1
94 // Int_t iN = 164; //multiplicity for chi=0.8
96 Int_t iGoodTracks = 0;
98 Int_t iSelParticlesDiff = 0;
99 Int_t iSelParticlesInt = 0;
101 while (itrkN < iNumberOfInputTracks) {
102 anInput->GetEntry(itrkN); //get input particle
103 //checking the cuts for int. and diff. flow
104 if (pParticle->Pt() > dPtMinInt && pParticle->Pt() < dPtMaxInt &&
105 pParticle->Eta() > dEtaMinInt && pParticle->Eta() < dEtaMaxInt &&
106 pParticle->Phi() > dPhiMinInt && pParticle->Phi() < dPhiMaxInt &&
107 TMath::Abs(pParticle->GetPdgCode()) == iPIDInt) {
108 bPassedIntFlowCuts = kTRUE;
111 if (pParticle->Pt() > dPtMinDiff && pParticle->Pt() < dPtMaxDiff &&
112 pParticle->Eta() > dEtaMinDiff && pParticle->Eta() < dEtaMaxDiff &&
113 pParticle->Phi() > dPhiMinDiff && pParticle->Phi() < dPhiMaxDiff &&
114 TMath::Abs(pParticle->GetPdgCode()) == iPIDDiff){
115 bPassedDiffFlowCuts = kTRUE;
118 if (bPassedIntFlowCuts || bPassedDiffFlowCuts) {
119 for(Int_t d=0;d<iLoops;d++) {
120 AliFlowTrackSimple* pTrack = new AliFlowTrackSimple();
121 pTrack->SetPt(pParticle->Pt());
122 pTrack->SetEta(pParticle->Eta());
123 pTrack->SetPhi(pParticle->Phi());
125 //marking the particles used for int. flow:
126 if(bPassedIntFlowCuts && iSelParticlesInt < iN*iLoops) {
127 pTrack->SetForIntegratedFlow(kTRUE);
130 //marking the particles used for diff. flow:
131 if(bPassedDiffFlowCuts) {
132 pTrack->SetForDifferentialFlow(kTRUE);
135 //adding a particles which were used either for int. or diff. flow to the list
136 pEvent->TrackCollection()->Add(pTrack);
138 }//end of for(Int_t d=0;d<iLoops;d++)
139 }//end of if(bPassedIntFlowCuts || bPassedDiffFlowCuts)
141 bPassedIntFlowCuts = kFALSE;
142 bPassedDiffFlowCuts = kFALSE;
143 }//end of while (itrkN < iNumberOfInputTracks)
145 pEvent->SetEventNSelTracksIntFlow(iSelParticlesInt);
146 pEvent->SetNumberOfTracks(iGoodTracks);//tracks used either for int. or for diff. flow
148 cout<<" iGoodTracks = "<<iGoodTracks<<endl;
149 cout<<" # of selected tracks for int. flow = "<<iSelParticlesInt<<endl;
150 cout<<" # of selected tracks for diff. flow = "<<iSelParticlesDiff<<endl;
156 //-----------------------------------------------------------------------
157 AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliMCEvent* anInput)
159 //Fills the event from the MC kinematic information
161 Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
162 cerr<<"anInput->GetNumberOfTracks() = "<<iNumberOfInputTracks<<endl;
164 AliFlowEventSimple* pEvent = new AliFlowEventSimple(10);
166 //Int_t iN = 256; //multiplicity for chi=1
167 Int_t iN = iNumberOfInputTracks;
168 Int_t iGoodTracks = 0;
170 Int_t iSelParticlesDiff = 0;
171 Int_t iSelParticlesInt = 0;
174 while (iGoodTracks < iN && itrkN < iNumberOfInputTracks) {
175 AliMCParticle* pParticle = anInput->GetTrack(itrkN); //get input particle
177 if (TMath::Abs(pParticle->Eta()) < 0.9)
180 TMath::Abs(pParticle->Particle()->GetPdgCode()) == 211
181 // TMath::Abs(pParticle->Particle()->GetPdgCode()) == 211 ||
182 // TMath::Abs(pParticle->Particle()->GetPdgCode()) == 321 ||
183 // TMath::Abs(pParticle->Particle()->GetPdgCode()) == 2212
186 AliFlowTrackSimple* pTrack = new AliFlowTrackSimple();
187 pTrack->SetPt(pParticle->Pt() );
188 pTrack->SetEta(pParticle->Eta() );
189 pTrack->SetPhi(pParticle->Phi() );
190 pTrack->SetForIntegratedFlow(kTRUE);
191 pTrack->SetForDifferentialFlow(kTRUE);
193 if (pTrack->UseForIntegratedFlow())
194 { iSelParticlesInt++; }
195 if (pTrack->UseForDifferentialFlow())
196 { iSelParticlesDiff++; }
198 pEvent->TrackCollection()->Add(pTrack) ;
201 TMath::Abs(pParticle->Particle()->GetPdgCode()) == 211
204 AliFlowTrackSimple* pTrack = new AliFlowTrackSimple();
205 pTrack->SetPt(pParticle->Pt() );
206 pTrack->SetEta(pParticle->Eta() );
207 pTrack->SetPhi(pParticle->Phi() );
208 pTrack->SetForIntegratedFlow(kFALSE);
209 pTrack->SetForDifferentialFlow(kTRUE);
211 if (pTrack->UseForIntegratedFlow())
212 { iSelParticlesInt++; }
213 if (pTrack->UseForDifferentialFlow())
214 { iSelParticlesDiff++; }
216 pEvent->TrackCollection()->Add(pTrack);
224 pEvent-> SetEventNSelTracksIntFlow(iSelParticlesInt);
225 pEvent->SetNumberOfTracks(iGoodTracks);
226 cout<<" iGoodTracks = "<<iGoodTracks<<endl;
227 //cout << " iSelectedTracksInt = " << iSelParticlesInt << endl;
233 //-----------------------------------------------------------------------
234 AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliMCEvent* anInput, AliCFManager* intCFManager, AliCFManager* diffCFManager)
236 //Fills the event from the MC kinematic information
238 Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
239 cerr<<"anInput->GetNumberOfTracks() = "<<iNumberOfInputTracks<<endl;
240 if (iNumberOfInputTracks==-1) {
241 cout<<"Skipping Event -- No MC information available for this event"<<endl;
245 AliFlowEventSimple* pEvent = new AliFlowEventSimple(10);
247 Int_t iN = iNumberOfInputTracks; //maximum number of tracks in AliFlowEventSimple
248 Int_t iGoodTracks = 0; //number of good tracks
249 Int_t itrkN = 0; //track counter
250 Int_t iSelParticlesDiff = 0; //number of tracks selected for Diff
251 Int_t iSelParticlesInt = 0; //number of tracks selected for Int
255 while (iGoodTracks < iN && itrkN < iNumberOfInputTracks) {
257 AliMCParticle* pParticle = anInput->GetTrack(itrkN);
258 //make new AliFlowTrackSimple
259 AliFlowTrackSimple* pTrack = new AliFlowTrackSimple();
260 pTrack->SetPt(pParticle->Pt() );
261 pTrack->SetEta(pParticle->Eta() );
262 pTrack->SetPhi(pParticle->Phi() );
264 //check if pParticle passes the cuts
265 if (intCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pParticle)) {
266 pTrack->SetForIntegratedFlow(kTRUE);
267 //cout<<"integrated selection. PID = "<<pParticle->Particle()->GetPdgCode()<<endl;
269 if (diffCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pParticle)) {
270 pTrack->SetForDifferentialFlow(kTRUE);
271 //cout<<"differential selection. PID = "<<pParticle->Particle()->GetPdgCode()<<endl;
274 //check if any bits are set
275 TBits bFlowBits = pTrack->GetFlowBits();
276 if (bFlowBits.CountBits() ==0) {
277 delete pTrack; } //track will not be used anymore
279 pEvent->TrackCollection()->Add(pTrack) ;
282 if (pTrack->UseForIntegratedFlow())
283 { iSelParticlesInt++; }
284 if (pTrack->UseForDifferentialFlow())
285 { iSelParticlesDiff++; }
291 pEvent-> SetEventNSelTracksIntFlow(iSelParticlesInt);
292 pEvent-> SetNumberOfTracks(iGoodTracks);
293 cout<<" iGoodTracks = "<<iGoodTracks<<endl;
294 //cout << " iSelectedTracksInt = " << iSelParticlesInt << endl;
300 //-----------------------------------------------------------------------
301 AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliESDEvent* anInput)
303 //Fills the event from the ESD
305 Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
306 cerr<<"anInput->GetNumberOfTracks() = "<<iNumberOfInputTracks<<endl;
308 AliFlowEventSimple* pEvent = new AliFlowEventSimple(10);
310 //Int_t iN = 256; //multiplicity for chi=1
311 Int_t iN = iNumberOfInputTracks;
312 Int_t iGoodTracks = 0;
314 Int_t iSelParticlesDiff = 0;
315 Int_t iSelParticlesInt = 0;
320 while (iGoodTracks < iN && itrkN < iNumberOfInputTracks) {
321 AliESDtrack* pParticle = anInput->GetTrack(itrkN); //get input particle
323 if (TMath::Abs(pParticle->Eta()) < 0.9)
328 AliFlowTrackSimple* pTrack = new AliFlowTrackSimple();
329 pTrack->SetPt(pParticle->Pt() );
330 pTrack->SetEta(pParticle->Eta() );
331 pTrack->SetPhi(pParticle->Phi() );
332 pTrack->SetForIntegratedFlow(kTRUE);
333 pTrack->SetForDifferentialFlow(kTRUE);
335 if (pTrack->UseForIntegratedFlow())
336 { iSelParticlesInt++; }
337 if (pTrack->UseForDifferentialFlow())
338 { iSelParticlesDiff++; }
340 pEvent->TrackCollection()->Add(pTrack) ;
346 pEvent-> SetEventNSelTracksIntFlow(iSelParticlesInt);
347 pEvent->SetNumberOfTracks(iGoodTracks);
348 cout<<" iGoodTracks = "<<iGoodTracks<<endl;
349 //cout << " iSelectedTracksInt = " << iSelParticlesInt << endl;
356 //-----------------------------------------------------------------------
357 AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliESDEvent* anInput, AliCFManager* intCFManager, AliCFManager* diffCFManager)
359 //Fills the event from the ESD
361 Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
362 cerr<<"anInput->GetNumberOfTracks() = "<<iNumberOfInputTracks<<endl;
364 AliFlowEventSimple* pEvent = new AliFlowEventSimple(10);
366 Int_t iN = iNumberOfInputTracks; //maximum number of tracks in AliFlowEventSimple
367 Int_t iGoodTracks = 0; //number of good tracks
368 Int_t itrkN = 0; //track counter
369 Int_t iSelParticlesDiff = 0; //number of tracks selected for Diff
370 Int_t iSelParticlesInt = 0; //number of tracks selected for Int
373 while (iGoodTracks < iN && itrkN < iNumberOfInputTracks) {
374 AliESDtrack* pParticle = anInput->GetTrack(itrkN); //get input particle
375 //make new AliFLowTrackSimple
376 AliFlowTrackSimple* pTrack = new AliFlowTrackSimple();
377 pTrack->SetPt(pParticle->Pt() );
378 pTrack->SetEta(pParticle->Eta() );
379 pTrack->SetPhi(pParticle->Phi() );
380 //check if pParticle passes the cuts
382 if (intCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle) &&
383 intCFManager->CheckParticleCuts(AliCFManager::kPartSelCuts,pParticle)) {
384 pTrack->SetForIntegratedFlow(kTRUE);
386 if (diffCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle) &&
387 diffCFManager->CheckParticleCuts(AliCFManager::kPartSelCuts,pParticle)) {
388 pTrack->SetForDifferentialFlow(kTRUE);}
390 //check if any bits are set
391 TBits bFlowBits = pTrack->GetFlowBits();
392 if (bFlowBits.CountBits() ==0) {
393 delete pTrack; } //track will not be used anymore
395 pEvent->TrackCollection()->Add(pTrack) ;
398 if (pTrack->UseForIntegratedFlow())
399 { iSelParticlesInt++; }
400 if (pTrack->UseForDifferentialFlow())
401 { iSelParticlesDiff++; }
408 pEvent-> SetEventNSelTracksIntFlow(iSelParticlesInt);
409 pEvent->SetNumberOfTracks(iGoodTracks);
410 cout<<" iGoodTracks = "<<iGoodTracks<<endl;
411 //cout << " iSelectedTracksInt = " << iSelParticlesInt << endl;
417 //-----------------------------------------------------------------------
418 AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliAODEvent* anInput)
420 //Fills the event from the AOD
422 Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
423 cerr<<"anInput->GetNumberOfTracks() = "<<iNumberOfInputTracks<<endl;
425 AliFlowEventSimple* pEvent = new AliFlowEventSimple(10);
427 //Int_t iN = 256; //multiplicity for chi=1
428 Int_t iN = iNumberOfInputTracks;
429 Int_t iGoodTracks = 0;
431 Int_t iSelParticlesDiff = 0;
432 Int_t iSelParticlesInt = 0;
435 while (iGoodTracks < iN && itrkN < iNumberOfInputTracks) {
436 AliAODTrack* pParticle = anInput->GetTrack(itrkN); //get input particle
438 if (TMath::Abs(pParticle->Eta()) < 0.9)
440 AliFlowTrackSimple* pTrack = new AliFlowTrackSimple();
441 pTrack->SetPt(pParticle->Pt() );
442 pTrack->SetEta(pParticle->Eta() );
443 pTrack->SetPhi(pParticle->Phi() );
444 pTrack->SetForIntegratedFlow(kTRUE);
445 pTrack->SetForDifferentialFlow(kTRUE);
447 if (pTrack->UseForIntegratedFlow())
448 { iSelParticlesInt++; }
449 if (pTrack->UseForDifferentialFlow())
450 { iSelParticlesDiff++; }
452 pEvent->TrackCollection()->Add(pTrack) ;
458 pEvent-> SetEventNSelTracksIntFlow(iSelParticlesInt);
459 pEvent->SetNumberOfTracks(iGoodTracks);
460 cout<<" iGoodTracks = "<<iGoodTracks<<endl;
461 //cout << " iSelectedTracksInt = " << iSelParticlesInt << endl;
467 //-----------------------------------------------------------------------
468 AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliAODEvent* anInput, AliCFManager* intCFManager, AliCFManager* diffCFManager)
470 //Fills the event from the AOD
472 Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
473 cerr<<"anInput->GetNumberOfTracks() = "<<iNumberOfInputTracks<<endl;
475 AliFlowEventSimple* pEvent = new AliFlowEventSimple(10);
477 Int_t iN = iNumberOfInputTracks; //maximum number of tracks in AliFlowEventSimple
478 Int_t iGoodTracks = 0; //number of good tracks
479 Int_t itrkN = 0; //track counter
480 Int_t iSelParticlesDiff = 0; //number of tracks selected for Diff
481 Int_t iSelParticlesInt = 0; //number of tracks selected for Int
484 while (iGoodTracks < iN && itrkN < iNumberOfInputTracks) {
485 AliAODTrack* pParticle = anInput->GetTrack(itrkN); //get input particle
486 //make new AliFlowTrackSimple
487 AliFlowTrackSimple* pTrack = new AliFlowTrackSimple();
488 pTrack->SetPt(pParticle->Pt() );
489 pTrack->SetEta(pParticle->Eta() );
490 pTrack->SetPhi(pParticle->Phi() );
492 //check if pParticle passes the cuts
493 if (intCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle) &&
494 intCFManager->CheckParticleCuts(AliCFManager::kPartSelCuts,pParticle)) {
495 pTrack->SetForIntegratedFlow(kTRUE); }
496 if (diffCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle) &&
497 diffCFManager->CheckParticleCuts(AliCFManager::kPartSelCuts,pParticle)) {
498 pTrack->SetForDifferentialFlow(kTRUE);}
500 //check if any bits are set
501 TBits bFlowBits = pTrack->GetFlowBits();
502 if (bFlowBits.CountBits() ==0) {
503 delete pTrack; } //track will not be used anymore
505 pEvent->TrackCollection()->Add(pTrack) ;
508 if (pTrack->UseForIntegratedFlow())
509 { iSelParticlesInt++; }
510 if (pTrack->UseForDifferentialFlow())
511 { iSelParticlesDiff++; }
518 pEvent-> SetEventNSelTracksIntFlow(iSelParticlesInt);
519 pEvent->SetNumberOfTracks(iGoodTracks);
520 cout<<" iGoodTracks = "<<iGoodTracks<<endl;
521 //cout << " iSelectedTracksInt = " << iSelParticlesInt << endl;
526 //-----------------------------------------------------------------------
527 AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliESDEvent* anInput, AliMCEvent* anInputMc, Int_t anOption)
529 //fills the event with tracks from the ESD and kinematics from the MC info via the track label
531 if (!(anOption ==0 || anOption ==1)) {
532 cout<<"WRONG OPTION IN AliFlowEventSimpleMaker::FillTracks(AliESDEvent* anInput, AliMCEvent* anInputMc, Int_t anOption)"<<endl;
536 Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
537 cerr<<"anInput->GetNumberOfTracks() = "<<iNumberOfInputTracks<<endl;
539 AliFlowEventSimple* pEvent = new AliFlowEventSimple(10);
541 //Int_t iN = 256; //multiplicity for chi=1
542 Int_t iN = iNumberOfInputTracks;
543 Int_t iGoodTracks = 0;
545 Int_t iSelParticlesDiff = 0;
546 Int_t iSelParticlesInt = 0;
549 while (iGoodTracks < iN && itrkN < iNumberOfInputTracks) {
550 AliESDtrack* pParticle = anInput->GetTrack(itrkN); //get input particle
552 Int_t iLabel = pParticle->GetLabel();
553 //match to mc particle
554 AliMCParticle* pMcParticle = anInputMc->GetTrack(TMath::Abs(iLabel));
557 if (TMath::Abs(pParticle->GetLabel())!=pMcParticle->Label()) cout<<"pParticle->GetLabel()!=pMcParticle->Label() "<<pParticle->GetLabel()<<" "<<pMcParticle->Label()<<endl;
560 if (TMath::Abs(pParticle->Eta()) < 0.2)
563 TMath::Abs(pMcParticle->Particle()->GetPdgCode()) == 211 //pions
564 // TMath::Abs(pMcParticle->Particle()->GetPdgCode()) == 211 ||
565 // TMath::Abs(pMcParticle->Particle()->GetPdgCode()) == 321 ||
566 // TMath::Abs(pMcParticle->Particle()->GetPdgCode()) == 2212
569 AliFlowTrackSimple* pTrack = new AliFlowTrackSimple();
570 if(anOption == 0) { //take the PID from the MC & the kinematics from the ESD
571 pTrack->SetPt(pParticle->Pt() );
572 pTrack->SetEta(pParticle->Eta() );
573 pTrack->SetPhi(pParticle->Phi() );
574 pTrack->SetForIntegratedFlow(kTRUE);
575 pTrack->SetForDifferentialFlow(kTRUE);
577 else if (anOption == 1) { //take the PID and kinematics from the MC
578 pTrack->SetPt(pMcParticle->Pt() );
579 pTrack->SetEta(pMcParticle->Eta() );
580 pTrack->SetPhi(pMcParticle->Phi() );
581 pTrack->SetForIntegratedFlow(kTRUE);
582 pTrack->SetForDifferentialFlow(kTRUE);
584 else { cout<<"Not a valid option"<<endl; }
585 if (pTrack->UseForIntegratedFlow())
586 { iSelParticlesInt++; }
587 if (pTrack->UseForDifferentialFlow())
588 { iSelParticlesDiff++; }
590 pEvent->TrackCollection()->Add(pTrack) ;
596 pEvent-> SetEventNSelTracksIntFlow(iSelParticlesInt);
597 pEvent->SetNumberOfTracks(iGoodTracks);
598 cout<<" iGoodTracks = "<<iGoodTracks<<endl;
599 //cout << " iSelectedTracksInt = " << iSelParticlesInt << endl;
605 //-----------------------------------------------------------------------
606 AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliESDEvent* anInput, AliMCEvent* anInputMc, AliCFManager* intCFManager, AliCFManager* diffCFManager, Int_t anOption)
608 //fills the event with tracks from the ESD and kinematics from the MC info via the track label
611 if (!(anOption ==0 || anOption ==1)) {
612 cout<<"WRONG OPTION IN AliFlowEventSimpleMaker::FillTracks(AliESDEvent* anInput, AliMCEvent* anInputMc, Int_t anOption)"<<endl;
616 Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
617 cerr<<"anInput->GetNumberOfTracks() = "<<iNumberOfInputTracks<<endl;
618 Int_t iNumberOfInputTracksMC = anInputMc->GetNumberOfTracks() ;
619 cerr<<"anInputMc->GetNumberOfTracks() = "<<iNumberOfInputTracksMC<<endl;
620 if (iNumberOfInputTracksMC==-1) {
621 cout<<"Skipping Event -- No MC information available for this event"<<endl;
625 AliFlowEventSimple* pEvent = new AliFlowEventSimple(10);
627 Int_t iN = iNumberOfInputTracks; //maximum number of tracks in AliFlowEventSimple
628 Int_t iGoodTracks = 0; //number of good tracks
629 Int_t itrkN = 0; //track counter
630 Int_t iSelParticlesDiff = 0; //number of tracks selected for Diff
631 Int_t iSelParticlesInt = 0; //number of tracks selected for Int
635 while (iGoodTracks < iN && itrkN < iNumberOfInputTracks) {
636 AliESDtrack* pParticle = anInput->GetTrack(itrkN); //get input particle
638 Int_t iLabel = pParticle->GetLabel();
639 //match to mc particle
640 AliMCParticle* pMcParticle = anInputMc->GetTrack(TMath::Abs(iLabel));
643 if (TMath::Abs(pParticle->GetLabel())!=pMcParticle->Label()) cout<<"pParticle->GetLabel()!=pMcParticle->Label() "<<pParticle->GetLabel()<<" "<<pMcParticle->Label()<<endl;
645 //make new AliFlowTrackSimple
646 AliFlowTrackSimple* pTrack = new AliFlowTrackSimple();
647 if(anOption == 0) { //take the PID from the MC & the kinematics from the ESD
648 pTrack->SetPt(pParticle->Pt() );
649 pTrack->SetEta(pParticle->Eta() );
650 pTrack->SetPhi(pParticle->Phi() );
652 else if (anOption == 1) { //take the PID and kinematics from the MC
653 pTrack->SetPt(pMcParticle->Pt() );
654 pTrack->SetEta(pMcParticle->Eta() );
655 pTrack->SetPhi(pMcParticle->Phi() );
657 else { cout<<"Not a valid option"<<endl; }
659 //check if pParticle passes the cuts
661 //cout<<"take the PID from the MC & the kinematics from the ESD"<<endl;
662 if (intCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pMcParticle,"mcGenCuts1") &&
663 intCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle)) {
664 pTrack->SetForIntegratedFlow(kTRUE); }
665 if (diffCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pMcParticle,"mcGenCuts2") &&
666 diffCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle)) {
667 pTrack->SetForDifferentialFlow(kTRUE);}
669 else if (anOption == 1) {
670 //cout<<"take the PID and kinematics from the MC"<<endl;
671 if (intCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pMcParticle)) {
672 pTrack->SetForIntegratedFlow(kTRUE); }
673 if (diffCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pMcParticle)) {
674 pTrack->SetForDifferentialFlow(kTRUE);}
676 else { cout<<"Not a valid option"<<endl; }
678 //check if any bits are set
679 TBits bFlowBits = pTrack->GetFlowBits();
680 if (bFlowBits.CountBits() ==0) {
681 delete pTrack; } //track will not be used anymore
683 pEvent->TrackCollection()->Add(pTrack) ;
686 if (pTrack->UseForIntegratedFlow())
687 { iSelParticlesInt++; }
688 if (pTrack->UseForDifferentialFlow())
689 { iSelParticlesDiff++; }
696 pEvent-> SetEventNSelTracksIntFlow(iSelParticlesInt);
697 pEvent->SetNumberOfTracks(iGoodTracks);
698 cout<<" iGoodTracks = "<<iGoodTracks<<endl;
699 //cout << " iSelectedTracksInt = " << iSelParticlesInt << endl;