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