From 6f6c64569d074e0e6664bebef05aefd13138bcc0 Mon Sep 17 00:00:00 2001
From: Shaun Roe <shaun.roe@cern.ch>
Date: Thu, 9 Mar 2017 14:23:18 +0100
Subject: [PATCH] fix for ACTS-268: ConeBounds could not be instantiated

ConeBounds contained a private member hiding a baseclass protected data member
and which remained uninitialised, causing run time error upon instantiation.
This commit fixes that, and also converts use of 'at' vector element accessors
to simple bracket accessors.
---
 Core/include/ACTS/Surfaces/ConeBounds.hpp     | 52 +++++++++----------
 Core/include/ACTS/Surfaces/CylinderBounds.hpp | 21 ++++----
 .../include/ACTS/Surfaces/CylinderSurface.hpp |  2 +-
 Core/include/ACTS/Surfaces/DiamondBounds.hpp  | 21 ++++----
 Core/include/ACTS/Surfaces/DiscSurface.hpp    | 11 ++--
 .../ACTS/Surfaces/DiscTrapezoidalBounds.hpp   |  2 +-
 Core/include/ACTS/Surfaces/EllipseBounds.hpp  |  7 +--
 Core/include/ACTS/Surfaces/LineBounds.hpp     | 18 ++++---
 Core/include/ACTS/Surfaces/LineSurface.hpp    |  2 +-
 Core/include/ACTS/Surfaces/PlaneSurface.hpp   |  5 +-
 Core/include/ACTS/Surfaces/RadialBounds.hpp   |  5 +-
 .../include/ACTS/Surfaces/RectangleBounds.hpp | 10 ++--
 Core/include/ACTS/Surfaces/StrawSurface.hpp   |  5 +-
 Core/include/ACTS/Surfaces/Surface.hpp        |  2 +-
 .../include/ACTS/Surfaces/TrapezoidBounds.hpp | 10 ++--
 Core/include/ACTS/Surfaces/TriangleBounds.hpp | 13 +++--
 Core/src/Surfaces/BoundaryCheck.cpp           | 32 ++++++------
 Core/src/Surfaces/ConeBounds.cpp              | 34 ++++++------
 Core/src/Surfaces/ConeSurface.cpp             |  8 ++-
 Core/src/Surfaces/CylinderSurface.cpp         |  4 +-
 Core/src/Surfaces/DiamondBounds.cpp           |  6 +--
 Core/src/Surfaces/DiscSurface.cpp             |  8 +--
 Core/src/Surfaces/LineSurface.cpp             |  2 +-
 Core/src/Surfaces/PlaneSurface.cpp            |  5 +-
 24 files changed, 152 insertions(+), 133 deletions(-)

diff --git a/Core/include/ACTS/Surfaces/ConeBounds.hpp b/Core/include/ACTS/Surfaces/ConeBounds.hpp
index 5522d9b17..179bb5874 100644
--- a/Core/include/ACTS/Surfaces/ConeBounds.hpp
+++ b/Core/include/ACTS/Surfaces/ConeBounds.hpp
@@ -22,7 +22,7 @@ namespace Acts {
 
 ///  @class ConeBounds
 ///
-///  Bounds for a conical Surface,
+///  Bounds for a conical surface,
 ///  the opening angle is stored in \f$ \tan(\alpha) \f$ and always positively
 /// defined.
 ///  The cone can open to both sides, steered by \f$ z_min \f$ and \f$ z_max
@@ -195,11 +195,9 @@ private:
   bool
   inside(const Vector2D& lpos, double tol0, double tol1) const;
 
-  std::vector<TDD_real_t>
-             m_valueStore;  ///< internal storage for the bound values
-  TDD_real_t m_tanAlpha;    ///< internal cache
-  TDD_real_t m_sinAlpha;    ///< internal cache
-  TDD_real_t m_cosAlpha;    ///< internal cache
+  TDD_real_t m_tanAlpha;  ///< internal cache
+  TDD_real_t m_sinAlpha;  ///< internal cache
+  TDD_real_t m_cosAlpha;  ///< internal cache
 
   /// Helper function for angle parameter initialization
   virtual void
@@ -209,14 +207,14 @@ private:
   inline double
   minPhi() const
   {
-    return m_valueStore.at(ConeBounds::bv_averagePhi)
-        - m_valueStore.at(ConeBounds::bv_halfPhiSector);
+    return m_valueStore[ConeBounds::bv_averagePhi]
+        - m_valueStore[ConeBounds::bv_halfPhiSector];
   }
   inline double
   maxPhi() const
   {
-    return m_valueStore.at(ConeBounds::bv_averagePhi)
-        + m_valueStore.at(ConeBounds::bv_halfPhiSector);
+    return m_valueStore[ConeBounds::bv_averagePhi]
+        + m_valueStore[ConeBounds::bv_halfPhiSector];
   }
 };
 
