9 #include <boost/test/data/test_case.hpp>
10 #include <boost/test/unit_test.hpp>
32 using namespace detail;
38 std::vector<double> rPos = {0., 1., 2., 3.};
39 std::vector<double> xPos = {0., 1., 2., 3.};
40 std::vector<double> yPos = {0., 1., 2., 3.};
41 std::vector<double> zPos = {0., 1., 2., 3.};
44 std::vector<Acts::Vector2> bField_rz;
45 for (
int i = 0;
i < 27;
i++) {
49 auto localToGlobalBin_rz = [](std::array<size_t, 2> binsRZ,
50 std::array<size_t, 2> nBinsRZ) {
51 return (binsRZ.at(1) * nBinsRZ.at(0) + binsRZ.at(0));
57 std::vector<size_t> nBins_rz = {rPos.size(), zPos.size()};
58 std::vector<double> minima_rz = {0., 0.};
59 std::vector<double> maxima_rz = {3., 3.};
60 BOOST_CHECK(map_rz.getNBins() == nBins_rz);
63 BOOST_CHECK(map_rz.getMin() == minima_rz);
66 BOOST_CHECK(map_rz.getMax() == maxima_rz);
68 auto localToGlobalBin_xyz = [](std::array<size_t, 3> binsXYZ,
69 std::array<size_t, 3> nBinsXYZ) {
70 return (binsXYZ.at(0) * (nBinsXYZ.at(1) * nBinsXYZ.at(2)) +
71 binsXYZ.at(1) * nBinsXYZ.at(2) + binsXYZ.at(2));
74 rPos = {0., 1., 2., 3.};
75 xPos = {0., 1., 2., 3.};
76 yPos = {0., 1., 2., 3.};
77 zPos = {0., 1., 2., 3.};
80 std::vector<Acts::Vector3> bField_xyz;
81 for (
int i = 0;
i < 81;
i++) {
87 bField_xyz, 1, 1,
false);
89 std::vector<size_t> nBins_xyz = {xPos.size(), yPos.size(), zPos.size()};
90 std::vector<double> minima_xyz = {0., 0., 0.};
91 std::vector<double> maxima_xyz = {3., 3., 3.};
92 BOOST_CHECK(map_xyz.getNBins() == nBins_xyz);
95 BOOST_CHECK(map_xyz.getMin() == minima_xyz);
98 BOOST_CHECK(map_xyz.getMax() == maxima_xyz);
104 auto value0_rz = map_rz.getField(pos0_rz).value();
105 auto value1_rz = map_rz.getField(pos1_rz).value();
106 auto value2_rz = map_rz.getField(pos2_rz).value();
109 bField_rz.at(localToGlobalBin_rz({{0, 0}}, {{rPos.size(), zPos.size()}}));
111 bField_rz.at(localToGlobalBin_rz({{1, 1}}, {{rPos.size(), zPos.size()}}));
113 bField_rz.at(localToGlobalBin_rz({{2, 2}}, {{rPos.size(), zPos.size()}}));
130 auto value0_xyz = map_xyz.getField(pos0_xyz).value();
131 auto value1_xyz = map_xyz.getField(pos1_xyz).value();
132 auto value2_xyz = map_xyz.getField(pos2_xyz).value();
134 auto b0_xyz = bField_xyz.at(localToGlobalBin_xyz(
135 {{0, 0, 0}}, {{xPos.size(), yPos.size(), zPos.size()}}));
136 auto b1_xyz = bField_xyz.at(localToGlobalBin_xyz(
137 {{1, 1, 1}}, {{xPos.size(), yPos.size(), zPos.size()}}));
138 auto b2_xyz = bField_xyz.at(localToGlobalBin_xyz(
139 {{2, 2, 2}}, {{xPos.size(), yPos.size(), zPos.size()}}));
141 BOOST_CHECK_EQUAL(value0_xyz, b0_xyz);
142 BOOST_CHECK_EQUAL(value1_xyz, b1_xyz);
143 BOOST_CHECK_EQUAL(value2_xyz, b2_xyz);
154 std::vector<double> rPos = {0., 1., 2.};
155 std::vector<double> xPos = {0., 1., 2.};
156 std::vector<double> yPos = {0., 1., 2.};
157 std::vector<double> zPos = {0., 1., 2.};
159 std::vector<Acts::Vector2> bField_rz;
160 for (
int i = 0;
i < 9;
i++) {
165 [](std::array<size_t, 2> binsRZ, std::array<size_t, 2> nBinsRZ) {
166 return (binsRZ.at(1) * nBinsRZ.at(0) + binsRZ.at(0));
168 rPos, zPos, bField_rz, 1, 1,
true);
171 std::vector<size_t> nBins_rz = {rPos.size(), 2 * zPos.size() - 1};
172 std::vector<double> minima_rz = {0., -2.};
173 std::vector<double> maxima_rz = {2., 2.};
174 BOOST_CHECK(map_rz.getNBins() == nBins_rz);
175 auto vec = map_rz.getNBins();
176 auto vec0 = map_rz.getMin();
179 BOOST_CHECK(map_rz.getMin() == minima_rz);
182 BOOST_CHECK(map_rz.getMax() == maxima_rz);
185 std::vector<Acts::Vector3> bField_xyz;
186 for (
int i = 0;
i < 27;
i++) {
191 [](std::array<size_t, 3> binsXYZ, std::array<size_t, 3> nBinsXYZ) {
192 return (binsXYZ.at(0) * (nBinsXYZ.at(1) * nBinsXYZ.at(2)) +
193 binsXYZ.at(1) * nBinsXYZ.at(2) + binsXYZ.at(2));
195 xPos, yPos, zPos, bField_xyz, 1, 1,
true);
198 std::vector<size_t> nBins_xyz = {2 * xPos.size() - 1, 2 * yPos.size() - 1,
199 2 * zPos.size() - 1};
200 std::vector<double> minima_xyz = {-2., -2., -2.};
201 std::vector<double> maxima_xyz = {2., 2., 2.};
202 BOOST_CHECK(map_xyz.getNBins() == nBins_xyz);
205 BOOST_CHECK(map_xyz.getMin() == minima_xyz);
208 BOOST_CHECK(map_xyz.getMax() == maxima_xyz);
216 auto value0_rz = map_rz.getField(pos0).value();
217 auto value1_rz = map_rz.getField(pos1).value();
218 auto value2_rz = map_rz.getField(pos2).value();
219 auto value3_rz = map_rz.getField(pos3).value();
220 auto value4_rz = map_rz.getField(pos4).value();
222 auto value0_xyz = map_xyz.getField(pos0).value();
223 auto value1_xyz = map_xyz.getField(pos1).value();
224 auto value2_xyz = map_xyz.getField(pos2).value();
225 auto value3_xyz = map_xyz.getField(pos3).value();
226 auto value4_xyz = map_xyz.getField(pos4).value();
248 bfield_symmetry_random,
251 bdata::distribution = std::uniform_real_distribution<>(-10., 10.))) ^
253 bdata::distribution =
254 std::uniform_real_distribution<>(-10., 10.))) ^
256 bdata::distribution =
257 std::uniform_real_distribution<>(-20., 20.))) ^
262 std::vector<double> rPos;
263 std::vector<double> xPos;
264 std::vector<double> yPos;
265 std::vector<double> zPos;
271 double stepR = maxR / nBins;
272 double stepZ = maxZ / nBins;
273 double bStepR = maxBr / nBins;
274 double bStepZ = maxBz / nBins;
276 for (
size_t i = 0;
i < nBins;
i++) {
277 rPos.push_back(
i * stepR);
278 xPos.push_back(
i * stepR);
279 yPos.push_back(
i * stepR);
280 zPos.push_back(
i * stepZ);
283 std::vector<Acts::Vector2> bField_rz;
284 for (
size_t i = 0;
i < nBins * nBins;
i++) {
289 [](std::array<size_t, 2> binsRZ, std::array<size_t, 2> nBinsRZ) {
290 return (binsRZ.at(1) * nBinsRZ.at(0) + binsRZ.at(0));
292 rPos, zPos, bField_rz, 1, 1,
true);
295 std::vector<size_t> nBins_rz = {rPos.size(), 2 * zPos.size() - 1};
296 std::vector<double> minima_rz = {0., -((nBins - 1) * stepZ)};
297 std::vector<double> maxima_rz = {(nBins - 1) * stepR, (nBins - 1) * stepZ};
298 BOOST_CHECK(map_rz.getNBins() == nBins_rz);
307 std::vector<Acts::Vector3> bField_xyz;
308 for (
size_t i = 0;
i < nBins * nBins * nBins;
i++) {
313 [](std::array<size_t, 3> binsXYZ, std::array<size_t, 3> nBinsXYZ) {
314 return (binsXYZ.at(0) * (nBinsXYZ.at(1) * nBinsXYZ.at(2)) +
315 binsXYZ.at(1) * nBinsXYZ.at(2) + binsXYZ.at(2));
317 xPos, yPos, zPos, bField_xyz, 1, 1,
true);
319 std::vector<size_t> nBins_xyz = {2 * xPos.size() - 1, 2 * yPos.size() - 1,
320 2 * zPos.size() - 1};
321 std::vector<double> minima_xyz = {
322 -((nBins - 1) * stepR), -((nBins - 1) * stepR), -((nBins - 1) * stepZ)};
323 std::vector<double> maxima_xyz = {(nBins - 1) * stepR, (nBins - 1) * stepR,
324 (nBins - 1) * stepZ};
325 BOOST_CHECK(map_xyz.getNBins() == nBins_xyz);
339 auto value0_rz = map_rz.getField(pos0).value();
340 auto value1_rz = map_rz.getField(pos1).value();
341 auto value2_rz = map_rz.getField(pos2).value();
342 auto value3_rz = map_rz.getField(pos3).value();
343 auto value4_rz = map_rz.getField(pos4).value();
355 auto value0_xyz = map_xyz.getField(pos0).value();
356 auto value1_xyz = map_xyz.getField(pos1).value();
357 auto value2_xyz = map_xyz.getField(pos2).value();
358 auto value3_xyz = map_xyz.getField(pos3).value();
359 auto value4_xyz = map_xyz.getField(pos4).value();