69 tree->SetBranchAddress(
"id", &
id);
70 tree->SetBranchAddress(
"zmin", &zmin);
71 tree->SetBranchAddress(
"zmax", &zmax);
72 tree->SetBranchAddress(
"rmin", &rmin);
73 tree->SetBranchAddress(
"rmax", &rmax);
74 tree->SetBranchAddress(
"phimin", &phimin);
75 tree->SetBranchAddress(
"phimax", &phimax);
76 tree->SetBranchAddress(
"bscale", &bscale);
77 tree->SetBranchAddress(
"ncond", &ncond);
78 tree->SetBranchAddress(
"nmeshz", &nmeshz);
79 tree->SetBranchAddress(
"nmeshr", &nmeshr);
80 tree->SetBranchAddress(
"nmeshphi", &nmeshphi);
81 tree->SetBranchAddress(
"nfield", &nfield);
90 unsigned maxmeshphi(0);
93 TTree* tmax = (TTree*)
rootfile->Get(
"BFieldMapSize");
94 if (tmax !=
nullptr) {
95 tmax->SetBranchAddress(
"maxcond", &maxcond);
96 tmax->SetBranchAddress(
"maxmeshz", &maxmeshz);
97 tmax->SetBranchAddress(
"maxmeshr", &maxmeshr);
98 tmax->SetBranchAddress(
"maxmeshphi", &maxmeshphi);
99 tmax->SetBranchAddress(
"maxfield", &maxfield);
102 for (
int i = 0; i <
tree->GetEntries(); i++) {
104 maxcond = std::max(maxcond, (
unsigned)ncond);
105 maxmeshz = std::max(maxmeshz, (
unsigned)nmeshz);
106 maxmeshr = std::max(maxmeshr, (
unsigned)nmeshr);
107 maxmeshphi = std::max(maxmeshphi, (
unsigned)nmeshphi);
108 maxfield = std::max(maxfield, (
unsigned)nfield);
111 finite =
new bool[maxcond];
112 p1x =
new double[maxcond];
113 p1y =
new double[maxcond];
114 p1z =
new double[maxcond];
115 p2x =
new double[maxcond];
116 p2y =
new double[maxcond];
117 p2z =
new double[maxcond];
118 curr =
new double[maxcond];
119 meshz =
new double[maxmeshz];
120 meshr =
new double[maxmeshr];
121 meshphi =
new double[maxmeshphi];
122 fieldz =
new short[maxfield];
123 fieldr =
new short[maxfield];
124 fieldphi =
new short[maxfield];
126 tree->SetBranchAddress(
"finite", finite);
127 tree->SetBranchAddress(
"p1x", p1x);
128 tree->SetBranchAddress(
"p1y", p1y);
129 tree->SetBranchAddress(
"p1z", p1z);
130 tree->SetBranchAddress(
"p2x", p2x);
131 tree->SetBranchAddress(
"p2y", p2y);
132 tree->SetBranchAddress(
"p2z", p2z);
133 tree->SetBranchAddress(
"curr", curr);
134 tree->SetBranchAddress(
"meshz", meshz);
135 tree->SetBranchAddress(
"meshr", meshr);
136 tree->SetBranchAddress(
"meshphi", meshphi);
137 tree->SetBranchAddress(
"fieldz", fieldz);
138 tree->SetBranchAddress(
"fieldr", fieldr);
139 tree->SetBranchAddress(
"fieldphi", fieldphi);
144 for (
int i = 0; i <
tree->GetEntries(); i++) {
146 BFieldZone z(
id, zmin, zmax, rmin, rmax, phimin, phimax, bscale);
148 m_zone.back().reserve(nmeshz, nmeshr, nmeshphi);
149 for (
int j = 0; j < ncond; j++) {
160 m_zone.back().appendCond(cond);
162 for (
int j = 0; j < nmeshz; j++) {
163 m_zone.back().appendMesh(0, meshz[j]);
165 for (
int j = 0; j < nmeshr; j++) {
166 m_zone.back().appendMesh(1, meshr[j]);
168 for (
int j = 0; j < nmeshphi; j++) {
169 m_zone.back().appendMesh(2, meshphi[j]);
171 for (
int j = 0; j < nfield; j++) {
173 m_zone.back().appendField(field);
void getB(const double *ATH_RESTRICT xyz, double *ATH_RESTRICT B, double *ATH_RESTRICT deriv=nullptr) const
get the bfield given a point in xyz
double mesh(size_t axis, size_t index) const
coordinate along axis (0 (z), 1 (r), 2 (phi)) of the cell at index (0 to nmesh-1)