12#include <Math/Vector3D.h>
13#include <framework/logging/Logger.h>
14#include <framework/gearbox/Unit.h>
15#include <framework/database/DBObjPtr.h>
16#include <framework/dbobjects/MagneticField.h>
38 static void getField(
const double* pos,
double* field);
45 static ROOT::Math::XYZVector
getField(
double x,
double y,
double z)
47 return getField(ROOT::Math::XYZVector(x, y, z));
53 static ROOT::Math::XYZVector
getField(
const ROOT::Math::XYZVector& pos)
80 ROOT::Math::XYZVector
calculate(
const ROOT::Math::XYZVector& pos)
const;
87 if (!
m_magfield) B2FATAL(
"Could not load magnetic field configuration from database");
93 ROOT::Math::XYZVector fieldvec =
getField(ROOT::Math::XYZVector(pos[0], pos[1], pos[2]));
94 field[0] = fieldvec.X();
95 field[1] = fieldvec.Y();
96 field[2] = fieldvec.Z();
Bfield manager to obtain the magnetic field at any point.
BFieldManager & operator=(const BFieldManager &)=delete
Singleton: no assignment operator.
BFieldManager()=default
Singleton: private constructor.
static ROOT::Math::XYZVector getField(const ROOT::Math::XYZVector &pos)
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 BFieldManager & getInstance()
Return the instance of the magnetic field manager.
BFieldManager(BFieldManager &)=delete
Singleton: no copy constructor.
static ROOT::Math::XYZVector getFieldInTesla(const ROOT::Math::XYZVector &pos)
return the magnetic field at a given position in Tesla.
DBObjPtr< MagneticField > m_magfield
Pointer to the actual magnetic field in the database.
~BFieldManager()=default
Empty destructor: this is just a wrapper to access the database object.
Class for accessing objects in the database.
static const double T
[tesla]
ROOT::Math::XYZVector calculate(const ROOT::Math::XYZVector &pos) const
Calculate the field value at a given position and return it.
static void getField(const double *pos, double *field)
return the magnetic field at a given position.
Abstract base class for different kinds of events.