24 #ifndef genfit_FieldManager_h
25 #define genfit_FieldManager_h
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);
103 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;
142 #endif // genfit_FieldManager_h
static void checkInstanciated()
Abstract Interface to magnetic fields in GENFIT.
static FieldManager * getInstance()
Get singleton instance.
static AbsBField * field_
void init(AbsBField *b)
set the magnetic field here. Magnetic field classes must be derived from AbsBField.
Cache B field at a position. Used by FieldManager.
static fieldCache * cache_
TVector3 getFieldVal(const TVector3 &position)
This does NOT use the 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...
Singleton which provides access to magnetic field maps.
static FieldManager * instance_
virtual TVector3 get(const TVector3 &position) const =0
Get the magneticField [kGauss] at position.
static unsigned int n_buckets_