G4UniformMagField Class Reference

#include <G4UniformMagField.hh>

Inheritance diagram for G4UniformMagField:

G4MagneticField G4ElectroMagneticField G4Field

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

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.

00040 {
00041       fFieldComponents[0] = FieldVector.x();
00042       fFieldComponents[1] = FieldVector.y();
00043       fFieldComponents[2] = FieldVector.z();
00044 }

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

Definition at line 54 of file G4UniformMagField.cc.

References FatalException, G4Exception(), and G4INCL::Math::pi.

00057 {
00058    if ( (vField<0) || (vTheta<0) || (vTheta>pi) || (vPhi<0) || (vPhi>twopi) )
00059    {
00060       G4Exception("G4UniformMagField::G4UniformMagField()",
00061                   "GeomField0002", FatalException, "Invalid parameters.") ;
00062    }
00063    fFieldComponents[0] = vField*std::sin(vTheta)*std::cos(vPhi) ;
00064    fFieldComponents[1] = vField*std::sin(vTheta)*std::sin(vPhi) ;
00065    fFieldComponents[2] = vField*std::cos(vTheta) ;
00066 }

G4UniformMagField::~G4UniformMagField (  )  [virtual]

Definition at line 68 of file G4UniformMagField.cc.

00069 {
00070 }

G4UniformMagField::G4UniformMagField ( const G4UniformMagField p  ) 

Definition at line 72 of file G4UniformMagField.cc.

References fFieldComponents.

00073    : G4MagneticField(p)
00074 {
00075    for (G4int i=0; i<3; i++)
00076       fFieldComponents[i] = p.fFieldComponents[i];
00077 }


Member Function Documentation

G4ThreeVector G4UniformMagField::GetConstantFieldValue (  )  const

Definition at line 97 of file G4UniformMagField.cc.

00098 {
00099    G4ThreeVector B(fFieldComponents[0],
00100                    fFieldComponents[1],
00101                    fFieldComponents[2]);
00102   return B;
00103 }

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

Implements G4MagneticField.

Definition at line 89 of file G4UniformMagField.cc.

00091 {
00092    B[0]= fFieldComponents[0] ;
00093    B[1]= fFieldComponents[1] ;
00094    B[2]= fFieldComponents[2] ;
00095 }

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

Definition at line 79 of file G4UniformMagField.cc.

References fFieldComponents.

00080 {
00081    if (&p == this) return *this;
00082    for (G4int i=0; i<3; i++)
00083       fFieldComponents[i] = p.fFieldComponents[i];
00084    return *this;
00085 }

void G4UniformMagField::SetFieldValue ( const G4ThreeVector newFieldValue  ) 

Definition at line 47 of file G4UniformMagField.cc.

00048 {
00049       fFieldComponents[0] = newFieldVector.x();
00050       fFieldComponents[1] = newFieldVector.y();
00051       fFieldComponents[2] = newFieldVector.z();
00052 }


The documentation for this class was generated from the following files:
Generated on Mon May 27 17:53:37 2013 for Geant4 by  doxygen 1.4.7