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"
29 #include "../../CORRFW/AliCFManager.h"
30 #include "AliFlowTrackSimpleCuts.h"
33 // AliFlowEventSimpleMaker:
34 // Class to fill the AliFlowEventSimple
35 // with AliFlowTrackSimple objects
36 // Has fill methods for TTree, AliMCEvent, AliESDEvent and AliAODEvent
37 // author: N. van der Kolk (kolk@nikhef.nl)
39 ClassImp(AliFlowEventSimpleMaker)
40 //-----------------------------------------------------------------------
41 AliFlowEventSimpleMaker::AliFlowEventSimpleMaker():
42 fUseWeightsPhi(kFALSE),
43 fUseWeightsPt(kFALSE),
44 fUseWeightsEta(kFALSE),
52 //-----------------------------------------------------------------------
53 AliFlowEventSimpleMaker::~AliFlowEventSimpleMaker()
58 //-----------------------------------------------------------------------
59 void AliFlowEventSimpleMaker::Init(TFile *file)
61 //initialize weights' histograms
66 file->GetObject("phi_weights",fPhiWeights);
70 file->GetObject("pt_weights",fPtWeights);
74 file->GetObject("eta_weights",fEtaWeights);
79 //-----------------------------------------------------------------------
80 AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(TTree* anInput, AliFlowTrackSimpleCuts* intCuts, AliFlowTrackSimpleCuts* diffCuts)
82 //fills the event from a TTree of kinematic.root files
84 // number of times to use the same particle (trick to introduce nonflow)
87 //flags for particles passing int. and diff. flow cuts
88 Bool_t bPassedIntFlowCuts = kFALSE;
89 Bool_t bPassedDiffFlowCuts = kFALSE;
92 Double_t dPtMaxInt = intCuts->GetPtMax();
93 Double_t dPtMinInt = intCuts->GetPtMin();
94 Double_t dEtaMaxInt = intCuts->GetEtaMax();
95 Double_t dEtaMinInt = intCuts->GetEtaMin();
96 Double_t dPhiMaxInt = intCuts->GetPhiMax();
97 Double_t dPhiMinInt = intCuts->GetPhiMin();
98 Int_t iPIDInt = intCuts->GetPID();
100 Double_t dPtMaxDiff = diffCuts->GetPtMax();
101 Double_t dPtMinDiff = diffCuts->GetPtMin();
102 Double_t dEtaMaxDiff = diffCuts->GetEtaMax();
103 Double_t dEtaMinDiff = diffCuts->GetEtaMin();
104 Double_t dPhiMaxDiff = diffCuts->GetPhiMax();
105 Double_t dPhiMinDiff = diffCuts->GetPhiMin();
106 Int_t iPIDDiff = diffCuts->GetPID();
108 Int_t iNumberOfInputTracks = anInput->GetEntries() ;
109 //cerr<<"iNumberOfInputTracks = "<<iNumberOfInputTracks<<endl;
110 TParticle* pParticle = new TParticle();
111 anInput->SetBranchAddress("Particles",&pParticle);
112 // AliFlowEventSimple* pEvent = new AliFlowEventSimple(iNumberOfInputTracks);
113 AliFlowEventSimple* pEvent = new AliFlowEventSimple(10);
114 //cerr<<pEvent<<" pEvent "<<endl;
116 //needed if weights are used:
117 pEvent->SetUseWeightsPhi(fUseWeightsPhi);
118 pEvent->SetUseWeightsPt(fUseWeightsPt);
119 pEvent->SetUseWeightsEta(fUseWeightsEta);
120 pEvent->SetPhiWeights(fPhiWeights);
121 pEvent->SetPtWeights(fPtWeights);
122 pEvent->SetEtaWeights(fEtaWeights);
124 Int_t iN = iNumberOfInputTracks; // additional variable to artificially fix the number of tracks
125 // Int_t iN = 576; //multiplicity for chi=1.5
126 // Int_t iN = 256; //multiplicity for chi=1
127 // Int_t iN = 164; //multiplicity for chi=0.8
129 Int_t iGoodTracks = 0;
131 Int_t iSelParticlesDiff = 0;
132 Int_t iSelParticlesInt = 0;
134 while (itrkN < iNumberOfInputTracks) {
135 anInput->GetEntry(itrkN); //get input particle
136 //checking the cuts for int. and diff. flow
137 if (pParticle->Pt() > dPtMinInt && pParticle->Pt() < dPtMaxInt &&
138 pParticle->Eta() > dEtaMinInt && pParticle->Eta() < dEtaMaxInt &&
139 pParticle->Phi() > dPhiMinInt && pParticle->Phi() < dPhiMaxInt &&
140 TMath::Abs(pParticle->GetPdgCode()) == iPIDInt) {
141 bPassedIntFlowCuts = kTRUE;
144 if (pParticle->Pt() > dPtMinDiff && pParticle->Pt() < dPtMaxDiff &&
145 pParticle->Eta() > dEtaMinDiff && pParticle->Eta() < dEtaMaxDiff &&
146 pParticle->Phi() > dPhiMinDiff && pParticle->Phi() < dPhiMaxDiff &&
147 TMath::Abs(pParticle->GetPdgCode()) == iPIDDiff){
148 bPassedDiffFlowCuts = kTRUE;
151 if (bPassedIntFlowCuts || bPassedDiffFlowCuts) {
152 for(Int_t d=0;d<iLoops;d++) {
153 AliFlowTrackSimple* pTrack = new AliFlowTrackSimple();
154 pTrack->SetPt(pParticle->Pt());
155 pTrack->SetEta(pParticle->Eta());
156 pTrack->SetPhi(pParticle->Phi());
158 //marking the particles used for int. flow:
159 if(bPassedIntFlowCuts && iSelParticlesInt < iN*iLoops) {
160 pTrack->SetForIntegratedFlow(kTRUE);
163 //marking the particles used for diff. flow:
164 if(bPassedDiffFlowCuts) {
165 pTrack->SetForDifferentialFlow(kTRUE);
168 //adding a particles which were used either for int. or diff. flow to the list
169 pEvent->TrackCollection()->Add(pTrack);
171 }//end of for(Int_t d=0;d<iLoops;d++)
172 }//end of if(bPassedIntFlowCuts || bPassedDiffFlowCuts)
174 bPassedIntFlowCuts = kFALSE;
175 bPassedDiffFlowCuts = kFALSE;
176 }//end of while (itrkN < iNumberOfInputTracks)
178 pEvent->SetEventNSelTracksIntFlow(iSelParticlesInt);
179 pEvent->SetNumberOfTracks(iGoodTracks);//tracks used either for int. or for diff. flow
181 cout<<" iGoodTracks = "<<iGoodTracks<<endl;
182 cout<<" # of selected tracks for int. flow = "<<iSelParticlesInt<<endl;
183 cout<<" # of selected tracks for diff. flow = "<<iSelParticlesDiff<<endl;
189 //-----------------------------------------------------------------------
190 AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliMCEvent* anInput)
192 //Fills the event from the MC kinematic information
194 Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
195 cerr<<"anInput->GetNumberOfTracks() = "<<iNumberOfInputTracks<<endl;
197 AliFlowEventSimple* pEvent = new AliFlowEventSimple(10);
199 //Int_t iN = 256; //multiplicity for chi=1
200 Int_t iN = iNumberOfInputTracks;
201 Int_t iGoodTracks = 0;
203 Int_t iSelParticlesDiff = 0;
204 Int_t iSelParticlesInt = 0;
207 while (iGoodTracks < iN && itrkN < iNumberOfInputTracks) {
208 AliMCParticle* pParticle = anInput->GetTrack(itrkN); //get input particle
210 if (TMath::Abs(pParticle->Eta()) < 0.9)
213 TMath::Abs(pParticle->Particle()->GetPdgCode()) == 211
214 // TMath::Abs(pParticle->Particle()->GetPdgCode()) == 211 ||
215 // TMath::Abs(pParticle->Particle()->GetPdgCode()) == 321 ||
216 // TMath::Abs(pParticle->Particle()->GetPdgCode()) == 2212
219 AliFlowTrackSimple* pTrack = new AliFlowTrackSimple();
220 pTrack->SetPt(pParticle->Pt() );
221 pTrack->SetEta(pParticle->Eta() );
222 pTrack->SetPhi(pParticle->Phi() );
223 pTrack->SetForIntegratedFlow(kTRUE);
224 pTrack->SetForDifferentialFlow(kTRUE);
226 if (pTrack->UseForIntegratedFlow())
227 { iSelParticlesInt++; }
228 if (pTrack->UseForDifferentialFlow())
229 { iSelParticlesDiff++; }
231 pEvent->TrackCollection()->Add(pTrack) ;
234 TMath::Abs(pParticle->Particle()->GetPdgCode()) == 211
237 AliFlowTrackSimple* pTrack = new AliFlowTrackSimple();
238 pTrack->SetPt(pParticle->Pt() );
239 pTrack->SetEta(pParticle->Eta() );
240 pTrack->SetPhi(pParticle->Phi() );
241 pTrack->SetForIntegratedFlow(kFALSE);
242 pTrack->SetForDifferentialFlow(kTRUE);
244 if (pTrack->UseForIntegratedFlow())
245 { iSelParticlesInt++; }
246 if (pTrack->UseForDifferentialFlow())
247 { iSelParticlesDiff++; }
249 pEvent->TrackCollection()->Add(pTrack);
257 pEvent-> SetEventNSelTracksIntFlow(iSelParticlesInt);
258 pEvent->SetNumberOfTracks(iGoodTracks);
259 cout<<" iGoodTracks = "<<iGoodTracks<<endl;
260 //cout << " iSelectedTracksInt = " << iSelParticlesInt << endl;
266 //-----------------------------------------------------------------------
267 AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliMCEvent* anInput, AliCFManager* intCFManager, AliCFManager* diffCFManager)
269 //Fills the event from the MC kinematic information
271 Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
272 cerr<<"anInput->GetNumberOfTracks() = "<<iNumberOfInputTracks<<endl;
273 if (iNumberOfInputTracks==-1) {
274 cout<<"Skipping Event -- No MC information available for this event"<<endl;
278 AliFlowEventSimple* pEvent = new AliFlowEventSimple(10);
280 Int_t iN = iNumberOfInputTracks; //maximum number of tracks in AliFlowEventSimple
281 Int_t iGoodTracks = 0; //number of good tracks
282 Int_t itrkN = 0; //track counter
283 Int_t iSelParticlesDiff = 0; //number of tracks selected for Diff
284 Int_t iSelParticlesInt = 0; //number of tracks selected for Int
288 while (iGoodTracks < iN && itrkN < iNumberOfInputTracks) {
290 AliMCParticle* pParticle = anInput->GetTrack(itrkN);
291 //make new AliFlowTrackSimple
292 AliFlowTrackSimple* pTrack = new AliFlowTrackSimple();
293 pTrack->SetPt(pParticle->Pt() );
294 pTrack->SetEta(pParticle->Eta() );
295 pTrack->SetPhi(pParticle->Phi() );
297 //check if pParticle passes the cuts
298 if (intCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pParticle)) {
299 pTrack->SetForIntegratedFlow(kTRUE);
300 //cout<<"integrated selection. PID = "<<pParticle->Particle()->GetPdgCode()<<endl;
302 if (diffCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pParticle)) {
303 pTrack->SetForDifferentialFlow(kTRUE);
304 //cout<<"differential selection. PID = "<<pParticle->Particle()->GetPdgCode()<<endl;
307 //check if any bits are set
308 TBits bFlowBits = pTrack->GetFlowBits();
309 if (bFlowBits.CountBits() ==0) {
310 delete pTrack; } //track will not be used anymore
312 pEvent->TrackCollection()->Add(pTrack) ;
315 if (pTrack->UseForIntegratedFlow())
316 { iSelParticlesInt++; }
317 if (pTrack->UseForDifferentialFlow())
318 { iSelParticlesDiff++; }
324 pEvent-> SetEventNSelTracksIntFlow(iSelParticlesInt);
325 pEvent-> SetNumberOfTracks(iGoodTracks);
326 cout<<" iGoodTracks = "<<iGoodTracks<<endl;
327 //cout << " iSelectedTracksInt = " << iSelParticlesInt << endl;
333 //-----------------------------------------------------------------------
334 AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliESDEvent* anInput)
336 //Fills the event from the ESD
338 Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
339 cerr<<"anInput->GetNumberOfTracks() = "<<iNumberOfInputTracks<<endl;
341 AliFlowEventSimple* pEvent = new AliFlowEventSimple(10);
343 //Int_t iN = 256; //multiplicity for chi=1
344 Int_t iN = iNumberOfInputTracks;
345 Int_t iGoodTracks = 0;
347 Int_t iSelParticlesDiff = 0;
348 Int_t iSelParticlesInt = 0;
353 while (iGoodTracks < iN && itrkN < iNumberOfInputTracks) {
354 AliESDtrack* pParticle = anInput->GetTrack(itrkN); //get input particle
356 if (TMath::Abs(pParticle->Eta()) < 0.9)
361 AliFlowTrackSimple* pTrack = new AliFlowTrackSimple();
362 pTrack->SetPt(pParticle->Pt() );
363 pTrack->SetEta(pParticle->Eta() );
364 pTrack->SetPhi(pParticle->Phi() );
365 pTrack->SetForIntegratedFlow(kTRUE);
366 pTrack->SetForDifferentialFlow(kTRUE);
368 if (pTrack->UseForIntegratedFlow())
369 { iSelParticlesInt++; }
370 if (pTrack->UseForDifferentialFlow())
371 { iSelParticlesDiff++; }
373 pEvent->TrackCollection()->Add(pTrack) ;
379 pEvent-> SetEventNSelTracksIntFlow(iSelParticlesInt);
380 pEvent->SetNumberOfTracks(iGoodTracks);
381 cout<<" iGoodTracks = "<<iGoodTracks<<endl;
382 //cout << " iSelectedTracksInt = " << iSelParticlesInt << endl;
389 //-----------------------------------------------------------------------
390 AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliESDEvent* anInput, AliCFManager* intCFManager, AliCFManager* diffCFManager)
392 //Fills the event from the ESD
394 Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
395 cerr<<"anInput->GetNumberOfTracks() = "<<iNumberOfInputTracks<<endl;
397 AliFlowEventSimple* pEvent = new AliFlowEventSimple(10);
399 Int_t iN = iNumberOfInputTracks; //maximum number of tracks in AliFlowEventSimple
400 Int_t iGoodTracks = 0; //number of good tracks
401 Int_t itrkN = 0; //track counter
402 Int_t iSelParticlesDiff = 0; //number of tracks selected for Diff
403 Int_t iSelParticlesInt = 0; //number of tracks selected for Int
406 while (iGoodTracks < iN && itrkN < iNumberOfInputTracks) {
407 AliESDtrack* pParticle = anInput->GetTrack(itrkN); //get input particle
408 //make new AliFLowTrackSimple
409 AliFlowTrackSimple* pTrack = new AliFlowTrackSimple();
410 pTrack->SetPt(pParticle->Pt() );
411 pTrack->SetEta(pParticle->Eta() );
412 pTrack->SetPhi(pParticle->Phi() );
413 //check if pParticle passes the cuts
415 if (intCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle) &&
416 intCFManager->CheckParticleCuts(AliCFManager::kPartSelCuts,pParticle)) {
417 pTrack->SetForIntegratedFlow(kTRUE);
419 if (diffCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle) &&
420 diffCFManager->CheckParticleCuts(AliCFManager::kPartSelCuts,pParticle)) {
421 pTrack->SetForDifferentialFlow(kTRUE);}
423 //check if any bits are set
424 TBits bFlowBits = pTrack->GetFlowBits();
425 if (bFlowBits.CountBits() ==0) {
426 delete pTrack; } //track will not be used anymore
428 pEvent->TrackCollection()->Add(pTrack) ;
431 if (pTrack->UseForIntegratedFlow())
432 { iSelParticlesInt++; }
433 if (pTrack->UseForDifferentialFlow())
434 { iSelParticlesDiff++; }
441 pEvent-> SetEventNSelTracksIntFlow(iSelParticlesInt);
442 pEvent->SetNumberOfTracks(iGoodTracks);
443 cout<<" iGoodTracks = "<<iGoodTracks<<endl;
444 //cout << " iSelectedTracksInt = " << iSelParticlesInt << endl;
450 //-----------------------------------------------------------------------
451 AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliAODEvent* anInput)
453 //Fills the event from the AOD
455 Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
456 cerr<<"anInput->GetNumberOfTracks() = "<<iNumberOfInputTracks<<endl;
458 AliFlowEventSimple* pEvent = new AliFlowEventSimple(10);
460 //Int_t iN = 256; //multiplicity for chi=1
461 Int_t iN = iNumberOfInputTracks;
462 Int_t iGoodTracks = 0;
464 Int_t iSelParticlesDiff = 0;
465 Int_t iSelParticlesInt = 0;
468 while (iGoodTracks < iN && itrkN < iNumberOfInputTracks) {
469 AliAODTrack* pParticle = anInput->GetTrack(itrkN); //get input particle
471 if (TMath::Abs(pParticle->Eta()) < 0.9)
473 AliFlowTrackSimple* pTrack = new AliFlowTrackSimple();
474 pTrack->SetPt(pParticle->Pt() );
475 pTrack->SetEta(pParticle->Eta() );
476 pTrack->SetPhi(pParticle->Phi() );
477 pTrack->SetForIntegratedFlow(kTRUE);
478 pTrack->SetForDifferentialFlow(kTRUE);
480 if (pTrack->UseForIntegratedFlow())
481 { iSelParticlesInt++; }
482 if (pTrack->UseForDifferentialFlow())
483 { iSelParticlesDiff++; }
485 pEvent->TrackCollection()->Add(pTrack) ;
491 pEvent-> SetEventNSelTracksIntFlow(iSelParticlesInt);
492 pEvent->SetNumberOfTracks(iGoodTracks);
493 cout<<" iGoodTracks = "<<iGoodTracks<<endl;
494 //cout << " iSelectedTracksInt = " << iSelParticlesInt << endl;
500 //-----------------------------------------------------------------------
501 AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliAODEvent* anInput, AliCFManager* intCFManager, AliCFManager* diffCFManager)
503 //Fills the event from the AOD
505 Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
506 cerr<<"anInput->GetNumberOfTracks() = "<<iNumberOfInputTracks<<endl;
508 AliFlowEventSimple* pEvent = new AliFlowEventSimple(10);
510 Int_t iN = iNumberOfInputTracks; //maximum number of tracks in AliFlowEventSimple
511 Int_t iGoodTracks = 0; //number of good tracks
512 Int_t itrkN = 0; //track counter
513 Int_t iSelParticlesDiff = 0; //number of tracks selected for Diff
514 Int_t iSelParticlesInt = 0; //number of tracks selected for Int
517 while (iGoodTracks < iN && itrkN < iNumberOfInputTracks) {
518 AliAODTrack* pParticle = anInput->GetTrack(itrkN); //get input particle
519 //make new AliFlowTrackSimple
520 AliFlowTrackSimple* pTrack = new AliFlowTrackSimple();
521 pTrack->SetPt(pParticle->Pt() );
522 pTrack->SetEta(pParticle->Eta() );
523 pTrack->SetPhi(pParticle->Phi() );
525 //check if pParticle passes the cuts
526 if (intCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle) &&
527 intCFManager->CheckParticleCuts(AliCFManager::kPartSelCuts,pParticle)) {
528 pTrack->SetForIntegratedFlow(kTRUE); }
529 if (diffCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle) &&
530 diffCFManager->CheckParticleCuts(AliCFManager::kPartSelCuts,pParticle)) {
531 pTrack->SetForDifferentialFlow(kTRUE);}
533 //check if any bits are set
534 TBits bFlowBits = pTrack->GetFlowBits();
535 if (bFlowBits.CountBits() ==0) {
536 delete pTrack; } //track will not be used anymore
538 pEvent->TrackCollection()->Add(pTrack) ;
541 if (pTrack->UseForIntegratedFlow())
542 { iSelParticlesInt++; }
543 if (pTrack->UseForDifferentialFlow())
544 { iSelParticlesDiff++; }
551 pEvent-> SetEventNSelTracksIntFlow(iSelParticlesInt);
552 pEvent->SetNumberOfTracks(iGoodTracks);
553 cout<<" iGoodTracks = "<<iGoodTracks<<endl;
554 //cout << " iSelectedTracksInt = " << iSelParticlesInt << endl;
559 //-----------------------------------------------------------------------
560 AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliESDEvent* anInput, AliMCEvent* anInputMc, Int_t anOption)
562 //fills the event with tracks from the ESD and kinematics from the MC info via the track label
564 if (!(anOption ==0 || anOption ==1)) {
565 cout<<"WRONG OPTION IN AliFlowEventSimpleMaker::FillTracks(AliESDEvent* anInput, AliMCEvent* anInputMc, Int_t anOption)"<<endl;
569 Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
570 cerr<<"anInput->GetNumberOfTracks() = "<<iNumberOfInputTracks<<endl;
572 AliFlowEventSimple* pEvent = new AliFlowEventSimple(10);
574 //Int_t iN = 256; //multiplicity for chi=1
575 Int_t iN = iNumberOfInputTracks;
576 Int_t iGoodTracks = 0;
578 Int_t iSelParticlesDiff = 0;
579 Int_t iSelParticlesInt = 0;
582 while (iGoodTracks < iN && itrkN < iNumberOfInputTracks) {
583 AliESDtrack* pParticle = anInput->GetTrack(itrkN); //get input particle
585 Int_t iLabel = pParticle->GetLabel();
586 //match to mc particle
587 AliMCParticle* pMcParticle = anInputMc->GetTrack(TMath::Abs(iLabel));
590 if (TMath::Abs(pParticle->GetLabel())!=pMcParticle->Label()) cout<<"pParticle->GetLabel()!=pMcParticle->Label() "<<pParticle->GetLabel()<<" "<<pMcParticle->Label()<<endl;
593 if (TMath::Abs(pParticle->Eta()) < 0.2)
596 TMath::Abs(pMcParticle->Particle()->GetPdgCode()) == 211 //pions
597 // TMath::Abs(pMcParticle->Particle()->GetPdgCode()) == 211 ||
598 // TMath::Abs(pMcParticle->Particle()->GetPdgCode()) == 321 ||
599 // TMath::Abs(pMcParticle->Particle()->GetPdgCode()) == 2212
602 AliFlowTrackSimple* pTrack = new AliFlowTrackSimple();
603 if(anOption == 0) { //take the PID from the MC & the kinematics from the ESD
604 pTrack->SetPt(pParticle->Pt() );
605 pTrack->SetEta(pParticle->Eta() );
606 pTrack->SetPhi(pParticle->Phi() );
607 pTrack->SetForIntegratedFlow(kTRUE);
608 pTrack->SetForDifferentialFlow(kTRUE);
610 else if (anOption == 1) { //take the PID and kinematics from the MC
611 pTrack->SetPt(pMcParticle->Pt() );
612 pTrack->SetEta(pMcParticle->Eta() );
613 pTrack->SetPhi(pMcParticle->Phi() );
614 pTrack->SetForIntegratedFlow(kTRUE);
615 pTrack->SetForDifferentialFlow(kTRUE);
617 else { cout<<"Not a valid option"<<endl; }
618 if (pTrack->UseForIntegratedFlow())
619 { iSelParticlesInt++; }
620 if (pTrack->UseForDifferentialFlow())
621 { iSelParticlesDiff++; }
623 pEvent->TrackCollection()->Add(pTrack) ;
629 pEvent-> SetEventNSelTracksIntFlow(iSelParticlesInt);
630 pEvent->SetNumberOfTracks(iGoodTracks);
631 cout<<" iGoodTracks = "<<iGoodTracks<<endl;
632 //cout << " iSelectedTracksInt = " << iSelParticlesInt << endl;
638 //-----------------------------------------------------------------------
639 AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliESDEvent* anInput, AliMCEvent* anInputMc, AliCFManager* intCFManager, AliCFManager* diffCFManager, Int_t anOption)
641 //fills the event with tracks from the ESD and kinematics from the MC info via the track label
644 if (!(anOption ==0 || anOption ==1)) {
645 cout<<"WRONG OPTION IN AliFlowEventSimpleMaker::FillTracks(AliESDEvent* anInput, AliMCEvent* anInputMc, Int_t anOption)"<<endl;
649 Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
650 cerr<<"anInput->GetNumberOfTracks() = "<<iNumberOfInputTracks<<endl;
651 Int_t iNumberOfInputTracksMC = anInputMc->GetNumberOfTracks() ;
652 cerr<<"anInputMc->GetNumberOfTracks() = "<<iNumberOfInputTracksMC<<endl;
653 if (iNumberOfInputTracksMC==-1) {
654 cout<<"Skipping Event -- No MC information available for this event"<<endl;
658 AliFlowEventSimple* pEvent = new AliFlowEventSimple(10);
660 Int_t iN = iNumberOfInputTracks; //maximum number of tracks in AliFlowEventSimple
661 Int_t iGoodTracks = 0; //number of good tracks
662 Int_t itrkN = 0; //track counter
663 Int_t iSelParticlesDiff = 0; //number of tracks selected for Diff
664 Int_t iSelParticlesInt = 0; //number of tracks selected for Int
668 while (iGoodTracks < iN && itrkN < iNumberOfInputTracks) {
669 AliESDtrack* pParticle = anInput->GetTrack(itrkN); //get input particle
671 Int_t iLabel = pParticle->GetLabel();
672 //match to mc particle
673 AliMCParticle* pMcParticle = anInputMc->GetTrack(TMath::Abs(iLabel));
676 if (TMath::Abs(pParticle->GetLabel())!=pMcParticle->Label()) cout<<"pParticle->GetLabel()!=pMcParticle->Label() "<<pParticle->GetLabel()<<" "<<pMcParticle->Label()<<endl;
678 //make new AliFlowTrackSimple
679 AliFlowTrackSimple* pTrack = new AliFlowTrackSimple();
680 if(anOption == 0) { //take the PID from the MC & the kinematics from the ESD
681 pTrack->SetPt(pParticle->Pt() );
682 pTrack->SetEta(pParticle->Eta() );
683 pTrack->SetPhi(pParticle->Phi() );
685 else if (anOption == 1) { //take the PID and kinematics from the MC
686 pTrack->SetPt(pMcParticle->Pt() );
687 pTrack->SetEta(pMcParticle->Eta() );
688 pTrack->SetPhi(pMcParticle->Phi() );
690 else { cout<<"Not a valid option"<<endl; }
692 //check if pParticle passes the cuts
694 //cout<<"take the PID from the MC & the kinematics from the ESD"<<endl;
695 if (intCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pMcParticle,"mcGenCuts1") &&
696 intCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle)) {
697 pTrack->SetForIntegratedFlow(kTRUE); }
698 if (diffCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pMcParticle,"mcGenCuts2") &&
699 diffCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle)) {
700 pTrack->SetForDifferentialFlow(kTRUE);}
702 else if (anOption == 1) {
703 //cout<<"take the PID and kinematics from the MC"<<endl;
704 if (intCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pMcParticle)) {
705 pTrack->SetForIntegratedFlow(kTRUE); }
706 if (diffCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pMcParticle)) {
707 pTrack->SetForDifferentialFlow(kTRUE);}
709 else { cout<<"Not a valid option"<<endl; }
711 //check if any bits are set
712 TBits bFlowBits = pTrack->GetFlowBits();
713 if (bFlowBits.CountBits() ==0) {
714 delete pTrack; } //track will not be used anymore
716 pEvent->TrackCollection()->Add(pTrack) ;
719 if (pTrack->UseForIntegratedFlow())
720 { iSelParticlesInt++; }
721 if (pTrack->UseForDifferentialFlow())
722 { iSelParticlesDiff++; }
729 pEvent-> SetEventNSelTracksIntFlow(iSelParticlesInt);
730 pEvent->SetNumberOfTracks(iGoodTracks);
731 cout<<" iGoodTracks = "<<iGoodTracks<<endl;
732 //cout << " iSelectedTracksInt = " << iSelParticlesInt << endl;