Belle II Software light-2406-ragdoll
BFieldMap Class Reference

This class represents the magnetic field of the Belle II detector. More...

#include <BFieldMap.h>

Collaboration diagram for BFieldMap:

Public Member Functions

template<class BFIELDCOMP >
BFIELDCOMP & addBFieldComponent ()
 Adds a new BField component to the Belle II magnetic field.
 
void initialize ()
 Initialize the magnetic field after adding all components.
 
void clear ()
 Clear the existing components.
 

Static Public Member Functions

static BFieldMapInstance ()
 Static method to get a reference to the BFieldMap instance.
 

Protected Attributes

std::list< BFieldComponentAbs * > m_components
 The components of the magnetic field.
 

Private Member Functions

ROOT::Math::XYZVector getBField (const ROOT::Math::XYZVector &point) const
 Returns the magnetic field of the Belle II detector at the specified space point.
 
 BFieldMap ()
 The constructor is hidden to avoid that someone creates an instance of this class.
 
 BFieldMap (const BFieldMap &)
 Disable/Hide the copy constructor.
 
BFieldMapoperator= (const BFieldMap &)
 Disable/Hide the copy assignment operator.
 
virtual ~BFieldMap ()
 The destructor of the BFieldMap class.
 

Private Attributes

bool m_isMapInitialized
 If false the map hasn't been initialized yet.
 

Friends

struct std::default_delete< BFieldMap >
 allow destruction of instance
 
class BFieldFrameworkInterface
 only allow lookup by framework payload interface from now on
 

Detailed Description

This class represents the magnetic field of the Belle II detector.

Its main method is getBField() which returns the Bfield vector at the specified space point.

It is designed as a singleton.

Definition at line 30 of file BFieldMap.h.

Constructor & Destructor Documentation

◆ BFieldMap()

BFieldMap ( )
private

The constructor is hidden to avoid that someone creates an instance of this class.

Definition at line 44 of file BFieldMap.cc.

44 : m_isMapInitialized(false)
45{
46
47}
bool m_isMapInitialized
If false the map hasn't been initialized yet.
Definition: BFieldMap.h:74

◆ ~BFieldMap()

~BFieldMap ( )
privatevirtual

The destructor of the BFieldMap class.

Definition at line 49 of file BFieldMap.cc.

50{
52 //Delete the magnetic field components by calling their terminate() method and freeing their memory.
53 for (BFieldComponentAbs* comp : m_components) {
54 comp->terminate();
55 delete comp;
56 }
57 }
58}
The BFieldComponentAbs class.
std::list< BFieldComponentAbs * > m_components
The components of the magnetic field.
Definition: BFieldMap.h:69

Member Function Documentation

◆ clear()

void clear ( )

Clear the existing components.

Definition at line 33 of file BFieldMap.cc.

34{
35 m_isMapInitialized = false;
36 for (auto ptr : m_components) delete ptr;
37 m_components.clear();
38}

◆ initialize()

void initialize ( )

Initialize the magnetic field after adding all components.

Definition at line 21 of file BFieldMap.cc.

22{
23 if (!m_isMapInitialized) {
24 for (BFieldComponentAbs* comp : m_components) {
25 comp->initialize();
26 }
27
28 m_isMapInitialized = true;
29 B2DEBUG(10, "The magnetic field map has been initialized.");
30 }
31}

◆ Instance()

BFieldMap & Instance ( )
static

Static method to get a reference to the BFieldMap instance.

Returns
A reference to an instance of this class.

Definition at line 15 of file BFieldMap.cc.

16{
17 static std::unique_ptr<BFieldMap> instance(new BFieldMap());
18 return *instance;
19}
BFieldMap()
The constructor is hidden to avoid that someone creates an instance of this class.
Definition: BFieldMap.cc:44

Friends And Related Function Documentation

◆ BFieldFrameworkInterface

friend class BFieldFrameworkInterface
friend

only allow lookup by framework payload interface from now on

Definition at line 91 of file BFieldMap.h.

◆ std::default_delete< BFieldMap >

friend struct std::default_delete< BFieldMap >
friend

allow destruction of instance

Definition at line 86 of file BFieldMap.h.

Member Data Documentation

◆ m_components

std::list<BFieldComponentAbs*> m_components
protected

The components of the magnetic field.

Definition at line 69 of file BFieldMap.h.

◆ m_isMapInitialized

bool m_isMapInitialized
private

If false the map hasn't been initialized yet.

Definition at line 74 of file BFieldMap.h.


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