diff --git a/Tracking/TrkEvent/TrkParametersBase/TrkParametersBase/CurvilinearParametersT.h b/Tracking/TrkEvent/TrkParametersBase/TrkParametersBase/CurvilinearParametersT.h index 4cbe21a82af9503affdcb85261ba7b9ac8a29beb..aa8593245a917ac3911873230439ea221baa88fd 100644 --- a/Tracking/TrkEvent/TrkParametersBase/TrkParametersBase/CurvilinearParametersT.h +++ b/Tracking/TrkEvent/TrkParametersBase/TrkParametersBase/CurvilinearParametersT.h @@ -14,8 +14,7 @@ #include "EventPrimitives/EventPrimitives.h" #include "GeoPrimitives/GeoPrimitives.h" #include "TrkEventPrimitives/CurvilinearUVT.h" -#include "TrkEventPrimitives/SurfaceUniquePtrT.h" - +#include "TrkSurfaces/Surface.h" #include <memory> class MsgStream; @@ -48,6 +47,9 @@ template<int DIM, class T, class S> class CurvilinearParametersT final : public ParametersBase<DIM, T> { public: + static_assert(S::staticType == Surface::Plane, + "The surface type must be Plane"); + /** default constructor only for POOL */ CurvilinearParametersT() = default; @@ -117,10 +119,9 @@ public: /** Virtual clone */ virtual CurvilinearParametersT<DIM, T, S>* clone() const override final; - + /** Virtual clone returning unique_ptr*/ std::unique_ptr<CurvilinearParametersT<DIM, T, S>> uniqueClone() const; - /** Return the ParametersType enum */ virtual ParametersType type() const override final; @@ -149,9 +150,9 @@ protected: using ParametersBase<DIM, T>::m_parameters; using ParametersBase<DIM, T>::m_covariance; using ParametersBase<DIM, T>::m_chargeDef; - Amg::Vector3D m_position; //!< point on track - Amg::Vector3D m_momentum; //!< momentum at this point on track - SurfaceUniquePtrT<const S> m_surface; //!< surface template + Amg::Vector3D m_position; //!< point on track + Amg::Vector3D m_momentum; //!< momentum at this point on track + S m_surface; //!< surface template /** the curvilinear parameters identifier */ unsigned int m_cIdentifier = 0; /* diff --git a/Tracking/TrkEvent/TrkParametersBase/TrkParametersBase/CurvilinearParametersT.icc b/Tracking/TrkEvent/TrkParametersBase/TrkParametersBase/CurvilinearParametersT.icc index eb7b9d2b12143cc27f7ace3e3fb221fdaf7cfd9b..4cfcf6694d303a9890cea20e8968b621d9d73bc6 100644 --- a/Tracking/TrkEvent/TrkParametersBase/TrkParametersBase/CurvilinearParametersT.icc +++ b/Tracking/TrkEvent/TrkParametersBase/TrkParametersBase/CurvilinearParametersT.icc @@ -22,7 +22,6 @@ Trk::CurvilinearParametersT<DIM, T, S>::CurvilinearParametersT( : ParametersBase<DIM, T>(covariance) , m_position(Amg::Vector3D(parameters[x], parameters[y], parameters[z])) , m_momentum(Amg::Vector3D(parameters[3], parameters[4], parameters[5])) - , m_surface{ nullptr } , m_cIdentifier(cIdentifier) { @@ -39,7 +38,7 @@ Trk::CurvilinearParametersT<DIM, T, S>::CurvilinearParametersT( this->m_parameters[qOverP] = parameters[6] / this->momentum().mag(); /* we need all the above to be there for the surfac*/ - this->m_surface.reset(new S(this->m_position, curvilinearFrame())); + m_surface = S(this->m_position, curvilinearFrame()); } // Constructor with TP arguments @@ -52,7 +51,6 @@ CurvilinearParametersT<DIM, T, S>::CurvilinearParametersT( AmgSymMatrix(DIM) * cov, unsigned int cIdentifier) : ParametersBase<DIM, T>() - , m_surface{ nullptr } , m_cIdentifier(cIdentifier) { this->m_covariance.reset(cov); @@ -73,11 +71,12 @@ CurvilinearParametersT<DIM, T, S>::CurvilinearParametersT( // make sure that the position & momentum are calculated double p = std::abs(1. / tqOverP); - this->m_momentum = Amg::Vector3D( - p * std::cos(tphi) * std::sin(ttheta), p * std::sin(tphi) * std::sin(ttheta), p * std::cos(ttheta)); + this->m_momentum = Amg::Vector3D(p * std::cos(tphi) * std::sin(ttheta), + p * std::sin(tphi) * std::sin(ttheta), + p * std::cos(ttheta)); /* we need all the above for the surface*/ - this->m_surface.reset(new S(this->m_position, curvilinearFrame())); + m_surface= S(this->m_position, curvilinearFrame()); } // full global constructor @@ -89,7 +88,6 @@ CurvilinearParametersT<DIM, T, S>::CurvilinearParametersT( AmgSymMatrix(DIM) * cov, unsigned int cIdentifier) : ParametersBase<DIM, T>() - , m_surface{ nullptr } , m_cIdentifier(cIdentifier) { this->m_chargeDef.setCharge(charge); @@ -110,7 +108,7 @@ CurvilinearParametersT<DIM, T, S>::CurvilinearParametersT( this->m_momentum = mom; // we need all the above to create the surface - this->m_surface.reset(new S(this->m_position, curvilinearFrame())); + m_surface = S(this->m_position, curvilinearFrame()); } // Copy constructor @@ -121,12 +119,9 @@ CurvilinearParametersT<DIM, T, S>::CurvilinearParametersT( , m_position(rhs.position()) , m_momentum(rhs.momentum()) - , m_surface(nullptr) + , m_surface(rhs.m_surface) , m_cIdentifier(rhs.m_cIdentifier) { - m_surface.reset((rhs.m_surface && rhs.m_surface->isFree() - ? rhs.m_surface->clone() - : rhs.m_surface.get())); if (rhs.covariance()) { m_covariance = std::make_unique<AmgSymMatrix(DIM)>(*rhs.covariance()); } @@ -145,9 +140,7 @@ CurvilinearParametersT<DIM, T, S>::operator=( : nullptr; m_position = rhs.position(); m_momentum = rhs.momentum(); - m_surface.reset((rhs.m_surface && rhs.m_surface->isFree()) - ? rhs.m_surface->clone() - : rhs.m_surface.get()); + m_surface = rhs.m_surface; m_chargeDef = rhs.m_chargeDef; m_cIdentifier = rhs.m_cIdentifier; } @@ -194,7 +187,7 @@ template<int DIM, class T, class S> bool CurvilinearParametersT<DIM, T, S>::hasSurface() const { - return m_surface != nullptr; + return true; } /** Access to the Surface method */ @@ -202,7 +195,7 @@ template<int DIM, class T, class S> const S& CurvilinearParametersT<DIM, T, S>::associatedSurface() const { - return *m_surface; + return m_surface; } // equality operator @@ -371,7 +364,7 @@ Trk::CurvilinearParametersT<DIM, T, S>::updateParametersHelper( updatedParameters[Trk::loc2] * curvilinearFrame().curvV(); } // Reset also the surface - this->m_surface.reset(new S(this->m_position, curvilinearFrame())); + m_surface = S(this->m_position, curvilinearFrame()); } } // end of namespace Trk diff --git a/Tracking/TrkEvent/TrkParametersBase/TrkParametersBase/ParametersT.h b/Tracking/TrkEvent/TrkParametersBase/TrkParametersBase/ParametersT.h index 0c738abbcdb359e5bf3afe1f829798f83afa0de9..5f2f6c6518570b90dbc0931b496836701b71ba35 100644 --- a/Tracking/TrkEvent/TrkParametersBase/TrkParametersBase/ParametersT.h +++ b/Tracking/TrkEvent/TrkParametersBase/TrkParametersBase/ParametersT.h @@ -14,11 +14,6 @@ #include "TrkEventPrimitives/SurfaceUniquePtrT.h" #include "TrkParametersBase/ParametersBase.h" #include "TrkSurfaces/Surface.h" -/* - * Needed for persistency - * friends - */ - namespace Trk { class MaterialEffectsEngine;