#include <SimG4Core/MagneticField/interface/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 |
Definition at line 10 of file Field.h.
Field::Field | ( | const MagneticField * | f, | |
double | d | |||
) |
Definition at line 17 of file Field.cc.
00018 : G4MagneticField(), theCMSMagneticField(f),theDelta(d) 00019 { 00020 }
void Field::fieldEquation | ( | G4Mag_UsualEqRhs * | e | ) |
Definition at line 67 of file Field.cc.
References theFieldEquation.
00067 { theFieldEquation = e; }
G4Mag_UsualEqRhs * Field::fieldEquation | ( | ) |
Definition at line 15 of file Field.cc.
References theFieldEquation.
00015 { return theFieldEquation; }
void Field::GetFieldValue | ( | const double | p[3], | |
double | b[3] | |||
) | const [virtual] |
Definition at line 24 of file Field.cc.
References b, g, MagneticField::inTesla(), edm::isnan(), theCMSMagneticField, theDelta, v, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().
00025 { 00026 00027 // 00028 // this is another trick to check on a NaN, maybe it's even CPU-faster... 00029 // but ler's stick to system function isnan(...) for now 00030 // 00031 // if ( !(xyz[0]==xyz[0]) || !(xyz[1]==xyz[1]) || !(xyz[2]==xyz[2]) ) 00032 if ( isnan(xyz[0]+xyz[1]+xyz[2]) != 0 ) 00033 { 00034 throw SimG4Exception( "SimG4CoreMagneticField: Corrupted Event - NaN detected (position)" ) ; 00035 } 00036 00037 static float oldx[3] = {1.0e12,1.0e12,1.0e12}; 00038 static double b[3]; 00039 00040 if (theDelta>0. && 00041 fabs(oldx[0]-xyz[0])<theDelta && 00042 fabs(oldx[1]-xyz[1])<theDelta && 00043 fabs(oldx[2]-xyz[2])<theDelta) 00044 { 00045 // old b good enough 00046 bfield[0] = b[0]; 00047 bfield[1] = b[1]; 00048 bfield[2] = b[2]; 00049 return; 00050 } 00051 00052 const GlobalPoint g(xyz[0]/cm,xyz[1]/cm,xyz[2]/cm); 00053 GlobalVector v = theCMSMagneticField->inTesla(g); 00054 b[0] = v.x()*tesla; 00055 b[1] = v.y()*tesla; 00056 b[2] = v.z()*tesla; 00057 00058 oldx[0] = xyz[0]; 00059 oldx[1] = xyz[1]; 00060 oldx[2] = xyz[2]; 00061 00062 bfield[0] = b[0]; 00063 bfield[1] = b[1]; 00064 bfield[2] = b[2]; 00065 }
const MagneticField* sim::Field::theCMSMagneticField [private] |
double sim::Field::theDelta [private] |
G4Mag_UsualEqRhs* sim::Field::theFieldEquation [private] |