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

#include <G4QuadrupoleMagField.hh>

+ Inheritance diagram for G4QuadrupoleMagField:

Public Member Functions

 G4QuadrupoleMagField (G4double pGradient)
 
 G4QuadrupoleMagField (G4double pGradient, const G4ThreeVector &pOrigin, G4RotationMatrix *pMatrix)
 
 ~G4QuadrupoleMagField () override
 
void GetFieldValue (const G4double yTrack[], G4double B[]) const override
 
G4FieldClone () const override
 
- Public Member Functions inherited from G4MagneticField
 G4MagneticField ()
 
 ~G4MagneticField () override
 
 G4MagneticField (const G4MagneticField &r)
 
G4MagneticFieldoperator= (const G4MagneticField &p)
 
G4bool DoesFieldChangeEnergy () const override
 
void GetFieldValue (const G4double Point[4], G4double *Bfield) const override=0
 
- Public Member Functions inherited from G4Field
 G4Field (G4bool gravityOn=false)
 
 G4Field (const G4Field &)
 
virtual ~G4Field ()
 
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

Definition at line 48 of file G4QuadrupoleMagField.hh.

Constructor & Destructor Documentation

◆ G4QuadrupoleMagField() [1/2]

G4QuadrupoleMagField::G4QuadrupoleMagField ( G4double pGradient)

Definition at line 40 of file G4QuadrupoleMagField.cc.

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

Referenced by Clone().

◆ G4QuadrupoleMagField() [2/2]

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

Definition at line 48 of file G4QuadrupoleMagField.cc.

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

◆ ~G4QuadrupoleMagField()

G4QuadrupoleMagField::~G4QuadrupoleMagField ( )
overridedefault

Member Function Documentation

◆ Clone()

G4Field * G4QuadrupoleMagField::Clone ( ) const
overridevirtual

Reimplemented from G4Field.

Definition at line 59 of file G4QuadrupoleMagField.cc.

60{
61 return new G4QuadrupoleMagField(fGradient, fOrigin, fpMatrix);
62}
G4QuadrupoleMagField(G4double pGradient)

◆ GetFieldValue()

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

Definition at line 70 of file G4QuadrupoleMagField.cc.

72{
73 // with displaced origin and rotation
74
75 G4ThreeVector r_global = G4ThreeVector(y[0] - fOrigin.x(),
76 y[1] - fOrigin.y(),
77 y[2] - fOrigin.z());
78
79 const G4ThreeVector r_local = (*fpMatrix) * r_global;
80 const G4ThreeVector B_local( fGradient * r_local.y(),
81 fGradient * r_local.x(), 0);
82 const G4ThreeVector B_global = fpMatrix->inverse() * B_local;
83
84 B[0] = B_global.x();
85 B[1] = B_global.y();
86 B[2] = B_global.z();
87}
G4double B(G4double temperature)
CLHEP::Hep3Vector G4ThreeVector
double z() const
double x() const
double y() const
HepRotation inverse() const

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