@@ -230,8 +228,8 @@ inline bool
 ConeBounds::inside(const Vector2D& lpos, double tol0, double tol1) const
 {
   double z       = lpos[Acts::eLOC_Z];
-  bool   insideZ = z > (m_valueStore.at(ConeBounds::bv_minZ) - tol1)
-      && z < (m_valueStore.at(ConeBounds::bv_maxZ) + tol1);
+  bool   insideZ = z > (m_valueStore[ConeBounds::bv_minZ] - tol1)
+      && z < (m_valueStore[ConeBounds::bv_maxZ] + tol1);
   if (!insideZ) return false;
   // TODO: Do we need some sort of "R" tolerance also here (take
   // it off the z tol1 in that case?) or does the rphi tol0 cover
@@ -260,8 +258,8 @@ inline bool
 ConeBounds::insideLoc1(const Vector2D& lpos, double tol1) const
 {
   double z = lpos[Acts::eLOC_Z];
-  return (z > (m_valueStore.at(ConeBounds::bv_minZ) - tol1)
-          && z < (m_valueStore.at(ConeBounds::bv_maxZ) + tol1));
+  return (z > (m_valueStore[ConeBounds::bv_minZ] - tol1)
+          && z < (m_valueStore[ConeBounds::bv_maxZ] + tol1));
 }
 
 inline double
@@ -291,45 +289,45 @@ ConeBounds::cosAlpha() const
 inline double
 ConeBounds::alpha() const
 {
-  return m_valueStore.at(ConeBounds::bv_alpha);
+  return m_valueStore[ConeBounds::bv_alpha];
 }
 
 inline double
 ConeBounds::minZ() const
 {
-  return m_valueStore.at(ConeBounds::bv_minZ);
+  return m_valueStore[ConeBounds::bv_minZ];
 }
 
 inline double
 ConeBounds::maxZ() const
 {
-  return m_valueStore.at(ConeBounds::bv_maxZ);
+  return m_valueStore[ConeBounds::bv_maxZ];
 }
 
 inline double
 ConeBounds::averagePhi() const
 {
-  return m_valueStore.at(ConeBounds::bv_averagePhi);
+  return m_valueStore[ConeBounds::bv_averagePhi];
 }
 
 inline double
 ConeBounds::halfPhiSector() const
 {
-  return m_valueStore.at(ConeBounds::bv_halfPhiSector);
+  return m_valueStore[ConeBounds::bv_halfPhiSector];
 }
 
 inline void
 ConeBounds::initCache()
 {
-  m_tanAlpha = tan(m_valueStore.at(ConeBounds::bv_alpha));
-  m_sinAlpha = sin(m_valueStore.at(ConeBounds::bv_alpha));
-  m_cosAlpha = cos(m_valueStore.at(ConeBounds::bv_alpha));
+  m_tanAlpha = tan(m_valueStore[ConeBounds::bv_alpha]);
+  m_sinAlpha = sin(m_valueStore[ConeBounds::bv_alpha]);
+  m_cosAlpha = cos(m_valueStore[ConeBounds::bv_alpha]);
   // validate the halfphi
-  if (m_valueStore.at(ConeBounds::bv_halfPhiSector) < 0.)
-    m_valueStore.at(ConeBounds::bv_halfPhiSector)
-        = -m_valueStore.at(ConeBounds::bv_halfPhiSector);
-  if (m_valueStore.at(ConeBounds::bv_halfPhiSector) > M_PI)
-    m_valueStore.at(ConeBounds::bv_halfPhiSector) = M_PI;
+  if (m_valueStore[ConeBounds::bv_halfPhiSector] < 0.)
+    m_valueStore[ConeBounds::bv_halfPhiSector]
+        = -m_valueStore[ConeBounds::bv_halfPhiSector];
+  if (m_valueStore[ConeBounds::bv_halfPhiSector] > M_PI)
+    m_valueStore[ConeBounds::bv_halfPhiSector] = M_PI;
 }
 }
 
diff --git a/Core/include/ACTS/Surfaces/CylinderBounds.hpp b/Core/include/ACTS/Surfaces/CylinderBounds.hpp
index 0c4027df0..db2f8e166 100644
--- a/Core/include/ACTS/Surfaces/CylinderBounds.hpp
+++ b/Core/include/ACTS/Surfaces/CylinderBounds.hpp
@@ -209,19 +209,22 @@ CylinderBounds::inside(const Vector2D& lpos, const BoundaryCheck& bcheck) const
 {
   if (bcheck.bcType == 0 || bcheck.nSigmas == 0
       || m_valueStore.at(CylinderBounds::bv_halfPhiSector) != M_PI)
-    return CylinderBounds::inside(lpos, bcheck.toleranceLoc0, bcheck.toleranceLoc1);
+    return CylinderBounds::inside(
+        lpos, bcheck.toleranceLoc0, bcheck.toleranceLoc1);
 
-  float theta = ((*bcheck.lCovariance)(1, 0) != 0
-                 && ((*bcheck.lCovariance)(1, 1) - (*bcheck.lCovariance)(0, 0)) != 0)
+  float theta
+      = ((*bcheck.lCovariance)(1, 0) != 0
+         && ((*bcheck.lCovariance)(1, 1) - (*bcheck.lCovariance)(0, 0)) != 0)
       ? .5
-          * bcheck.FastArcTan(2 * (*bcheck.lCovariance)(1, 0)
-                            / ((*bcheck.lCovariance)(1, 1) - (*bcheck.lCovariance)(0, 0)))
+          * bcheck.FastArcTan(
+                2 * (*bcheck.lCovariance)(1, 0)
+                / ((*bcheck.lCovariance)(1, 1) - (*bcheck.lCovariance)(0, 0)))
       : 0.;
   sincosCache scResult = bcheck.FastSinCos(theta);
-  double      dphi     = scResult.sinC * scResult.sinC * (*bcheck.lCovariance)(0, 0);
-  double      dz       = scResult.cosC * scResult.cosC * (*bcheck.lCovariance)(0, 1);
-  double      max_ell  = dphi > dz ? dphi : dz;
-  double      limit    = bcheck.nSigmas * sqrt(max_ell);
+  double dphi    = scResult.sinC * scResult.sinC * (*bcheck.lCovariance)(0, 0);
+  double dz      = scResult.cosC * scResult.cosC * (*bcheck.lCovariance)(0, 1);
+  double max_ell = dphi > dz ? dphi : dz;
+  double limit   = bcheck.nSigmas * sqrt(max_ell);
   return insideLocZ(lpos[Acts::eLOC_Z], limit);
 }
 
diff --git a/Core/include/ACTS/Surfaces/CylinderSurface.hpp b/Core/include/ACTS/Surfaces/CylinderSurface.hpp
index bd5606553..51bb1c6e5 100644
--- a/Core/include/ACTS/Surfaces/CylinderSurface.hpp
+++ b/Core/include/ACTS/Surfaces/CylinderSurface.hpp
@@ -202,7 +202,7 @@ public:
   ///  recalculated
   /// into the new frame.
   ///  Suppose, this is done, the intersection is straight forward:
