more for weigths
[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//-----------------------------------------------------------------------
e085f1a9 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() ;
26c4cbb9 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);
26c4cbb9 224 cout<<" iGoodTracks = "<<iGoodTracks<<endl;
225 //cout << " iSelectedTracksInt = " << iSelParticlesInt << endl;
e35ddff0 226 return pEvent;
f1d945a1 227
228}
229
88e00a8a 230
231//-----------------------------------------------------------------------
232AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliMCEvent* anInput, AliCFManager* intCFManager, AliCFManager* diffCFManager)
233{
234 //Fills the event from the MC kinematic information
235
236 Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
26c4cbb9 237 cerr<<"anInput->GetNumberOfTracks() = "<<iNumberOfInputTracks<<endl;
1eda9b5e 238 if (iNumberOfInputTracks==-1) {
239 cout<<"Skipping Event -- No MC information available for this event"<<endl;
240 return 0;
241 }
242
88e00a8a 243 AliFlowEventSimple* pEvent = new AliFlowEventSimple(10);
244
b7e1ac01 245 Int_t iN = iNumberOfInputTracks; //maximum number of tracks in AliFlowEventSimple
246 Int_t iGoodTracks = 0; //number of good tracks
247 Int_t itrkN = 0; //track counter
248 Int_t iSelParticlesDiff = 0; //number of tracks selected for Diff
249 Int_t iSelParticlesInt = 0; //number of tracks selected for Int
88e00a8a 250
251
252 //normal loop
253 while (iGoodTracks < iN && itrkN < iNumberOfInputTracks) {
254 //get input particle
255 AliMCParticle* pParticle = anInput->GetTrack(itrkN);
256 //make new AliFlowTrackSimple
257 AliFlowTrackSimple* pTrack = new AliFlowTrackSimple();
258 pTrack->SetPt(pParticle->Pt() );
259 pTrack->SetEta(pParticle->Eta() );
260 pTrack->SetPhi(pParticle->Phi() );
261
262 //check if pParticle passes the cuts
263 if (intCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pParticle)) {
264 pTrack->SetForIntegratedFlow(kTRUE);
265 //cout<<"integrated selection. PID = "<<pParticle->Particle()->GetPdgCode()<<endl;
266 }
267 if (diffCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pParticle)) {
268 pTrack->SetForDifferentialFlow(kTRUE);
269 //cout<<"differential selection. PID = "<<pParticle->Particle()->GetPdgCode()<<endl;
270 }
271
272 //check if any bits are set
273 TBits bFlowBits = pTrack->GetFlowBits();
e60cd248 274 if (bFlowBits.CountBits() ==0) {
275 delete pTrack; } //track will not be used anymore
276 else {
88e00a8a 277 pEvent->TrackCollection()->Add(pTrack) ;
278 iGoodTracks++;
279
280 if (pTrack->UseForIntegratedFlow())
281 { iSelParticlesInt++; }
282 if (pTrack->UseForDifferentialFlow())
283 { iSelParticlesDiff++; }
284 }
285
286 itrkN++;
287 }
288
289 pEvent-> SetEventNSelTracksIntFlow(iSelParticlesInt);
290 pEvent-> SetNumberOfTracks(iGoodTracks);
26c4cbb9 291 cout<<" iGoodTracks = "<<iGoodTracks<<endl;
292 //cout << " iSelectedTracksInt = " << iSelParticlesInt << endl;
88e00a8a 293 return pEvent;
294
295}
296
297
f1d945a1 298//-----------------------------------------------------------------------
e35ddff0 299AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliESDEvent* anInput)
f1d945a1 300{
301 //Fills the event from the ESD
0b7f49e9 302
e35ddff0 303 Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
26c4cbb9 304 cerr<<"anInput->GetNumberOfTracks() = "<<iNumberOfInputTracks<<endl;
f1d945a1 305
e35ddff0 306 AliFlowEventSimple* pEvent = new AliFlowEventSimple(10);
f1d945a1 307
e35ddff0 308 //Int_t iN = 256; //multiplicity for chi=1
309 Int_t iN = iNumberOfInputTracks;
310 Int_t iGoodTracks = 0;
311 Int_t itrkN = 0;
312 Int_t iSelParticlesDiff = 0;
313 Int_t iSelParticlesInt = 0;
f1d945a1 314
062e56d1 315
316
0b7f49e9 317 //normal loop
e35ddff0 318 while (iGoodTracks < iN && itrkN < iNumberOfInputTracks) {
319 AliESDtrack* pParticle = anInput->GetTrack(itrkN); //get input particle
0b7f49e9 320 //cut on tracks
88e00a8a 321 if (TMath::Abs(pParticle->Eta()) < 0.9)
062e56d1 322
323
324
325 {
e35ddff0 326 AliFlowTrackSimple* pTrack = new AliFlowTrackSimple();
327 pTrack->SetPt(pParticle->Pt() );
328 pTrack->SetEta(pParticle->Eta() );
329 pTrack->SetPhi(pParticle->Phi() );
330 pTrack->SetForIntegratedFlow(kTRUE);
331 pTrack->SetForDifferentialFlow(kTRUE);
332
333 if (pTrack->UseForIntegratedFlow())
334 { iSelParticlesInt++; }
335 if (pTrack->UseForDifferentialFlow())
336 { iSelParticlesDiff++; }
337 iGoodTracks++;
338 pEvent->TrackCollection()->Add(pTrack) ;
0b7f49e9 339 }
f1d945a1 340
e35ddff0 341 itrkN++;
f1d945a1 342 }
0b7f49e9 343
e35ddff0 344 pEvent-> SetEventNSelTracksIntFlow(iSelParticlesInt);
345 pEvent->SetNumberOfTracks(iGoodTracks);
26c4cbb9 346 cout<<" iGoodTracks = "<<iGoodTracks<<endl;
347 //cout << " iSelectedTracksInt = " << iSelParticlesInt << endl;
348 return pEvent;
0b7f49e9 349
f1d945a1 350
351}
352
353
88e00a8a 354//-----------------------------------------------------------------------
355AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliESDEvent* anInput, AliCFManager* intCFManager, AliCFManager* diffCFManager)
356{
357 //Fills the event from the ESD
358
359 Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
26c4cbb9 360 cerr<<"anInput->GetNumberOfTracks() = "<<iNumberOfInputTracks<<endl;
88e00a8a 361
362 AliFlowEventSimple* pEvent = new AliFlowEventSimple(10);
363
b7e1ac01 364 Int_t iN = iNumberOfInputTracks; //maximum number of tracks in AliFlowEventSimple
365 Int_t iGoodTracks = 0; //number of good tracks
366 Int_t itrkN = 0; //track counter
367 Int_t iSelParticlesDiff = 0; //number of tracks selected for Diff
368 Int_t iSelParticlesInt = 0; //number of tracks selected for Int
88e00a8a 369
370 //normal loop
371 while (iGoodTracks < iN && itrkN < iNumberOfInputTracks) {
372 AliESDtrack* pParticle = anInput->GetTrack(itrkN); //get input particle
373 //make new AliFLowTrackSimple
374 AliFlowTrackSimple* pTrack = new AliFlowTrackSimple();
375 pTrack->SetPt(pParticle->Pt() );
376 pTrack->SetEta(pParticle->Eta() );
377 pTrack->SetPhi(pParticle->Phi() );
378 //check if pParticle passes the cuts
379
1eda9b5e 380 if (intCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle) &&
b7e1ac01 381 intCFManager->CheckParticleCuts(AliCFManager::kPartSelCuts,pParticle)) {
88e00a8a 382 pTrack->SetForIntegratedFlow(kTRUE);
383 }
1eda9b5e 384 if (diffCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle) &&
b7e1ac01 385 diffCFManager->CheckParticleCuts(AliCFManager::kPartSelCuts,pParticle)) {
88e00a8a 386 pTrack->SetForDifferentialFlow(kTRUE);}
387
388 //check if any bits are set
389 TBits bFlowBits = pTrack->GetFlowBits();
e60cd248 390 if (bFlowBits.CountBits() ==0) {
391 delete pTrack; } //track will not be used anymore
392 else {
88e00a8a 393 pEvent->TrackCollection()->Add(pTrack) ;
394 iGoodTracks++;
395
396 if (pTrack->UseForIntegratedFlow())
397 { iSelParticlesInt++; }
398 if (pTrack->UseForDifferentialFlow())
399 { iSelParticlesDiff++; }
400
401 }
e60cd248 402
88e00a8a 403 itrkN++;
404 }
405
406 pEvent-> SetEventNSelTracksIntFlow(iSelParticlesInt);
407 pEvent->SetNumberOfTracks(iGoodTracks);
26c4cbb9 408 cout<<" iGoodTracks = "<<iGoodTracks<<endl;
409 //cout << " iSelectedTracksInt = " << iSelParticlesInt << endl;
410 return pEvent;
88e00a8a 411
412
413}
f1d945a1 414
415//-----------------------------------------------------------------------
e35ddff0 416AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliAODEvent* anInput)
f1d945a1 417{
418 //Fills the event from the AOD
0b7f49e9 419
e35ddff0 420 Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
26c4cbb9 421 cerr<<"anInput->GetNumberOfTracks() = "<<iNumberOfInputTracks<<endl;
f1d945a1 422
e35ddff0 423 AliFlowEventSimple* pEvent = new AliFlowEventSimple(10);
f1d945a1 424
e35ddff0 425 //Int_t iN = 256; //multiplicity for chi=1
426 Int_t iN = iNumberOfInputTracks;
427 Int_t iGoodTracks = 0;
428 Int_t itrkN = 0;
429 Int_t iSelParticlesDiff = 0;
430 Int_t iSelParticlesInt = 0;
f1d945a1 431
0b7f49e9 432 //normal loop
e35ddff0 433 while (iGoodTracks < iN && itrkN < iNumberOfInputTracks) {
434 AliAODTrack* pParticle = anInput->GetTrack(itrkN); //get input particle
0b7f49e9 435 //cut on tracks
88e00a8a 436 if (TMath::Abs(pParticle->Eta()) < 0.9)
0b7f49e9 437 {
e35ddff0 438 AliFlowTrackSimple* pTrack = new AliFlowTrackSimple();
439 pTrack->SetPt(pParticle->Pt() );
440 pTrack->SetEta(pParticle->Eta() );
441 pTrack->SetPhi(pParticle->Phi() );
442 pTrack->SetForIntegratedFlow(kTRUE);
443 pTrack->SetForDifferentialFlow(kTRUE);
444
445 if (pTrack->UseForIntegratedFlow())
446 { iSelParticlesInt++; }
447 if (pTrack->UseForDifferentialFlow())
448 { iSelParticlesDiff++; }
449 iGoodTracks++;
450 pEvent->TrackCollection()->Add(pTrack) ;
0b7f49e9 451 }
f1d945a1 452
e35ddff0 453 itrkN++;
0b7f49e9 454 }
455
e35ddff0 456 pEvent-> SetEventNSelTracksIntFlow(iSelParticlesInt);
457 pEvent->SetNumberOfTracks(iGoodTracks);
26c4cbb9 458 cout<<" iGoodTracks = "<<iGoodTracks<<endl;
459 //cout << " iSelectedTracksInt = " << iSelParticlesInt << endl;
e35ddff0 460 return pEvent;
26c4cbb9 461
0b7f49e9 462}
88e00a8a 463
464
465//-----------------------------------------------------------------------
466AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliAODEvent* anInput, AliCFManager* intCFManager, AliCFManager* diffCFManager)
467{
468 //Fills the event from the AOD
469
470 Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
26c4cbb9 471 cerr<<"anInput->GetNumberOfTracks() = "<<iNumberOfInputTracks<<endl;
88e00a8a 472
473 AliFlowEventSimple* pEvent = new AliFlowEventSimple(10);
88e00a8a 474
b7e1ac01 475 Int_t iN = iNumberOfInputTracks; //maximum number of tracks in AliFlowEventSimple
476 Int_t iGoodTracks = 0; //number of good tracks
477 Int_t itrkN = 0; //track counter
478 Int_t iSelParticlesDiff = 0; //number of tracks selected for Diff
479 Int_t iSelParticlesInt = 0; //number of tracks selected for Int
480
88e00a8a 481 //normal loop
482 while (iGoodTracks < iN && itrkN < iNumberOfInputTracks) {
483 AliAODTrack* pParticle = anInput->GetTrack(itrkN); //get input particle
484 //make new AliFlowTrackSimple
485 AliFlowTrackSimple* pTrack = new AliFlowTrackSimple();
486 pTrack->SetPt(pParticle->Pt() );
487 pTrack->SetEta(pParticle->Eta() );
488 pTrack->SetPhi(pParticle->Phi() );
489
490 //check if pParticle passes the cuts
b7e1ac01 491 if (intCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle) &&
492 intCFManager->CheckParticleCuts(AliCFManager::kPartSelCuts,pParticle)) {
88e00a8a 493 pTrack->SetForIntegratedFlow(kTRUE); }
b7e1ac01 494 if (diffCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle) &&
495 diffCFManager->CheckParticleCuts(AliCFManager::kPartSelCuts,pParticle)) {
88e00a8a 496 pTrack->SetForDifferentialFlow(kTRUE);}
497
498 //check if any bits are set
499 TBits bFlowBits = pTrack->GetFlowBits();
e60cd248 500 if (bFlowBits.CountBits() ==0) {
501 delete pTrack; } //track will not be used anymore
502 else {
88e00a8a 503 pEvent->TrackCollection()->Add(pTrack) ;
504 iGoodTracks++;
505
506 if (pTrack->UseForIntegratedFlow())
507 { iSelParticlesInt++; }
508 if (pTrack->UseForDifferentialFlow())
509 { iSelParticlesDiff++; }
510
511 }
e60cd248 512
88e00a8a 513 itrkN++;
514 }
515
516 pEvent-> SetEventNSelTracksIntFlow(iSelParticlesInt);
517 pEvent->SetNumberOfTracks(iGoodTracks);
26c4cbb9 518 cout<<" iGoodTracks = "<<iGoodTracks<<endl;
519 //cout << " iSelectedTracksInt = " << iSelParticlesInt << endl;
88e00a8a 520 return pEvent;
26c4cbb9 521
88e00a8a 522}
523
0b7f49e9 524//-----------------------------------------------------------------------
e35ddff0 525AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliESDEvent* anInput, AliMCEvent* anInputMc, Int_t anOption)
0b7f49e9 526{
527 //fills the event with tracks from the ESD and kinematics from the MC info via the track label
528
e35ddff0 529 if (!(anOption ==0 || anOption ==1)) {
530 cout<<"WRONG OPTION IN AliFlowEventSimpleMaker::FillTracks(AliESDEvent* anInput, AliMCEvent* anInputMc, Int_t anOption)"<<endl;
0b7f49e9 531 exit(1);
f1d945a1 532 }
533
e35ddff0 534 Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
26c4cbb9 535 cerr<<"anInput->GetNumberOfTracks() = "<<iNumberOfInputTracks<<endl;
0b7f49e9 536
e35ddff0 537 AliFlowEventSimple* pEvent = new AliFlowEventSimple(10);
0b7f49e9 538
e35ddff0 539 //Int_t iN = 256; //multiplicity for chi=1
540 Int_t iN = iNumberOfInputTracks;
541 Int_t iGoodTracks = 0;
542 Int_t itrkN = 0;
543 Int_t iSelParticlesDiff = 0;
544 Int_t iSelParticlesInt = 0;
f1d945a1 545
0b7f49e9 546 //normal loop
e35ddff0 547 while (iGoodTracks < iN && itrkN < iNumberOfInputTracks) {
548 AliESDtrack* pParticle = anInput->GetTrack(itrkN); //get input particle
0b7f49e9 549 //get Label
e35ddff0 550 Int_t iLabel = pParticle->GetLabel();
0b7f49e9 551 //match to mc particle
e35ddff0 552 AliMCParticle* pMcParticle = anInputMc->GetTrack(TMath::Abs(iLabel));
0b7f49e9 553
554 //check
e35ddff0 555 if (TMath::Abs(pParticle->GetLabel())!=pMcParticle->Label()) cout<<"pParticle->GetLabel()!=pMcParticle->Label() "<<pParticle->GetLabel()<<" "<<pMcParticle->Label()<<endl;
0b7f49e9 556
557 //cut on tracks
e35ddff0 558 if (TMath::Abs(pParticle->Eta()) < 0.2)
0b7f49e9 559 {
560 if(
e35ddff0 561 TMath::Abs(pMcParticle->Particle()->GetPdgCode()) == 211 //pions
562 // TMath::Abs(pMcParticle->Particle()->GetPdgCode()) == 211 ||
563 // TMath::Abs(pMcParticle->Particle()->GetPdgCode()) == 321 ||
564 // TMath::Abs(pMcParticle->Particle()->GetPdgCode()) == 2212
0b7f49e9 565 )
566 {
e35ddff0 567 AliFlowTrackSimple* pTrack = new AliFlowTrackSimple();
568 if(anOption == 0) { //take the PID from the MC & the kinematics from the ESD
569 pTrack->SetPt(pParticle->Pt() );
570 pTrack->SetEta(pParticle->Eta() );
571 pTrack->SetPhi(pParticle->Phi() );
572 pTrack->SetForIntegratedFlow(kTRUE);
573 pTrack->SetForDifferentialFlow(kTRUE);
0b7f49e9 574 }
e35ddff0 575 else if (anOption == 1) { //take the PID and kinematics from the MC
576 pTrack->SetPt(pMcParticle->Pt() );
577 pTrack->SetEta(pMcParticle->Eta() );
578 pTrack->SetPhi(pMcParticle->Phi() );
579 pTrack->SetForIntegratedFlow(kTRUE);
580 pTrack->SetForDifferentialFlow(kTRUE);
0b7f49e9 581 }
582 else { cout<<"Not a valid option"<<endl; }
e35ddff0 583 if (pTrack->UseForIntegratedFlow())
584 { iSelParticlesInt++; }
585 if (pTrack->UseForDifferentialFlow())
586 { iSelParticlesDiff++; }
587 iGoodTracks++;
588 pEvent->TrackCollection()->Add(pTrack) ;
0b7f49e9 589 }
590 }
e35ddff0 591 itrkN++;
0b7f49e9 592 }
593
e35ddff0 594 pEvent-> SetEventNSelTracksIntFlow(iSelParticlesInt);
595 pEvent->SetNumberOfTracks(iGoodTracks);
26c4cbb9 596 cout<<" iGoodTracks = "<<iGoodTracks<<endl;
597 //cout << " iSelectedTracksInt = " << iSelParticlesInt << endl;
e35ddff0 598 return pEvent;
f1d945a1 599
0b7f49e9 600
f1d945a1 601}
602
88e00a8a 603//-----------------------------------------------------------------------
604AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliESDEvent* anInput, AliMCEvent* anInputMc, AliCFManager* intCFManager, AliCFManager* diffCFManager, Int_t anOption)
605{
606 //fills the event with tracks from the ESD and kinematics from the MC info via the track label
0b7f49e9 607
b7e1ac01 608
88e00a8a 609 if (!(anOption ==0 || anOption ==1)) {
610 cout<<"WRONG OPTION IN AliFlowEventSimpleMaker::FillTracks(AliESDEvent* anInput, AliMCEvent* anInputMc, Int_t anOption)"<<endl;
611 exit(1);
612 }
f1d945a1 613
88e00a8a 614 Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
26c4cbb9 615 cerr<<"anInput->GetNumberOfTracks() = "<<iNumberOfInputTracks<<endl;
1eda9b5e 616 Int_t iNumberOfInputTracksMC = anInputMc->GetNumberOfTracks() ;
26c4cbb9 617 cerr<<"anInputMc->GetNumberOfTracks() = "<<iNumberOfInputTracksMC<<endl;
1eda9b5e 618 if (iNumberOfInputTracksMC==-1) {
619 cout<<"Skipping Event -- No MC information available for this event"<<endl;
620 return 0;
621 }
622
88e00a8a 623 AliFlowEventSimple* pEvent = new AliFlowEventSimple(10);
624
b7e1ac01 625 Int_t iN = iNumberOfInputTracks; //maximum number of tracks in AliFlowEventSimple
626 Int_t iGoodTracks = 0; //number of good tracks
627 Int_t itrkN = 0; //track counter
628 Int_t iSelParticlesDiff = 0; //number of tracks selected for Diff
629 Int_t iSelParticlesInt = 0; //number of tracks selected for Int
88e00a8a 630
b7e1ac01 631
88e00a8a 632 //normal loop
633 while (iGoodTracks < iN && itrkN < iNumberOfInputTracks) {
634 AliESDtrack* pParticle = anInput->GetTrack(itrkN); //get input particle
635 //get Label
636 Int_t iLabel = pParticle->GetLabel();
637 //match to mc particle
638 AliMCParticle* pMcParticle = anInputMc->GetTrack(TMath::Abs(iLabel));
639
640 //check
641 if (TMath::Abs(pParticle->GetLabel())!=pMcParticle->Label()) cout<<"pParticle->GetLabel()!=pMcParticle->Label() "<<pParticle->GetLabel()<<" "<<pMcParticle->Label()<<endl;
642
643 //make new AliFlowTrackSimple
644 AliFlowTrackSimple* pTrack = new AliFlowTrackSimple();
645 if(anOption == 0) { //take the PID from the MC & the kinematics from the ESD
646 pTrack->SetPt(pParticle->Pt() );
647 pTrack->SetEta(pParticle->Eta() );
648 pTrack->SetPhi(pParticle->Phi() );
649 }
650 else if (anOption == 1) { //take the PID and kinematics from the MC
651 pTrack->SetPt(pMcParticle->Pt() );
652 pTrack->SetEta(pMcParticle->Eta() );
653 pTrack->SetPhi(pMcParticle->Phi() );
654 }
655 else { cout<<"Not a valid option"<<endl; }
656
657 //check if pParticle passes the cuts
658 if(anOption == 0) {
659 //cout<<"take the PID from the MC & the kinematics from the ESD"<<endl;
660 if (intCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pMcParticle,"mcGenCuts1") &&
b7e1ac01 661 intCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle)) {
88e00a8a 662 pTrack->SetForIntegratedFlow(kTRUE); }
663 if (diffCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pMcParticle,"mcGenCuts2") &&
b7e1ac01 664 diffCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle)) {
88e00a8a 665 pTrack->SetForDifferentialFlow(kTRUE);}
666 }
667 else if (anOption == 1) {
668 //cout<<"take the PID and kinematics from the MC"<<endl;
669 if (intCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pMcParticle)) {
670 pTrack->SetForIntegratedFlow(kTRUE); }
671 if (diffCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pMcParticle)) {
672 pTrack->SetForDifferentialFlow(kTRUE);}
673 }
674 else { cout<<"Not a valid option"<<endl; }
675
676 //check if any bits are set
677 TBits bFlowBits = pTrack->GetFlowBits();
e60cd248 678 if (bFlowBits.CountBits() ==0) {
679 delete pTrack; } //track will not be used anymore
680 else {
88e00a8a 681 pEvent->TrackCollection()->Add(pTrack) ;
682 iGoodTracks++;
683
684 if (pTrack->UseForIntegratedFlow())
685 { iSelParticlesInt++; }
686 if (pTrack->UseForDifferentialFlow())
687 { iSelParticlesDiff++; }
688
689 }
e60cd248 690
88e00a8a 691 itrkN++;
692 }
693
694 pEvent-> SetEventNSelTracksIntFlow(iSelParticlesInt);
695 pEvent->SetNumberOfTracks(iGoodTracks);
26c4cbb9 696 cout<<" iGoodTracks = "<<iGoodTracks<<endl;
697 //cout << " iSelectedTracksInt = " << iSelParticlesInt << endl;
7b88dba1 698 return pEvent;
26c4cbb9 699
7b88dba1 700}
88e00a8a 701
26c4cbb9 702
703
704
705
706