9 #include <boost/test/unit_test.hpp>
22 using namespace Acts::UnitLiterals;
30 std::shared_ptr<const std::array<Transform3D, 2>> alignmentStore =
nullptr;
33 unsigned int alignmentIndex{0};
40 unsigned int aIndex = 0)
41 : alignmentStore(std::move(aStore)), alignmentIndex(aIndex) {}
60 std::shared_ptr<const PlanarBounds> pBounds,
63 m_elementTransform(std::move(transform)),
64 m_elementThickness(thickness) {
65 auto mutableSurface = Surface::makeShared<PlaneSurface>(pBounds, *
this);
66 m_elementSurface = mutableSurface;
90 std::shared_ptr<const Surface> m_elementSurface{
nullptr};
92 double m_elementThickness{0.};
98 if (alignContext.alignmentStore !=
nullptr and
99 alignContext.alignmentIndex < 2) {
100 return (*(alignContext.alignmentStore))[alignContext.alignmentIndex];
102 return (*m_elementTransform);
106 return *m_elementSurface;
110 return m_elementThickness;
117 Vector3D negativeCenter(0., 0., -1.);
118 Vector3D positiveCenter(0., 0., 1.);
132 Transform3D negativeTransform = Transform3D::Identity();
133 negativeTransform.translation() = negativeCenter;
135 Transform3D positiveTransform = Transform3D::Identity();
136 positiveTransform.translation() = positiveCenter;
138 std::array<Transform3D, 2> alignmentArray = {negativeTransform,
141 std::shared_ptr<const std::array<Transform3D, 2>> alignmentStore =
142 std::make_shared<const std::array<Transform3D, 2>>(alignmentArray);
146 std::make_shared<const Transform3D>(Transform3D::Identity()),
147 std::make_shared<const RectangleBounds>(100
_cm, 100
_cm), 1
_mm);
149 const auto& alignedSurface = alignedElement.surface();
157 BOOST_CHECK(alignedSurface.transform(defaultContext)
158 .isApprox(Transform3D::Identity()));
160 alignedSurface.transform(negativeContext).isApprox(negativeTransform));
162 alignedSurface.transform(positiveContext).isApprox(positiveTransform));
165 BOOST_CHECK_EQUAL(alignedSurface.center(defaultContext), nominalCenter);
166 BOOST_CHECK_EQUAL(alignedSurface.center(negativeContext), negativeCenter);
167 BOOST_CHECK_EQUAL(alignedSurface.center(positiveContext), positiveCenter);
171 alignedSurface.isOnSurface(defaultContext, onNominal, dummyMomentum));
173 alignedSurface.isOnSurface(negativeContext, onNegative, dummyMomentum));
175 alignedSurface.isOnSurface(positiveContext, onPositive, dummyMomentum));
178 alignedSurface.localToGlobal(defaultContext, localPosition, dummyMomentum,
180 BOOST_CHECK_EQUAL(globalPosition, onNominal);
181 alignedSurface.globalToLocal(defaultContext, onNominal, dummyMomentum,
183 BOOST_CHECK_EQUAL(localPosition,
Vector2D(3., 3.));
185 alignedSurface.localToGlobal(negativeContext, localPosition, dummyMomentum,
187 BOOST_CHECK_EQUAL(globalPosition, onNegative);
188 alignedSurface.globalToLocal(negativeContext, onNegative, dummyMomentum,
190 BOOST_CHECK_EQUAL(localPosition,
Vector2D(3., 3.));
192 alignedSurface.localToGlobal(positiveContext, localPosition, dummyMomentum,
194 BOOST_CHECK_EQUAL(globalPosition, onPositive);
195 alignedSurface.globalToLocal(positiveContext, onPositive, dummyMomentum,
197 BOOST_CHECK_EQUAL(localPosition,
Vector2D(3., 3.));