CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
magfieldparam::BCycl< T > Class Template Reference

#include <BCyl.h>

Public Member Functions

 BCycl (BCylParam< T > const &ipar)
 
void compute (T r2, T z, T &Br, T &Bz) const
 
void operator() (T r2, T z, T &Br, T &Bz) const
 

Private Attributes

BCylParam< Tpars
 

Detailed Description

template<typename T>
class magfieldparam::BCycl< T >

Definition at line 66 of file BCyl.h.

Constructor & Destructor Documentation

◆ BCycl()

template<typename T>
magfieldparam::BCycl< T >::BCycl ( BCylParam< T > const &  ipar)
inline

Definition at line 68 of file BCyl.h.

68 : pars(ipar) {}
BCylParam< T > pars
Definition: BCyl.h:97

Member Function Documentation

◆ compute()

template<typename T>
void magfieldparam::BCycl< T >::compute ( T  r2,
T  z,
T Br,
T Bz 
) const
inline

Definition at line 73 of file BCyl.h.

Referenced by magfieldparam::BCycl< float >::operator()().

73  {
74  using namespace bcylDetails;
75  // if (r<1.15&&fabs(z)<2.8) // NOTE: check omitted, is done already by the wrapper! (NA)
76  z -= pars.prm[3]; // max Bz point is shifted in z
77  T az = std::abs(z);
78  T zainv = z * pars.ainv;
79  T u = pars.hlova - zainv;
80  T v = pars.hlova + zainv;
81  T fu[4], gv[4];
82  ffunkti(u, fu);
83  ffunkti(v, gv);
84  T rat = T(0.5) * pars.ainv;
85  T rat2 = rat * rat * r2;
86  Br = pars.hb0 * rat * (fu[1] - gv[1] - (fu[3] - gv[3]) * rat2 * T(0.5));
87  Bz = pars.hb0 * (fu[0] + gv[0] - (fu[2] + gv[2]) * rat2);
88 
89  T corBr = pars.prm[4] * z * (az - pars.prm[5]) * (az - pars.prm[5]);
90  T corBz = -pars.prm[6] * (myExp(-(z - pars.prm[7]) * (z - pars.prm[7]) * pars.coeff) +
91  myExp(-(z + pars.prm[7]) * (z + pars.prm[7]) * pars.coeff)); // double Gaussian
92  Br += corBr;
93  Bz += corBz;
94  }
float myExp(float x)
Definition: BCyl.h:61
BCylParam< T > pars
Definition: BCyl.h:97
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
void ffunkti(T u, T *__restrict__ ff) __attribute__((always_inline))
Definition: BCyl.h:47
long double T

◆ operator()()

template<typename T>
void magfieldparam::BCycl< T >::operator() ( T  r2,
T  z,
T Br,
T Bz 
) const
inline

Definition at line 70 of file BCyl.h.

70 { compute(r2, z, Br, Bz); }
void compute(T r2, T z, T &Br, T &Bz) const
Definition: BCyl.h:73

Member Data Documentation

◆ pars

template<typename T>
BCylParam<T> magfieldparam::BCycl< T >::pars
private

Definition at line 97 of file BCyl.h.

Referenced by magfieldparam::BCycl< float >::compute().