ATLAS Offline Software
Loading...
Searching...
No Matches
CylinderBoundsExpander.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
5
6#ifndef SIMULATIONBASE
7
9#include "Acts/Geometry/CylinderVolumeBounds.hpp"
10namespace MuonGMR4{
11 CylinderBoundsExpander::CylinderBoundsExpander(std::unique_ptr<const Acts::Logger> loggerObj):
12 BoundsExpander{Acts::Transform3::Identity(), std::move(loggerObj)} {}
13 void CylinderBoundsExpander::setMargin(const double extraR, const double extraZ) {
14 m_extraR = extraR;
15 m_extraZ = extraZ;
16 }
17 void CylinderBoundsExpander::expand(const Acts::GeometryContext& tgContext,
18 const Acts::Volume& volume) {
19
20 for(const Amg::Vector3D& vertex: cornerPoints(tgContext, volume)) {
21 const double r = vertex.perp();
22 m_rMax = std::max(m_rMax, r);
23 m_rMin = std::min(m_rMin, r);
24 m_zMax = std::max(m_zMax, vertex.z());
25 m_zMin = std::min(m_zMin, vertex.z());
26 }
27 ACTS_VERBOSE(__func__<<"() "<<__LINE__<<" New boundaries are: ["<<m_rMin<<";"<<m_rMax<<"]"
28 <<", z: ["<<m_zMax<<";"<<m_zMin<<"]");
29 }
30 std::shared_ptr<Acts::VolumeBounds>
31 CylinderBoundsExpander::makeBounds(Acts::VolumeBoundFactory& factory) {
32 reCenter(std::array{Amg::Vector3D{0.,0., m_zMax},
33 Amg::Vector3D{0.,0., m_zMin}});
34 auto bounds = factory.makeBounds<Acts::CylinderVolumeBounds>(std::max(m_rMin - m_extraR, 0.),
36 0.5*(m_zMax - m_zMin) + m_extraZ);
37 ACTS_DEBUG(__func__<<"() "<<__LINE__<<" - created new bounds "<<(bounds));
38 return bounds;
39 }
40 double CylinderBoundsExpander::rMin() const { return m_rMin; }
42 double CylinderBoundsExpander::rMax() const { return m_rMax; }
44 double CylinderBoundsExpander::zMin() const { return m_zMin; }
46 double CylinderBoundsExpander::zMax() const { return m_zMax; }
48}
49#endif
static std::vector< Amg::Vector3D > cornerPoints(const Acts::GeometryContext &tgContext, const Acts::Volume &volume, const std::size_t nSegments=3)
Returns the vertices from a volume.
BoundsExpander()=default
Default constructor.
void reCenter(std::span< const Amg::Vector3D > vertices)
Update the center point from a list of global vertices.
void setMargin(const double extraR, const double extraZ)
Assign an extra margin to the constructed bounds.
double zMin() const
Minimum seen longitudinal displacement.
double m_extraZ
Extra margin to be applied in z.
virtual std::shared_ptr< Acts::VolumeBounds > makeBounds(Acts::VolumeBoundFactory &factory) override final
Crate volume bounds that enclose the readout element from the central localToGlobalTransform.
double m_extraR
Extra margin to be applied in R.
CylinderBoundsExpander(std::unique_ptr< const Acts::Logger > loggerObj=nullptr)
Constructor with an optional logger instance.
virtual void expand(const Acts::GeometryContext &tgContext, const Acts::Volume &volume) override
Expand the bounds from a chamber.
double zMax() const
Maximum seen longitudinal displacement.
double m_rMin
Minimum r of any shown vertex.
double m_zMin
Minimum z of any shown vertex.
double rMax() const
Maximum seen radius.
double rMin() const
Minimum seen radius.
double m_rMax
Maximum r of any shown vertex.
double m_zMax
Maximum z of any shown vertex.
int r
Definition globals.cxx:22
Eigen::Matrix< double, 3, 1 > Vector3D
The ReadoutGeomCnvAlg converts the Run4 Readout geometry build from the GeoModelXML into the legacy M...
STL namespace.