SND@LHC Software
Loading...
Searching...
No Matches
genfit::FieldManager Class Reference

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

#include <FieldManager.h>

Collaboration diagram for genfit::FieldManager:

Public Member Functions

AbsBFieldgetField ()
 
TVector3 getFieldVal (const TVector3 &position)
 This does NOT use the cache!
 
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.
 
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.
 
AbsBFieldgetField ()
 
TVector3 getFieldVal (const TVector3 &position)
 This does NOT use the cache!
 
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.
 
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.
 

Static Public Member Functions

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

Private Member Functions

 FieldManager ()
 
 ~FieldManager ()
 
 FieldManager ()
 
 ~FieldManager ()
 

Static Private Attributes

static FieldManagerinstance_ = NULL
 
static AbsBFieldfield_ = NULL
 
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

◆ FieldManager() [1/2]

genfit::FieldManager::FieldManager ( )
inlineprivate

Definition at line 122 of file FieldManager.h.

122{}

◆ ~FieldManager() [1/2]

genfit::FieldManager::~FieldManager ( )
inlineprivate

Definition at line 124 of file FieldManager.h.

124{ delete cache_; }
static fieldCache * cache_

◆ FieldManager() [2/2]

genfit::FieldManager::FieldManager ( )
inlineprivate

Definition at line 122 of file FieldManager.h.

122{}

◆ ~FieldManager() [2/2]

genfit::FieldManager::~FieldManager ( )
inlineprivate

Definition at line 124 of file FieldManager.h.

124{ delete cache_; }

Member Function Documentation

◆ checkInitialized() [1/2]

void genfit::FieldManager::checkInitialized ( )
inline

Definition at line 84 of file FieldManager.h.

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 }

◆ checkInitialized() [2/2]

void genfit::FieldManager::checkInitialized ( )
inline

Definition at line 84 of file FieldManager.h.

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 }

◆ checkInstanciated() [1/2]

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

Definition at line 93 of file FieldManager.h.

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_

◆ checkInstanciated() [2/2]

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

Definition at line 93 of file FieldManager.h.

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 }

◆ getField() [1/2]

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

Definition at line 57 of file FieldManager.h.

57 {
59 return field_;
60 }
static AbsBField * field_

◆ getField() [2/2]

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

Definition at line 57 of file FieldManager.h.

57 {
59 return field_;
60 }

◆ getFieldVal() [1/4]

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

◆ getFieldVal() [2/4]

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

◆ getFieldVal() [3/4]

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

This does NOT use the cache!

Definition at line 63 of file FieldManager.h.

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

◆ getFieldVal() [4/4]

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

This does NOT use the cache!

Definition at line 63 of file FieldManager.h.

63 {
65 return field_->get(position);
66 }

◆ getInstance() [1/2]

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

Get singleton instance.

Definition at line 112 of file FieldManager.h.

112 {
113 if(instance_ == NULL) {
114 instance_ = new FieldManager();
115 }
116 return instance_;
117 }

◆ getInstance() [2/2]

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

Get singleton instance.

Definition at line 112 of file FieldManager.h.

112 {
113 if(instance_ == NULL) {
114 instance_ = new FieldManager();
115 }
116 return instance_;
117 }

◆ init() [1/2]

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.

◆ init() [2/2]

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.

78 {
79 field_=b;
80 }

◆ isInitialized() [1/2]

bool genfit::FieldManager::isInitialized ( )
inline

Definition at line 82 of file FieldManager.h.

82{ return field_ != NULL; }

◆ isInitialized() [2/2]

bool genfit::FieldManager::isInitialized ( )
inline

Definition at line 82 of file FieldManager.h.

82{ return field_ != NULL; }

◆ useCache() [1/2]

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.

◆ useCache() [2/2]

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

◆ cache_

static fieldCache * genfit::FieldManager::cache_
staticprivate

Definition at line 134 of file FieldManager.h.

◆ field_

static AbsBField * genfit::FieldManager::field_ = NULL
staticprivate

Definition at line 129 of file FieldManager.h.

◆ instance_

static FieldManager * genfit::FieldManager::instance_ = NULL
staticprivate

Definition at line 128 of file FieldManager.h.

◆ n_buckets_

static unsigned int genfit::FieldManager::n_buckets_
staticprivate

Definition at line 133 of file FieldManager.h.

◆ useCache_

static bool genfit::FieldManager::useCache_
staticprivate

Definition at line 132 of file FieldManager.h.


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