-  ///  @f$p_{1}=(p_{1x}, p_{1y}, p_{1z}), p_{2}=(p_{2x}, p_{2y}, p_{2z}) @f$ 
+  ///  @f$p_{1}=(p_{1x}, p_{1y}, p_{1z}), p_{2}=(p_{2x}, p_{2y}, p_{2z}) @f$
   ///  are the two points describing the 3D-line,
   ///  then the line in the \f$x-y@f$ plane can be written as
   ///  @f$y=kx+d\f$, where @f$k =\frac{p_{2y}-p_{1y}}{p_{2x}-p_{1x}}@f$such as
diff --git a/Core/include/ACTS/Surfaces/DiamondBounds.hpp b/Core/include/ACTS/Surfaces/DiamondBounds.hpp
index 8da20a290..47cbc28ac 100644
--- a/Core/include/ACTS/Surfaces/DiamondBounds.hpp
+++ b/Core/include/ACTS/Surfaces/DiamondBounds.hpp
@@ -23,7 +23,7 @@ namespace Acts {
 
 ///
 /// @class DiamondBounds
-///  
+///
 /// Bounds for a double trapezoidal ("diamond"), planar Surface.
 ///
 class DiamondBounds : public PlanarBounds
@@ -190,9 +190,9 @@ private:
   initCache();
 
   // std::vector<TDD_real_t> m_valueStore;  ///< internal parameter store
-  TDD_real_t              m_alpha1;  ///< internal parameter cache for alpha1
-  TDD_real_t              m_alpha2;  ///< internal parameter cache for alpha2
-  RectangleBounds         m_boundingBox;  ///< internal bounding box cache
+  TDD_real_t      m_alpha1;       ///< internal parameter cache for alpha1
+  TDD_real_t      m_alpha2;       ///< internal parameter cache for alpha2
+  RectangleBounds m_boundingBox;  ///< internal bounding box cache
 };
 
 inline DiamondBounds*
@@ -235,7 +235,8 @@ inline bool
 DiamondBounds::inside(const Vector2D& lpos, const BoundaryCheck& bcheck) const
 {
   if (bcheck.bcType == 0)
-    return DiamondBounds::inside(lpos, bcheck.toleranceLoc0, bcheck.toleranceLoc1);
+    return DiamondBounds::inside(
+        lpos, bcheck.toleranceLoc0, bcheck.toleranceLoc1);
 
   // a fast FALSE
   double max_ell = (*bcheck.lCovariance)(0, 0) > (*bcheck.lCovariance)(1, 1)
@@ -271,11 +272,13 @@ DiamondBounds::inside(const Vector2D& lpos, const BoundaryCheck& bcheck) const
   // compute KDOP and axes for surface polygon
   std::vector<KDOP>     elementKDOP(5);
   std::vector<Vector2D> elementP(6);
-  float                 theta = ((*bcheck.lCovariance)(1, 0) != 0
-                 && ((*bcheck.lCovariance)(1, 1) - (*bcheck.lCovariance)(0, 0)) != 0)
+  float                 theta
+      = ((*bcheck.lCovariance)(1, 0) != 0
+         && ((*bcheck.lCovariance)(1, 1) - (*bcheck.lCovariance)(0, 0)) != 0)
       ? .5
-          * bcheck.FastArcTan(2 * (*bcheck.lCovariance)(1, 0)
-                            / ((*bcheck.lCovariance)(1, 1) - (*bcheck.lCovariance)(0, 0)))
+          * bcheck.FastArcTan(
+                2 * (*bcheck.lCovariance)(1, 0)
+                / ((*bcheck.lCovariance)(1, 1) - (*bcheck.lCovariance)(0, 0)))
       : 0.;
   sincosCache scResult = bcheck.FastSinCos(theta);
   ActsMatrixD<2, 2> rotMatrix;
diff --git a/Core/include/ACTS/Surfaces/DiscSurface.hpp b/Core/include/ACTS/Surfaces/DiscSurface.hpp
index fb06cd4c6..413a56ffa 100644
--- a/Core/include/ACTS/Surfaces/DiscSurface.hpp
+++ b/Core/include/ACTS/Surfaces/DiscSurface.hpp
@@ -61,7 +61,7 @@ public:
   /// This is n this case you have DiscTrapezoidalBounds
   ///
   /// @param htrans is transform that places the disc in the global 3D space
-  /// (can be nullptr)           
+  /// (can be nullptr)
   /// @param minhalfx is the half length in x at minimal r
   /// @param maxhalfx is the half length in x at maximal r
   /// @param rmin is the inner radius of the disc surface
@@ -313,7 +313,7 @@ DiscSurface::normal(const Vector2D&) const
 {
   // fast access via tranform matrix (and not rotation())
   auto tMatrix = transform().matrix();
-  return Vector3D(tMatrix(0,2),tMatrix(1,2),tMatrix(2,2));
+  return Vector3D(tMatrix(0, 2), tMatrix(1, 2), tMatrix(2, 2));
 }
 
 inline const Vector3D DiscSurface::binningPosition(BinningValue) const
@@ -332,8 +332,8 @@ inline const Vector2D
 DiscSurface::localCartesianToPolar(const Vector2D& lcart) const
 {
   return Vector2D(sqrt(lcart[Acts::eLOC_X] * lcart[Acts::eLOC_X]
-                    + lcart[Acts::eLOC_Y] * lcart[Acts::eLOC_Y]),
-                   atan2(lcart[Acts::eLOC_Y], lcart[Acts::eLOC_X]));
+                       + lcart[Acts::eLOC_Y] * lcart[Acts::eLOC_Y]),
+                  atan2(lcart[Acts::eLOC_Y], lcart[Acts::eLOC_X]));
 }
 
 inline double
@@ -356,7 +356,8 @@ DiscSurface::intersectionEstimate(const Vector3D&      gpos,
     // evaluate the intersection in terms of direction
     bool isValid = forceDir ? (u > 0.) : true;
     // evaluate (if necessary in terms of boundaries)
-    isValid = bcheck ? (isValid && isOnSurface(intersectPoint, bcheck)) : isValid;
+    isValid
+        = bcheck ? (isValid && isOnSurface(intersectPoint, bcheck)) : isValid;
     // return the result
     return Intersection(intersectPoint, u, isValid);
   }
