k4SimGeant4
Loading...
Searching...
No Matches
ConstantField.h
Go to the documentation of this file.
1#ifndef SIMG4COMMON_CONSTANTFIELD_H
2#define SIMG4COMMON_CONSTANTFIELD_H
3
4// Geant 4
5#include "G4MagneticField.hh"
6
14namespace sim {
15class ConstantField : public G4MagneticField {
16public:
20 explicit ConstantField(double bX, double bY, double bZ, double rMax, double zMax);
21 // Destructor
22 virtual ~ConstantField() {}
23
27 virtual void GetFieldValue(const G4double point[4], double* bField) const final;
28
30 void setBx(double value) { m_bX = value; }
32 void setBy(double value) { m_bY = value; }
34 void setBz(double value) { m_bZ = value; }
35
37 void setMaxR(double value) { m_rMax = value; }
39 void setMaxZ(double value) { m_zMax = value; }
40
41private:
43 double m_bX;
45 double m_bY;
47 double m_bZ;
48
50 double m_rMax;
52 double m_zMax;
53};
54}
55#endif /* SIMG4COMMON_CONSTANTFIELD_H */
Constant magnetic field inside the cylinder.
Definition ConstantField.h:15
void setMaxZ(double value)
Set the extend of the field in longitudinal direction.
Definition ConstantField.h:39
virtual void GetFieldValue(const G4double point[4], double *bField) const final
Get the value of the magnetic field value at position.
Definition ConstantField.cpp:12
ConstantField()
Default constructor.
Definition ConstantField.cpp:7
void setBz(double value)
Set the z component of the field.
Definition ConstantField.h:34
virtual ~ConstantField()
Definition ConstantField.h:22
void setBy(double value)
Set the y component of the field.
Definition ConstantField.h:32
void setBx(double value)
Set the x component of the field.
Definition ConstantField.h:30
double m_bY
Field component in y.
Definition ConstantField.h:45
double m_rMax
Extend of the field in radial direction.
Definition ConstantField.h:50
double m_zMax
Extend of the field in longitudinal direction.
Definition ConstantField.h:52
void setMaxR(double value)
Set the extend of the field in radial direction.
Definition ConstantField.h:37
double m_bZ
Field component in Z.
Definition ConstantField.h:47
double m_bX
Field component in x.
Definition ConstantField.h:43
Conversion between units.
Definition ConstantField.h:14