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