9 #include <boost/test/data/test_case.hpp>
10 #include <boost/test/tools/output_test_stream.hpp>
11 #include <boost/test/unit_test.hpp>
39 #include <boost/format.hpp>
45 namespace tt = boost::test_tools;
54 using SrfVec = std::vector<std::shared_ptr<const Surface>>;
62 double zbase = 0,
double r = 10) {
65 double phiStep = 2 * M_PI /
n;
66 for (
size_t i = 0;
i <
n; ++
i) {
67 double z = zbase + ((
i % 2 == 0) ? 1 : -1) * 0.2;
71 trans.rotate(Eigen::AngleAxisd(
i * phiStep + shift,
Vector3(0, 0, 1)));
74 auto bounds = std::make_shared<const RectangleBounds>(2, 1);
75 std::shared_ptr<const Surface> srf =
76 Surface::makeShared<PlaneSurface>(trans,
bounds);
87 double incl = M_PI / 9.,
double w = 2,
91 double phiStep = 2 * M_PI /
n;
92 for (
int i = 0;
i <
n; ++
i) {
97 trans.rotate(Eigen::AngleAxisd(
i * phiStep + shift,
Vector3(0, 0, 1)));
98 trans.translate(
Vector3(10, 0, z));
99 trans.rotate(Eigen::AngleAxisd(incl,
Vector3(0, 0, 1)));
100 trans.rotate(Eigen::AngleAxisd(M_PI / 2.,
Vector3(0, 1, 0)));
102 auto bounds = std::make_shared<const RectangleBounds>(w,
h);
103 std::shared_ptr<const Surface> srf =
104 Surface::makeShared<PlaneSurface>(trans,
bounds);
116 const Transform3& pretrans = Transform3::Identity(),
117 const Vector3& dir = {0, 0, 1}) {
119 for (
size_t i = 0;
i <
n; ++
i) {
125 trans = trans * pretrans;
127 auto bounds = std::make_shared<const RectangleBounds>(2, 1.5);
129 std::shared_ptr<const Surface> srf =
130 Surface::makeShared<PlaneSurface>(trans,
bounds);
141 double z0 = -(nZ - 1) * w;
144 for (
int i = 0; i < nZ; i++) {
145 double z = i * w * 2 + z0;
148 res.insert(res.end(), ring.begin(), ring.end());
158 os << std::fixed << std::setprecision(4);
161 for (
const auto& srfx : surfaces) {
162 std::shared_ptr<const PlaneSurface> srf =
167 for (
const auto& vtxloc : bounds->vertices()) {
170 os <<
"v " << vtx.x() <<
" " << vtx.y() <<
" " << vtx.z() <<
"\n";
175 for (
size_t i = 1; i <= bounds->vertices().size(); ++
i) {
176 os <<
" " << nVtx +
i;
180 nVtx += bounds->vertices().size();
187 BOOST_AUTO_TEST_SUITE(Surfaces)
192 SrfVec brl = makeBarrel(30, 7, 2, 1);
196 detail::Axis<detail::AxisType::Equidistant, detail::AxisBoundaryType::Closed>
197 phiAxis(-M_PI, M_PI, 30
u);
198 detail::Axis<detail::AxisType::Equidistant, detail::AxisBoundaryType::Bound>
201 double angleShift = 2 * M_PI / 30. / 2.;
206 auto itransform = [angleShift,
R](
const Vector2&
loc) {
207 return Vector3(R * std::cos(
loc[0] - angleShift),
208 R * std::sin(
loc[0] - angleShift),
loc[1]);
211 auto sl = std::make_unique<
215 sl->
fill(tgContext, brlRaw);
221 for (
const auto& srf : brl) {
222 Vector3 ctr = srf->binningPosition(tgContext,
binR);
223 std::vector<const Surface*> binContent = sa.
at(ctr);
225 BOOST_CHECK_EQUAL(binContent.size(), 1
u);
226 BOOST_CHECK_EQUAL(srf.get(), binContent.at(0));
229 std::vector<const Surface*> neighbors =
231 BOOST_CHECK_EQUAL(neighbors.size(), 9
u);
233 auto sl2 = std::make_unique<
241 for (
const auto& srf : brl) {
242 Vector3 ctr = srf->binningPosition(tgContext,
binR);
243 std::vector<const Surface*> binContent = sa2.
at(ctr);
245 BOOST_CHECK_EQUAL(binContent.size(), 1
u);
246 BOOST_CHECK_EQUAL(srf.get(), binContent.at(0));
252 auto bounds = std::make_shared<const RectangleBounds>(w,
h);
253 auto srf = Surface::makeShared<PlaneSurface>(Transform3::Identity(),
bounds);
257 auto binContent = sa.at(
Vector3(42, 42, 42));
258 BOOST_CHECK_EQUAL(binContent.size(), 1
u);
259 BOOST_CHECK_EQUAL(binContent.at(0), srf.get());
260 BOOST_CHECK_EQUAL(sa.surfaces().size(), 1
u);
261 BOOST_CHECK_EQUAL(sa.surfaces().at(0), srf.get());
266 auto bounds = std::make_shared<const RectangleBounds>(w,
h);
267 auto srf0 = Surface::makeShared<PlaneSurface>(Transform3::Identity(),
bounds);
268 auto srf1 = Surface::makeShared<PlaneSurface>(Transform3::Identity(),
bounds);
270 std::vector<const Surface*> sfPointers = {srf0.get(), srf1.get()};
271 std::vector<std::shared_ptr<const Surface>> surfaces = {srf0, srf1};
274 std::make_unique<Acts::SurfaceArray::SingleElementLookup>(sfPointers);
278 auto binContent = sa.at(
Vector3(42, 42, 42));
279 BOOST_CHECK_EQUAL(binContent.size(), 2
u);
280 BOOST_CHECK_EQUAL(sa.surfaces().size(), 2
u);
283 BOOST_AUTO_TEST_SUITE_END()