5#include <GaudiKernel/SystemOfUnits.h>
8# include <Acts/Geometry/VolumeBounds.hpp>
9# include <Acts/Geometry/CuboidVolumeBounds.hpp>
10# include <Acts/Geometry/TrapezoidVolumeBounds.hpp>
11# include <Acts/Geometry/DiamondVolumeBounds.hpp>
12# include <Acts/Geometry/TrackingVolume.hpp>
23 auto newStore = std::make_unique<ActsTrk::DetectorAlignStore>(inStore);
24 if(newStore->geoModelAlignment) {
26 newStore->geoModelAlignment->clearPosCache();
28 newStore->trackingAlignment = std::make_unique<ActsTrk::detail::TransformStore>(inStore.
detType,
41 double halfXlowY(
const Acts::VolumeBounds& visitBounds) {
42 switch (visitBounds.type()) {
43 case Acts::VolumeBounds::BoundsType::eCuboid: {
44 const auto& bounds =
static_cast<const Acts::CuboidVolumeBounds&
>(visitBounds);
45 using BoundEnum = Acts::CuboidVolumeBounds::BoundValues;
46 return bounds.get(BoundEnum::eHalfLengthX);
48 case Acts::VolumeBounds::BoundsType::eTrapezoid: {
49 const auto& bounds =
static_cast<const Acts::TrapezoidVolumeBounds&
>(visitBounds);
50 using BoundEnum = Acts::TrapezoidVolumeBounds::BoundValues;
51 return bounds.get(BoundEnum::eHalfLengthXnegY);
52 }
case Acts::VolumeBounds::BoundsType::eDiamond: {
53 const auto& bounds =
static_cast<const Acts::DiamondVolumeBounds&
>(visitBounds);
54 using BoundEnum = Acts::DiamondVolumeBounds::BoundValues;
55 return bounds.get(BoundEnum::eHalfLengthX2);
61 double halfXhighY(
const Acts::VolumeBounds& visitBounds) {
62 switch (visitBounds.type()) {
63 case Acts::VolumeBounds::BoundsType::eCuboid: {
64 const auto& bounds =
static_cast<const Acts::CuboidVolumeBounds&
>(visitBounds);
65 using BoundEnum = Acts::CuboidVolumeBounds::BoundValues;
66 return bounds.get(BoundEnum::eHalfLengthX);
68 case Acts::VolumeBounds::BoundsType::eTrapezoid: {
69 const auto& bounds =
static_cast<const Acts::TrapezoidVolumeBounds&
>(visitBounds);
70 using BoundEnum = Acts::TrapezoidVolumeBounds::BoundValues;
71 return bounds.get(BoundEnum::eHalfLengthXposY);
72 }
case Acts::VolumeBounds::BoundsType::eDiamond: {
73 const auto& bounds =
static_cast<const Acts::DiamondVolumeBounds&
>(visitBounds);
74 using BoundEnum = Acts::DiamondVolumeBounds::BoundValues;
75 return bounds.get(BoundEnum::eHalfLengthX1);
81 double halfY(
const Acts::VolumeBounds& visitBounds) {
82 switch (visitBounds.type()) {
83 case Acts::VolumeBounds::BoundsType::eCuboid: {
84 const auto& bounds =
static_cast<const Acts::CuboidVolumeBounds&
>(visitBounds);
85 using BoundEnum = Acts::CuboidVolumeBounds::BoundValues;
86 return bounds.get(BoundEnum::eHalfLengthY);
87 }
case Acts::VolumeBounds::BoundsType::eTrapezoid: {
88 const auto& bounds =
static_cast<const Acts::TrapezoidVolumeBounds&
>(visitBounds);
89 using BoundEnum = Acts::TrapezoidVolumeBounds::BoundValues;
90 return bounds.get(BoundEnum::eHalfLengthY);
91 }
case Acts::VolumeBounds::BoundsType::eDiamond: {
92 const auto& bounds =
static_cast<const Acts::DiamondVolumeBounds&
>(visitBounds);
93 using BoundEnum = Acts::DiamondVolumeBounds::BoundValues;
94 return std::max(bounds.get(BoundEnum::eLengthY1),
95 bounds.get(BoundEnum::eLengthY2));
102 double halfZ(
const Acts::VolumeBounds& visitBounds) {
103 switch (visitBounds.type()) {
104 case Acts::VolumeBounds::BoundsType::eCuboid: {
105 const auto& bounds =
static_cast<const Acts::CuboidVolumeBounds&
>(visitBounds);
106 using BoundEnum = Acts::CuboidVolumeBounds::BoundValues;
107 return bounds.get(BoundEnum::eHalfLengthZ);
108 }
case Acts::VolumeBounds::BoundsType::eTrapezoid: {
109 const auto& bounds =
static_cast<const Acts::TrapezoidVolumeBounds&
>(visitBounds);
110 using BoundEnum = Acts::TrapezoidVolumeBounds::BoundValues;
111 return bounds.get(BoundEnum::eHalfLengthZ);
112 }
case Acts::VolumeBounds::BoundsType::eDiamond: {
113 const auto& bounds =
static_cast<const Acts::DiamondVolumeBounds&
>(visitBounds);
114 using BoundEnum = Acts::DiamondVolumeBounds::BoundValues;
115 return bounds.get(BoundEnum::eHalfLengthZ);
122 const bool fetchBottom) {
123 if (!volume.isAlignable()) {
126 std::size_t portalIdx{volume.portals().size()};
127 switch (volume.volumeBounds().type()) {
128 using enum Acts::VolumeBounds::BoundsType;
131 portalIdx = Acts::toUnderlying(Acts::CuboidVolumeBounds::Face::NegativeZFace);
133 portalIdx = Acts::toUnderlying(Acts::CuboidVolumeBounds::Face::PositiveZFace);
138 portalIdx = Acts::toUnderlying(Acts::CuboidVolumeBounds::Face::NegativeZFace);
140 portalIdx = Acts::toUnderlying(Acts::CuboidVolumeBounds::Face::PositiveZFace);
145 portalIdx = Acts::toUnderlying(Acts::DiamondVolumeBounds::Face::NegativeZFaceXY);
147 portalIdx = Acts::toUnderlying(Acts::DiamondVolumeBounds::Face::PositiveZFaceXY);
154 const Acts::VolumePlacementBase* placement = volume.volumePlacement();
155 assert(portalIdx < placement->nPortalPlacements());
156 const Acts::SurfacePlacementBase* portalPlacement = placement->portalPlacement(portalIdx);
157 const Acts::Surface* surface = (&portalPlacement->surface());
158 if (surface->geometryId().withBoundary(0) != volume.geometryId()) {
159 std::stringstream portalStr{};
160 for (
const Acts::Portal& portal : volume.portals()) {
161 portalStr<<
"\n --- "<<portal.surface().type()<<
" "
162 <<portal.surface().geometryId();
165 <<volume.geometryId()<<
" vs. "<<surface->geometryId().withBoundary(0)
166 <<
"Portals: "<<portalStr.str());
174 const Acts::Surface*
topBoundary(
const Acts::TrackingVolume& volume) {
std::shared_ptr< GeoAlignmentStore > geoModelAlignment
Store containing the aligned GeoModel nodes.
DetectorType detType
The aligned detector element type.
bool posCacheLocked() const
Returns whether the position cache is locked.
DetectorType
Simple enum to Identify the Type of the ACTS sub detector.
Amg::Transform3D getRotateZ3D(double angle)
get a rotation transformation around Z-axis
Eigen::Affine3d Transform3D
Amg::Transform3D getRotateY3D(double angle)
get a rotation transformation around Y-axis
Amg::Transform3D rotationToAMDB(const ActsTrk::DetectorType type)
Returns the rotation matrix from the readout element coordinate system into the AMDB coordinate syste...
The ReadoutGeomCnvAlg converts the Run4 Readout geometry build from the GeoModelXML into the legacy M...
double halfY(const Acts::VolumeBounds &bounds)
Returns the half-Y length for the parsed volume bounds (Trapezoid/ Cuboid).
const Acts::Surface * bottomBoundary(const Acts::TrackingVolume &volume)
Returns the boundary surface parallel to the x-y plane at negative local z.
const Acts::Surface * topBoundary(const Acts::TrackingVolume &volume)
Returns the boundary surface parallel to the x-y plane at positive local z.
std::unique_ptr< ActsTrk::DetectorAlignStore > copyDeltas(const ActsTrk::DetectorAlignStore &inStore)
Copy the alignment deltas from the inStore to a new alignment store.
bool isMuon(const ActsTrk::DetectorType type)
Returns whether the parsed type is muon.
const Acts::Surface * volumeLidBounadry(const Acts::TrackingVolume &volume, const bool fetchBottom)
double halfZ(const Acts::VolumeBounds &bounds)
Returns the half-Z length for the parsed volume bounds (Trapezoid/ Cuboid).
double halfXhighY(const Acts::VolumeBounds &bounds)
Returns the half-Y length @ posiive Y for the parsed volume bounds (Trapezoid/ Cuboid).
double halfXlowY(const Acts::VolumeBounds &bounds)
Returns the half-X length @ negative Y for the parsed volume bounds (Trapezoid/ Cuboid).
#define THROW_EXCEPTION(MESSAGE)