diff --git a/Core/include/ACTS/Surfaces/DiscTrapezoidalBounds.hpp b/Core/include/ACTS/Surfaces/DiscTrapezoidalBounds.hpp
index 94433c0ee..5a2b9a5e6 100644
--- a/Core/include/ACTS/Surfaces/DiscTrapezoidalBounds.hpp
+++ b/Core/include/ACTS/Surfaces/DiscTrapezoidalBounds.hpp
@@ -404,7 +404,7 @@ DiscTrapezoidalBounds::inside(const Vector2D&      lpos,
                  && (lCovarianceCar(1, 1) - lCovarianceCar(0, 0)) != 0)
       ? .5
           * bcheck.FastArcTan(2 * lCovarianceCar(1, 0)
-                            / (lCovarianceCar(1, 1) - lCovarianceCar(0, 0)))
+                              / (lCovarianceCar(1, 1) - lCovarianceCar(0, 0)))
       : 0.;
   scResult = bcheck.FastSinCos(theta);
   ActsMatrixD<2, 2> rotMatrix;
diff --git a/Core/include/ACTS/Surfaces/EllipseBounds.hpp b/Core/include/ACTS/Surfaces/EllipseBounds.hpp
index efdca6c99..3de77084b 100644
--- a/Core/include/ACTS/Surfaces/EllipseBounds.hpp
+++ b/Core/include/ACTS/Surfaces/EllipseBounds.hpp
@@ -27,9 +27,9 @@ namespace Acts {
 /// i.e. the surface between two ellipses.
 /// By providing an argument for hphisec, the bounds can
 /// be restricted to a phirange around the center position.
-///   
+///
 /// @image html EllipseBounds.png
-///  
+///
 class EllipseBounds : public PlanarBounds
 {
 public:
@@ -226,7 +226,8 @@ EllipseBounds::inside(const Vector2D& lpos, double tol0, double tol1) const
 inline bool
 EllipseBounds::inside(const Vector2D& lpos, const BoundaryCheck& bcheck) const
 {
-  return EllipseBounds::inside(lpos, bcheck.toleranceLoc0, bcheck.toleranceLoc1);
+  return EllipseBounds::inside(
+      lpos, bcheck.toleranceLoc0, bcheck.toleranceLoc1);
 }
 
 inline bool
diff --git a/Core/include/ACTS/Surfaces/LineBounds.hpp b/Core/include/ACTS/Surfaces/LineBounds.hpp
index 978cedcec..6e06c1feb 100644
--- a/Core/include/ACTS/Surfaces/LineBounds.hpp
+++ b/Core/include/ACTS/Surfaces/LineBounds.hpp
@@ -160,17 +160,19 @@ LineBounds::inside(const Vector2D& lpos, const BoundaryCheck& bcheck) const
   if (bcheck.bcType == 0 || bcheck.nSigmas == 0)
     return LineBounds::inside(lpos, bcheck.toleranceLoc0, bcheck.toleranceLoc1);
   // ellipsoid check
-  float theta = ((*bcheck.lCovariance)(1, 0) != 0
-                 && ((*bcheck.lCovariance)(1, 1) - (*bcheck.lCovariance)(0, 0)) != 0)
+  float theta
+      = ((*bcheck.lCovariance)(1, 0) != 0
+         && ((*bcheck.lCovariance)(1, 1) - (*bcheck.lCovariance)(0, 0)) != 0)
       ? .5
-          * bcheck.FastArcTan(2 * (*bcheck.lCovariance)(1, 0)
-                            / ((*bcheck.lCovariance)(1, 1) - (*bcheck.lCovariance)(0, 0)))
+          * bcheck.FastArcTan(
+                2 * (*bcheck.lCovariance)(1, 0)
+                / ((*bcheck.lCovariance)(1, 1) - (*bcheck.lCovariance)(0, 0)))
       : 0.;
   sincosCache scResult = bcheck.FastSinCos(theta);
-  double      dphi     = scResult.sinC * scResult.sinC * (*bcheck.lCovariance)(0, 0);
-  double      dz       = scResult.cosC * scResult.cosC * (*bcheck.lCovariance)(0, 1);
-  double      max_ell  = dphi > dz ? dphi : dz;
-  double      limit    = bcheck.nSigmas * sqrt(max_ell);
+  double dphi    = scResult.sinC * scResult.sinC * (*bcheck.lCovariance)(0, 0);
+  double dz      = scResult.cosC * scResult.cosC * (*bcheck.lCovariance)(0, 1);
+  double max_ell = dphi > dz ? dphi : dz;
+  double limit   = bcheck.nSigmas * sqrt(max_ell);
   return insideLocZ(lpos[Acts::eLOC_Z], limit);
 }
 
diff --git a/Core/include/ACTS/Surfaces/LineSurface.hpp b/Core/include/ACTS/Surfaces/LineSurface.hpp
index 754535c4b..c42a48cf3 100644
--- a/Core/include/ACTS/Surfaces/LineSurface.hpp
+++ b/Core/include/ACTS/Surfaces/LineSurface.hpp
@@ -291,7 +291,7 @@ LineSurface::lineDirection() const
 {
   // fast access via tranform matrix (and not rotation())
   auto tMatrix = transform().matrix();
-  return Vector3D(tMatrix(0,2),tMatrix(1,2),tMatrix(2,2));
+  return Vector3D(tMatrix(0, 2), tMatrix(1, 2), tMatrix(2, 2));
 }
 
 }  // end of namespace
diff --git a/Core/include/ACTS/Surfaces/PlaneSurface.hpp b/Core/include/ACTS/Surfaces/PlaneSurface.hpp
index 80ce32fb7..ba5e986ac 100644
--- a/Core/include/ACTS/Surfaces/PlaneSurface.hpp
+++ b/Core/include/ACTS/Surfaces/PlaneSurface.hpp
@@ -235,7 +235,7 @@ PlaneSurface::normal(const Vector2D&) const
 {
   // fast access via tranform matrix (and not rotation())
   auto tMatrix = transform().matrix();
-  return Vector3D(tMatrix(0,2),tMatrix(1,2),tMatrix(2,2));
+  return Vector3D(tMatrix(0, 2), tMatrix(1, 2), tMatrix(2, 2));
 }
 
 inline const Vector3D PlaneSurface::binningPosition(BinningValue) const
