ATLAS Offline Software
Classes | Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
Trk::SolenoidParametrization Class Reference

#include <SolenoidParametrization.h>

Collaboration diagram for Trk::SolenoidParametrization:

Classes

class  BinParameters
 
class  Parameters
 

Public Member Functions

 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
 

Private Member Functions

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
 
void parametrizeSolenoid ()
 
void setTerms (int, Parameters &parms) const
 
 SolenoidParametrization (const SolenoidParametrization &)=delete
 
SolenoidParametrizationoperator= (const SolenoidParametrization &)=delete
 

Static Private Member Functions

static int fieldKey (BinParameters &parms)
 

Private Attributes

const AtlasFieldCacheCondObjm_fieldCondObj
 
double m_currentMin {}
 
double m_currentMax {}
 
double m_centralField
 
double m_parameters [14688]
 

Static Private Attributes

static const double s_binInvSizeTheta = 1./0.1
 
static const double s_binInvSizeZ = 1./20.*Gaudi::Units::mm
 
static const double s_binZeroTheta = 0.
 
static const double s_binZeroZ = -160.*Gaudi::Units::mm
 
static const double s_lightSpeed = -1.*299792458*Gaudi::Units::m/Gaudi::Units::s
 
static const int s_maxBinTheta = 72
 
static const int s_maxBinZ = 17
 
static const double s_maximumImpactAtOrigin = 30.*Gaudi::Units::mm
 
static const double s_maximumZatOrigin = 250.*Gaudi::Units::mm
 
static const int s_numberParameters = 6
 
static const double s_rInner = 570.*Gaudi::Units::mm
 
static const double s_rOuter = 1050.*Gaudi::Units::mm
 
static const double s_zInner = 2150.0*Gaudi::Units::mm
 
static const double s_zOuter = 2800.0*Gaudi::Units::mm
 

Friends

class Parameters
 

Detailed Description

Definition at line 30 of file SolenoidParametrization.h.

Constructor & Destructor Documentation

◆ SolenoidParametrization() [1/2]

Trk::SolenoidParametrization::SolenoidParametrization ( const AtlasFieldCacheCondObj field_cond_obj)

Definition at line 93 of file SolenoidParametrization.cxx.

94  : m_fieldCondObj (&field_cond_obj),
95  m_parameters ()
96 {
97 
98  MagField::AtlasFieldCache fieldCache;
99  m_fieldCondObj->getInitializedCache (fieldCache);
100  m_centralField = fieldComponent(0.,0.,0., fieldCache);
101  // now parametrise field - if requested
102  {
104  }
105 }

◆ ~SolenoidParametrization()

Trk::SolenoidParametrization::~SolenoidParametrization ( )
default

◆ SolenoidParametrization() [2/2]

Trk::SolenoidParametrization::SolenoidParametrization ( const SolenoidParametrization )
privatedelete

Member Function Documentation

◆ centralField()

double Trk::SolenoidParametrization::centralField ( ) const
inline

Definition at line 221 of file SolenoidParametrization.h.

222 { return m_centralField; }

◆ 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

Definition at line 236 of file SolenoidParametrization.h.

237 {
239  Amg::Vector3D position(r, 0., z);
240  fieldCache.getField(position.data(),field.data());
241  return s_lightSpeed*(field.z() - field.perp()*cotTheta);
242 }

◆ fieldComponent() [2/2]

double Trk::SolenoidParametrization::fieldComponent ( double  z,
const Parameters parms 
) const
inline

Definition at line 225 of file SolenoidParametrization.h.

226 {
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;
232  return value;
233 }

◆ 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.

