Class Reference for E1039 Core & Analysis Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GFField.cxx
Go to the documentation of this file.
1 #include "GFField.h"
2 
3 #include <iostream>
4 
5 #include <CLHEP/Units/SystemOfUnits.h>
6 
7 namespace SQGenFit
8 {
9 GFField::GFField(const PHField* field): _field(field)
10 {
11  _scale = 1.;
12  _disable = false;
13 }
14 
15 TVector3 GFField::get(const TVector3& pos) const
16 {
17  double x = pos.X();
18  double y = pos.Y();
19  double z = pos.Z();
20 
21  double Bx, By, Bz;
22  get(x, y, z, Bx, By, Bz);
23 
24  return TVector3(Bx, By, Bz);
25 }
26 
27 void GFField::get(const double& x, const double& y, const double& z, double& Bx, double& By, double& Bz) const
28 {
29  if(_disable)
30  {
31  Bx = 0.;
32  By = 0.;
33  Bz = 0.;
34  return;
35  }
36 
37  const double Point[] = {x*CLHEP::cm, y*CLHEP::cm, z*CLHEP::cm, 0.};
38  double Bfield[6];
39  for(int i = 0; i < 6; ++i)
40  {
41  Bfield[i] = 0.;
42  }
43 
44  _field->GetFieldValue(Point, Bfield);
45  Bx = _scale*Bfield[0]/CLHEP::kilogauss;
46  By = _scale*Bfield[1]/CLHEP::kilogauss;
47  Bz = _scale*Bfield[2]/CLHEP::kilogauss;
48 }
49 
50 }
TVector3 get(const TVector3 &pos) const
Definition: GFField.cxx:15
transient DST object for field storage and access
Definition: PHField.h:13
GFField(const PHField *field)
Definition: GFField.cxx:9
virtual void GetFieldValue(const double Point[4], double *Bfield) const =0