cleanup of some cout's
[u/mrichter/AliRoot.git] / PWG2 / FLOW / AliFlowEventSimpleMaker.cxx
CommitLineData
f1d945a1 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
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/* $Id */
16
17#include "Riostream.h"
18#include "AliFlowEventSimpleMaker.h"
19#include "AliFlowEventSimple.h"
20#include "AliFlowTrackSimple.h"
21#include "TTree.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"
88e00a8a 29#include "../../CORRFW/AliCFManager.h"
b00ca27f 30#include "AliFlowTrackSimpleCuts.h"
31
f1d945a1 32
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)
38
f1d945a1 39ClassImp(AliFlowEventSimpleMaker)
40//-----------------------------------------------------------------------
e35ddff0 41AliFlowEventSimpleMaker::AliFlowEventSimpleMaker()
f1d945a1 42{
f1d945a1 43 //constructor
f1d945a1 44}
45
f1d945a1 46//-----------------------------------------------------------------------
47AliFlowEventSimpleMaker::~AliFlowEventSimpleMaker()
48{
e35ddff0 49 //destructor
f1d945a1 50}
51
f1d945a1 52//-----------------------------------------------------------------------
b00ca27f 53AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(TTree* anInput, AliFlowTrackSimpleCuts* intCuts, AliFlowTrackSimpleCuts* diffCuts)
f1d945a1 54{
55 //fills the event from a TTree of kinematic.root files
7f0d823b 56
57 // number of times to use the same particle (trick to introduce nonflow)
58 Int_t iLoops = 1;
59
60 //flags for particles passing int. and diff. flow cuts
61 Bool_t bPassedIntFlowCuts = kFALSE;
62 Bool_t bPassedDiffFlowCuts = kFALSE;
63
b00ca27f 64 //track cut values
65 Double_t dPtMaxInt = intCuts->GetPtMax();
66 Double_t dPtMinInt = intCuts->GetPtMin();
67 Double_t dEtaMaxInt = intCuts->GetEtaMax();
68 Double_t dEtaMinInt = intCuts->GetEtaMin();
69 Double_t dPhiMaxInt = intCuts->GetPhiMax();
70 Double_t dPhiMinInt = intCuts->GetPhiMin();
71 Int_t iPIDInt = intCuts->GetPID();
7f0d823b 72
b00ca27f 73 Double_t dPtMaxDiff = diffCuts->GetPtMax();
74 Double_t dPtMinDiff = diffCuts->GetPtMin();
75 Double_t dEtaMaxDiff = diffCuts->GetEtaMax();
76 Double_t dEtaMinDiff = diffCuts->GetEtaMin();
77 Double_t dPhiMaxDiff = diffCuts->GetPhiMax();
78 Double_t dPhiMinDiff = diffCuts->GetPhiMin();
79 Int_t iPIDDiff = diffCuts->GetPID();
7f0d823b 80
e35ddff0 81 Int_t iNumberOfInputTracks = anInput->GetEntries() ;
82 //cerr<<"iNumberOfInputTracks = "<<iNumberOfInputTracks<<endl;
83 TParticle* pParticle = new TParticle();
84 anInput->SetBranchAddress("Particles",&pParticle);
85 // AliFlowEventSimple* pEvent = new AliFlowEventSimple(iNumberOfInputTracks);
86 AliFlowEventSimple* pEvent = new AliFlowEventSimple(10);
87 //cerr<<pEvent<<" pEvent "<<endl;
f1d945a1 88
062e56d1 89 Int_t iN = iNumberOfInputTracks; // additional variable to artificially fix the number of tracks
e35ddff0 90 // Int_t iN = 576; //multiplicity for chi=1.5
91 // Int_t iN = 256; //multiplicity for chi=1
92 // Int_t iN = 164; //multiplicity for chi=0.8
7f0d823b 93
e35ddff0 94 Int_t iGoodTracks = 0;
95 Int_t itrkN = 0;
96 Int_t iSelParticlesDiff = 0;
97 Int_t iSelParticlesInt = 0;
f1d945a1 98
7f0d823b 99 while (itrkN < iNumberOfInputTracks) {
100 anInput->GetEntry(itrkN); //get input particle
101 //checking the cuts for int. and diff. flow
102 if (pParticle->Pt() > dPtMinInt && pParticle->Pt() < dPtMaxInt &&
103 pParticle->Eta() > dEtaMinInt && pParticle->Eta() < dEtaMaxInt &&
104 pParticle->Phi() > dPhiMinInt && pParticle->Phi() < dPhiMaxInt &&
105 TMath::Abs(pParticle->GetPdgCode()) == iPIDInt) {
106 bPassedIntFlowCuts = kTRUE;
107 }
108
109 if (pParticle->Pt() > dPtMinDiff && pParticle->Pt() < dPtMaxDiff &&
110 pParticle->Eta() > dEtaMinDiff && pParticle->Eta() < dEtaMaxDiff &&
111 pParticle->Phi() > dPhiMinDiff && pParticle->Phi() < dPhiMaxDiff &&
112 TMath::Abs(pParticle->GetPdgCode()) == iPIDDiff){
113 bPassedDiffFlowCuts = kTRUE;
f1d945a1 114 }
7f0d823b 115
116 if (bPassedIntFlowCuts || bPassedDiffFlowCuts) {
117 for(Int_t d=0;d<iLoops;d++) {
118 AliFlowTrackSimple* pTrack = new AliFlowTrackSimple();
119 pTrack->SetPt(pParticle->Pt());
120 pTrack->SetEta(pParticle->Eta());
121 pTrack->SetPhi(pParticle->Phi());
122
123 //marking the particles used for int. flow:
124 if(bPassedIntFlowCuts && iSelParticlesInt < iN*iLoops) {
125 pTrack->SetForIntegratedFlow(kTRUE);
126 iSelParticlesInt++;
127 }
128 //marking the particles used for diff. flow:
129 if(bPassedDiffFlowCuts) {
130 pTrack->SetForDifferentialFlow(kTRUE);
131 iSelParticlesDiff++;
132 }
133 //adding a particles which were used either for int. or diff. flow to the list
134 pEvent->TrackCollection()->Add(pTrack);
135 iGoodTracks++;
136 }//end of for(Int_t d=0;d<iLoops;d++)
137 }//end of if(bPassedIntFlowCuts || bPassedDiffFlowCuts)
138 itrkN++;
139 bPassedIntFlowCuts = kFALSE;
140 bPassedDiffFlowCuts = kFALSE;
141 }//end of while (itrkN < iNumberOfInputTracks)
062e56d1 142
7f0d823b 143 pEvent->SetEventNSelTracksIntFlow(iSelParticlesInt);
144 pEvent->SetNumberOfTracks(iGoodTracks);//tracks used either for int. or for diff. flow
145
e35ddff0 146 cout<<" iGoodTracks = "<<iGoodTracks<<endl;
7f0d823b 147 cout<<" # of selected tracks for int. flow = "<<iSelParticlesInt<<endl;
148 cout<<" # of selected tracks for diff. flow = "<<iSelParticlesDiff<<endl;
149
150 delete pParticle;
e35ddff0 151 return pEvent;
f1d945a1 152}
153
154//-----------------------------------------------------------------------
e35ddff0 155AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliMCEvent* anInput)
f1d945a1 156{
157 //Fills the event from the MC kinematic information
0b7f49e9 158
e35ddff0 159 Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
160 cerr<<"anInput->GetNumberOfTracks() = "<<iNumberOfInputTracks<<endl;
f1d945a1 161
e35ddff0 162 AliFlowEventSimple* pEvent = new AliFlowEventSimple(10);
f1d945a1 163
e35ddff0 164 //Int_t iN = 256; //multiplicity for chi=1
165 Int_t iN = iNumberOfInputTracks;
166 Int_t iGoodTracks = 0;
167 Int_t itrkN = 0;
168 Int_t iSelParticlesDiff = 0;
169 Int_t iSelParticlesInt = 0;
f1d945a1 170
0b7f49e9 171 //normal loop
e35ddff0 172 while (iGoodTracks < iN && itrkN < iNumberOfInputTracks) {
173 AliMCParticle* pParticle = anInput->GetTrack(itrkN); //get input particle
0b7f49e9 174 //cut on tracks
88e00a8a 175 if (TMath::Abs(pParticle->Eta()) < 0.9)
0b7f49e9 176 {
177 if(
e35ddff0 178 TMath::Abs(pParticle->Particle()->GetPdgCode()) == 211
179 // TMath::Abs(pParticle->Particle()->GetPdgCode()) == 211 ||
180 // TMath::Abs(pParticle->Particle()->GetPdgCode()) == 321 ||
181 // TMath::Abs(pParticle->Particle()->GetPdgCode()) == 2212
0b7f49e9 182 )
183 {
e35ddff0 184 AliFlowTrackSimple* pTrack = new AliFlowTrackSimple();
185 pTrack->SetPt(pParticle->Pt() );
186 pTrack->SetEta(pParticle->Eta() );
187 pTrack->SetPhi(pParticle->Phi() );
188 pTrack->SetForIntegratedFlow(kTRUE);
189 pTrack->SetForDifferentialFlow(kTRUE);
190
191 if (pTrack->UseForIntegratedFlow())
192 { iSelParticlesInt++; }
193 if (pTrack->UseForDifferentialFlow())
194 { iSelParticlesDiff++; }
195 iGoodTracks++;
196 pEvent->TrackCollection()->Add(pTrack) ;
0b7f49e9 197 }
88e00a8a 198 /* else if(
e35ddff0 199 TMath::Abs(pParticle->Particle()->GetPdgCode()) == 211
f1d945a1 200 )
201 {
e35ddff0 202 AliFlowTrackSimple* pTrack = new AliFlowTrackSimple();
203 pTrack->SetPt(pParticle->Pt() );
204 pTrack->SetEta(pParticle->Eta() );
205 pTrack->SetPhi(pParticle->Phi() );
206 pTrack->SetForIntegratedFlow(kFALSE);
207 pTrack->SetForDifferentialFlow(kTRUE);
208
209 if (pTrack->UseForIntegratedFlow())
210 { iSelParticlesInt++; }
211 if (pTrack->UseForDifferentialFlow())
212 { iSelParticlesDiff++; }
213 iGoodTracks++;
214 pEvent->TrackCollection()->Add(pTrack);
f1d945a1 215 }
216 */
0b7f49e9 217 }
f1d945a1 218
e35ddff0 219 itrkN++;
f1d945a1 220 }
0b7f49e9 221
e35ddff0 222 pEvent-> SetEventNSelTracksIntFlow(iSelParticlesInt);
223 pEvent->SetNumberOfTracks(iGoodTracks);
7b88dba1 224
225 cout<<" iGoodTracks MC Event = "<<iGoodTracks<<endl;
226 cout<<" # of selected tracks for int. flow = "<<iSelParticlesInt<<endl;
227 cout<<" # of selected tracks for diff. flow = "<<iSelParticlesDiff<<endl;
228
e35ddff0 229 return pEvent;
f1d945a1 230
231}
232
88e00a8a 233
234//-----------------------------------------------------------------------
235AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliMCEvent* anInput, AliCFManager* intCFManager, AliCFManager* diffCFManager)
236{
237 //Fills the event from the MC kinematic information
238
239 Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
240 cerr<<"anInput->GetNumberOfTracks() = "<<iNumberOfInputTracks<<endl;
1eda9b5e 241 if (iNumberOfInputTracks==-1) {
242 cout<<"Skipping Event -- No MC information available for this event"<<endl;
243 return 0;
244 }
245
88e00a8a 246 AliFlowEventSimple* pEvent = new AliFlowEventSimple(10);
247
b7e1ac01 248 Int_t iN = iNumberOfInputTracks; //maximum number of tracks in AliFlowEventSimple
249 Int_t iGoodTracks = 0; //number of good tracks
250 Int_t itrkN = 0; //track counter
251 Int_t iSelParticlesDiff = 0; //number of tracks selected for Diff
252 Int_t iSelParticlesInt = 0; //number of tracks selected for Int
88e00a8a 253
254
255 //normal loop
256 while (iGoodTracks < iN && itrkN < iNumberOfInputTracks) {
257 //get input particle
258 AliMCParticle* pParticle = anInput->GetTrack(itrkN);
259 //make new AliFlowTrackSimple
260 AliFlowTrackSimple* pTrack = new AliFlowTrackSimple();
261 pTrack->SetPt(pParticle->Pt() );
262 pTrack->SetEta(pParticle->Eta() );
263 pTrack->SetPhi(pParticle->Phi() );
264
265 //check if pParticle passes the cuts
266 if (intCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pParticle)) {
267 pTrack->SetForIntegratedFlow(kTRUE);
268 //cout<<"integrated selection. PID = "<<pParticle->Particle()->GetPdgCode()<<endl;
269 }
270 if (diffCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pParticle)) {
271 pTrack->SetForDifferentialFlow(kTRUE);
272 //cout<<"differential selection. PID = "<<pParticle->Particle()->GetPdgCode()<<endl;
273 }
274
275 //check if any bits are set
276 TBits bFlowBits = pTrack->GetFlowBits();
e60cd248 277 if (bFlowBits.CountBits() ==0) {
278 delete pTrack; } //track will not be used anymore
279 else {
88e00a8a 280 pEvent->TrackCollection()->Add(pTrack) ;
281 iGoodTracks++;
282
283 if (pTrack->UseForIntegratedFlow())
284 { iSelParticlesInt++; }
285 if (pTrack->UseForDifferentialFlow())
286 { iSelParticlesDiff++; }
287 }
288
289 itrkN++;
290 }
291
292 pEvent-> SetEventNSelTracksIntFlow(iSelParticlesInt);
293 pEvent-> SetNumberOfTracks(iGoodTracks);
7b88dba1 294
295 cout<<" iGoodTracks MC Event = "<<iGoodTracks<<endl;
296 cout<<" # of selected tracks for int. flow = "<<iSelParticlesInt<<endl;
297 cout<<" # of selected tracks for diff. flow = "<<iSelParticlesDiff<<endl;
298
88e00a8a 299 return pEvent;
300
301}
302
303
f1d945a1 304//-----------------------------------------------------------------------
e35ddff0 305AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliESDEvent* anInput)
f1d945a1 306{
307 //Fills the event from the ESD
0b7f49e9 308
e35ddff0 309 Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
310 cerr<<"anInput->GetNumberOfTracks() = "<<iNumberOfInputTracks<<endl;
f1d945a1 311
e35ddff0 312 AliFlowEventSimple* pEvent = new AliFlowEventSimple(10);
f1d945a1 313
e35ddff0 314 //Int_t iN = 256; //multiplicity for chi=1
315 Int_t iN = iNumberOfInputTracks;
316 Int_t iGoodTracks = 0;
317 Int_t itrkN = 0;
318 Int_t iSelParticlesDiff = 0;
319 Int_t iSelParticlesInt = 0;
f1d945a1 320
062e56d1 321
322
0b7f49e9 323 //normal loop
e35ddff0 324 while (iGoodTracks < iN && itrkN < iNumberOfInputTracks) {
325 AliESDtrack* pParticle = anInput->GetTrack(itrkN); //get input particle
0b7f49e9 326 //cut on tracks
88e00a8a 327 if (TMath::Abs(pParticle->Eta()) < 0.9)
062e56d1 328
329
330
331 {
e35ddff0 332 AliFlowTrackSimple* pTrack = new AliFlowTrackSimple();
333 pTrack->SetPt(pParticle->Pt() );
334 pTrack->SetEta(pParticle->Eta() );
335 pTrack->SetPhi(pParticle->Phi() );
336 pTrack->SetForIntegratedFlow(kTRUE);
337 pTrack->SetForDifferentialFlow(kTRUE);
338
339 if (pTrack->UseForIntegratedFlow())
340 { iSelParticlesInt++; }
341 if (pTrack->UseForDifferentialFlow())
342 { iSelParticlesDiff++; }
343 iGoodTracks++;
344 pEvent->TrackCollection()->Add(pTrack) ;
0b7f49e9 345 }
f1d945a1 346
e35ddff0 347 itrkN++;
f1d945a1 348 }
0b7f49e9 349
e35ddff0 350 pEvent-> SetEventNSelTracksIntFlow(iSelParticlesInt);
351 pEvent->SetNumberOfTracks(iGoodTracks);
0b7f49e9 352
7b88dba1 353 cout<<" iGoodTracks ESD Event = "<<iGoodTracks<<endl;
354 cout<<" # of selected tracks for int. flow = "<<iSelParticlesInt<<endl;
355 cout<<" # of selected tracks for diff. flow = "<<iSelParticlesDiff<<endl;
f1d945a1 356
7b88dba1 357 return pEvent;
f1d945a1 358}
359
360
88e00a8a 361//-----------------------------------------------------------------------
362AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliESDEvent* anInput, AliCFManager* intCFManager, AliCFManager* diffCFManager)
363{
364 //Fills the event from the ESD
365
366 Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
367 cerr<<"anInput->GetNumberOfTracks() = "<<iNumberOfInputTracks<<endl;
368
369 AliFlowEventSimple* pEvent = new AliFlowEventSimple(10);
370
b7e1ac01 371 Int_t iN = iNumberOfInputTracks; //maximum number of tracks in AliFlowEventSimple
372 Int_t iGoodTracks = 0; //number of good tracks
373 Int_t itrkN = 0; //track counter
374 Int_t iSelParticlesDiff = 0; //number of tracks selected for Diff
375 Int_t iSelParticlesInt = 0; //number of tracks selected for Int
88e00a8a 376
377 //normal loop
378 while (iGoodTracks < iN && itrkN < iNumberOfInputTracks) {
379 AliESDtrack* pParticle = anInput->GetTrack(itrkN); //get input particle
380 //make new AliFLowTrackSimple
381 AliFlowTrackSimple* pTrack = new AliFlowTrackSimple();
382 pTrack->SetPt(pParticle->Pt() );
383 pTrack->SetEta(pParticle->Eta() );
384 pTrack->SetPhi(pParticle->Phi() );
385 //check if pParticle passes the cuts
386
1eda9b5e 387 if (intCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle) &&
b7e1ac01 388 intCFManager->CheckParticleCuts(AliCFManager::kPartSelCuts,pParticle)) {
88e00a8a 389 pTrack->SetForIntegratedFlow(kTRUE);
390 }
1eda9b5e 391 if (diffCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle) &&
b7e1ac01 392 diffCFManager->CheckParticleCuts(AliCFManager::kPartSelCuts,pParticle)) {
88e00a8a 393 pTrack->SetForDifferentialFlow(kTRUE);}
394
395 //check if any bits are set
396 TBits bFlowBits = pTrack->GetFlowBits();
e60cd248 397 if (bFlowBits.CountBits() ==0) {
398 delete pTrack; } //track will not be used anymore
399 else {
88e00a8a 400 pEvent->TrackCollection()->Add(pTrack) ;
401 iGoodTracks++;
402
403 if (pTrack->UseForIntegratedFlow())
404 { iSelParticlesInt++; }
405 if (pTrack->UseForDifferentialFlow())
406 { iSelParticlesDiff++; }
407
408 }
e60cd248 409
88e00a8a 410 itrkN++;
411 }
412
413 pEvent-> SetEventNSelTracksIntFlow(iSelParticlesInt);
414 pEvent->SetNumberOfTracks(iGoodTracks);
88e00a8a 415
7b88dba1 416 cout<<" iGoodTracks ESD Event = "<<iGoodTracks<<endl;
417 cout<<" # of selected tracks for int. flow = "<<iSelParticlesInt<<endl;
418 cout<<" # of selected tracks for diff. flow = "<<iSelParticlesDiff<<endl;
88e00a8a 419
7b88dba1 420 return pEvent;
88e00a8a 421}
f1d945a1 422
423//-----------------------------------------------------------------------
e35ddff0 424AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliAODEvent* anInput)
f1d945a1 425{
426 //Fills the event from the AOD
0b7f49e9 427
e35ddff0 428 Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
429 cerr<<"anInput->GetNumberOfTracks() = "<<iNumberOfInputTracks<<endl;
f1d945a1 430
e35ddff0 431 AliFlowEventSimple* pEvent = new AliFlowEventSimple(10);
f1d945a1 432
e35ddff0 433 //Int_t iN = 256; //multiplicity for chi=1
434 Int_t iN = iNumberOfInputTracks;
435 Int_t iGoodTracks = 0;
436 Int_t itrkN = 0;
437 Int_t iSelParticlesDiff = 0;
438 Int_t iSelParticlesInt = 0;
f1d945a1 439
0b7f49e9 440 //normal loop
e35ddff0 441 while (iGoodTracks < iN && itrkN < iNumberOfInputTracks) {
442 AliAODTrack* pParticle = anInput->GetTrack(itrkN); //get input particle
0b7f49e9 443 //cut on tracks
88e00a8a 444 if (TMath::Abs(pParticle->Eta()) < 0.9)
0b7f49e9 445 {
e35ddff0 446 AliFlowTrackSimple* pTrack = new AliFlowTrackSimple();
447 pTrack->SetPt(pParticle->Pt() );
448 pTrack->SetEta(pParticle->Eta() );
449 pTrack->SetPhi(pParticle->Phi() );
450 pTrack->SetForIntegratedFlow(kTRUE);
451 pTrack->SetForDifferentialFlow(kTRUE);
452
453 if (pTrack->UseForIntegratedFlow())
454 { iSelParticlesInt++; }
455 if (pTrack->UseForDifferentialFlow())
456 { iSelParticlesDiff++; }
457 iGoodTracks++;
458 pEvent->TrackCollection()->Add(pTrack) ;
0b7f49e9 459 }
f1d945a1 460
e35ddff0 461 itrkN++;
0b7f49e9 462 }
463
e35ddff0 464 pEvent-> SetEventNSelTracksIntFlow(iSelParticlesInt);
465 pEvent->SetNumberOfTracks(iGoodTracks);
7b88dba1 466
467 cout<<" iGoodTracks AOD Event = "<<iGoodTracks<<endl;
468 cout<<" # of selected tracks for int. flow = "<<iSelParticlesInt<<endl;
469 cout<<" # of selected tracks for diff. flow = "<<iSelParticlesDiff<<endl;
470
e35ddff0 471 return pEvent;
0b7f49e9 472}
88e00a8a 473
474
475//-----------------------------------------------------------------------
476AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliAODEvent* anInput, AliCFManager* intCFManager, AliCFManager* diffCFManager)
477{
478 //Fills the event from the AOD
479
480 Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
481 cerr<<"anInput->GetNumberOfTracks() = "<<iNumberOfInputTracks<<endl;
482
483 AliFlowEventSimple* pEvent = new AliFlowEventSimple(10);
88e00a8a 484
b7e1ac01 485 Int_t iN = iNumberOfInputTracks; //maximum number of tracks in AliFlowEventSimple
486 Int_t iGoodTracks = 0; //number of good tracks
487 Int_t itrkN = 0; //track counter
488 Int_t iSelParticlesDiff = 0; //number of tracks selected for Diff
489 Int_t iSelParticlesInt = 0; //number of tracks selected for Int
490
88e00a8a 491 //normal loop
492 while (iGoodTracks < iN && itrkN < iNumberOfInputTracks) {
493 AliAODTrack* pParticle = anInput->GetTrack(itrkN); //get input particle
494 //make new AliFlowTrackSimple
495 AliFlowTrackSimple* pTrack = new AliFlowTrackSimple();
496 pTrack->SetPt(pParticle->Pt() );
497 pTrack->SetEta(pParticle->Eta() );
498 pTrack->SetPhi(pParticle->Phi() );
499
500 //check if pParticle passes the cuts
b7e1ac01 501 if (intCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle) &&
502 intCFManager->CheckParticleCuts(AliCFManager::kPartSelCuts,pParticle)) {
88e00a8a 503 pTrack->SetForIntegratedFlow(kTRUE); }
b7e1ac01 504 if (diffCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle) &&
505 diffCFManager->CheckParticleCuts(AliCFManager::kPartSelCuts,pParticle)) {
88e00a8a 506 pTrack->SetForDifferentialFlow(kTRUE);}
507
508 //check if any bits are set
509 TBits bFlowBits = pTrack->GetFlowBits();
e60cd248 510 if (bFlowBits.CountBits() ==0) {
511 delete pTrack; } //track will not be used anymore
512 else {
88e00a8a 513 pEvent->TrackCollection()->Add(pTrack) ;
514 iGoodTracks++;
515
516 if (pTrack->UseForIntegratedFlow())
517 { iSelParticlesInt++; }
518 if (pTrack->UseForDifferentialFlow())
519 { iSelParticlesDiff++; }
520
521 }
e60cd248 522
88e00a8a 523 itrkN++;
524 }
525
526 pEvent-> SetEventNSelTracksIntFlow(iSelParticlesInt);
527 pEvent->SetNumberOfTracks(iGoodTracks);
7b88dba1 528
529 cout<<" iGoodTracks AOD Event = "<<iGoodTracks<<endl;
530 cout<<" # of selected tracks for int. flow = "<<iSelParticlesInt<<endl;
531 cout<<" # of selected tracks for diff. flow = "<<iSelParticlesDiff<<endl;
532
88e00a8a 533 return pEvent;
88e00a8a 534}
535
0b7f49e9 536//-----------------------------------------------------------------------
e35ddff0 537AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliESDEvent* anInput, AliMCEvent* anInputMc, Int_t anOption)
0b7f49e9 538{
539 //fills the event with tracks from the ESD and kinematics from the MC info via the track label
540
e35ddff0 541 if (!(anOption ==0 || anOption ==1)) {
542 cout<<"WRONG OPTION IN AliFlowEventSimpleMaker::FillTracks(AliESDEvent* anInput, AliMCEvent* anInputMc, Int_t anOption)"<<endl;
0b7f49e9 543 exit(1);
f1d945a1 544 }
545
e35ddff0 546 Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
547 cerr<<"anInput->GetNumberOfTracks() = "<<iNumberOfInputTracks<<endl;
0b7f49e9 548
e35ddff0 549 AliFlowEventSimple* pEvent = new AliFlowEventSimple(10);
0b7f49e9 550
e35ddff0 551 //Int_t iN = 256; //multiplicity for chi=1
552 Int_t iN = iNumberOfInputTracks;
553 Int_t iGoodTracks = 0;
554 Int_t itrkN = 0;
555 Int_t iSelParticlesDiff = 0;
556 Int_t iSelParticlesInt = 0;
f1d945a1 557
0b7f49e9 558 //normal loop
e35ddff0 559 while (iGoodTracks < iN && itrkN < iNumberOfInputTracks) {
560 AliESDtrack* pParticle = anInput->GetTrack(itrkN); //get input particle
0b7f49e9 561 //get Label
e35ddff0 562 Int_t iLabel = pParticle->GetLabel();
0b7f49e9 563 //match to mc particle
e35ddff0 564 AliMCParticle* pMcParticle = anInputMc->GetTrack(TMath::Abs(iLabel));
0b7f49e9 565
566 //check
e35ddff0 567 if (TMath::Abs(pParticle->GetLabel())!=pMcParticle->Label()) cout<<"pParticle->GetLabel()!=pMcParticle->Label() "<<pParticle->GetLabel()<<" "<<pMcParticle->Label()<<endl;
0b7f49e9 568
569 //cut on tracks
e35ddff0 570 if (TMath::Abs(pParticle->Eta()) < 0.2)
0b7f49e9 571 {
572 if(
e35ddff0 573 TMath::Abs(pMcParticle->Particle()->GetPdgCode()) == 211 //pions
574 // TMath::Abs(pMcParticle->Particle()->GetPdgCode()) == 211 ||
575 // TMath::Abs(pMcParticle->Particle()->GetPdgCode()) == 321 ||
576 // TMath::Abs(pMcParticle->Particle()->GetPdgCode()) == 2212
0b7f49e9 577 )
578 {
e35ddff0 579 AliFlowTrackSimple* pTrack = new AliFlowTrackSimple();
580 if(anOption == 0) { //take the PID from the MC & the kinematics from the ESD
581 pTrack->SetPt(pParticle->Pt() );
582 pTrack->SetEta(pParticle->Eta() );
583 pTrack->SetPhi(pParticle->Phi() );
584 pTrack->SetForIntegratedFlow(kTRUE);
585 pTrack->SetForDifferentialFlow(kTRUE);
0b7f49e9 586 }
e35ddff0 587 else if (anOption == 1) { //take the PID and kinematics from the MC
588 pTrack->SetPt(pMcParticle->Pt() );
589 pTrack->SetEta(pMcParticle->Eta() );
590 pTrack->SetPhi(pMcParticle->Phi() );
591 pTrack->SetForIntegratedFlow(kTRUE);
592 pTrack->SetForDifferentialFlow(kTRUE);
0b7f49e9 593 }
594 else { cout<<"Not a valid option"<<endl; }
e35ddff0 595 if (pTrack->UseForIntegratedFlow())
596 { iSelParticlesInt++; }
597 if (pTrack->UseForDifferentialFlow())
598 { iSelParticlesDiff++; }
599 iGoodTracks++;
600 pEvent->TrackCollection()->Add(pTrack) ;
0b7f49e9 601 }
602 }
e35ddff0 603 itrkN++;
0b7f49e9 604 }
605
e35ddff0 606 pEvent-> SetEventNSelTracksIntFlow(iSelParticlesInt);
607 pEvent->SetNumberOfTracks(iGoodTracks);
7b88dba1 608
609 cout<<" iGoodTracks ESD and MC Event = "<<iGoodTracks<<endl;
610 cout<<" # of selected tracks for int. flow = "<<iSelParticlesInt<<endl;
611 cout<<" # of selected tracks for diff. flow = "<<iSelParticlesDiff<<endl;
612
e35ddff0 613 return pEvent;
f1d945a1 614
0b7f49e9 615
f1d945a1 616}
617
88e00a8a 618//-----------------------------------------------------------------------
619AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliESDEvent* anInput, AliMCEvent* anInputMc, AliCFManager* intCFManager, AliCFManager* diffCFManager, Int_t anOption)
620{
621 //fills the event with tracks from the ESD and kinematics from the MC info via the track label
0b7f49e9 622
b7e1ac01 623
88e00a8a 624 if (!(anOption ==0 || anOption ==1)) {
625 cout<<"WRONG OPTION IN AliFlowEventSimpleMaker::FillTracks(AliESDEvent* anInput, AliMCEvent* anInputMc, Int_t anOption)"<<endl;
626 exit(1);
627 }
f1d945a1 628
88e00a8a 629 Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
630 cerr<<"anInput->GetNumberOfTracks() = "<<iNumberOfInputTracks<<endl;
1eda9b5e 631 Int_t iNumberOfInputTracksMC = anInputMc->GetNumberOfTracks() ;
632 cerr<<"anInputMc->GetNumberOfTracks() = "<<iNumberOfInputTracksMC<<endl;
633 if (iNumberOfInputTracksMC==-1) {
634 cout<<"Skipping Event -- No MC information available for this event"<<endl;
635 return 0;
636 }
637
88e00a8a 638 AliFlowEventSimple* pEvent = new AliFlowEventSimple(10);
639
b7e1ac01 640 Int_t iN = iNumberOfInputTracks; //maximum number of tracks in AliFlowEventSimple
641 Int_t iGoodTracks = 0; //number of good tracks
642 Int_t itrkN = 0; //track counter
643 Int_t iSelParticlesDiff = 0; //number of tracks selected for Diff
644 Int_t iSelParticlesInt = 0; //number of tracks selected for Int
88e00a8a 645
b7e1ac01 646
88e00a8a 647 //normal loop
648 while (iGoodTracks < iN && itrkN < iNumberOfInputTracks) {
649 AliESDtrack* pParticle = anInput->GetTrack(itrkN); //get input particle
650 //get Label
651 Int_t iLabel = pParticle->GetLabel();
652 //match to mc particle
653 AliMCParticle* pMcParticle = anInputMc->GetTrack(TMath::Abs(iLabel));
654
655 //check
656 if (TMath::Abs(pParticle->GetLabel())!=pMcParticle->Label()) cout<<"pParticle->GetLabel()!=pMcParticle->Label() "<<pParticle->GetLabel()<<" "<<pMcParticle->Label()<<endl;
657
658 //make new AliFlowTrackSimple
659 AliFlowTrackSimple* pTrack = new AliFlowTrackSimple();
660 if(anOption == 0) { //take the PID from the MC & the kinematics from the ESD
661 pTrack->SetPt(pParticle->Pt() );
662 pTrack->SetEta(pParticle->Eta() );
663 pTrack->SetPhi(pParticle->Phi() );
664 }
665 else if (anOption == 1) { //take the PID and kinematics from the MC
666 pTrack->SetPt(pMcParticle->Pt() );
667 pTrack->SetEta(pMcParticle->Eta() );
668 pTrack->SetPhi(pMcParticle->Phi() );
669 }
670 else { cout<<"Not a valid option"<<endl; }
671
672 //check if pParticle passes the cuts
673 if(anOption == 0) {
674 //cout<<"take the PID from the MC & the kinematics from the ESD"<<endl;
675 if (intCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pMcParticle,"mcGenCuts1") &&
b7e1ac01 676 intCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle)) {
88e00a8a 677 pTrack->SetForIntegratedFlow(kTRUE); }
678 if (diffCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pMcParticle,"mcGenCuts2") &&
b7e1ac01 679 diffCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle)) {
88e00a8a 680 pTrack->SetForDifferentialFlow(kTRUE);}
681 }
682 else if (anOption == 1) {
683 //cout<<"take the PID and kinematics from the MC"<<endl;
684 if (intCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pMcParticle)) {
685 pTrack->SetForIntegratedFlow(kTRUE); }
686 if (diffCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pMcParticle)) {
687 pTrack->SetForDifferentialFlow(kTRUE);}
688 }
689 else { cout<<"Not a valid option"<<endl; }
690
691 //check if any bits are set
692 TBits bFlowBits = pTrack->GetFlowBits();
e60cd248 693 if (bFlowBits.CountBits() ==0) {
694 delete pTrack; } //track will not be used anymore
695 else {
88e00a8a 696 pEvent->TrackCollection()->Add(pTrack) ;
697 iGoodTracks++;
698
699 if (pTrack->UseForIntegratedFlow())
700 { iSelParticlesInt++; }
701 if (pTrack->UseForDifferentialFlow())
702 { iSelParticlesDiff++; }
703
704 }
e60cd248 705
88e00a8a 706 itrkN++;
707 }
708
709 pEvent-> SetEventNSelTracksIntFlow(iSelParticlesInt);
710 pEvent->SetNumberOfTracks(iGoodTracks);
88e00a8a 711
7b88dba1 712 cout<<" iGoodTracks ESD and MC Event = "<<iGoodTracks<<endl;
713 cout<<" # of selected tracks for int. flow = "<<iSelParticlesInt<<endl;
714 cout<<" # of selected tracks for diff. flow = "<<iSelParticlesDiff<<endl;
88e00a8a 715
7b88dba1 716 return pEvent;
717}
88e00a8a 718