9 #include <boost/test/data/test_case.hpp>
10 #include <boost/test/unit_test.hpp>
15 #include "Acts/MagneticField/SharedBFieldMap.hpp"
16 #include "Acts/MagneticField/concept/AnyFieldLookup.hpp"
31 namespace tt = boost::test_tools;
39 namespace IntegrationTest {
44 std::array<size_t, 3> nBinsXYZ)>
46 std::string fieldMapFile =
"Field.txt",
double lengthUnit = 1.,
47 double BFieldUnit = 1.,
size_t nPoints = 100000,
bool firstOctant =
false) {
50 std::vector<double> xPos;
51 std::vector<double> yPos;
52 std::vector<double> zPos;
54 std::vector<Acts::Vector3D>
bField;
56 xPos.reserve(nPoints);
57 yPos.reserve(nPoints);
58 zPos.reserve(nPoints);
59 bField.reserve(nPoints);
61 std::ifstream map_file(fieldMapFile.c_str(),
std::ios::in);
63 double x = 0.,
y = 0.,
z = 0.;
64 double bx = 0., by = 0., bz = 0.;
65 while (std::getline(map_file, line)) {
66 if (line.empty() || line[0] ==
'%' || line[0] ==
'#' ||
67 line.find_first_not_of(
' ') == std::string::npos)
70 std::istringstream
tmp(line);
71 tmp >> x >>
y >>
z >> bx >> by >> bz;
79 return fieldMapperXYZ(localToGlobalBin, xPos, yPos, zPos, bField, lengthUnit,
80 BFieldUnit, firstOctant);
85 std::string fieldMapFile =
"Field.txt") {
87 concept ::AnyFieldLookup<> mapper;
92 [](std::array<size_t, 3> binsXYZ, std::array<size_t, 3> nBinsXYZ) {
93 return (binsXYZ.at(0) * (nBinsXYZ.at(1) * nBinsXYZ.at(2)) +
94 binsXYZ.at(1) * nBinsXYZ.at(2) + binsXYZ.at(2));
96 fieldMapFile, lengthUnit, BFieldUnit);
100 config.mapper = std::move(mapper);
102 return std::make_shared<const InterpolatedBFieldMap>(std::move(config));