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 stength in z direction at the origin ( in Tesla )
 
static double getBFieldZ (const Vector2D &pos2D)
 Getter for the signed magnetic field stength in z direction ( in Tesla )
 
static double getBFieldZ (const Vector3D &pos3D)
 Getter for the signed magnetic field stength in z direction ( in Tesla )
 
static double getAlphaFromBField (double bField)
 Translater from magnetic field strength in Tesla to the alpha value.
 
static double getAlphaZ (const Vector2D &pos2D)
 Getter for the signed alpha of the magnetic field in z direction.
 
static double getAlphaZ (const Vector3D &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 Vector2D &pos2D)
 Conversion helper for momenta to two dimensional (absolute) bend radius.
 
static double absMom2DToBendRadius (double absMom2D, const Vector3D &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 Vector2D &pos2D)
 Conversion helper for momenta to two dimensional curvature.
 
static double absMom2DToCurvature (double absMom2D, double charge, const Vector3D &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 Vector2D &pos2D)
 Conversion helper for two dimensional curvature to momenta.
 
static double curvatureToAbsMom2D (double curvature, const Vector3D &pos3D)
 Conversion helper for two dimensional curvature to momenta.
 

Detailed Description

Helper functions to interact with the magnetic field.

Definition at line 23 of file CDCBFieldUtil.h.

Member Function Documentation

◆ absMom2DToBendRadius() [1/3]

double absMom2DToBendRadius ( double  absMom2D,
const Vector2D pos2D 
)
static

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

Definition at line 96 of file CDCBFieldUtil.cc.

98{
99 return absMom2DToBendRadius(absMom2D, getBFieldZ(pos2D));
100}
static double getBFieldZ()
Getter for the signed magnetic field stength 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 Vector3D pos3D 
)
static

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

Definition at line 102 of file CDCBFieldUtil.cc.

104{
105 return absMom2DToBendRadius(absMom2D, getBFieldZ(pos3D));
106}

◆ absMom2DToBendRadius() [3/3]

double absMom2DToBendRadius ( double  absMom2D,
double  bZ 
)
static

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

Definition at line 89 of file CDCBFieldUtil.cc.

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

◆ absMom2DToCurvature() [1/3]

double absMom2DToCurvature ( double  absMom2D,
double  charge,
const Vector2D pos2D 
)
static

Conversion helper for momenta to two dimensional curvature.

Definition at line 115 of file CDCBFieldUtil.cc.

118{
119 return absMom2DToCurvature(absMom2D, charge, getBFieldZ(pos2D));
120}
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 Vector3D pos3D 
)
static

Conversion helper for momenta to two dimensional curvature.

Definition at line 122 of file CDCBFieldUtil.cc.

125{
126 return absMom2DToCurvature(absMom2D, charge, getBFieldZ(pos3D));
127}

◆ absMom2DToCurvature() [3/3]

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

Conversion helper for momenta to two dimensional curvature.

Definition at line 108 of file CDCBFieldUtil.cc.

111{
112 return - charge * bZ * 0.00299792458 * std::fmax(0, 1 / absMom2D);
113}
double charge(int pdgCode)
Returns electric charge of a particle with given pdg code.
Definition: EvtPDLUtil.cc:44

◆ 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 74 of file CDCBFieldUtil.cc.

75{
76 return static_cast<ESign>(- ccwInfo * getBFieldZSign());
77}
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 79 of file CDCBFieldUtil.cc.

80{
81 return static_cast<ERotation>(- chargeSign * getBFieldZSign());
82}
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 84 of file CDCBFieldUtil.cc.

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

◆ curvatureToAbsMom2D() [1/3]

double curvatureToAbsMom2D ( double  curvature,
const Vector2D pos2D 
)
static

Conversion helper for two dimensional curvature to momenta.

Definition at line 135 of file CDCBFieldUtil.cc.

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

◆ curvatureToAbsMom2D() [2/3]

double curvatureToAbsMom2D ( double  curvature,
const Vector3D pos3D 
)
static

Conversion helper for two dimensional curvature to momenta.

Definition at line 141 of file CDCBFieldUtil.cc.

143{
144 return curvatureToAbsMom2D(curvature, getBFieldZ(pos3D));
145}

◆ curvatureToAbsMom2D() [3/3]

double curvatureToAbsMom2D ( double  curvature,
double  bZ 
)
static

Conversion helper for two dimensional curvature to momenta.

Definition at line 129 of file CDCBFieldUtil.cc.

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

◆ getAlphaFromBField()

double getAlphaFromBField ( double  bField)
static

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

Definition at line 59 of file CDCBFieldUtil.cc.

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

◆ getAlphaZ() [1/2]

double getAlphaZ ( const Vector2D pos2D)
static

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

Definition at line 64 of file CDCBFieldUtil.cc.

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

◆ getAlphaZ() [2/2]

double getAlphaZ ( const Vector3D pos3D)
static

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

Definition at line 69 of file CDCBFieldUtil.cc.

70{
71 return getAlphaFromBField(getBFieldZ(pos3D));
72}

◆ getBFieldZ() [1/3]

double getBFieldZ ( )
static

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

Definition at line 37 of file CDCBFieldUtil.cc.

38{
39 return getBFieldZ(Vector3D(0, 0, 0));
40}
A three dimensional vector.
Definition: Vector3D.h:33

◆ getBFieldZ() [2/3]

double getBFieldZ ( const Vector2D pos2D)
static

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

Definition at line 42 of file CDCBFieldUtil.cc.

43{
44 return getBFieldZ(Vector3D(pos2D, 0));
45}

◆ getBFieldZ() [3/3]

double getBFieldZ ( const Vector3D pos3D)
static

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

Definition at line 47 of file CDCBFieldUtil.cc.

48{
49 // The BFieldMap can not handle positions with not a number coordinates
50 // which can occure if fits fail.
51 // Return NAN to the caller and let him decide what to do next.
52 if (pos3D.hasNAN()) return NAN;
53 auto mag3D = BFieldManager::getField(pos3D.x(), pos3D.y(), pos3D.z());
54 return mag3D.Z() / Unit::T;
55}
double x() const
Getter for the x coordinate.
Definition: Vector3D.h:472
bool hasNAN() const
Checks if one of the coordinates is NAN.
Definition: Vector3D.h:165
double y() const
Getter for the y coordinate.
Definition: Vector3D.h:484
double z() const
Getter for the z coordinate.
Definition: Vector3D.h:496
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.
Definition: BFieldManager.h:91

◆ getBFieldZSign()

ESign getBFieldZSign ( )
static

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

Definition at line 32 of file CDCBFieldUtil.cc.

33{
34 return sign(CDCBFieldUtil::getBFieldZ());
35}

◆ isOff()

bool isOff ( )
static

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

Definition at line 25 of file CDCBFieldUtil.cc.

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

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