250 {
251  zBegin = parms.m_signTheta*zBegin;
252  zEnd = parms.m_signTheta*zEnd;
253  if (zEnd < s_zInner || zBegin > s_zInner)
254  {
255  integrate(firstIntegral,secondIntegral,zBegin-parms.m_zAtAxis,zEnd-parms.m_zAtAxis, parms);
256  }
257  else
258  {
259  integrate(firstIntegral,secondIntegral,zBegin-parms.m_zAtAxis,s_zInner, parms);
260  int key = fieldKey(parms) + s_numberParameters/2;
261  setTerms(key, parms);
262  integrate(firstIntegral,secondIntegral,s_zInner,zEnd-parms.m_zAtAxis,parms);
263  }
264 }

◆ fieldKey()

int Trk::SolenoidParametrization::fieldKey ( BinParameters parms)
inlinestaticprivate

Definition at line 131 of file SolenoidParametrization.h.

132 {
133  double z = parms.m_zAtAxis - s_binZeroZ;
134  int zBin = static_cast<int>(s_binInvSizeZ*z);
135  parms.m_interpolateZ = z*s_binInvSizeZ - double(zBin);
136  if (zBin < 0)
137  {
138  parms.m_interpolateZ = 0.;
139  zBin = 0;
140  }
141  else if (zBin > s_maxBinZ - 2)
142  {
143  parms.m_interpolateZ = 0.;
144  zBin = s_maxBinZ - 1;
145  }
146  parms.m_complementZ = 1. - parms.m_interpolateZ;
147 
148  int thetaBin = static_cast<int>(s_binInvSizeTheta*parms.m_cotTheta);
149  parms.m_interpolateTheta = parms.m_cotTheta*s_binInvSizeTheta - double(thetaBin);
150  if (thetaBin > s_maxBinTheta - 3)
151  {
152  parms.m_interpolateTheta = 0.;
153  thetaBin = s_maxBinTheta - 2;
154  }
155  parms.m_complementTheta = 1. - parms.m_interpolateTheta;
156  return 2*s_numberParameters*(s_maxBinTheta*zBin + thetaBin);
157 }

◆ 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.

165 {
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);
172 
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);
180 }

◆ interpolate()

double Trk::SolenoidParametrization::interpolate ( int  key1,
int  key2,
int  key3,
int  key4,
const Parameters parms 
) const
inlineprivate

Definition at line 183 of file SolenoidParametrization.h.

188 {
189  return ((m_parameters[key1]*parms.m_complementZ +
190  m_parameters[key2]*parms.m_interpolateZ)*parms.m_complementTheta +
191  (m_parameters[key3]*parms.m_complementZ +
192  m_parameters[key4]*parms.m_interpolateZ)*parms.m_interpolateTheta);
193 }

◆ maximumR()

double Trk::SolenoidParametrization::maximumR ( ) const
inline

Definition at line 267 of file SolenoidParametrization.h.

268 { return s_rInner; }

◆ maximumZ()

double Trk::SolenoidParametrization::maximumZ ( ) const
inline

Definition at line 271 of file SolenoidParametrization.h.

272 { return s_zInner; }

◆ operator=()

SolenoidParametrization& Trk::SolenoidParametrization::operator= ( const SolenoidParametrization )
privatedelete

◆ parametrizeSolenoid()

void Trk::SolenoidParametrization::parametrizeSolenoid ( )
private

Definition at line 110 of file SolenoidParametrization.cxx.

