File indexing completed on 2025-01-18 09:10:53
0001
0002
0003
0004
0005
0006
0007
0008
0009 #pragma once
0010
0011 #include "Acts/Definitions/Algebra.hpp"
0012 #include "Acts/Definitions/Direction.hpp"
0013 #include "Acts/Geometry/Volume.hpp"
0014 #include "Acts/Surfaces/RegularSurface.hpp"
0015 #include "Acts/Utilities/AxisDefinitions.hpp"
0016
0017 #include <cmath>
0018 #include <iostream>
0019 #include <memory>
0020 #include <numbers>
0021 #include <utility>
0022 #include <vector>
0023
0024 namespace Acts {
0025
0026 class Surface;
0027 class VolumeBounds;
0028 class Direction;
0029
0030 struct OrientedSurface {
0031 std::shared_ptr<RegularSurface> surface;
0032 Direction direction = Direction::AlongNormal();
0033 };
0034
0035
0036 static const Transform3 s_planeXY = Transform3::Identity();
0037 static const Transform3 s_planeYZ =
0038 AngleAxis3(std::numbers::pi / 2., Vector3::UnitY()) *
0039 AngleAxis3(std::numbers::pi / 2., Vector3::UnitZ()) *
0040 Transform3::Identity();
0041 static const Transform3 s_planeZX =
0042 AngleAxis3(-std::numbers::pi / 2., Vector3::UnitX()) *
0043 AngleAxis3(-std::numbers::pi / 2., Vector3::UnitZ()) *
0044 Transform3::Identity();
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058 class VolumeBounds {
0059 public:
0060
0061
0062
0063 enum class BoundsType {
0064 eCone,
0065 eCuboid,
0066 eCutoutCylinder,
0067 eCylinder,
0068 eGenericCuboid,
0069 eTrapezoid,
0070 eOther,
0071
0072 };
0073
0074 using enum BoundsType;
0075
0076
0077 static const std::vector<std::string> s_boundsTypeNames;
0078
0079 VolumeBounds() = default;
0080
0081 virtual ~VolumeBounds() = default;
0082
0083
0084
0085
0086 virtual BoundsType type() const = 0;
0087
0088
0089
0090
0091
0092 virtual std::vector<double> values() const = 0;
0093
0094
0095
0096
0097
0098
0099
0100 virtual bool inside(const Vector3& gpos, double tol = 0.) const = 0;
0101
0102
0103
0104
0105
0106
0107
0108
0109
0110
0111
0112 virtual std::vector<OrientedSurface> orientedSurfaces(
0113 const Transform3& transform = Transform3::Identity()) const = 0;
0114
0115
0116
0117
0118
0119
0120 virtual Volume::BoundingBox boundingBox(
0121 const Transform3* trf = nullptr, const Vector3& envelope = {0, 0, 0},
0122 const Volume* entity = nullptr) const = 0;
0123
0124
0125
0126
0127
0128
0129
0130
0131
0132 virtual std::vector<AxisDirection> canonicalAxes() const {
0133 using enum AxisDirection;
0134 return {AxisX, AxisY, AxisZ};
0135 };
0136
0137
0138
0139
0140
0141
0142 virtual Vector3 referenceOffset(AxisDirection aDir) const;
0143
0144
0145
0146
0147
0148
0149 virtual double referenceBorder(AxisDirection aDir) const;
0150
0151
0152
0153
0154 virtual std::ostream& toStream(std::ostream& sl) const = 0;
0155 };
0156
0157
0158 inline Vector3 VolumeBounds::referenceOffset(
0159 AxisDirection ) const {
0160 return Vector3(0., 0., 0.);
0161 }
0162
0163 inline double VolumeBounds::referenceBorder(AxisDirection ) const {
0164 return 0.;
0165 }
0166
0167
0168 std::ostream& operator<<(std::ostream& sl, const VolumeBounds& vb);
0169
0170 inline bool operator==(const VolumeBounds& lhs, const VolumeBounds& rhs) {
0171 if (&lhs == &rhs) {
0172 return true;
0173 }
0174 return (lhs.type() == rhs.type()) && (lhs.values() == rhs.values());
0175 }
0176
0177 std::ostream& operator<<(std::ostream& sl, const VolumeBounds::BoundsType& bt);
0178
0179 }