9 #include <boost/test/unit_test.hpp>
28 using namespace Acts::UnitLiterals;
36 std::shared_ptr<const std::array<Transform3, 2>> alignmentStore =
nullptr;
39 unsigned int alignmentIndex{0};
46 unsigned int aIndex = 0)
47 : alignmentStore(std::
move(aStore)), alignmentIndex(aIndex) {}
66 const std::shared_ptr<const PlanarBounds>& pBounds,
69 m_elementTransform(std::
move(transform)),
70 m_elementThickness(thickness) {
71 m_elementSurface = Surface::makeShared<PlaneSurface>(pBounds, *
this);
97 std::shared_ptr<Surface> m_elementSurface{
nullptr};
99 double m_elementThickness{0.};
105 if (alignContext.alignmentStore !=
nullptr and
106 alignContext.alignmentIndex < 2) {
107 return (*(alignContext.alignmentStore))[alignContext.alignmentIndex];
109 return (*m_elementTransform);
113 return *m_elementSurface;
117 return *m_elementSurface;
121 return m_elementThickness;
127 Vector3 nominalCenter(0., 0., 0.);
128 Vector3 negativeCenter(0., 0., -1.);
129 Vector3 positiveCenter(0., 0., 1.);
133 Vector3 onNegative(3., 3., -1.);
134 Vector3 onPositive(3., 3., 1.);
140 Vector3 globalPosition(100_cm, 100_cm, 100_cm);
141 Vector3 dummyMomentum(4., 4., 4.);
143 Transform3 negativeTransform = Transform3::Identity();
144 negativeTransform.translation() = negativeCenter;
146 Transform3 positiveTransform = Transform3::Identity();
147 positiveTransform.translation() = positiveCenter;
149 std::array<Transform3, 2> alignmentArray = {negativeTransform,
152 std::shared_ptr<const std::array<Transform3, 2>> alignmentStore =
153 std::make_shared<const std::array<Transform3, 2>>(alignmentArray);
157 std::make_shared<const Transform3>(Transform3::Identity()),
158 std::make_shared<const RectangleBounds>(100_cm, 100_cm), 1_mm);
160 const auto& alignedSurface = alignedElement.surface();
168 BOOST_CHECK(alignedSurface.transform(defaultContext)
169 .isApprox(Transform3::Identity()));
171 alignedSurface.transform(negativeContext).isApprox(negativeTransform));
173 alignedSurface.transform(positiveContext).isApprox(positiveTransform));
176 BOOST_CHECK_EQUAL(alignedSurface.center(defaultContext), nominalCenter);
177 BOOST_CHECK_EQUAL(alignedSurface.center(negativeContext), negativeCenter);
178 BOOST_CHECK_EQUAL(alignedSurface.center(positiveContext), positiveCenter);
182 alignedSurface.isOnSurface(defaultContext, onNominal, dummyMomentum));
184 alignedSurface.isOnSurface(negativeContext, onNegative, dummyMomentum));
186 alignedSurface.isOnSurface(positiveContext, onPositive, dummyMomentum));
189 globalPosition = alignedSurface.localToGlobal(defaultContext, localPosition,
191 BOOST_CHECK_EQUAL(globalPosition, onNominal);
193 alignedSurface.globalToLocal(defaultContext, onNominal, dummyMomentum)
195 BOOST_CHECK_EQUAL(localPosition,
Vector2(3., 3.));
197 globalPosition = alignedSurface.localToGlobal(negativeContext, localPosition,
199 BOOST_CHECK_EQUAL(globalPosition, onNegative);
201 alignedSurface.globalToLocal(negativeContext, onNegative, dummyMomentum)
203 BOOST_CHECK_EQUAL(localPosition,
Vector2(3., 3.));
205 globalPosition = alignedSurface.localToGlobal(positiveContext, localPosition,
207 BOOST_CHECK_EQUAL(globalPosition, onPositive);
209 alignedSurface.globalToLocal(positiveContext, onPositive, dummyMomentum)
211 BOOST_CHECK_EQUAL(localPosition,
Vector2(3., 3.));