110  {
111  // set parametrisation granularity (up to cotTheta = 7.)
112  // get value of cubic term for approx: Bz = Bcentral*(1 - term * z^3)
113  // 'fit' to average over cotTheta lines
114  double smallOffset = 0.0000000000001; // avoid FPE
115  double zAtAxis = s_binZeroZ; // + smallOffset ?
116  MagField::AtlasFieldCache fieldCache;
117  m_fieldCondObj->getInitializedCache (fieldCache);
118 
119  constexpr int n = 200;
120  Amg::VectorX difference(n); // it is filled below in the loop over n
121  Amg::MatrixX derivative(n,s_numberParameters); //set zero below
122  for (int binZ = 0; binZ < s_maxBinZ; ++binZ){
123  double cotTheta = smallOffset;
124  for (int binTheta = 0; binTheta < s_maxBinTheta - 1; ++binTheta) {
125  double r = 0.;
126  double z = zAtAxis;
127  double dr;
128  if (cotTheta < s_zOuter/s_rOuter){
129  dr = s_rOuter/double(n);
130  } else {
131  dr = s_zOuter/(cotTheta*double(n));
132  }
133  derivative.setZero();
134  for (int k = 0; k < n; ++k){
135  r += dr;
136  z += dr*cotTheta;
137  double w = (n - k)*(n - k);
138  double zLocal = z - zAtAxis;
139  if (r > s_rInner || z > s_zInner){
140  derivative(k,3) = w;
141  derivative(k,4) = w*zLocal*zLocal;
142  derivative(k,5) = w*zLocal*zLocal*zLocal;
143  } else {
144  derivative(k,0) = w;
145  derivative(k,1) = w*zLocal*zLocal;
146  derivative(k,2) = w*zLocal*zLocal*zLocal;
147  }
148  difference(k) = w*(fieldComponent(r,z,cotTheta, fieldCache) - m_centralField);
149  }
150  // solve for parametrization coefficients
151  Amg::VectorX solution = derivative.colPivHouseholderQr().solve(difference);
152  BinParameters parms (zAtAxis, cotTheta);
153  int key = fieldKey(parms);
154  assert (m_parameters[key] == 0.);
155  m_parameters[key++] = m_centralField + solution(0);
156  m_parameters[key++] = solution(1);
157  m_parameters[key++] = solution(2);
158  m_parameters[key++] = m_centralField + solution(3);
159  m_parameters[key++] = solution(4);
160  m_parameters[key++] = solution(5);
161  // duplicate last z-bin for contiguous neighbour lookup
162  if (binZ == s_maxBinZ - 1){
163  assert (m_parameters[key] == 0.);
164  m_parameters[key++] = m_centralField + solution(0);
165  m_parameters[key++] = solution(1);
166  m_parameters[key++] = solution(2);
167  m_parameters[key++] = m_centralField + solution(3);
168  m_parameters[key++] = solution(4);
169  m_parameters[key++] = solution(5);
171  }
172 
173  // duplicate next to previous z-bin for contiguous neighbour lookup
174  if (binZ > 0){
176  assert (m_parameters[key] == 0.);
177  m_parameters[key++] = m_centralField + solution(0);
178  m_parameters[key++] = solution(1);
179  m_parameters[key++] = solution(2);
180  m_parameters[key++] = m_centralField + solution(3);
181  m_parameters[key++] = solution(4);
182  m_parameters[key++] = solution(5);
183  }
185  } // Loop over binTheta
186  zAtAxis += 1./s_binInvSizeZ;
187  }
188  //
189  // duplicate end theta-bins for contiguous neighbour lookup
190  zAtAxis = s_binZeroZ; // + smallOffset ??
191  for (int binZ = 0; binZ < s_maxBinZ; ++binZ){
193  BinParameters parms (zAtAxis, cotTheta);
194  int key = fieldKey(parms);
195  for (int k = 0; k < 2*s_numberParameters; ++k){
196  assert (m_parameters[key+2*s_numberParameters] == 0.);
198  ++key;
199  }
200  zAtAxis += 1./s_binInvSizeZ;
201  }
202 }

◆ printFieldIntegrals()

void Trk::SolenoidParametrization::printFieldIntegrals ( MsgStream &  m) const

Definition at line 207 of file SolenoidParametrization.cxx.

