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

#include <G4UniformMagField.hh>

+ Inheritance diagram for G4UniformMagField:

Public Member Functions

 G4UniformMagField (const G4ThreeVector &FieldVector)
 
 G4UniformMagField (G4double vField, G4double vTheta, G4double vPhi)
 
virtual ~G4UniformMagField ()
 
 G4UniformMagField (const G4UniformMagField &p)
 
G4UniformMagFieldoperator= (const G4UniformMagField &p)
 
virtual void GetFieldValue (const G4double yTrack[4], G4double *MagField) const
 
void SetFieldValue (const G4ThreeVector &newFieldValue)
 
G4ThreeVector GetConstantFieldValue () const
 
- Public Member Functions inherited from G4MagneticField
 G4MagneticField ()
 
virtual ~G4MagneticField ()
 
 G4MagneticField (const G4MagneticField &r)
 
G4MagneticFieldoperator= (const G4MagneticField &p)
 
G4bool DoesFieldChangeEnergy () const
 
virtual void GetFieldValue (const G4double Point[4], G4double *Bfield) const =0
 
- Public Member Functions inherited from G4ElectroMagneticField
 G4ElectroMagneticField ()
 
virtual ~G4ElectroMagneticField ()
 
 G4ElectroMagneticField (const G4ElectroMagneticField &r)
 
G4ElectroMagneticFieldoperator= (const G4ElectroMagneticField &p)
 
virtual void GetFieldValue (const G4double Point[4], G4double *Bfield) const =0
 
virtual G4bool DoesFieldChangeEnergy () const =0
 
- Public Member Functions inherited from G4Field
virtual void GetFieldValue (const double Point[4], double *fieldArr) const =0
 
 G4Field (G4bool gravityOn=false)
 
 G4Field (const G4Field &)
 
virtual ~G4Field ()
 
G4Fieldoperator= (const G4Field &p)
 
virtual G4bool DoesFieldChangeEnergy () const =0
 
G4bool IsGravityActive () const
 
void SetGravityActive (G4bool OnOffFlag)
 

Detailed Description

Definition at line 49 of file G4UniformMagField.hh.

Constructor & Destructor Documentation

◆ G4UniformMagField() [1/3]

G4UniformMagField::G4UniformMagField ( const G4ThreeVector FieldVector)

Definition at line 39 of file G4UniformMagField.cc.

40{
41 fFieldComponents[0] = FieldVector.x();
42 fFieldComponents[1] = FieldVector.y();
43 fFieldComponents[2] = FieldVector.z();
44}
double z() const
double x() const
double y() const

◆ G4UniformMagField() [2/3]

G4UniformMagField::G4UniformMagField ( G4double  vField,
G4double  vTheta,
G4double  vPhi 
)

Definition at line 54 of file G4UniformMagField.cc.

57{
58 if ( (vField<0) || (vTheta<0) || (vTheta>pi) || (vPhi<0) || (vPhi>twopi) )
59 {
60 G4Exception("G4UniformMagField::G4UniformMagField()",
61 "GeomField0002", FatalException, "Invalid parameters.") ;
62 }
63 fFieldComponents[0] = vField*std::sin(vTheta)*std::cos(vPhi) ;
64 fFieldComponents[1] = vField*std::sin(vTheta)*std::sin(vPhi) ;
65 fFieldComponents[2] = vField*std::cos(vTheta) ;
66}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41

◆ ~G4UniformMagField()

G4UniformMagField::~G4UniformMagField ( )
virtual

Definition at line 68 of file G4UniformMagField.cc.

69{
70}

◆ G4UniformMagField() [3/3]

G4UniformMagField::G4UniformMagField ( const G4UniformMagField p)

Definition at line 72 of file G4UniformMagField.cc.

74{
75 for (G4int i=0; i<3; i++)
76 fFieldComponents[i] = p.fFieldComponents[i];
77}
int G4int
Definition: G4Types.hh:66

Member Function Documentation

◆ GetConstantFieldValue()

G4ThreeVector G4UniformMagField::GetConstantFieldValue ( ) const

Definition at line 97 of file G4UniformMagField.cc.

98{
99 G4ThreeVector B(fFieldComponents[0],
100 fFieldComponents[1],
101 fFieldComponents[2]);
102 return B;
103}

◆ GetFieldValue()

void G4UniformMagField::GetFieldValue ( const G4double  yTrack[4],
G4double MagField 
) const
virtual

Implements G4MagneticField.

Definition at line 89 of file G4UniformMagField.cc.

91{
92 B[0]= fFieldComponents[0] ;
93 B[1]= fFieldComponents[1] ;
94 B[2]= fFieldComponents[2] ;
95}

◆ operator=()

G4UniformMagField & G4UniformMagField::operator= ( const G4UniformMagField p)

Definition at line 79 of file G4UniformMagField.cc.

80{
81 if (&p == this) return *this;
82 for (G4int i=0; i<3; i++)
83 fFieldComponents[i] = p.fFieldComponents[i];
84 return *this;
85}

◆ SetFieldValue()

void G4UniformMagField::SetFieldValue ( const G4ThreeVector newFieldValue)

Definition at line 47 of file G4UniformMagField.cc.

48{
49 fFieldComponents[0] = newFieldVector.x();
50 fFieldComponents[1] = newFieldVector.y();
51 fFieldComponents[2] = newFieldVector.z();
52}

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