ATLAS Offline Software
Loading...
Searching...
No Matches
Trk::TrapezoidVolumeBounds Class Referencefinal

Bounds for a trapezoidal shaped Volume, the decomposeToSurfaces method creates a vector of 6 surfaces: More...

#include <TrapezoidVolumeBounds.h>

Inheritance diagram for Trk::TrapezoidVolumeBounds:
Collaboration diagram for Trk::TrapezoidVolumeBounds:

Public Member Functions

 TrapezoidVolumeBounds ()
 Default Constructor.
 TrapezoidVolumeBounds (double minhlenghtx, double maxhlengthx, double hlenghty, double hlengthz)
 Constructor - the trapezoid boundaries (symmetric trapezoid)
 TrapezoidVolumeBounds (double minhlenghtx, double hlenghty, double hlengthz, double alpha, double beta)
 Constructor - the trapezoid boundaries (arbitrary trapezoid)
 TrapezoidVolumeBounds (const TrapezoidVolumeBounds &bobo)
 Copy Constructor.
virtual ~TrapezoidVolumeBounds ()
 Destructor.
TrapezoidVolumeBoundsoperator= (const TrapezoidVolumeBounds &bobo)
 Assignment operator.
TrapezoidVolumeBoundsclone () const override final
 Virtual constructor.
bool inside (const Amg::Vector3D &, double tol=0.) const override final
 This method checks if position in the 3D volume frame is inside the cylinder.
virtual std::vector< std::unique_ptr< Trk::Surface > > decomposeToSurfaces (const Amg::Transform3D &transform) override final
 Method to decompose the Bounds into Surfaces.
ObjectAccessor boundarySurfaceAccessor (const Amg::Vector3D &gp, const Amg::Vector3D &dir, bool forceInside=false) const override
 Provide accessor for BoundarySurfaces.
double minHalflengthX () const
 This method returns the minimal halflength in local x.
double maxHalflengthX () const
 This method returns the maximal halflength in local x.
double halflengthY () const
 This method returns the halflength in local y.
double halflengthZ () const
 This method returns the halflength in local z.
double alpha () const
 This method returns the opening angle in point A (negative local x)
double beta () const
 This method returns the opening angle in point B (negative local x)
MsgStream & dump (MsgStream &sl) const override final
 Output Method for MsgStream.
std::ostream & dump (std::ostream &sl) const override final
 Output Method for std::ostream.

Private Member Functions

std::shared_ptr< TrapezoidBoundsfaceXYTrapezoidBounds () const
 This method returns the associated TrapezoidBounds of the face PlaneSurface parallel to local xy plane.
std::shared_ptr< RectangleBoundsfaceAlphaRectangleBounds () const
 This method returns the associated RecantleBounds of the face PlaneSurface attached to alpha (negative local x)
std::shared_ptr< RectangleBoundsfaceBetaRectangleBounds () const
 This method returns the associated RecantleBounds of the face PlaneSurface attached to beta (positive local x)
std::shared_ptr< RectangleBoundsfaceZXRectangleBoundsBottom () const
 This method returns the associated RecantleBounds of the face PlaneSurface parallel to local zx plane, negative local y.
std::shared_ptr< RectangleBoundsfaceZXRectangleBoundsTop () const
 This method returns the associated RecantleBounds of the face PlaneSurface parallel to local zx plane, positive local y.

Private Attributes

double m_minHalfX
 minimal halflength in x
double m_maxHalfX
 maximal halflength in x
double m_halfY
 halflength in y
double m_halfZ
 halflength in z
double m_alpha
 opening angle alpha (in point A)
double m_beta
 opening angle beta (in point B)
SixObjectsAccessor m_objectAccessor
 There's only one single object Acessor for the moment has to be implemented if Cuboids are used more widely.

Detailed Description

Bounds for a trapezoidal shaped Volume, the decomposeToSurfaces method creates a vector of 6 surfaces:

BoundarySurfaceFace [index]:

- negativeFaceXY     [0] : Trazpezoidal Trk::PlaneSurface,
                           parallel to \f$ xy \f$ plane at negative \f$ z