@@ -263,7 +263,8 @@ PlaneSurface::intersectionEstimate(const Vector3D&      gpos,
     // evaluate the intersection in terms of direction
     bool isValid = forceDir ? (u > 0.) : true;
     // evaluate (if necessary in terms of boundaries)
-    isValid = bcheck ? (isValid && isOnSurface(intersectPoint, bcheck)) : isValid;
+    isValid
+        = bcheck ? (isValid && isOnSurface(intersectPoint, bcheck)) : isValid;
     // return the result
     return Intersection(intersectPoint, u, isValid);
   }
diff --git a/Core/include/ACTS/Surfaces/RadialBounds.hpp b/Core/include/ACTS/Surfaces/RadialBounds.hpp
index d7104b36f..3c319bcda 100644
--- a/Core/include/ACTS/Surfaces/RadialBounds.hpp
+++ b/Core/include/ACTS/Surfaces/RadialBounds.hpp
@@ -185,7 +185,8 @@ RadialBounds::inside(const Vector2D& lpos, const BoundaryCheck& bcheck) const
   if (bcheck.bcType == 0 || bcheck.nSigmas == 0
       || m_valueStore[RadialBounds::bv_rMin] != 0
       || m_valueStore[RadialBounds::bv_halfPhiSector] != M_PI)
-    return RadialBounds::inside(lpos, bcheck.toleranceLoc0, bcheck.toleranceLoc1);
+    return RadialBounds::inside(
+        lpos, bcheck.toleranceLoc0, bcheck.toleranceLoc1);
 
   // a fast FALSE
   sincosCache scResult = bcheck.FastSinCos(lpos(1, 0));
@@ -359,7 +360,7 @@ RadialBounds::inside(const Vector2D& lpos, const BoundaryCheck& bcheck) const
                  && (lCovarianceCar(1, 1) - lCovarianceCar(0, 0)) != 0)
       ? .5
           * bcheck.FastArcTan(2 * lCovarianceCar(1, 0)
-                            / (lCovarianceCar(1, 1) - lCovarianceCar(0, 0)))
+                              / (lCovarianceCar(1, 1) - lCovarianceCar(0, 0)))
       : 0.;
   scResult = bcheck.FastSinCos(theta);
   ActsMatrixD<2, 2> rotMatrix;
diff --git a/Core/include/ACTS/Surfaces/RectangleBounds.hpp b/Core/include/ACTS/Surfaces/RectangleBounds.hpp
index 35c52435c..cea065021 100644
--- a/Core/include/ACTS/Surfaces/RectangleBounds.hpp
+++ b/Core/include/ACTS/Surfaces/RectangleBounds.hpp
@@ -171,11 +171,13 @@ RectangleBounds::inside(const Vector2D& lpos, const BoundaryCheck& bcheck) const
   // compute KDOP and axes for surface polygon
   std::vector<KDOP>     elementKDOP(4);
   std::vector<Vector2D> elementP(4);
-  float                 theta = ((*bcheck.lCovariance)(1, 0) != 0
-                 && ((*bcheck.lCovariance)(1, 1) - (*bcheck.lCovariance)(0, 0)) != 0)
+  float                 theta
+      = ((*bcheck.lCovariance)(1, 0) != 0
+         && ((*bcheck.lCovariance)(1, 1) - (*bcheck.lCovariance)(0, 0)) != 0)
       ? .5
-          * bcheck.FastArcTan(2 * (*bcheck.lCovariance)(1, 0)
-                            / ((*bcheck.lCovariance)(1, 1) - (*bcheck.lCovariance)(0, 0)))
+          * bcheck.FastArcTan(
+                2 * (*bcheck.lCovariance)(1, 0)
+                / ((*bcheck.lCovariance)(1, 1) - (*bcheck.lCovariance)(0, 0)))
       : 0.;
   sincosCache scResult = bcheck.FastSinCos(theta);
   ActsMatrixD<2, 2> rotMatrix;
diff --git a/Core/include/ACTS/Surfaces/StrawSurface.hpp b/Core/include/ACTS/Surfaces/StrawSurface.hpp
index 783b8286e..d78209d4b 100644
--- a/Core/include/ACTS/Surfaces/StrawSurface.hpp
+++ b/Core/include/ACTS/Surfaces/StrawSurface.hpp
@@ -26,7 +26,7 @@ class DetectorElementBase;
 ///
 ///  Class for a StrawSurface in the TrackingGeometry
 ///  to describe dirft tube and straw like detectors.
-///  
+///
 /// @image html LineSurface.png
 ///
 class StrawSurface : public LineSurface
@@ -75,7 +75,8 @@ public:
   /// @param htrans is the additional transform applied after copying
   StrawSurface(const StrawSurface& slsf, const Transform3D& htrans)
     : LineSurface(slsf, htrans)
-  {}
+  {
+  }
 
   /// Destructor
   virtual ~StrawSurface();
