1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
17 #include "Riostream.h"
18 #include "AliFlowEventSimpleMaker.h"
19 #include "AliFlowEventSimple.h"
20 #include "AliFlowTrackSimple.h"
22 #include "TParticle.h"
23 #include "AliMCEvent.h"
24 #include "AliMCParticle.h"
25 #include "AliESDEvent.h"
26 #include "AliESDtrack.h"
27 #include "AliAODEvent.h"
28 #include "AliAODTrack.h"
30 // AliFlowEventSimpleMaker:
31 // Class to fill the AliFlowEventSimple
32 // with AliFlowTrackSimple objects
33 // Has fill methods for TTree, AliMCEvent, AliESDEvent and AliAODEvent
34 // author: N. van der Kolk (kolk@nikhef.nl)
38 ClassImp(AliFlowEventSimpleMaker)
39 //-----------------------------------------------------------------------
40 AliFlowEventSimpleMaker::AliFlowEventSimpleMaker():
51 //-----------------------------------------------------------------------
52 AliFlowEventSimpleMaker::~AliFlowEventSimpleMaker()
58 //-----------------------------------------------------------------------
59 AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(TTree* fInput)
61 //fills the event from a TTree of kinematic.root files
62 Bool_t fDoubleLoop = kFALSE;
64 Int_t fNumberOfInputTracks = fInput->GetEntries() ;
65 //cerr<<"fNumberOfInputTracks = "<<fNumberOfInputTracks<<endl;
66 fParticle = new TParticle();
67 fInput->SetBranchAddress("Particles",&fParticle);
68 // fEvent = new AliFlowEventSimple(fNumberOfInputTracks);
69 fEvent = new AliFlowEventSimple(10);
70 //cerr<<fEvent<<" fEvent "<<endl;
72 Int_t fN = fNumberOfInputTracks;
73 // Int_t fN = 576; //multiplicity for chi=1.5
74 // Int_t fN = 256; //multiplicity for chi=1
75 // Int_t fN = 164; //multiplicity for chi=0.8
76 Int_t fGoodTracks = 0;
78 Int_t fSelParticlesDiff = 0;
79 Int_t fSelParticlesInt = 0;
83 while (fGoodTracks < fN*2 && ftrkN < fNumberOfInputTracks)
85 fInput->GetEntry(ftrkN); //get input particle
87 if(TMath::Abs(fParticle->Eta()) < 0.9)
89 // Int_t fLoop = floor(2.*fParticle->Pt())+2;
90 // for(Int_t d=0;d<fLoop;d++)
91 for(Int_t d=0;d<2;d++)
94 TMath::Abs(fParticle->GetPdgCode()) == 211
95 // TMath::Abs(fParticle->GetPdgCode()) == 211 ||
96 // TMath::Abs(fParticle->GetPdgCode()) == 321 ||
97 // TMath::Abs(fParticle->GetPdgCode()) == 2212
100 fTrack = new AliFlowTrackSimple();
101 fTrack->SetPt(fParticle->Pt() );
102 fTrack->SetEta(fParticle->Eta() );
103 fTrack->SetPhi(fParticle->Phi() );
104 fTrack->SetForIntegratedFlow(kTRUE);
105 fTrack->SetForDifferentialFlow(kTRUE);
107 if (fTrack->UseForIntegratedFlow())
108 { fSelParticlesInt++; }
109 if (fTrack->UseForDifferentialFlow())
110 { fSelParticlesDiff++; }
112 fEvent->TrackCollection()->Add(fTrack);
116 TMath::Abs(fParticle->GetPdgCode()) == 2212
119 fTrack = new AliFlowTrackSimple();
120 fTrack->SetPt(fParticle->Pt() );
121 fTrack->SetEta(fParticle->Eta() );
122 fTrack->SetPhi(fParticle->Phi() );
123 fTrack->SetForIntegratedFlow(kFALSE);
124 fTrack->SetForDifferentialFlow(kTRUE);
126 if (fTrack->UseForIntegratedFlow())
127 { fSelParticlesInt++; }
128 if (fTrack->UseForDifferentialFlow())
129 { fSelParticlesDiff++; }
131 fEvent->TrackCollection()->Add(fTrack);
141 while (fGoodTracks < fN && ftrkN < fNumberOfInputTracks) {
142 fInput->GetEntry(ftrkN); //get input particle
144 if (TMath::Abs(fParticle->Eta()) < 0.2)
147 TMath::Abs(fParticle->GetPdgCode()) == 211
148 // TMath::Abs(fParticle->GetPdgCode()) == 211 ||
149 // TMath::Abs(fParticle->GetPdgCode()) == 321 ||
150 // TMath::Abs(fParticle->GetPdgCode()) == 2212
153 fTrack = new AliFlowTrackSimple() ;
154 fTrack->SetPt(fParticle->Pt() );
155 fTrack->SetEta(fParticle->Eta() );
156 fTrack->SetPhi(fParticle->Phi() );
157 fTrack->SetForIntegratedFlow(kTRUE);
158 fTrack->SetForDifferentialFlow(kTRUE);
160 if (fTrack->UseForIntegratedFlow())
161 { fSelParticlesInt++; }
162 if (fTrack->UseForDifferentialFlow())
163 { fSelParticlesDiff++; }
165 fEvent->TrackCollection()->Add(fTrack) ;
168 TMath::Abs(fParticle->GetPdgCode()) == 211
171 fTrack = new AliFlowTrackSimple();
172 fTrack->SetPt(fParticle->Pt() );
173 fTrack->SetEta(fParticle->Eta() );
174 fTrack->SetPhi(fParticle->Phi() );
175 fTrack->SetForIntegratedFlow(kFALSE);
176 fTrack->SetForDifferentialFlow(kTRUE);
178 if (fTrack->UseForIntegratedFlow())
179 { fSelParticlesInt++; }
180 if (fTrack->UseForDifferentialFlow())
181 { fSelParticlesDiff++; }
183 fEvent->TrackCollection()->Add(fTrack);
192 fEvent-> SetEventNSelTracksIntFlow(fSelParticlesInt);
193 fEvent->SetNumberOfTracks(fGoodTracks);
194 cout<<" fGoodTracks = "<<fGoodTracks<<endl;
195 cout << " fSelectedTracksInt = " << fSelParticlesInt << endl;
200 //-----------------------------------------------------------------------
201 AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliMCEvent* fInput)
203 //Fills the event from the MC kinematic information
205 Int_t fNumberOfInputTracks = fInput->GetNumberOfTracks() ;
206 cerr<<"fInput->GetNumberOfTracks() = "<<fNumberOfInputTracks<<endl;
208 fEvent = new AliFlowEventSimple(10);
210 //Int_t fN = 256; //multiplicity for chi=1
211 Int_t fN = fNumberOfInputTracks;
212 Int_t fGoodTracks = 0;
214 Int_t fSelParticlesDiff = 0;
215 Int_t fSelParticlesInt = 0;
219 while (fGoodTracks < fN && ftrkN < fNumberOfInputTracks) {
220 AliMCParticle* fParticle = fInput->GetTrack(ftrkN); //get input particle
222 if (TMath::Abs(fParticle->Eta()) < 0.2)
225 TMath::Abs(fParticle->Particle()->GetPdgCode()) == 211
226 // TMath::Abs(fParticle->Particle()->GetPdgCode()) == 211 ||
227 // TMath::Abs(fParticle->Particle()->GetPdgCode()) == 321 ||
228 // TMath::Abs(fParticle->Particle()->GetPdgCode()) == 2212
231 fTrack = new AliFlowTrackSimple() ;
232 fTrack->SetPt(fParticle->Pt() );
233 fTrack->SetEta(fParticle->Eta() );
234 fTrack->SetPhi(fParticle->Phi() );
235 fTrack->SetForIntegratedFlow(kTRUE);
236 fTrack->SetForDifferentialFlow(kTRUE);
238 if (fTrack->UseForIntegratedFlow())
239 { fSelParticlesInt++; }
240 if (fTrack->UseForDifferentialFlow())
241 { fSelParticlesDiff++; }
243 fEvent->TrackCollection()->Add(fTrack) ;
246 TMath::Abs(fParticle->Particle()->GetPdgCode()) == 211
249 fTrack = new AliFlowTrackSimple();
250 fTrack->SetPt(fParticle->Pt() );
251 fTrack->SetEta(fParticle->Eta() );
252 fTrack->SetPhi(fParticle->Phi() );
253 fTrack->SetForIntegratedFlow(kFALSE);
254 fTrack->SetForDifferentialFlow(kTRUE);
256 if (fTrack->UseForIntegratedFlow())
257 { fSelParticlesInt++; }
258 if (fTrack->UseForDifferentialFlow())
259 { fSelParticlesDiff++; }
261 fEvent->TrackCollection()->Add(fTrack);
269 fEvent-> SetEventNSelTracksIntFlow(fSelParticlesInt);
270 fEvent->SetNumberOfTracks(fGoodTracks);
271 cout<<" fGoodTracks = "<<fGoodTracks<<endl;
272 cout << " fSelectedTracksInt = " << fSelParticlesInt << endl;
279 //-----------------------------------------------------------------------
280 AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliESDEvent* fInput)
282 //Fills the event from the ESD
284 Int_t fNumberOfInputTracks = fInput->GetNumberOfTracks() ;
285 cerr<<"fInput->GetNumberOfTracks() = "<<fNumberOfInputTracks<<endl;
287 fEvent = new AliFlowEventSimple(10);
289 //Int_t fN = 256; //multiplicity for chi=1
290 Int_t fN = fNumberOfInputTracks;
291 Int_t fGoodTracks = 0;
293 Int_t fSelParticlesDiff = 0;
294 Int_t fSelParticlesInt = 0;
298 while (fGoodTracks < fN && ftrkN < fNumberOfInputTracks) {
299 AliESDtrack* fParticle = fInput->GetTrack(ftrkN); //get input particle
301 if (TMath::Abs(fParticle->Eta()) < 0.2)
303 fTrack = new AliFlowTrackSimple() ;
304 fTrack->SetPt(fParticle->Pt() );
305 fTrack->SetEta(fParticle->Eta() );
306 fTrack->SetPhi(fParticle->Phi() );
307 fTrack->SetForIntegratedFlow(kTRUE);
308 fTrack->SetForDifferentialFlow(kTRUE);
310 if (fTrack->UseForIntegratedFlow())
311 { fSelParticlesInt++; }
312 if (fTrack->UseForDifferentialFlow())
313 { fSelParticlesDiff++; }
315 fEvent->TrackCollection()->Add(fTrack) ;
321 fEvent-> SetEventNSelTracksIntFlow(fSelParticlesInt);
322 fEvent->SetNumberOfTracks(fGoodTracks);
323 cout<<" fGoodTracks = "<<fGoodTracks<<endl;
324 cout << " fSelectedTracksInt = " << fSelParticlesInt << endl;
332 //-----------------------------------------------------------------------
333 AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliAODEvent* fInput)
335 //Fills the event from the AOD
337 Int_t fNumberOfInputTracks = fInput->GetNumberOfTracks() ;
338 cerr<<"fInput->GetNumberOfTracks() = "<<fNumberOfInputTracks<<endl;
340 fEvent = new AliFlowEventSimple(10);
342 //Int_t fN = 256; //multiplicity for chi=1
343 Int_t fN = fNumberOfInputTracks;
344 Int_t fGoodTracks = 0;
346 Int_t fSelParticlesDiff = 0;
347 Int_t fSelParticlesInt = 0;
351 while (fGoodTracks < fN && ftrkN < fNumberOfInputTracks) {
352 AliAODTrack* fParticle = fInput->GetTrack(ftrkN); //get input particle
354 if (TMath::Abs(fParticle->Eta()) < 0.2)
356 fTrack = new AliFlowTrackSimple() ;
357 fTrack->SetPt(fParticle->Pt() );
358 fTrack->SetEta(fParticle->Eta() );
359 fTrack->SetPhi(fParticle->Phi() );
360 fTrack->SetForIntegratedFlow(kTRUE);
361 fTrack->SetForDifferentialFlow(kTRUE);
363 if (fTrack->UseForIntegratedFlow())
364 { fSelParticlesInt++; }
365 if (fTrack->UseForDifferentialFlow())
366 { fSelParticlesDiff++; }
368 fEvent->TrackCollection()->Add(fTrack) ;
374 fEvent-> SetEventNSelTracksIntFlow(fSelParticlesInt);
375 fEvent->SetNumberOfTracks(fGoodTracks);
376 cout<<" fGoodTracks = "<<fGoodTracks<<endl;
377 cout << " fSelectedTracksInt = " << fSelParticlesInt << endl;
381 //-----------------------------------------------------------------------
382 AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliESDEvent* fInput, AliMCEvent* fInputMc, Int_t fOption)
384 //fills the event with tracks from the ESD and kinematics from the MC info via the track label
386 if (!(fOption ==0 || fOption ==1)) {
387 cout<<"WRONG OPTION IN AliFlowEventSimpleMaker::FillTracks(AliESDEvent* fInput, AliMCEvent* fInputMc, Int_t fOption)"<<endl;
391 Int_t fNumberOfInputTracks = fInput->GetNumberOfTracks() ;
392 cerr<<"fInput->GetNumberOfTracks() = "<<fNumberOfInputTracks<<endl;
394 fEvent = new AliFlowEventSimple(10);
396 //Int_t fN = 256; //multiplicity for chi=1
397 Int_t fN = fNumberOfInputTracks;
398 Int_t fGoodTracks = 0;
400 Int_t fSelParticlesDiff = 0;
401 Int_t fSelParticlesInt = 0;
404 while (fGoodTracks < fN && ftrkN < fNumberOfInputTracks) {
405 AliESDtrack* fParticle = fInput->GetTrack(ftrkN); //get input particle
407 Int_t fLabel = fParticle->GetLabel();
408 //match to mc particle
409 AliMCParticle* fMcParticle = fInputMc->GetTrack(TMath::Abs(fLabel));
412 if (TMath::Abs(fParticle->GetLabel())!=fMcParticle->Label()) cout<<"fParticle->GetLabel()!=fMcParticle->Label() "<<fParticle->GetLabel()<<" "<<fMcParticle->Label()<<endl;
415 if (TMath::Abs(fParticle->Eta()) < 0.2)
418 TMath::Abs(fMcParticle->Particle()->GetPdgCode()) == 211 //pions
419 // TMath::Abs(fMcParticle->Particle()->GetPdgCode()) == 211 ||
420 // TMath::Abs(fMcParticle->Particle()->GetPdgCode()) == 321 ||
421 // TMath::Abs(fMcParticle->Particle()->GetPdgCode()) == 2212
424 if(fOption == 0) { //take the PID from the MC & the kinematics from the ESD
425 fTrack = new AliFlowTrackSimple() ;
426 fTrack->SetPt(fParticle->Pt() );
427 fTrack->SetEta(fParticle->Eta() );
428 fTrack->SetPhi(fParticle->Phi() );
429 fTrack->SetForIntegratedFlow(kTRUE);
430 fTrack->SetForDifferentialFlow(kTRUE);
432 else if (fOption == 1) { //take the PID and kinematics from the MC
433 fTrack = new AliFlowTrackSimple() ;
434 fTrack->SetPt(fMcParticle->Pt() );
435 fTrack->SetEta(fMcParticle->Eta() );
436 fTrack->SetPhi(fMcParticle->Phi() );
437 fTrack->SetForIntegratedFlow(kTRUE);
438 fTrack->SetForDifferentialFlow(kTRUE);
440 else { cout<<"Not a valid option"<<endl; }
441 if (fTrack->UseForIntegratedFlow())
442 { fSelParticlesInt++; }
443 if (fTrack->UseForDifferentialFlow())
444 { fSelParticlesDiff++; }
446 fEvent->TrackCollection()->Add(fTrack) ;
452 fEvent-> SetEventNSelTracksIntFlow(fSelParticlesInt);
453 fEvent->SetNumberOfTracks(fGoodTracks);
454 cout<<" fGoodTracks = "<<fGoodTracks<<endl;
455 cout << " fSelectedTracksInt = " << fSelParticlesInt << endl;