\( - positiveFaceXY [1] : Trazpezoidal Trk::PlaneSurface, parallel to \) xy \( plane at positive \) z \( - trapezoidFaceAlpha [2] : Rectangular Trk::PlaneSurface, attached to [0] and [1] at negative \) x \((associated to alpha) - trapezoidFaceBeta [3] : Rectangular Trk::PlaneSurface, attached to [0] and [1] at positive \) x \((associated to beta) - negativeFaceZX [4] : Rectangular Trk::PlaneSurface, parallel to \) zx \( plane at negative \) y \( - positiveFaceZX [5] : Rectangular Trk::PlaneSurface, parallel to \) zx \( plane at positive \) y

Definition at line 57 of file TrapezoidVolumeBounds.h.

Constructor & Destructor Documentation

◆ TrapezoidVolumeBounds() [1/4]

Trk::TrapezoidVolumeBounds::TrapezoidVolumeBounds ( )

Default Constructor.

Definition at line 26 of file TrapezoidVolumeBounds.cxx.

27 : VolumeBounds()
28 , m_minHalfX(0.)
29 , m_maxHalfX(0.)
30 , m_halfY(0.)
31 , m_halfZ(0.)
32 , m_alpha(0.)
33 , m_beta(0.)
35{}
double m_alpha
opening angle alpha (in point A)
SixObjectsAccessor m_objectAccessor
There's only one single object Acessor for the moment has to be implemented if Cuboids are used more ...
double m_maxHalfX
maximal halflength in x
double m_beta
opening angle beta (in point B)
double m_minHalfX
minimal halflength in x
VolumeBounds()
Default Constructor.

◆ TrapezoidVolumeBounds() [2/4]

Trk::TrapezoidVolumeBounds::TrapezoidVolumeBounds ( double minhlenghtx,
double maxhlengthx,
double hlenghty,
double hlengthz )

Constructor - the trapezoid boundaries (symmetric trapezoid)

Definition at line 37 of file TrapezoidVolumeBounds.cxx.

42 : VolumeBounds()
43 , m_minHalfX(minhalex)
44 , m_maxHalfX(maxhalex)
45 , m_halfY(haley)
46 , m_halfZ(halez)
47 , m_alpha(0.)
48 , m_beta(0.)
50{
51 m_alpha = atan((m_maxHalfX - m_minHalfX) / 2 / m_halfY) + 0.5 * M_PI;
53}
#define M_PI

◆ TrapezoidVolumeBounds() [3/4]

Trk::TrapezoidVolumeBounds::TrapezoidVolumeBounds ( double minhlenghtx,
double hlenghty,
double hlengthz,
double alpha,
double beta )

Constructor - the trapezoid boundaries (arbitrary trapezoid)

Definition at line 55 of file TrapezoidVolumeBounds.cxx.

61 : VolumeBounds()
62 , m_minHalfX(minhalex)
63 , m_maxHalfX(0.)
64 , m_halfY(haley)
65 , m_halfZ(halez)
66 , m_alpha(alpha)
67 , m_beta(beta)
69{
70 double gamma = (alpha > beta) ? (alpha - 0.5 * M_PI) : (beta - 0.5 * M_PI);
71 m_maxHalfX = m_minHalfX + (2. * m_halfY) * tan(gamma);
72}
double alpha() const
This method returns the opening angle in point A (negative local x)
double beta() const
This method returns the opening angle in point B (negative local x)

◆ TrapezoidVolumeBounds() [4/4]

Trk::TrapezoidVolumeBounds::TrapezoidVolumeBounds ( const TrapezoidVolumeBounds & bobo)

Copy Constructor.

Definition at line 74 of file TrapezoidVolumeBounds.cxx.

76 : VolumeBounds()
77 , m_minHalfX(trabo.m_minHalfX)
78 , m_maxHalfX(trabo.m_maxHalfX)
79 , m_halfY(trabo.m_halfY)
80 , m_halfZ(trabo.m_halfZ)
81 , m_alpha(trabo.m_alpha)
82 , m_beta(trabo.m_beta)
83 , m_objectAccessor(trabo.m_objectAccessor)
84{}

◆ ~TrapezoidVolumeBounds()

Trk::TrapezoidVolumeBounds::~TrapezoidVolumeBounds ( )
virtualdefault

Destructor.

Member Function Documentation

◆ alpha()

double Trk::TrapezoidVolumeBounds::alpha ( ) const
inline

