]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG2/FLOW/AliFlowEventSimpleMaker.cxx
First implementation of phi, pt and eta weights for the Q vector
[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//-----------------------------------------------------------------------
26c4cbb9 41AliFlowEventSimpleMaker::AliFlowEventSimpleMaker():
42 fUseWeightsPhi(kFALSE),
43 fUseWeightsPt(kFALSE),
44 fUseWeightsEta(kFALSE),
45 fPhiWeights(NULL),
46 fPtWeights(NULL),
47 fEtaWeights(NULL)
f1d945a1 48{
f1d945a1 49 //constructor
f1d945a1 50}
51
f1d945a1 52//-----------------------------------------------------------------------
53AliFlowEventSimpleMaker::~AliFlowEventSimpleMaker()
54{
e35ddff0 55 //destructor
f1d945a1 56}
57
26c4cbb9 58//-----------------------------------------------------------------------
59void AliFlowEventSimpleMaker::Init(TFile *file)
60{
61 //initialize weights' histograms
62 if(file)
63 {
64 if(fUseWeightsPhi)
65 {
66 file->GetObject("phi_weights",fPhiWeights);
67 }
68 if(fUseWeightsPt)
69 {
70 file->GetObject("pt_weights",fPtWeights);
71 }
72 if(fUseWeightsEta)
73 {
74 file->GetObject("eta_weights",fEtaWeights);
75 }
76 }//end of if(file)
77}
78
f1d945a1 79//-----------------------------------------------------------------------
b00ca27f 80AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(TTree* anInput, AliFlowTrackSimpleCuts* intCuts, AliFlowTrackSimpleCuts* diffCuts)
f1d945a1 81{
82 //fills the event from a TTree of kinematic.root files
7f0d823b 83
84 // number of times to use the same particle (trick to introduce nonflow)
85 Int_t iLoops = 1;
86
87 //flags for particles passing int. and diff. flow cuts
88 Bool_t bPassedIntFlowCuts = kFALSE;
89 Bool_t bPassedDiffFlowCuts = kFALSE;
90
b00ca27f 91 //track cut values
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();
7f0d823b 99
b00ca27f 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();
7f0d823b 107
e35ddff0 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;
f1d945a1 115
26c4cbb9 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);
123
062e56d1 124 Int_t iN = iNumberOfInputTracks; // additional variable to artificially fix the number of tracks
e35ddff0 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
7f0d823b 128
e35ddff0 129 Int_t iGoodTracks = 0;
130 Int_t itrkN = 0;
131 Int_t iSelParticlesDiff = 0;
132 Int_t iSelParticlesInt = 0;
f1d945a1 133
7f0d823b 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;
142 }
143
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;
f1d945a1 149 }
7f0d823b 150
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());
157
158 //marking the particles used for int. flow:
159 if(bPassedIntFlowCuts && iSelParticlesInt < iN*iLoops) {
160 pTrack->SetForIntegratedFlow(kTRUE);
161 iSelParticlesInt++;
162 }
163 //marking the particles used for diff. flow:
164 if(bPassedDiffFlowCuts) {
165 pTrack->SetForDifferentialFlow(kTRUE);
166 iSelParticlesDiff++;
167 }
168 //adding a particles which were used either for int. or diff. flow to the list
169 pEvent->TrackCollection()->Add(pTrack);
170 iGoodTracks++;
171 }//end of for(Int_t d=0;d<iLoops;d++)
172 }//end of if(bPassedIntFlowCuts || bPassedDiffFlowCuts)
173 itrkN++;
174 bPassedIntFlowCuts = kFALSE;
175 bPassedDiffFlowCuts = kFALSE;
176 }//end of while (itrkN < iNumberOfInputTracks)
062e56d1 177
7f0d823b 178 pEvent->SetEventNSelTracksIntFlow(iSelParticlesInt);
179 pEvent->SetNumberOfTracks(iGoodTracks);//tracks used either for int. or for diff. flow
180
e35ddff0 181 cout<<" iGoodTracks = "<<iGoodTracks<<endl;
7f0d823b 182 cout<<" # of selected tracks for int. flow = "<<iSelParticlesInt<<endl;
183 cout<<" # of selected tracks for diff. flow = "<<iSelParticlesDiff<<endl;
184
185 delete pParticle;
e35ddff0 186 return pEvent;
f1d945a1 187}
188
189//-----------------------------------------------------------------------
e35ddff0 190AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliMCEvent* anInput)
f1d945a1 191{
192 //Fills the event from the MC kinematic information
0b7f49e9 193
e35ddff0 194 Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
26c4cbb9 195 cerr<<"anInput->GetNumberOfTracks() = "<<iNumberOfInputTracks<<endl;
f1d945a1 196
e35ddff0 197 AliFlowEventSimple* pEvent = new AliFlowEventSimple(10);
f1d945a1 198
e35ddff0 199 //Int_t iN = 256; //multiplicity for chi=1
200 Int_t iN = iNumberOfInputTracks;
201 Int_t iGoodTracks = 0;
202 Int_t itrkN = 0;
203 Int_t iSelParticlesDiff = 0;
204 Int_t iSelParticlesInt = 0;
f1d945a1 205
0b7f49e9 206 //normal loop
e35ddff0 207 while (iGoodTracks < iN && itrkN < iNumberOfInputTracks) {
208 AliMCParticle* pParticle = anInput->GetTrack(itrkN); //get input particle
0b7f49e9 209 //cut on tracks
88e00a8a 210 if (TMath::Abs(pParticle->Eta()) < 0.9)
0b7f49e9 211 {
212 if(
e35ddff0 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
0b7f49e9 217 )
218 {
e35ddff0 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);
225
226 if (pTrack->UseForIntegratedFlow())
227 { iSelParticlesInt++; }
228 if (pTrack->UseForDifferentialFlow())
229 { iSelParticlesDiff++; }
230 iGoodTracks++;
231 pEvent->TrackCollection()->Add(pTrack) ;
0b7f49e9 232 }
88e00a8a 233 /* else if(
e35ddff0 234 TMath::Abs(pParticle->Particle()->GetPdgCode()) == 211
f1d945a1 235 )
236 {
e35ddff0 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);
243
244 if (pTrack->UseForIntegratedFlow())
245 { iSelParticlesInt++; }
246 if (pTrack->UseForDifferentialFlow())
247 { iSelParticlesDiff++; }
248 iGoodTracks++;
249 pEvent->TrackCollection()->Add(pTrack);
f1d945a1 250 }
251 */
0b7f49e9 252 }
f1d945a1 253
e35ddff0 254 itrkN++;
f1d945a1 255 }
0b7f49e9 256
e35ddff0 257 pEvent-> SetEventNSelTracksIntFlow(iSelParticlesInt);
258 pEvent->SetNumberOfTracks(iGoodTracks);
26c4cbb9 259 cout<<" iGoodTracks = "<<iGoodTracks<<endl;
260 //cout << " iSelectedTracksInt = " << iSelParticlesInt << endl;
e35ddff0 261 return pEvent;
f1d945a1 262
263}
264
88e00a8a 265
266//-----------------------------------------------------------------------
267AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliMCEvent* anInput, AliCFManager* intCFManager, AliCFManager* diffCFManager)
268{
269 //Fills the event from the MC kinematic information
270
271 Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
26c4cbb9 272 cerr<<"anInput->GetNumberOfTracks() = "<<iNumberOfInputTracks<<endl;
1eda9b5e 273 if (iNumberOfInputTracks==-1) {
274 cout<<"Skipping Event -- No MC information available for this event"<<endl;
275 return 0;
276 }
277
88e00a8a 278 AliFlowEventSimple* pEvent = new AliFlowEventSimple(10);
279
b7e1ac01 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
88e00a8a 285
286
287 //normal loop
288 while (iGoodTracks < iN && itrkN < iNumberOfInputTracks) {
289 //get input particle
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() );
296
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;
301 }
302 if (diffCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pParticle)) {
303 pTrack->SetForDifferentialFlow(kTRUE);
304 //cout<<"differential selection. PID = "<<pParticle->Particle()->GetPdgCode()<<endl;
305 }
306
307 //check if any bits are set
308 TBits bFlowBits = pTrack->GetFlowBits();
e60cd248 309 if (bFlowBits.CountBits() ==0) {
310 delete pTrack; } //track will not be used anymore
311 else {
88e00a8a 312 pEvent->TrackCollection()->Add(pTrack) ;
313 iGoodTracks++;
314
315 if (pTrack->UseForIntegratedFlow())
316 { iSelParticlesInt++; }
317 if (pTrack->UseForDifferentialFlow())
318 { iSelParticlesDiff++; }
319 }
320
321 itrkN++;
322 }
323
324 pEvent-> SetEventNSelTracksIntFlow(iSelParticlesInt);
325 pEvent-> SetNumberOfTracks(iGoodTracks);
26c4cbb9 326 cout<<" iGoodTracks = "<<iGoodTracks<<endl;
327 //cout << " iSelectedTracksInt = " << iSelParticlesInt << endl;
88e00a8a 328 return pEvent;
329
330}
331
332
f1d945a1 333//-----------------------------------------------------------------------
e35ddff0 334AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliESDEvent* anInput)
f1d945a1 335{
336 //Fills the event from the ESD
0b7f49e9 337
e35ddff0 338 Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
26c4cbb9 339 cerr<<"anInput->GetNumberOfTracks() = "<<iNumberOfInputTracks<<endl;
f1d945a1 340
e35ddff0 341 AliFlowEventSimple* pEvent = new AliFlowEventSimple(10);
f1d945a1 342
e35ddff0 343 //Int_t iN = 256; //multiplicity for chi=1
344 Int_t iN = iNumberOfInputTracks;
345 Int_t iGoodTracks = 0;
346 Int_t itrkN = 0;
347 Int_t iSelParticlesDiff = 0;
348 Int_t iSelParticlesInt = 0;
f1d945a1 349
062e56d1 350
351
0b7f49e9 352 //normal loop
e35ddff0 353 while (iGoodTracks < iN && itrkN < iNumberOfInputTracks) {
354 AliESDtrack* pParticle = anInput->GetTrack(itrkN); //get input particle
0b7f49e9 355 //cut on tracks
88e00a8a 356 if (TMath::Abs(pParticle->Eta()) < 0.9)
062e56d1 357
358
359
360 {
e35ddff0 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);
367
368 if (pTrack->UseForIntegratedFlow())
369 { iSelParticlesInt++; }
370 if (pTrack->UseForDifferentialFlow())
371 { iSelParticlesDiff++; }
372 iGoodTracks++;
373 pEvent->TrackCollection()->Add(pTrack) ;
0b7f49e9 374 }
f1d945a1 375
e35ddff0 376 itrkN++;
f1d945a1 377 }
0b7f49e9 378
e35ddff0 379 pEvent-> SetEventNSelTracksIntFlow(iSelParticlesInt);
380 pEvent->SetNumberOfTracks(iGoodTracks);
26c4cbb9 381 cout<<" iGoodTracks = "<<iGoodTracks<<endl;
382 //cout << " iSelectedTracksInt = " << iSelParticlesInt << endl;
383 return pEvent;
0b7f49e9 384
f1d945a1 385
386}
387
388
88e00a8a 389//-----------------------------------------------------------------------
390AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliESDEvent* anInput, AliCFManager* intCFManager, AliCFManager* diffCFManager)
391{
392 //Fills the event from the ESD
393
394 Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
26c4cbb9 395 cerr<<"anInput->GetNumberOfTracks() = "<<iNumberOfInputTracks<<endl;
88e00a8a 396
397 AliFlowEventSimple* pEvent = new AliFlowEventSimple(10);
398
b7e1ac01 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
88e00a8a 404
405 //normal loop
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
414
1eda9b5e 415 if (intCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle) &&
b7e1ac01 416 intCFManager->CheckParticleCuts(AliCFManager::kPartSelCuts,pParticle)) {
88e00a8a 417 pTrack->SetForIntegratedFlow(kTRUE);
418 }
1eda9b5e 419 if (diffCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle) &&
b7e1ac01 420 diffCFManager->CheckParticleCuts(AliCFManager::kPartSelCuts,pParticle)) {
88e00a8a 421 pTrack->SetForDifferentialFlow(kTRUE);}
422
423 //check if any bits are set
424 TBits bFlowBits = pTrack->GetFlowBits();
e60cd248 425 if (bFlowBits.CountBits() ==0) {
426 delete pTrack; } //track will not be used anymore
427 else {
88e00a8a 428 pEvent->TrackCollection()->Add(pTrack) ;
429 iGoodTracks++;
430
431 if (pTrack->UseForIntegratedFlow())
432 { iSelParticlesInt++; }
433 if (pTrack->UseForDifferentialFlow())
434 { iSelParticlesDiff++; }
435
436 }
e60cd248 437
88e00a8a 438 itrkN++;
439 }
440
441 pEvent-> SetEventNSelTracksIntFlow(iSelParticlesInt);
442 pEvent->SetNumberOfTracks(iGoodTracks);
26c4cbb9 443 cout<<" iGoodTracks = "<<iGoodTracks<<endl;
444 //cout << " iSelectedTracksInt = " << iSelParticlesInt << endl;
445 return pEvent;
88e00a8a 446
447
448}
f1d945a1 449
450//-----------------------------------------------------------------------
e35ddff0 451AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliAODEvent* anInput)
f1d945a1 452{
453 //Fills the event from the AOD
0b7f49e9 454
e35ddff0 455 Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
26c4cbb9 456 cerr<<"anInput->GetNumberOfTracks() = "<<iNumberOfInputTracks<<endl;
f1d945a1 457
e35ddff0 458 AliFlowEventSimple* pEvent = new AliFlowEventSimple(10);
f1d945a1 459
e35ddff0 460 //Int_t iN = 256; //multiplicity for chi=1
461 Int_t iN = iNumberOfInputTracks;
462 Int_t iGoodTracks = 0;
463 Int_t itrkN = 0;
464 Int_t iSelParticlesDiff = 0;
465 Int_t iSelParticlesInt = 0;
f1d945a1 466
0b7f49e9 467 //normal loop
e35ddff0 468 while (iGoodTracks < iN && itrkN < iNumberOfInputTracks) {
469 AliAODTrack* pParticle = anInput->GetTrack(itrkN); //get input particle
0b7f49e9 470 //cut on tracks
88e00a8a 471 if (TMath::Abs(pParticle->Eta()) < 0.9)
0b7f49e9 472 {
e35ddff0 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);
479
480 if (pTrack->UseForIntegratedFlow())
481 { iSelParticlesInt++; }
482 if (pTrack->UseForDifferentialFlow())
483 { iSelParticlesDiff++; }
484 iGoodTracks++;
485 pEvent->TrackCollection()->Add(pTrack) ;
0b7f49e9 486 }
f1d945a1 487
e35ddff0 488 itrkN++;
0b7f49e9 489 }
490
e35ddff0 491 pEvent-> SetEventNSelTracksIntFlow(iSelParticlesInt);
492 pEvent->SetNumberOfTracks(iGoodTracks);
26c4cbb9 493 cout<<" iGoodTracks = "<<iGoodTracks<<endl;
494 //cout << " iSelectedTracksInt = " << iSelParticlesInt << endl;
e35ddff0 495 return pEvent;
26c4cbb9 496
0b7f49e9 497}
88e00a8a 498
499
500//-----------------------------------------------------------------------
501AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliAODEvent* anInput, AliCFManager* intCFManager, AliCFManager* diffCFManager)
502{
503 //Fills the event from the AOD
504
505 Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
26c4cbb9 506 cerr<<"anInput->GetNumberOfTracks() = "<<iNumberOfInputTracks<<endl;
88e00a8a 507
508 AliFlowEventSimple* pEvent = new AliFlowEventSimple(10);
88e00a8a 509
b7e1ac01 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
515
88e00a8a 516 //normal loop
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() );
524
525 //check if pParticle passes the cuts
b7e1ac01 526 if (intCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle) &&
527 intCFManager->CheckParticleCuts(AliCFManager::kPartSelCuts,pParticle)) {
88e00a8a 528 pTrack->SetForIntegratedFlow(kTRUE); }
b7e1ac01 529 if (diffCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle) &&
530 diffCFManager->CheckParticleCuts(AliCFManager::kPartSelCuts,pParticle)) {
88e00a8a 531 pTrack->SetForDifferentialFlow(kTRUE);}
532
533 //check if any bits are set
534 TBits bFlowBits = pTrack->GetFlowBits();
e60cd248 535 if (bFlowBits.CountBits() ==0) {
536 delete pTrack; } //track will not be used anymore
537 else {
88e00a8a 538 pEvent->TrackCollection()->Add(pTrack) ;
539 iGoodTracks++;
540
541 if (pTrack->UseForIntegratedFlow())
542 { iSelParticlesInt++; }
543 if (pTrack->UseForDifferentialFlow())
544 { iSelParticlesDiff++; }
545
546 }
e60cd248 547
88e00a8a 548 itrkN++;
549 }
550
551 pEvent-> SetEventNSelTracksIntFlow(iSelParticlesInt);
552 pEvent->SetNumberOfTracks(iGoodTracks);
26c4cbb9 553 cout<<" iGoodTracks = "<<iGoodTracks<<endl;
554 //cout << " iSelectedTracksInt = " << iSelParticlesInt << endl;
88e00a8a 555 return pEvent;
26c4cbb9 556
88e00a8a 557}
558
0b7f49e9 559//-----------------------------------------------------------------------
e35ddff0 560AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliESDEvent* anInput, AliMCEvent* anInputMc, Int_t anOption)
0b7f49e9 561{
562 //fills the event with tracks from the ESD and kinematics from the MC info via the track label
563
e35ddff0 564 if (!(anOption ==0 || anOption ==1)) {
565 cout<<"WRONG OPTION IN AliFlowEventSimpleMaker::FillTracks(AliESDEvent* anInput, AliMCEvent* anInputMc, Int_t anOption)"<<endl;
0b7f49e9 566 exit(1);
f1d945a1 567 }
568
e35ddff0 569 Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
26c4cbb9 570 cerr<<"anInput->GetNumberOfTracks() = "<<iNumberOfInputTracks<<endl;
0b7f49e9 571
e35ddff0 572 AliFlowEventSimple* pEvent = new AliFlowEventSimple(10);
0b7f49e9 573
e35ddff0 574 //Int_t iN = 256; //multiplicity for chi=1
575 Int_t iN = iNumberOfInputTracks;
576 Int_t iGoodTracks = 0;
577 Int_t itrkN = 0;
578 Int_t iSelParticlesDiff = 0;
579 Int_t iSelParticlesInt = 0;
f1d945a1 580
0b7f49e9 581 //normal loop
e35ddff0 582 while (iGoodTracks < iN && itrkN < iNumberOfInputTracks) {
583 AliESDtrack* pParticle = anInput->GetTrack(itrkN); //get input particle
0b7f49e9 584 //get Label
e35ddff0 585 Int_t iLabel = pParticle->GetLabel();
0b7f49e9 586 //match to mc particle
e35ddff0 587 AliMCParticle* pMcParticle = anInputMc->GetTrack(TMath::Abs(iLabel));
0b7f49e9 588
589 //check
e35ddff0 590 if (TMath::Abs(pParticle->GetLabel())!=pMcParticle->Label()) cout<<"pParticle->GetLabel()!=pMcParticle->Label() "<<pParticle->GetLabel()<<" "<<pMcParticle->Label()<<endl;
0b7f49e9 591
592 //cut on tracks
e35ddff0 593 if (TMath::Abs(pParticle->Eta()) < 0.2)
0b7f49e9 594 {
595 if(
e35ddff0 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
0b7f49e9 600 )
601 {
e35ddff0 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);
0b7f49e9 609 }
e35ddff0 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);
0b7f49e9 616 }
617 else { cout<<"Not a valid option"<<endl; }
e35ddff0 618 if (pTrack->UseForIntegratedFlow())
619 { iSelParticlesInt++; }
620 if (pTrack->UseForDifferentialFlow())
621 { iSelParticlesDiff++; }
622 iGoodTracks++;
623 pEvent->TrackCollection()->Add(pTrack) ;
0b7f49e9 624 }
625 }
e35ddff0 626 itrkN++;
0b7f49e9 627 }
628
e35ddff0 629 pEvent-> SetEventNSelTracksIntFlow(iSelParticlesInt);
630 pEvent->SetNumberOfTracks(iGoodTracks);
26c4cbb9 631 cout<<" iGoodTracks = "<<iGoodTracks<<endl;
632 //cout << " iSelectedTracksInt = " << iSelParticlesInt << endl;
e35ddff0 633 return pEvent;
f1d945a1 634
0b7f49e9 635
f1d945a1 636}
637
88e00a8a 638//-----------------------------------------------------------------------
639AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliESDEvent* anInput, AliMCEvent* anInputMc, AliCFManager* intCFManager, AliCFManager* diffCFManager, Int_t anOption)
640{
641 //fills the event with tracks from the ESD and kinematics from the MC info via the track label
0b7f49e9 642
b7e1ac01 643
88e00a8a 644 if (!(anOption ==0 || anOption ==1)) {
645 cout<<"WRONG OPTION IN AliFlowEventSimpleMaker::FillTracks(AliESDEvent* anInput, AliMCEvent* anInputMc, Int_t anOption)"<<endl;
646 exit(1);
647 }
f1d945a1 648
88e00a8a 649 Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
26c4cbb9 650 cerr<<"anInput->GetNumberOfTracks() = "<<iNumberOfInputTracks<<endl;
1eda9b5e 651 Int_t iNumberOfInputTracksMC = anInputMc->GetNumberOfTracks() ;
26c4cbb9 652 cerr<<"anInputMc->GetNumberOfTracks() = "<<iNumberOfInputTracksMC<<endl;
1eda9b5e 653 if (iNumberOfInputTracksMC==-1) {
654 cout<<"Skipping Event -- No MC information available for this event"<<endl;
655 return 0;
656 }
657
88e00a8a 658 AliFlowEventSimple* pEvent = new AliFlowEventSimple(10);
659
b7e1ac01 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
88e00a8a 665
b7e1ac01 666
88e00a8a 667 //normal loop
668 while (iGoodTracks < iN && itrkN < iNumberOfInputTracks) {
669 AliESDtrack* pParticle = anInput->GetTrack(itrkN); //get input particle
670 //get Label
671 Int_t iLabel = pParticle->GetLabel();
672 //match to mc particle
673 AliMCParticle* pMcParticle = anInputMc->GetTrack(TMath::Abs(iLabel));
674
675 //check
676 if (TMath::Abs(pParticle->GetLabel())!=pMcParticle->Label()) cout<<"pParticle->GetLabel()!=pMcParticle->Label() "<<pParticle->GetLabel()<<" "<<pMcParticle->Label()<<endl;
677
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() );
684 }
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() );
689 }
690 else { cout<<"Not a valid option"<<endl; }
691
692 //check if pParticle passes the cuts
693 if(anOption == 0) {
694 //cout<<"take the PID from the MC & the kinematics from the ESD"<<endl;
695 if (intCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pMcParticle,"mcGenCuts1") &&
b7e1ac01 696 intCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle)) {
88e00a8a 697 pTrack->SetForIntegratedFlow(kTRUE); }
698 if (diffCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pMcParticle,"mcGenCuts2") &&
b7e1ac01 699 diffCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle)) {
88e00a8a 700 pTrack->SetForDifferentialFlow(kTRUE);}
701 }
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);}
708 }
709 else { cout<<"Not a valid option"<<endl; }
710
711 //check if any bits are set
712 TBits bFlowBits = pTrack->GetFlowBits();
e60cd248 713 if (bFlowBits.CountBits() ==0) {
714 delete pTrack; } //track will not be used anymore
715 else {
88e00a8a 716 pEvent->TrackCollection()->Add(pTrack) ;
717 iGoodTracks++;
718
719 if (pTrack->UseForIntegratedFlow())
720 { iSelParticlesInt++; }
721 if (pTrack->UseForDifferentialFlow())
722 { iSelParticlesDiff++; }
723
724 }
e60cd248 725
88e00a8a 726 itrkN++;
727 }
728
729 pEvent-> SetEventNSelTracksIntFlow(iSelParticlesInt);
730 pEvent->SetNumberOfTracks(iGoodTracks);
26c4cbb9 731 cout<<" iGoodTracks = "<<iGoodTracks<<endl;
732 //cout << " iSelectedTracksInt = " << iSelParticlesInt << endl;
7b88dba1 733 return pEvent;
26c4cbb9 734
7b88dba1 735}
88e00a8a 736
26c4cbb9 737
738
739
740
741