CMS 3D CMS Logo

Classes | Functions
magneticFieldParabolicPortable Namespace Reference

Classes

struct  Parameters
 

Functions

template<typename Vec3 >
constexpr float B0Z (Vec3 const &vec)
 
template<typename Vec3 >
constexpr bool isValid (Vec3 const &vec)
 
template<typename Vec3 >
constexpr float Kr (Vec3 const &vec)
 
template<typename Vec3 >
constexpr float magneticFieldAtPoint (Vec3 const &vec)
 

Detailed Description

Description: Utility function to calculate the Magnetic Field on the GPU. The Vec3 argument of the functions must support access to its components via (), note that e.g. Eigen::Matrix provides such an interface.

Function Documentation

◆ B0Z()

template<typename Vec3 >
constexpr float magneticFieldParabolicPortable::B0Z ( Vec3 const &  vec)

◆ isValid()

template<typename Vec3 >
constexpr bool magneticFieldParabolicPortable::isValid ( Vec3 const &  vec)

Definition at line 32 of file ParabolicParametrizedMagneticField.h.

References magneticFieldParabolicPortable::Parameters::max_radius2, and magneticFieldParabolicPortable::Parameters::max_z.

Referenced by magneticFieldAtPoint().

32  {
33  return ((vec(0) * vec(0) + vec(1) * vec(1)) < Parameters::max_radius2 && fabs(vec(2)) < Parameters::max_z);
34  }

◆ Kr()

template<typename Vec3 >
constexpr float magneticFieldParabolicPortable::Kr ( Vec3 const &  vec)

Definition at line 22 of file ParabolicParametrizedMagneticField.h.

References magneticFieldParabolicPortable::Parameters::a, and f.

Referenced by magneticFieldAtPoint().

22  {
23  return Parameters::a * (vec(0) * vec(0) + vec(1) * vec(1)) + 1.f;
24  }
double f[11][100]
double a
Definition: hdecay.h:121

◆ magneticFieldAtPoint()

template<typename Vec3 >
constexpr float magneticFieldParabolicPortable::magneticFieldAtPoint ( Vec3 const &  vec)

Definition at line 37 of file ParabolicParametrizedMagneticField.h.

References B0Z(), isValid(), and Kr().

37  {
38  if (isValid(vec)) {
39  return B0Z(vec) * Kr(vec);
40  } else {
41  return 0;
42  }
43  }