208 {
209  // integrate along lines of const eta from origin to r = 1m or |z| = 2.65m
210  // direction normalised st transverse component = 1 (equiv to a fixed pt)
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"
215  << " asymm: x y z"
216  << " " << std::endl
217  << " m T T/m T T/m "
218  << " T T m T.m T.m"
219  << " T T T"
220  << "/n";
221 
222  double maxR = 1000.*Gaudi::Units::mm;
223  double maxZ = 2650.*Gaudi::Units::mm;
224  int numSteps = 1000;
225 
226  MagField::AtlasFieldCache fieldCache;
227  m_fieldCondObj->getInitializedCache (fieldCache);
228 
229  // step through eta-range
230  double eta = 0.;
231  for (int i = 0; i != 31; ++i)
232  {
233  double phi = 0.;
234  double cotTheta = std::sinh(eta);
236  double rEnd = maxR;
237  if (std::abs(cotTheta) > maxZ/maxR) rEnd = maxZ/direction.z();
238  double step = rEnd/static_cast<double>(numSteps); // radial step in mm
239  Amg::Vector3D position(0.,0.,0.);
240  double meanBL = 0.;
241  double meanBT = 0.;
242  double meanBZ = 0.;
243  double maxBT = 0.;
244  double minBT = 9999.;
245  double maxGradBT = 0.;
246  double maxGradBZ = 0.;
247  double prevBT = 0.;
248  double prevBZ = 0.;
249  double reverseZ = 0.;
250 
251  // look up field along eta-line
252  for (int j = 0; j != numSteps; ++j)
253  {
254  position += 0.5*step*direction;
256  fieldCache.getField(position.data(),field.data());
257  Amg::Vector3D vCrossB = direction.cross(field);
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);
262  meanBL += BL;
263  meanBT += BT;
264  meanBZ += BZ;
265  if (BT > maxBT) maxBT = BT;
266  if (BT < minBT) minBT = BT;
267  if (j > 0)
268  {
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;
274  }
275  prevBT = BT;
276  prevBZ = BZ;
277  }
278 
279  // normalize
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;
287 
288  msg << std::setw(6) << std::setprecision(2) << eta
289  << std::setw(8) << std::setprecision(3) << rEnd /Gaudi::Units::meter
290  << std::setw(11) << std::setprecision(4) << meanBZ /Gaudi::Units::tesla
291  << std::setw(12) << std::setprecision(3) << maxGradBZ /Gaudi::Units::tesla
292  << std::setw(13) << std::setprecision(4) << meanBT /Gaudi::Units::tesla
293  << std::setw(12) << std::setprecision(3) << maxGradBT /Gaudi::Units::tesla
294  << std::setw(13) << std::setprecision(4) << minBT /Gaudi::Units::tesla
295  << std::setw(8) << std::setprecision(4) << maxBT /Gaudi::Units::tesla;
296  if (reverseZ > 0.)
297  {
298  msg << std::setw(17) << std::setprecision(2) << reverseZ /Gaudi::Units::meter
299  << std::setw(18) << std::setprecision(4) << integralBT /(Gaudi::Units::tesla*Gaudi::Units::meter)
300  << std::setw(8) << std::setprecision(4) << integralBL /(Gaudi::Units::tesla*Gaudi::Units::meter)
301  << " ";
302  }
303  else
304  {
305  msg << std::setw(35) << std::setprecision(4) << integralBT /(Gaudi::Units::tesla*Gaudi::Units::meter)
306  << std::setw(8) << std::setprecision(4) << integralBL /(Gaudi::Units::tesla*Gaudi::Units::meter)
307  << " ";
308  }
309 
310  // check symmetry (reflect in each axis)
311  for (int k = 0; k != 3; ++k)
312  {
313  if (k == 0) direction = Amg::Vector3D(-std::cos(phi),std::sin(phi),cotTheta);
314  if (k == 1) direction = Amg::Vector3D(std::cos(phi),-std::sin(phi),cotTheta);
315  if (k == 2) direction = Amg::Vector3D(std::cos(phi),std::sin(phi),-cotTheta);
316  position = Amg::Vector3D(0.,0.,0.);
317  double asymm = 0.;
318  // look up field along eta-line
319  for (int j = 0; j != numSteps; ++j)
320  {
321  position += 0.5*step*direction;
323  fieldCache.getField(position.data(),field.data());
324  Amg::Vector3D vCrossB = direction.cross(field);
325  position += 0.5*step*direction;
326  double BT = vCrossB.x()*direction.y() - vCrossB.y()*direction.x();
327  asymm += BT;
328  }
329  asymm = asymm/static_cast<double>(numSteps) - meanBT;
330  msg << std::setw(9) << std::setprecision(4) << asymm /Gaudi::Units::tesla;
331  }
332  msg<<"/n";
333  eta += 0.1;
334  }
335 }