diff --git a/Core/include/ACTS/Surfaces/Surface.hpp b/Core/include/ACTS/Surfaces/Surface.hpp
index 8c4748324..35fac4ac6 100644
--- a/Core/include/ACTS/Surfaces/Surface.hpp
+++ b/Core/include/ACTS/Surfaces/Surface.hpp
@@ -307,7 +307,7 @@ public:
   Intersection
   intersectionEstimate(const T&             pars,
                        bool                 forceDir = false,
-                       const BoundaryCheck& bcheck     = false) const
+                       const BoundaryCheck& bcheck   = false) const
   {
     return intersectionEstimate(
         pars.position(), pars.momentum().unit(), forceDir, bcheck);
diff --git a/Core/include/ACTS/Surfaces/TrapezoidBounds.hpp b/Core/include/ACTS/Surfaces/TrapezoidBounds.hpp
index 12add0342..7b8ac5dbf 100644
--- a/Core/include/ACTS/Surfaces/TrapezoidBounds.hpp
+++ b/Core/include/ACTS/Surfaces/TrapezoidBounds.hpp
@@ -322,11 +322,13 @@ TrapezoidBounds::inside(const Vector2D& lpos, const BoundaryCheck& bcheck) const
   // compute KDOP and axes for surface polygon
   std::vector<KDOP>     elementKDOP(3);
   std::vector<Vector2D> elementP(4);
-  float                 theta = ((*bcheck.lCovariance)(1, 0) != 0
-                 && ((*bcheck.lCovariance)(1, 1) - (*bcheck.lCovariance)(0, 0)) != 0)
+  float                 theta
+      = ((*bcheck.lCovariance)(1, 0) != 0
+         && ((*bcheck.lCovariance)(1, 1) - (*bcheck.lCovariance)(0, 0)) != 0)
       ? .5
-          * bcheck.FastArcTan(2 * (*bcheck.lCovariance)(1, 0)
-                            / ((*bcheck.lCovariance)(1, 1) - (*bcheck.lCovariance)(0, 0)))
+          * bcheck.FastArcTan(
+                2 * (*bcheck.lCovariance)(1, 0)
+                / ((*bcheck.lCovariance)(1, 1) - (*bcheck.lCovariance)(0, 0)))
       : 0.;
   sincosCache scResult = bcheck.FastSinCos(theta);
   ActsMatrixD<2, 2> rotMatrix;
diff --git a/Core/include/ACTS/Surfaces/TriangleBounds.hpp b/Core/include/ACTS/Surfaces/TriangleBounds.hpp
index fc22e252b..c0492ed33 100644
--- a/Core/include/ACTS/Surfaces/TriangleBounds.hpp
+++ b/Core/include/ACTS/Surfaces/TriangleBounds.hpp
@@ -197,7 +197,8 @@ inline bool
 TriangleBounds::inside(const Vector2D& lpos, const BoundaryCheck& bcheck) const
 {
   if (bcheck.bcType == 0)
-    return TriangleBounds::inside(lpos, bcheck.toleranceLoc0, bcheck.toleranceLoc1);
+    return TriangleBounds::inside(
+        lpos, bcheck.toleranceLoc0, bcheck.toleranceLoc1);
 
   /// @todo check for quick limit test
   /// double max_ell = (*bcheck.lCovariance)(0, 0) > (*bcheck.lCovariance)(1, 1)
@@ -212,11 +213,13 @@ TriangleBounds::inside(const Vector2D& lpos, const BoundaryCheck& bcheck) const
   // compute KDOP and axes for surface polygon
   std::vector<KDOP>     elementKDOP(3);
   std::vector<Vector2D> elementP(3);
-  double                theta = ((*bcheck.lCovariance)(1, 0) != 0
-                  && ((*bcheck.lCovariance)(1, 1) - (*bcheck.lCovariance)(0, 0)) != 0)
+  double                theta
+      = ((*bcheck.lCovariance)(1, 0) != 0
+         && ((*bcheck.lCovariance)(1, 1) - (*bcheck.lCovariance)(0, 0)) != 0)
       ? .5
-          * bcheck.FastArcTan(2 * (*bcheck.lCovariance)(1, 0)
-                            / ((*bcheck.lCovariance)(1, 1) - (*bcheck.lCovariance)(0, 0)))
+          * bcheck.FastArcTan(
+                2 * (*bcheck.lCovariance)(1, 0)
+                / ((*bcheck.lCovariance)(1, 1) - (*bcheck.lCovariance)(0, 0)))
       : 0.;
   sincosCache scResult = bcheck.FastSinCos(theta);
   ActsMatrixD<2, 2> rotMatrix;
diff --git a/Core/src/Surfaces/BoundaryCheck.cpp b/Core/src/Surfaces/BoundaryCheck.cpp
index 4a50fc62e..ebdebf681 100644
--- a/Core/src/Surfaces/BoundaryCheck.cpp
+++ b/Core/src/Surfaces/BoundaryCheck.cpp
@@ -24,7 +24,8 @@ Acts::BoundaryCheck::BoundaryCheck(bool sCheck)
   , nSigmas(-1)
   , lCovariance(nullptr)
   , bcType(absolute)
-{}
+{
+}
 
 Acts::BoundaryCheck::BoundaryCheck(bool   chkL0,
                                    bool   chkL1,
@@ -49,7 +50,7 @@ Acts::BoundaryCheck::BoundaryCheck(const ActsSymMatrixD<2>& lCov,
   , toleranceLoc0(0.)
   , toleranceLoc1(0.)
   , nSigmas(nsig)
-  , lCovariance(std::make_unique< ActsSymMatrixD<2> >(lCov))
+  , lCovariance(std::make_unique<ActsSymMatrixD<2>>(lCov))
   , bcType(chi2corr)
 {
 }
@@ -63,21 +64,22 @@ Acts::BoundaryCheck::BoundaryCheck(const BoundaryCheck& bCheck)
   , lCovariance(nullptr)
   , bcType(bCheck.bcType)
 {
-  lCovariance = bCheck.lCovariance ? 
-      std::make_unique< ActsSymMatrixD<2> >(*bCheck.lCovariance) : nullptr; 
+  lCovariance = bCheck.lCovariance
+      ? std::make_unique<ActsSymMatrixD<2>>(*bCheck.lCovariance)
+      : nullptr;
 }
 
-Acts::BoundaryCheck& Acts::BoundaryCheck::operator=(const BoundaryCheck& bCheck)
+Acts::BoundaryCheck&
+Acts::BoundaryCheck::operator=(const BoundaryCheck& bCheck)
 {
-  if (this != &bCheck){
-      checkLoc0     = bCheck.checkLoc0;
-      checkLoc1     = bCheck.checkLoc1;
-      toleranceLoc0 = bCheck.toleranceLoc0;
-      toleranceLoc1 = bCheck.toleranceLoc1;
-      nSigmas       = bCheck.nSigmas;
-      lCovariance   = nullptr;
-      bcType        = bCheck.bcType;
+  if (this != &bCheck) {
+    checkLoc0     = bCheck.checkLoc0;
+    checkLoc1     = bCheck.checkLoc1;
+    toleranceLoc0 = bCheck.toleranceLoc0;
+    toleranceLoc1 = bCheck.toleranceLoc1;
+    nSigmas       = bCheck.nSigmas;
+    lCovariance   = nullptr;
+    bcType        = bCheck.bcType;
   }
   return (*this);
-}  
-
+}
diff --git a/Core/src/Surfaces/ConeBounds.cpp b/Core/src/Surfaces/ConeBounds.cpp
index f902446fa..575b95374 100644
--- a/Core/src/Surfaces/ConeBounds.cpp
+++ b/Core/src/Surfaces/ConeBounds.cpp
@@ -24,11 +24,11 @@ Acts::ConeBounds::ConeBounds(double alpha,
   , m_sinAlpha(0.)
   , m_cosAlpha(0.)
 {
-  m_valueStore.at(ConeBounds::bv_alpha)      = alpha;
-  m_valueStore.at(ConeBounds::bv_minZ)       = symm ? -TDD_max_bound_value : 0.;
-  m_valueStore.at(ConeBounds::bv_maxZ)       = TDD_max_bound_value;
-  m_valueStore.at(ConeBounds::bv_averagePhi) = avphi;
-  m_valueStore.at(ConeBounds::bv_halfPhiSector) = halfphi;
+  m_valueStore[ConeBounds::bv_alpha]         = alpha;
+  m_valueStore[ConeBounds::bv_minZ]          = symm ? -TDD_max_bound_value : 0.;
+  m_valueStore[ConeBounds::bv_maxZ]          = TDD_max_bound_value;
+  m_valueStore[ConeBounds::bv_averagePhi]    = avphi;
+  m_valueStore[ConeBounds::bv_halfPhiSector] = halfphi;
   initCache();
 }
 
@@ -42,11 +42,11 @@ Acts::ConeBounds::ConeBounds(double alpha,
   , m_sinAlpha(0.)
   , m_cosAlpha(0.)
 {
-  m_valueStore.at(ConeBounds::bv_alpha)         = alpha;
-  m_valueStore.at(ConeBounds::bv_minZ)          = zmin;
-  m_valueStore.at(ConeBounds::bv_maxZ)          = zmax;
-  m_valueStore.at(ConeBounds::bv_averagePhi)    = avphi;
-  m_valueStore.at(ConeBounds::bv_halfPhiSector) = halfphi;
+  m_valueStore[ConeBounds::bv_alpha]         = alpha;
+  m_valueStore[ConeBounds::bv_minZ]          = zmin;
+  m_valueStore[ConeBounds::bv_maxZ]          = zmax;
+  m_valueStore[ConeBounds::bv_averagePhi]    = avphi;
+  m_valueStore[ConeBounds::bv_halfPhiSector] = halfphi;
   initCache();
 }
 
@@ -82,20 +82,20 @@ Acts::ConeBounds::distanceToBoundary(const Acts::Vector2D& pos) const
   // then it won't work
 
   // find the minimum distance along the z direction
-  double toMinZ = m_valueStore.at(ConeBounds::bv_minZ) - pos[Acts::eLOC_Z];
-  double toMaxZ = pos[Acts::eLOC_Z] - m_valueStore.at(ConeBounds::bv_maxZ);
+  double toMinZ = m_valueStore[ConeBounds::bv_minZ] - pos[Acts::eLOC_Z];
+  double toMaxZ = pos[Acts::eLOC_Z] - m_valueStore[ConeBounds::bv_maxZ];
   double toZ    = (std::abs(toMinZ) < std::abs(toMaxZ)) ? toMinZ : toMaxZ;
 
   // NB this works only if the localPos is in the same hemisphere as
   // the cone (i.e. if the localPos has z < 0 and the cone only
   // defined for z > z_min where z_min > 0, this is wrong)
-  double zDist = sqrt(toZ * toZ * (1. + m_tanAlpha * m_tanAlpha));
+  double zDist = std::sqrt(toZ * toZ * (1. + m_tanAlpha * m_tanAlpha));
   if (toZ < 0.)  // positive if outside the cone only
     zDist = -zDist;
 
   // if the cone is complete, or pos is in the same phi range as the
   // cone piece then its just the distance along the cone.
-  if (m_valueStore.at(ConeBounds::bv_halfPhiSector) >= M_PI) return zDist;
+  if (m_valueStore[ConeBounds::bv_halfPhiSector] >= M_PI) return zDist;
 
   // we have a conical segment, so find also the phi distance
   // Note that here we take the phi distance as the distance from
@@ -104,13 +104,13 @@ Acts::ConeBounds::distanceToBoundary(const Acts::Vector2D& pos) const
   // cone)
   double posR     = pos[Acts::eLOC_Z] * m_tanAlpha;
   double deltaPhi = pos[Acts::eLOC_RPHI] / posR
-      - m_valueStore.at(ConeBounds::bv_averagePhi);  // from center
+      - m_valueStore[ConeBounds::bv_averagePhi];  // from center
   if (deltaPhi > M_PI) deltaPhi  = 2 * M_PI - deltaPhi;
   if (deltaPhi < -M_PI) deltaPhi = 2 * M_PI + deltaPhi;
 
   // straight line distance (goes off cone)
   double phiDist = 2 * posR
-      * sin(.5 * (deltaPhi - m_valueStore.at(ConeBounds::bv_halfPhiSector)));
+      * sin(.5 * (deltaPhi - m_valueStore[ConeBounds::bv_halfPhiSector]));
 
   // if inside the cone, return the smaller length (since both are
   // negative, the *larger* of the 2 is the *smaller* distance)
@@ -127,7 +127,7 @@ Acts::ConeBounds::distanceToBoundary(const Acts::Vector2D& pos) const
 
   // otherwise, return both (this should be the distance to the corner
   // closest to the cone
-  return sqrt(zDist * zDist + phiDist * phiDist);
+  return std::sqrt(zDist * zDist + phiDist * phiDist);
 }
 
 std::ostream&
diff --git a/Core/src/Surfaces/ConeSurface.cpp b/Core/src/Surfaces/ConeSurface.cpp
index 0e9c21416..2c75af184 100644
--- a/Core/src/Surfaces/ConeSurface.cpp
+++ b/Core/src/Surfaces/ConeSurface.cpp
@@ -123,11 +123,9 @@ Acts::ConeSurface::globalToLocal(const Vector3D& gpos,
                                  const Vector3D&,
                                  Vector2D& lpos) const
 {
-  Vector3D loc3Dframe
-      = m_transform ? (transform().inverse() * gpos) : gpos;
-  double r = loc3Dframe.z() * bounds().tanAlpha();
-  lpos     = Vector2D(r * atan2(loc3Dframe.y(), loc3Dframe.x()),
-                        loc3Dframe.z());
+  Vector3D loc3Dframe = m_transform ? (transform().inverse() * gpos) : gpos;
+  double   r          = loc3Dframe.z() * bounds().tanAlpha();
+  lpos = Vector2D(r * atan2(loc3Dframe.y(), loc3Dframe.x()), loc3Dframe.z());
   // now decide on the quility of the transformation
   double inttol = r * 0.0001;
   inttol        = (inttol < 0.01) ? 0.01 : 0.01;  // ?
diff --git a/Core/src/Surfaces/CylinderSurface.cpp b/Core/src/Surfaces/CylinderSurface.cpp
index e5f71c4e5..f3a36facb 100644
--- a/Core/src/Surfaces/CylinderSurface.cpp
+++ b/Core/src/Surfaces/CylinderSurface.cpp
@@ -214,8 +214,8 @@ Acts::CylinderSurface::intersectionEstimate(const Acts::Vector3D& gpos,
   Vector3D sol1raw(point1 + t1 * direction);
   Vector3D sol2raw(point1 + t2 * direction);
   // now reorder and return
-  Vector3D       solution(0, 0, 0);
-  double         path = 0.;
+  Vector3D solution(0, 0, 0);
+  double   path = 0.;
 
   // first check the validity of the direction
   bool isValid = true;
diff --git a/Core/src/Surfaces/DiamondBounds.cpp b/Core/src/Surfaces/DiamondBounds.cpp
index decdc20bd..dbba0f21b 100644
--- a/Core/src/Surfaces/DiamondBounds.cpp
+++ b/Core/src/Surfaces/DiamondBounds.cpp
@@ -58,9 +58,9 @@ Acts::DiamondBounds::operator=(const DiamondBounds& diabo)
 {
   if (this != &diabo) {
     PlanarBounds::m_valueStore = diabo.m_valueStore;
-    m_alpha1      = diabo.m_alpha1;
-    m_alpha2      = diabo.m_alpha2;
-    m_boundingBox = diabo.m_boundingBox;
+    m_alpha1                   = diabo.m_alpha1;
+    m_alpha2                   = diabo.m_alpha2;
+    m_boundingBox              = diabo.m_boundingBox;
   }
   return *this;
 }
diff --git a/Core/src/Surfaces/DiscSurface.cpp b/Core/src/Surfaces/DiscSurface.cpp
index 62db8ff69..4029d622a 100644
--- a/Core/src/Surfaces/DiscSurface.cpp
+++ b/Core/src/Surfaces/DiscSurface.cpp
@@ -151,8 +151,8 @@ Acts::DiscSurface::isOnSurface(const Vector3D&      glopo,
 {
   Vector3D loc3Dframe = (transform().inverse()) * glopo;
   if (std::abs(loc3Dframe.z()) > (s_onSurfaceTolerance)) return false;
-  return (
-      bcheck
-          ? bounds().inside(Vector2D(loc3Dframe.perp(), loc3Dframe.phi()), bcheck)
-          : true);
+  return (bcheck
+              ? bounds().inside(Vector2D(loc3Dframe.perp(), loc3Dframe.phi()),
+                                bcheck)
+              : true);
 }
diff --git a/Core/src/Surfaces/LineSurface.cpp b/Core/src/Surfaces/LineSurface.cpp
index b44b8b6a1..1ab2c6a29 100644
--- a/Core/src/Surfaces/LineSurface.cpp
+++ b/Core/src/Surfaces/LineSurface.cpp
@@ -148,7 +148,7 @@ Acts::LineSurface::intersectionEstimate(const Vector3D&      gpos,
     bool isValid = forceDir ? (lambda0 > 0.) : true;
     // evaluate validaty in terms of bounds
     Vector3D result = (ma + lambda0 * ea);
-    isValid         = bcheck ? (isValid && isOnSurface(result, bcheck)) : isValid;
+    isValid = bcheck ? (isValid && isOnSurface(result, bcheck)) : isValid;
     // return the result
     return Intersection(result, lambda0, isValid);
   }
diff --git a/Core/src/Surfaces/PlaneSurface.cpp b/Core/src/Surfaces/PlaneSurface.cpp
index c0429b1a4..e44162f65 100644
--- a/Core/src/Surfaces/PlaneSurface.cpp
+++ b/Core/src/Surfaces/PlaneSurface.cpp
@@ -113,6 +113,7 @@ Acts::PlaneSurface::isOnSurface(const Vector3D&      glopo,
   /// the chance that there is no transform is almost 0, let's apply it
   Vector3D loc3Dframe = (transform().inverse()) * glopo;
   if (std::abs(loc3Dframe.z()) > s_onSurfaceTolerance) return false;
-  return (bcheck ? bounds().inside(Vector2D(loc3Dframe.x(), loc3Dframe.y()), bcheck)
-               : true);
+  return (
+      bcheck ? bounds().inside(Vector2D(loc3Dframe.x(), loc3Dframe.y()), bcheck)
+             : true);
 }
-- 
GitLab