BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
|
Interface for static magnetic fields that may or may not be local. More...
#include <BDSFieldMag.hh>
Public Member Functions | |
BDSFieldMag () | |
BDSFieldMag (G4Transform3D transformIn) | |
virtual G4ThreeVector | GetField (const G4ThreeVector &position, const G4double t=0) const =0 |
virtual G4bool | TimeVarying () const |
virtual void | GetFieldValue (const G4double point[4], G4double *field) const |
virtual G4ThreeVector | GetFieldTransformed (const G4ThreeVector &position, const G4double t) const |
Get the field value after applying transform for local offset. | |
virtual void | SetTransform (const G4Transform3D &transformIn) |
void | SetModulator (BDSModulator *modulatorIn) |
Set the optional modulator. | |
G4bool | FiniteStrength () const |
Accessor. | |
Protected Attributes | |
G4bool | finiteStrength |
Flag to cache whether finite nor not. | |
G4Transform3D | transform |
Transform to apply for the field relative to the local coordinates of the geometry. | |
G4bool | transformIsNotIdentity |
Cache of whether to use transform at all. | |
BDSModulator * | modulator |
Optional modulator;. | |
Private Attributes | |
G4Transform3D | inverseTransform |
The complimentary transform used to initially rotate the point of query. | |
Interface for static magnetic fields that may or may not be local.
Defines abstract interface for all derived magnetic fields. More common to use G4ThreeVectors than arrays so provides common functionality.
Definition at line 38 of file BDSFieldMag.hh.
BDSFieldMag::BDSFieldMag | ( | ) |
Constructor takes transform in, which is inverted and applied to positions before querying the 'pure' derived field object. This allows local offset, translations, reflections and scalings to be applied if required - ie for misalignment from the local coordinates.
Definition at line 28 of file BDSFieldMag.cc.
|
explicit |
Definition at line 36 of file BDSFieldMag.cc.
|
inlinevirtual |
Definition at line 47 of file BDSFieldMag.hh.
|
inline |
Accessor.
Definition at line 80 of file BDSFieldMag.hh.
References finiteStrength.
Referenced by BDSFieldMagSkew::BDSFieldMagSkew().
|
pure virtual |
Get the magnetic field vector in local coordinates. The derived class does not need to apply the transform.
Implemented in BDSFieldMagZero, BDSFieldMagInterpolated4D, BDSFieldMagDecapole, BDSFieldMagDetectorSolenoid, BDSFieldMagDipole, BDSFieldMagDipoleQuadrupole, BDSFieldMagGlobal, BDSFieldMagGlobalPlacement, BDSFieldMagInterpolated1D, BDSFieldMagInterpolated2D, BDSFieldMagInterpolated2Layer, BDSFieldMagInterpolated3D, BDSFieldMagMultipole, BDSFieldMagMuonSpoiler, BDSFieldMagOctupole, BDSFieldMagQuadrupole, BDSFieldMagSextupole, BDSFieldMagSkew, BDSFieldMagSolenoidSheet, and BDSFieldMagUndulator.
Referenced by BDSFieldMagGradient::GetBy(), BDSFieldMagSkew::GetField(), and GetFieldTransformed().
|
virtual |
Get the field value after applying transform for local offset.
Reimplemented in BDSFieldMagGlobal, and BDSFieldMagGlobalPlacement.
Definition at line 44 of file BDSFieldMag.cc.
References BDSModulator::Factor(), finiteStrength, GetField(), inverseTransform, modulator, transform, and transformIsNotIdentity.
Referenced by BDSFieldMagDipoleQuadrupole::GetField(), BDSFieldMagGlobal::GetField(), BDSFieldMagGlobalPlacement::GetField(), BDSFieldMagInterpolated2Layer::GetField(), and GetFieldValue().
|
virtual |
Implement interface to this class's GetField to fulfill G4MagneticField inheritance and allow a BDSFieldMag instance to be passed around in the field factory even if it's not wrapped in a BDSFieldGlobal instance and is in fact in local coordinates. This uses GetFieldTransformed.
Definition at line 73 of file BDSFieldMag.cc.
References GetFieldTransformed().
|
inline |
Set the optional modulator.
Definition at line 77 of file BDSFieldMag.hh.
References modulator.
Referenced by BDSFieldFactory::CreateFieldMagRaw().
|
virtual |
Set the transform applied before evaluating the field. This can be used to account for any difference between the field coordinate system and the coordinate system of the geometry. Ie an offset aperture. This is a public interface to allow the transform to be set after construction so that derived classes don't need modified constructors.
Reimplemented in BDSFieldMagDipoleQuadrupole.
Definition at line 88 of file BDSFieldMag.cc.
References inverseTransform, transform, and transformIsNotIdentity.
Referenced by BDSFieldFactory::CreateFieldMagRaw(), and BDSFieldMagDipoleQuadrupole::SetTransform().
|
inlinevirtual |
Each derived class should override this if needs be. Used to warn about time modulation with a time-varying field.
Reimplemented in BDSFieldMagInterpolated, and BDSFieldMagInterpolated2Layer.
Definition at line 56 of file BDSFieldMag.hh.
Referenced by BDSFieldFactory::CreateFieldMagRaw().
|
protected |
Flag to cache whether finite nor not.
Definition at line 83 of file BDSFieldMag.hh.
Referenced by BDSFieldMagDipole::BDSFieldMagDipole(), BDSFieldMagSkew::BDSFieldMagSkew(), BDSFieldMagSolenoidSheet::BDSFieldMagSolenoidSheet(), FiniteStrength(), BDSFieldMagDipoleOuter::GetField(), BDSFieldMagDipoleOuterOld::GetField(), GetFieldTransformed(), BDSFieldMagGlobal::GetFieldTransformed(), and BDSFieldMagGlobalPlacement::GetFieldTransformed().
|
private |
The complimentary transform used to initially rotate the point of query.
Definition at line 93 of file BDSFieldMag.hh.
Referenced by GetFieldTransformed(), and SetTransform().
|
protected |
Optional modulator;.
Definition at line 89 of file BDSFieldMag.hh.
Referenced by GetFieldTransformed(), and SetModulator().
|
protected |
Transform to apply for the field relative to the local coordinates of the geometry.
Definition at line 86 of file BDSFieldMag.hh.
Referenced by BDSFieldMagInterpolated::Extent(), GetFieldTransformed(), and SetTransform().
|
protected |
Cache of whether to use transform at all.
Definition at line 88 of file BDSFieldMag.hh.
Referenced by GetFieldTransformed(), and SetTransform().