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