CMS 3D CMS Logo

Field.cc
Go to the documentation of this file.
3 
5 #include "G4Mag_UsualEqRhs.hh"
6 
7 #include "CLHEP/Units/GlobalSystemOfUnits.h"
8 
9 using namespace sim;
10 
11 Field::Field(const MagneticField *f, double d) : G4MagneticField(), theCMSMagneticField(f), theDelta(d) {
12  for (int i = 0; i < 3; ++i) {
13  oldx[i] = 1.0e12;
14  oldb[i] = 0.0;
15  }
16 }
17 
19 
20 void Field::GetFieldValue(const G4double xyz[4], G4double bfield[3]) const {
21  if (std::abs(oldx[0] - xyz[0]) > theDelta || std::abs(oldx[1] - xyz[1]) > theDelta ||
22  std::abs(oldx[2] - xyz[2]) > theDelta) {
23  static const float lunit = (float)(1.0 / CLHEP::cm);
24  GlobalPoint ggg((float)(xyz[0]) * lunit, (float)(xyz[1]) * lunit, (float)(xyz[2]) * lunit);
26 
27  static const float btesla = (float)CLHEP::tesla;
28  oldb[0] = (G4double)(v.x() * btesla);
29  oldb[1] = (G4double)(v.y() * btesla);
30  oldb[2] = (G4double)(v.z() * btesla);
31  oldx[0] = xyz[0];
32  oldx[1] = xyz[1];
33  oldx[2] = xyz[2];
34  }
35 
36  bfield[0] = oldb[0];
37  bfield[1] = oldb[1];
38  bfield[2] = oldb[2];
39 }
Vector3DBase
Definition: Vector3DBase.h:8
MagneticField::inTesla
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
mps_fire.i
i
Definition: mps_fire.py:428
dqmMemoryStats.float
float
Definition: dqmMemoryStats.py:127
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
sim::Field::~Field
~Field() override
Definition: Field.cc:18
findQualityFiles.v
v
Definition: findQualityFiles.py:179
sim::Field::oldx
double oldx[3]
Definition: Field.h:19
sim::Field::GetFieldValue
void GetFieldValue(const G4double p[4], G4double b[3]) const override
Definition: Field.cc:20
Point3DBase< float, GlobalTag >
sim::Field::oldb
double oldb[3]
Definition: Field.h:20
sim
Definition: GeometryProducer.h:20
Field.h
MagneticField.h
sim::Field::theDelta
double theDelta
Definition: Field.h:17
ztail.d
d
Definition: ztail.py:151
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
sim::Field::theCMSMagneticField
const MagneticField * theCMSMagneticField
Definition: Field.h:16
MagneticField
Definition: MagneticField.h:19
sim::Field::Field
Field(const MagneticField *f, double d)
Definition: Field.cc:11
GlobalPoint.h