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