16 #include <RtypesCore.h>
22 const std::function<
size_t(std::array<size_t, 2> binsRZ,
23 std::array<size_t, 2> nBinsRZ)>&
30 std::vector<double> rPos;
31 std::vector<double> zPos;
33 std::vector<Acts::Vector2>
bField;
35 TFile* inputFile = TFile::Open(fieldMapFile.c_str());
36 if (inputFile ==
nullptr) {
37 throw std::runtime_error(
"file does not exist");
39 TTree*
tree = inputFile->Get<TTree>(treeName.c_str());
40 if (tree ==
nullptr) {
41 throw std::runtime_error(
"object not found in file");
43 Int_t entries = tree->GetEntries();
46 double Br = 0,
Bz = 0;
48 tree->SetBranchAddress(
"r", &r);
49 tree->SetBranchAddress(
"z", &
z);
51 tree->SetBranchAddress(
"Br", &Br);
52 tree->SetBranchAddress(
"Bz", &
Bz);
55 rPos.reserve(entries);
56 zPos.reserve(entries);
57 bField.reserve(entries);
59 for (
int i = 0;
i < entries;
i++) {
68 BFieldUnit, firstQuadrant);
73 const std::function<
size_t(std::array<size_t, 3> binsXYZ,
74 std::array<size_t, 3> nBinsXYZ)>&
81 std::vector<double> xPos;
82 std::vector<double> yPos;
83 std::vector<double> zPos;
85 std::vector<Acts::Vector3>
bField;
87 TFile* inputFile = TFile::Open(fieldMapFile.c_str());
88 if (inputFile ==
nullptr) {
89 throw std::runtime_error(
"file does not exist");
91 TTree*
tree = inputFile->Get<TTree>(treeName.c_str());
92 if (tree ==
nullptr) {
93 throw std::runtime_error(
"object not found in file");
95 Int_t entries = tree->GetEntries();
97 float x = 0,
y = 0,
z = 0;
98 float Bx = 0, By = 0,
Bz = 0;
100 tree->SetBranchAddress(
"x", &x);
101 tree->SetBranchAddress(
"y", &
y);
102 tree->SetBranchAddress(
"z", &
z);
104 tree->SetBranchAddress(
"bx", &Bx);
105 tree->SetBranchAddress(
"by", &By);
106 tree->SetBranchAddress(
"bz", &
Bz);
109 xPos.reserve(entries);
110 yPos.reserve(entries);
111 zPos.reserve(entries);
112 bField.reserve(entries);
114 for (
int i = 0;
i < entries;
i++) {
124 lengthUnit, BFieldUnit, firstOctant);