25 std::function<
size_t(std::array<size_t, 2> binsRZ,
26 std::array<size_t, 2> nBinsRZ)>
28 std::string fieldMapFile,
double lengthUnit,
double BFieldUnit,
29 size_t nPoints,
bool firstQuadrant) {
32 std::vector<double> rPos;
33 std::vector<double> zPos;
35 std::vector<Acts::Vector2D>
bField;
37 rPos.reserve(nPoints);
38 zPos.reserve(nPoints);
39 bField.reserve(nPoints);
41 std::ifstream map_file(fieldMapFile.c_str(),
std::ios::in);
43 double r = 0.,
z = 0.;
44 double br = 0., bz = 0.;
46 if (line.empty() || line[0] ==
'%' || line[0] ==
'#' ||
47 line.find_first_not_of(
' ') == std::string::npos)
50 std::istringstream tmp(line);
51 tmp >> r >>
z >> br >> bz;
59 BFieldUnit, firstQuadrant);
66 std::function<
size_t(std::array<size_t, 3> binsXYZ,
67 std::array<size_t, 3> nBinsXYZ)>
69 std::string fieldMapFile,
double lengthUnit,
double BFieldUnit,
70 size_t nPoints,
bool firstOctant) {
73 std::vector<double> xPos;
74 std::vector<double> yPos;
75 std::vector<double> zPos;
77 std::vector<Acts::Vector3D>
bField;
79 xPos.reserve(nPoints);
80 yPos.reserve(nPoints);
81 zPos.reserve(nPoints);
82 bField.reserve(nPoints);
84 std::ifstream map_file(fieldMapFile.c_str(),
std::ios::in);
86 double x = 0.,
y = 0.,
z = 0.;
87 double bx = 0., by = 0., bz = 0.;
89 if (line.empty() || line[0] ==
'%' || line[0] ==
'#' ||
90 line.find_first_not_of(
' ') == std::string::npos)
93 std::istringstream tmp(line);
94 tmp >> x >>
y >>
z >> bx >> by >> bz;
98 bField.push_back(Acts::Vector3D(bx, by, bz));
103 lengthUnit, BFieldUnit, firstOctant);
108 Acts::detail::EquidistantAxis>>
110 std::function<
size_t(std::array<size_t, 2> binsRZ,
111 std::array<size_t, 2> nBinsRZ)>
113 std::string fieldMapFile, std::string treeName,
double lengthUnit,
114 double BFieldUnit,
bool firstQuadrant) {
117 std::vector<double> rPos;
118 std::vector<double> zPos;
120 std::vector<Acts::Vector2D>
bField;
122 TFile* inputFile = TFile::Open(fieldMapFile.c_str());
123 TTree* tree = (TTree*)inputFile->Get(treeName.c_str());
124 Int_t entries = tree->GetEntries();
129 tree->SetBranchAddress(
"r", &r);
130 tree->SetBranchAddress(
"z", &z);
132 tree->SetBranchAddress(
"br", &Br);
133 tree->SetBranchAddress(
"bz", &Bz);
136 rPos.reserve(entries);
137 zPos.reserve(entries);
138 bField.reserve(entries);
140 for (
int i = 0; i < entries; i++) {
144 bField.push_back(Acts::Vector2D(Br, Bz));
149 BFieldUnit, firstQuadrant);
156 std::function<
size_t(std::array<size_t, 3> binsXYZ,
157 std::array<size_t, 3> nBinsXYZ)>
159 std::string fieldMapFile, std::string treeName,
double lengthUnit,
160 double BFieldUnit,
bool firstOctant) {
163 std::vector<double> xPos;
164 std::vector<double> yPos;
165 std::vector<double> zPos;
167 std::vector<Acts::Vector3D>
bField;
169 TFile* inputFile = TFile::Open(fieldMapFile.c_str());
170 TTree* tree = (TTree*)inputFile->Get(treeName.c_str());
171 Int_t entries = tree->GetEntries();
176 tree->SetBranchAddress(
"x", &x);
177 tree->SetBranchAddress(
"y", &y);
178 tree->SetBranchAddress(
"z", &z);
180 tree->SetBranchAddress(
"bx", &Bx);
181 tree->SetBranchAddress(
"by", &By);
182 tree->SetBranchAddress(
"bz", &Bz);
185 xPos.reserve(entries);
186 yPos.reserve(entries);
187 zPos.reserve(entries);
188 bField.reserve(entries);
190 for (
int i = 0; i < entries; i++) {
195 bField.push_back(Acts::Vector3D(Bx, By, Bz));
200 lengthUnit, BFieldUnit, firstOctant);