Belle II Software development
BFieldComponentConstant Class Reference

The BFieldComponentConstant class. More...

#include <BFieldComponentConstant.h>

Inheritance diagram for BFieldComponentConstant:
BFieldComponentAbs

Public Member Functions

 BFieldComponentConstant ()=default
 The BFieldComponentConstant constructor.
 
virtual ~BFieldComponentConstant ()=default
 The BFieldComponentConstant destructor.
 
virtual ROOT::Math::XYZVector calculate (const ROOT::Math::XYZVector &point) const override
 Calculates the magnetic field vector at the specified space point.
 
void setMagneticFieldValues (double x, double y, double z, double rmax, double zmin, double zmax)
 Sets the values for the homogeneous magnetic field vector.
 
virtual void initialize ()
 Initializes the magnetic field component.
 
virtual void terminate ()
 Terminates the magnetic field component.
 

Private Attributes

double m_magneticField [3] {0}
 The values for the homogeneous magnetic field vector.
 
double maxRadius4BField {0}
 The values for the maximum radius for the homogeneous field.
 
double minZ4BField {0}
 The values for the minimum z position for the homogeneous field.
 
double maxZ4BField {0}
 The values for the maximum z position for the homogeneous field.
 

Detailed Description

The BFieldComponentConstant class.

This class represents an homogeneous magnetic field.

Definition at line 24 of file BFieldComponentConstant.h.

Member Function Documentation

◆ calculate()

ROOT::Math::XYZVector calculate ( const ROOT::Math::XYZVector &  point) const
overridevirtual

Calculates the magnetic field vector at the specified space point.

Parameters
pointThe space point in Cartesian coordinates (x,y,z) in [cm] at which the magnetic field vector should be calculated.
Returns
The magnetic field vector at the given space point in [T]. Returns a zero vector XYZVector(0,0,0) if the space point lies outside the region described by the component.

Implements BFieldComponentAbs.

Definition at line 14 of file BFieldComponentConstant.cc.

15{
16 if ((maxRadius4BField > 0.0 && maxRadius4BField < point.Rho()) ||
17 (point.Z() < minZ4BField || point.Z() > maxZ4BField)) return ROOT::Math::XYZVector(0, 0, 0);
18 return ROOT::Math::XYZVector(m_magneticField[0], m_magneticField[1], m_magneticField[2]);
19}
double maxZ4BField
The values for the maximum z position for the homogeneous field.
double maxRadius4BField
The values for the maximum radius for the homogeneous field.
double m_magneticField[3]
The values for the homogeneous magnetic field vector.
double minZ4BField
The values for the minimum z position for the homogeneous field.

◆ initialize()

virtual void initialize ( )
inlinevirtualinherited

Initializes the magnetic field component.

This method should be used to open and load files containing the magnetic field data.

Reimplemented in BFieldComponent3d, BFieldComponentBeamline, BFieldComponentKlm1, BFieldComponentQuad, and BFieldComponentRadial.

Definition at line 45 of file BFieldComponentAbs.h.

45{};

◆ setMagneticFieldValues()

void setMagneticFieldValues ( double  x,
double  y,
double  z,
double  rmax,
double  zmin,
double  zmax 
)

Sets the values for the homogeneous magnetic field vector.

Parameters
xThe x component of the magnetic field vector.
yThe y component of the magnetic field vector.
zThe z component of the magnetic field vector.
rmaxMaximum radial coordinate.
zminMinimum z coordinate.
zmaxMaximum z coordinate.

Definition at line 22 of file BFieldComponentConstant.cc.

23{
24 m_magneticField[0] = x;
25 m_magneticField[1] = y;
26 m_magneticField[2] = z;
27 maxRadius4BField = rmax; // unit [cm]
28 minZ4BField = zmin; // unit [cm]
29 maxZ4BField = zmax; // unit [cm]
30}

◆ terminate()

virtual void terminate ( )
inlinevirtualinherited

Terminates the magnetic field component.

This method should be used to close files that have been opened in the initialize() method.

Reimplemented in BFieldComponent3d, BFieldComponentBeamline, BFieldComponentKlm1, and BFieldComponentRadial.

Definition at line 66 of file BFieldComponentAbs.h.

66{};

Member Data Documentation

◆ m_magneticField

double m_magneticField[3] {0}
private

The values for the homogeneous magnetic field vector.

Definition at line 55 of file BFieldComponentConstant.h.

◆ maxRadius4BField

double maxRadius4BField {0}
private

The values for the maximum radius for the homogeneous field.

Definition at line 57 of file BFieldComponentConstant.h.

◆ maxZ4BField

double maxZ4BField {0}
private

The values for the maximum z position for the homogeneous field.

Definition at line 61 of file BFieldComponentConstant.h.

◆ minZ4BField

double minZ4BField {0}
private

The values for the minimum z position for the homogeneous field.

Definition at line 59 of file BFieldComponentConstant.h.


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