test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
sim::Field Class Reference

#include <Field.h>

Inheritance diagram for sim::Field:

Public Member Functions

 Field (const MagneticField *f, double d)
 
G4Mag_UsualEqRhs * fieldEquation ()
 
void fieldEquation (G4Mag_UsualEqRhs *e)
 
virtual void GetFieldValue (const double p[3], double b[3]) const
 
virtual ~Field ()
 

Private Attributes

const MagneticFieldtheCMSMagneticField
 
double theDelta
 
G4Mag_UsualEqRhs * theFieldEquation
 

Detailed Description

Definition at line 10 of file Field.h.

Constructor & Destructor Documentation

Field::Field ( const MagneticField f,
double  d 
)

Definition at line 18 of file Field.cc.

19  : G4MagneticField(), theCMSMagneticField(f),theDelta(d)
20 {
21 }
const MagneticField * theCMSMagneticField
Definition: Field.h:19
tuple d
Definition: ztail.py:151
double theDelta
Definition: Field.h:21
Field::~Field ( )
virtual

Definition at line 23 of file Field.cc.

23 {}

Member Function Documentation

G4Mag_UsualEqRhs * Field::fieldEquation ( )

Definition at line 16 of file Field.cc.

References theFieldEquation.

16 { return theFieldEquation; }
G4Mag_UsualEqRhs * theFieldEquation
Definition: Field.h:20
void Field::fieldEquation ( G4Mag_UsualEqRhs *  e)

Definition at line 74 of file Field.cc.

References alignCSCRings::e, and theFieldEquation.

74 { theFieldEquation = e; }
G4Mag_UsualEqRhs * theFieldEquation
Definition: Field.h:20
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, findQualityFiles::v, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

26 {
27 
28  //
29  // this is another trick to check on a NaN, maybe it's even CPU-faster...
30  // but ler's stick to system function edm::isNotFinite(...) for now
31  //
32  // if ( !(xyz[0]==xyz[0]) || !(xyz[1]==xyz[1]) || !(xyz[2]==xyz[2]) )
33  if ( edm::isNotFinite(xyz[0]+xyz[1]+xyz[2]) != 0 )
34  {
35  throw SimG4Exception( "SimG4CoreMagneticField: Corrupted Event - NaN detected (position)" ) ;
36  }
37 
38  // Which is worse, thread_local static here, or mutable members?
39  // Mutable members + synchronization would be the most correct. In
40  // practice I know there is (by construction via
41  // RunManagerMT/RunManagerMTWorker) one Field object per thread,
42  // managed via pointers in TLS, so thread_local here is also
43  // "correct", and fastest to write.
44  static thread_local float oldx[3] = {1.0e12,1.0e12,1.0e12};
45  static thread_local double b[3];
46 
47  if (theDelta>0. &&
48  fabs(oldx[0]-xyz[0])<theDelta &&
49  fabs(oldx[1]-xyz[1])<theDelta &&
50  fabs(oldx[2]-xyz[2])<theDelta)
51  {
52  // old b good enough
53  bfield[0] = b[0];
54  bfield[1] = b[1];
55  bfield[2] = b[2];
56  return;
57  }
58 
59  const GlobalPoint g(xyz[0]/cm,xyz[1]/cm,xyz[2]/cm);
61  b[0] = v.x()*tesla;
62  b[1] = v.y()*tesla;
63  b[2] = v.z()*tesla;
64 
65  oldx[0] = xyz[0];
66  oldx[1] = xyz[1];
67  oldx[2] = xyz[2];
68 
69  bfield[0] = b[0];
70  bfield[1] = b[1];
71  bfield[2] = b[2];
72 }
const MagneticField * theCMSMagneticField
Definition: Field.h:19
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
T y() const
Definition: PV3DBase.h:63
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Definition: Activities.doc:4
bool isNotFinite(T x)
Definition: isFinite.h:10
T z() const
Definition: PV3DBase.h:64
double b
Definition: hdecay.h:120
double theDelta
Definition: Field.h:21
T x() const
Definition: PV3DBase.h:62

Member Data Documentation

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().