diff --git a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/ConeSurface.h b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/ConeSurface.h index 084539784bc22ab1d8f8bd98d2d5c7dba66aa5c3..12d04e90de9fc94465c40b26da23e1ff78b186eb 100644 --- a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/ConeSurface.h +++ b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/ConeSurface.h @@ -184,8 +184,7 @@ public: /**Return method for surface normal information at a given local point, overwrites the normal() from base class.*/ - virtual const Amg::Vector3D* normal( - const Amg::Vector2D& locpo) const override; + virtual Amg::Vector3D normal(const Amg::Vector2D& locpo) const override final; /**Return method for the rotational symmetry axis - the z-Axis of the * HepTransform */ diff --git a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/ConeSurface.icc b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/ConeSurface.icc index 3d1d13d619c569e495854148133e5c9233b7060a..40495a72f3039680c9c8d3f29164728d67859ad6 100644 --- a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/ConeSurface.icc +++ b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/ConeSurface.icc @@ -119,7 +119,7 @@ ConeSurface::clone() const return new ConeSurface(*this); } -inline const Amg::Vector3D* +inline Amg::Vector3D ConeSurface::normal(const Amg::Vector2D& lp) const { // (cos phi cos alpha, sin phi cos alpha, sgn z sin alpha) @@ -128,7 +128,7 @@ ConeSurface::normal(const Amg::Vector2D& lp) const Amg::Vector3D localNormal(cos(phi) * bounds().cosAlpha(), sin(phi) * bounds().cosAlpha(), sgn * bounds().sinAlpha()); - return new Amg::Vector3D(transform().rotation() * localNormal); + return Amg::Vector3D(transform().rotation() * localNormal); } inline const ConeBounds& diff --git a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/CylinderSurface.h b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/CylinderSurface.h index a1284a9bffe4a2f633ae177cdd2b96e485a1d044..a5116a52f7c11df7c6e988d428b468befcf6365c 100644 --- a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/CylinderSurface.h +++ b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/CylinderSurface.h @@ -203,8 +203,7 @@ public: using Trk::Surface::normal; /**Return method for surface normal information at a given local point, overwrites the normal() from base class.*/ - virtual const Amg::Vector3D* normal( - const Amg::Vector2D& locpo) const override; + virtual Amg::Vector3D normal(const Amg::Vector2D& locpo) const override final; /**Return method for the rotational symmetry axis - the z-Axis of the * HepTransform */ diff --git a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/CylinderSurface.icc b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/CylinderSurface.icc index 34d40fd4300f9afa857da31665d0b9962e989bb7..a7a94dff0238dbf5231568f485f6dd976789aecb 100644 --- a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/CylinderSurface.icc +++ b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/CylinderSurface.icc @@ -121,12 +121,12 @@ CylinderSurface::clone() const return new CylinderSurface(*this); } -inline const Amg::Vector3D* +inline Amg::Vector3D CylinderSurface::normal(const Amg::Vector2D& lp) const { double phi = lp[Trk::locRPhi] / (bounds().r()); Amg::Vector3D localNormal(cos(phi), sin(phi), 0.); - return new Amg::Vector3D(transform().rotation() * localNormal); + return Amg::Vector3D(transform().rotation() * localNormal); } inline double @@ -138,7 +138,7 @@ CylinderSurface::pathCorrection(const Amg::Vector3D& pos, Amg::Vector3D pcT(pos.x() - center().x(), pos.y() - center().y(), 0.); Amg::Vector3D normalT(pcT.unit()); // transverse normal double cosAlpha = normalT.dot(mom.unit()); - return (cosAlpha != 0 ? fabs(1. / cosAlpha) + return (cosAlpha != 0 ? std::abs(1. / cosAlpha) : 1.); // ST undefined for cosAlpha=0 } diff --git a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/PerigeeSurface.h b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/PerigeeSurface.h index 63461bbd4b98eaaa901247859dc3b8796175e614..55869d9d8e5b7c00306d48eb895921088146b2b7 100644 --- a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/PerigeeSurface.h +++ b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/PerigeeSurface.h @@ -154,7 +154,7 @@ public: virtual const Amg::Vector3D& normal() const override final; /**Returns a normal vector at a specific localPosition*/ - virtual const Amg::Vector3D* normal(const Amg::Vector2D& lp) const override final; + virtual Amg::Vector3D normal(const Amg::Vector2D& lp) const override final; /** Return the measurement frame - this is needed for alignment, in particular for StraightLine and Perigee Surface diff --git a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/PerigeeSurface.icc b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/PerigeeSurface.icc index 288e9787802a04bbaa6cd14ece1c7a68a2f992dd..aef32c2c4d574f9005c03ac5c66d2a2ab9a7ae9b 100644 --- a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/PerigeeSurface.icc +++ b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/PerigeeSurface.icc @@ -126,10 +126,10 @@ PerigeeSurface::normal() const } -inline const Amg::Vector3D* +inline Amg::Vector3D PerigeeSurface::normal(const Amg::Vector2D&) const { - return new Amg::Vector3D(normal()); + return Amg::Vector3D(normal()); } inline bool diff --git a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/StraightLineSurface.icc b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/StraightLineSurface.icc index 2598522e2ae872e2abd5219c046571ef4c5dd9fe..de8fed7a8b1c85809bb914182ff656f62e427b0e 100644 --- a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/StraightLineSurface.icc +++ b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/StraightLineSurface.icc @@ -139,7 +139,7 @@ StraightLineSurface::insideBounds(const Amg::Vector2D& locpos, { if (!(m_bounds.get()) && !Surface::m_associatedDetElement) return true; - return (fabs(locpos[locR]) < bounds().r() + tol1 && + return (std::abs(locpos[locR]) < bounds().r() + tol1 && bounds().insideLoc2(locpos, tol2)); } diff --git a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/Surface.h b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/Surface.h index ec30928d5d05207d1c6ed830164adf65f3d57d0c..acddadc7bc39ddb2fb69d002fe8563dae246ed77 100644 --- a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/Surface.h +++ b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/Surface.h @@ -161,7 +161,7 @@ public: /** Returns a normal vector at a specific local position */ - virtual const Amg::Vector3D* normal(const Amg::Vector2D& lp) const; + virtual Amg::Vector3D normal(const Amg::Vector2D& lp) const; /** Returns a global reference point on the surface, for PlaneSurface, StraightLineSurface, PerigeeSurface this is equal to diff --git a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/Surface.icc b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/Surface.icc index f6f95384f4857f6d447ce6ef74821bdae765f187..ecf85d970a1eef0720265e428f1cea04222c30d1 100644 --- a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/Surface.icc +++ b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/Surface.icc @@ -84,7 +84,7 @@ Surface::pathCorrection(const Amg::Vector3D&, const Amg::Vector3D& mom) const { Amg::Vector3D dir(mom.unit()); double cosAlpha = dir.dot(normal()); - return (cosAlpha != 0 ? fabs(1. / cosAlpha) + return (cosAlpha != 0 ? std::abs(1. / cosAlpha) : 1.); // ST undefined for cosAlpha=0 } @@ -195,10 +195,10 @@ Surface::globalToLocal(const Amg::Vector3D& glopos, } // take local position and return global direction -inline const Amg::Vector3D* +inline Amg::Vector3D Surface::normal(const Amg::Vector2D&) const { - return new Amg::Vector3D(normal()); + return Amg::Vector3D(normal()); } inline const Amg::Vector3D& diff --git a/Tracking/TrkDetDescr/TrkVolumes/TrkVolumes/BoundaryCylinderSurface.h b/Tracking/TrkDetDescr/TrkVolumes/TrkVolumes/BoundaryCylinderSurface.h index 2fa158ef532e0da71d0b77dc126b0a6ee6b375b7..f1cadb688d86b7e6a0514b0518045b34420a9189 100755 --- a/Tracking/TrkDetDescr/TrkVolumes/TrkVolumes/BoundaryCylinderSurface.h +++ b/Tracking/TrkDetDescr/TrkVolumes/TrkVolumes/BoundaryCylinderSurface.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -21,56 +21,51 @@ namespace Trk { //class TrackParameters; class Volume; - /** + /** @class BoundaryCylinderSurface BoundaryCylinderSurface description inside the tracking realm, it extends the Surface description to make a surface being a boundary of a Trk::Volume - + @author Andreas.Salzburger@cern.ch */ - - template <class Tvol> class BoundaryCylinderSurface final: + + template <class Tvol> class BoundaryCylinderSurface final: virtual public BoundarySurface<Tvol>, public CylinderSurface { - + /** typedef the BinnedArray */ - typedef BinnedArray<Tvol> VolumeArray; + typedef BinnedArray<Tvol> VolumeArray; public: /** Default Constructor - needed for pool and inherited classes */ - BoundaryCylinderSurface(): - BoundarySurface<Tvol>(), - CylinderSurface() - {} - - /** Copy constructor */ - BoundaryCylinderSurface(const BoundaryCylinderSurface<Tvol>& bcs) : - BoundarySurface<Tvol>(bcs), - CylinderSurface(bcs) - {} - + BoundaryCylinderSurface() = default; + /** Copy constructor */ + BoundaryCylinderSurface(const BoundaryCylinderSurface<Tvol>& bcs) =default; + /** Assignment operator*/ + BoundaryCylinderSurface& operator=(const BoundaryCylinderSurface& vol) = default; + /**Virtual Destructor*/ + virtual ~BoundaryCylinderSurface() = default; + /** Constructor for a Boundary with exact two Volumes attached to it*/ BoundaryCylinderSurface(const Tvol* inside, const Tvol* outside, const CylinderSurface& csf) : BoundarySurface<Tvol>(inside, outside), CylinderSurface(csf) {} - + /** Constructor for a Boundary with two VolumeArrays attached to it*/ BoundaryCylinderSurface(SharedObject<VolumeArray> insideArray, SharedObject<VolumeArray> outsideArray, const CylinderSurface& csf) : BoundarySurface<Tvol>(insideArray, outsideArray), CylinderSurface(csf) - {} - + {} + /** Copy constructor with a shift */ BoundaryCylinderSurface(const Tvol* inside, const Tvol* outside, const CylinderSurface& csf, const Amg::Transform3D& tr) : BoundarySurface<Tvol>(inside,outside), CylinderSurface(csf,tr) {} - /**Virtual Destructor*/ - virtual ~BoundaryCylinderSurface() = default; /** Get the next Volume depending on the TrackParameters and the requested direction, gives back 0 if there's no volume attached to the requested @@ -90,19 +85,14 @@ class Volume; /** The Surface Representation of this */ virtual const Surface& surfaceRepresentation() const override final; - /**Assignment operator*/ - BoundaryCylinderSurface& operator=(const BoundaryCylinderSurface& vol); - - protected: - + }; -template <class Tvol> inline const Surface& BoundaryCylinderSurface<Tvol>::surfaceRepresentation() const { return *this; } // Hash include the inline functions #include "TrkVolumes/BoundaryCylinderSurface.icc" - + } // end of namespace Trk #endif // TRKVOLUMES_BOUNDARYCYLIMDERSURFACE_H diff --git a/Tracking/TrkDetDescr/TrkVolumes/TrkVolumes/BoundaryCylinderSurface.icc b/Tracking/TrkDetDescr/TrkVolumes/TrkVolumes/BoundaryCylinderSurface.icc index d75dcf25c57214df33027426663d6cfbb2929dde..1a47a9924d83ea282d6b12cf13c00568f3496d29 100755 --- a/Tracking/TrkDetDescr/TrkVolumes/TrkVolumes/BoundaryCylinderSurface.icc +++ b/Tracking/TrkDetDescr/TrkVolumes/TrkVolumes/BoundaryCylinderSurface.icc @@ -1,94 +1,79 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ -/////////////////////////////////////////////////////////////////// -// BoundaryCylinderSurface.icc, (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// - -template <class Tvol> inline BoundaryCylinderSurface<Tvol>& - BoundaryCylinderSurface<Tvol>::operator=(const BoundaryCylinderSurface<Tvol>& bcs) -{ - if (this!=&bcs){ - delete BoundarySurface<Tvol>::m_insideVolume; - delete BoundarySurface<Tvol>::m_outsideVolume; - delete Surface::m_transform; - delete Surface::m_center; - delete Surface::m_normal; - delete CylinderSurface::m_bounds; - BoundarySurface<Tvol>::m_insideVolume = bcs.m_insideVolume; - BoundarySurface<Tvol>::m_outsideVolume = bcs.m_outsideVolume; - BoundarySurface<Tvol>::m_insideVolumeArray = bcs.m_insideVolumeArray ; - BoundarySurface<Tvol>::m_outsideVolumeArray = bcs.m_outsideVolumeArray ; - Surface::m_transform = (bcs.m_transform) ? new Amg::Transform3D(*bcs.m_transform) : nullptr; - Surface::m_center = (bcs.m_center) ? new Amg::Vector3D(*bcs.m_center) : nullptr; - Surface::m_normal = (bcs.m_normal) ? new Amg::Vector3D(*bcs.m_normal) : nullptr ; - Surface::m_associatedDetElement = bcs.m_associatedDetElement; // copy by pointer as CylinderSurface does not have ownership - Surface::m_associatedDetElementId = bcs.m_associatedDetElementId; - m_bounds = bcs.m_bounds; - } - return *this; - -} - -template <class Tvol> inline const Tvol* BoundaryCylinderSurface<Tvol>::attachedVolume(const TrackParameters& parms, - PropDirection dir) const -{ - const Tvol* attVolume = nullptr; - // (ST) buggy line - assumes the parms are at this boundary surface ! - // const HepGeom::Vector3D<double>* localNormal = this->surfaceRepresentation().normal(parms.localPosition()); - // replacing with - const Amg::Vector2D* locPos = this->surfaceRepresentation().globalToLocal(parms.position()); - const Amg::Vector3D* localNormal = nullptr; - if (locPos) { - localNormal = this->surfaceRepresentation().normal(*locPos); - delete locPos; - } - if (!localNormal) return attVolume; - // (ST) end patch - - if ( (*localNormal).dot(dir*parms.momentum()) > 0.){ - attVolume = BoundarySurface<Tvol>::m_outsideVolume; - if (BoundarySurface<Tvol>::m_outsideVolumeArray.get()){ - attVolume = BoundarySurface<Tvol>::m_outsideVolumeArray.get()->object(parms.position()); - } - } else { - attVolume = BoundarySurface<Tvol>::m_insideVolume; - if (BoundarySurface<Tvol>::m_insideVolumeArray.get()){ - attVolume = BoundarySurface<Tvol>::m_insideVolumeArray.get()->object(parms.position()); - } - } - delete localNormal; - return attVolume; -} - -template <class Tvol> inline const Tvol* BoundaryCylinderSurface<Tvol>::attachedVolume(const Amg::Vector3D& pos, - const Amg::Vector3D& mom, - PropDirection dir) const -{ - const Tvol* attVolume = nullptr; - //const Amg::Vector2D* lp = CylinderSurface::globalToLocal(pos, 2.*Gaudi::Units::mm); // FIXME: previous call with 2mm hard coded tolerance, new interface doesn't allow setting tolerance - Amg::Vector2D* lp = new Amg::Vector2D; // FIXME: call without tolerance, check if still ok - CylinderSurface::globalToLocal(pos, pos, *lp); // FIXME: call without tolerance, check if still ok - - if (lp) - { const Amg::Vector3D* localNormal = CylinderSurface::normal(*lp); - delete lp; - if ( (*localNormal).dot(dir*mom) > 0.){ - attVolume = BoundarySurface<Tvol>::m_outsideVolume; - if (BoundarySurface<Tvol>::m_outsideVolumeArray.get()){ - attVolume = BoundarySurface<Tvol>::m_outsideVolumeArray.get()->object(pos); - } - } else { - attVolume = BoundarySurface<Tvol>::m_insideVolume; - if (BoundarySurface<Tvol>::m_insideVolumeArray.get()){ - attVolume = BoundarySurface<Tvol>::m_insideVolumeArray.get()->object(pos); - } - } - delete localNormal; - } - - return attVolume; -} - - +/////////////////////////////////////////////////////////////////// +// BoundaryCylinderSurface.icc, (c) ATLAS Detector software +/////////////////////////////////////////////////////////////////// + +template<class Tvol> +inline const Surface& +BoundaryCylinderSurface<Tvol>::surfaceRepresentation() const +{ + return *this; +} +template<class Tvol> +inline const Tvol* +BoundaryCylinderSurface<Tvol>::attachedVolume(const TrackParameters& parms, + PropDirection dir) const +{ + const Tvol* attVolume = nullptr; + auto locPos = std::unique_ptr<const Amg::Vector2D>( + this->surfaceRepresentation().globalToLocal(parms.position())); + Amg::Vector3D localNormal{}; + if (locPos) { + localNormal = this->surfaceRepresentation().normal(*locPos); + } else { + return attVolume; + } + + if (localNormal.dot(dir * parms.momentum()) > 0.) { + attVolume = BoundarySurface<Tvol>::m_outsideVolume; + if (BoundarySurface<Tvol>::m_outsideVolumeArray.get()) { + attVolume = BoundarySurface<Tvol>::m_outsideVolumeArray.get()->object( + parms.position()); + } + } else { + attVolume = BoundarySurface<Tvol>::m_insideVolume; + if (BoundarySurface<Tvol>::m_insideVolumeArray.get()) { + attVolume = BoundarySurface<Tvol>::m_insideVolumeArray.get()->object( + parms.position()); + } + } + return attVolume; +} + +template<class Tvol> +inline const Tvol* +BoundaryCylinderSurface<Tvol>::attachedVolume(const Amg::Vector3D& pos, + const Amg::Vector3D& mom, + PropDirection dir) const +{ + const Tvol* attVolume = nullptr; + // const Amg::Vector2D* lp = + // CylinderSurface::globalToLocal(pos, 2.*Gaudi::Units::mm); + Amg::Vector2D lp{}; + // The new interface returns true or false , based on internal tolerance + // there is not nullptr to check. + const bool intol = CylinderSurface::globalToLocal(pos, pos, lp); + + if (intol) { + Amg::Vector3D localNormal = CylinderSurface::normal(lp); + if (localNormal.dot(dir * mom) > 0.) { + attVolume = BoundarySurface<Tvol>::m_outsideVolume; + if (BoundarySurface<Tvol>::m_outsideVolumeArray.get()) { + attVolume = + BoundarySurface<Tvol>::m_outsideVolumeArray.get()->object(pos); + } + } else { + attVolume = BoundarySurface<Tvol>::m_insideVolume; + if (BoundarySurface<Tvol>::m_insideVolumeArray.get()) { + attVolume = + BoundarySurface<Tvol>::m_insideVolumeArray.get()->object(pos); + } + } + } + + return attVolume; +} + diff --git a/Tracking/TrkDetDescr/TrkVolumes/TrkVolumes/BoundaryDiscSurface.h b/Tracking/TrkDetDescr/TrkVolumes/TrkVolumes/BoundaryDiscSurface.h index 2e4e32b35fc1c5cb16394c661d238025f0ae78ce..48bd6de49c418f35a304890fda4091ef6b8a78b7 100755 --- a/Tracking/TrkDetDescr/TrkVolumes/TrkVolumes/BoundaryDiscSurface.h +++ b/Tracking/TrkDetDescr/TrkVolumes/TrkVolumes/BoundaryDiscSurface.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -24,48 +24,49 @@ namespace Trk { //class TrackParameters; class Volume; - /** + /** @class BoundaryDiscSurface BoundaryDiscSurface description inside the tracking realm, it extends the DiscSurface description to make a surface being a boundary of a - Trk::Volume (used for cylindrical shape). - It inherits from BoundarySurface to get the interface of boundaries. - - @author Andreas.Salzburger@cern.ch + Trk::Volume (used for cylindrical shape). + It inherits from BoundarySurface to get the interface of boundaries. + + @author Andreas.Salzburger@cern.ch */ - - template <class Tvol> class BoundaryDiscSurface final: + + template <class Tvol> class BoundaryDiscSurface final: virtual public BoundarySurface<Tvol>, public DiscSurface { - + /** typedef the BinnedArray */ - typedef BinnedArray<Tvol> VolumeArray; + typedef BinnedArray<Tvol> VolumeArray; public: /** Default Constructor - needed for pool and inherited classes */ - BoundaryDiscSurface(): - BoundarySurface<Tvol>(), - DiscSurface() - {} - - /** Copy constructor */ - BoundaryDiscSurface(const BoundaryDiscSurface<Tvol>& bds) : - BoundarySurface<Tvol>(bds), - DiscSurface(bds) - {} - + BoundaryDiscSurface() = default; + + /** Copy constructor */ + BoundaryDiscSurface(const BoundaryDiscSurface<Tvol>& bds) = default; + + /**Assignment operator*/ + BoundaryDiscSurface& operator=(const BoundaryDiscSurface& vol) = default; + + /**Virtual Destructor*/ + virtual ~BoundaryDiscSurface() = default; + + /** Constructor for a Boundary with exact two Volumes attached to it*/ BoundaryDiscSurface(const Tvol* inside, const Tvol* outside, const DiscSurface& dsf) : BoundarySurface<Tvol>(inside, outside), DiscSurface(dsf) {} - + /** Constructor for a Boundary with two VolumeArrays attached to it*/ BoundaryDiscSurface(SharedObject<VolumeArray> insideArray, SharedObject<VolumeArray> outsideArray, const DiscSurface& dsf) : BoundarySurface<Tvol>(insideArray, outsideArray), DiscSurface(dsf) {} - + /** Copy constructor with a shift */ BoundaryDiscSurface(const Tvol* inside, const Tvol* outside, const DiscSurface& dsf, const Amg::Transform3D& tr) : BoundarySurface<Tvol>(inside,outside), @@ -90,21 +91,12 @@ class Volume; /** The Surface Representation of this */ virtual const Surface& surfaceRepresentation() const override final; - /**Virtual Destructor*/ - virtual ~BoundaryDiscSurface() = default; - - /**Assignment operator*/ - BoundaryDiscSurface& operator=(const BoundaryDiscSurface& vol); - - protected: - }; -template <class Tvol> inline const Surface& BoundaryDiscSurface<Tvol>::surfaceRepresentation() const { return *this; } // Hash include inline functions #include "TrkVolumes/BoundaryDiscSurface.icc" - + } // end of namespace Trk #endif // TRKVOLUMES_BOUNDARYDISCSURFACE_H diff --git a/Tracking/TrkDetDescr/TrkVolumes/TrkVolumes/BoundaryDiscSurface.icc b/Tracking/TrkDetDescr/TrkVolumes/TrkVolumes/BoundaryDiscSurface.icc index 453f9da8e630925ebea2554dea5e1a11146adda5..ab320c4ffb191fa47640c5373982ae596e656cd2 100755 --- a/Tracking/TrkDetDescr/TrkVolumes/TrkVolumes/BoundaryDiscSurface.icc +++ b/Tracking/TrkDetDescr/TrkVolumes/TrkVolumes/BoundaryDiscSurface.icc @@ -1,72 +1,59 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ -/////////////////////////////////////////////////////////////////// -// BoundaryDiscSurface.icc, (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// - - -template <class Tvol> inline BoundaryDiscSurface<Tvol>& - BoundaryDiscSurface<Tvol>::operator=(const BoundaryDiscSurface& bds) -{ - if (this!=&bds){ - delete BoundarySurface<Tvol>::m_insideVolume; - delete BoundarySurface<Tvol>::m_outsideVolume; - delete Surface::m_transform; - delete Surface::m_center; - delete Surface::m_normal; - delete DiscSurface::m_bounds; - BoundarySurface<Tvol>::m_insideVolume = bds.m_insideVolume; - BoundarySurface<Tvol>::m_outsideVolume = bds.m_outsideVolume; - BoundarySurface<Tvol>::m_insideVolumeArray = bds.m_insideVolumeArray; - BoundarySurface<Tvol>::m_outsideVolumeArray = bds.m_outsideVolumeArray; - Surface::m_transform = (bds.m_transform) ? new Amg::Transform3D(*bds.m_transform) : nullptr; - Surface::m_center = (bds.m_center) ? new Amg::Vector3D(*bds.m_center) : nullptr; - Surface::m_normal = (bds.m_normal) ? new Amg::Vector3D(*bds.m_normal) : nullptr ; - Surface::m_associatedDetElement = bds.m_associatedDetElement; // copy by pointer as DiscSurface does not have ownership - Surface::m_associatedDetElementId = bds.m_associatedDetElementId; - m_bounds = bds.m_bounds; - } - return *this; - -} - -template <class Tvol> inline const Tvol* BoundaryDiscSurface<Tvol>::attachedVolume(const TrackParameters& parms, - PropDirection dir) const -{ - const Tvol* attVolume = nullptr; - if ((this->surfaceRepresentation().normal()).dot(dir*parms.momentum()) > 0.){ - attVolume = BoundarySurface<Tvol>::m_outsideVolume; - if (BoundarySurface<Tvol>::m_outsideVolumeArray.get()){ - attVolume = BoundarySurface<Tvol>::m_outsideVolumeArray.get()->object(parms.position()); - } - } else { - attVolume = BoundarySurface<Tvol>::m_insideVolume; - if (BoundarySurface<Tvol>::m_insideVolumeArray.get()){ - attVolume = BoundarySurface<Tvol>::m_insideVolumeArray.get()->object(parms.position()); - } - } - return attVolume; -} - -template <class Tvol> inline const Tvol* BoundaryDiscSurface<Tvol>::attachedVolume(const Amg::Vector3D& pos, - const Amg::Vector3D& mom, - PropDirection dir) const -{ - const Tvol* attVolume = nullptr; - if ( (this->surfaceRepresentation().normal()).dot(dir*mom) > 0.){ - attVolume = BoundarySurface<Tvol>::m_outsideVolume; - if (BoundarySurface<Tvol>::m_outsideVolumeArray.get()){ - attVolume = BoundarySurface<Tvol>::m_outsideVolumeArray.get()->object(pos); - } - } else { - attVolume = BoundarySurface<Tvol>::m_insideVolume; - if (BoundarySurface<Tvol>::m_insideVolumeArray.get()){ - attVolume = BoundarySurface<Tvol>::m_insideVolumeArray.get()->object(pos); - } - } - return attVolume; -} - - +/////////////////////////////////////////////////////////////////// +// BoundaryDiscSurface.icc, (c) ATLAS Detector software +/////////////////////////////////////////////////////////////////// + +template<class Tvol> +inline const Surface& +BoundaryDiscSurface<Tvol>::surfaceRepresentation() const +{ + return *this; +} +template<class Tvol> +inline const Tvol* +BoundaryDiscSurface<Tvol>::attachedVolume(const TrackParameters& parms, + PropDirection dir) const +{ + const Tvol* attVolume = nullptr; + if ((this->surfaceRepresentation().normal()).dot(dir * parms.momentum()) > + 0.) { + attVolume = BoundarySurface<Tvol>::m_outsideVolume; + if (BoundarySurface<Tvol>::m_outsideVolumeArray.get()) { + attVolume = BoundarySurface<Tvol>::m_outsideVolumeArray.get()->object( + parms.position()); + } + } else { + attVolume = BoundarySurface<Tvol>::m_insideVolume; + if (BoundarySurface<Tvol>::m_insideVolumeArray.get()) { + attVolume = BoundarySurface<Tvol>::m_insideVolumeArray.get()->object( + parms.position()); + } + } + return attVolume; +} + +template<class Tvol> +inline const Tvol* +BoundaryDiscSurface<Tvol>::attachedVolume(const Amg::Vector3D& pos, + const Amg::Vector3D& mom, + PropDirection dir) const +{ + const Tvol* attVolume = nullptr; + if ((this->surfaceRepresentation().normal()).dot(dir * mom) > 0.) { + attVolume = BoundarySurface<Tvol>::m_outsideVolume; + if (BoundarySurface<Tvol>::m_outsideVolumeArray.get()) { + attVolume = + BoundarySurface<Tvol>::m_outsideVolumeArray.get()->object(pos); + } + } else { + attVolume = BoundarySurface<Tvol>::m_insideVolume; + if (BoundarySurface<Tvol>::m_insideVolumeArray.get()) { + attVolume = BoundarySurface<Tvol>::m_insideVolumeArray.get()->object(pos); + } + } + return attVolume; +} + diff --git a/Tracking/TrkDetDescr/TrkVolumes/TrkVolumes/BoundaryPlaneSurface.h b/Tracking/TrkDetDescr/TrkVolumes/TrkVolumes/BoundaryPlaneSurface.h index c56d5f389a69d2fac569c4bacd6f8eb4aa3bdb24..4b53f34c24f8a7da0b91fc4b768c2f4b09ee0c3e 100755 --- a/Tracking/TrkDetDescr/TrkVolumes/TrkVolumes/BoundaryPlaneSurface.h +++ b/Tracking/TrkDetDescr/TrkVolumes/TrkVolumes/BoundaryPlaneSurface.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -23,36 +23,36 @@ namespace Trk { //class TrackParameters; class Volume; - /** + /** @class BoundaryPlaneSurface BoundaryPlaneSurface description inside the tracking realm, it extends the PlaneSurface description to make a surface being a boundary of a Trk::Volume (used for all volume shapes). - It inherits from BoundarySurface to get the interface of boundaries. - - @author Andreas.Salzburger@cern.ch + It inherits from BoundarySurface to get the interface of boundaries. + + @author Andreas.Salzburger@cern.ch */ - - template <class Tvol> class BoundaryPlaneSurface final: + + template <class Tvol> class BoundaryPlaneSurface final: virtual public BoundarySurface<Tvol>, public PlaneSurface { /** typedef the BinnedArray */ - typedef BinnedArray<Tvol> VolumeArray; + typedef BinnedArray<Tvol> VolumeArray; public: /** Default Constructor - needed for pool and inherited classes */ - BoundaryPlaneSurface() : - BoundarySurface<Tvol>(), - PlaneSurface() - {} - - /** Copy constructor */ - BoundaryPlaneSurface(const BoundaryPlaneSurface<Tvol>& bps) : - BoundarySurface<Tvol>(bps), - PlaneSurface(bps) - {} - + BoundaryPlaneSurface() = default; + + /** Copy constructor */ + BoundaryPlaneSurface(const BoundaryPlaneSurface<Tvol>& bps) = default; + + /**Assignment operator*/ + BoundaryPlaneSurface& operator=(const BoundaryPlaneSurface& vol) = default; + + /**Virtual Destructor*/ + virtual ~BoundaryPlaneSurface() = default; + /** Constructor for a Boundary with exact two Volumes attached to it*/ BoundaryPlaneSurface(const Tvol* inside, const Tvol* outside, const PlaneSurface& psf) : BoundarySurface<Tvol>(inside, outside), @@ -64,7 +64,7 @@ class Volume; BoundarySurface<Tvol>(insideArray, outsideArray), PlaneSurface(psf) {} - + /** Copy constructor with a shift */ BoundaryPlaneSurface(const Tvol* inside, const Tvol* outside, const PlaneSurface& psf, const Amg::Transform3D& tr) : BoundarySurface<Tvol>(inside,outside), @@ -87,21 +87,13 @@ class Volume; /** The Surface Representation of this */ virtual const Surface& surfaceRepresentation() const override final; - /**Virtual Destructor*/ - virtual ~BoundaryPlaneSurface() = default; - /**Assignment operator*/ - BoundaryPlaneSurface& operator=(const BoundaryPlaneSurface& vol); - - protected: - }; -template <class Tvol> inline const Surface& BoundaryPlaneSurface<Tvol>::surfaceRepresentation() const { return *this; } // Hash include inline functions #include "TrkVolumes/BoundaryPlaneSurface.icc" - + } // end of namespace Trk #endif // TRKVOLUMES_BOUNDARYPLANESURFACE_H diff --git a/Tracking/TrkDetDescr/TrkVolumes/TrkVolumes/BoundaryPlaneSurface.icc b/Tracking/TrkDetDescr/TrkVolumes/TrkVolumes/BoundaryPlaneSurface.icc index fe0b8461c6c247ea3eef0dda53865fe4f72b84e2..a050722ff3a32afd5297d30e189fcce6eaddbc03 100755 --- a/Tracking/TrkDetDescr/TrkVolumes/TrkVolumes/BoundaryPlaneSurface.icc +++ b/Tracking/TrkDetDescr/TrkVolumes/TrkVolumes/BoundaryPlaneSurface.icc @@ -1,70 +1,59 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ -/////////////////////////////////////////////////////////////////// -// BoundaryPlaneSurface.icc, (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// - - -template <class Tvol> inline BoundaryPlaneSurface<Tvol>& - BoundaryPlaneSurface<Tvol>::operator=(const BoundaryPlaneSurface<Tvol>& bps) -{ - if (this!=&bps){ - delete BoundarySurface<Tvol>::m_insideVolume; - delete BoundarySurface<Tvol>::m_outsideVolume; - delete Surface::m_transform; - delete Surface::m_center; - delete Surface::m_normal; - delete PlaneSurface::m_bounds; - BoundarySurface<Tvol>::m_insideVolume = bps.m_insideVolume; - BoundarySurface<Tvol>::m_outsideVolume = bps.m_outsideVolume; - BoundarySurface<Tvol>::m_insideVolumeArray = bps.m_insideVolumeArray; - BoundarySurface<Tvol>::m_outsideVolumeArray = bps.m_outsideVolumeArray; - Surface::m_transform = (bps.m_transform) ? new Amg::Transform3D(*bps.m_transform) : nullptr; - Surface::m_center = (bps.m_center) ? new Amg::Vector3D(*bps.m_center) : nullptr; - Surface::m_normal = (bps.m_normal) ? new Amg::Vector3D(*bps.m_normal) : nullptr ; - Surface::m_associatedDetElement = bps.m_associatedDetElement; // copy by pointer as PlaneSurface does not have ownership - Surface::m_associatedDetElementId = bps.m_associatedDetElementId; - m_bounds = bps.m_bounds; - } - return *this; - -} - -template <class Tvol> inline const Tvol* BoundaryPlaneSurface<Tvol>::attachedVolume(const TrackParameters& parms, PropDirection dir) const -{ - const Tvol* attVolume = nullptr; - if ( (this->surfaceRepresentation().normal()).dot(dir*parms.momentum()) > 0.){ - attVolume = BoundarySurface<Tvol>::m_outsideVolume; - if (BoundarySurface<Tvol>::m_outsideVolumeArray.get()){ - attVolume = BoundarySurface<Tvol>::m_outsideVolumeArray.get()->object(parms.localPosition()); - } - } else { - attVolume = BoundarySurface<Tvol>::m_insideVolume; - if (BoundarySurface<Tvol>::m_insideVolumeArray.get()){ - attVolume = BoundarySurface<Tvol>::m_insideVolumeArray.get()->object(parms.localPosition()); - } - } - return attVolume; -} - -template <class Tvol> inline const Tvol* BoundaryPlaneSurface<Tvol>::attachedVolume(const Amg::Vector3D& pos, - const Amg::Vector3D& mom, - PropDirection dir) const -{ - const Tvol* attVolume = nullptr; - if ( (this->surfaceRepresentation().normal()).dot(dir*mom) > 0.){ - attVolume = BoundarySurface<Tvol>::m_outsideVolume; - if (BoundarySurface<Tvol>::m_outsideVolumeArray.get()){ - attVolume = BoundarySurface<Tvol>::m_outsideVolumeArray.get()->object(pos); - } - } else { - attVolume = BoundarySurface<Tvol>::m_insideVolume; - if (BoundarySurface<Tvol>::m_insideVolumeArray.get()){ - attVolume = BoundarySurface<Tvol>::m_insideVolumeArray.get()->object(pos); - } - } - return attVolume; -} - +/////////////////////////////////////////////////////////////////// +// BoundaryPlaneSurface.icc, (c) ATLAS Detector software +/////////////////////////////////////////////////////////////////// + +template<class Tvol> +inline const Surface& +BoundaryPlaneSurface<Tvol>::surfaceRepresentation() const +{ + return *this; +} +template<class Tvol> +inline const Tvol* +BoundaryPlaneSurface<Tvol>::attachedVolume(const TrackParameters& parms, + PropDirection dir) const +{ + const Tvol* attVolume = nullptr; + if ((this->surfaceRepresentation().normal()).dot(dir * parms.momentum()) > + 0.) { + attVolume = BoundarySurface<Tvol>::m_outsideVolume; + if (BoundarySurface<Tvol>::m_outsideVolumeArray.get()) { + attVolume = BoundarySurface<Tvol>::m_outsideVolumeArray.get()->object( + parms.localPosition()); + } + } else { + attVolume = BoundarySurface<Tvol>::m_insideVolume; + if (BoundarySurface<Tvol>::m_insideVolumeArray.get()) { + attVolume = BoundarySurface<Tvol>::m_insideVolumeArray.get()->object( + parms.localPosition()); + } + } + return attVolume; +} + +template<class Tvol> +inline const Tvol* +BoundaryPlaneSurface<Tvol>::attachedVolume(const Amg::Vector3D& pos, + const Amg::Vector3D& mom, + PropDirection dir) const +{ + const Tvol* attVolume = nullptr; + if ((this->surfaceRepresentation().normal()).dot(dir * mom) > 0.) { + attVolume = BoundarySurface<Tvol>::m_outsideVolume; + if (BoundarySurface<Tvol>::m_outsideVolumeArray.get()) { + attVolume = + BoundarySurface<Tvol>::m_outsideVolumeArray.get()->object(pos); + } + } else { + attVolume = BoundarySurface<Tvol>::m_insideVolume; + if (BoundarySurface<Tvol>::m_insideVolumeArray.get()) { + attVolume = BoundarySurface<Tvol>::m_insideVolumeArray.get()->object(pos); + } + } + return attVolume; +} + diff --git a/Tracking/TrkDetDescr/TrkVolumes/TrkVolumes/BoundarySubtractedCylinderSurface.h b/Tracking/TrkDetDescr/TrkVolumes/TrkVolumes/BoundarySubtractedCylinderSurface.h index c4dc325cd426977b7a4828d5f3552eccb0df906e..932e135091cf97ffcd23400337c3c6cbe5e9d0e9 100755 --- a/Tracking/TrkDetDescr/TrkVolumes/TrkVolumes/BoundarySubtractedCylinderSurface.h +++ b/Tracking/TrkDetDescr/TrkVolumes/TrkVolumes/BoundarySubtractedCylinderSurface.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -22,56 +22,54 @@ namespace Trk { //class TrackParameters; class Volume; - /** + /** @class BoundarySubtractedCylinderSurface BoundarySubtractedCylinderSurface description inside the tracking realm, it extends the Surface description to make a surface being a boundary of a Trk::Volume - + @author Andreas.Salzburger@cern.ch */ - - template <class Tvol> class BoundarySubtractedCylinderSurface final: + + template <class Tvol> class BoundarySubtractedCylinderSurface final: virtual public BoundarySurface<Tvol>, public SubtractedCylinderSurface { - + /** typedef the BinnedArray */ - typedef BinnedArray<Tvol> VolumeArray; + typedef BinnedArray<Tvol> VolumeArray; public: /** Default Constructor - needed for pool and inherited classes */ - BoundarySubtractedCylinderSurface(): - BoundarySurface<Tvol>(), - SubtractedCylinderSurface() - {} - - /** Copy constructor */ - BoundarySubtractedCylinderSurface(const BoundarySubtractedCylinderSurface<Tvol>& bcs) : - BoundarySurface<Tvol>(bcs), - SubtractedCylinderSurface(bcs) - {} - + BoundarySubtractedCylinderSurface() = default; + + /** Copy constructor */ + BoundarySubtractedCylinderSurface(const BoundarySubtractedCylinderSurface<Tvol>& bcs) = default; + + /**Virtual Destructor*/ + virtual ~BoundarySubtractedCylinderSurface() = default; + + /**Assignment operator*/ + BoundarySubtractedCylinderSurface& operator=(const BoundarySubtractedCylinderSurface& vol) = default; + /** Constructor for a Boundary with exact two Volumes attached to it*/ BoundarySubtractedCylinderSurface(const Tvol* inside, const Tvol* outside, const SubtractedCylinderSurface& csf) : BoundarySurface<Tvol>(inside, outside), SubtractedCylinderSurface(csf) - {} - + {} + /** Constructor for a Boundary with two VolumeArrays attached to it*/ BoundarySubtractedCylinderSurface(SharedObject<VolumeArray> insideArray, SharedObject<VolumeArray> outsideArray, const SubtractedCylinderSurface& csf) : BoundarySurface<Tvol>(insideArray, outsideArray), SubtractedCylinderSurface(csf) - {} - + {} + /** Copy constructor with a shift */ BoundarySubtractedCylinderSurface(const Tvol* inside, const Tvol* outside, const SubtractedCylinderSurface& csf, const Amg::Transform3D& tr) : BoundarySurface<Tvol>(inside,outside), SubtractedCylinderSurface(csf,tr) - {} - - /**Virtual Destructor*/ - virtual ~BoundarySubtractedCylinderSurface() = default; - + {} + + /** Get the next Volume depending on the TrackParameters and the requested direction, gives back 0 if there's no volume attached to the requested direction - this is speed optimized as it doesn't invoke a local to global transformation @@ -88,19 +86,13 @@ class Volume; /** The Surface Representation of this */ virtual const Surface& surfaceRepresentation() const override final; - /**Assignment operator*/ - BoundarySubtractedCylinderSurface& operator=(const BoundarySubtractedCylinderSurface& vol); - - protected: - }; -template <class Tvol> inline const Surface& BoundarySubtractedCylinderSurface<Tvol>::surfaceRepresentation() const { return *this; } // Hash include the inline functions #include "TrkVolumes/BoundarySubtractedCylinderSurface.icc" - + } // end of namespace Trk #endif // TRKVOLUMES_BOUNDARYSUBTRACTEDCYLINDERSURFACE_H diff --git a/Tracking/TrkDetDescr/TrkVolumes/TrkVolumes/BoundarySubtractedCylinderSurface.icc b/Tracking/TrkDetDescr/TrkVolumes/TrkVolumes/BoundarySubtractedCylinderSurface.icc index c2372c1e88c351737dee5d8281a8748a9beb908c..6ad218443dc94c17345d7ff91ebaa561d0ceda7a 100755 --- a/Tracking/TrkDetDescr/TrkVolumes/TrkVolumes/BoundarySubtractedCylinderSurface.icc +++ b/Tracking/TrkDetDescr/TrkVolumes/TrkVolumes/BoundarySubtractedCylinderSurface.icc @@ -1,93 +1,79 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ -/////////////////////////////////////////////////////////////////// -// BoundarySubtractedCylinderSurface.icc, (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// - -template <class Tvol> inline BoundarySubtractedCylinderSurface<Tvol>& - BoundarySubtractedCylinderSurface<Tvol>::operator=(const BoundarySubtractedCylinderSurface<Tvol>& bcs) -{ - if (this!=&bcs){ - delete BoundarySurface<Tvol>::m_insideVolume; - delete BoundarySurface<Tvol>::m_outsideVolume; - BoundarySurface<Tvol>::m_insideVolumeArray.remRef(); - BoundarySurface<Tvol>::m_outsideVolumeArray.remRef(); - delete Surface::m_transform; - delete Surface::m_center; - delete Surface::m_normal; - delete SubtractedCylinderSurface::m_bounds; - BoundarySurface<Tvol>::m_insideVolume = bcs.m_insideVolume; - BoundarySurface<Tvol>::m_outsideVolume = bcs.m_outsideVolume; - BoundarySurface<Tvol>::m_insideVolumeArray = bcs.m_insideVolumeArray; - BoundarySurface<Tvol>::m_outsideVolumeArray = bcs.m_outsideVolumeArray; - Surface::m_transform = (bcs.m_transform) ? new Amg::Transform3D(*bcs.m_transform) : nullptr; - Surface::m_center = (bcs.m_center) ? new Amg::Vector3D(*bcs.m_center) : nullptr; - Surface::m_normal = (bcs.m_normal) ? new Amg::Vector3D(*bcs.m_normal) : nullptr ; - Surface::m_associatedDetElement = bcs.m_associatedDetElement; // copy by pointer as CylinderSurface does not have ownership - Surface::m_associatedDetElementId = bcs.m_associatedDetElementId; - m_bounds = bcs.m_bounds->clone(); - } - return *this; - -} - -template <class Tvol> inline const Tvol* BoundarySubtractedCylinderSurface<Tvol>::attachedVolume(const TrackParameters& parms, - PropDirection dir) const -{ - const Tvol* attVolume = nullptr; - // (ST) buggy line - assumes the parms are at this boundary surface ! - // const HepGeom::Vector3D<double>* localNormal = this->surfaceRepresentation().normal(parms.localPosition()); - // replacing with - const Amg::Vector2D* locPos = this->surfaceRepresentation().globalToLocal(parms.position()); - const Amg::Vector3D* localNormal = nullptr; - if (locPos) { - localNormal = this->surfaceRepresentation().normal(*locPos); - delete locPos; - } - if (!localNormal) return attVolume; - // (ST) end patch - - if ( (*localNormal).dot(dir*parms.momentum()) > 0.){ - attVolume = BoundarySurface<Tvol>::m_outsideVolume; - if (BoundarySurface<Tvol>::m_outsideVolumeArray.get()){ - attVolume = BoundarySurface<Tvol>::m_outsideVolumeArray.get()->object(parms.position()); - } - } else { - attVolume = BoundarySurface<Tvol>::m_insideVolume; - if (BoundarySurface<Tvol>::m_insideVolumeArray.get()){ - attVolume = BoundarySurface<Tvol>::m_insideVolumeArray.get()->object(parms.position()); - } - } - delete localNormal; - return attVolume; -} - -template <class Tvol> inline const Tvol* BoundarySubtractedCylinderSurface<Tvol>::attachedVolume(const Amg::Vector3D& pos, - const Amg::Vector3D& mom, - PropDirection dir) const -{ - const Tvol* attVolume = nullptr; - const Amg::Vector2D* lp = Surface::globalToLocal(pos, 2.); - if (lp) - { const Amg::Vector3D* localNormal = CylinderSurface::normal(*lp); - delete lp; - if ( (*localNormal).dot(dir*mom) > 0.){ - attVolume = BoundarySurface<Tvol>::m_outsideVolume; - if (BoundarySurface<Tvol>::m_outsideVolumeArray.get()){ - attVolume = BoundarySurface<Tvol>::m_outsideVolumeArray.get()->object(pos); - } - } else { - attVolume = BoundarySurface<Tvol>::m_insideVolume; - if (BoundarySurface<Tvol>::m_insideVolumeArray.get()){ - attVolume = BoundarySurface<Tvol>::m_insideVolumeArray.get()->object(pos); - } - } - delete localNormal; - } - - return attVolume; -} - - +/////////////////////////////////////////////////////////////////// +// BoundarySubtractedCylinderSurface.icc, (c) ATLAS Detector software +/////////////////////////////////////////////////////////////////// + +template<class Tvol> +inline const Surface& +BoundarySubtractedCylinderSurface<Tvol>::surfaceRepresentation() const +{ + return *this; +} +template<class Tvol> +inline const Tvol* +BoundarySubtractedCylinderSurface<Tvol>::attachedVolume( + const TrackParameters& parms, + PropDirection dir) const +{ + const Tvol* attVolume = nullptr; + // (ST) buggy line - assumes the parms are at this boundary surface ! + // const HepGeom::Vector3D<double>* localNormal = + // this->surfaceRepresentation().normal(parms.localPosition()); replacing with + auto locPos = std::unique_ptr<const Amg::Vector2D>( + this->surfaceRepresentation().globalToLocal(parms.position())); + Amg::Vector3D localNormal{}; + if (locPos) { + localNormal = this->surfaceRepresentation().normal(*locPos); + } else { + return attVolume; + } + // (ST) end patch + + if (localNormal.dot(dir * parms.momentum()) > 0.) { + attVolume = BoundarySurface<Tvol>::m_outsideVolume; + if (BoundarySurface<Tvol>::m_outsideVolumeArray.get()) { + attVolume = BoundarySurface<Tvol>::m_outsideVolumeArray.get()->object( + parms.position()); + } + } else { + attVolume = BoundarySurface<Tvol>::m_insideVolume; + if (BoundarySurface<Tvol>::m_insideVolumeArray.get()) { + attVolume = BoundarySurface<Tvol>::m_insideVolumeArray.get()->object( + parms.position()); + } + } + return attVolume; +} + +template<class Tvol> +inline const Tvol* +BoundarySubtractedCylinderSurface<Tvol>::attachedVolume( + const Amg::Vector3D& pos, + const Amg::Vector3D& mom, + PropDirection dir) const +{ + const Tvol* attVolume = nullptr; + auto lp = + std::unique_ptr<const Amg::Vector2D>(Surface::globalToLocal(pos, 2.)); + if (lp) { + const Amg::Vector3D localNormal = CylinderSurface::normal(*lp); + if (localNormal.dot(dir * mom) > 0.) { + attVolume = BoundarySurface<Tvol>::m_outsideVolume; + if (BoundarySurface<Tvol>::m_outsideVolumeArray.get()) { + attVolume = + BoundarySurface<Tvol>::m_outsideVolumeArray.get()->object(pos); + } + } else { + attVolume = BoundarySurface<Tvol>::m_insideVolume; + if (BoundarySurface<Tvol>::m_insideVolumeArray.get()) { + attVolume = + BoundarySurface<Tvol>::m_insideVolumeArray.get()->object(pos); + } + } + } + return attVolume; +} + diff --git a/Tracking/TrkDetDescr/TrkVolumes/TrkVolumes/BoundarySubtractedPlaneSurface.h b/Tracking/TrkDetDescr/TrkVolumes/TrkVolumes/BoundarySubtractedPlaneSurface.h index c4b4993d67156c1a6902444b299d1b8b31fe0683..93ac25a12e26125a976cc42d4ed7656e0e4987f8 100755 --- a/Tracking/TrkDetDescr/TrkVolumes/TrkVolumes/BoundarySubtractedPlaneSurface.h +++ b/Tracking/TrkDetDescr/TrkVolumes/TrkVolumes/BoundarySubtractedPlaneSurface.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -22,48 +22,47 @@ namespace Trk { //class TrackParameters; class Volume; - /** + /** @class BoundarySubtractedPlaneSurface BoundarySubtractedPlaneSurface description inside the tracking realm, it extends the SubtractedPlaneSurface description to make a surface being a boundary of a Trk::Volume (used for all volume shapes). - It inherits from BoundarySurface to get the interface of boundaries. - - @author Sarka.Todorova@cern.ch + It inherits from BoundarySurface to get the interface of boundaries. + + @author Sarka.Todorova@cern.ch */ - - template <class Tvol> class BoundarySubtractedPlaneSurface final: + + template <class Tvol> class BoundarySubtractedPlaneSurface final: virtual public BoundarySurface<Tvol>, public SubtractedPlaneSurface { /** typedef the BinnedArray */ - typedef BinnedArray<Tvol> VolumeArray; + typedef BinnedArray<Tvol> VolumeArray; public: /** Default Constructor - needed for pool and inherited classes */ - BoundarySubtractedPlaneSurface() : - BoundarySurface<Tvol>(), - SubtractedPlaneSurface() - {} - - /** Copy constructor */ - BoundarySubtractedPlaneSurface(const BoundarySubtractedPlaneSurface<Tvol>& bps) : - BoundarySurface<Tvol>(bps), - SubtractedPlaneSurface(bps) - {} - + BoundarySubtractedPlaneSurface() = default; + + /** Copy constructor */ + BoundarySubtractedPlaneSurface(const BoundarySubtractedPlaneSurface<Tvol>& bps) = default; + + /**Assignment operator*/ + BoundarySubtractedPlaneSurface& operator=(const BoundarySubtractedPlaneSurface& vol) = default; + + virtual ~BoundarySubtractedPlaneSurface() = default; + /** Constructor for a Boundary with exact two Volumes attached to it*/ BoundarySubtractedPlaneSurface(const Tvol* inside, const Tvol* outside, const SubtractedPlaneSurface& psf) : BoundarySurface<Tvol>(inside, outside), SubtractedPlaneSurface(psf) {} - + /** Constructor for a Boundary with two VolumeArrays attached to it*/ BoundarySubtractedPlaneSurface(SharedObject<VolumeArray> insideArray, SharedObject<VolumeArray> outsideArray, const SubtractedPlaneSurface& psf) : BoundarySurface<Tvol>(insideArray, outsideArray), SubtractedPlaneSurface(psf) - {} - + {} + /** Copy constructor with a shift */ BoundarySubtractedPlaneSurface(const Tvol* inside, const Tvol* outside, const SubtractedPlaneSurface& psf, const Amg::Transform3D& tr) : BoundarySurface<Tvol>(inside,outside), @@ -86,21 +85,13 @@ class Volume; /** The Surface Representation of this */ virtual const Surface& surfaceRepresentation() const override final; - /**Virtual Destructor*/ - virtual ~BoundarySubtractedPlaneSurface() = default; - /**Assignment operator*/ - BoundarySubtractedPlaneSurface& operator=(const BoundarySubtractedPlaneSurface& vol); - - protected: - }; -template <class Tvol> inline const Surface& BoundarySubtractedPlaneSurface<Tvol>::surfaceRepresentation() const { return *this; } // Hash include inline functions #include "TrkVolumes/BoundarySubtractedPlaneSurface.icc" - + } // end of namespace Trk #endif // TRKVOLUMES_BOUNDARYSUBTRACTEDPLANESURFACE_H diff --git a/Tracking/TrkDetDescr/TrkVolumes/TrkVolumes/BoundarySubtractedPlaneSurface.icc b/Tracking/TrkDetDescr/TrkVolumes/TrkVolumes/BoundarySubtractedPlaneSurface.icc index 185390b478d742f426d658b1aece1bea3b9d4122..8ae63354e77991fd786603080e3428936bea28e3 100755 --- a/Tracking/TrkDetDescr/TrkVolumes/TrkVolumes/BoundarySubtractedPlaneSurface.icc +++ b/Tracking/TrkDetDescr/TrkVolumes/TrkVolumes/BoundarySubtractedPlaneSurface.icc @@ -1,70 +1,60 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ -/////////////////////////////////////////////////////////////////// -// BoundarySubtractedPlaneSurface.icc, (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// - - -template <class Tvol> inline BoundarySubtractedPlaneSurface<Tvol>& - BoundarySubtractedPlaneSurface<Tvol>::operator=(const BoundarySubtractedPlaneSurface<Tvol>& bps) -{ - if (this!=&bps){ - delete BoundarySurface<Tvol>::m_insideVolume; - delete BoundarySurface<Tvol>::m_outsideVolume; - delete Surface::m_transform; - delete Surface::m_center; - delete Surface::m_normal; - delete SubtractedPlaneSurface::m_bounds; - BoundarySurface<Tvol>::m_insideVolume = bps.m_insideVolume; - BoundarySurface<Tvol>::m_outsideVolume = bps.m_outsideVolume; - BoundarySurface<Tvol>::m_insideVolumeArray = bps.m_insideVolumeArray; - BoundarySurface<Tvol>::m_outsideVolumeArray = bps.m_outsideVolumeArray; - Surface::m_transform = (bps.m_transform) ? new Amg::Transform3D(*bps.m_transform) : nullptr; - Surface::m_center = (bps.m_center) ? new Amg::Vector3D(*bps.m_center) : nullptr; - Surface::m_normal = (bps.m_normal) ? new Amg::Vector3D(*bps.m_normal) : nullptr ; - Surface::m_associatedDetElement = bps.m_associatedDetElement; // copy by pointer as PlaneSurface does not have ownership - Surface::m_associatedDetElementId = bps.m_associatedDetElementId; - m_bounds = bps.m_bounds->clone(); - } - return *this; - -} - -template <class Tvol> inline const Tvol* BoundarySubtractedPlaneSurface<Tvol>::attachedVolume(const TrackParameters& parms, PropDirection dir) const -{ - const Tvol* attVolume = nullptr; - if ( (this->surfaceRepresentation().normal()).dot(dir*parms.momentum()) > 0.){ - attVolume = BoundarySurface<Tvol>::m_outsideVolume; - if (BoundarySurface<Tvol>::m_outsideVolumeArray.get()){ - attVolume = BoundarySurface<Tvol>::m_outsideVolumeArray.get()->object(parms.localPosition()); - } - } else { - attVolume = BoundarySurface<Tvol>::m_insideVolume; - if (BoundarySurface<Tvol>::m_insideVolumeArray.get()){ - attVolume = BoundarySurface<Tvol>::m_insideVolumeArray.get()->object(parms.localPosition()); - } - } - return attVolume; -} - -template <class Tvol> inline const Tvol* BoundarySubtractedPlaneSurface<Tvol>::attachedVolume(const Amg::Vector3D& pos, - const Amg::Vector3D& mom, - PropDirection dir) const -{ - const Tvol* attVolume = nullptr; - if ( (this->surfaceRepresentation().normal()).dot(dir*mom) > 0.){ - attVolume = BoundarySurface<Tvol>::m_outsideVolume; - if (BoundarySurface<Tvol>::m_outsideVolumeArray.get()){ - attVolume = BoundarySurface<Tvol>::m_outsideVolumeArray.get()->object(pos); - } - } else { - attVolume = BoundarySurface<Tvol>::m_insideVolume; - if (BoundarySurface<Tvol>::m_insideVolumeArray.get()){ - attVolume = BoundarySurface<Tvol>::m_insideVolumeArray.get()->object(pos); - } - } - return attVolume; -} - +/////////////////////////////////////////////////////////////////// +// BoundarySubtractedPlaneSurface.icc, (c) ATLAS Detector software +/////////////////////////////////////////////////////////////////// + +template<class Tvol> +inline const Surface& +BoundarySubtractedPlaneSurface<Tvol>::surfaceRepresentation() const +{ + return *this; +} +template<class Tvol> +inline const Tvol* +BoundarySubtractedPlaneSurface<Tvol>::attachedVolume( + const TrackParameters& parms, + PropDirection dir) const +{ + const Tvol* attVolume = nullptr; + if ((this->surfaceRepresentation().normal()).dot(dir * parms.momentum()) > + 0.) { + attVolume = BoundarySurface<Tvol>::m_outsideVolume; + if (BoundarySurface<Tvol>::m_outsideVolumeArray.get()) { + attVolume = BoundarySurface<Tvol>::m_outsideVolumeArray.get()->object( + parms.localPosition()); + } + } else { + attVolume = BoundarySurface<Tvol>::m_insideVolume; + if (BoundarySurface<Tvol>::m_insideVolumeArray.get()) { + attVolume = BoundarySurface<Tvol>::m_insideVolumeArray.get()->object( + parms.localPosition()); + } + } + return attVolume; +} + +template<class Tvol> +inline const Tvol* +BoundarySubtractedPlaneSurface<Tvol>::attachedVolume(const Amg::Vector3D& pos, + const Amg::Vector3D& mom, + PropDirection dir) const +{ + const Tvol* attVolume = nullptr; + if ((this->surfaceRepresentation().normal()).dot(dir * mom) > 0.) { + attVolume = BoundarySurface<Tvol>::m_outsideVolume; + if (BoundarySurface<Tvol>::m_outsideVolumeArray.get()) { + attVolume = + BoundarySurface<Tvol>::m_outsideVolumeArray.get()->object(pos); + } + } else { + attVolume = BoundarySurface<Tvol>::m_insideVolume; + if (BoundarySurface<Tvol>::m_insideVolumeArray.get()) { + attVolume = BoundarySurface<Tvol>::m_insideVolumeArray.get()->object(pos); + } + } + return attVolume; +} + diff --git a/Tracking/TrkFitter/TrkGlobalChi2Fitter/src/GlobalChi2Fitter.cxx b/Tracking/TrkFitter/TrkGlobalChi2Fitter/src/GlobalChi2Fitter.cxx index 5f74c6f3208f689439d5cc88deb2ef5e0c3b6939..f0aaea724bc26ebfba4e18dd73cf52e32433e7fd 100644 --- a/Tracking/TrkFitter/TrkGlobalChi2Fitter/src/GlobalChi2Fitter.cxx +++ b/Tracking/TrkFitter/TrkGlobalChi2Fitter/src/GlobalChi2Fitter.cxx @@ -1003,7 +1003,7 @@ namespace Trk { if (cylsurf != nullptr) { double length = 2 * M_PI * cylsurf->bounds().r(); - if (fabs(fabs(dloc1) - length) < fabs(dloc1)) { + if (std::abs(std::abs(dloc1) - length) < std::abs(dloc1)) { if (dloc1 > 0) { dloc1 -= length; } else { @@ -1013,7 +1013,7 @@ namespace Trk { } if (discsurf != nullptr) { - if (fabs(fabs(dloc2) - 2 * M_PI) < fabs(dloc2)) { + if (std::abs(std::abs(dloc2) - 2 * M_PI) < std::abs(dloc2)) { if (dloc2 > 0) { dloc2 -= 2 * M_PI; } else { @@ -1109,8 +1109,8 @@ namespace Trk { std::unique_ptr<GXFMaterialEffects> elossmeff = std::make_unique<GXFMaterialEffects>(&calomeots[1]); std::unique_ptr<GXFMaterialEffects> secondscatmeff = std::make_unique<GXFMaterialEffects>(&calomeots[2]); - double pull1 = fabs(firstscatphi / firstscatmeff->sigmaDeltaPhi()); - double pull2 = fabs(secondscatphi / secondscatmeff->sigmaDeltaPhi()); + double pull1 = std::abs(firstscatphi / firstscatmeff->sigmaDeltaPhi()); + double pull2 = std::abs(secondscatphi / secondscatmeff->sigmaDeltaPhi()); if (firstismuon) { for (auto & i : tmp_matvec) { @@ -2102,14 +2102,10 @@ namespace Trk { double p = 1. / std::abs(layerpars->parameters()[Trk::qOverP] - .0005 * meff->delta_p()); std::unique_ptr<const Amg::Vector2D> locpos(state->surface()->globalToLocal(layerpars->position())); - std::unique_ptr<const Amg::Vector3D> layerNormal(state->surface()->normal(*locpos)); + const Amg::Vector3D layerNormal(state->surface()->normal(*locpos)); double costracksurf = 1.; - if (layerNormal != nullptr) { - costracksurf = fabs(layerNormal->dot(layerpars->momentum().unit())); - } else { - ATH_MSG_WARNING("No normal on surface found!"); - } + costracksurf = std::abs(layerNormal.dot(layerpars->momentum().unit())); double oldde = meff->deltaE(); @@ -3176,8 +3172,8 @@ namespace Trk { double z0 = parforextrap.position().z(); double delta_s = (surf.center().z() - z0) / costheta; double delta_phi = delta_s * sintheta / r; - double x = xc + fabs(r) * cos(phi0 + delta_phi); - double y = yc + fabs(r) * sin(phi0 + delta_phi); + double x = xc + std::abs(r) * cos(phi0 + delta_phi); + double y = yc + std::abs(r) * sin(phi0 + delta_phi); Amg::Vector3D intersect = Amg::Vector3D(x, y, surf.center().z()); double perp = intersect.perp(); const DiscBounds *discbounds = (const DiscBounds *) (&surf.bounds()); @@ -3186,7 +3182,7 @@ namespace Trk { return {}; } - double costracksurf = fabs(costheta); + double costracksurf = std::abs(costheta); return std::make_pair(intersect, costracksurf); } @@ -3266,7 +3262,7 @@ namespace Trk { Amg::Vector3D intersect = Amg::Vector3D(x, y, z); - if (fabs(z - surf.center().z()) > surf.bounds().halflengthZ()) { + if (std::abs(z - surf.center().z()) > surf.bounds().halflengthZ()) { return {}; } @@ -3282,7 +3278,7 @@ namespace Trk { Amg::Vector3D trackdir(cos(phidir) * sintheta, sin(phidir) * sintheta, costheta); - double costracksurf = fabs(normal.unit().dot(trackdir)); + double costracksurf = std::abs(normal.unit().dot(trackdir)); return std::make_pair(intersect, costracksurf); } @@ -3353,7 +3349,7 @@ namespace Trk { */ if (oldstates[i]->trackParameters() != nullptr) { double rlayer = cylsurf->bounds().r(); - if (fabs(rmeas - rlayer) < fabs(parforextrap->position().perp() - rlayer)) { + if (std::abs(rmeas - rlayer) < std::abs(parforextrap->position().perp() - rlayer)) { parforextrap = oldstates[i]->trackParameters(); } } @@ -3382,7 +3378,7 @@ namespace Trk { if (oldstates[i]->trackParameters() != nullptr) { double zlayer = discsurf->center().z(); - if (fabs(zmeas - zlayer) < fabs(parforextrap->position().z() - zlayer)) { + if (std::abs(zmeas - zlayer) < std::abs(parforextrap->position().z() - zlayer)) { parforextrap = oldstates[i]->trackParameters(); } } @@ -3394,7 +3390,7 @@ namespace Trk { continue; } - if (fabs(discsurf->center().z()) > fabs(zmeas)) break; + if (std::abs(discsurf->center().z()) > std::abs(zmeas)) break; } else { throw std::logic_error("Unhandled surface."); } @@ -3416,9 +3412,9 @@ namespace Trk { double X0 = matprop->thicknessInX0(); double currentqoverp = (matEffects != Trk::electron) ? parforextrap->parameters()[Trk::qOverP] : refpar2->parameters()[Trk::qOverP]; double actualx0 = X0 / costracksurf; - double de = -fabs((matprop->thickness() / costracksurf) * m_elosstool->dEdX(*matprop, (m_p != 0.0 ? fabs(m_p) : fabs(1. / currentqoverp)), matEffects)); + double de = -std::abs((matprop->thickness() / costracksurf) * m_elosstool->dEdX(*matprop, (m_p != 0.0 ? std::abs(m_p) : std::abs(1. / currentqoverp)), matEffects)); double sintheta = sin(parforextrap->parameters()[Trk::theta]); - double sigmascat = sqrt(m_scattool->sigmaSquare(*matprop, (m_p != 0.0 ? fabs(m_p) : fabs(1. / currentqoverp)), 1. / costracksurf, matEffects)); + double sigmascat = sqrt(m_scattool->sigmaSquare(*matprop, (m_p != 0.0 ? std::abs(m_p) : std::abs(1. / currentqoverp)), 1. / costracksurf, matEffects)); std::unique_ptr<GXFMaterialEffects> meff = std::make_unique<GXFMaterialEffects>(); meff->setDeltaE(de); @@ -3436,7 +3432,7 @@ namespace Trk { if (cache.m_fiteloss || (matEffects == electron && cache.m_asymeloss)) { eloss.reset(m_elosstool->energyLoss( *matprop, - (m_p != 0.0 ? fabs(m_p) : fabs(1. / currentqoverp)), + (m_p != 0.0 ? std::abs(m_p) : std::abs(1. / currentqoverp)), 1. / costracksurf, alongMomentum, matEffects @@ -3557,7 +3553,7 @@ namespace Trk { * If we've overshot the last hit in our track, we don't need to look * at any further layers. We're done! */ - if (fabs((*it)->surfaceRepresentation().center().z()) > fabs(lastz)) { + if (std::abs((*it)->surfaceRepresentation().center().z()) > std::abs(lastz)) { break; } @@ -3600,7 +3596,7 @@ namespace Trk { * the convention. Discs to right, cylinders go left. */ if ( - fabs((*it)->surfaceRepresentation().center().z()) < fabs(firstz) || + std::abs((*it)->surfaceRepresentation().center().z()) < std::abs(firstz) || (*it) == startlayer ) { upstreamlayers.emplace_back((Layer *) nullptr, (*it)); @@ -3611,7 +3607,7 @@ namespace Trk { */ if ( (*it) != startlayer && - (fabs((*it)->surfaceRepresentation().center().z()) > fabs(firstz2) || + (std::abs((*it)->surfaceRepresentation().center().z()) > std::abs(firstz2) || (*it) == startlayer2) ) { layers.emplace_back((Layer *) nullptr, (*it)); @@ -3639,7 +3635,7 @@ namespace Trk { */ double zintersect = firstz + ((*it)->surfaceRepresentation().bounds().r() - firstr) * slope; - if (fabs(zintersect - (*it)->surfaceRepresentation().center().z()) > ((const CylinderSurface *) (&(*it)->surfaceRepresentation()))->bounds().halflengthZ() + 50) { + if (std::abs(zintersect - (*it)->surfaceRepresentation().center().z()) > ((const CylinderSurface *) (&(*it)->surfaceRepresentation()))->bounds().halflengthZ() + 50) { continue; } @@ -4271,7 +4267,7 @@ namespace Trk { if ( npseudomuon2 < 2 && (firstmuonpar != nullptr) && - fabs(firstmuonpar->parameters()[Trk::qOverP]) > 1.e-9 + std::abs(firstmuonpar->parameters()[Trk::qOverP]) > 1.e-9 ) { qoverpbrem = firstmuonpar->parameters()[Trk::qOverP]; } else { @@ -4331,7 +4327,7 @@ namespace Trk { if ( npseudomuon1 < 2 && (lastmuonpar != nullptr) && - fabs(lastmuonpar->parameters()[Trk::qOverP]) > 1.e-9 + std::abs(lastmuonpar->parameters()[Trk::qOverP]) > 1.e-9 ) { qoverp = lastmuonpar->parameters()[Trk::qOverP]; } else { @@ -5565,7 +5561,7 @@ namespace Trk { if ( trajectory.prefit() > 0 && ( (newredchi2 < 2 && it != 0) || - (newredchi2 < oldredchi2 + .1 && fabs(newredchi2 - oldredchi2) < 1 && it != 1) + (newredchi2 < oldredchi2 + .1 && std::abs(newredchi2 - oldredchi2) < 1 && it != 1) ) ) { trajectory.setConverged(true); @@ -5579,7 +5575,7 @@ namespace Trk { miniter = cache.m_miniter; } - if (it >= miniter && fabs(oldchi2 - chi2) < maxdiff) { + if (it >= miniter && std::abs(oldchi2 - chi2) < maxdiff) { trajectory.setConverged(true); } @@ -6221,7 +6217,7 @@ namespace Trk { if (hittype == TrackState::TRT) { if ( runOutlier && - fabs(state->trackParameters()->parameters()[Trk::driftRadius]) > 1.05 * state->surface()->bounds().r() + std::abs(state->trackParameters()->parameters()[Trk::driftRadius]) > 1.05 * state->surface()->bounds().r() ) { ATH_MSG_DEBUG("Removing TRT hit #" << hitno); @@ -6987,7 +6983,7 @@ namespace Trk { double distance = getDistance(distsol); if (distsol.numberOfSolutions() == 2) { - if (fabs(distance) < 0.01) { + if (std::abs(distance) < 0.01) { continue; } @@ -8377,7 +8373,7 @@ namespace Trk { newparminuseps->parameters()[paraccessor.pardef[j]]; if (cylsurf && j == 0) { double length = 2 * M_PI * surf->bounds().r(); - if (fabs(fabs(diff) - length) < fabs(diff)) { + if (std::abs(std::abs(diff) - length) < std::abs(diff)) { if (diff > 0) { diff -= length; } else { @@ -8386,7 +8382,7 @@ namespace Trk { } } if (discsurf && j == 1) { - if (fabs(fabs(diff) - 2 * M_PI) < fabs(diff)) { + if (std::abs(std::abs(diff) - 2 * M_PI) < std::abs(diff)) { if (diff > 0) { diff -= 2 * M_PI; } else {