File indexing completed on 2026-03-29 07:46:54
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include "Acts/Geometry/ProtoLayer.hpp"
0010
0011 #include "Acts/Definitions/Algebra.hpp"
0012 #include "Acts/Geometry/Polyhedron.hpp"
0013 #include "Acts/Surfaces/RegularSurface.hpp"
0014
0015 namespace Acts {
0016
0017 using VectorHelpers::perp;
0018 using VectorHelpers::phi;
0019
0020 namespace detail {
0021
0022 void ProtoLayerBase::measureImpl(const GeometryContext& gctx,
0023 const std::vector<const Surface*>& surfaces,
0024 Extent& extent, const Transform3& transform) {
0025 for (const auto& sf : surfaces) {
0026
0027
0028 int lseg = (sf->type() != Surface::Straw) ? 1 : 2;
0029 auto sfPolyhedron = sf->polyhedronRepresentation(gctx, lseg);
0030 const auto* regSurface = dynamic_cast<const RegularSurface*>(sf);
0031 if (sf->isSensitive() && regSurface != nullptr) {
0032
0033 double thickness = sf->thickness();
0034
0035 Vector3 sfNormal = regSurface->normal(gctx, sf->center(gctx));
0036 for (const auto& dT : {-0.5 * thickness, 0.5 * thickness}) {
0037 Transform3 dtransform = transform * Translation3{dT * sfNormal};
0038 extent.extend(sfPolyhedron.extent(dtransform));
0039 }
0040 continue;
0041 }
0042 extent.extend(sfPolyhedron.extent(transform));
0043 }
0044 }
0045
0046 double ProtoLayerBase::min(AxisDirection aDir, bool addenv) const {
0047 if (addenv) {
0048 return extent.min(aDir) - envelope[aDir][0u];
0049 }
0050 return extent.min(aDir);
0051 }
0052
0053 double ProtoLayerBase::max(AxisDirection aDir, bool addenv) const {
0054 if (addenv) {
0055 return extent.max(aDir) + envelope[aDir][1u];
0056 }
0057 return extent.max(aDir);
0058 }
0059
0060 double ProtoLayerBase::medium(AxisDirection aDir, bool addenv) const {
0061 return 0.5 * (min(aDir, addenv) + max(aDir, addenv));
0062 }
0063
0064 double ProtoLayerBase::range(AxisDirection aDir, bool addenv) const {
0065 return std::abs(max(aDir, addenv) - min(aDir, addenv));
0066 }
0067
0068 std::ostream& ProtoLayerBase::toStream(std::ostream& sl) const {
0069 sl << "ProtoLayer with dimensions (min/max)" << std::endl;
0070 sl << extent.toString();
0071 return sl;
0072 }
0073
0074 }
0075
0076 ProtoLayer::ProtoLayer(const MutableProtoLayer& other) {
0077 transform = other.transform;
0078 extent = other.extent;
0079 envelope = other.envelope;
0080
0081 m_surfaces.reserve(other.surfaces().size());
0082 for (const auto& sf : other.surfaces()) {
0083 m_surfaces.push_back(sf);
0084 }
0085 }
0086
0087 }