◆ printParametersForEtaLine()

void Trk::SolenoidParametrization::printParametersForEtaLine ( double  eta,
double  z_origin,
MsgStream &  msg 
) const

Definition at line 338 of file SolenoidParametrization.cxx.

339 {
340  double cotTheta = 1./std::tan(2.*std::atan(1./std::exp(eta)));
341  BinParameters parms (z_origin, cotTheta);
342  int key = fieldKey(parms);
343  double z_max;
344  if (cotTheta < s_zInner/s_rInner)
345  {
346  z_max = s_rInner*cotTheta;
347  }
348  else
349  {
350  z_max = s_zInner;
351  }
352  msg <<__func__<<"\n"
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)
359  << m_parameters[key+1]*z_max*z_max/m_centralField
360  << " z^3 " << std::setw(6) << std::setprecision(3)
361  << m_parameters[key+2]*z_max*z_max*z_max/m_centralField
362  << " outer terms: z0 "<< std::setw(6) << std::setprecision(3)
364  << " z^2 "<< std::setw(6) << std::setprecision(3)
365  << m_parameters[key+4]*z_max*z_max/m_centralField
366  << " z^3 " << std::setw(6) << std::setprecision(3)
367  << m_parameters[key+5]*z_max*z_max*z_max/m_centralField
368  << std::resetiosflags(std::ios::fixed) << "\n";
369 }

◆ printResidualForEtaLine()

void Trk::SolenoidParametrization::printResidualForEtaLine ( double  eta,
double  zOrigin,
MsgStream &  msg 
) const

Definition at line 372 of file SolenoidParametrization.cxx.

373 {
374  double cotTheta = 1./std::tan(2.*std::atan(1./std::exp(std::abs(eta))));
375  double z = zOrigin;
376  double r = 0.;
377  int n = 200;
378  double dr;
379  if (cotTheta < s_zOuter/s_rOuter)
380  {
381  dr = s_rOuter/double(n);
382  }
383  else
384  {
385  dr = s_zOuter/(cotTheta*double(n));
386  }
387  double chiSquareIn = 0.;
388  double chiSquareOut = 0.;
389  double nIn = 0.;
390  double nOut = 0.;
391  double worstBCalc = 0.;
392  double worstBTrue = 0.;
393  double worstDiff = -1.;
394  double worstR = 0.;
395  double worstZ = 0.;
396  MagField::AtlasFieldCache fieldCache;
397  m_fieldCondObj->getInitializedCache (fieldCache);
398  for (int k = 0; k < n; ++k)
399  {
400  double b = fieldComponent(r,z,cotTheta,fieldCache);
401  Parameters parms (*this, r, z, cotTheta);
402  double diff = (fieldComponent(z, parms) - b)/s_lightSpeed;
403 
404  if (r > s_rInner || z > s_zInner)
405  {
406  chiSquareOut+= diff*diff;
407  nOut += 1.;
408  }
409  else
410  {
411  chiSquareIn += diff*diff;
412  nIn += 1.;
413  }
414 
415  if (std::abs(diff) > worstDiff)
416  {
417  worstDiff = std::abs(diff);
418  worstBCalc = fieldComponent(z, parms);
419  worstBTrue = b;
420  worstR = r;
421  worstZ = z;
422  }
423  r += dr;
424  z += dr*cotTheta;
425  }
426 
427  msg <<__func__<<"\n"
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)
433  << std::sqrt(chiSquareOut/nOut) /Gaudi::Units::tesla << std::endl
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)
438  << worstBTrue/s_lightSpeed /Gaudi::Units::tesla
439  << " " << std::setw(6) << std::setprecision(3) << worstBCalc/s_lightSpeed /Gaudi::Units::tesla
440  << std::resetiosflags(std::ios::fixed) << "\n";
441 }

