Added muon arms
[u/mrichter/AliRoot.git] / PWG2 / FLOW / AliFlowTasks / AliFlowTrackCuts.cxx
CommitLineData
daf66719 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
16/* $Id$ */
17
18// AliFlowTrackCuts:
19// ESD track cuts for flow framework
20//
21// origin: Mikolaj Krzewicki (mikolaj.krzewicki@cern.ch)
5559ce24 22//
23// This class gurantees consistency of cut methods, trackparameter
24// selection (global tracks, TPC only, etc..) and parameter mixing
25// in the flow framework. Transparently handles different input types:
26// ESD, MC, AOD.
27// This class works in 2 steps: first the requested track parameters are
28// constructed (to be set by SetParamType() ), then cuts are applied.
29// the constructed track can be requested AFTER checking the cuts by
30// calling GetTrack(), in this case the cut object stays in control,
31// caller does not have to delete the track.
32// Additionally caller can request an AliFlowTrack object to be constructed
33// according the parameter mixing scenario requested by SetParamMix().
34// AliFlowTrack is made using MakeFlowTrack() method, its an 'object factory'
35// so caller needs to take care of the freshly created object.
daf66719 36
37#include <limits.h>
38#include <float.h>
9a0783cc 39#include "TParticle.h"
40#include "AliStack.h"
daf66719 41#include "AliMCEvent.h"
9a0783cc 42#include "AliESDEvent.h"
daf66719 43#include "AliVParticle.h"
44#include "AliMCParticle.h"
45#include "AliESDtrack.h"
12b2b8bc 46#include "AliMultiplicity.h"
daf66719 47#include "AliAODTrack.h"
48#include "AliFlowTrack.h"
49#include "AliFlowTrackCuts.h"
50#include "AliLog.h"
51
52ClassImp(AliFlowTrackCuts)
53
54//-----------------------------------------------------------------------
55AliFlowTrackCuts::AliFlowTrackCuts():
56 AliFlowTrackSimpleCuts(),
57 fAliESDtrackCuts(new AliESDtrackCuts()),
924b02b0 58 fQA(kFALSE),
1ff4bda1 59 fCutMC(kFALSE),
daf66719 60 fCutMCprocessType(kFALSE),
61 fMCprocessType(kPNoProcess),
62 fCutMCPID(kFALSE),
63 fMCPID(0),
4cbcbead 64 fIgnoreSignInPID(kFALSE),
daf66719 65 fCutMCisPrimary(kFALSE),
66 fMCisPrimary(kFALSE),
957517fa 67 fRequireCharge(kFALSE),
127a5825 68 fFakesAreOK(kTRUE),
9a0783cc 69 fCutSPDtrackletDeltaPhi(kFALSE),
70 fSPDtrackletDeltaPhiMax(FLT_MAX),
71 fSPDtrackletDeltaPhiMin(-FLT_MAX),
1ff4bda1 72 fIgnoreTPCzRange(kFALSE),
73 fIgnoreTPCzRangeMax(FLT_MAX),
74 fIgnoreTPCzRangeMin(-FLT_MAX),
12b2b8bc 75 fParamType(kGlobal),
daf66719 76 fParamMix(kPure),
daf66719 77 fTrack(NULL),
12b2b8bc 78 fTrackPhi(0.),
79 fTrackEta(0.),
80 fTrackWeight(0.),
127a5825 81 fTrackLabel(INT_MIN),
957517fa 82 fMCevent(NULL),
9a0783cc 83 fMCparticle(NULL),
1ff4bda1 84 fEvent(NULL),
85 fTPCtrack()
daf66719 86{
87 //constructor
88}
89
90//-----------------------------------------------------------------------
ee242db3 91AliFlowTrackCuts::AliFlowTrackCuts(const AliFlowTrackCuts& that):
92 AliFlowTrackSimpleCuts(that),
93 fAliESDtrackCuts(new AliESDtrackCuts(*(that.fAliESDtrackCuts))),
94 fQA(that.fQA),
1ff4bda1 95 fCutMC(that.fCutMC),
ee242db3 96 fCutMCprocessType(that.fCutMCprocessType),
97 fMCprocessType(that.fMCprocessType),
98 fCutMCPID(that.fCutMCPID),
99 fMCPID(that.fMCPID),
4cbcbead 100 fIgnoreSignInPID(that.fIgnoreSignInPID),
ee242db3 101 fCutMCisPrimary(that.fCutMCisPrimary),
102 fMCisPrimary(that.fMCisPrimary),
103 fRequireCharge(that.fRequireCharge),
104 fFakesAreOK(that.fFakesAreOK),
105 fCutSPDtrackletDeltaPhi(that.fCutSPDtrackletDeltaPhi),
106 fSPDtrackletDeltaPhiMax(that.fSPDtrackletDeltaPhiMax),
107 fSPDtrackletDeltaPhiMin(that.fSPDtrackletDeltaPhiMin),
1ff4bda1 108 fIgnoreTPCzRange(that.fIgnoreTPCzRange),
109 fIgnoreTPCzRangeMax(that.fIgnoreTPCzRangeMax),
110 fIgnoreTPCzRangeMin(that.fIgnoreTPCzRangeMin),
ee242db3 111 fParamType(that.fParamType),
112 fParamMix(that.fParamMix),
daf66719 113 fTrack(NULL),
ee242db3 114 fTrackPhi(0.),
115 fTrackEta(0.),
116 fTrackWeight(0.),
127a5825 117 fTrackLabel(INT_MIN),
957517fa 118 fMCevent(NULL),
9a0783cc 119 fMCparticle(NULL),
1ff4bda1 120 fEvent(NULL),
121 fTPCtrack(that.fTPCtrack)
daf66719 122{
123 //copy constructor
124}
125
126//-----------------------------------------------------------------------
ee242db3 127AliFlowTrackCuts& AliFlowTrackCuts::operator=(const AliFlowTrackCuts& that)
daf66719 128{
129 //assignment
ee242db3 130 AliFlowTrackSimpleCuts::operator=(that);
131 *fAliESDtrackCuts=*(that.fAliESDtrackCuts);
132 fQA=that.fQA;
1ff4bda1 133 fCutMC=that.fCutMC;
ee242db3 134 fCutMCprocessType=that.fCutMCprocessType;
135 fMCprocessType=that.fMCprocessType;
136 fCutMCPID=that.fCutMCPID;
137 fMCPID=that.fMCPID;
4cbcbead 138 fIgnoreSignInPID=that.fIgnoreSignInPID,
ee242db3 139 fCutMCisPrimary=that.fCutMCisPrimary;
140 fMCisPrimary=that.fMCisPrimary;
141 fRequireCharge=that.fRequireCharge;
142 fFakesAreOK=that.fFakesAreOK;
143 fCutSPDtrackletDeltaPhi=that.fCutSPDtrackletDeltaPhi;
144 fSPDtrackletDeltaPhiMax=that.fSPDtrackletDeltaPhiMax;
145 fSPDtrackletDeltaPhiMin=that.fSPDtrackletDeltaPhiMin;
1ff4bda1 146 fIgnoreTPCzRange=that.fIgnoreTPCzRange;
147 fIgnoreTPCzRangeMax=that.fIgnoreTPCzRangeMax;
148 fIgnoreTPCzRangeMin=that.fIgnoreTPCzRangeMin;
ee242db3 149 fParamType=that.fParamType;
150 fParamMix=that.fParamMix;
daf66719 151
daf66719 152 fTrack=NULL;
ee242db3 153 fTrackPhi=0.;
154 fTrackPhi=0.;
155 fTrackWeight=0.;
127a5825 156 fTrackLabel=INT_MIN;
957517fa 157 fMCevent=NULL;
daf66719 158 fMCparticle=NULL;
9a0783cc 159 fEvent=NULL;
daf66719 160
161 return *this;
162}
163
164//-----------------------------------------------------------------------
165AliFlowTrackCuts::~AliFlowTrackCuts()
166{
167 //dtor
daf66719 168 delete fAliESDtrackCuts;
169}
170
171//-----------------------------------------------------------------------
12b2b8bc 172Bool_t AliFlowTrackCuts::IsSelected(TObject* obj, Int_t id)
daf66719 173{
174 //check cuts
175 AliVParticle* vparticle = dynamic_cast<AliVParticle*>(obj);
176 if (vparticle) return PassesCuts(vparticle);
177 AliFlowTrackSimple* flowtrack = dynamic_cast<AliFlowTrackSimple*>(obj);
178 if (flowtrack) return PassesCuts(flowtrack);
12b2b8bc 179 AliMultiplicity* tracklets = dynamic_cast<AliMultiplicity*>(obj);
180 if (tracklets) return PassesCuts(tracklets,id);
daf66719 181 return kFALSE; //default when passed wrong type of object
182}
183
1ff4bda1 184//-----------------------------------------------------------------------
185Bool_t AliFlowTrackCuts::IsSelectedMCtruth(TObject* obj, Int_t id)
186{
187 //check cuts
188 AliVParticle* vparticle = dynamic_cast<AliVParticle*>(obj);
189 if (vparticle)
190 {
191 return PassesMCcuts(fMCevent,vparticle->GetLabel());
192 }
193 AliMultiplicity* tracklets = dynamic_cast<AliMultiplicity*>(obj);
194 if (tracklets)
195 {
196 Int_t label0 = tracklets->GetLabel(id,0);
197 Int_t label1 = tracklets->GetLabel(id,1);
198 Int_t label = (label0==label1)?tracklets->GetLabel(id,1):-666;
199 return PassesMCcuts(fMCevent,label);
200 }
201 return kFALSE; //default when passed wrong type of object
202}
203
daf66719 204//-----------------------------------------------------------------------
205Bool_t AliFlowTrackCuts::PassesCuts(AliFlowTrackSimple* track)
206{
207 //check cuts on a flowtracksimple
5559ce24 208
209 //clean up from last iteration
1ff4bda1 210 fTrack = NULL;
daf66719 211 return AliFlowTrackSimpleCuts::PassesCuts(track);
212}
213
12b2b8bc 214//-----------------------------------------------------------------------
215Bool_t AliFlowTrackCuts::PassesCuts(AliMultiplicity* tracklet, Int_t id)
216{
217 //check cuts on a tracklets
218
9a0783cc 219 //clean up from last iteration, and init label
1ff4bda1 220 fTrack = NULL;
12b2b8bc 221 fMCparticle=NULL;
9a0783cc 222 fTrackLabel=-1;
12b2b8bc 223
224 fTrackPhi = tracklet->GetPhi(id);
225 fTrackEta = tracklet->GetEta(id);
226 fTrackWeight = 1.0;
227 if (fCutEta) {if ( fTrackEta < fEtaMin || fTrackEta >= fEtaMax ) return kFALSE;}
228 if (fCutPhi) {if ( fTrackPhi < fPhiMin || fTrackPhi >= fPhiMax ) return kFALSE;}
229
230 //check MC info if available
9a0783cc 231 //if the 2 clusters have different label track cannot be good
232 //and should therefore not pass the mc cuts
233 Int_t label0 = tracklet->GetLabel(id,0);
234 Int_t label1 = tracklet->GetLabel(id,1);
235 fTrackLabel = (label0==label1)?tracklet->GetLabel(id,1):-1;
1ff4bda1 236 if (fCutMC && !PassesMCcuts()) return kFALSE;
12b2b8bc 237 return kTRUE;
238}
239
240//-----------------------------------------------------------------------
1ff4bda1 241Bool_t AliFlowTrackCuts::PassesMCcuts(AliMCEvent* mcEvent, Int_t label)
12b2b8bc 242{
243 //check the MC info
1ff4bda1 244 if (!mcEvent) return kFALSE;
245 if (label<0) return kFALSE;//otherwise AliCMevent prints a warning before returning NULL
246 AliMCParticle* mcparticle = static_cast<AliMCParticle*>(mcEvent->GetTrack(label));
247 if (!mcparticle) {AliError("no MC track"); return kFALSE;}
12b2b8bc 248
249 if (fCutMCisPrimary)
250 {
1ff4bda1 251 if (IsPhysicalPrimary(mcEvent,label) != fMCisPrimary) return kFALSE;
12b2b8bc 252 }
253 if (fCutMCPID)
254 {
1ff4bda1 255 Int_t pdgCode = mcparticle->PdgCode();
4cbcbead 256 if (fIgnoreSignInPID)
257 {
258 if (TMath::Abs(fMCPID) != TMath::Abs(pdgCode)) return kFALSE;
259 }
260 else
261 {
262 if (fMCPID != pdgCode) return kFALSE;
263 }
12b2b8bc 264 }
265 if ( fCutMCprocessType )
266 {
1ff4bda1 267 TParticle* particle = mcparticle->Particle();
12b2b8bc 268 Int_t processID = particle->GetUniqueID();
269 if (processID != fMCprocessType ) return kFALSE;
270 }
271 return kTRUE;
272}
1ff4bda1 273//-----------------------------------------------------------------------
274Bool_t AliFlowTrackCuts::PassesMCcuts()
275{
276 if (!fMCevent) return kFALSE;
277 if (fTrackLabel<0) return kFALSE;//otherwise AliCMevent prints a warning before returning NULL
278 fMCparticle = static_cast<AliMCParticle*>(fMCevent->GetTrack(fTrackLabel));
279 return PassesMCcuts(fMCevent,fTrackLabel);
280}
12b2b8bc 281
daf66719 282//-----------------------------------------------------------------------
283Bool_t AliFlowTrackCuts::PassesCuts(AliVParticle* vparticle)
284{
285 //check cuts for an ESD vparticle
286
127a5825 287 ////////////////////////////////////////////////////////////////
288 // start by preparing the track parameters to cut on //////////
289 ////////////////////////////////////////////////////////////////
5559ce24 290 //clean up from last iteration
1ff4bda1 291 fTrack=NULL;
5559ce24 292
957517fa 293 //get the label and the mc particle
127a5825 294 fTrackLabel = (fFakesAreOK)?TMath::Abs(vparticle->GetLabel()):vparticle->GetLabel();
295 if (fMCevent) fMCparticle = static_cast<AliMCParticle*>(fMCevent->GetTrack(fTrackLabel));
daf66719 296 else fMCparticle=NULL;
297
957517fa 298 Bool_t isMCparticle = kFALSE; //some things are different for MC particles, check!
daf66719 299 AliESDtrack* esdTrack = dynamic_cast<AliESDtrack*>(vparticle);
300 if (esdTrack)
301 HandleESDtrack(esdTrack);
302 else
957517fa 303 {
daf66719 304 HandleVParticle(vparticle);
957517fa 305 //now check if produced particle is MC
306 isMCparticle = (dynamic_cast<AliMCParticle*>(fTrack))!=NULL;
307 }
127a5825 308 ////////////////////////////////////////////////////////////////
309 ////////////////////////////////////////////////////////////////
310
1ff4bda1 311 if (!fTrack) return kFALSE;
924b02b0 312 Bool_t pass=kTRUE;
9a0783cc 313 //check the common cuts for the current particle fTrack (MC,AOD,ESD)
924b02b0 314 if (fCutPt) {if (fTrack->Pt() < fPtMin || fTrack->Pt() >= fPtMax ) pass=kFALSE;}
315 if (fCutEta) {if (fTrack->Eta() < fEtaMin || fTrack->Eta() >= fEtaMax ) pass=kFALSE;}
316 if (fCutPhi) {if (fTrack->Phi() < fPhiMin || fTrack->Phi() >= fPhiMax ) pass=kFALSE;}
317 if (fRequireCharge) {if (fTrack->Charge() == 0) pass=kFALSE;}
318 if (fCutCharge && !isMCparticle) {if (fTrack->Charge() != fCharge) pass=kFALSE;}
957517fa 319 if (fCutCharge && isMCparticle)
320 {
321 //in case of an MC particle the charge is stored in units of 1/3|e|
322 Int_t charge = TMath::Nint(fTrack->Charge()/3.0); //mc particles have charge in units of 1/3e
323 return (charge==fCharge);
324 }
924b02b0 325 //if(fCutPID) {if (fTrack->PID() != fPID) pass=kFALSE;}
daf66719 326
957517fa 327 //when additionally MC info is required
1ff4bda1 328 if (fCutMC && !PassesMCcuts()) pass=kFALSE;
daf66719 329
330 //check all else for ESDs using aliesdtrackcuts
924b02b0 331 if (esdTrack && (fParamType!=kMC) )
1ff4bda1 332 {
333 if (fIgnoreTPCzRange)
334 {
335 const AliExternalTrackParam* pin = esdTrack->GetOuterParam();
336 const AliExternalTrackParam* pout = esdTrack->GetInnerParam();
337 if (pin&&pout)
338 {
339 Double_t zin = pin->GetZ();
340 Double_t zout = pout->GetZ();
341 if (zin*zout<0) pass=kFALSE; //reject if cross the membrane
342 if (zin < fIgnoreTPCzRangeMin || zin > fIgnoreTPCzRangeMax) pass=kFALSE;
343 if (zout < fIgnoreTPCzRangeMin || zout > fIgnoreTPCzRangeMax) pass=kFALSE;
344 }
345 }
924b02b0 346 if (!fAliESDtrackCuts->IsSelected(static_cast<AliESDtrack*>(fTrack))) pass=kFALSE;
1ff4bda1 347 }
daf66719 348
924b02b0 349 return pass; //true by default, if we didn't set any cuts
daf66719 350}
351
352//-----------------------------------------------------------------------
353void AliFlowTrackCuts::HandleVParticle(AliVParticle* track)
354{
355 //handle the general case
daf66719 356 switch (fParamType)
357 {
daf66719 358 default:
daf66719 359 fTrack = track;
360 }
361}
362
363//-----------------------------------------------------------------------
364void AliFlowTrackCuts::HandleESDtrack(AliESDtrack* track)
365{
366 //handle esd track
daf66719 367 switch (fParamType)
368 {
12b2b8bc 369 case kGlobal:
daf66719 370 fTrack = track;
daf66719 371 break;
372 case kESD_TPConly:
1ff4bda1 373 if (!track->FillTPCOnlyTrack(fTPCtrack))
374 {
375 fTrack=NULL;
376 fMCparticle=NULL;
377 fTrackLabel=-1;
378 return;
379 }
380 fTrack = &fTPCtrack;
957517fa 381 //recalculate the label and mc particle, they may differ as TPClabel != global label
127a5825 382 fTrackLabel = (fFakesAreOK)?TMath::Abs(fTrack->GetLabel()):fTrack->GetLabel();
383 if (fMCevent) fMCparticle = static_cast<AliMCParticle*>(fMCevent->GetTrack(fTrackLabel));
957517fa 384 else fMCparticle=NULL;
daf66719 385 break;
daf66719 386 default:
387 fTrack = track;
daf66719 388 }
389}
390
391//-----------------------------------------------------------------------
392AliFlowTrackCuts* AliFlowTrackCuts::GetStandardTPCOnlyTrackCuts()
393{
394 //get standard cuts
395 AliFlowTrackCuts* cuts = new AliFlowTrackCuts();
5559ce24 396 cuts->SetName("standard TPConly cuts");
daf66719 397 delete cuts->fAliESDtrackCuts;
398 cuts->fAliESDtrackCuts = AliESDtrackCuts::GetStandardTPCOnlyTrackCuts();
5559ce24 399 cuts->SetParamType(kESD_TPConly);
daf66719 400 return cuts;
401}
402
403//-----------------------------------------------------------------------
404AliFlowTrackCuts* AliFlowTrackCuts::GetStandardITSTPCTrackCuts2009(Bool_t selPrimaries)
405{
406 //get standard cuts
407 AliFlowTrackCuts* cuts = new AliFlowTrackCuts();
408 cuts->SetName("standard global track cuts 2009");
409 delete cuts->fAliESDtrackCuts;
410 cuts->fAliESDtrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2009(selPrimaries);
12b2b8bc 411 cuts->SetParamType(kGlobal);
daf66719 412 return cuts;
413}
414
415//-----------------------------------------------------------------------
416AliFlowTrack* AliFlowTrackCuts::MakeFlowTrack() const
417{
418 //get a flow track constructed from whatever we applied cuts on
419 //caller is resposible for deletion
9a0783cc 420 //if construction fails return NULL
daf66719 421 AliFlowTrack* flowtrack=NULL;
12b2b8bc 422 if (fParamType==kESD_SPDtracklet)
daf66719 423 {
12b2b8bc 424 flowtrack = new AliFlowTrack();
9a0783cc 425 switch (fParamMix)
426 {
427 case kPure:
428 flowtrack->SetPhi(fTrackPhi);
429 flowtrack->SetEta(fTrackEta);
430 break;
431 case kTrackWithMCkine:
432 if (!fMCparticle) return NULL;
433 flowtrack->SetPhi( fMCparticle->Phi() );
434 flowtrack->SetEta( fMCparticle->Eta() );
435 flowtrack->SetPt( fMCparticle->Pt() );
436 break;
437 case kTrackWithMCpt:
438 if (!fMCparticle) return NULL;
439 flowtrack->SetPhi(fTrackPhi);
440 flowtrack->SetEta(fTrackEta);
441 flowtrack->SetPt(fMCparticle->Pt());
442 break;
443 default:
444 flowtrack->SetPhi(fTrackPhi);
445 flowtrack->SetEta(fTrackEta);
446 }
12b2b8bc 447 flowtrack->SetSource(AliFlowTrack::kFromTracklet);
448 }
449 else
450 {
1ff4bda1 451 if (!fTrack) return NULL;
12b2b8bc 452 switch(fParamMix)
453 {
454 case kPure:
455 flowtrack = new AliFlowTrack(fTrack);
456 break;
457 case kTrackWithMCkine:
458 flowtrack = new AliFlowTrack(fMCparticle);
459 break;
460 case kTrackWithMCPID:
461 flowtrack = new AliFlowTrack(fTrack);
9a0783cc 462 //flowtrack->setPID(...) from mc, when implemented
12b2b8bc 463 break;
9a0783cc 464 case kTrackWithMCpt:
465 if (!fMCparticle) return NULL;
466 flowtrack = new AliFlowTrack(fTrack);
467 flowtrack->SetPt(fMCparticle->Pt());
12b2b8bc 468 default:
469 flowtrack = new AliFlowTrack(fTrack);
470 }
471 if (fParamType==kMC) flowtrack->SetSource(AliFlowTrack::kFromMC);
472 else if (dynamic_cast<AliESDtrack*>(fTrack)) flowtrack->SetSource(AliFlowTrack::kFromESD);
473 else if (dynamic_cast<AliAODTrack*>(fTrack)) flowtrack->SetSource(AliFlowTrack::kFromAOD);
474 else if (dynamic_cast<AliMCParticle*>(fTrack)) flowtrack->SetSource(AliFlowTrack::kFromMC);
daf66719 475 }
daf66719 476 return flowtrack;
477}
127a5825 478
479//-----------------------------------------------------------------------
480Bool_t AliFlowTrackCuts::IsPhysicalPrimary() const
481{
482 //check if current particle is a physical primary
9a0783cc 483 if (!fMCevent) return kFALSE;
484 if (fTrackLabel<0) return kFALSE;
485 return IsPhysicalPrimary(fMCevent, fTrackLabel);
486}
487
488//-----------------------------------------------------------------------
489Bool_t AliFlowTrackCuts::IsPhysicalPrimary(AliMCEvent* mcEvent, Int_t label)
490{
491 //check if current particle is a physical primary
492 Bool_t physprim=mcEvent->IsPhysicalPrimary(label);
493 if (!physprim) return kFALSE;
494 AliMCParticle* track = static_cast<AliMCParticle*>(mcEvent->GetTrack(label));
495 if (!track) return kFALSE;
496 TParticle* particle = track->Particle();
497 Bool_t transported = particle->TestBit(kTransportBit);
498 //printf("prim: %s, transp: %s\n",(physprim)?"YES":"NO ",(transported)?"YES":"NO ");
499 return (physprim && transported);
127a5825 500}
12b2b8bc 501
502//-----------------------------------------------------------------------
503const char* AliFlowTrackCuts::GetParamTypeName(trackParameterType type)
504{
505 //return the name of the selected parameter type
506 switch (type)
507 {
508 case kMC:
509 return "MC";
510 case kGlobal:
511 return "ESD global";
512 case kESD_TPConly:
513 return "TPC only";
514 case kESD_SPDtracklet:
515 return "SPD tracklet";
516 default:
517 return "unknown";
518 }
519 return "unknown";
520}
924b02b0 521
522//-----------------------------------------------------------------------
523void AliFlowTrackCuts::DefineHistograms()
524{
525}
9a0783cc 526
527//-----------------------------------------------------------------------
528Int_t AliFlowTrackCuts::GetNumberOfInputObjects() const
529{
530 //get the number of tracks in the input event according source
531 //selection (ESD tracks, tracklets, MC particles etc.)
532 AliESDEvent* esd=NULL;
533 switch (fParamType)
534 {
535 case kESD_SPDtracklet:
536 esd = dynamic_cast<AliESDEvent*>(fEvent);
537 if (!esd) return 0;
538 return esd->GetMultiplicity()->GetNumberOfTracklets();
539 case kMC:
540 if (!fMCevent) return 0;
541 return fMCevent->GetNumberOfTracks();
542 default:
543 if (!fEvent) return 0;
544 return fEvent->GetNumberOfTracks();
545 }
546 return 0;
547}
548
549//-----------------------------------------------------------------------
550TObject* AliFlowTrackCuts::GetInputObject(Int_t i)
551{
552 //get the input object according the data source selection:
553 //(esd tracks, traclets, mc particles,etc...)
554 AliESDEvent* esd=NULL;
555 switch (fParamType)
556 {
557 case kESD_SPDtracklet:
558 esd = dynamic_cast<AliESDEvent*>(fEvent);
559 if (!esd) return NULL;
560 return const_cast<AliMultiplicity*>(esd->GetMultiplicity());
561 case kMC:
562 if (!fMCevent) return NULL;
563 return fMCevent->GetTrack(i);
564 default:
565 if (!fEvent) return NULL;
566 return fEvent->GetTrack(i);
567 }
568}