Belle II Software development
CDCBFieldUtil Class Reference

Helper functions to interact with the magnetic field. More...

#include <CDCBFieldUtil.h>

Static Public Member Functions

static bool isOff ()
 Indicator if the magnetic field is off in the current geometry.
 
static ESign getBFieldZSign ()
 Getter for the sign of the magnetic field in z direction.
 
static double getBFieldZ ()
 Getter for the signed magnetic field strength in z direction at the origin ( in Tesla )
 
static double getBFieldZ (const ROOT::Math::XYVector &pos2D)
 Getter for the signed magnetic field strength in z direction ( in Tesla )
 
static double getBFieldZ (const ROOT::Math::XYZVector &pos3D)
 Getter for the signed magnetic field strength in z direction ( in Tesla )
 
static double getAlphaFromBField (double bField)
 Translator from magnetic field strength in Tesla to the alpha value.
 
static double getAlphaZ (const ROOT::Math::XYVector &pos2D)
 Getter for the signed alpha of the magnetic field in z direction.
 
static double getAlphaZ (const ROOT::Math::XYZVector &pos3D)
 Getter for the signed alpha of the magnetic field in z direction.
 
static ESign ccwInfoToChargeSign (ERotation ccwInfo)
 Conversion helper from clockwise or counterclockwise travel to the charge sign.
 
static ERotation chargeSignToERotation (ESign chargeSign)
 Conversion helper from the charge sign to clockwise or counterclockwise travel.
 
static ERotation chargeToERotation (double charge)
 Conversion help for charges to clockwise or counterclockwise travel.
 
static double absMom2DToBendRadius (double absMom2D, double bZ)
 Conversion helper for momenta to two dimensional (absolute) bend radius.
 
static double absMom2DToBendRadius (double absMom2D, const ROOT::Math::XYVector &pos2D)
 Conversion helper for momenta to two dimensional (absolute) bend radius.
 
static double absMom2DToBendRadius (double absMom2D, const ROOT::Math::XYZVector &pos3D)
 Conversion helper for momenta to two dimensional (absolute) bend radius.
 
static double absMom2DToCurvature (double absMom2D, double charge, double bZ)
 Conversion helper for momenta to two dimensional curvature.
 
static double absMom2DToCurvature (double absMom2D, double charge, const ROOT::Math::XYVector &pos2D)
 Conversion helper for momenta to two dimensional curvature.
 
static double absMom2DToCurvature (double absMom2D, double charge, const ROOT::Math::XYZVector &pos3D)
 Conversion helper for momenta to two dimensional curvature.
 
static double curvatureToAbsMom2D (double curvature, double bZ)
 Conversion helper for two dimensional curvature to momenta.
 
static double curvatureToAbsMom2D (double curvature, const ROOT::Math::XYVector &pos2D)
 Conversion helper for two dimensional curvature to momenta.
 
static double curvatureToAbsMom2D (double curvature, const ROOT::Math::XYZVector &pos3D)
 Conversion helper for two dimensional curvature to momenta.
 

Detailed Description

Helper functions to interact with the magnetic field.

Definition at line 24 of file CDCBFieldUtil.h.

Member Function Documentation

◆ absMom2DToBendRadius() [1/3]

double absMom2DToBendRadius ( double absMom2D,
const ROOT::Math::XYVector & pos2D )
static

Conversion helper for momenta to two dimensional (absolute) bend radius.

Definition at line 98 of file CDCBFieldUtil.cc.

100{
101 return absMom2DToBendRadius(absMom2D, getBFieldZ(pos2D));
102}
static double getBFieldZ()
Getter for the signed magnetic field strength in z direction at the origin ( in Tesla )
static double absMom2DToBendRadius(double absMom2D, double bZ)
Conversion helper for momenta to two dimensional (absolute) bend radius.

◆ absMom2DToBendRadius() [2/3]

double absMom2DToBendRadius ( double absMom2D,
const ROOT::Math::XYZVector & pos3D )
static

Conversion helper for momenta to two dimensional (absolute) bend radius.

