Belle II Software light-2406-ragdoll
MagneticField Class Reference

Magnetic field map. More...

#include <MagneticField.h>

Inheritance diagram for MagneticField:
Collaboration diagram for MagneticField:

Public Member Functions

 MagneticField ()
 Empty Constructor.
 
 ~MagneticField ()
 Delete all components.
 
 MagneticField (const MagneticField &)=delete
 Disallow copying the magnetic field.
 
 MagneticField (MagneticField &&other) noexcept
 But allow move construction.
 
ROOT::Math::XYZVector getField (const ROOT::Math::XYZVector &pos) const
 Calculate the magnetic field at a given position.
 
ROOT::Math::XYZVector getFieldInTesla (const ROOT::Math::XYZVector &pos) const
 Convenience function to get the field directly in Tesla.
 
void addComponent (MagneticFieldComponent *component)
 Add a new component to the magnetic field.
 

Private Member Functions

 ClassDef (MagneticField, 1)
 ROOT dictionary definition.
 

Private Attributes

std::vector< MagneticFieldComponent * > m_components
 Magnetic field components to evaluate the field.
 

Detailed Description

Magnetic field map.

It can be used directly using a DBObjPtr<MagneticField> instance in your class. Alternatively there is a BFieldManager class which encapsulates the DBObjPtr already. Field evaluation is then a simple call to BFieldManager::getField().

This class contains the Magnetic field map to be stored in the Database and used during simulation and reconstruction. The field can be assembled from multiple components (constant, 3D, 2D, ...) in different regions. By default all components valid in a certain region will be added to obtain the final field value but components can also be flagged as exclusive in which case only the field of this particular component will be returned.

Definition at line 32 of file MagneticField.h.

Constructor & Destructor Documentation

◆ MagneticField() [1/2]

MagneticField ( )
inline

Empty Constructor.

Definition at line 35 of file MagneticField.h.

35: TObject() {}

◆ ~MagneticField()

~MagneticField ( )
inline

Delete all components.

Definition at line 37 of file MagneticField.h.

38 {
39 for (auto c : m_components) delete c;
40 m_components.clear();
41 }
std::vector< MagneticFieldComponent * > m_components
Magnetic field components to evaluate the field.
Definition: MagneticField.h:62

◆ MagneticField() [2/2]

MagneticField ( MagneticField &&  other)
inlinenoexcept

But allow move construction.

Definition at line 45 of file MagneticField.h.

45: m_components(std::move(other.m_components)) {}

Member Function Documentation

◆ addComponent()

void addComponent ( MagneticFieldComponent component)
inline

Add a new component to the magnetic field.

Ownership is taken over by the MagneticField instance

Definition at line 59 of file MagneticField.h.

59{ m_components.emplace_back(component); }

◆ getFieldInTesla()

ROOT::Math::XYZVector getFieldInTesla ( const ROOT::Math::XYZVector &  pos) const
inline

Convenience function to get the field directly in Tesla.

Parameters
posposition where the field should be evaluated in framework units.
Returns
magnetic field at pos in framework units.

Definition at line 57 of file MagneticField.h.

57{ return getField(pos) / Unit::T; }
static const double T
[tesla]
Definition: Unit.h:120
ROOT::Math::XYZVector getField(const ROOT::Math::XYZVector &pos) const
Calculate the magnetic field at a given position.
Definition: MagneticField.h:67

Member Data Documentation

◆ m_components

std::vector<MagneticFieldComponent*> m_components
private

Magnetic field components to evaluate the field.

Definition at line 62 of file MagneticField.h.


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