Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:11:04

0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 CERN for the benefit of the ACTS project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
0008 
0009 #pragma once
0010 
0011 #include "Acts/Definitions/Algebra.hpp"
0012 #include "Acts/Surfaces/BoundaryTolerance.hpp"
0013 
0014 #include <ostream>
0015 
0016 namespace Acts {
0017 
0018 /// @class SurfaceBounds
0019 ///
0020 /// Interface for surface bounds.
0021 ///
0022 /// Surface bounds provide:
0023 /// - inside() checks
0024 /// - distance to boundary calculations
0025 /// - the BoundsType and a set of parameters to simplify persistency
0026 ///
0027 class SurfaceBounds {
0028  public:
0029   /// @enum BoundsType
0030   /// This is nested to the SurfaceBounds, as also VolumeBounds will have
0031   /// Bounds Type.
0032   enum BoundsType : int {
0033     eCone = 0,
0034     eCylinder = 1,
0035     eDiamond = 2,
0036     eDisc = 3,
0037     eEllipse = 4,
0038     eLine = 5,
0039     eRectangle = 6,
0040     eTrapezoid = 7,
0041     eTriangle = 8,
0042     eDiscTrapezoid = 9,
0043     eConvexPolygon = 10,
0044     eAnnulus = 11,
0045     eBoundless = 12,
0046     eOther = 13
0047   };
0048 
0049   virtual ~SurfaceBounds() = default;
0050 
0051   /// Return the bounds type - for persistency optimization
0052   ///
0053   /// @return is a BoundsType enum
0054   virtual BoundsType type() const = 0;
0055 
0056   /// Access method for bound values, this is a dynamically sized
0057   /// vector containing the parameters needed to describe these bounds
0058   ///
0059   /// @return of the stored values for this SurfaceBounds object
0060   virtual std::vector<double> values() const = 0;
0061 
0062   /// Inside check for the bounds object driven by the boundary check directive
0063   /// Each Bounds has a method inside, which checks if a LocalPosition is inside
0064   /// the bounds  Inside can be called without/with tolerances.
0065   ///
0066   /// @param lposition Local position (assumed to be in right surface frame)
0067   /// @param boundaryTolerance boundary check directive
0068   /// @return boolean indicator for the success of this operation
0069   virtual bool inside(const Vector2& lposition,
0070                       const BoundaryTolerance& boundaryTolerance) const = 0;
0071 
0072   /// Output Method for std::ostream, to be overloaded by child classes
0073   ///
0074   /// @param os is the outstream in which the string dump is done
0075   virtual std::ostream& toStream(std::ostream& os) const = 0;
0076 
0077   friend bool operator==(const SurfaceBounds& lhs, const SurfaceBounds& rhs) {
0078     if (&lhs == &rhs) {
0079       return true;
0080     }
0081     return (lhs.type() == rhs.type()) && (lhs.values() == rhs.values());
0082   }
0083 
0084   friend std::ostream& operator<<(std::ostream& os, const SurfaceBounds& sb) {
0085     return sb.toStream(os);
0086   }
0087 };
0088 
0089 }  // namespace Acts