PandaRoot
genfit::FieldManager Class Reference

Singleton which provides access to magnetic field maps. More...

#include <FieldManager.h>

Public Member Functions

AbsBFieldgetField ()
 
TVector3 getFieldVal (const TVector3 &position)
 This does NOT use the cache! More...
 
void getFieldVal (const double &posX, const double &posY, const double &posZ, double &Bx, double &By, double &Bz)
 
void init (AbsBField *b)
 set the magnetic field here. Magnetic field classes must be derived from AbsBField. More...
 
bool isInitialized ()
 
void checkInitialized ()
 
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 done. More...
 

Static Public Member Functions

static void checkInstanciated ()
 
static FieldManagergetInstance ()
 Get singleton instance. More...
 

Detailed Description

Singleton which provides access to magnetic field maps.

Author
Christian Höppner (Technische Universität München, original author)
Sebastian Neubert (Technische Universität München, original author)

Definition at line 67 of file FieldManager.h.

Member Function Documentation

◆ checkInitialized()

void genfit::FieldManager::checkInitialized ( )
inline

Definition at line 98 of file FieldManager.h.

99  {
100  if (!isInitialized()) {
101  std::cerr << "FieldManager hasn't been initialized with a correct AbsBField pointer!" << std::endl;
102  std::string msg("FieldManager hasn't been initialized with a correct AbsBField pointer!");
103  std::runtime_error err(msg);
104  throw err;
105  }
106  }

◆ checkInstanciated()

static void genfit::FieldManager::checkInstanciated ( )
inlinestatic

Definition at line 108 of file FieldManager.h.

109  {
110  if (instance_ == nullptr) {
111  std::cerr << "FieldManager hasn't been instantiated yet, call getInstance() and init() before getFieldVal()!" << std::endl;
112  std::string msg("FieldManager hasn't been instantiated yet, call getInstance() and init() before getFieldVal()!");
113  std::runtime_error err(msg);
114  throw err;
115  }
116  }

◆ getField()

AbsBField* genfit::FieldManager::getField ( )
inline

Definition at line 70 of file FieldManager.h.

71  {
73  return field_;
74  }

◆ getFieldVal() [1/2]

TVector3 genfit::FieldManager::getFieldVal ( const TVector3 &  position)
inline

This does NOT use the cache!

Definition at line 77 of file FieldManager.h.

References genfit::fieldCache::Bx, genfit::fieldCache::By, genfit::fieldCache::Bz, genfit::fieldCache::posX, genfit::fieldCache::posY, and genfit::fieldCache::posZ.

78  {
80  return field_->get(position);
81  }
virtual TVector3 get(const TVector3 &position) const =0
Get the magneticField [kGauss] at position.

◆ getFieldVal() [2/2]

void genfit::FieldManager::getFieldVal ( const double &  posX,
const double &  posY,
const double &  posZ,
double &  Bx,
double &  By,
double &  Bz 
)

◆ getInstance()

static FieldManager* genfit::FieldManager::getInstance ( )
inlinestatic

Get singleton instance.

Definition at line 129 of file FieldManager.h.

130  {
131  if (instance_ == nullptr) {
132  instance_ = new FieldManager();
133  }
134  return instance_;
135  }

◆ init()

void genfit::FieldManager::init ( AbsBField b)
inline

set the magnetic field here. Magnetic field classes must be derived from AbsBField.

Definition at line 94 of file FieldManager.h.

94 { field_ = b; }

◆ isInitialized()

bool genfit::FieldManager::isInitialized ( )
inline

Definition at line 96 of file FieldManager.h.

96 { return field_ != nullptr; }

◆ useCache()

void genfit::FieldManager::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 done.


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