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), nhybridTracks2a(0), nhybridTracks2b(0), nhybridTracks3(0);
204 for(
auto accresult : *acceptedTracks) {
207 AliVTrack *vTrack = selectionResult->
GetTrack();
208 trackarray->AddLast(vTrack);
209 if (!(*selectionResult) || !vTrack) {
242 AliDebugStream(1) <<
"Accepted: " << naccepted <<
", Rejected: " << nrejected <<
", hybrid: (" << nhybridTracks1 <<
" | [" << nhybridTracks2a <<
" | " << nhybridTracks2b <<
"] | " << nhybridTracks3 <<
")" << std::endl;
272 if (i == -1) i = fCurrentID;
277 AliDebug(2,
"Track not accepted.");
289 const Int_t n = GetNEntries();
293 if (fCurrentID >= n)
break;
307 const Int_t n = GetNEntries();
311 if (fCurrentID >= n)
break;
347 if (mass < 0) mass = track->M();
349 Bool_t useConstrainedParams = kFALSE;
353 AliDebugStream(2) <<
"Found a constrained track" << std::endl;
354 useConstrainedParams = kTRUE;
358 if (useConstrainedParams) {
359 const AliESDtrack *esdtrack =
static_cast<const AliESDtrack*
>(track);
360 mom.SetPtEtaPhiM(esdtrack->GetConstrainedParam()->Pt(), esdtrack->GetConstrainedParam()->Eta(), esdtrack->GetConstrainedParam()->Phi(),
mass);
363 mom.SetPtEtaPhiM(track->Pt(), track->Eta(), track->Phi(),
mass);
368 mom.SetPtEtaPhiM(0, 0, 0, 0);
398 if (i == -1) i = fCurrentID;
401 if (mass < 0) mass = vp->M();
405 AliDebugStream(2) <<
"Found a constrained track" << std::endl;
406 AliESDtrack *track =
static_cast<AliESDtrack*
>(vp);
407 mom.SetPtEtaPhiM(track->GetConstrainedParam()->Pt(), track->GetConstrainedParam()->Eta(), track->GetConstrainedParam()->Phi(),
mass);
410 mom.SetPtEtaPhiM(vp->Pt(), vp->Eta(), vp->Phi(),
mass);
415 mom.SetPtEtaPhiM(0, 0, 0, 0);
435 if (mass < 0) mass = vp->M();
439 AliDebugStream(2) <<
"Found a constrained track" << std::endl;
440 AliESDtrack *track =
static_cast<AliESDtrack*
>(vp);
441 mom.SetPtEtaPhiM(track->GetConstrainedParam()->Pt(), track->GetConstrainedParam()->Eta(), track->GetConstrainedParam()->Phi(),
mass);
444 mom.SetPtEtaPhiM(vp->Pt(), vp->Eta(), vp->Phi(),
mass);
449 mom.SetPtEtaPhiM(0, 0, 0, 0);
469 if (i == -1) i = fCurrentID;
472 if (mass < 0) mass = vp->M();
476 AliDebugStream(2) <<
"Found a constrained track" << std::endl;
477 AliESDtrack *track =
static_cast<AliESDtrack*
>(vp);
478 mom.SetPtEtaPhiM(track->GetConstrainedParam()->Pt(), track->GetConstrainedParam()->Eta(), track->GetConstrainedParam()->Phi(),
mass);
481 mom.SetPtEtaPhiM(vp->Pt(), vp->Eta(), vp->Phi(),
mass);
487 mom.SetPtEtaPhiM(0, 0, 0, 0);
507 if (mass < 0) mass = vp->M();
511 AliDebugStream(2) <<
"Found a constrained track" << std::endl;
512 AliESDtrack *track =
static_cast<AliESDtrack*
>(vp);
513 mom.SetPtEtaPhiM(track->GetConstrainedParam()->Pt(), track->GetConstrainedParam()->Eta(), track->GetConstrainedParam()->Phi(),
mass);
516 mom.SetPtEtaPhiM(vp->Pt(), vp->Eta(), vp->Phi(),
mass);
522 mom.SetPtEtaPhiM(0, 0, 0, 0);
540 if (!r)
return kFALSE;
563 if (!r)
return kFALSE;
616 if (icut < fListOfCuts->GetEntries()) {
617 return static_cast<AliVCuts *
>(
fListOfCuts->At(icut));
633 if(
auto hybriddata = dynamic_cast<const PWG::EMCAL::AliEmcalTrackSelResultHybrid *>(selectionResult.
GetUserInfo())) {
634 hybridDefinition = hybriddata->GetHybridTrackType();
636 if(
auto combineddata = dynamic_cast<const PWG::EMCAL::AliEmcalTrackSelResultCombined *>(selectionResult.
GetUserInfo())){
637 for(
int icut = 0; icut < combineddata->GetNumberOfSelectionResults(); icut++){
642 AliErrorStream() <<
"Index error: " << e.
what() << std::endl;
647 return hybridDefinition;
651 bool teststatus =
true;
653 if(selected->GetEntries() != fClArray->GetEntries()) {
654 std::cout <<
"Mismatch array size: selected " << selected->GetEntries() <<
", input " << fClArray->GetEntries() << std::endl;
657 std::cout <<
"Array size consistent: " << selected->GetEntries() << std::endl;
662 int nmatch(0), nfail(0);
663 for(
int i = 0; i < fClArray->GetEntries(); i++) {
664 AliVTrack *trackAll =
dynamic_cast<AliVTrack *
>(fClArray->At(i));
665 AliVTrack *trackSel =
dynamic_cast<AliVTrack *
>(selected->At(i));
666 if(trackSel == trackAll) {
669 std::cout <<
"Mismatch in array position: " << i << std::endl;
674 std::cout <<
"found " << nfail <<
"mismatches" << std::endl;
726 trackString = TString::Format(
"%s_pT%04d", GetArrayName().
Data(), static_cast<int>(GetMinPt()*1000.0));
727 return trackString.Data();
731 if(ev->IsA() == AliAODEvent::Class())
return "tracks";
732 else if(ev->IsA() == AliESDEvent::Class())
return "Tracks";
761 TObject::operator=(other);
Interface for virtual track selection.
Complementary hybrid track with alive SPD module (type IIb)
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.
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.
Global hybrid track (type I)
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
Hybrid tracks using the 2018 TRD test definition.
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
Bool_t fITSHybridTrackDistinction
Distinct hybrid tracks via SPD information.
TObjArray * GetData() const
Complementary hybrid track without alive SPD module (type IIa)
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.
Undefined - no hybrid track.
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
HybridType_t
Various types of hybrid tracks.
void AddTrackCuts(AliVCuts *cuts)
virtual TString GetDefaultArrayName(const AliVEvent *const ev) const
void SetArray(const AliVEvent *event)
Track selected under the constrained hybrid track cuts (true constrained)
virtual AliVTrack * GetAcceptTrack(Int_t i=-1) const
Track selected under the constrained hybrid track cuts (fake constrained)
virtual Bool_t GetNextAcceptMomentum(TLorentzVector &mom)
void SetSelectionModeAll()
Set selection mode to all.
const AliTrackIterableMomentumContainer accepted_momentum() const
Complementary hybrid track without ITS refit (type III)
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