Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4UniformMagField Class Reference

#include <G4UniformMagField.hh>

Inheritance diagram for G4UniformMagField:
Collaboration 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
 
virtual G4FieldClone () const
 
- Public Member Functions inherited from G4MagneticField
 G4MagneticField ()
 
virtual ~G4MagneticField ()
 
 G4MagneticField (const G4MagneticField &r)
 
G4MagneticFieldoperator= (const G4MagneticField &p)
 
G4bool DoesFieldChangeEnergy () const
 
- Public Member Functions inherited from G4ElectroMagneticField
 G4ElectroMagneticField ()
 
virtual ~G4ElectroMagneticField ()
 
 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)
 

Detailed Description

Definition at line 49 of file G4UniformMagField.hh.

Constructor & Destructor Documentation

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 x() const
double z() const
double y() const

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 61 of file G4UniformMagField.cc.

64 {
65  if ( (vField<0) || (vTheta<0) || (vTheta>pi) || (vPhi<0) || (vPhi>twopi) )
66  {
67  std::ostringstream msg;
68  msg << "ERROR in G4UniformMagField::G4UniformMagField(double, double, double) : "
69  << "Invalid parameter(s). " << std::endl;
70  msg << " Expected " << std::endl;
71 
72  msg << " - Magnitude vField: Value = " << vField
73  << " Expected vField > 0 " ;
74  if ( vField<0) { msg << " <------ Erroneous "; }
75  msg << std::endl;
76 
77  msg << " - Theta angle: Value = " << vTheta
78  << " Expected between 0 <= theta <= pi = " << pi << " ";
79  if ( (vTheta<0) || (vTheta>pi) ) { msg << " <------ Erroneous "; }
80 
81  msg << std::endl;
82  msg << " - Phi angle: Value = " << vPhi
83  << " Expected between 0 <= phi <= 2*pi = " << twopi << std::endl;
84  if ( (vPhi<0) || (vPhi>twopi) ) { msg << " <------ Erroneous "; }
85 
86  G4Exception("G4UniformMagField::G4UniformMagField()",
87  "GeomField0002", FatalException, msg ); // "Invalid parameters.") ;
88  }
89  fFieldComponents[0] = vField*std::sin(vTheta)*std::cos(vPhi) ;
90  fFieldComponents[1] = vField*std::sin(vTheta)*std::sin(vPhi) ;
91  fFieldComponents[2] = vField*std::cos(vTheta) ;
92 }
static constexpr double twopi
Definition: G4SIunits.hh:76
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
static constexpr double pi
Definition: G4SIunits.hh:75

Here is the call graph for this function:

G4UniformMagField::~G4UniformMagField ( )
virtual

Definition at line 94 of file G4UniformMagField.cc.

95 {
96 }
G4UniformMagField::G4UniformMagField ( const G4UniformMagField p)

Definition at line 98 of file G4UniformMagField.cc.

99  : G4MagneticField(p)
100 {
101  for (G4int i=0; i<3; i++)
102  {
103  fFieldComponents[i] = p.fFieldComponents[i];
104  }
105 }
int G4int
Definition: G4Types.hh:78

Member Function Documentation

G4Field * G4UniformMagField::Clone ( ) const
virtual

Reimplemented from G4Field.

Definition at line 46 of file G4UniformMagField.cc.

47 {
48  return new G4UniformMagField( G4ThreeVector(fFieldComponents[0],
49  fFieldComponents[1],
50  fFieldComponents[2]) );
51 }
CLHEP::Hep3Vector G4ThreeVector
G4UniformMagField(const G4ThreeVector &FieldVector)

Here is the call graph for this function:

G4ThreeVector G4UniformMagField::GetConstantFieldValue ( ) const

Definition at line 128 of file G4UniformMagField.cc.

129 {
130  G4ThreeVector B(fFieldComponents[0],
131  fFieldComponents[1],
132  fFieldComponents[2]);
133  return B;
134 }
double B(double temperature)

Here is the call graph for this function:

Here is the caller graph for this function:

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

Implements G4MagneticField.

Definition at line 120 of file G4UniformMagField.cc.

122 {
123  B[0]= fFieldComponents[0] ;
124  B[1]= fFieldComponents[1] ;
125  B[2]= fFieldComponents[2] ;
126 }
double B(double temperature)
G4UniformMagField & G4UniformMagField::operator= ( const G4UniformMagField p)

Definition at line 107 of file G4UniformMagField.cc.

108 {
109  if (&p == this) return *this;
111  for (G4int i=0; i<3; i++)
112  {
113  fFieldComponents[i] = p.fFieldComponents[i];
114  }
115  return *this;
116 }
int G4int
Definition: G4Types.hh:78
G4MagneticField & operator=(const G4MagneticField &p)

Here is the call graph for this function:

void G4UniformMagField::SetFieldValue ( const G4ThreeVector newFieldValue)

Definition at line 54 of file G4UniformMagField.cc.

55 {
56  fFieldComponents[0] = newFieldVector.x();
57  fFieldComponents[1] = newFieldVector.y();
58  fFieldComponents[2] = newFieldVector.z();
59 }

Here is the call graph for this function:

Here is the caller graph for this function:


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