Definition at line 104 of file CDCBFieldUtil.cc.

106{
107 return absMom2DToBendRadius(absMom2D, getBFieldZ(pos3D));
108}

◆ absMom2DToBendRadius() [3/3]

double absMom2DToBendRadius ( double absMom2D,
double bZ )
static

Conversion helper for momenta to two dimensional (absolute) bend radius.

Definition at line 91 of file CDCBFieldUtil.cc.

93{
94 // In case of zero magnetic field return something large
95 return std::fmin(4440, absMom2D / (bZ * 0.00299792458));
96}

◆ absMom2DToCurvature() [1/3]

double absMom2DToCurvature ( double absMom2D,
double charge,
const ROOT::Math::XYVector & pos2D )
static

Conversion helper for momenta to two dimensional curvature.

Definition at line 117 of file CDCBFieldUtil.cc.

120{
121 return absMom2DToCurvature(absMom2D, charge, getBFieldZ(pos2D));
122}
static double absMom2DToCurvature(double absMom2D, double charge, double bZ)
Conversion helper for momenta to two dimensional curvature.

◆ absMom2DToCurvature() [2/3]

double absMom2DToCurvature ( double absMom2D,
double charge,
const ROOT::Math::XYZVector & pos3D )
static

Conversion helper for momenta to two dimensional curvature.

Definition at line 124 of file CDCBFieldUtil.cc.

127{
128 return absMom2DToCurvature(absMom2D, charge, getBFieldZ(pos3D));
129}

◆ absMom2DToCurvature() [3/3]

double absMom2DToCurvature ( double absMom2D,
double charge,
double bZ )
static

Conversion helper for momenta to two dimensional curvature.

Definition at line 110 of file CDCBFieldUtil.cc.

113{
114 return - charge * bZ * 0.00299792458 * std::fmax(0, 1 / absMom2D);
115}

◆ ccwInfoToChargeSign()

ESign ccwInfoToChargeSign ( ERotation ccwInfo)
static

Conversion helper from clockwise or counterclockwise travel to the charge sign.

Return the charge sign based on the travel direction on the fitted circle. With the Lorentz force F = q * v x B. For positively charged particles we have:

  • Counterclockwise travel <-> Bz < 0
  • Clockwise travel <-> Bz > 0 and opposite for negatively charged. Hence the charge sign is -ERotation * sign(Bz)

Definition at line 76 of file CDCBFieldUtil.cc.

77{
78 return static_cast<ESign>(- ccwInfo * getBFieldZSign());
79}
static ESign getBFieldZSign()
Getter for the sign of the magnetic field in z direction.
ESign
Enumeration for the distinct sign values of floating point variables.
Definition ESign.h:27

◆ chargeSignToERotation()

ERotation chargeSignToERotation ( ESign chargeSign)
static

Conversion helper from the charge sign to clockwise or counterclockwise travel.

Definition at line 81 of file CDCBFieldUtil.cc.

82{
83 return static_cast<ERotation>(- chargeSign * getBFieldZSign());
84}
ERotation
Enumeration to represent the distinct possibilities of the right left passage information.
Definition ERotation.h:25

◆ chargeToERotation()

ERotation chargeToERotation ( double charge)
static

Conversion help for charges to clockwise or counterclockwise travel.

Definition at line 86 of file CDCBFieldUtil.cc.

87{
88 return chargeSignToERotation(sign(charge));
89}
static ERotation chargeSignToERotation(ESign chargeSign)
Conversion helper from the charge sign to clockwise or counterclockwise travel.

◆ curvatureToAbsMom2D() [1/3]

double curvatureToAbsMom2D ( double curvature,
const ROOT::Math::XYVector & pos2D )
static

Conversion helper for two dimensional curvature to momenta.

Definition at line 137 of file CDCBFieldUtil.cc.

139{
140 return curvatureToAbsMom2D(curvature, getBFieldZ(pos2D));
141}
static double curvatureToAbsMom2D(double curvature, double bZ)
Conversion helper for two dimensional curvature to momenta.

