File indexing completed on 2025-07-11 07:50:12
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 DetectorElementBase* element = sf->associatedDetectorElement();
0031 const auto* regSurface = dynamic_cast<const RegularSurface*>(sf);
0032 if (element != nullptr && regSurface != nullptr) {
0033
0034 double thickness = element->thickness();
0035
0036 Vector3 sfNormal = regSurface->normal(gctx, sf->center(gctx));
0037 for (const auto& dT : {-0.5 * thickness, 0.5 * thickness}) {
0038 Transform3 dtransform = transform * Translation3{dT * sfNormal};
0039 extent.extend(sfPolyhedron.extent(dtransform));
0040 }
0041 continue;
0042 }
0043 extent.extend(sfPolyhedron.extent(transform));
0044 }
0045 }
0046
0047 double ProtoLayerBase::min(AxisDirection aDir, bool addenv) const {
0048 if (addenv) {
0049 return extent.min(aDir) - envelope[aDir][0u];
0050 }
0051 return extent.min(aDir);
0052 }
0053
0054 double ProtoLayerBase::max(AxisDirection aDir, bool addenv) const {
0055 if (addenv) {
0056 return extent.max(aDir) + envelope[aDir][1u];
0057 }
0058 return extent.max(aDir);
0059 }
0060
0061 double ProtoLayerBase::medium(AxisDirection aDir, bool addenv) const {
0062 return 0.5 * (min(aDir, addenv) + max(aDir, addenv));
0063 }
0064
0065 double ProtoLayerBase::range(AxisDirection aDir, bool addenv) const {
0066 return std::abs(max(aDir, addenv) - min(aDir, addenv));
0067 }
0068
0069 std::ostream& ProtoLayerBase::toStream(std::ostream& sl) const {
0070 sl << "ProtoLayer with dimensions (min/max)" << std::endl;
0071 sl << extent.toString();
0072 return sl;
0073 }
0074
0075 }
0076
0077 ProtoLayer::ProtoLayer(const MutableProtoLayer& other) {
0078 transform = other.transform;
0079 extent = other.extent;
0080 envelope = other.envelope;
0081
0082 m_surfaces.reserve(other.surfaces().size());
0083 for (const auto& sf : other.surfaces()) {
0084 m_surfaces.push_back(sf);
0085 }
0086 }
0087
0088 }