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 #include "Acts/Surfaces/DiscBounds.hpp"
0014 #include "Acts/Surfaces/SurfaceBounds.hpp"
0015 
0016 #include <array>
0017 #include <iosfwd>
0018 #include <numbers>
0019 #include <vector>
0020 
0021 namespace Acts {
0022 
0023 /// @class RadialBounds
0024 ///
0025 /// Class to describe the bounds for a planar DiscSurface.
0026 /// By providing an argument for hphisec, the bounds can
0027 /// be restricted to a phi-range around the center position.
0028 ///
0029 class RadialBounds : public DiscBounds {
0030  public:
0031   enum BoundValues {
0032     eMinR = 0,
0033     eMaxR = 1,
0034     eHalfPhiSector = 2,
0035     eAveragePhi = 3,
0036     eSize = 4
0037   };
0038 
0039   /// Constructor for full disc of symmetric disc around phi=0
0040   ///
0041   /// @param minR The inner radius (0 for full disc)
0042   /// @param maxR The outer radius
0043   /// @param halfPhi The half opening angle (Pi for full angular coverage)
0044   /// @param avgPhi The average phi for the disc/ring sector
0045   RadialBounds(double minR, double maxR, double halfPhi = std::numbers::pi,
0046                double avgPhi = 0.) noexcept(false)
0047       : m_values({minR, maxR, halfPhi, avgPhi}) {
0048     checkConsistency();
0049   }
0050 
0051   /// Constructor from array values
0052   ///
0053   /// @param values The bound values
0054   RadialBounds(const std::array<double, eSize>& values) noexcept(false)
0055       : m_values(values) {
0056     checkConsistency();
0057   }
0058 
0059   BoundsType type() const final { return SurfaceBounds::eDisc; }
0060 
0061   /// Return the bound values as dynamically sized vector
0062   ///
0063   /// @return this returns a copy of the internal values
0064   std::vector<double> values() const final;
0065 
0066   /// For disc surfaces the local position in (r,phi) is checked
0067   ///
0068   /// @param lposition local position to be checked
0069   /// @param boundaryTolerance boundary check directive
0070   ///
0071   /// @return is a boolean indicating the operation success
0072   bool inside(const Vector2& lposition,
0073               const BoundaryTolerance& boundaryTolerance) const final;
0074 
0075   /// Outstream operator
0076   ///
0077   /// @param sl is the ostream to be dumped into
0078   std::ostream& toStream(std::ostream& sl) const final;
0079 
0080   /// Return method for inner Radius
0081   double rMin() const final { return get(eMinR); }
0082 
0083   /// Return method for outer Radius
0084   double rMax() const final { return get(eMaxR); }
0085 
0086   /// Access to the bound values
0087   /// @param bValue the class nested enum for the array access
0088   double get(BoundValues bValue) const { return m_values[bValue]; }
0089 
0090   /// Returns true for full phi coverage
0091   bool coversFullAzimuth() const final {
0092     return (get(eHalfPhiSector) == std::numbers::pi);
0093   }
0094 
0095   /// Checks if this is inside the radial coverage
0096   /// given the a tolerance
0097   bool insideRadialBounds(double R, double tolerance = 0.) const final {
0098     return (R + tolerance > get(eMinR) && R - tolerance < get(eMaxR));
0099   }
0100 
0101   /// Return a reference radius for binning
0102   double binningValueR() const final { return 0.5 * (get(eMinR) + get(eMaxR)); }
0103 
0104   /// Return a reference radius for binning
0105   double binningValuePhi() const final { return get(eAveragePhi); }
0106 
0107  private:
0108   std::array<double, eSize> m_values;
0109 
0110   /// Check the input values for consistency, will throw a logic_exception
0111   /// if consistency is not given
0112   void checkConsistency() noexcept(false);
0113 
0114   /// Private helper method to shift a local position
0115   /// within the bounds
0116   ///
0117   /// @param lposition The local position in polar coordinates
0118   Vector2 shifted(const Vector2& lposition) const;
0119 
0120   /// This method returns the xy coordinates of vertices along
0121   /// the radial bounds
0122   ///
0123   /// @param lseg the number of segments used to approximate
0124   /// and eventually curved line
0125   ///
0126   /// @note that the extremas are given, which may slightly alter the
0127   /// number of segments returned
0128   ///
0129   /// @return vector for vertices in 2D
0130   std::vector<Vector2> vertices(unsigned int lseg) const final;
0131 };
0132 
0133 }  // namespace Acts