6#include "GeoModelHelpers/GeoDeDuplicator.h"
19 const std::size_t portalIdx):
26 return m_parent->localToGlobalTransform(store);
28 return m_parent->localToGlobalTransform(store) *
29 m_parent->portalPlacement(
hash())->portalToVolumeCenter();
31 return m_parent->localToGlobalTransform(store).inverse();
34 return Amg::Transform3D::Identity();
41 std::optional<Amg::Transform3D> addShift):
48 m_refShift = GeoDeDuplicator{}.makeTransform(*addShift);
51 assert(child.get() !=
this);
52 assert(child !=
nullptr);
56 std::optional<Amg::Transform3D> addShift):
65 m_refShift = GeoDeDuplicator{}.makeTransform(*addShift);
70 std::optional<Amg::Transform3D> addShift):
79 m_refShift = GeoDeDuplicator{}.makeTransform(*addShift);
84 const std::vector<std::shared_ptr<Acts::RegularSurface>>& portalsToAlign) {
85 Acts::VolumePlacementBase::makePortalsAlignable(gctx, portalsToAlign);
86 for (std::size_t p = 0ul; p < portalsToAlign.size(); ++p) {
87 m_portalCaches.emplace_back(std::make_unique<AlignedCache>(
this, p));
93 if (std::holds_alternative<const IDetectorElementBase*>(
m_parent)){
94 return std::get<const IDetectorElementBase*>(
m_parent)->localToGlobalTransform(gctx);
95 }
else if (std::holds_alternative<const VolumePlacement*>(
m_parent)) {
96 return std::get<const VolumePlacement*>(
m_parent)->localToGlobalTransform(gctx);
98 THROW_EXCEPTION(
"A VolumePlacement without cache && alignable trf should never happen");
109 return std::get<const VolumePlacement*>(
m_parent)->globalToLocalTransform(gctx);
118 const std::size_t portalIdx)
const {
126 m_surfacePlacement = std::make_unique<Acts::detail::PortalPlacement>(std::numeric_limits<std::size_t>::max(),
127 Amg::Transform3D::Identity(),
this,
134 return std::visit([](
const auto& parent) {
135 using visit_t = std::decay_t<
decltype(parent)>;
136 if constexpr(!std::is_same_v<visit_t, AlignableNode_t>) {
137 return parent->detectorType();
145 using visit_t = std::decay_t<
decltype(parent)>;
146 if constexpr(std::is_same_v<visit_t, AlignableNode_t>) {
147 return parent->getTransform(store ? store->geoModelAlignment.get() :
nullptr);
149 return parent->localToGlobalTransform(store);
151 return Amg::Transform3D::Identity();
153 : Amg::Transform3D::Identity());
158 for (
const std::unique_ptr<VolumePlacement>& child :
m_children) {
159 n+=child->storeAlignedTransforms(store);
168 volCache->getTransform(&store);
171 for (
const std::unique_ptr<AlignedCache>& cache:
m_portalCaches) {
172 cache->getTransform(&store);
Acts::GeometryContext context() const
base class interface providing the bare minimal interface extension.
virtual DetectorType detectorType() const =0
Returns the detector element type.
Auxiliary class to store the aligned transforms of the volume and of the associated portals.
virtual Amg::Transform3D fetchTransform(const DetectorAlignStore *store) const override
Fetch the transform to store it in the detector alignment cache.
const VolumePlacement * m_parent
Back reference to the parent VolumePlacement.
CacheFlags m_flags
Flags to indicate which transform type is handled.
CacheFlags
Flag to indicate which kind of transform is handled by the AlignedCache.
AlignedCache(const CacheFlags flags, const DetectorType type, const VolumePlacement *parent)
Constructor for the cache storing the of the volume itself.
std::unique_ptr< AlignedCache > m_globToLocCache
Cache to handle the global -> local transform of the volume.
std::vector< std::unique_ptr< AlignedCache > > m_portalCaches
Cache to handle the local -> global transforms of the associated portals.
const Acts::Transform3 & globalToLocalTransform(const Acts::GeometryContext &gctx) const override final
GeoIntrusivePtr< GeoAlignableTransform > AlignableNode_t
Abrivation of an alignable GeoTransform.
Parent_t m_parent
Parent element which is following the alignment.
const Acts::Transform3 & localToGlobalTransform(const Acts::GeometryContext &gctx) const override final
std::unique_ptr< Acts::detail::PortalPlacement > m_surfacePlacement
Pipe the local -> global transform to a surface.
VolumePlacement(const DetectorType detType, const AlignableNode_t parentNode, std::optional< Amg::Transform3D > addShift=std::nullopt)
Constructor taking an Alignable transform from the geometry tree.
GeoIntrusivePtr< GeoTransform > m_refShift
Additional shift on top of the parent position.
void addChild(std::unique_ptr< VolumePlacement > &&child)
Add a child volume placement to this placement.
std::vector< std::unique_ptr< VolumePlacement > > m_children
Children spawning from this VolumePlacement.
unsigned storeAlignedTransforms(const DetectorAlignStore &store) const override final
DetectorType detectorType() const override final
void makePortalsAlignable(const Acts::GeometryContext &gctx, const std::vector< std::shared_ptr< Acts::RegularSurface > > &portalsToAlign) override final
const Acts::Transform3 & portalLocalToGlobal(const Acts::GeometryContext &gctx, const std::size_t portalIdx) const override final
std::unique_ptr< AlignedCache > m_locToGlobCache
Cache to handle the local -> global transform of the volume.
void connectCenterSurface(std::shared_ptr< Acts::RegularSurface > surface)
Connect an external surface and place it into the volume center.
This is a "hash" representation of an Identifier.
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
DetectorType
Simple enum to Identify the Type of the ACTS sub detector.
@ UnDefined
Small Thing Gap chambers (NSW)
Eigen::Affine3d Transform3D
#define THROW_EXCEPTION(MESSAGE)