This method returns the opening angle in point A (negative local x)

Definition at line 165 of file TrapezoidVolumeBounds.h.

165{ return m_alpha; }

◆ beta()

double Trk::TrapezoidVolumeBounds::beta ( ) const
inline

This method returns the opening angle in point B (negative local x)

Definition at line 166 of file TrapezoidVolumeBounds.h.

166{ return m_beta; }

◆ boundarySurfaceAccessor()

ObjectAccessor Trk::TrapezoidVolumeBounds::boundarySurfaceAccessor ( const Amg::Vector3D & gp,
const Amg::Vector3D & dir,
bool forceInside = false ) const
inlineoverridevirtual

Provide accessor for BoundarySurfaces.

Implements Trk::VolumeBounds.

Definition at line 168 of file TrapezoidVolumeBounds.h.

169 {
170 return Trk::ObjectAccessor(m_objectAccessor);
171}

◆ clone()

TrapezoidVolumeBounds * Trk::TrapezoidVolumeBounds::clone ( ) const
inlinefinaloverridevirtual

Virtual constructor.

Implements Trk::VolumeBounds.

Definition at line 153 of file TrapezoidVolumeBounds.h.

153 {
154 return new TrapezoidVolumeBounds(*this);
155}
TrapezoidVolumeBounds()
Default Constructor.

◆ decomposeToSurfaces()

std::vector< std::unique_ptr< Trk::Surface > > Trk::TrapezoidVolumeBounds::decomposeToSurfaces ( const Amg::Transform3D & transform)
finaloverridevirtual

Method to decompose the Bounds into Surfaces.

Implements Trk::VolumeBounds.

Definition at line 104 of file TrapezoidVolumeBounds.cxx.

