CMS 3D CMS Logo

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)
 
void GetFieldValue (const G4double p[4], G4double b[3]) const override
 
 ~Field () override
 

Private Attributes

double oldb [3]
 
double oldx [3]
 
const MagneticFieldtheCMSMagneticField
 
double theDelta
 

Detailed Description

Definition at line 9 of file Field.h.

Constructor & Destructor Documentation

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

Definition at line 11 of file Field.cc.

References mps_fire::i, oldb, and oldx.

12  : G4MagneticField(), theCMSMagneticField(f), theDelta(d)
13 {
14  for(int i=0; i<3; ++i) {
15  oldx[i] = 1.0e12;
16  oldb[i] = 0.0;
17  }
18 }
const MagneticField * theCMSMagneticField
Definition: Field.h:17
double oldb[3]
Definition: Field.h:21
double theDelta
Definition: Field.h:18
double oldx[3]
Definition: Field.h:20
Field::~Field ( )
override

Definition at line 20 of file Field.cc.

20 {}

Member Function Documentation

void Field::GetFieldValue ( const G4double  p[4],
G4double  b[3] 
) const
override

Definition at line 22 of file Field.cc.

References funct::abs(), objects.autophobj::float, MagneticField::inTesla(), oldb, oldx, theCMSMagneticField, theDelta, findQualityFiles::v, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

23 {
24  if (std::abs(oldx[0]-xyz[0])>theDelta ||
25  std::abs(oldx[1]-xyz[1])>theDelta ||
26  std::abs(oldx[2]-xyz[2])>theDelta)
27  {
28  static const float lunit = (float)(1.0/CLHEP::cm);
29  GlobalPoint ggg((float)(xyz[0])*lunit,(float)(xyz[1])*lunit,(float)(xyz[2])*lunit);
31 
32  static const float btesla = (float)CLHEP::tesla;
33  oldb[0] = (G4double)(v.x()*btesla);
34  oldb[1] = (G4double)(v.y()*btesla);
35  oldb[2] = (G4double)(v.z()*btesla);
36  oldx[0] = xyz[0];
37  oldx[1] = xyz[1];
38  oldx[2] = xyz[2];
39  }
40 
41  bfield[0] = oldb[0];
42  bfield[1] = oldb[1];
43  bfield[2] = oldb[2];
44 }
const MagneticField * theCMSMagneticField
Definition: Field.h:17
T y() const
Definition: PV3DBase.h:63
T z() const
Definition: PV3DBase.h:64
double oldb[3]
Definition: Field.h:21
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
double theDelta
Definition: Field.h:18
double oldx[3]
Definition: Field.h:20
T x() const
Definition: PV3DBase.h:62

Member Data Documentation

double sim::Field::oldb[3]
mutableprivate

Definition at line 21 of file Field.h.

Referenced by Field(), and GetFieldValue().

double sim::Field::oldx[3]
mutableprivate

Definition at line 20 of file Field.h.

Referenced by Field(), and GetFieldValue().

const MagneticField* sim::Field::theCMSMagneticField
private

Definition at line 17 of file Field.h.

Referenced by GetFieldValue().

double sim::Field::theDelta
private

Definition at line 18 of file Field.h.

Referenced by GetFieldValue().