Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4SextupoleMagField Class Reference

G4SextupoleMagField is a class for defining a sextupole magnetic field. More...

#include <G4SextupoleMagField.hh>

Inheritance diagram for G4SextupoleMagField:

Public Member Functions

 G4SextupoleMagField (G4double pGradient)
 G4SextupoleMagField (G4double pGradient, const G4ThreeVector &pOrigin, G4RotationMatrix *pMatrix)
 ~G4SextupoleMagField () override=default
void GetFieldValue (const G4double yTrack[], G4double B[]) const override
G4FieldClone () const override
Public Member Functions inherited from G4MagneticField
 G4MagneticField ()
 ~G4MagneticField () override=default
 G4MagneticField (const G4MagneticField &r)
G4MagneticFieldoperator= (const G4MagneticField &p)
G4bool DoesFieldChangeEnergy () const override
void GetFieldValue (const G4double Point[4], G4double *Bfield) const override=0
G4FieldType GetFieldType () const override
Public Member Functions inherited from G4Field
 G4Field (G4bool gravityOn=false)
virtual ~G4Field ()=default
 G4Field (const G4Field &p)=default
G4Fieldoperator= (const G4Field &p)
G4bool IsGravityActive () const
void SetGravityActive (G4bool OnOffFlag)

Additional Inherited Members

Static Public Attributes inherited from G4Field
static constexpr G4int MAX_NUMBER_OF_COMPONENTS = 24

Detailed Description

G4SextupoleMagField is a class for defining a sextupole magnetic field.

Definition at line 49 of file G4SextupoleMagField.hh.

Constructor & Destructor Documentation

◆ G4SextupoleMagField() [1/2]

G4SextupoleMagField::G4SextupoleMagField ( G4double pGradient)

Constructor for G4SextupoleMagField.

Parameters
[in]pGradientField gradient value.

Definition at line 41 of file G4SextupoleMagField.cc.

42{
43 fGradient = pGradient;
44 fpMatrix = &IdentityMatrix;
45}

Referenced by Clone().

◆ G4SextupoleMagField() [2/2]

G4SextupoleMagField::G4SextupoleMagField ( G4double pGradient,
const G4ThreeVector & pOrigin,
G4RotationMatrix * pMatrix )

Constructor for G4QuadrupoleMagField.

Parameters
[in]pGradientField gradient value.
[in]pOriginOrigin position.
[in]pMatrixRotation matrix.

Definition at line 47 of file G4SextupoleMagField.cc.

50{
51 fGradient = pGradient ;
52 fOrigin = pOrigin ;
53 fpMatrix = pMatrix ;
54}

◆ ~G4SextupoleMagField()

G4SextupoleMagField::~G4SextupoleMagField ( )
overridedefault

Default Destructor.

Member Function Documentation

◆ Clone()

G4Field * G4SextupoleMagField::Clone ( ) const
overridevirtual

Returns a pointer to a new allocated clone of this object.

Reimplemented from G4Field.

Definition at line 56 of file G4SextupoleMagField.cc.

57{
58 return new G4SextupoleMagField(fGradient, fOrigin, fpMatrix);
59}
G4SextupoleMagField(G4double pGradient)

◆ GetFieldValue()

void G4SextupoleMagField::GetFieldValue ( const G4double yTrack[],
G4double B[] ) const
override

Returns the field value on the given position 'yTrack'.

Parameters
[in]yTrackTime position array.
[out]BThe returned field array.

Definition at line 63 of file G4SextupoleMagField.cc.

66{
68 y[0] - fOrigin.x(),
69 y[1] - fOrigin.y(),
70 y[2] - fOrigin.z());
71
72 const G4ThreeVector r_local = (*fpMatrix) * r_global;
73 const G4ThreeVector B_local( fGradient * r_local.x() * r_local.y(),fGradient * ( std::pow(r_local.x(),2) - std::pow(r_local.y(),2) )/2 ,0);
74 const G4ThreeVector B_global = fpMatrix->inverse() * B_local;
75
76 B[0] = B_global.x() ;
77 B[1] = B_global.y() ;
78 B[2] = B_global.z() ;
79}
G4double B(G4double temperature)
CLHEP::Hep3Vector G4ThreeVector
double z() const
double x() const
double y() const

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