106{
107 auto retsf = std::vector<std::unique_ptr<Trk::Surface>>();
108
109 // face surfaces xy
110 Amg::RotationMatrix3D trapezoidRotation(transform.rotation());
111 Amg::Vector3D trapezoidX(trapezoidRotation.col(0));
112 Amg::Vector3D trapezoidY(trapezoidRotation.col(1));
113 Amg::Vector3D trapezoidZ(trapezoidRotation.col(2));
114 Amg::Vector3D trapezoidCenter(transform.translation());
115
116 // (1) - at negative local z
117 retsf.push_back(std::make_unique<Trk::PlaneSurface>(
119 transform *
120 Amg::AngleAxis3D(180 * Gaudi::Units::deg, Amg::Vector3D(0., 1., 0.)) *
122 this->faceXYTrapezoidBounds()));
123 // (2) - at positive local z
124 retsf.push_back(std::make_unique<Trk::PlaneSurface>(
126 transform *
128 this->faceXYTrapezoidBounds()));
129 // face surfaces yz
130 // transmute cyclical
131 // (3) - at point A, attached to alpha opening angle
132 // the yz bound are created in such a way that the surface y-direction has to
133 // become the z-direction. The resulting surface normal has to point in
134 // y-direction. This is achieved by rotating the plane surface by -90
135 // degrees around the x-axis.
136 // Then, the plane has to be rotated around the z-axis by alpha.
137 //
138 // double c=cos(M_PI/2);
139 // double s=sin(M_PI/2);
140 // Amg::RotationMatrix3D rotate_to_xz;
141 // rotate_to_xz << 1.f, 0.f, 0.f, // 1 0 0
142 // 0.f, c, -s, // 0 0 -1
143 // 0.f, s, c; // 0 1 0
144 //
145 // s=sin(-alpha());
146 // c=cos(-alpha());
147 // Amg::RotationMatrix3D rotate_left;
148 // rotate_left << c, s, 0.f,
149 // -s, c, 0.f,
150 // 0.f, 0.f, 1.f;
151 //
152 // Amg::RotationMatrix3D rotateToFaceAlpha( rotate_left * rotate_to_xz);
153 Amg::RotationMatrix3D rotateToFaceAlpha;
154 {
155 double s=sin(-alpha());
156 double c=cos(-alpha());
157 rotateToFaceAlpha << c, 0.f, s,
158 -s, 0.f, c,
159 0.f, -1.f, 0.f;
160 }
161
162 std::shared_ptr<RectangleBounds> faceAlphaBounds = this->faceAlphaRectangleBounds();
163 Amg::Vector3D faceAlphaPosition0(
164 -0.5 * (this->minHalflengthX() + this->maxHalflengthX()), 0., 0.);
165 Amg::Vector3D faceAlphaPosition = transform * faceAlphaPosition0;
166 retsf.push_back(std::make_unique<Trk::PlaneSurface>( Amg::Translation3D(faceAlphaPosition)
167 * Amg::Transform3D(trapezoidRotation * rotateToFaceAlpha),
168 faceAlphaBounds));
169 // (4) - at point B, attached to beta opening angle
170 // same as above but rotate to the right by beta
171 Amg::RotationMatrix3D rotateToFaceBeta;
172 {
173 double s=sin(beta());
174 double c=cos(beta());
175 rotateToFaceBeta << c, 0.f, s,
176 -s, 0.f, c,
177 0.f, -1.f, 0.f;
178 }
179
180 std::shared_ptr<RectangleBounds> faceBetaBounds = this->faceBetaRectangleBounds();
181 // Amg::Vector3D
182 // faceBetaPosition(B+faceBetaRotation.colX()*faceBetaBounds->halflengthX());
183 Amg::Vector3D faceBetaPosition0(
184 0.5 * (this->minHalflengthX() + this->maxHalflengthX()), 0., 0.);
185 Amg::Vector3D faceBetaPosition = transform * faceBetaPosition0;
186 retsf.push_back(std::make_unique<Trk::PlaneSurface>( Amg::Translation3D(faceBetaPosition)
187 * Amg::Transform3D(trapezoidRotation * rotateToFaceBeta),
188 faceBetaBounds));
189 retsf.push_back(std::make_unique<Trk::PlaneSurface>(
191 transform *
192 Amg::AngleAxis3D(180. * Gaudi::Units::deg, Amg::Vector3D(1., 0., 0.)) *
194 Amg::AngleAxis3D(-90 * Gaudi::Units::deg, Amg::Vector3D(0., 1., 0.)) *
195 Amg::AngleAxis3D(-90. * Gaudi::Units::deg, Amg::Vector3D(1., 0., 0.))),
197 // (6) - at positive local x
198 retsf.push_back(std::make_unique<Trk::PlaneSurface>(
200 transform *
202 Amg::AngleAxis3D(-90 * Gaudi::Units::deg, Amg::Vector3D(0., 1., 0.)) *
203 Amg::AngleAxis3D(-90. * Gaudi::Units::deg, Amg::Vector3D(1., 0., 0.))),
204 this->faceZXRectangleBoundsTop()));
205
206 return retsf;
207}
double halflengthZ() const
This method returns the halflength in local z.
std::shared_ptr< RectangleBounds > faceAlphaRectangleBounds() const
This method returns the associated RecantleBounds of the face PlaneSurface attached to alpha (negativ...
std::shared_ptr< RectangleBounds > faceZXRectangleBoundsBottom() const
This method returns the associated RecantleBounds of the face PlaneSurface parallel to local zx plane...
double minHalflengthX() const
This method returns the minimal halflength in local x.
double halflengthY() const
This method returns the halflength in local y.
std::shared_ptr< RectangleBounds > faceZXRectangleBoundsTop() const
This method returns the associated RecantleBounds of the face PlaneSurface parallel to local zx plane...
std::shared_ptr< TrapezoidBounds > faceXYTrapezoidBounds() const
This method returns the associated TrapezoidBounds of the face PlaneSurface parallel to local xy plan...
std::shared_ptr< RectangleBounds > faceBetaRectangleBounds() const
This method returns the associated RecantleBounds of the face PlaneSurface attached to beta (positive...
double maxHalflengthX() const
This method returns the maximal halflength in local x.
Eigen::AngleAxisd AngleAxis3D
Eigen::Matrix< double, 3, 3 > RotationMatrix3D
Eigen::Affine3d Transform3D
Amg::Vector3D transform(Amg::Vector3D &v, Amg::Transform3D &tr)
Transform a point from a Trasformation3D.
Eigen::Matrix< double, 3, 1 > Vector3D
Eigen::Translation< double, 3 > Translation3D

◆ dump() [1/2]

MsgStream & Trk::TrapezoidVolumeBounds::dump ( MsgStream & sl) const
finaloverridevirtual

Output Method for MsgStream.

Implements Trk::VolumeBounds.

Definition at line 258 of file TrapezoidVolumeBounds.cxx.

259{
260 std::stringstream temp_sl;
261 temp_sl << std::setiosflags(std::ios::fixed);
262 temp_sl << std::setprecision(7);
263 temp_sl
264 << "Trk::TrapezoidVolumeBounds: (minhalfX, halfY, halfZ, alpha, beta) = ";
265 temp_sl << "(" << m_minHalfX << ", " << m_halfY << ", " << m_halfZ;
266 temp_sl << ", " << m_alpha << ", " << m_beta << ")";
267 sl << temp_sl.str();
268 return sl;
269}

◆ dump() [2/2]

std::ostream & Trk::TrapezoidVolumeBounds::dump ( std::ostream & sl) const
finaloverridevirtual

Output Method for std::ostream.

Implements Trk::VolumeBounds.

Definition at line 272 of file TrapezoidVolumeBounds.cxx.

273{
274 std::stringstream temp_sl;
275 temp_sl << std::setiosflags(std::ios::fixed);
276 temp_sl << std::setprecision(7);
277 temp_sl
278 << "Trk::TrapezoidVolumeBounds: (minhalfX, halfY, halfZ, alpha, beta) = ";
279 temp_sl << "(" << m_minHalfX << ", " << m_halfY << ", " << m_halfZ;
280 temp_sl << ", " << m_alpha << ", " << m_beta << ")";
281 sl << temp_sl.str();
282 return sl;
283}

◆ faceAlphaRectangleBounds()

std::shared_ptr< Trk::RectangleBounds > Trk::TrapezoidVolumeBounds::faceAlphaRectangleBounds ( ) const
private

This method returns the associated RecantleBounds of the face PlaneSurface attached to alpha (negative local x)

Definition at line 217 of file TrapezoidVolumeBounds.cxx.

218{
219 return std::make_shared<Trk::RectangleBounds>(m_halfY / cos(m_alpha - 0.5 * M_PI), m_halfZ);
220}

◆ faceBetaRectangleBounds()

std::shared_ptr< Trk::RectangleBounds > Trk::TrapezoidVolumeBounds::faceBetaRectangleBounds ( ) const
private

This method returns the associated RecantleBounds of the face PlaneSurface attached to beta (positive local x)

Definition at line 223 of file TrapezoidVolumeBounds.cxx.

224{
225 return std::make_shared<Trk::RectangleBounds>(m_halfY / cos(m_beta - 0.5 * M_PI), m_halfZ);
226}

◆ faceXYTrapezoidBounds()

std::shared_ptr< Trk::TrapezoidBounds > Trk::TrapezoidVolumeBounds::faceXYTrapezoidBounds ( ) const
private

This method returns the associated TrapezoidBounds of the face PlaneSurface parallel to local xy plane.

Definition at line 211 of file TrapezoidVolumeBounds.cxx.

212{
213 return std::make_shared<Trk::TrapezoidBounds>(m_minHalfX, m_maxHalfX, m_halfY);
214}

◆ faceZXRectangleBoundsBottom()

std::shared_ptr< Trk::RectangleBounds > Trk::TrapezoidVolumeBounds::faceZXRectangleBoundsBottom ( ) const
private

This method returns the associated RecantleBounds of the face PlaneSurface parallel to local zx plane, negative local y.

Definition at line 229 of file TrapezoidVolumeBounds.cxx.

230{
231 return std::make_shared<Trk::RectangleBounds>(m_halfZ, m_minHalfX);
232}

◆ faceZXRectangleBoundsTop()

std::shared_ptr< Trk::RectangleBounds > Trk::TrapezoidVolumeBounds::faceZXRectangleBoundsTop ( ) const
private

This method returns the associated RecantleBounds of the face PlaneSurface parallel to local zx plane, positive local y.

Definition at line 235 of file TrapezoidVolumeBounds.cxx.

236{
237 // double delta = (m_alpha < m_beta) ? m_alpha - M_PI/2. : m_beta - M_PI/2.;
238 // return new Trk::RectangleBounds(m_halfZ,
239 // 0.5*(m_minHalfX+m_minHalfX+2.*m_halfY/cos(delta)));
240 return std::make_shared<Trk::RectangleBounds>(m_halfZ, m_maxHalfX);
241}

◆ halflengthY()

double Trk::TrapezoidVolumeBounds::halflengthY ( ) const
inline

This method returns the halflength in local y.

Definition at line 163 of file TrapezoidVolumeBounds.h.

163{ return m_halfY; }

◆ halflengthZ()

double Trk::TrapezoidVolumeBounds::halflengthZ ( ) const
inline

This method returns the halflength in local z.

Definition at line 164 of file TrapezoidVolumeBounds.h.

164{ return m_halfZ; }

◆ inside()

bool Trk::TrapezoidVolumeBounds::inside ( const Amg::Vector3D & pos,
double tol = 0. ) const
finaloverridevirtual

This method checks if position in the 3D volume frame is inside the cylinder.

Implements Trk::VolumeBounds.

Definition at line 244 of file TrapezoidVolumeBounds.cxx.

245{
246 if (std::abs(pos.z()) > m_halfZ + tol)
247 return false;
248 if (std::abs(pos.y()) > m_halfY + tol)
249 return false;
250 std::shared_ptr<Trk::TrapezoidBounds> faceXYBounds = this->faceXYTrapezoidBounds();
251 Amg::Vector2D locp(pos.x(), pos.y());
252 bool inside(faceXYBounds->inside(locp, tol, tol));
253 return inside;
254}
bool inside(const Amg::Vector3D &, double tol=0.) const override final
This method checks if position in the 3D volume frame is inside the cylinder.
Eigen::Matrix< double, 2, 1 > Vector2D

◆ maxHalflengthX()

double Trk::TrapezoidVolumeBounds::maxHalflengthX ( ) const
inline

This method returns the maximal halflength in local x.

Definition at line 160 of file TrapezoidVolumeBounds.h.

160 {
161 return m_maxHalfX;
162}

◆ minHalflengthX()

double Trk::TrapezoidVolumeBounds::minHalflengthX ( ) const
inline

This method returns the minimal halflength in local x.

Definition at line 157 of file TrapezoidVolumeBounds.h.

157 {
158 return m_minHalfX;
159}

◆ operator=()

Trk::TrapezoidVolumeBounds & Trk::TrapezoidVolumeBounds::operator= ( const TrapezoidVolumeBounds & bobo)

Assignment operator.

Definition at line 89 of file TrapezoidVolumeBounds.cxx.

90{
91 if (this != &trabo) {
92 m_minHalfX = trabo.m_minHalfX;
93 m_maxHalfX = trabo.m_maxHalfX;
94 m_halfY = trabo.m_halfY;
95 m_halfZ = trabo.m_halfZ;
96 m_alpha = trabo.m_alpha;
97 m_beta = trabo.m_beta;
98 m_objectAccessor = trabo.m_objectAccessor;
99 }
100 return *this;
101}

Member Data Documentation

◆ m_alpha

double Trk::TrapezoidVolumeBounds::m_alpha
private

opening angle alpha (in point A)

Definition at line 145 of file TrapezoidVolumeBounds.h.

◆ m_beta

double Trk::TrapezoidVolumeBounds::m_beta
private

opening angle beta (in point B)

Definition at line 146 of file TrapezoidVolumeBounds.h.

◆ m_halfY

double Trk::TrapezoidVolumeBounds::m_halfY
private

halflength in y

Definition at line 142 of file TrapezoidVolumeBounds.h.

◆ m_halfZ

double Trk::TrapezoidVolumeBounds::m_halfZ
private

halflength in z

Definition at line 143 of file TrapezoidVolumeBounds.h.

◆ m_maxHalfX

double Trk::TrapezoidVolumeBounds::m_maxHalfX
private

maximal halflength in x

Definition at line 141 of file TrapezoidVolumeBounds.h.

◆ m_minHalfX

double Trk::TrapezoidVolumeBounds::m_minHalfX
private

minimal halflength in x

Definition at line 140 of file TrapezoidVolumeBounds.h.

◆ m_objectAccessor

SixObjectsAccessor Trk::TrapezoidVolumeBounds::m_objectAccessor
private

There's only one single object Acessor for the moment has to be implemented if Cuboids are used more widely.

Definition at line 150 of file TrapezoidVolumeBounds.h.


The documentation for this class was generated from the following files: