24#ifndef genfit_FieldManager_h
25#define genfit_FieldManager_h
43 double Bx;
double By;
double Bz;
69 void getFieldVal(
const double& posX,
const double& posY,
const double& posZ,
double& Bx,
double& By,
double& Bz);
71 inline void getFieldVal(
const double& posX,
const double& posY,
const double& posZ,
double& Bx,
double& By,
double& Bz) {
73 return field_->
get(posX, posY, posZ, Bx, By, Bz);
86 std::cerr <<
"FieldManager hasn't been initialized with a correct AbsBField pointer!" << std::endl;
87 std::string msg(
"FieldManager hasn't been initialized with a correct AbsBField pointer!");
88 std::runtime_error err(msg);
95 std::cerr <<
"FieldManager hasn't been instantiated yet, call getInstance() and init() before getFieldVal()!" << std::endl;
96 std::string msg(
"FieldManager hasn't been instantiated yet, call getInstance() and init() before getFieldVal()!");
97 std::runtime_error err(msg);
104 void useCache(
bool opt =
true,
unsigned int nBuckets = 8);
106 void useCache(
bool opt =
true,
unsigned int nBuckets = 8) {
107 std::cerr <<
"genfit::FieldManager::useCache() - FieldManager is compiled w/o CACHE, no caching will be done!" << std::endl;
134 static fieldCache*
cache_;
Abstract Interface to magnetic fields in GENFIT.
virtual TVector3 get(const TVector3 &position) const =0
Get the magneticField [kGauss] at position.
Singleton which provides access to magnetic field maps.
void init(AbsBField *b)
set the magnetic field here. Magnetic field classes must be derived from AbsBField.
void getFieldVal(const double &posX, const double &posY, const double &posZ, double &Bx, double &By, double &Bz)
static void checkInstanciated()
static unsigned int n_buckets_
TVector3 getFieldVal(const TVector3 &position)
This does NOT use the cache!
static FieldManager * getInstance()
Get singleton instance.
static fieldCache * cache_
static FieldManager * instance_
static AbsBField * field_
void useCache(bool opt=true, unsigned int nBuckets=8)
Cache last lookup positions, and use stored field values if a lookup at (almost) the same position is...