Belle II Software development
MagneticField Class Reference

The Class for the Belle2 magnetic field implementation for Geant4. More...

#include <MagneticField.h>

Inheritance diagram for MagneticField:

Public Member Functions

 MagneticField ()
 Constructor.
 
 ~MagneticField ()
 Destructor.
 
void GetFieldValue (const G4double Point[3], G4double *Bfield) const
 Sets the magnetic field vector for a specified space point.
 

Detailed Description

The Class for the Belle2 magnetic field implementation for Geant4.

The Geant4 simulation uses the central magnetic field map implementation of the basf2 framework to return the magnetic field vector for a space point.

Definition at line 28 of file MagneticField.h.

Constructor & Destructor Documentation

◆ MagneticField()

Constructor.

Definition at line 25 of file MagneticField.cc.

25 : G4MagneticField()
26 {
27 }

◆ ~MagneticField()

Destructor.

Definition at line 29 of file MagneticField.cc.

30 {
31 }

Member Function Documentation

◆ GetFieldValue()

void GetFieldValue ( const G4double  Point[3],
G4double *  Bfield 
) const

Sets the magnetic field vector for a specified space point.

Parameters
PointAn array specifying the space point (x,y,z) in [mm].
BfieldReturns the magnetic field vector in tesla.

Definition at line 33 of file MagneticField.cc.

34 {
35 static const double pos_conversion{Unit::mm / CLHEP::mm};
36 static const double mag_conversion{CLHEP::tesla / Unit::T};
37 //Get the magnetic field vector from the central magnetic field map (Geant4 uses [mm] as a length unit)
38 const ROOT::Math::XYZVector point = ROOT::Math::XYZVector(Point[0], Point[1], Point[2]) * pos_conversion;
39 // get the field in Geant4 units
40 ROOT::Math::XYZVector magField = BFieldManager::getField(point) * mag_conversion;
41 // and set it
42 magField.GetCoordinates(Bfield);
43 }
static const double mm
[millimeters]
Definition: Unit.h:70
static const double T
[tesla]
Definition: Unit.h:120
static void getField(const double *pos, double *field)
return the magnetic field at a given position.
Definition: BFieldManager.h:91

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