24#ifndef genfit_FieldManager_h
25#define genfit_FieldManager_h
65 return field_->get(position);
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);
93 errorOut <<
"FieldManager hasn't been initialized with a correct AbsBField pointer!" << std::endl;
94 std::string msg(
"FieldManager hasn't been initialized with a correct AbsBField pointer!");
95 std::runtime_error err(msg);
102 errorOut <<
"FieldManager hasn't been instantiated yet, call getInstance() and init() before getFieldVal()!" << std::endl;
103 std::string msg(
"FieldManager hasn't been instantiated yet, call getInstance() and init() before getFieldVal()!");
104 std::runtime_error err(msg);
111 void useCache(
bool opt =
true,
unsigned int nBuckets = 8);
113 void useCache(
bool opt =
true,
unsigned int nBuckets = 8) {
114 std::cerr <<
"genfit::FieldManager::useCache() - FieldManager is compiled w/o CACHE, no caching will be done!" << std::endl;
Abstract Interface to magnetic fields in GENFIT.
virtual TVector3 get(const TVector3 &position) const =0
Get the magneticField [kGauss] at position.
void init(AbsBField *b)
set the magnetic field here. Magnetic field classes must be derived from AbsBField.
static unsigned int n_buckets_
static FieldManager * instance_
static void checkInstanciated()
TVector3 getFieldVal(const TVector3 &position)
This does NOT use the cache!
static FieldManager * getInstance()
Get singleton instance.
static fieldCache * cache_
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...
static AbsBField * field_
Defines for I/O streams used for error and debug printing.
Cache B field at a position. Used by FieldManager.