#include <Field.h>
Public Member Functions | |
Field (const MagneticField *f, double d) | |
void | fieldEquation (G4Mag_UsualEqRhs *e) |
G4Mag_UsualEqRhs * | fieldEquation () |
virtual void | GetFieldValue (const double p[3], double b[3]) const |
virtual | ~Field () |
Private Attributes | |
const MagneticField * | theCMSMagneticField |
double | theDelta |
G4Mag_UsualEqRhs * | theFieldEquation |
Field::Field | ( | const MagneticField * | f, |
double | d | ||
) |
Definition at line 18 of file Field.cc.
: G4MagneticField(), theCMSMagneticField(f),theDelta(d) { }
G4Mag_UsualEqRhs * Field::fieldEquation | ( | ) |
void Field::fieldEquation | ( | G4Mag_UsualEqRhs * | e | ) |
Definition at line 68 of file Field.cc.
References alignCSCRings::e, and theFieldEquation.
{ theFieldEquation = e; }
void Field::GetFieldValue | ( | const double | p[3], |
double | b[3] | ||
) | const [virtual] |
Definition at line 25 of file Field.cc.
References b, g, MagneticField::inTesla(), edm::isNotFinite(), theCMSMagneticField, theDelta, v, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().
{ // // this is another trick to check on a NaN, maybe it's even CPU-faster... // but ler's stick to system function edm::isNotFinite(...) for now // // if ( !(xyz[0]==xyz[0]) || !(xyz[1]==xyz[1]) || !(xyz[2]==xyz[2]) ) if ( edm::isNotFinite(xyz[0]+xyz[1]+xyz[2]) != 0 ) { throw SimG4Exception( "SimG4CoreMagneticField: Corrupted Event - NaN detected (position)" ) ; } static float oldx[3] = {1.0e12,1.0e12,1.0e12}; static double b[3]; if (theDelta>0. && fabs(oldx[0]-xyz[0])<theDelta && fabs(oldx[1]-xyz[1])<theDelta && fabs(oldx[2]-xyz[2])<theDelta) { // old b good enough bfield[0] = b[0]; bfield[1] = b[1]; bfield[2] = b[2]; return; } const GlobalPoint g(xyz[0]/cm,xyz[1]/cm,xyz[2]/cm); GlobalVector v = theCMSMagneticField->inTesla(g); b[0] = v.x()*tesla; b[1] = v.y()*tesla; b[2] = v.z()*tesla; oldx[0] = xyz[0]; oldx[1] = xyz[1]; oldx[2] = xyz[2]; bfield[0] = b[0]; bfield[1] = b[1]; bfield[2] = b[2]; }
const MagneticField* sim::Field::theCMSMagneticField [private] |
Definition at line 19 of file Field.h.
Referenced by GetFieldValue().
double sim::Field::theDelta [private] |
Definition at line 21 of file Field.h.
Referenced by GetFieldValue().
G4Mag_UsualEqRhs* sim::Field::theFieldEquation [private] |
Definition at line 20 of file Field.h.
Referenced by fieldEquation().