41 fFieldComponents[0] = FieldVector.
x();
42 fFieldComponents[1] = FieldVector.
y();
43 fFieldComponents[2] = FieldVector.
z();
50 fFieldComponents[2]) );
56 fFieldComponents[0] = newFieldVector.
x();
57 fFieldComponents[1] = newFieldVector.
y();
58 fFieldComponents[2] = newFieldVector.
z();
65 if ( (vField<0) || (vTheta<0) || (vTheta>
pi) || (vPhi<0) || (vPhi>
twopi) )
67 std::ostringstream msg;
68 msg <<
"ERROR in G4UniformMagField::G4UniformMagField(double, double, double) : "
69 <<
"Invalid parameter(s). " << std::endl;
70 msg <<
" Expected " << std::endl;
72 msg <<
" - Magnitude vField: Value = " << vField
73 <<
" Expected vField > 0 " ;
74 if ( vField<0) { msg <<
" <------ Erroneous "; }
77 msg <<
" - Theta angle: Value = " << vTheta
78 <<
" Expected between 0 <= theta <= pi = " <<
pi <<
" ";
79 if ( (vTheta<0) || (vTheta>pi) ) { msg <<
" <------ Erroneous "; }
82 msg <<
" - Phi angle: Value = " << vPhi
83 <<
" Expected between 0 <= phi <= 2*pi = " <<
twopi << std::endl;
84 if ( (vPhi<0) || (vPhi>
twopi) ) { msg <<
" <------ Erroneous "; }
86 G4Exception(
"G4UniformMagField::G4UniformMagField()",
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) ;
101 for (
G4int i=0; i<3; i++)
103 fFieldComponents[i] = p.fFieldComponents[i];
109 if (&p ==
this)
return *
this;
111 for (
G4int i=0; i<3; i++)
113 fFieldComponents[i] = p.fFieldComponents[i];
123 B[0]= fFieldComponents[0] ;
124 B[1]= fFieldComponents[1] ;
125 B[2]= fFieldComponents[2] ;
132 fFieldComponents[2]);
CLHEP::Hep3Vector G4ThreeVector
double B(double temperature)
static constexpr double twopi
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
G4MagneticField & operator=(const G4MagneticField &p)
static constexpr double pi