]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG2/FLOW/AliFlowEventSimpleMaker.cxx
Moved old reacton plane code to /oldcode
[u/mrichter/AliRoot.git] / PWG2 / FLOW / AliFlowEventSimpleMaker.cxx
CommitLineData
f1d945a1 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15/* $Id */
16
17#include "Riostream.h"
18#include "AliFlowEventSimpleMaker.h"
19#include "AliFlowEventSimple.h"
20#include "AliFlowTrackSimple.h"
21#include "TTree.h"
22#include "TParticle.h"
23#include "AliMCEvent.h"
24#include "AliMCParticle.h"
25#include "AliESDEvent.h"
26#include "AliESDtrack.h"
27#include "AliAODEvent.h"
28#include "AliAODTrack.h"
29
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)
35
36
37
38ClassImp(AliFlowEventSimpleMaker)
39//-----------------------------------------------------------------------
40AliFlowEventSimpleMaker::AliFlowEventSimpleMaker():
41 fEvent(0),
42 fTrack(0),
43 fParticle(0)
44{
45
46 //constructor
47
48}
49
50
51//-----------------------------------------------------------------------
52AliFlowEventSimpleMaker::~AliFlowEventSimpleMaker()
53{
54 //desstructor
55}
56
57
58//-----------------------------------------------------------------------
59AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(TTree* fInput)
60{
61 //fills the event from a TTree of kinematic.root files
62 Bool_t fDoubleLoop = kFALSE;
63
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;
71
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;
77 Int_t ftrkN = 0;
78 Int_t fSelParticlesDiff = 0;
79 Int_t fSelParticlesInt = 0;
80
81 if (fDoubleLoop)
82 { //double loop
83 while (fGoodTracks < fN*2 && ftrkN < fNumberOfInputTracks)
84 {
85 fInput->GetEntry(ftrkN); //get input particle
86 //cut on tracks
87 if(TMath::Abs(fParticle->Eta()) < 0.9)
88 {
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++)
92 {
93 if(
94 TMath::Abs(fParticle->GetPdgCode()) == 211
95 // TMath::Abs(fParticle->GetPdgCode()) == 211 ||
96 // TMath::Abs(fParticle->GetPdgCode()) == 321 ||
97 // TMath::Abs(fParticle->GetPdgCode()) == 2212
98 )
99 {
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);
106
107 if (fTrack->UseForIntegratedFlow())
108 { fSelParticlesInt++; }
109 if (fTrack->UseForDifferentialFlow())
110 { fSelParticlesDiff++; }
111 fGoodTracks++;
112 fEvent->TrackCollection()->Add(fTrack);
113 }
114 /*
115 else if(
116 TMath::Abs(fParticle->GetPdgCode()) == 2212
117 )
118 {
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);
125
126 if (fTrack->UseForIntegratedFlow())
127 { fSelParticlesInt++; }
128 if (fTrack->UseForDifferentialFlow())
129 { fSelParticlesDiff++; }
130 fGoodTracks++;
131 fEvent->TrackCollection()->Add(fTrack);
132 }
133 */
134 }
135 }
136 ftrkN++;
137 }
138 }
139
140 else { //normal loop
141 while (fGoodTracks < fN && ftrkN < fNumberOfInputTracks) {
142 fInput->GetEntry(ftrkN); //get input particle
143 //cut on tracks
144 if (TMath::Abs(fParticle->Eta()) < 0.2)
145 {
146 if(
147 TMath::Abs(fParticle->GetPdgCode()) == 211
148 // TMath::Abs(fParticle->GetPdgCode()) == 211 ||
149 // TMath::Abs(fParticle->GetPdgCode()) == 321 ||
150 // TMath::Abs(fParticle->GetPdgCode()) == 2212
151 )
152 {
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);
159
160 if (fTrack->UseForIntegratedFlow())
161 { fSelParticlesInt++; }
162 if (fTrack->UseForDifferentialFlow())
163 { fSelParticlesDiff++; }
164 fGoodTracks++;
165 fEvent->TrackCollection()->Add(fTrack) ;
166 }
167 /* else if(
168 TMath::Abs(fParticle->GetPdgCode()) == 211
169 )
170 {
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);
177
178 if (fTrack->UseForIntegratedFlow())
179 { fSelParticlesInt++; }
180 if (fTrack->UseForDifferentialFlow())
181 { fSelParticlesDiff++; }
182 fGoodTracks++;
183 fEvent->TrackCollection()->Add(fTrack);
184 }
185 */
186 }
187
188 ftrkN++;
189 }
190 }
191
192 fEvent-> SetEventNSelTracksIntFlow(fSelParticlesInt);
193 fEvent->SetNumberOfTracks(fGoodTracks);
194 cout<<" fGoodTracks = "<<fGoodTracks<<endl;
195 cout << " fSelectedTracksInt = " << fSelParticlesInt << endl;
196 return fEvent;
197
198}
199
200//-----------------------------------------------------------------------
201AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliMCEvent* fInput)
202{
203 //Fills the event from the MC kinematic information
204 Bool_t fDoubleLoop = kFALSE;
205
206 Int_t fNumberOfInputTracks = fInput->GetNumberOfTracks() ;
207 cerr<<"fInput->GetNumberOfTracks() = "<<fNumberOfInputTracks<<endl;
208
209 fEvent = new AliFlowEventSimple(10);
210
211 //Int_t fN = 256; //multiplicity for chi=1
212 Int_t fN = fNumberOfInputTracks;
213 Int_t fGoodTracks = 0;
214 Int_t ftrkN = 0;
215 Int_t fSelParticlesDiff = 0;
216 Int_t fSelParticlesInt = 0;
217
218
219 if (fDoubleLoop)
220 { //double loop
221 while (fGoodTracks < fN*2 && ftrkN < fNumberOfInputTracks)
222 {
223 AliMCParticle* fParticle = fInput->GetTrack(ftrkN); //get input particle
224 //cut on tracks
225 if(TMath::Abs(fParticle->Eta()) < 0.9)
226 {
227 // Int_t fLoop = floor(2.*fParticle->Pt())+2;
228 // for(Int_t d=0;d<fLoop;d++)
229 for(Int_t d=0;d<2;d++)
230 {
231 if(
232 TMath::Abs(fParticle->Particle()->GetPdgCode()) == 211
233 // TMath::Abs(fParticle->Particle()->GetPdgCode()) == 211 ||
234 // TMath::Abs(fParticle->Particle()->GetPdgCode()) == 321 ||
235 // TMath::Abs(fParticle->Particle()->GetPdgCode()) == 2212
236 )
237 {
238 fTrack = new AliFlowTrackSimple();
239 fTrack->SetPt(fParticle->Pt() );
240 fTrack->SetEta(fParticle->Eta() );
241 fTrack->SetPhi(fParticle->Phi() );
242 fTrack->SetForIntegratedFlow(kTRUE);
243 fTrack->SetForDifferentialFlow(kTRUE);
244
245 if (fTrack->UseForIntegratedFlow())
246 { fSelParticlesInt++; }
247 if (fTrack->UseForDifferentialFlow())
248 { fSelParticlesDiff++; }
249 fGoodTracks++;
250 fEvent->TrackCollection()->Add(fTrack);
251 }
252 /*
253 else if(
254 TMath::Abs(fParticle->Particle()->GetPdgCode()) == 2212
255 )
256 {
257 fTrack = new AliFlowTrackSimple();
258 fTrack->SetPt(fParticle->Pt() );
259 fTrack->SetEta(fParticle->Eta() );
260 fTrack->SetPhi(fParticle->Phi() );
261 fTrack->SetForIntegratedFlow(kFALSE);
262 fTrack->SetForDifferentialFlow(kTRUE);
263
264 if (fTrack->UseForIntegratedFlow())
265 { fSelParticlesInt++; }
266 if (fTrack->UseForDifferentialFlow())
267 { fSelParticlesDiff++; }
268 fGoodTracks++;
269 fEvent->TrackCollection()->Add(fTrack);
270 }
271 */
272 }
273 }
274 ftrkN++;
275 }
276 }
277 else { //normal loop
278 while (fGoodTracks < fN && ftrkN < fNumberOfInputTracks) {
279 AliMCParticle* fParticle = fInput->GetTrack(ftrkN); //get input particle
280 //cut on tracks
281 if (TMath::Abs(fParticle->Eta()) < 0.2)
282 {
283 if(
284 TMath::Abs(fParticle->Particle()->GetPdgCode()) == 211
285 // TMath::Abs(fParticle->Particle()->GetPdgCode()) == 211 ||
286 // TMath::Abs(fParticle->Particle()->GetPdgCode()) == 321 ||
287 // TMath::Abs(fParticle->Particle()->GetPdgCode()) == 2212
288 )
289 {
290 fTrack = new AliFlowTrackSimple() ;
291 fTrack->SetPt(fParticle->Pt() );
292 fTrack->SetEta(fParticle->Eta() );
293 fTrack->SetPhi(fParticle->Phi() );
294 fTrack->SetForIntegratedFlow(kTRUE);
295 fTrack->SetForDifferentialFlow(kTRUE);
296
297 if (fTrack->UseForIntegratedFlow())
298 { fSelParticlesInt++; }
299 if (fTrack->UseForDifferentialFlow())
300 { fSelParticlesDiff++; }
301 fGoodTracks++;
302 fEvent->TrackCollection()->Add(fTrack) ;
303 }
304 /* else if(
305 TMath::Abs(fParticle->Particle()->GetPdgCode()) == 211
306 )
307 {
308 fTrack = new AliFlowTrackSimple();
309 fTrack->SetPt(fParticle->Pt() );
310 fTrack->SetEta(fParticle->Eta() );
311 fTrack->SetPhi(fParticle->Phi() );
312 fTrack->SetForIntegratedFlow(kFALSE);
313 fTrack->SetForDifferentialFlow(kTRUE);
314
315 if (fTrack->UseForIntegratedFlow())
316 { fSelParticlesInt++; }
317 if (fTrack->UseForDifferentialFlow())
318 { fSelParticlesDiff++; }
319 fGoodTracks++;
320 fEvent->TrackCollection()->Add(fTrack);
321 }
322 */
323 }
324
325 ftrkN++;
326 }
327 }
328
329
330 fEvent-> SetEventNSelTracksIntFlow(fSelParticlesInt);
331 fEvent->SetNumberOfTracks(fGoodTracks);
332 cout<<" fGoodTracks = "<<fGoodTracks<<endl;
333 cout << " fSelectedTracksInt = " << fSelParticlesInt << endl;
334 return fEvent;
335
336
337}
338
339
340//-----------------------------------------------------------------------
341AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliESDEvent* fInput)
342{
343 //Fills the event from the ESD
344 Bool_t fDoubleLoop = kFALSE;
345
346 Int_t fNumberOfInputTracks = fInput->GetNumberOfTracks() ;
347 cerr<<"fInput->GetNumberOfTracks() = "<<fNumberOfInputTracks<<endl;
348
349 fEvent = new AliFlowEventSimple(10);
350
351 //Int_t fN = 256; //multiplicity for chi=1
352 Int_t fN = fNumberOfInputTracks;
353 Int_t fGoodTracks = 0;
354 Int_t ftrkN = 0;
355 Int_t fSelParticlesDiff = 0;
356 Int_t fSelParticlesInt = 0;
357
358
359 if (fDoubleLoop)
360 { //double loop
361 while (fGoodTracks < fN*2 && ftrkN < fNumberOfInputTracks)
362 {
363 AliESDtrack* fParticle = fInput->GetTrack(ftrkN); //get input particle
364 //cut on tracks
365 if(TMath::Abs(fParticle->Eta()) < 0.9)
366 {
367 // Int_t fLoop = floor(2.*fParticle->Pt())+2;
368 // for(Int_t d=0;d<fLoop;d++)
369 for(Int_t d=0;d<2;d++)
370 {
371 fTrack = new AliFlowTrackSimple();
372 fTrack->SetPt(fParticle->Pt() );
373 fTrack->SetEta(fParticle->Eta() );
374 fTrack->SetPhi(fParticle->Phi() );
375 fTrack->SetForIntegratedFlow(kTRUE);
376 fTrack->SetForDifferentialFlow(kTRUE);
377
378 if (fTrack->UseForIntegratedFlow())
379 { fSelParticlesInt++; }
380 if (fTrack->UseForDifferentialFlow())
381 { fSelParticlesDiff++; }
382 fGoodTracks++;
383 fEvent->TrackCollection()->Add(fTrack);
384 }
385 }
386 ftrkN++;
387 }
388 }
389 else { //normal loop
390 while (fGoodTracks < fN && ftrkN < fNumberOfInputTracks) {
391 AliESDtrack* fParticle = fInput->GetTrack(ftrkN); //get input particle
392 //cut on tracks
393 if (TMath::Abs(fParticle->Eta()) < 0.2)
394 {
395 fTrack = new AliFlowTrackSimple() ;
396 fTrack->SetPt(fParticle->Pt() );
397 fTrack->SetEta(fParticle->Eta() );
398 fTrack->SetPhi(fParticle->Phi() );
399 fTrack->SetForIntegratedFlow(kTRUE);
400 fTrack->SetForDifferentialFlow(kTRUE);
401
402 if (fTrack->UseForIntegratedFlow())
403 { fSelParticlesInt++; }
404 if (fTrack->UseForDifferentialFlow())
405 { fSelParticlesDiff++; }
406 fGoodTracks++;
407 fEvent->TrackCollection()->Add(fTrack) ;
408 }
409
410 ftrkN++;
411 }
412 }
413
414
415 fEvent-> SetEventNSelTracksIntFlow(fSelParticlesInt);
416 fEvent->SetNumberOfTracks(fGoodTracks);
417 cout<<" fGoodTracks = "<<fGoodTracks<<endl;
418 cout << " fSelectedTracksInt = " << fSelParticlesInt << endl;
419 return fEvent;
420
421
422}
423
424
425
426//-----------------------------------------------------------------------
427AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliAODEvent* fInput)
428{
429 //Fills the event from the AOD
430 Bool_t fDoubleLoop = kFALSE;
431
432 Int_t fNumberOfInputTracks = fInput->GetNumberOfTracks() ;
433 cerr<<"fInput->GetNumberOfTracks() = "<<fNumberOfInputTracks<<endl;
434
435 fEvent = new AliFlowEventSimple(10);
436
437 //Int_t fN = 256; //multiplicity for chi=1
438 Int_t fN = fNumberOfInputTracks;
439 Int_t fGoodTracks = 0;
440 Int_t ftrkN = 0;
441 Int_t fSelParticlesDiff = 0;
442 Int_t fSelParticlesInt = 0;
443
444
445 if (fDoubleLoop)
446 { //double loop
447 while (fGoodTracks < fN*2 && ftrkN < fNumberOfInputTracks)
448 {
449 AliAODTrack* fParticle = fInput->GetTrack(ftrkN); //get input particle
450 //cut on tracks
451 if(TMath::Abs(fParticle->Eta()) < 0.9)
452 {
453 // Int_t fLoop = floor(2.*fParticle->Pt())+2;
454 // for(Int_t d=0;d<fLoop;d++)
455 for(Int_t d=0;d<2;d++)
456 {
457 fTrack = new AliFlowTrackSimple();
458 fTrack->SetPt(fParticle->Pt() );
459 fTrack->SetEta(fParticle->Eta() );
460 fTrack->SetPhi(fParticle->Phi() );
461 fTrack->SetForIntegratedFlow(kTRUE);
462 fTrack->SetForDifferentialFlow(kTRUE);
463
464 if (fTrack->UseForIntegratedFlow())
465 { fSelParticlesInt++; }
466 if (fTrack->UseForDifferentialFlow())
467 { fSelParticlesDiff++; }
468 fGoodTracks++;
469 fEvent->TrackCollection()->Add(fTrack);
470 }
471 }
472 ftrkN++;
473 }
474 }
475 else { //normal loop
476 while (fGoodTracks < fN && ftrkN < fNumberOfInputTracks) {
477 AliAODTrack* fParticle = fInput->GetTrack(ftrkN); //get input particle
478 //cut on tracks
479 if (TMath::Abs(fParticle->Eta()) < 0.2)
480 {
481 fTrack = new AliFlowTrackSimple() ;
482 fTrack->SetPt(fParticle->Pt() );
483 fTrack->SetEta(fParticle->Eta() );
484 fTrack->SetPhi(fParticle->Phi() );
485 fTrack->SetForIntegratedFlow(kTRUE);
486 fTrack->SetForDifferentialFlow(kTRUE);
487
488 if (fTrack->UseForIntegratedFlow())
489 { fSelParticlesInt++; }
490 if (fTrack->UseForDifferentialFlow())
491 { fSelParticlesDiff++; }
492 fGoodTracks++;
493 fEvent->TrackCollection()->Add(fTrack) ;
494 }
495
496 ftrkN++;
497 }
498 }
499
500
501 fEvent-> SetEventNSelTracksIntFlow(fSelParticlesInt);
502 fEvent->SetNumberOfTracks(fGoodTracks);
503 cout<<" fGoodTracks = "<<fGoodTracks<<endl;
504 cout << " fSelectedTracksInt = " << fSelParticlesInt << endl;
505 return fEvent;
506
507
508}
509
510/*
511$Log$
512*/
513