diff --git a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/DistanceSolution.h b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/DistanceSolution.h index 60ee6ea87fed1f56e8807a616da6585214a3295f..d38c5f9e771410f817509915881c672c1128aeab 100644 --- a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/DistanceSolution.h +++ b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/DistanceSolution.h @@ -9,9 +9,7 @@ #ifndef TRKSURFACES_DISTANCESOLUTION_H #define TRKSURFACES_DISTANCESOLUTION_H -// STD -#include <iostream> -#include <math.h> +#include <cmath> namespace Trk { @@ -26,14 +24,19 @@ namespace Trk { class DistanceSolution { public: - /**Default Constructor*/ - DistanceSolution(); - - /**Constructor*/ - DistanceSolution(int num, double current = 0., bool signedDist = false, double first = 0., double second = 0.); - - /**Destructor*/ - virtual ~DistanceSolution() = default; + DistanceSolution() = default; + DistanceSolution(const DistanceSolution&) = default; + DistanceSolution(DistanceSolution&&) = default; + DistanceSolution& operator=(const DistanceSolution&) = default; + DistanceSolution& operator=(DistanceSolution&&) = default; + ~DistanceSolution() = default; + + /**Constructor*/ + DistanceSolution(int num, + double current = 0., + bool signedDist = false, + double first = 0., + double second = 0.); // methods to access solutions /** Number of intersection solutions*/ @@ -42,7 +45,8 @@ public: /** Distance to first intersection solution along direction*/ double first() const; - /** Distance to second intersection solution along direction (for a cylinder surface)*/ + /** Distance to second intersection solution along direction (for a cylinder + * surface)*/ double second() const; /** Absolute Distance to closest solution */ @@ -51,14 +55,15 @@ public: /** Distance to point of closest approach along direction*/ double toPointOfClosestApproach() const; - /** Current distance to surface (spatial), signed (along/opposite to surface normal) if input argument true (absolute - * value by default)*/ + /** Current distance to surface (spatial), signed (along/opposite to surface + * normal) if input argument true (absolute value by default)*/ double currentDistance(bool signedDist = false) const; - /** This method indicates availability of signed current distance (false for Perigee and StraighLineSurface) */ + /** This method indicates availability of signed current distance (false for + * Perigee and StraighLineSurface) */ bool signedDistance() const; -protected: +private: int m_num; double m_first; double m_second; @@ -66,54 +71,7 @@ protected: bool m_signedDist; }; -inline int -DistanceSolution::numberOfSolutions() const -{ - return m_num; -} - -inline double -DistanceSolution::first() const -{ - return m_first; -} - -inline double -DistanceSolution::second() const -{ - return m_second; -} - -inline double -DistanceSolution::absClosest() const -{ - if (m_num > 1) - return (m_first * m_first < m_second * m_second) ? fabs(m_first) : fabs(m_second); - else - return fabs(m_first); -} - -inline double -DistanceSolution::toPointOfClosestApproach() const -{ - return m_first; -} - -inline double -DistanceSolution::currentDistance(bool signedDist) const -{ - if (signedDist) - return m_current; - else - return fabs(m_current); -} - -inline bool -DistanceSolution::signedDistance() const -{ - return m_signedDist; -} - } // end of namespace +#include "TrkSurfaces/DistanceSolution.icc" #endif // TRKSURFACES_DISTANCESOLUTION_H diff --git a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/DistanceSolution.icc b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/DistanceSolution.icc new file mode 100644 index 0000000000000000000000000000000000000000..15ef7e32d23aef44aad1bbcc8319eae1f3bb6b93 --- /dev/null +++ b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/DistanceSolution.icc @@ -0,0 +1,69 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ +namespace Trk { +inline DistanceSolution::DistanceSolution(int num, + double current, + bool signedDist, + double first, + double second) + : m_num(num) + , m_first(first) + , m_second(second) + , m_current(current) + , m_signedDist(signedDist) +{} + +inline int +DistanceSolution::numberOfSolutions() const +{ + return m_num; +} + +inline double +DistanceSolution::first() const +{ + return m_first; +} + +inline double +DistanceSolution::second() const +{ + return m_second; +} + +inline double +DistanceSolution::absClosest() const +{ + if (m_num > 1) { + return (m_first * m_first < m_second * m_second) ? std::abs(m_first) + : std::abs(m_second); + } else { + return std::abs(m_first); + } +} + +inline double +DistanceSolution::toPointOfClosestApproach() const +{ + return m_first; +} + +inline double +DistanceSolution::currentDistance(bool signedDist) const +{ + if (signedDist) { + return m_current; + } else { + return std::abs(m_current); + } +} + +inline bool +DistanceSolution::signedDistance() const +{ + return m_signedDist; +} + +} // end of namespace + diff --git a/Tracking/TrkDetDescr/TrkSurfaces/src/DistanceSolution.cxx b/Tracking/TrkDetDescr/TrkSurfaces/src/DistanceSolution.cxx deleted file mode 100644 index a7d7a4cdf54896944a2b300672f0aa0f5635abf6..0000000000000000000000000000000000000000 --- a/Tracking/TrkDetDescr/TrkSurfaces/src/DistanceSolution.cxx +++ /dev/null @@ -1,28 +0,0 @@ -/* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration -*/ - -/////////////////////////////////////////////////////////////////// -// DistanceSolution.cxx, (c) ATLAS Detector Software -/////////////////////////////////////////////////////////////////// - -// Trk -#include "TrkSurfaces/DistanceSolution.h" - -// default constructor -Trk::DistanceSolution::DistanceSolution() - : m_num() - , m_first() - , m_second() - , m_current() - , m_signedDist() -{} - -// constructor -Trk::DistanceSolution::DistanceSolution(int num, double current, bool signedDist, double first, double second) - : m_num(num) - , m_first(first) - , m_second(second) - , m_current(current) - , m_signedDist(signedDist) -{}