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

#include <G4TUniformMagneticField.hh>

+ Inheritance diagram for G4TUniformMagneticField:

Public Member Functions

 G4TUniformMagneticField (const G4ThreeVector &FieldVector)
 
 G4TUniformMagneticField (G4double vField, G4double vTheta, G4double vPhi)
 
virtual ~G4TUniformMagneticField ()
 
 G4TUniformMagneticField (const G4TUniformMagneticField &p)
 
G4TUniformMagneticFieldoperator= (const G4TUniformMagneticField &p)
 
void GetFieldValue (const G4double yTrack[4], G4double *B) const
 
void SetFieldValue (const G4ThreeVector &newFieldVector)
 
G4ThreeVector GetConstantFieldValue () const
 
virtual G4TUniformMagneticFieldClone () 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 G4Field
 G4Field (G4bool gravityOn=false)
 
 G4Field (const G4Field &)
 
virtual ~G4Field ()
 
G4Fieldoperator= (const G4Field &p)
 
virtual void GetFieldValue (const G4double Point[4], G4double *fieldArr) const =0
 
virtual G4bool DoesFieldChangeEnergy () const =0
 
G4bool IsGravityActive () const
 
void SetGravityActive (G4bool OnOffFlag)
 
virtual G4FieldClone () const
 

Additional Inherited Members

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

Detailed Description

Definition at line 34 of file G4TUniformMagneticField.hh.

Constructor & Destructor Documentation

◆ G4TUniformMagneticField() [1/3]

G4TUniformMagneticField::G4TUniformMagneticField ( const G4ThreeVector FieldVector)
inline

Definition at line 38 of file G4TUniformMagneticField.hh.

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

◆ G4TUniformMagneticField() [2/3]

G4TUniformMagneticField::G4TUniformMagneticField ( G4double  vField,
G4double  vTheta,
G4double  vPhi 
)
inline

Definition at line 47 of file G4TUniformMagneticField.hh.

50 {
51 if ( (vField<0) || (vTheta<0) || (vTheta>pi) || (vPhi<0) || (vPhi>twopi) )
52 {
53 G4Exception("G4TUniformMagneticField::G4TUniformMagneticField()",
54 "GeomField0002", FatalException, "Invalid parameters.") ;
55 }
56 fFieldComponents[0] = vField*std::sin(vTheta)*std::cos(vPhi) ;
57 fFieldComponents[1] = vField*std::sin(vTheta)*std::sin(vPhi) ;
58 fFieldComponents[2] = vField*std::cos(vTheta) ;
59 }
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:59

◆ ~G4TUniformMagneticField()

virtual G4TUniformMagneticField::~G4TUniformMagneticField ( )
inlinevirtual

Definition at line 61 of file G4TUniformMagneticField.hh.

61{;}

◆ G4TUniformMagneticField() [3/3]

G4TUniformMagneticField::G4TUniformMagneticField ( const G4TUniformMagneticField p)
inline

Definition at line 63 of file G4TUniformMagneticField.hh.

65 {
66 for (G4int i=0; i<3; ++i)
67 fFieldComponents[i] = p.fFieldComponents[i];
68 }
int G4int
Definition: G4Types.hh:85

Member Function Documentation

◆ Clone()

virtual G4TUniformMagneticField * G4TUniformMagneticField::Clone ( ) const
inlinevirtual

Reimplemented from G4Field.

Definition at line 103 of file G4TUniformMagneticField.hh.

104 {
105 return new G4TUniformMagneticField( G4ThreeVector(this->fFieldComponents[0],
106 this->fFieldComponents[1],
107 this->fFieldComponents[2]) );
108 }
CLHEP::Hep3Vector G4ThreeVector

◆ GetConstantFieldValue()

G4ThreeVector G4TUniformMagneticField::GetConstantFieldValue ( ) const
inline

Definition at line 94 of file G4TUniformMagneticField.hh.

95 {
96 G4ThreeVector B(fFieldComponents[0],
97 fFieldComponents[1],
98 fFieldComponents[2]);
99 return B;
100 }
G4double B(G4double temperature)

◆ GetFieldValue()

void G4TUniformMagneticField::GetFieldValue ( const G4double  yTrack[4],
G4double B 
) const
inlinevirtual

Implements G4MagneticField.

Definition at line 79 of file G4TUniformMagneticField.hh.

81 {
82 B[0]= fFieldComponents[0] ;
83 B[1]= fFieldComponents[1] ;
84 B[2]= fFieldComponents[2] ;
85 }

◆ operator=()

G4TUniformMagneticField & G4TUniformMagneticField::operator= ( const G4TUniformMagneticField p)
inline

Definition at line 70 of file G4TUniformMagneticField.hh.

72 {
73 if (&p == this) return *this;
74 for (G4int i=0; i<3; ++i)
75 fFieldComponents[i] = p.fFieldComponents[i];
76 return *this;
77 }

◆ SetFieldValue()

void G4TUniformMagneticField::SetFieldValue ( const G4ThreeVector newFieldVector)
inline

Definition at line 87 of file G4TUniformMagneticField.hh.

88 {
89 fFieldComponents[0] = newFieldVector.x();
90 fFieldComponents[1] = newFieldVector.y();
91 fFieldComponents[2] = newFieldVector.z();
92 }

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