CMS 3D CMS Logo

PolyFit2DParametrizedMagneticField.cc
Go to the documentation of this file.
1 
9 
10 #include "BFit.h"
11 
12 using namespace std;
13 using namespace magfieldparam;
14 
16  theParam->SetField(bVal);
18 }
19 
21  : theParam(new BFit()) {
22  theParam->SetField(parameters.getParameter<double>("BValue"));
24 }
25 
27 
29  if (isDefined(gp)) {
30  return inTeslaUnchecked(gp);
31  } else {
32  edm::LogWarning("MagneticField") << " Point " << gp
33  << " is outside the validity region of PolyFit2DParametrizedMagneticField";
34  return GlobalVector();
35  }
36 }
37 
39  double Br, Bz, Bphi;
40  theParam->GetField(gp.perp() / 100., gp.z() / 100., gp.phi(), Br, Bz, Bphi);
41 
42  double cosphi = cos(gp.phi());
43  double sinphi = sin(gp.phi());
44 
45  return GlobalVector(Br * cosphi - Bphi * sinphi, Br * sinphi + Bphi * cosphi, Bz);
46 }
47 
49  double z = fabs(gp.z());
50  double r = gp.perp();
51  //"rectangle" |z|<3.5, r<1.9 _except_ the "corners" |z|+2.5*r>6.7, everything in meters
52  if (z > 350. || r > 190 || z + 2.5 * r > 670.)
53  return false;
54  return true;
55 }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
void GetField(double r, double z, double phi, double &Br, double &Bz, double &Bphi) const
Definition: BFit.cc:190
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
bool isDefined(const GlobalPoint &gp) const override
True if the point is within the region where the concrete field.
GlobalVector inTesla(const GlobalPoint &gp) const override
Field value ad specified global point, in Tesla.
GlobalVector inTeslaUnchecked(const GlobalPoint &gp) const override
void setNominalValue()
Log< level::Warning, false > LogWarning
void SetField(double B)
Definition: BFit.cc:152
Global3DVector GlobalVector
Definition: GlobalVector.h:10