diff --git a/InnerDetector/InDetRecEvent/InDetRIO_OnTrack/InDetRIO_OnTrack/TRT_DriftCircleOnTrack.h b/InnerDetector/InDetRecEvent/InDetRIO_OnTrack/InDetRIO_OnTrack/TRT_DriftCircleOnTrack.h index f5f8b4b37eab8e89ff09e2312286990e1aae65ee..e84917187f49cd7cd4b3e6dd359708ebc9cedb82 100755 --- a/InnerDetector/InDetRecEvent/InDetRIO_OnTrack/InDetRIO_OnTrack/TRT_DriftCircleOnTrack.h +++ b/InnerDetector/InDetRecEvent/InDetRIO_OnTrack/InDetRIO_OnTrack/TRT_DriftCircleOnTrack.h @@ -77,6 +77,20 @@ namespace InDet{ const Trk::DriftCircleStatus status); + /** + * Constructor used by the TP converters + */ + TRT_DriftCircleOnTrack( const ElementLinkToIDCTRT_DriftCircleContainer& RIO, + const Trk::LocalParameters& driftRadius, + const Amg::MatrixX& errDriftRadius, + IdentifierHash idDE, + const Identifier& id, + double predictedLocZ, + float localAngle, + const Trk::DriftCircleStatus status, + bool highLevel, + double timeOverThreshold); + /**Destructor */ virtual ~TRT_DriftCircleOnTrack(); @@ -144,15 +158,17 @@ namespace InDet{ float localAngle() const; float positionAlongWire() const; - /** @brief Uses the passed loc3Dframe to calculate and set the global coord of this hit. - The detector element surface is used*/ - void setGlobalPositionHelper(); - + private: /** ONLY for use in custom convertor Allows the custom convertor to reset values when persistying/reading back RoTs*/ virtual void setValues(const Trk::TrkDetElementBase* detEl, const Trk::PrepRawData* prd) override; + /** @calculate and set the global coord of this hit. + The detector element surface is used. Can be used from the convertor + after setValues if the element is constructed without a detEl*/ + void setGlobalPositionHelper(); + /** global position to be cached */ Amg::Vector3D m_globalPosition; diff --git a/InnerDetector/InDetRecEvent/InDetRIO_OnTrack/src/TRT_DriftCircleOnTrack.cxx b/InnerDetector/InDetRecEvent/InDetRIO_OnTrack/src/TRT_DriftCircleOnTrack.cxx index dd9996ce28f114eb49edab33a973758c611b238c..52548493e8a2ac56229a33591982eb86f831f1ee 100755 --- a/InnerDetector/InDetRecEvent/InDetRIO_OnTrack/src/TRT_DriftCircleOnTrack.cxx +++ b/InnerDetector/InDetRecEvent/InDetRIO_OnTrack/src/TRT_DriftCircleOnTrack.cxx @@ -64,6 +64,30 @@ InDet::TRT_DriftCircleOnTrack::TRT_DriftCircleOnTrack( } } +//Constructor used by the converter +InDet::TRT_DriftCircleOnTrack::TRT_DriftCircleOnTrack( + const ElementLinkToIDCTRT_DriftCircleContainer& RIO, + const Trk::LocalParameters& driftRadius, + const Amg::MatrixX& errDriftRadius, + IdentifierHash idDE, + const Identifier& id, + double predictedLocZ, + float localAngle, + const Trk::DriftCircleStatus status, + bool highLevel, + double timeOverThreshold) + : Trk::RIO_OnTrack(driftRadius, errDriftRadius, id) + , m_globalPosition{} + , m_localAngle(localAngle) + , m_positionAlongWire(predictedLocZ) + , m_rio(RIO) + , m_idDE(idDE) + , m_status(status) + , m_highLevel(highLevel) + , m_timeOverThreshold(timeOverThreshold) + , m_detEl(nullptr) +{} + // Destructor: InDet::TRT_DriftCircleOnTrack::~TRT_DriftCircleOnTrack() {} @@ -147,9 +171,18 @@ const Trk::Surface& InDet::TRT_DriftCircleOnTrack::associatedSurface() const return (m_detEl->surface(identify())); } +const Amg::Vector3D& InDet::TRT_DriftCircleOnTrack::globalPosition() const { + + return m_globalPosition; +} + + +//Global Position Helper for the converter void InDet::TRT_DriftCircleOnTrack::setGlobalPositionHelper() { + + //default Amg::Vector3D loc3Dframe(0., 0., m_positionAlongWire); if (side() != Trk::NONE) { // get global position where track and drift radius intersect. @@ -162,9 +195,10 @@ InDet::TRT_DriftCircleOnTrack::setGlobalPositionHelper() double y = localParameters()[Trk::driftRadius]*std::cos(m_localAngle); */ // get local position - Amg::Vector3D loc3Dframe(x, y, m_positionAlongWire); + loc3Dframe = Amg::Vector3D(x, y, m_positionAlongWire); } + //We need a surface for the global position const Trk::StraightLineSurface* slsf = dynamic_cast<const Trk::StraightLineSurface*>(&(associatedSurface())); if (slsf) { @@ -176,14 +210,16 @@ InDet::TRT_DriftCircleOnTrack::setGlobalPositionHelper() } } -void InDet::TRT_DriftCircleOnTrack::setValues(const Trk::TrkDetElementBase* detEl, const Trk::PrepRawData*) +//set Values to be used by the converter +void +InDet::TRT_DriftCircleOnTrack::setValues(const Trk::TrkDetElementBase* detEl, + const Trk::PrepRawData*) { m_detEl = dynamic_cast<const InDetDD::TRT_BaseElement* >(detEl); -} - -const Amg::Vector3D& InDet::TRT_DriftCircleOnTrack::globalPosition() const { - - return m_globalPosition; + // If we have a m_detEL we can set the global position + if (m_detEl) { + setGlobalPositionHelper(); + } } MsgStream& InDet::TRT_DriftCircleOnTrack::dump( MsgStream& sl ) const