◆ setTerms()

void Trk::SolenoidParametrization::setTerms ( int  key1,
Parameters parms 
) const
inlineprivate

Definition at line 196 of file SolenoidParametrization.h.

197 {
198  int key2 = key1 + s_numberParameters;
199  int key3 = key2 + s_numberParameters;
200  int key4 = key3 + s_numberParameters;
201 
202  assert (key1 >= 0);
203  assert (key4 < 14688);
204  assert (m_parameters[key1] != 0.);
205  assert (m_parameters[key3] != 0.);
206  if (parms.m_cotTheta < 7.)
207  {
208  assert (m_parameters[key2] != 0.);
209  assert (m_parameters[key4] != 0.);
210  }
211 
212 
213  parms.m_fieldAtOrigin = interpolate(key1++,key2++,key3++,key4++,parms);
214  parms.m_quadraticTerm = interpolate(key1++,key2++,key3++,key4++,parms);
215  parms.m_cubicTerm = interpolate(key1,key2,key3,key4,parms);
216 }

◆ validOrigin()

bool Trk::SolenoidParametrization::validOrigin ( const Amg::Vector3D origin) const
inline

Definition at line 275 of file SolenoidParametrization.h.

276 { return (origin.perp() < s_maximumImpactAtOrigin
277  && std::abs(origin.z()) < s_maximumZatOrigin); }

Friends And Related Function Documentation

◆ Parameters

friend class Parameters
friend

Definition at line 88 of file SolenoidParametrization.h.

Member Data Documentation

◆ m_centralField

double Trk::SolenoidParametrization::m_centralField
private

Definition at line 120 of file SolenoidParametrization.h.

◆ m_currentMax

double Trk::SolenoidParametrization::m_currentMax {}
private

Definition at line 119 of file SolenoidParametrization.h.

◆ m_currentMin

double Trk::SolenoidParametrization::m_currentMin {}
private

Definition at line 118 of file SolenoidParametrization.h.

◆ m_fieldCondObj

const AtlasFieldCacheCondObj* Trk::SolenoidParametrization::m_fieldCondObj
private

Definition at line 117 of file SolenoidParametrization.h.

◆ m_parameters

double Trk::SolenoidParametrization::m_parameters[14688]
private

Definition at line 121 of file SolenoidParametrization.h.

◆ s_binInvSizeTheta

const double Trk::SolenoidParametrization::s_binInvSizeTheta = 1./0.1
staticprivate

Definition at line 102 of file SolenoidParametrization.h.

◆ s_binInvSizeZ

const double Trk::SolenoidParametrization::s_binInvSizeZ = 1./20.*Gaudi::Units::mm
staticprivate

Definition at line 103 of file SolenoidParametrization.h.

◆ s_binZeroTheta

const double Trk::SolenoidParametrization::s_binZeroTheta = 0.
staticprivate

Definition at line 104 of file SolenoidParametrization.h.

◆ s_binZeroZ

const double Trk::SolenoidParametrization::s_binZeroZ = -160.*Gaudi::Units::mm
staticprivate

Definition at line 105 of file SolenoidParametrization.h.

◆ s_lightSpeed

const double Trk::SolenoidParametrization::s_lightSpeed = -1.*299792458*Gaudi::Units::m/Gaudi::Units::s
staticprivate

Definition at line 106 of file SolenoidParametrization.h.

◆ s_maxBinTheta

const int Trk::SolenoidParametrization::s_maxBinTheta = 72
staticprivate

Definition at line 107 of file SolenoidParametrization.h.

