29 #include <TClonesArray.h>
31 #include "AliAODEvent.h"
32 #include "AliESDEvent.h"
33 #include "AliVEvent.h"
36 #include "AliESDtrack.h"
59 fSelectionModeAny(kFALSE),
60 fITSHybridTrackDistinction(kFALSE),
63 fEmcalTrackSelection(0),
67 fBaseClassName =
"AliVTrack";
68 SetClassName(
"AliVTrack");
69 fMassHypothesis = 0.139;
81 fSelectionModeAny(kFALSE),
82 fITSHybridTrackDistinction(kFALSE),
84 fTrackCutsPeriod(period),
85 fEmcalTrackSelection(0),
89 fBaseClassName =
"AliVTrack";
90 SetClassName(
"AliVTrack");
92 if (
fTrackCutsPeriod.IsNull() && !AliTrackContainer::fgDefTrackCutsPeriod.IsNull()) {
93 AliInfo(Form(
"Default track cuts period is %s", AliTrackContainer::fgDefTrackCutsPeriod.
Data()));
96 fMassHypothesis = 0.139;
116 AliInfo(
"Using custom track cuts");
119 if (fLoadedClass->InheritsFrom(
"AliAODTrack")) {
120 AliInfo(Form(
"Objects are of type %s: AOD track selection will be done.", fLoadedClass->GetName()));
123 else if (fLoadedClass->InheritsFrom(
"AliESDtrack")) {
124 AliInfo(Form(
"Objects are of type %s: ESD track selection will be done.", fLoadedClass->GetName()));
128 AliWarning(Form(
"Objects are of type %s: no track filtering will be done!!", fLoadedClass->GetName()));
148 AliInfo(Form(
"Using track cuts %d (no data period was provided!)",
fTrackFilterType));
151 if (fLoadedClass->InheritsFrom(
"AliAODTrack")) {
152 AliInfo(Form(
"Objects are of type %s: AOD track selection will be done.", fLoadedClass->GetName()));
155 else if (fLoadedClass->InheritsFrom(
"AliESDtrack")) {
156 AliInfo(Form(
"Objects are of type %s: ESD track selection will be done.", fLoadedClass->GetName()));
160 AliWarning(Form(
"Objects are of type %s: no track filtering will be done!!", fLoadedClass->GetName()));
173 AliParticleContainer::NextEvent(event);
182 trackarray->SetOwner(
false);
189 int naccepted(0), nrejected(0), nhybridTracks1(0), nhybridTracks2(0), nhybridTracks3(0);
191 for(
auto accresult : *acceptedTracks) {
194 AliVTrack *vTrack = selectionResult->
GetTrack();
195 trackarray->AddLast(vTrack);
196 if (!(*selectionResult) || !vTrack) {
225 AliDebugStream(1) <<
"Accepted: " << naccepted <<
", Rejected: " << nrejected <<
", hybrid: (" << nhybridTracks1 <<
" | " << nhybridTracks2 <<
" | " << nhybridTracks3 <<
")" << std::endl;
255 if (i == -1) i = fCurrentID;
260 AliDebug(2,
"Track not accepted.");
272 const Int_t n = GetNEntries();
276 if (fCurrentID >= n)
break;
290 const Int_t n = GetNEntries();
294 if (fCurrentID >= n)
break;
330 if (mass < 0) mass = track->M();
332 Bool_t useConstrainedParams = kFALSE;
336 AliDebugStream(2) <<
"Found a constrained track" << std::endl;
337 useConstrainedParams = kTRUE;
341 if (useConstrainedParams) {
342 const AliESDtrack *esdtrack =
static_cast<const AliESDtrack*
>(track);
343 mom.SetPtEtaPhiM(esdtrack->GetConstrainedParam()->Pt(), esdtrack->GetConstrainedParam()->Eta(), esdtrack->GetConstrainedParam()->Phi(),
mass);
346 mom.SetPtEtaPhiM(track->Pt(), track->Eta(), track->Phi(),
mass);
351 mom.SetPtEtaPhiM(0, 0, 0, 0);
381 if (i == -1) i = fCurrentID;
384 if (mass < 0) mass = vp->M();
388 AliDebugStream(2) <<
"Found a constrained track" << std::endl;
389 AliESDtrack *track =
static_cast<AliESDtrack*
>(vp);
390 mom.SetPtEtaPhiM(track->GetConstrainedParam()->Pt(), track->GetConstrainedParam()->Eta(), track->GetConstrainedParam()->Phi(),
mass);
393 mom.SetPtEtaPhiM(vp->Pt(), vp->Eta(), vp->Phi(),
mass);
398 mom.SetPtEtaPhiM(0, 0, 0, 0);
418 if (mass < 0) mass = vp->M();
422 AliDebugStream(2) <<
"Found a constrained track" << std::endl;
423 AliESDtrack *track =
static_cast<AliESDtrack*
>(vp);
424 mom.SetPtEtaPhiM(track->GetConstrainedParam()->Pt(), track->GetConstrainedParam()->Eta(), track->GetConstrainedParam()->Phi(),
mass);
427 mom.SetPtEtaPhiM(vp->Pt(), vp->Eta(), vp->Phi(),
mass);
432 mom.SetPtEtaPhiM(0, 0, 0, 0);
452 if (i == -1) i = fCurrentID;
455 if (mass < 0) mass = vp->M();
459 AliDebugStream(2) <<
"Found a constrained track" << std::endl;
460 AliESDtrack *track =
static_cast<AliESDtrack*
>(vp);
461 mom.SetPtEtaPhiM(track->GetConstrainedParam()->Pt(), track->GetConstrainedParam()->Eta(), track->GetConstrainedParam()->Phi(),
mass);
464 mom.SetPtEtaPhiM(vp->Pt(), vp->Eta(), vp->Phi(),
mass);
470 mom.SetPtEtaPhiM(0, 0, 0, 0);
490 if (mass < 0) mass = vp->M();
494 AliDebugStream(2) <<
"Found a constrained track" << std::endl;
495 AliESDtrack *track =
static_cast<AliESDtrack*
>(vp);
496 mom.SetPtEtaPhiM(track->GetConstrainedParam()->Pt(), track->GetConstrainedParam()->Eta(), track->GetConstrainedParam()->Phi(),
mass);
499 mom.SetPtEtaPhiM(vp->Pt(), vp->Eta(), vp->Phi(),
mass);
505 mom.SetPtEtaPhiM(0, 0, 0, 0);
523 if (!r)
return kFALSE;
545 if (!r)
return kFALSE;
598 if (icut < fListOfCuts->GetEntries()) {
599 return static_cast<AliVCuts *
>(
fListOfCuts->At(icut));
614 if(
auto hybriddata = dynamic_cast<const PWG::EMCAL::AliEmcalTrackSelResultHybrid *>(selectionResult.
GetUserInfo())) {
615 hybridDefinition = hybriddata->GetHybridTrackType();
617 if(
auto combineddata = dynamic_cast<const PWG::EMCAL::AliEmcalTrackSelResultCombined *>(selectionResult.
GetUserInfo())){
618 for(
int icut = 0; icut < combineddata->GetNumberOfSelectionResults(); icut++){
624 return hybridDefinition;
672 trackString = TString::Format(
"%s_pT%04d", GetArrayName().
Data(), static_cast<int>(GetMinPt()*1000.0));
673 return trackString.Data();
677 if(ev->IsA() == AliAODEvent::Class())
return "tracks";
678 else if(ev->IsA() == AliESDEvent::Class())
return "Tracks";
692 fManagedObject(managedobject),
693 fOwnership(ownership)
700 fManagedObject(other.fManagedObject),
707 TObject::operator=(other);
709 if(fOwnership && fManagedObject)
delete fManagedObject;
717 if(fOwnership && fManagedObject)
delete fManagedObject;
721 if(fOwnership && fManagedObject)
delete fManagedObject;
722 fManagedObject = obj;
730 if(fOwnership) target.
SetOwner(fOwnership);
Interface for virtual track selection.
void SetArray(const AliVEvent *event)
No filter (all tracks passing)
static TString fgDefTrackCutsPeriod
! default period string used to generate track cuts
const AliTrackIterableContainer accepted() const
TrackOwnerHandler & operator=(const TrackOwnerHandler &other)
Container with name, TClonesArray and cuts for particles.
EMCALIterableContainer::AliEmcalIterableContainerT< AliVTrack, EMCALIterableContainer::operator_star_object< AliVTrack > > AliTrackIterableContainer
Declaration of class AliTLorentzVector.
Track selected under the constrained hybrid track cuts.
virtual Bool_t ApplyParticleCuts(const AliVParticle *vp, UInt_t &rejectionReason) const
UInt_t fAODFilterBits
track filter bits
void NextEvent(const AliVEvent *event)
Structure containing the result of a given track selection step.
const AliTrackIterableContainer all() const
void ReceiveOwnershipFrom(TrackOwnerHandler &source)
void SetSelectionModeAny()
Set selection mode to any.
AliVCuts * GetTrackCuts(Int_t icut)
virtual Bool_t GetNextMomentum(TLorentzVector &mom)
AliEmcalTrackSelection * fEmcalTrackSelection
! track selection object
virtual Bool_t GetMomentum(TLorentzVector &mom, Int_t i) const
ETrackFilterType_t fTrackFilterType
track filter type
TString fTrackCutsPeriod
period string used to generate track cuts
Container for particles within the EMCAL framework.
Track selected under the constrained hybrid track cuts without ITS refit.
PWG::EMCAL::AliEmcalTrackSelResultHybrid::HybridType_t GetHybridDefinition(const PWG::EMCAL::AliEmcalTrackSelResultPtr &selectionResult) const
TObjArray * GetData() const
Hybrid tracks using the 2011 definition including NoITSrefit tracks (ESD-only)
virtual ~TrackOwnerHandler()
virtual Bool_t GetAcceptMomentum(TLorentzVector &mom, Int_t i) const
virtual Bool_t GetMomentumFromTrack(TLorentzVector &mom, const AliVTrack *track, Double_t mass) const
Hybrid tracks using the 2010 definition including NoITSrefit tracks (ESD-only)
TrackOwnerHandler fFilteredTracks
! tracks filtered using fEmcalTrackSelection
virtual Bool_t ApplyTrackCuts(const AliVTrack *vp, UInt_t &rejectionReason) const
TObjArray * fManagedObject
Object managed by the handler.
EMCALIterableContainer::AliEmcalIterableContainerT< AliVTrack, EMCALIterableContainer::operator_star_pair< AliVTrack > > AliTrackIterableMomentumContainer
virtual Bool_t AcceptTrack(const AliVTrack *vp, UInt_t &rejectionReason) const
Hybrid tracks using the 2010 definition excluding NoITSrefit tracks (ESD-only)
Int_t GetNumberOfCutObjects() const
TArrayC fTrackTypes
! track types
Hybrid tracks using the 2011 definition excluding NoITSrefit tracks (ESD-only)
TObjArray * fListOfCuts
list of track cut objects
void AddTrackCuts(AliVCuts *cuts)
Add new track cuts to the list of cuts.
Implement virtual track selection for AOD analysis.
AliVTrack * GetTrack() const
virtual AliVTrack * GetNextTrack()
Bool_t Data(TH1F *h, Double_t *rangefit, Bool_t writefit, Double_t &sgn, Double_t &errsgn, Double_t &bkg, Double_t &errbkg, Double_t &sgnf, Double_t &errsgnf, Double_t &sigmafit, Int_t &status)
Bool_t fSelectionModeAny
accept track if any of the cuts is fulfilled
const TObject * GetUserInfo() const
Custom (user-defined) tracks.
virtual AliVTrack * GetTrack(Int_t i=-1) const
void SetOwner(Bool_t owner)
Track selected under the global hybrid track cuts.
TObjArray * GetAcceptedTracks(const TClonesArray *const tracks)
Select tracks from a TClonesArray of input tracks.
virtual AliVTrack * GetNextAcceptTrack()
Char_t GetTrackType(const AliVTrack *track) const
void AddTrackCuts(AliVCuts *cuts)
virtual TString GetDefaultArrayName(const AliVEvent *const ev) const
void SetArray(const AliVEvent *event)
virtual AliVTrack * GetAcceptTrack(Int_t i=-1) const
virtual Bool_t GetNextAcceptMomentum(TLorentzVector &mom)
void SetSelectionModeAll()
Set selection mode to all.
const AliTrackIterableMomentumContainer accepted_momentum() const
const char * GetTitle() const
virtual Bool_t ApplyKinematicCuts(const AliTLorentzVector &mom, UInt_t &rejectionReason) const
void TransferOwnershipTo(TrackOwnerHandler &target)
void SetObject(TObjArray *obj)
Unique_ptr implementation for ROOT5 compatibility.
Implementation of virtual track selection for ESDs.
const AliTrackIterableMomentumContainer all_momentum() const
Bool_t IsHybridTrackSelection() const