Geant4 11.2.2
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)
 
 ~G4UniformElectricField () override
 
 G4UniformElectricField (const G4UniformElectricField &p)
 
G4UniformElectricFieldoperator= (const G4UniformElectricField &p)
 
void GetFieldValue (const G4double pos[4], G4double *field) const override
 
G4FieldClone () const override
 
- Public Member Functions inherited from G4ElectricField
 G4ElectricField ()
 
 ~G4ElectricField () override
 
 G4ElectricField (const G4ElectricField &r)
 
G4ElectricFieldoperator= (const G4ElectricField &p)
 
G4bool DoesFieldChangeEnergy () const override
 
- Public Member Functions inherited from G4ElectroMagneticField
 G4ElectroMagneticField ()
 
 ~G4ElectroMagneticField () override
 
 G4ElectroMagneticField (const G4ElectroMagneticField &r)
 
G4ElectroMagneticFieldoperator= (const G4ElectroMagneticField &p)
 
- 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 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

Referenced by Clone().

◆ 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)

◆ ~G4UniformElectricField()

G4UniformElectricField::~G4UniformElectricField ( )
overridedefault

◆ G4UniformElectricField() [3/3]

G4UniformElectricField::G4UniformElectricField ( const G4UniformElectricField & p)

Definition at line 65 of file G4UniformElectricField.cc.

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

Member Function Documentation

◆ Clone()

G4Field * G4UniformElectricField::Clone ( ) const
overridevirtual

Reimplemented from G4Field.

Definition at line 87 of file G4UniformElectricField.cc.

88{
89 return new G4UniformElectricField( G4ThreeVector(fFieldComponents[3],
90 fFieldComponents[4],
91 fFieldComponents[5]));
92}
CLHEP::Hep3Vector G4ThreeVector
G4UniformElectricField(const G4ThreeVector &FieldVector)

◆ GetFieldValue()

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

Implements G4ElectricField.

Definition at line 96 of file G4UniformElectricField.cc.

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

◆ operator=()

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

Definition at line 76 of file G4UniformElectricField.cc.

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

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