ATLAS Offline Software
Loading...
Searching...
No Matches
TrapezoidBoundsExpander.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4#ifndef ACTSMUONDETECTOR_TRAPEZOIDBOUNDSEXPANDER_H
5#define ACTSMUONDETECTOR_TRAPEZOIDBOUNDSEXPANDER_H
6#ifndef SIMULATIONBASE
7
9
10#include <iostream>
11
12namespace MuonGMR4 {
14 public:
19 explicit TrapezoidPatch(const Acts::Transform3& trf,
20 std::shared_ptr<const Acts::VolumeBounds> volBounds);
22 void print(std::ostream& ostr) const;
24 inline friend std::ostream& operator<<(std::ostream& ostr, const TrapezoidPatch& patch) {
25 patch.print(ostr);
26 return ostr;
27 }
28
29 double area() const;
31 Acts::Transform3 toCenter{Acts::Transform3::Identity()};
33 std::shared_ptr<const Acts::VolumeBounds> bounds{};
34 };
35
36 enum class Side : std::int8_t{left = -1, right = 1};
38 enum class Level : std::int8_t { bottom= -1, top = 1 };
40 friend std::ostream& operator<<(std::ostream& ostr, const Side side){
41 switch (side) {
42 case Side::left: return ostr<<"left";
43 case Side::right: return ostr<<"right";
44 }
45 return ostr;
46 }
47
48 friend std::ostream& operator<<(std::ostream& ostr, const Level lvl) {
49 switch (lvl) {
50 case Level::bottom: return ostr<<"bottom";
51 case Level::top: return ostr<<"top";
52 }
53 return ostr;
54 }
55
61 static Amg::Vector3D makeVertex(const TrapezoidPatch& trapezoid,
62 const Side side,
63 const Level lvl);
71 static double distanceToTrapezoid(const Amg::Vector3D& vertex,
72 const Amg::Vector3D& edge,
73 const Amg::Vector3D& testMe,
74 const Side side);
76 static std::uint8_t toIndex(const Side side, const Level lvl);
77
85 virtual void expand(const Acts::GeometryContext& tgContext,
86 const Acts::Volume& volume) override final;
87
89 virtual std::shared_ptr<Acts::VolumeBounds>
90 makeBounds(Acts::VolumeBoundFactory& factory) override final;
93 void setMargin(const double margin);
99 void setMargin(const double marginXlow, const double marginXhigh,
100 const double marginY, const double marginZ);
101 private:
110 void findTrapezoidEdge(Amg::Vector3D& botCorner,
111 Amg::Vector3D& topCorner,
112 const Side side,
113 const std::size_t lowPatch,
114 const std::size_t highPatch) const;
115 std::vector<TrapezoidPatch> m_constituents{};
116 std::shared_ptr<Acts::VolumeBounds> m_finalBounds{};
117 std::array<double, 4> m_margin{Acts::filledArray<double, 4>(0.)};
118 };
119}
120#endif
121#endif
BoundsExpander()=default
Default constructor.
void expand(const Acts::GeometryContext &tgContext, const MuonGMR4::Chamber &chamber)
Expand the bounds from a chamber.
static std::shared_ptr< Acts::VolumeBounds > makeBounds(const MuonGMR4::MuonReadoutElement &readoutElement, Acts::VolumeBoundFactory &boundFactory)
Crate volume bounds that enclose the readout element from the central localToGlobalTransform.
virtual std::shared_ptr< Acts::VolumeBounds > makeBounds(Acts::VolumeBoundFactory &factory) override final
void findTrapezoidEdge(Amg::Vector3D &botCorner, Amg::Vector3D &topCorner, const Side side, const std::size_t lowPatch, const std::size_t highPatch) const
Moves the position of the bottom and top corner of a trapezoid side such that all vertices are enclos...
std::vector< TrapezoidPatch > m_constituents
BoundsExpander()=default
Use the constructor from the base class.
void setMargin(const double margin)
Apply an extra margin to all four bound dimensions.
std::shared_ptr< Acts::VolumeBounds > m_finalBounds
static Amg::Vector3D makeVertex(const TrapezoidPatch &trapezoid, const Side side, const Level lvl)
Returns the vertex point from a trapezoid.
friend std::ostream & operator<<(std::ostream &ostr, const Level lvl)
Pipe the Level to an ostream.
Level
Enum to select the top / bottom corners of a trapezoid.
Side
Enum to select the left / right corners of a trapezoid.
friend std::ostream & operator<<(std::ostream &ostr, const Side side)
Pipe the Side to an ostream.
static double distanceToTrapezoid(const Amg::Vector3D &vertex, const Amg::Vector3D &edge, const Amg::Vector3D &testMe, const Side side)
Returns the distance to the inclided trapezoidal side Positive values imply that the test point is ou...
virtual void expand(const Acts::GeometryContext &tgContext, const Acts::Volume &volume) override final
static std::uint8_t toIndex(const Side side, const Level lvl)
Construct an index from [0;3] from the side and level.
Eigen::Matrix< double, 3, 1 > Vector3D
The ReadoutGeomCnvAlg converts the Run4 Readout geometry build from the GeoModelXML into the legacy M...
friend std::ostream & operator<<(std::ostream &ostr, const TrapezoidPatch &patch)
the ostream operator
void print(std::ostream &ostr) const
Print the TrapezoidPatch.
Acts::Transform3 toCenter
The transform to move to the outer trapezoid center.
double area() const
Calculates the area in the x-y plane.
TrapezoidPatch(const Acts::Transform3 &trf, std::shared_ptr< const Acts::VolumeBounds > volBounds)
The constructor.
std::shared_ptr< const Acts::VolumeBounds > bounds
Pointer to the volume bounds.