CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 }
T perp() const
Definition: PV3DBase.h:69
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
void GetField(double r, double z, double phi, double &Br, double &Bz, double &Bphi) const
Definition: BFit.cc:190
T z() const
Definition: PV3DBase.h:61
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
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
void setNominalValue()
Log< level::Warning, false > LogWarning
void SetField(double B)
Definition: BFit.cc:152
Global3DVector GlobalVector
Definition: GlobalVector.h:10