File indexing completed on 2025-07-11 08:04:07
0001
0002
0003
0004
0005
0006
0007
0008
0009 #pragma once
0010
0011 #include "Acts/Definitions/Algebra.hpp"
0012 #include "Acts/Geometry/Volume.hpp"
0013 #include "Acts/Geometry/VolumeBounds.hpp"
0014
0015 #include <array>
0016 #include <iosfwd>
0017 #include <memory>
0018 #include <stdexcept>
0019 #include <vector>
0020
0021 namespace Acts {
0022
0023 class CylinderBounds;
0024 class DiscBounds;
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038 class CutoutCylinderVolumeBounds : public VolumeBounds {
0039 public:
0040
0041 enum BoundValues : int {
0042 eMinR = 0,
0043 eMedR = 1,
0044 eMaxR = 2,
0045 eHalfLengthZ = 3,
0046 eHalfLengthZcutout = 4,
0047 eSize
0048 };
0049
0050 CutoutCylinderVolumeBounds() = delete;
0051
0052
0053
0054
0055
0056
0057
0058
0059 CutoutCylinderVolumeBounds(double rmin, double rmed, double rmax, double hlZ,
0060 double hlZc) noexcept(false)
0061 : m_values({rmin, rmed, rmax, hlZ, hlZc}) {
0062 checkConsistency();
0063 buildSurfaceBounds();
0064 }
0065
0066
0067
0068
0069 CutoutCylinderVolumeBounds(const std::array<double, eSize>& values) noexcept(
0070 false)
0071 : m_values(values) {
0072 checkConsistency();
0073 buildSurfaceBounds();
0074 }
0075
0076 ~CutoutCylinderVolumeBounds() override = default;
0077
0078 VolumeBounds::BoundsType type() const final {
0079 return VolumeBounds::eCutoutCylinder;
0080 }
0081
0082
0083
0084
0085 std::vector<double> values() const final;
0086
0087
0088
0089
0090
0091
0092 bool inside(const Vector3& gpos, double tol = 0) const override;
0093
0094
0095
0096
0097
0098
0099
0100
0101
0102
0103
0104 std::vector<OrientedSurface> orientedSurfaces(
0105 const Transform3& transform = Transform3::Identity()) const override;
0106
0107
0108
0109
0110
0111
0112
0113 Volume::BoundingBox boundingBox(const Transform3* trf = nullptr,
0114 const Vector3& envelope = {0, 0, 0},
0115 const Volume* entity = nullptr) const final;
0116
0117
0118
0119
0120
0121 std::vector<Acts::BinningValue> canonicalBinning() const override {
0122 return {Acts::BinningValue::binR, Acts::BinningValue::binPhi,
0123 Acts::BinningValue::binZ};
0124 };
0125
0126
0127
0128
0129
0130 std::ostream& toStream(std::ostream& sl) const override;
0131
0132
0133
0134 double get(BoundValues bValue) const { return m_values[bValue]; }
0135
0136 private:
0137 std::array<double, eSize> m_values;
0138
0139
0140 std::shared_ptr<const CylinderBounds> m_innerCylinderBounds{nullptr};
0141 std::shared_ptr<const CylinderBounds> m_cutoutCylinderBounds{nullptr};
0142 std::shared_ptr<const CylinderBounds> m_outerCylinderBounds{nullptr};
0143 std::shared_ptr<const DiscBounds> m_outerDiscBounds{nullptr};
0144 std::shared_ptr<const DiscBounds> m_innerDiscBounds{nullptr};
0145
0146
0147 void buildSurfaceBounds();
0148
0149
0150
0151 void checkConsistency() noexcept(false);
0152 };
0153
0154 inline std::vector<double> CutoutCylinderVolumeBounds::values() const {
0155 std::vector<double> valvector;
0156 valvector.insert(valvector.begin(), m_values.begin(), m_values.end());
0157 return valvector;
0158 }
0159
0160 inline void CutoutCylinderVolumeBounds::checkConsistency() noexcept(false) {
0161 if (get(eMinR) < 0. || get(eMedR) <= 0. || get(eMaxR) <= 0. ||
0162 get(eMinR) >= get(eMedR) || get(eMinR) >= get(eMaxR) ||
0163 get(eMedR) >= get(eMaxR)) {
0164 throw std::invalid_argument(
0165 "CutoutCylinderVolumeBounds: invalid radial input.");
0166 }
0167 if (get(eHalfLengthZ) <= 0 || get(eHalfLengthZcutout) <= 0. ||
0168 get(eHalfLengthZcutout) > get(eHalfLengthZ)) {
0169 throw std::invalid_argument(
0170 "CutoutCylinderVolumeBounds: invalid longitudinal input.");
0171 }
0172 }
0173
0174 }