◆ s_maxBinZ

const int Trk::SolenoidParametrization::s_maxBinZ = 17
staticprivate

Definition at line 108 of file SolenoidParametrization.h.

◆ s_maximumImpactAtOrigin

const double Trk::SolenoidParametrization::s_maximumImpactAtOrigin = 30.*Gaudi::Units::mm
staticprivate

Definition at line 109 of file SolenoidParametrization.h.

◆ s_maximumZatOrigin

const double Trk::SolenoidParametrization::s_maximumZatOrigin = 250.*Gaudi::Units::mm
staticprivate

Definition at line 110 of file SolenoidParametrization.h.

◆ s_numberParameters

const int Trk::SolenoidParametrization::s_numberParameters = 6
staticprivate

Definition at line 111 of file SolenoidParametrization.h.

◆ s_rInner

const double Trk::SolenoidParametrization::s_rInner = 570.*Gaudi::Units::mm
staticprivate

Definition at line 112 of file SolenoidParametrization.h.

◆ s_rOuter

const double Trk::SolenoidParametrization::s_rOuter = 1050.*Gaudi::Units::mm
staticprivate

Definition at line 113 of file SolenoidParametrization.h.

◆ s_zInner

const double Trk::SolenoidParametrization::s_zInner = 2150.0*Gaudi::Units::mm
staticprivate

Definition at line 114 of file SolenoidParametrization.h.

◆ s_zOuter

const double Trk::SolenoidParametrization::s_zOuter = 2800.0*Gaudi::Units::mm
staticprivate

Definition at line 115 of file SolenoidParametrization.h.


