diff --git a/InnerDetector/InDetRecTools/InDetPriVxFinderTool/src/InDetAdaptiveMultiPriVxFinderTool.cxx b/InnerDetector/InDetRecTools/InDetPriVxFinderTool/src/InDetAdaptiveMultiPriVxFinderTool.cxx index 7c31811a3735cfab3ff07f8b02743cd2406bd4f1..3093e6cff68e2fde32648167304d6f19dfcdd0a1 100755 --- a/InnerDetector/InDetRecTools/InDetPriVxFinderTool/src/InDetAdaptiveMultiPriVxFinderTool.cxx +++ b/InnerDetector/InDetRecTools/InDetPriVxFinderTool/src/InDetAdaptiveMultiPriVxFinderTool.cxx @@ -578,15 +578,11 @@ InDetAdaptiveMultiPriVxFinderTool::findVertex( trkAtVtxIter != trkAtVtxend; ++trkAtVtxIter) { // for now using the compatibility at stage before end... - ATH_MSG_VERBOSE("The compatibility value of the track " - << *trkAtVtxIter << " is " - << (*trkAtVtxIter)->vtxCompatibility()); if (((*trkAtVtxIter)->vtxCompatibility() < m_maxVertexChi2 && m_useFastCompatibility) || ((*trkAtVtxIter)->weight() > m_minweight && (*trkAtVtxIter)->trackQuality().chiSquared() < m_maxVertexChi2 && !m_useFastCompatibility)) { - ATH_MSG_VERBOSE("Eliminating incompatible track"); std::vector<const Trk::ITrackLink*>::iterator foundTrack = seedtrkend; for (std::vector<const Trk::ITrackLink*>::iterator seedtrkiter = @@ -598,17 +594,13 @@ InDetAdaptiveMultiPriVxFinderTool::findVertex( foundTrack = seedtrkiter; } } - ATH_MSG_VERBOSE("Trying to find track now"); if (foundTrack != seedtrkend) { - ATH_MSG_VERBOSE("Track found: eliminating it"); seedTracks.erase(foundTrack); // update end and begin??? should I? yes, he can copy, regenerate, // you don't know! seedtrkbegin = seedTracks.begin(); seedtrkend = seedTracks.end(); - - ATH_MSG_VERBOSE("Remaining seeds: " << seedTracks.size()); } } } @@ -618,13 +610,10 @@ InDetAdaptiveMultiPriVxFinderTool::findVertex( double highestcompatibility = 0; Trk::VxTrackAtVertex* trackHighestCompatibility = nullptr; - ATH_MSG_VERBOSE("Analyzing new vertex"); - for (std::vector<Trk::VxTrackAtVertex*>::iterator trkAtVtxIter = trkAtVtxbegin; trkAtVtxIter != trkAtVtxend; ++trkAtVtxIter) { - ATH_MSG_VERBOSE("Checking new track for compatibility"); const Trk::ITrackLink* foundTrack = nullptr; for (std::vector<const Trk::ITrackLink*>::const_iterator seedtrkiter = seedtrkbegin; @@ -637,7 +626,6 @@ InDetAdaptiveMultiPriVxFinderTool::findVertex( } if (foundTrack != nullptr) { double compatibility = (*trkAtVtxIter)->vtxCompatibility(); - ATH_MSG_VERBOSE("New track has compatibility: " << compatibility); if (compatibility > highestcompatibility) { highestcompatibility = compatibility; trackHighestCompatibility = *trkAtVtxIter; @@ -937,14 +925,12 @@ InDetAdaptiveMultiPriVxFinderTool::findVertex( ++tracksIter) { // only set link if track link is to an xAOD::TrackParticle - - // why do we need dynamic_cast here? - Trk::LinkToXAODTrackParticle* linkToXAODTP = - dynamic_cast<Trk::LinkToXAODTrackParticle*>( - (*tracksIter).trackOrParticleLink()); + Trk::LinkToXAODTrackParticle* linkToXAODTP = nullptr; + Trk::ITrackLink* tmpLink = (*tracksIter).trackOrParticleLink(); + if (tmpLink->type() == Trk::ITrackLink::ToxAODTrackParticle) { + linkToXAODTP = static_cast<Trk::LinkToXAODTrackParticle*>(tmpLink); + } if (linkToXAODTP) { - ATH_MSG_VERBOSE( - "Iterating over new vertex in fixing xAOD::TrackParticle links... "); (*vxIter)->addTrackAtVertex(*linkToXAODTP, (*tracksIter).weight()); } } @@ -995,10 +981,6 @@ InDetAdaptiveMultiPriVxFinderTool::findVertex( if (i > 0) { (*theVertexContainer)[i]->setVertexType(xAOD::VxType::PileUp); } - ATH_MSG_VERBOSE("Vertex at z =" - << (*theVertexContainer)[i]->position().z() - << " with ntracks: " - << (*theVertexContainer)[i]->vxTrackAtVertex().size()); } return std::make_pair(theVertexContainer, theVertexAuxContainer); } diff --git a/InnerDetector/InDetRecTools/InDetPriVxFinderTool/src/InDetIterativePriVxFinderTool.cxx b/InnerDetector/InDetRecTools/InDetPriVxFinderTool/src/InDetIterativePriVxFinderTool.cxx index 4c2e0c0f21edf79ecf258d39f4168fb3a9644b1d..03f1643f207b1ee109498273e81d8d09b6f83cfa 100755 --- a/InnerDetector/InDetRecTools/InDetPriVxFinderTool/src/InDetIterativePriVxFinderTool.cxx +++ b/InnerDetector/InDetRecTools/InDetPriVxFinderTool/src/InDetIterativePriVxFinderTool.cxx @@ -792,16 +792,16 @@ InDetIterativePriVxFinderTool::findVertex( (*tracksIter).setOrigTrack(*origtrkiter); // See if the trklink is to an xAOD::TrackParticle - - //Why we need dynamicC_cast here? - Trk::LinkToXAODTrackParticle* linkToXAODTP = - dynamic_cast<Trk::LinkToXAODTrackParticle*>(*origtrkiter); + Trk::LinkToXAODTrackParticle* linkToXAODTP = nullptr; + Trk::ITrackLink* tmpLink = (*tracksIter).trackOrParticleLink(); + if (tmpLink->type() == Trk::ITrackLink::ToxAODTrackParticle) { + linkToXAODTP = static_cast<Trk::LinkToXAODTrackParticle*>(tmpLink); + } // If track is an xAOD::TrackParticle, set directly in xAOD::Vertex if (linkToXAODTP) { (*vxIter)->addTrackAtVertex(*linkToXAODTP, (*tracksIter).weight()); - } // TODO: else write in a warning? (if tracks were Trk::Tracks or - // Trk::TrackParticleBase) + } origTracks.erase(origtrkiter); origtrkbegin = origTracks.begin(); diff --git a/Tracking/TrkEvent/TrkLinks/TrkLinks/LinkToXAODNeutralParticle.h b/Tracking/TrkEvent/TrkLinks/TrkLinks/LinkToXAODNeutralParticle.h index 4e43f6771e75f2b8ef97786369c2bfe9d56375d1..2c629bd76543e1aafb79264f0350961b8ed6693e 100644 --- a/Tracking/TrkEvent/TrkLinks/TrkLinks/LinkToXAODNeutralParticle.h +++ b/Tracking/TrkEvent/TrkLinks/TrkLinks/LinkToXAODNeutralParticle.h @@ -5,54 +5,56 @@ #ifndef TRKTRACK_LINKTOXAODNEUTRALPARTICLE_H #define TRKTRACK_LINKTOXAODNEUTRALPARTICLE_H -#include "TrkTrackLink/ITrackLink.h" #include "AthLinks/ElementLink.h" +#include "TrkTrackLink/ITrackLink.h" -#include "xAODTracking/NeutralParticleContainer.h" #include "TrkNeutralParameters/NeutralParameters.h" +#include "xAODTracking/NeutralParticleContainer.h" -namespace Trk +namespace Trk { +/** @brief Element link to XAOD NeutralParticle. + * An EDM object to reduce dependencies among + * Tracking/InDet/XAOD domains. This is NOT an + * analysis class. This link keeps the EDM of + * different domains together and makes it interchangeable. + * WARNING: Do not use this class unless you understand + * how the ITrackLink functions. + * + * A hack to the EDM which will be possibly removed at later stages + * Kirill.Prokofiev@cern.ch + * + * February 2014 + */ + +class LinkToXAODNeutralParticle + : public ITrackLink + , public ElementLink<xAOD::NeutralParticleContainer> { - /** @brief Element link to XAOD NeutralParticle. - * An EDM object to reduce dependencies among - * Tracking/InDet/XAOD domains. This is NOT an - * analysis class. This link keeps the EDM of - * different domains together and makes it interchangeable. - * WARNING: Do not use this class unless you understand - * how the ITrackLink functions. - * - * A hack to the EDM which will be possibly removed at later stages - * Kirill.Prokofiev@cern.ch - * - * February 2014 - */ - - class LinkToXAODNeutralParticle : public ITrackLink, public ElementLink<xAOD::NeutralParticleContainer> - { - - public: - /** default constructor (needed for persistency) */ - LinkToXAODNeutralParticle(); - - /** constructor with ElementLink */ - LinkToXAODNeutralParticle( ElementLink<xAOD::NeutralParticleContainer>& link ); - - /** default destructor */ - virtual ~LinkToXAODNeutralParticle() = default; - - /** dummy function to return 0 if TrackParameters are asked for */ - const TrackParameters* parameters() const { return nullptr; }; - - /** return the neutral parameters of the neutral (to which the EL< NeutralCollection > points) */ - const NeutralParameters* neutralParameters() const; - - /** method to clone the LinkToXAODNeutralParticle object */ - LinkToXAODNeutralParticle * clone() const ; - - // This is here to make sure that the NeutralCollection typedef - // will make it into the dictionary. - // typedef NeutralCollection NeutralCollectionForDict; - };//end of class definitions -}//end of namespace definitions - -#endif //TRKTRACK_LINKTOXAODNEUTRALPARTICLE_H + +public: + /** default constructor (needed for persistency) */ + LinkToXAODNeutralParticle(); + + /** constructor with ElementLink */ + LinkToXAODNeutralParticle(ElementLink<xAOD::NeutralParticleContainer>& link); + + /** default destructor */ + virtual ~LinkToXAODNeutralParticle() = default; + + /** dummy function to return 0 if TrackParameters are asked for */ + const TrackParameters* parameters() const override final { return nullptr; } + + /** return the neutral parameters of the neutral (to which the EL< + * NeutralCollection > points) */ + const NeutralParameters* neutralParameters() const override final; + + /** method to clone the LinkToXAODNeutralParticle object */ + LinkToXAODNeutralParticle* clone() const override final; + + virtual ITrackLinkType type() const override final { + return ToxAODNeutralParticle; + } +}; // end of class definitions +} // end of namespace definitions + +#endif // TRKTRACK_LINKTOXAODNEUTRALPARTICLE_H diff --git a/Tracking/TrkEvent/TrkLinks/TrkLinks/LinkToXAODTrackParticle.h b/Tracking/TrkEvent/TrkLinks/TrkLinks/LinkToXAODTrackParticle.h index 6b607d83a83c4c66684599b6c3725fff167a657f..936a54e04b15c56608540857193bbcf908ce6f86 100644 --- a/Tracking/TrkEvent/TrkLinks/TrkLinks/LinkToXAODTrackParticle.h +++ b/Tracking/TrkEvent/TrkLinks/TrkLinks/LinkToXAODTrackParticle.h @@ -29,31 +29,38 @@ namespace Trk * February 2014 */ - class LinkToXAODTrackParticle : public ITrackLink, public ElementLink<xAOD::TrackParticleContainer> - { - - public: - /** default constructor (needed for persistency) */ - LinkToXAODTrackParticle(); - - /** constructor with ElementLink */ - LinkToXAODTrackParticle( ElementLink<xAOD::TrackParticleContainer>& link ); +class LinkToXAODTrackParticle + : public ITrackLink + , public ElementLink<xAOD::TrackParticleContainer> +{ - /** default destructor */ - virtual ~LinkToXAODTrackParticle() = default; - - /** return the track parameters of the track (to which the EL< TrackCollection > points) */ - const TrackParameters* parameters() const; +public: + /** default constructor (needed for persistency) */ + LinkToXAODTrackParticle(); - /** return the neutral parameters of the NeutralParticle) */ - virtual const NeutralParameters* neutralParameters() const {return nullptr;}; - - /** method to clone the LinkToXAODTrackParticle object */ - LinkToXAODTrackParticle * clone() const ; + /** constructor with ElementLink */ + LinkToXAODTrackParticle(ElementLink<xAOD::TrackParticleContainer>& link); + + /** default destructor */ + virtual ~LinkToXAODTrackParticle() = default; + + /** return the track parameters of the track (to which the EL< TrackCollection + * > points) */ + virtual const TrackParameters* parameters() const override final; + + /** return the neutral parameters of the NeutralParticle) */ + virtual const NeutralParameters* neutralParameters() const override final + { + return nullptr; + } + + /** method to clone the LinkToXAODTrackParticle object */ + virtual LinkToXAODTrackParticle* clone() const override final; - // This is here to make sure that the TrackCollection typedef - // will make it into the dictionary. - // typedef TrackCollection TrackCollectionForDict; + virtual ITrackLinkType type() const override final { + return ToxAODTrackParticle; + } + };//end of class definitions }//end of namespace definitions diff --git a/Tracking/TrkEvent/TrkLinks/src/LinkToXAODNeutralParticle.cxx b/Tracking/TrkEvent/TrkLinks/src/LinkToXAODNeutralParticle.cxx index 789e71730c2a562ba975893c44ac142ab32a63c1..197ea17973c0561573f54c8a4181b10c93d8d737 100644 --- a/Tracking/TrkEvent/TrkLinks/src/LinkToXAODNeutralParticle.cxx +++ b/Tracking/TrkEvent/TrkLinks/src/LinkToXAODNeutralParticle.cxx @@ -6,30 +6,33 @@ #include "xAODTracking/NeutralParticleContainer.h" #include "xAODTracking/NeutralParticle.h" +namespace Trk { +LinkToXAODNeutralParticle::LinkToXAODNeutralParticle() + : ElementLink<xAOD::NeutralParticleContainer>() +{} -namespace Trk -{ - LinkToXAODNeutralParticle::LinkToXAODNeutralParticle() : ElementLink<xAOD::NeutralParticleContainer>() - {} +LinkToXAODNeutralParticle::LinkToXAODNeutralParticle( + ElementLink<xAOD::NeutralParticleContainer>& link) + : ElementLink<xAOD::NeutralParticleContainer>(link) +{} - LinkToXAODNeutralParticle::LinkToXAODNeutralParticle ( ElementLink<xAOD::NeutralParticleContainer>& link ) : ElementLink<xAOD::NeutralParticleContainer> ( link ) - {} +const NeutralParameters* +LinkToXAODNeutralParticle::neutralParameters() const +{ + if (isValid()) { + const xAOD::NeutralParticle* neut = this->cachedElement(); + if (nullptr != neut) { + return &(neut->perigeeParameters()); + } + return nullptr; + } + return nullptr; +} // end of parameters method - const NeutralParameters* LinkToXAODNeutralParticle::neutralParameters() const - { - if ( isValid() ) - { - const xAOD::NeutralParticle * neut = this->cachedElement(); - if ( nullptr != neut ) { return dynamic_cast<const Trk::NeutralParameters* > ( &neut->perigeeParameters() ); +Trk::LinkToXAODNeutralParticle* +Trk::LinkToXAODNeutralParticle::clone() const +{ + return new LinkToXAODNeutralParticle(*this); } - return nullptr; - } - return nullptr; - }//end of parameters method - - Trk::LinkToXAODNeutralParticle* Trk::LinkToXAODNeutralParticle::clone() const - { - return new LinkToXAODNeutralParticle ( *this ); - } -}//end of namespace definitions +} // end of namespace definitions diff --git a/Tracking/TrkEvent/TrkLinks/src/LinkToXAODTrackParticle.cxx b/Tracking/TrkEvent/TrkLinks/src/LinkToXAODTrackParticle.cxx index 26f139c965e78554f071994f3022603fe4060bec..19e9fffef544c6893effa52dcbc1aff95e51a342 100644 --- a/Tracking/TrkEvent/TrkLinks/src/LinkToXAODTrackParticle.cxx +++ b/Tracking/TrkEvent/TrkLinks/src/LinkToXAODTrackParticle.cxx @@ -3,33 +3,36 @@ */ #include "TrkLinks/LinkToXAODTrackParticle.h" -#include "xAODTracking/TrackParticleContainer.h" #include "xAODTracking/TrackParticle.h" +#include "xAODTracking/TrackParticleContainer.h" +namespace Trk { +LinkToXAODTrackParticle::LinkToXAODTrackParticle() + : ElementLink<xAOD::TrackParticleContainer>() +{} -namespace Trk -{ - LinkToXAODTrackParticle::LinkToXAODTrackParticle() : ElementLink<xAOD::TrackParticleContainer>() - {} +LinkToXAODTrackParticle::LinkToXAODTrackParticle( + ElementLink<xAOD::TrackParticleContainer>& link) + : ElementLink<xAOD::TrackParticleContainer>(link) +{} - LinkToXAODTrackParticle::LinkToXAODTrackParticle ( ElementLink<xAOD::TrackParticleContainer>& link ) : ElementLink<xAOD::TrackParticleContainer> ( link ) - {} +const TrackParameters* +LinkToXAODTrackParticle::parameters() const +{ + if (isValid()) { + const xAOD::TrackParticle* trk = this->cachedElement(); + if (nullptr != trk) { + return &(trk->perigeeParameters()); + } + return nullptr; + } + return nullptr; +} // end of parameters method - const TrackParameters* LinkToXAODTrackParticle::parameters() const - { - if ( isValid() ) - { - const xAOD::TrackParticle * trk = this->cachedElement(); - if ( nullptr != trk ) { return dynamic_cast<const Trk::TrackParameters* > ( &trk->perigeeParameters() ); +Trk::LinkToXAODTrackParticle* +Trk::LinkToXAODTrackParticle::clone() const +{ + return new LinkToXAODTrackParticle(*this); } - return nullptr; - } - return nullptr; - }//end of parameters method - - Trk::LinkToXAODTrackParticle* Trk::LinkToXAODTrackParticle::clone() const - { - return new LinkToXAODTrackParticle ( *this ); - } -}//end of namespace definitions +} // end of namespace definitions diff --git a/Tracking/TrkEvent/TrkParticleBase/TrkParticleBase/LinkToTrackParticleBase.h b/Tracking/TrkEvent/TrkParticleBase/TrkParticleBase/LinkToTrackParticleBase.h index 234b5881030f87cf913397b099fe7bbff7cf587e..5aec0f7576869daebe6f02c5cdadae4945f77d79 100644 --- a/Tracking/TrkEvent/TrkParticleBase/TrkParticleBase/LinkToTrackParticleBase.h +++ b/Tracking/TrkEvent/TrkParticleBase/TrkParticleBase/LinkToTrackParticleBase.h @@ -5,37 +5,41 @@ #ifndef TRKPARTICLEBASE_LINKTOTRACKPARTICLEBASE_H #define TRKPARTICLEBASE_LINKTOTRACKPARTICLEBASE_H -#include "TrkTrackLink/ITrackLink.h" -#include "TrkParticleBase/TrackParticleBaseCollection.h" #include "AthLinks/ElementLink.h" +#include "TrkParticleBase/TrackParticleBaseCollection.h" +#include "TrkTrackLink/ITrackLink.h" + +namespace Trk { -namespace Trk +class LinkToTrackParticleBase + : public ITrackLink + , public ElementLink<TrackParticleBaseCollection> { - - class LinkToTrackParticleBase : public ITrackLink, public ElementLink<TrackParticleBaseCollection> - { - - public: - /** default constructor (needed for persistency) */ - LinkToTrackParticleBase( ); - - /** constructor with ElementLink */ - LinkToTrackParticleBase( ElementLink<TrackParticleBaseCollection>& link); - - /** default destructor */ - virtual ~LinkToTrackParticleBase() = default; - - /** return the track parameters of the track (to which the EL< TrackParticleBaseCollection > points) */ - const TrackParameters * parameters() const; - - /** return the neutral parameters of the NeutralParticle) */ - const NeutralParameters* neutralParameters() const {return nullptr;}; - - /** method to clone the LinkToTrack object */ - LinkToTrackParticleBase * clone() const ; - - };//end of class definitions -}//end of namespace definitions - -#endif //LINKTOTRACKPARTICLEBASE_H +public: + /** default constructor (needed for persistency) */ + LinkToTrackParticleBase(); + + /** constructor with ElementLink */ + LinkToTrackParticleBase(ElementLink<TrackParticleBaseCollection>& link); + + /** default destructor */ + virtual ~LinkToTrackParticleBase() = default; + + /** return the track parameters of the track (to which the EL< + * TrackParticleBaseCollection > points) */ + virtual const TrackParameters* parameters() const override final; + + /** return the neutral parameters of the NeutralParticle) */ + virtual const NeutralParameters* neutralParameters() const override final { return nullptr; } + + /** method to clone the LinkToTrack object */ + virtual LinkToTrackParticleBase* clone() const override final; + + virtual ITrackLinkType type() const override final { + return ToTrackParticleBase; + } +}; // end of class definitions +} // end of namespace definitions + +#endif // LINKTOTRACKPARTICLEBASE_H diff --git a/Tracking/TrkEvent/TrkParticleBase/src/LinkToTrackParticleBase.cxx b/Tracking/TrkEvent/TrkParticleBase/src/LinkToTrackParticleBase.cxx index c1e535a5afe0c3f6190ed653cd43532fa8198143..31abad580d9eb1dfab27f139083f2d7ed73f5040 100644 --- a/Tracking/TrkEvent/TrkParticleBase/src/LinkToTrackParticleBase.cxx +++ b/Tracking/TrkEvent/TrkParticleBase/src/LinkToTrackParticleBase.cxx @@ -2,35 +2,37 @@ Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ - #include "TrkParticleBase/LinkToTrackParticleBase.h" #include "TrkParticleBase/TrackParticleBase.h" -namespace Trk -{ +namespace Trk { - LinkToTrackParticleBase::LinkToTrackParticleBase() : ElementLink<TrackParticleBaseCollection>() - {} +LinkToTrackParticleBase::LinkToTrackParticleBase() + : ElementLink<TrackParticleBaseCollection>() +{} - LinkToTrackParticleBase::LinkToTrackParticleBase ( ElementLink<TrackParticleBaseCollection>& link ) - : ElementLink<TrackParticleBaseCollection> ( link ) - {} +LinkToTrackParticleBase::LinkToTrackParticleBase( + ElementLink<TrackParticleBaseCollection>& link) + : ElementLink<TrackParticleBaseCollection>(link) +{} - const TrackParameters * LinkToTrackParticleBase::parameters() const - { - if ( isValid() ) - { - const Trk::TrackParticleBase * trk = this->cachedElement(); - if ( nullptr != trk ) { return & ( trk->definingParameters() ); +const TrackParameters* +LinkToTrackParticleBase::parameters() const +{ + if (isValid()) { + const Trk::TrackParticleBase* trk = this->cachedElement(); + if (nullptr != trk) { + return &(trk->definingParameters()); + } + return nullptr; + } // end of validity check + return nullptr; +} // end of parameters method + +Trk::LinkToTrackParticleBase* +Trk::LinkToTrackParticleBase::clone() const +{ + return new LinkToTrackParticleBase(*this); } - return nullptr; - }//end of validity check - return nullptr; - }//end of parameters method - - Trk::LinkToTrackParticleBase* Trk::LinkToTrackParticleBase::clone() const - { - return new LinkToTrackParticleBase ( *this ); - } -}//end of namespace definitions +} // end of namespace definitions diff --git a/Tracking/TrkEvent/TrkParticleBase/src/TrackParticleBase.cxx b/Tracking/TrkEvent/TrkParticleBase/src/TrackParticleBase.cxx index bcff10696ba028fe8801fc48f0936d0839f38805..deb1787f7fb8d4ebda19006d691a8625e99262f8 100755 --- a/Tracking/TrkEvent/TrkParticleBase/src/TrackParticleBase.cxx +++ b/Tracking/TrkEvent/TrkParticleBase/src/TrackParticleBase.cxx @@ -165,7 +165,7 @@ namespace Trk m_trackParticleOrigin = rhs.m_trackParticleOrigin; m_elVxCandidate = rhs.m_elVxCandidate; - m_trackInfo = std::move(rhs.m_trackInfo); + m_trackInfo = rhs.m_trackInfo; } return *this; } diff --git a/Tracking/TrkEvent/TrkTrack/TrkTrack/LinkToTrack.h b/Tracking/TrkEvent/TrkTrack/TrkTrack/LinkToTrack.h index ab19d4bdb69d16297b70a501b895baef6a2d797a..31cb94d920b73c87216eab6a99a0f628acf48fe2 100644 --- a/Tracking/TrkEvent/TrkTrack/TrkTrack/LinkToTrack.h +++ b/Tracking/TrkEvent/TrkTrack/TrkTrack/LinkToTrack.h @@ -1,47 +1,52 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef TRKTRACK_LINKTOTRACK_H #define TRKTRACK_LINKTOTRACK_H -#include "TrkTrackLink/ITrackLink.h" #include "AthLinks/ElementLink.h" -#include "TrkTrack/TrackCollection.h" +#include "TrkNeutralParameters/NeutralParameters.h" #include "TrkParameters/TrackParameters.h" -#include "TrkNeutralParameters/NeutralParameters.h" +#include "TrkTrack/TrackCollection.h" +#include "TrkTrackLink/ITrackLink.h" +namespace Trk { +/** @brief AUTO - An Undocumented Tracking Object */ -namespace Trk +class LinkToTrack + : public ITrackLink + , public ElementLink<TrackCollection> { - /** @brief AUTO - An Undocumented Tracking Object */ - - class LinkToTrack : public ITrackLink, public ElementLink<TrackCollection> - { - - public: - /** default constructor (needed for persistency) */ - LinkToTrack(); - - /** constructor with ElementLink */ - LinkToTrack( ElementLink<TrackCollection>& link ); - - /** default destructor */ - virtual ~LinkToTrack() = default; - - /** return the track parameters of the track (to which the EL< TrackCollection > points) */ - const TrackParameters* parameters() const; - - /** return the neutral parameters of the NeutralParticle) */ - const NeutralParameters* neutralParameters() const {return nullptr;}; - - /** method to clone the LinkToTrack object */ - LinkToTrack * clone() const ; - - // This is here to make sure that the TrackCollection typedef - // will make it into the dictionary. - typedef TrackCollection TrackCollectionForDict; - };//end of class definitions -}//end of namespace definitions - -#endif //TRKTRACK_LINKTOTRACK_H + +public: + /** default constructor (needed for persistency) */ + LinkToTrack(); + + /** constructor with ElementLink */ + LinkToTrack(ElementLink<TrackCollection>& link); + + /** default destructor */ + virtual ~LinkToTrack() = default; + + /** return the track parameters of the track (to which the EL< TrackCollection + * > points) */ + virtual const TrackParameters* parameters() const override final; + + /** return the neutral parameters of the NeutralParticle) */ + virtual const NeutralParameters* neutralParameters() const override final { return nullptr; } + + /** method to clone the LinkToTrack object */ + virtual LinkToTrack* clone() const override final; + + virtual ITrackLinkType type() const override final { + return ToTrack; + } + + // This is here to make sure that the TrackCollection typedef + // will make it into the dictionary. + typedef TrackCollection TrackCollectionForDict; +}; // end of class definitions +} // end of namespace definitions + +#endif // TRKTRACK_LINKTOTRACK_H diff --git a/Tracking/TrkEvent/TrkTrack/src/LinkToTrack.cxx b/Tracking/TrkEvent/TrkTrack/src/LinkToTrack.cxx index 33cf02b150e430fef6a39ca6e2c2ccb280824332..01600f4bad0b608dd45f1f1de1a7c46a5f472d0a 100644 --- a/Tracking/TrkEvent/TrkTrack/src/LinkToTrack.cxx +++ b/Tracking/TrkEvent/TrkTrack/src/LinkToTrack.cxx @@ -3,32 +3,35 @@ */ #include "TrkTrack/LinkToTrack.h" -#include "TrkTrack/TrackCollection.h" #include "TrkTrack/Track.h" +#include "TrkTrack/TrackCollection.h" +namespace Trk { +LinkToTrack::LinkToTrack() + : ElementLink<TrackCollection>() +{} -namespace Trk -{ - LinkToTrack::LinkToTrack() : ElementLink<TrackCollection>() - {} - - LinkToTrack::LinkToTrack ( ElementLink<TrackCollection>& link ) : ElementLink<TrackCollection> ( link ) - {} +LinkToTrack::LinkToTrack(ElementLink<TrackCollection>& link) + : ElementLink<TrackCollection>(link) +{} - const TrackParameters* LinkToTrack::parameters() const - { - if ( isValid() ) - { - const Trk::Track * trk = this->cachedElement(); - if ( nullptr != trk ) { return dynamic_cast<const Trk::TrackParameters* > ( trk->perigeeParameters() );} - return nullptr; - } - return nullptr; - }//end of parameters method +const TrackParameters* +LinkToTrack::parameters() const +{ + if (isValid()) { + const Trk::Track* trk = this->cachedElement(); + if (nullptr != trk) { + return trk->perigeeParameters(); + } + return nullptr; + } + return nullptr; +} // end of parameters method - Trk::LinkToTrack* Trk::LinkToTrack::clone() const - { - return new LinkToTrack ( *this ); - } +Trk::LinkToTrack* +Trk::LinkToTrack::clone() const +{ + return new LinkToTrack(*this); +} -}//end of namespace definitions +} // end of namespace definitions diff --git a/Tracking/TrkEvent/TrkTrackLink/TrkTrackLink/ITrackLink.h b/Tracking/TrkEvent/TrkTrackLink/TrkTrackLink/ITrackLink.h index 830d925e39904da41131f4f15f4adf595c110ac8..53c16988e25e9910956d73198546eeb33abf1b45 100644 --- a/Tracking/TrkEvent/TrkTrackLink/TrkTrackLink/ITrackLink.h +++ b/Tracking/TrkEvent/TrkTrackLink/TrkTrackLink/ITrackLink.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef TRKTRACKLINK_ITRACKLINK_H @@ -18,36 +18,38 @@ * Kirill Prokofiev, June 2007 */ -#include "TrkParameters/TrackParameters.h" // no forward declare for now because needed in cast #include "TrkNeutralParameters/NeutralParameters.h" // no forward declare for now because needed in cast +#include "TrkParameters/TrackParameters.h" // no forward declare for now because needed in cast -namespace Trk +namespace Trk { +class ITrackLink { - class ITrackLink + +public: + enum ITrackLinkType { + ToxAODTrackParticle = 0, + ToxAODNeutralParticle = 1, + ToTrack = 2, + ToTrackParticleBase = 3 + }; - public: - ///Default 'do nothing' constructors are used - - /** default destructor */ - virtual ~ITrackLink() {} + virtual ~ITrackLink() = default; - /** clone methods for copy constructors */ - virtual ITrackLink * clone() const = 0; + /** clone methods for copy constructors */ + virtual ITrackLink* clone() const = 0; - /** return the track parameters of the track or TrackParticleBase) */ - virtual const TrackParameters* parameters() const = 0; + /** return the track parameters of the track or TrackParticleBase) */ + virtual const TrackParameters* parameters() const = 0; - /** return the neutral parameters of the NeutralParticle) */ - virtual const NeutralParameters* neutralParameters() const = 0; + /** return the neutral parameters of the NeutralParticle) */ + virtual const NeutralParameters* neutralParameters() const = 0; - /**return number of parameters currently created*/ - ////DRQ: Commented out because not implemented - ////static unsigned int numberOfInstantiations(); + /** return the type */ + virtual ITrackLinkType type() const = 0; - } - ; //end of class definitions +}; // end of class definitions -}//end of namespace definitions +} // end of namespace definitions -#endif //TRKTRACKLINK_ITRACKLINK_H +#endif // TRKTRACKLINK_ITRACKLINK_H