36 fFieldComponents[0] = FieldVector.
x();
37 fFieldComponents[1] = FieldVector.
y();
38 fFieldComponents[2] = FieldVector.
z();
46 for (
auto i=0; i<3; ++i)
48 fFieldComponents[i] = p.fFieldComponents[i];
54 if (&p ==
this) {
return *
this;}
56 for (
auto i=0; i<3; ++i)
58 fFieldComponents[i] = p.fFieldComponents[i];
67 fFieldComponents[2]) );
73 fFieldComponents[0] = newFieldVector.
x();
74 fFieldComponents[1] = newFieldVector.
y();
75 fFieldComponents[2] = newFieldVector.
z();
82 if ( (vField<0) || (vTheta<0) || (vTheta>pi) || (vPhi<0) || (vPhi>twopi) )
84 std::ostringstream msg;
85 msg <<
"ERROR in G4UniformMagField::G4UniformMagField() : "
86 <<
"Invalid parameter(s). " << std::endl;
87 msg <<
" Expected " << std::endl;
89 msg <<
" - Magnitude vField: Value = " << vField
90 <<
" Expected vField > 0 " ;
91 if ( vField<0) { msg <<
" <------ Erroneous "; }
94 msg <<
" - Theta angle: Value = " << vTheta
95 <<
" Expected between 0 <= theta <= pi = " << pi <<
" ";
96 if ( (vTheta<0) || (vTheta>pi) ) { msg <<
" <------ Erroneous "; }
99 msg <<
" - Phi angle: Value = " << vPhi
100 <<
" Expected between 0 <= phi <= 2*pi = " << twopi << std::endl;
101 if ( (vPhi<0) || (vPhi>twopi) ) { msg <<
" <------ Erroneous "; }
103 G4Exception(
"G4UniformMagField::G4UniformMagField()",
106 fFieldComponents[0] = vField*std::sin(vTheta)*std::cos(vPhi) ;
107 fFieldComponents[1] = vField*std::sin(vTheta)*std::sin(vPhi) ;
108 fFieldComponents[2] = vField*std::cos(vTheta) ;
116 B[0]= fFieldComponents[0];
117 B[1]= fFieldComponents[1];
118 B[2]= fFieldComponents[2];
125 fFieldComponents[2]);
G4double B(G4double temperature)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
CLHEP::Hep3Vector G4ThreeVector
G4MagneticField & operator=(const G4MagneticField &p)