The documentation for this class was generated from the following files:
beamspotman.r
def r
Definition: beamspotman.py:676
test_pyathena.eta
eta
Definition: test_pyathena.py:10
Trk::SolenoidParametrization::s_maxBinZ
static const int s_maxBinZ
Definition: SolenoidParametrization.h:108
Trk::SolenoidParametrization::fieldKey
static int fieldKey(BinParameters &parms)
Definition: SolenoidParametrization.h:131
Amg::VectorX
Eigen::Matrix< double, Eigen::Dynamic, 1 > VectorX
Dynamic Vector - dynamic allocation.
Definition: EventPrimitives.h:30
Amg::MatrixX
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
Definition: EventPrimitives.h:27
Trk::SolenoidParametrization::s_binZeroZ
static const double s_binZeroZ
Definition: SolenoidParametrization.h:105
Trk::z
@ z
global position (cartesian)
Definition: ParamDefs.h:57
Trk::SolenoidParametrization::s_lightSpeed
static const double s_lightSpeed
Definition: SolenoidParametrization.h:106
Trk::binZ
@ binZ
Definition: BinningType.h:49
Trk::SolenoidParametrization::parametrizeSolenoid
void parametrizeSolenoid()
Definition: SolenoidParametrization.cxx:110
Trk::SolenoidParametrization::m_fieldCondObj
const AtlasFieldCacheCondObj * m_fieldCondObj
Definition: SolenoidParametrization.h:117
mc.diff
diff
Definition: mc.SFGenPy8_MuMu_DD.py:14
athena.value
value
Definition: athena.py:124
python.TurnDataReader.dr
dr
Definition: TurnDataReader.py:112
ReadOfcFromCool.field
field
Definition: ReadOfcFromCool.py:48
Trk::SolenoidParametrization::setTerms
void setTerms(int, Parameters &parms) const
Definition: SolenoidParametrization.h:196
drawFromPickle.cos
cos
Definition: drawFromPickle.py:36
Trk::SolenoidParametrization::s_maximumZatOrigin
static const double s_maximumZatOrigin
Definition: SolenoidParametrization.h:110
drawFromPickle.exp
exp
Definition: drawFromPickle.py:36
Trk::SolenoidParametrization::s_maxBinTheta
static const int s_maxBinTheta
Definition: SolenoidParametrization.h:107
MuonCalib::Legendre::derivative
constexpr double derivative(const double x)
Definition: LegendrePoly.h:120
drawFromPickle.atan
atan
Definition: drawFromPickle.py:36
module_driven_slicing.key2
key2
Definition: module_driven_slicing.py:159
Trk::SolenoidParametrization::s_binInvSizeZ
static const double s_binInvSizeZ
Definition: SolenoidParametrization.h:103
AtlasFieldCacheCondObj::getInitializedCache
void getInitializedCache(MagField::AtlasFieldCache &cache) const
get B field cache for evaluation as a function of 2-d or 3-d position.
Definition: AtlasFieldCacheCondObj.h:32
python.SystemOfUnits.meter
int meter
Definition: SystemOfUnits.py:61
Trk::SolenoidParametrization::fieldComponent
double fieldComponent(double z, const Parameters &parms) const
Definition: SolenoidParametrization.h:225
Trk::SolenoidParametrization::integrate
void integrate(double &firstIntegral, double &secondIntegral, double zBegin, double zEnd, const Parameters &parms) const
Definition: SolenoidParametrization.h:160
lumiFormat.i
int i
Definition: lumiFormat.py:85
Trk::SolenoidParametrization::interpolate
double interpolate(int key1, int key2, int key3, int key4, const Parameters &parms) const
Definition: SolenoidParametrization.h:183
beamspotman.n
n
Definition: beamspotman.py:731
drawFromPickle.tan
tan
Definition: drawFromPickle.py:36
xAOD::double
double
Definition: CompositeParticle_v1.cxx:159
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
python.SystemOfUnits.tesla
int tesla
Definition: SystemOfUnits.py:228
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
Trk::SolenoidParametrization::s_zInner
static const double s_zInner
Definition: SolenoidParametrization.h:114
python.SystemOfUnits.mm
int mm
Definition: SystemOfUnits.py:83
Trk::SolenoidParametrization::m_parameters
double m_parameters[14688]
Definition: SolenoidParametrization.h:121
MagField::AtlasFieldCache
Local cache for magnetic field (based on MagFieldServices/AtlasFieldSvcTLS.h)
Definition: AtlasFieldCache.h:43
Trk::SolenoidParametrization::s_numberParameters
static const int s_numberParameters
Definition: SolenoidParametrization.h:111
TRT::Track::cotTheta
@ cotTheta
Definition: InnerDetector/InDetCalibEvent/TRT_CalibData/TRT_CalibData/TrackInfo.h:65
LArCellBinning.step
step
Definition: LArCellBinning.py:158
MagField::AtlasFieldCache::getField
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,...
Definition: AtlasFieldCache.cxx:42
Trk::phi
@ phi
Definition: ParamDefs.h:75
drawFromPickle.sin
sin
Definition: drawFromPickle.py:36
Trk::SolenoidParametrization::s_rOuter
static const double s_rOuter
Definition: SolenoidParametrization.h:113
python.IoTestsLib.w
def w
Definition: IoTestsLib.py:200
Trk::SolenoidParametrization::s_maximumImpactAtOrigin
static const double s_maximumImpactAtOrigin
Definition: SolenoidParametrization.h:109
Trk::SolenoidParametrization::m_centralField
double m_centralField
Definition: SolenoidParametrization.h:120
Trk::SolenoidParametrization::s_binInvSizeTheta
static const double s_binInvSizeTheta
Definition: SolenoidParametrization.h:102
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
Trk::SolenoidParametrization::Parameters
friend class Parameters
Definition: SolenoidParametrization.h:88
fitman.k
k
Definition: fitman.py:528
Trk::SolenoidParametrization::s_zOuter
static const double s_zOuter
Definition: SolenoidParametrization.h:115
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37
module_driven_slicing.key1
key1
Definition: module_driven_slicing.py:158
Trk::SolenoidParametrization::s_rInner
static const double s_rInner
Definition: SolenoidParametrization.h:112