29 #include <TClonesArray.h> 31 #include "AliAODEvent.h" 32 #include "AliESDEvent.h" 33 #include "AliVEvent.h" 36 #include "AliESDtrack.h" 72 fSelectionModeAny(kFALSE),
73 fITSHybridTrackDistinction(kFALSE),
76 fEmcalTrackSelection(0),
80 fBaseClassName =
"AliVTrack";
81 SetClassName(
"AliVTrack");
82 fMassHypothesis = 0.139;
102 fBaseClassName =
"AliVTrack";
103 SetClassName(
"AliVTrack");
105 if (
fTrackCutsPeriod.IsNull() && !AliTrackContainer::fgDefTrackCutsPeriod.IsNull()) {
106 AliInfo(Form(
"Default track cuts period is %s", AliTrackContainer::fgDefTrackCutsPeriod.
Data()));
109 fMassHypothesis = 0.139;
129 AliInfo(
"Using custom track cuts");
132 if (fLoadedClass->InheritsFrom(
"AliAODTrack")) {
133 AliInfo(Form(
"Objects are of type %s: AOD track selection will be done.", fLoadedClass->GetName()));
136 else if (fLoadedClass->InheritsFrom(
"AliESDtrack")) {
137 AliInfo(Form(
"Objects are of type %s: ESD track selection will be done.", fLoadedClass->GetName()));
141 AliWarning(Form(
"Objects are of type %s: no track filtering will be done!!", fLoadedClass->GetName()));
161 AliInfo(Form(
"Using track cuts %d (no data period was provided!)",
fTrackFilterType));
164 if (fLoadedClass->InheritsFrom(
"AliAODTrack")) {
165 AliInfo(Form(
"Objects are of type %s: AOD track selection will be done.", fLoadedClass->GetName()));
168 else if (fLoadedClass->InheritsFrom(
"AliESDtrack")) {
169 AliInfo(Form(
"Objects are of type %s: ESD track selection will be done.", fLoadedClass->GetName()));
173 AliWarning(Form(
"Objects are of type %s: no track filtering will be done!!", fLoadedClass->GetName()));
186 AliParticleContainer::NextEvent(event);
195 trackarray->SetOwner(
false);
202 int naccepted(0), nrejected(0), nhybridTracks1(0), nhybridTracks2(0), nhybridTracks3(0);
204 for(
auto accresult : *acceptedTracks) {
207 AliVTrack *vTrack = selectionResult->
GetTrack();
208 trackarray->AddLast(vTrack);
209 if (!(*selectionResult) || !vTrack) {
238 AliDebugStream(1) <<
"Accepted: " << naccepted <<
", Rejected: " << nrejected <<
", hybrid: (" << nhybridTracks1 <<
" | " << nhybridTracks2 <<
" | " << nhybridTracks3 <<
")" << std::endl;
268 if (i == -1) i = fCurrentID;
273 AliDebug(2,
"Track not accepted.");
285 const Int_t n = GetNEntries();
289 if (fCurrentID >= n)
break;
303 const Int_t n = GetNEntries();
307 if (fCurrentID >= n)
break;
343 if (mass < 0) mass = track->M();
345 Bool_t useConstrainedParams = kFALSE;
349 AliDebugStream(2) <<
"Found a constrained track" << std::endl;
350 useConstrainedParams = kTRUE;
354 if (useConstrainedParams) {
355 const AliESDtrack *esdtrack =
static_cast<const AliESDtrack*
>(track);
356 mom.SetPtEtaPhiM(esdtrack->GetConstrainedParam()->Pt(), esdtrack->GetConstrainedParam()->Eta(), esdtrack->GetConstrainedParam()->Phi(),
mass);
359 mom.SetPtEtaPhiM(track->Pt(), track->Eta(), track->Phi(),
mass);
364 mom.SetPtEtaPhiM(0, 0, 0, 0);
394 if (i == -1) i = fCurrentID;
397 if (mass < 0) mass = vp->M();
401 AliDebugStream(2) <<
"Found a constrained track" << std::endl;
402 AliESDtrack *track =
static_cast<AliESDtrack*
>(vp);
403 mom.SetPtEtaPhiM(track->GetConstrainedParam()->Pt(), track->GetConstrainedParam()->Eta(), track->GetConstrainedParam()->Phi(),
mass);
406 mom.SetPtEtaPhiM(vp->Pt(), vp->Eta(), vp->Phi(),
mass);
411 mom.SetPtEtaPhiM(0, 0, 0, 0);
431 if (mass < 0) mass = vp->M();
435 AliDebugStream(2) <<
"Found a constrained track" << std::endl;
436 AliESDtrack *track =
static_cast<AliESDtrack*
>(vp);
437 mom.SetPtEtaPhiM(track->GetConstrainedParam()->Pt(), track->GetConstrainedParam()->Eta(), track->GetConstrainedParam()->Phi(),
mass);
440 mom.SetPtEtaPhiM(vp->Pt(), vp->Eta(), vp->Phi(),
mass);
445 mom.SetPtEtaPhiM(0, 0, 0, 0);
465 if (i == -1) i = fCurrentID;
468 if (mass < 0) mass = vp->M();
472 AliDebugStream(2) <<
"Found a constrained track" << std::endl;
473 AliESDtrack *track =
static_cast<AliESDtrack*
>(vp);
474 mom.SetPtEtaPhiM(track->GetConstrainedParam()->Pt(), track->GetConstrainedParam()->Eta(), track->GetConstrainedParam()->Phi(),
mass);
477 mom.SetPtEtaPhiM(vp->Pt(), vp->Eta(), vp->Phi(),
mass);
483 mom.SetPtEtaPhiM(0, 0, 0, 0);
503 if (mass < 0) mass = vp->M();
507 AliDebugStream(2) <<
"Found a constrained track" << std::endl;
508 AliESDtrack *track =
static_cast<AliESDtrack*
>(vp);
509 mom.SetPtEtaPhiM(track->GetConstrainedParam()->Pt(), track->GetConstrainedParam()->Eta(), track->GetConstrainedParam()->Phi(),
mass);
512 mom.SetPtEtaPhiM(vp->Pt(), vp->Eta(), vp->Phi(),
mass);
518 mom.SetPtEtaPhiM(0, 0, 0, 0);
536 if (!r)
return kFALSE;
559 if (!r)
return kFALSE;
612 if (icut < fListOfCuts->GetEntries()) {
613 return static_cast<AliVCuts *
>(
fListOfCuts->At(icut));
628 if(
auto hybriddata = dynamic_cast<const PWG::EMCAL::AliEmcalTrackSelResultHybrid *>(selectionResult.
GetUserInfo())) {
629 hybridDefinition = hybriddata->GetHybridTrackType();
631 if(
auto combineddata = dynamic_cast<const PWG::EMCAL::AliEmcalTrackSelResultCombined *>(selectionResult.
GetUserInfo())){
632 for(
int icut = 0; icut < combineddata->GetNumberOfSelectionResults(); icut++){
637 AliErrorStream() <<
"Index error: " << e.
what() << std::endl;
642 return hybridDefinition;
646 bool teststatus =
true;
648 if(selected->GetEntries() != fClArray->GetEntries()) {
649 std::cout <<
"Mismatch array size: selected " << selected->GetEntries() <<
", input " << fClArray->GetEntries() << std::endl;
652 std::cout <<
"Array size consistent: " << selected->GetEntries() << std::endl;
657 int nmatch(0), nfail(0);
658 for(
int i = 0; i < fClArray->GetEntries(); i++) {
659 AliVTrack *trackAll =
dynamic_cast<AliVTrack *
>(fClArray->At(i));
660 AliVTrack *trackSel =
dynamic_cast<AliVTrack *
>(selected->At(i));
661 if(trackSel == trackAll) {
664 std::cout <<
"Mismatch in array position: " << i << std::endl;
669 std::cout <<
"found " << nfail <<
"mismatches" << std::endl;
721 trackString = TString::Format(
"%s_pT%04d", GetArrayName().
Data(), static_cast<int>(GetMinPt()*1000.0));
722 return trackString.Data();
726 if(ev->IsA() == AliAODEvent::Class())
return "tracks";
727 else if(ev->IsA() == AliESDEvent::Class())
return "Tracks";
756 TObject::operator=(other);
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)
Bool_t CheckArrayConsistency() const
Test function checking whether the entries in the track array are the same as in the input array...
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 part
use mixed event to constrain combinatorial background
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
Bool_t fITSHybridTrackDistinction
Distinct hybrid tracks via SPD information.
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
static const std::map< std::string, AliEmcalTrackSelection::ETrackFilterType_t > fgkTrackFilterTypeMap
Relates string to the track filter enumeration for YAML configuration.
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.
Bool_t fOwnership
Ownership implementation.
const char * what() const
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