FairRoot/PandaRoot
Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Attributes | List of all members
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...
 

Private Member Functions

 FieldManager ()
 
 ~FieldManager ()
 

Static Private Attributes

static FieldManagerinstance_
 
static AbsBFieldfield_
 
static bool useCache_
 
static unsigned int n_buckets_
 
static fieldCachecache_
 

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

Constructor & Destructor Documentation

genfit::FieldManager::FieldManager ( )
inlineprivate

Definition at line 122 of file FieldManager.h.

Referenced by getInstance().

122 {}
genfit::FieldManager::~FieldManager ( )
inlineprivate

Definition at line 124 of file FieldManager.h.

References cache_.

124 { delete cache_; }
static fieldCache * cache_
Definition: FieldManager.h:134

Member Function Documentation

void genfit::FieldManager::checkInitialized ( )
inline

Definition at line 84 of file FieldManager.h.

References isInitialized().

Referenced by getField(), and getFieldVal().

84  {
85  if(! isInitialized()){
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);
89  throw err;
90  }
91  }
static void genfit::FieldManager::checkInstanciated ( )
inlinestatic

Definition at line 93 of file FieldManager.h.

References instance_.

93  {
94  if(instance_==NULL){
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);
98  throw err;
99  }
100  }
static FieldManager * instance_
Definition: FieldManager.h:128
AbsBField* genfit::FieldManager::getField ( )
inline

Definition at line 57 of file FieldManager.h.

References checkInitialized(), and field_.

57  {
59  return field_;
60  }
static AbsBField * field_
Definition: FieldManager.h:129
TVector3 genfit::FieldManager::getFieldVal ( const TVector3 &  position)
inline

This does NOT use the cache!

Definition at line 63 of file FieldManager.h.

References checkInitialized(), field_, and genfit::AbsBField::get().

63  {
65  return field_->get(position);
66  }
static AbsBField * field_
Definition: FieldManager.h:129
virtual TVector3 get(const TVector3 &position) const =0
Get the magneticField [kGauss] at position.
void genfit::FieldManager::getFieldVal ( const double &  posX,
const double &  posY,
const double &  posZ,
double &  Bx,
double &  By,
double &  Bz 
)
static FieldManager* genfit::FieldManager::getInstance ( )
inlinestatic

Get singleton instance.

Definition at line 112 of file FieldManager.h.

References FieldManager(), and instance_.

Referenced by PndRecoDafFit2::Init(), and PndRecoKalmanFit2::Init().

112  {
113  if(instance_ == NULL) {
114  instance_ = new FieldManager();
115  }
116  return instance_;
117  }
static FieldManager * instance_
Definition: FieldManager.h:128
void genfit::FieldManager::init ( AbsBField b)
inline

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

Definition at line 78 of file FieldManager.h.

References b, and field_.

Referenced by PndRecoDafFit2::Init(), and PndRecoKalmanFit2::Init().

78  {
79  field_=b;
80  }
TTree * b
static AbsBField * field_
Definition: FieldManager.h:129
bool genfit::FieldManager::isInitialized ( )
inline

Definition at line 82 of file FieldManager.h.

References field_.

Referenced by checkInitialized().

82 { return field_ != NULL; }
static AbsBField * field_
Definition: FieldManager.h:129
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.

Member Data Documentation

fieldCache* genfit::FieldManager::cache_
staticprivate

Definition at line 134 of file FieldManager.h.

Referenced by ~FieldManager().

AbsBField* genfit::FieldManager::field_
staticprivate

Definition at line 129 of file FieldManager.h.

Referenced by getField(), getFieldVal(), init(), and isInitialized().

FieldManager* genfit::FieldManager::instance_
staticprivate

Definition at line 128 of file FieldManager.h.

Referenced by checkInstanciated(), and getInstance().

unsigned int genfit::FieldManager::n_buckets_
staticprivate

Definition at line 133 of file FieldManager.h.

bool genfit::FieldManager::useCache_
staticprivate

Definition at line 132 of file FieldManager.h.


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