◆ curvatureToAbsMom2D() [2/3]

double curvatureToAbsMom2D ( double curvature,
const ROOT::Math::XYZVector & pos3D )
static

Conversion helper for two dimensional curvature to momenta.

Definition at line 143 of file CDCBFieldUtil.cc.

145{
146 return curvatureToAbsMom2D(curvature, getBFieldZ(pos3D));
147}

◆ curvatureToAbsMom2D() [3/3]

double curvatureToAbsMom2D ( double curvature,
double bZ )
static

Conversion helper for two dimensional curvature to momenta.

Definition at line 131 of file CDCBFieldUtil.cc.

133{
134 return std::fmin(20, std::fabs(bZ * 0.00299792458 / curvature));
135}

◆ getAlphaFromBField()

double getAlphaFromBField ( double bField)
static

Translator from magnetic field strength in Tesla to the alpha value.

Definition at line 61 of file CDCBFieldUtil.cc.

62{
63 return 1.0 / (bField * TMath::C()) * 1E11;
64}

◆ getAlphaZ() [1/2]

double getAlphaZ ( const ROOT::Math::XYVector & pos2D)
static

Getter for the signed alpha of the magnetic field in z direction.

Definition at line 66 of file CDCBFieldUtil.cc.

67{
68 return getAlphaFromBField(getBFieldZ(pos2D));
69}
static double getAlphaFromBField(double bField)
Translator from magnetic field strength in Tesla to the alpha value.

◆ getAlphaZ() [2/2]

double getAlphaZ ( const ROOT::Math::XYZVector & pos3D)
static

Getter for the signed alpha of the magnetic field in z direction.

Definition at line 71 of file CDCBFieldUtil.cc.

72{
73 return getAlphaFromBField(getBFieldZ(pos3D));
74}

◆ getBFieldZ() [1/3]

double getBFieldZ ( )
static

Getter for the signed magnetic field strength in z direction at the origin ( in Tesla )

Definition at line 39 of file CDCBFieldUtil.cc.

40{
41 return getBFieldZ(ROOT::Math::XYZVector(0, 0, 0));
42}

◆ getBFieldZ() [2/3]

double getBFieldZ ( const ROOT::Math::XYVector & pos2D)
static

Getter for the signed magnetic field strength in z direction ( in Tesla )

Definition at line 44 of file CDCBFieldUtil.cc.

45{
46 return getBFieldZ(ROOT::Math::XYZVector(pos2D.X(), pos2D.Y(), 0));
47}

◆ getBFieldZ() [3/3]

double getBFieldZ ( const ROOT::Math::XYZVector & pos3D)
static

Getter for the signed magnetic field strength in z direction ( in Tesla )

Definition at line 49 of file CDCBFieldUtil.cc.

50{
51 // The BFieldMap can not handle positions with not a number coordinates
52 // which can occur if fits fail.
53 // Return NAN to the caller and let him decide what to do next.
54 if (VectorUtil::hasNAN(pos3D)) return NAN;
55 auto mag3D = BFieldManager::getField(pos3D.x(), pos3D.y(), pos3D.z());
56 return mag3D.Z() / Unit::T;
57}
static const double T
[tesla]
Definition Unit.h:120
static void getField(const double *pos, double *field)
return the magnetic field at a given position.

◆ getBFieldZSign()

ESign getBFieldZSign ( )
static

Getter for the sign of the magnetic field in z direction.

Definition at line 34 of file CDCBFieldUtil.cc.

35{
36 return sign(CDCBFieldUtil::getBFieldZ());
37}

◆ isOff()

bool isOff ( )
static

Indicator if the magnetic field is off in the current geometry.

Definition at line 27 of file CDCBFieldUtil.cc.

28{
29 double b = BFieldManager::getField(0, 0, 0).R();
30 double c_EarthMagneticField = 3.2e-5 * Unit::T;
31 return not(b > 5 * c_EarthMagneticField);
32}

The documentation for this class was generated from the following files: