Belle II Software development
BFieldManager Class Reference

Bfield manager to obtain the magnetic field at any point. More...

#include <BFieldManager.h>

Static Public Member Functions

static void getField (const double *pos, double *field)
 return the magnetic field at a given position.
 
static ROOT::Math::XYZVector getField (double x, double y, double z)
 return the magnetic field at a given position.
 
static ROOT::Math::XYZVector getField (const ROOT::Math::XYZVector &pos)
 return the magnetic field at a given position.
 
static ROOT::Math::XYZVector getFieldInTesla (const ROOT::Math::XYZVector &pos)
 return the magnetic field at a given position in Tesla.
 
static BFieldManagergetInstance ()
 Return the instance of the magnetic field manager.
 

Private Member Functions

 BFieldManager ()=default
 Singleton: private constructor.
 
 BFieldManager (BFieldManager &)=delete
 Singleton: no copy constructor.
 
BFieldManageroperator= (const BFieldManager &)=delete
 Singleton: no assignment operator.
 
 ~BFieldManager ()=default
 Empty destructor: this is just a wrapper to access the database object.
 
ROOT::Math::XYZVector calculate (const ROOT::Math::XYZVector &pos) const
 Calculate the field value at a given position and return it.
 

Private Attributes

DBObjPtr< MagneticFieldm_magfield
 Pointer to the actual magnetic field in the database.
 

Detailed Description

Bfield manager to obtain the magnetic field at any point.

This class is implemented as singleton, there can only be one magnetic field. It has static members to get the field at a given point.

Note
For internal use in the simulation, there is also a BFieldMap class in the geometry package with similar behaviour. To ensure consistent output, the BFieldFrameworkInterface component provides a wrapper around BFieldMap and is used by default.

Definition at line 32 of file BFieldManager.h.

Member Function Documentation

◆ getField() [1/2]

static ROOT::Math::XYZVector getField ( const ROOT::Math::XYZVector &  pos)
inlinestatic

return the magnetic field at a given position.

Parameters
posposition where to evaluate the magnetic field
Returns
magnetic field value at position pos in framework units

Definition at line 53 of file BFieldManager.h.

54 {
56 }
static BFieldManager & getInstance()
Return the instance of the magnetic field manager.
ROOT::Math::XYZVector calculate(const ROOT::Math::XYZVector &pos) const
Calculate the field value at a given position and return it.
Definition: BFieldManager.h:85

◆ getField() [2/2]

static ROOT::Math::XYZVector getField ( double  x,
double  y,
double  z 
)
inlinestatic

return the magnetic field at a given position.

Parameters
xx coordinate of the position where to evaluate the magnetic field
yy coordinate of the position where to evaluate the magnetic field
zz coordinate of the position where to evaluate the magnetic field
Returns
magnetic field value at position pos in framework units

Definition at line 45 of file BFieldManager.h.

46 {
47 return getField(ROOT::Math::XYZVector(x, y, z));
48 }
static void getField(const double *pos, double *field)
return the magnetic field at a given position.
Definition: BFieldManager.h:91

◆ getFieldInTesla()

static ROOT::Math::XYZVector getFieldInTesla ( const ROOT::Math::XYZVector &  pos)
inlinestatic

return the magnetic field at a given position in Tesla.

Parameters
posposition where to evaluate the magnetic field
Returns
magnetic field value at position pos in Tesla

Definition at line 61 of file BFieldManager.h.

62 {
63 return getField(pos) / Unit::T;
64 }
static const double T
[tesla]
Definition: Unit.h:120

◆ getInstance()

BFieldManager & getInstance ( )
static

Return the instance of the magnetic field manager.

Definition at line 13 of file BFieldManager.cc.

14{
15 static BFieldManager instance;
16 return instance;
17}
Bfield manager to obtain the magnetic field at any point.
Definition: BFieldManager.h:32

Member Data Documentation

◆ m_magfield

DBObjPtr<MagneticField> m_magfield
private

Pointer to the actual magnetic field in the database.

Definition at line 82 of file BFieldManager.h.


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