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 55 of file FieldManager.h.

Member Function Documentation

◆ checkInitialized()

void genfit::FieldManager::checkInitialized ( )
inline

Definition at line 86 of file FieldManager.h.

87  {
88  if (!isInitialized()) {
89  std::cerr << "FieldManager hasn't been initialized with a correct AbsBField pointer!" << std::endl;
90  std::string msg("FieldManager hasn't been initialized with a correct AbsBField pointer!");
91  std::runtime_error err(msg);
92  throw err;
93  }
94  }

◆ checkInstanciated()

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

Definition at line 96 of file FieldManager.h.

97  {
98  if (instance_ == nullptr) {
99  std::cerr << "FieldManager hasn't been instantiated yet, call getInstance() and init() before getFieldVal()!" << std::endl;
100  std::string msg("FieldManager hasn't been instantiated yet, call getInstance() and init() before getFieldVal()!");
101  std::runtime_error err(msg);
102  throw err;
103  }
104  }

◆ getField()

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

Definition at line 58 of file FieldManager.h.

59  {
61  return field_;
62  }

◆ getFieldVal() [1/2]

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

This does NOT use the cache!

Definition at line 65 of file FieldManager.h.

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

66  {
68  return field_->get(position);
69  }
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 117 of file FieldManager.h.

118  {
119  if (instance_ == nullptr) {
120  instance_ = new FieldManager();
121  }
122  return instance_;
123  }

◆ init()

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

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

Definition at line 82 of file FieldManager.h.

82 { field_ = b; }

◆ isInitialized()

bool genfit::FieldManager::isInitialized ( )
inline

Definition at line 84 of file FieldManager.h.

84 { 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: