|
ATLAS Offline Software
|
#include <SolenoidParametrization.h>
|
| SolenoidParametrization (const AtlasFieldCacheCondObj &field_cond_obj) |
|
| ~SolenoidParametrization ()=default |
|
double | centralField () const |
|
double | fieldComponent (double z, const Parameters &parms) const |
|
double | fieldComponent (double r, double z, double cotTheta, MagField::AtlasFieldCache &fieldCache) const |
|
void | fieldIntegrals (double &firstIntegral, double &secondIntegral, double zBegin, double zEnd, Parameters &parms) const |
|
double | maximumR () const |
|
double | maximumZ () const |
|
void | printFieldIntegrals (MsgStream &m) const |
|
void | printParametersForEtaLine (double eta, double z_origin, MsgStream &msg) const |
|
void | printResidualForEtaLine (double eta, double zOrigin, MsgStream &msg) const |
|
bool | validOrigin (const Amg::Vector3D &origin) const |
|
bool | currentMatches (double current) const |
|
Definition at line 30 of file SolenoidParametrization.h.
◆ SolenoidParametrization() [1/2]
◆ ~SolenoidParametrization()
Trk::SolenoidParametrization::~SolenoidParametrization |
( |
| ) |
|
|
default |
◆ SolenoidParametrization() [2/2]
◆ centralField()
double Trk::SolenoidParametrization::centralField |
( |
| ) |
const |
|
inline |
◆ currentMatches()
bool Trk::SolenoidParametrization::currentMatches |
( |
double |
current | ) |
const |
◆ fieldComponent() [1/2]
double Trk::SolenoidParametrization::fieldComponent |
( |
double |
r, |
|
|
double |
z, |
|
|
double |
cotTheta, |
|
|
MagField::AtlasFieldCache & |
fieldCache |
|
) |
| const |
|
inline |
◆ fieldComponent() [2/2]
double Trk::SolenoidParametrization::fieldComponent |
( |
double |
z, |
|
|
const Parameters & |
parms |
|
) |
| const |
|
inline |
Definition at line 225 of file SolenoidParametrization.h.
227 double z_local = parms.m_signTheta*
z - parms.m_zAtAxis;
228 double z_squared = z_local*z_local;
229 double value = parms.m_fieldAtOrigin +
230 parms.m_quadraticTerm*z_squared +
231 parms.m_cubicTerm*z_squared*z_local;
◆ fieldIntegrals()
void Trk::SolenoidParametrization::fieldIntegrals |
( |
double & |
firstIntegral, |
|
|
double & |
secondIntegral, |
|
|
double |
zBegin, |
|
|
double |
zEnd, |
|
|
Parameters & |
parms |
|
) |
| const |
|
inline |
Definition at line 245 of file SolenoidParametrization.h.
251 zBegin = parms.m_signTheta*zBegin;
252 zEnd = parms.m_signTheta*zEnd;
253 if (zEnd < s_zInner || zBegin >
s_zInner)
255 integrate(firstIntegral,secondIntegral,zBegin-parms.m_zAtAxis,zEnd-parms.m_zAtAxis, parms);
◆ fieldKey()
int Trk::SolenoidParametrization::fieldKey |
( |
BinParameters & |
parms | ) |
|
|
inlinestaticprivate |
Definition at line 131 of file SolenoidParametrization.h.
138 parms.m_interpolateZ = 0.;
143 parms.m_interpolateZ = 0.;
146 parms.m_complementZ = 1. - parms.m_interpolateZ;
152 parms.m_interpolateTheta = 0.;
155 parms.m_complementTheta = 1. - parms.m_interpolateTheta;
◆ integrate()
void Trk::SolenoidParametrization::integrate |
( |
double & |
firstIntegral, |
|
|
double & |
secondIntegral, |
|
|
double |
zBegin, |
|
|
double |
zEnd, |
|
|
const Parameters & |
parms |
|
) |
| const |
|
inlineprivate |
Definition at line 160 of file SolenoidParametrization.h.
166 double zDiff = zEnd - zBegin;
167 double zBeg2 = zBegin*zBegin;
168 double zBeg3 = zBeg2*zBegin;
169 double zEnd2 = zEnd*zEnd;
170 double zEnd3 = zEnd2*zEnd;
171 double zDiff4 = 0.25*(zEnd2 + zBeg2)*(zEnd2 - zBeg2);
173 firstIntegral += parms.m_fieldAtOrigin*zDiff +
174 parms.m_quadraticTerm*(zEnd3 - zBeg3)*0.333333333333 +
175 parms.m_cubicTerm*zDiff4;
176 double zDiffInv = 1./zDiff;
177 secondIntegral += parms.m_fieldAtOrigin*zDiff +
178 parms.m_quadraticTerm*(zDiffInv*zDiff4 - zBeg3)*0.666666666667 +
179 parms.m_cubicTerm*(0.1*zDiffInv*(zEnd2*zEnd3 - zBeg2*zBeg3) - 0.5*zBeg2*zBeg2);
◆ interpolate()
double Trk::SolenoidParametrization::interpolate |
( |
int |
key1, |
|
|
int |
key2, |
|
|
int |
key3, |
|
|
int |
key4, |
|
|
const Parameters & |
parms |
|
) |
| const |
|
inlineprivate |
◆ maximumR()
double Trk::SolenoidParametrization::maximumR |
( |
| ) |
const |
|
inline |
◆ maximumZ()
double Trk::SolenoidParametrization::maximumZ |
( |
| ) |
const |
|
inline |
◆ operator=()
◆ parametrizeSolenoid()
void Trk::SolenoidParametrization::parametrizeSolenoid |
( |
| ) |
|
|
private |
Definition at line 110 of file SolenoidParametrization.cxx.
114 double smallOffset = 0.0000000000001;
119 constexpr
int n = 200;
124 for (
int binTheta = 0; binTheta <
s_maxBinTheta - 1; ++binTheta) {
134 for (
int k = 0;
k <
n; ++
k){
137 double w = (
n -
k)*(
n -
k);
138 double zLocal =
z - zAtAxis;
152 BinParameters parms (zAtAxis,
cotTheta);
193 BinParameters parms (zAtAxis,
cotTheta);
◆ printFieldIntegrals()
void Trk::SolenoidParametrization::printFieldIntegrals |
( |
MsgStream & |
m | ) |
const |
Definition at line 207 of file SolenoidParametrization.cxx.
211 msg << __func__<<
"\n"
212 << std::setiosflags(std::ios::fixed)
213 <<
" eta rEnd mean(Bz) max(dBz/dR) mean(Bt) max(dBt/dR) "
214 <<
"min(Bt) max(Bt) reverse-bend(z) integrals: Bt.dR Bl.dR"
231 for (
int i = 0;
i != 31; ++
i)
237 if (std::abs(
cotTheta) > maxZ/maxR) rEnd = maxZ/direction.z();
238 double step = rEnd/
static_cast<double>(numSteps);
244 double minBT = 9999.;
245 double maxGradBT = 0.;
246 double maxGradBZ = 0.;
249 double reverseZ = 0.;
252 for (
int j = 0; j != numSteps; ++j)
254 position += 0.5*
step*direction;
258 position += 0.5*
step*direction;
259 double BZ =
field.z();
260 double BT = vCrossB.x()*direction.y() - vCrossB.y()*direction.x();
261 double BL = std::sqrt(vCrossB.mag2() - BT*BT);
265 if (BT > maxBT) maxBT = BT;
266 if (BT < minBT) minBT = BT;
269 if (BT*prevBT < 0.) reverseZ = position.z() -
step*direction.z();
270 double grad = std::abs(BT - prevBT);
271 if (grad > maxGradBT) maxGradBT = grad;
272 grad = std::abs(BZ - prevBZ);
273 if (grad > maxGradBZ) maxGradBZ = grad;
280 maxGradBT *=
static_cast<double>(numSteps)/
step;
281 maxGradBZ *=
static_cast<double>(numSteps)/
step;
282 meanBL /=
static_cast<double>(numSteps);
283 meanBT /=
static_cast<double>(numSteps);
284 meanBZ /=
static_cast<double>(numSteps);
285 double integralBL = meanBL*rEnd;
286 double integralBT = meanBT*rEnd;
288 msg << std::setw(6) << std::setprecision(2) <<
eta
311 for (
int k = 0;
k != 3; ++
k)
319 for (
int j = 0; j != numSteps; ++j)
321 position += 0.5*
step*direction;
325 position += 0.5*
step*direction;
326 double BT = vCrossB.x()*direction.y() - vCrossB.y()*direction.x();
329 asymm = asymm/
static_cast<double>(numSteps) - meanBT;
◆ printParametersForEtaLine()
void Trk::SolenoidParametrization::printParametersForEtaLine |
( |
double |
eta, |
|
|
double |
z_origin, |
|
|
MsgStream & |
msg |
|
) |
| const |
Definition at line 338 of file SolenoidParametrization.cxx.
341 BinParameters parms (z_origin,
cotTheta);
353 << std::setiosflags(std::ios::fixed)
354 <<
"SolenoidParametrization: line with eta " << std::setw(6) << std::setprecision(2) <<
eta
355 <<
" from (r,z) 0.0," << std::setw(6) << std::setprecision(1) << z_origin
356 <<
" inner terms: z0 "<< std::setw(6) << std::setprecision(2)
358 <<
" z^2 "<< std::setw(6) << std::setprecision(3)
360 <<
" z^3 " << std::setw(6) << std::setprecision(3)
362 <<
" outer terms: z0 "<< std::setw(6) << std::setprecision(3)
364 <<
" z^2 "<< std::setw(6) << std::setprecision(3)
366 <<
" z^3 " << std::setw(6) << std::setprecision(3)
368 << std::resetiosflags(std::ios::fixed) <<
"\n";
◆ printResidualForEtaLine()
void Trk::SolenoidParametrization::printResidualForEtaLine |
( |
double |
eta, |
|
|
double |
zOrigin, |
|
|
MsgStream & |
msg |
|
) |
| const |
Definition at line 372 of file SolenoidParametrization.cxx.
387 double chiSquareIn = 0.;
388 double chiSquareOut = 0.;
391 double worstBCalc = 0.;
392 double worstBTrue = 0.;
393 double worstDiff = -1.;
398 for (
int k = 0;
k <
n; ++
k)
415 if (std::abs(
diff) > worstDiff)
417 worstDiff = std::abs(
diff);
428 << std::setiosflags(std::ios::fixed)
429 <<
"SolenoidParametrization: line with eta " << std::setw(6) << std::setprecision(2) <<
eta
430 <<
" from (r,z) 0.0, " << std::setw(6) << std::setprecision(1) << zOrigin
431 <<
" rms diff inner/outer " << std::setw(6) << std::setprecision(3)
432 << std::sqrt(chiSquareIn/nIn) /
Gaudi::Units::tesla <<
" " << std::setw(6) << std::setprecision(3)
434 <<
" worst residual at: (r,z) "
435 << std::setw(6) << std::setprecision(1) << worstR
436 <<
", " << std::setw(6) << std::setprecision(1) << worstZ
437 <<
" with B true/calc " << std::setw(6) << std::setprecision(3)
440 << std::resetiosflags(std::ios::fixed) <<
"\n";
◆ setTerms()
void Trk::SolenoidParametrization::setTerms |
( |
int |
key1, |
|
|
Parameters & |
parms |
|
) |
| const |
|
inlineprivate |
◆ validOrigin()
◆ Parameters
◆ m_centralField
double Trk::SolenoidParametrization::m_centralField |
|
private |
◆ m_currentMax
double Trk::SolenoidParametrization::m_currentMax {} |
|
private |
◆ m_currentMin
double Trk::SolenoidParametrization::m_currentMin {} |
|
private |
◆ m_fieldCondObj
◆ m_parameters
double Trk::SolenoidParametrization::m_parameters[14688] |
|
private |
◆ s_binInvSizeTheta
const double Trk::SolenoidParametrization::s_binInvSizeTheta = 1./0.1 |
|
staticprivate |
◆ s_binInvSizeZ
const double Trk::SolenoidParametrization::s_binInvSizeZ = 1./20.*Gaudi::Units::mm |
|
staticprivate |
◆ s_binZeroTheta
const double Trk::SolenoidParametrization::s_binZeroTheta = 0. |
|
staticprivate |
◆ s_binZeroZ
const double Trk::SolenoidParametrization::s_binZeroZ = -160.*Gaudi::Units::mm |
|
staticprivate |
◆ s_lightSpeed
const double Trk::SolenoidParametrization::s_lightSpeed = -1.*299792458*Gaudi::Units::m/Gaudi::Units::s |
|
staticprivate |
◆ s_maxBinTheta
const int Trk::SolenoidParametrization::s_maxBinTheta = 72 |
|
staticprivate |
◆ s_maxBinZ
const int Trk::SolenoidParametrization::s_maxBinZ = 17 |
|
staticprivate |
◆ s_maximumImpactAtOrigin
const double Trk::SolenoidParametrization::s_maximumImpactAtOrigin = 30.*Gaudi::Units::mm |
|
staticprivate |
◆ s_maximumZatOrigin
const double Trk::SolenoidParametrization::s_maximumZatOrigin = 250.*Gaudi::Units::mm |
|
staticprivate |
◆ s_numberParameters
const int Trk::SolenoidParametrization::s_numberParameters = 6 |
|
staticprivate |
◆ s_rInner
const double Trk::SolenoidParametrization::s_rInner = 570.*Gaudi::Units::mm |
|
staticprivate |
◆ s_rOuter
const double Trk::SolenoidParametrization::s_rOuter = 1050.*Gaudi::Units::mm |
|
staticprivate |
◆ s_zInner
const double Trk::SolenoidParametrization::s_zInner = 2150.0*Gaudi::Units::mm |
|
staticprivate |
◆ s_zOuter
const double Trk::SolenoidParametrization::s_zOuter = 2800.0*Gaudi::Units::mm |
|
staticprivate |
The documentation for this class was generated from the following files:
static const int s_maxBinZ
static int fieldKey(BinParameters &parms)
Eigen::Matrix< double, Eigen::Dynamic, 1 > VectorX
Dynamic Vector - dynamic allocation.
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
static const double s_binZeroZ
@ z
global position (cartesian)
static const double s_lightSpeed
void parametrizeSolenoid()
const AtlasFieldCacheCondObj * m_fieldCondObj
void setTerms(int, Parameters &parms) const
static const double s_maximumZatOrigin
static const int s_maxBinTheta
constexpr double derivative(const double x)
static const double s_binInvSizeZ
void getInitializedCache(MagField::AtlasFieldCache &cache) const
get B field cache for evaluation as a function of 2-d or 3-d position.
double fieldComponent(double z, const Parameters &parms) const
void integrate(double &firstIntegral, double &secondIntegral, double zBegin, double zEnd, const Parameters &parms) const
double interpolate(int key1, int key2, int key3, int key4, const Parameters &parms) const
Eigen::Matrix< double, 3, 1 > Vector3D
static const double s_zInner
double m_parameters[14688]
Local cache for magnetic field (based on MagFieldServices/AtlasFieldSvcTLS.h)
static const int s_numberParameters
void getField(const double *ATH_RESTRICT xyz, double *ATH_RESTRICT bxyz, double *ATH_RESTRICT deriv=nullptr)
get B field value at given position xyz[3] is in mm, bxyz[3] is in kT if deriv[9] is given,...
static const double s_rOuter
static const double s_maximumImpactAtOrigin
static const double s_binInvSizeTheta
static const double s_zOuter
static const double s_rInner