36 fFieldComponents[0] = FieldVector.
x();
37 fFieldComponents[1] = FieldVector.
y();
38 fFieldComponents[2] = FieldVector.
z();
48 for (
auto i=0; i<3; ++i)
50 fFieldComponents[i] = p.fFieldComponents[i];
56 if (&p ==
this)
return *
this;
58 for (
auto i=0; i<3; ++i)
60 fFieldComponents[i] = p.fFieldComponents[i];
69 fFieldComponents[2]) );
75 fFieldComponents[0] = newFieldVector.
x();
76 fFieldComponents[1] = newFieldVector.
y();
77 fFieldComponents[2] = newFieldVector.
z();
84 if ( (vField<0) || (vTheta<0) || (vTheta>pi) || (vPhi<0) || (vPhi>twopi) )
86 std::ostringstream msg;
87 msg <<
"ERROR in G4UniformMagField::G4UniformMagField() : "
88 <<
"Invalid parameter(s). " << std::endl;
89 msg <<
" Expected " << std::endl;
91 msg <<
" - Magnitude vField: Value = " << vField
92 <<
" Expected vField > 0 " ;
93 if ( vField<0) { msg <<
" <------ Erroneous "; }
96 msg <<
" - Theta angle: Value = " << vTheta
97 <<
" Expected between 0 <= theta <= pi = " << pi <<
" ";
98 if ( (vTheta<0) || (vTheta>pi) ) { msg <<
" <------ Erroneous "; }
101 msg <<
" - Phi angle: Value = " << vPhi
102 <<
" Expected between 0 <= phi <= 2*pi = " << twopi << std::endl;
103 if ( (vPhi<0) || (vPhi>twopi) ) { msg <<
" <------ Erroneous "; }
105 G4Exception(
"G4UniformMagField::G4UniformMagField()",
108 fFieldComponents[0] = vField*std::sin(vTheta)*std::cos(vPhi) ;
109 fFieldComponents[1] = vField*std::sin(vTheta)*std::sin(vPhi) ;
110 fFieldComponents[2] = vField*std::cos(vTheta) ;
118 B[0]= fFieldComponents[0];
119 B[1]= fFieldComponents[1];
120 B[2]= fFieldComponents[2];
127 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)