1#ifndef PlasmaMLPALLASMagneticField_h
2#define PlasmaMLPALLASMagneticField_h 1
31#include "G4MagneticField.hh"
33#include <CLHEP/Units/SystemOfUnits.h>
59 void GetFieldValue(
const G4double point[4],
double *bField)
const override;
86 void SetQLength(
size_t index, G4double length);
100 void SetQDrift(
size_t index, G4double drift);
121 void DefineCommands();
127 static void InitializeFieldToZero(G4double *bField);
134 G4double CalculateConstantDipoleField(G4double posY, G4double posZ)
const;
141 static G4double CalculateFieldMapMode(G4double posY, G4double posZ);
148 static bool InQuadrupoleRange(G4double posX, G4double posZ);
157 void ApplyQuadrupoleContributions(G4double posY, G4double posX, G4double posZ, G4double *bField)
const;
163 G4double GetQuadrupoleBegin(
int index)
const;
165 G4double ConstantDipoleBField = 0.0 * CLHEP::tesla;
166 std::array<G4double, NumQuadrupoles> gradients = {};
167 std::array<G4double, NumQuadrupoles> qlength = {};
168 std::array<G4double, NumQuadrupoles> qdrift = {};
169 std::array<G4double, NumQuadrupoles> qbegin = {};
170 std::array<G4double, NumQuadrupoles> qend = {};
171 G4bool StatusMapBField =
false;
constexpr size_t NumQuadrupoles
< Units definitions (T, mm, etc.)
Definition PlasmaMLPALLASMagneticField.hh:36
G4double fitFunction(G4double *x, G4double *par)
Fit function for magnetic field profiles.
Definition PlasmaMLPALLASMagneticField.cc:67
G4double symmetrizedFunctionS(G4double *x, G4double *par)
Symmetrized fit function along the S-axis.
Definition PlasmaMLPALLASMagneticField.cc:118
G4double symmetrizedFunctionY(G4double *x, G4double *par)
Symmetrized fit function along the Y-axis.
Definition PlasmaMLPALLASMagneticField.cc:99
Defines the magnetic field model for the PALLAS simulation.
Definition PlasmaMLPALLASMagneticField.hh:46
void SetQLength(size_t index, G4double length)
Set the length of a quadrupole.
Definition PlasmaMLPALLASMagneticField.cc:308
void SetDipoleField(G4double val)
Set the constant dipole magnetic field value.
Definition PlasmaMLPALLASMagneticField.cc:258
void SetQDrift(size_t index, G4double drift)
Set the drift distance before a quadrupole.
Definition PlasmaMLPALLASMagneticField.cc:338
G4double GetQLength(size_t index) const
Get the length of a quadrupole.
Definition PlasmaMLPALLASMagneticField.cc:322
PlasmaMLPALLASMagneticField()
Constructor.
Definition PlasmaMLPALLASMagneticField.cc:47
void GetFieldValue(const G4double point[4], double *bField) const override
Compute the magnetic field at a given location.
Definition PlasmaMLPALLASMagneticField.cc:140
void SetMapBFieldStatus(G4bool val)
Enable or disable mapped magnetic field usage.
Definition PlasmaMLPALLASMagneticField.cc:268
G4double GetQDrift(size_t index) const
Get the drift distance before a quadrupole.
Definition PlasmaMLPALLASMagneticField.cc:352
void SetGradient(size_t index, G4double gradient)
Set the gradient of a quadrupole.
Definition PlasmaMLPALLASMagneticField.cc:278
~PlasmaMLPALLASMagneticField() override
Destructor.
Definition PlasmaMLPALLASMagneticField.cc:52
G4double GetGradient(size_t index) const
Get the gradient of a quadrupole.
Definition PlasmaMLPALLASMagneticField.cc:292