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

#include <G4UniformElectricField.hh>

+ Inheritance diagram for G4UniformElectricField:

Public Member Functions

 G4UniformElectricField (const G4ThreeVector &FieldVector)
 
 G4UniformElectricField (G4double vField, G4double vTheta, G4double vPhi)
 
virtual ~G4UniformElectricField ()
 
 G4UniformElectricField (const G4UniformElectricField &p)
 
G4UniformElectricFieldoperator= (const G4UniformElectricField &p)
 
virtual void GetFieldValue (const G4double pos[4], G4double *field) const
 
virtual G4FieldClone () const
 
- Public Member Functions inherited from G4ElectricField
 G4ElectricField ()
 
virtual ~G4ElectricField ()
 
 G4ElectricField (const G4ElectricField &r)
 
G4ElectricFieldoperator= (const G4ElectricField &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
 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 41 of file G4UniformElectricField.hh.

Constructor & Destructor Documentation

◆ G4UniformElectricField() [1/3]

G4UniformElectricField::G4UniformElectricField ( const G4ThreeVector FieldVector)

Definition at line 34 of file G4UniformElectricField.cc.

36{
37 fFieldComponents[0] = 0.0;
38 fFieldComponents[1] = 0.0;
39 fFieldComponents[2] = 0.0;
40 fFieldComponents[3] = FieldVector.x();
41 fFieldComponents[4] = FieldVector.y();
42 fFieldComponents[5] = FieldVector.z();
43}
double z() const
double x() const
double y() const

◆ G4UniformElectricField() [2/3]

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

Definition at line 45 of file G4UniformElectricField.cc.

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

◆ ~G4UniformElectricField()

G4UniformElectricField::~G4UniformElectricField ( )
virtual

Definition at line 63 of file G4UniformElectricField.cc.

64{
65}

◆ G4UniformElectricField() [3/3]

G4UniformElectricField::G4UniformElectricField ( const G4UniformElectricField p)

Definition at line 67 of file G4UniformElectricField.cc.

70{
71 for (auto i=0; i<6; ++i)
72 {
73 fFieldComponents[i] = p.fFieldComponents[i];
74 }
75}

Member Function Documentation

◆ Clone()

G4Field * G4UniformElectricField::Clone ( ) const
virtual

Reimplemented from G4Field.

Definition at line 89 of file G4UniformElectricField.cc.

90{
91 return new G4UniformElectricField( G4ThreeVector(fFieldComponents[3],
92 fFieldComponents[4],
93 fFieldComponents[5]));
94}
CLHEP::Hep3Vector G4ThreeVector

◆ GetFieldValue()

void G4UniformElectricField::GetFieldValue ( const G4double  pos[4],
G4double field 
) const
virtual

Implements G4ElectricField.

Definition at line 98 of file G4UniformElectricField.cc.

100{
101 fieldBandE[0] = 0.0;
102 fieldBandE[1] = 0.0;
103 fieldBandE[2] = 0.0;
104 fieldBandE[3] = fFieldComponents[3];
105 fieldBandE[4] = fFieldComponents[4];
106 fieldBandE[5] = fFieldComponents[5];
107}

◆ operator=()

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

Definition at line 78 of file G4UniformElectricField.cc.

79{
80 if (&p == this) return *this;
82 for (auto i=0; i<6; ++i)
83 {
84 fFieldComponents[i] = p.fFieldComponents[i];
85 }
86 return *this;
87}
G4ElectricField & operator=(const G4ElectricField &p)

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