#include <BFieldSolenoid.h>
Definition at line 21 of file BFieldSolenoid.h.
◆ BFieldSolenoid()
BFieldSolenoid::BFieldSolenoid |
( |
| ) |
|
|
inline |
◆ ~BFieldSolenoid()
BFieldSolenoid::~BFieldSolenoid |
( |
| ) |
|
|
inline |
◆ getB()
void BFieldSolenoid::getB |
( |
const double * |
xyz, |
|
|
double * |
B, |
|
|
double * |
deriv = nullptr |
|
) |
| const |
Definition at line 287 of file BFieldSolenoid.cxx.
295 B[0] =
B[1] =
B[2] = 0.0;
296 if ( deriv )
for (
int i = 0;
i < 9;
i++ ) deriv[
i] = 0.0;
◆ moveMap()
void BFieldSolenoid::moveMap |
( |
double |
dx, |
|
|
double |
dy, |
|
|
double |
dz, |
|
|
double |
ax, |
|
|
double |
ay |
|
) |
| |
Definition at line 305 of file BFieldSolenoid.cxx.
308 cerr <<
"BFieldSolenoid::moveMap() : original map has not been read" << endl;
315 const double zlim = 2820.;
316 const double rlim = 1075.;
337 double sinax(
sin(
ax) );
338 double cosax(
cos(
ax) );
339 double sinay(
sin(
ay) );
340 double cosay(
cos(
ay) );
343 for (
unsigned j = 0; j <
m_tilt->
nmesh(1); j++ ) {
350 double x1( x0 -
dx );
351 double y1( y0 -
dy );
352 double z1(
z0 - dz );
355 double y2(
y1*cosax + z1*sinax );
356 double z2( z1*cosax -
y1*sinax );
358 double xyz3[3] = {
x2*cosay-z2*sinay,
y2, z2*cosay +
x2*sinay };
363 double Bx1(
B[0]*cosay +
B[2]*sinay );
365 double Bz1(
B[2]*cosay -
B[0]*sinay );
368 double By2( By1*cosax - Bz1*sinax );
369 double Bz2( Bz1*cosax + By1*sinax );
373 double Br( Bx2*cosphi0 + By2*sinphi0 );
374 double Bphi( -Bx2*sinphi0 + By2*cosphi0 );
◆ readMap() [1/2]
int BFieldSolenoid::readMap |
( |
std::istream & |
input | ) |
|
Definition at line 20 of file BFieldSolenoid.cxx.
22 const double meter(1000.0);
23 const double gauss(1.0
e-7);
24 const string myname(
"BFieldSolenoid::readMap()");
32 cerr << myname <<
": version number is " <<
version <<
" instead of 4" << endl;
68 for (
int k = 0;
k < nphi;
k++ ) {
69 for (
int j = 0; j < nr; j++ ) {
72 for (
int j = 0; j < nr; j++ ) {
75 for (
int j = 0; j < nr; j++ ) {
79 for (
int i = 0;
i < nz;
i++ ) {
80 for (
int j = 0; j < nr; j++ ) {
81 for (
int k = 0;
k < nphi;
k++ ) {
◆ readMap() [2/2]
int BFieldSolenoid::readMap |
( |
TFile * |
rootfile | ) |
|
Definition at line 188 of file BFieldSolenoid.cxx.
190 if (
rootfile ==
nullptr )
return 1;
197 if (
tree ==
nullptr )
return 3;
227 tree->SetBranchAddress(
"zmin", &
zmin );
228 tree->SetBranchAddress(
"zmax", &
zmax );
229 tree->SetBranchAddress(
"rmin", &rmin );
230 tree->SetBranchAddress(
"rmax", &rmax );
231 tree->SetBranchAddress(
"phimin", &phimin );
232 tree->SetBranchAddress(
"phimax", &phimax );
233 tree->SetBranchAddress(
"nmeshz", &nmeshz );
234 tree->SetBranchAddress(
"nmeshr", &nmeshr );
235 tree->SetBranchAddress(
"nmeshphi", &nmeshphi );
236 tree->SetBranchAddress(
"nfield", &nfield );
239 meshz =
new double[nmeshz];
240 meshr =
new double[nmeshr];
241 meshphi =
new double[nmeshphi];
242 fieldz =
new double[nfield];
243 fieldr =
new double[nfield];
244 fieldphi =
new double[nfield];
246 tree->SetBranchAddress(
"meshz", meshz );
247 tree->SetBranchAddress(
"meshr", meshr );
248 tree->SetBranchAddress(
"meshphi", meshphi );
249 tree->SetBranchAddress(
"fieldz", fieldz );
250 tree->SetBranchAddress(
"fieldr", fieldr );
251 tree->SetBranchAddress(
"fieldphi", fieldphi );
256 for (
int j = 0; j < nmeshz; j++ ) {
259 for (
int j = 0; j < nmeshr; j++ ) {
262 for (
int j = 0; j < nmeshphi; j++ ) {
265 for (
int j = 0; j < nfield; j++ ) {
◆ tiltedMap()
◆ writeMap()
void BFieldSolenoid::writeMap |
( |
TFile * |
rootfile, |
|
|
bool |
tilted = false |
|
) |
| |
Definition at line 104 of file BFieldSolenoid.cxx.
107 if ( map ==
nullptr )
return;
111 TTree*
tree =
new TTree(
"BFieldSolenoid",
"BFieldSolenoid version 4" );
114 double rmin = map->
rmin();
115 double rmax = map->
rmax();
116 double phimin = map->
phimin();
117 double phimax = map->
phimax();
118 int nmeshz = map->
nmesh(0);
119 int nmeshr = map->
nmesh(1);
120 int nmeshphi = map->
nmesh(2);
126 int nfield = nmeshz*nmeshr*nmeshphi;
132 meshz =
new double[nmeshz];
133 meshr =
new double[nmeshr];
134 meshphi =
new double[nmeshphi];
135 fieldz =
new double[nfield];
136 fieldr =
new double[nfield];
137 fieldphi =
new double[nfield];
139 tree->Branch(
"zmin", &
zmin,
"zmin/D" );
140 tree->Branch(
"zmax", &
zmax,
"zmax/D" );
141 tree->Branch(
"rmin", &rmin,
"rmin/D" );
142 tree->Branch(
"rmax", &rmax,
"rmax/D" );
143 tree->Branch(
"phimin", &phimin,
"phimin/D" );
144 tree->Branch(
"phimax", &phimax,
"phimax/D" );
145 tree->Branch(
"nmeshz", &nmeshz,
"nmeshz/I" );
146 tree->Branch(
"meshz", meshz,
"meshz[nmeshz]/D" );
147 tree->Branch(
"nmeshr", &nmeshr,
"nmeshr/I" );
148 tree->Branch(
"meshr", meshr,
"meshr[nmeshr]/D" );
149 tree->Branch(
"nmeshphi", &nmeshphi,
"nmeshphi/I" );
150 tree->Branch(
"meshphi", meshphi,
"meshphi[nmeshphi]/D" );
151 tree->Branch(
"nfield", &nfield,
"nfield/I" );
152 tree->Branch(
"fieldz", fieldz,
"fieldz[nfield]/D" );
153 tree->Branch(
"fieldr", fieldr,
"fieldr[nfield]/D" );
154 tree->Branch(
"fieldphi", fieldphi,
"fieldphi[nfield]/D" );
156 for (
int j = 0; j < nmeshz; j++ ) {
157 meshz[j] = map->
mesh(0,j);
159 for (
int j = 0; j < nmeshr; j++ ) {
160 meshr[j] = map->
mesh(1,j);
162 for (
int j = 0; j < nmeshphi; j++ ) {
163 meshphi[j] = map->
mesh(2,j);
165 for (
int j = 0; j < nfield; j++ ) {
169 fieldphi[j] =
f.phi();
◆ m_orig
◆ m_tilt
The documentation for this class was generated from the following files:
void setRange(double zmin, double zmax, double rmin, double rmax, double phimin, double phimax)
set mesh range/dimensions
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)
void reserve(int nz, int nr, int nphi, int nfield)
allocate space to vectors