CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PolyFit2DParametrizedMagneticField.cc
Go to the documentation of this file.
1 
11 
12 #include "BFit.h"
13 
14 
15 using namespace std;
16 using namespace magfieldparam;
17 
19  theParam(new BFit())
20 {
21  theParam->SetField(bVal);
22 }
23 
24 
26  theParam->SetField(parameters.getParameter<double>("BValue"));
27 }
28 
29 
31  delete theParam;
32 }
33 
34 
37 
38  if (isDefined(gp)) {
39  return inTeslaUnchecked(gp);
40  } else {
41  edm::LogWarning("MagneticField|FieldOutsideValidity") << " Point " << gp << " is outside the validity region of PolyFit2DParametrizedMagneticField";
42  return GlobalVector();
43  }
44 }
45 
48  double Br, Bz, Bphi;
49  theParam->GetField(gp.perp()/100., gp.z()/100., gp.phi(),
50  Br, Bz, Bphi);
51 
52  double cosphi = cos(gp.phi());
53  double sinphi = sin(gp.phi());
54 
55  return GlobalVector(Br*cosphi - Bphi*sinphi,
56  Br*sinphi + Bphi*cosphi,
57  Bz);
58 }
59 
60 bool
62  double z = fabs(gp.z());
63  double r = gp.perp();
64  //"rectangle" |z|<3.5, r<1.9 _except_ the "corners" |z|+2.5*r>6.7, everything in meters
65  if (z>350. || r>190 || z+2.5*r>670.) return false;
66  return true;
67 }
T getParameter(std::string const &) const
dictionary parameters
Definition: Parameters.py:2
T perp() const
Definition: PV3DBase.h:72
GlobalVector inTeslaUnchecked(const GlobalPoint &gp) const
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
void GetField(double r, double z, double phi, double &Br, double &Bz, double &Bphi)
Definition: BFit.cc:139
float float float z
T z() const
Definition: PV3DBase.h:64
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
GlobalVector inTesla(const GlobalPoint &gp) const
Field value ad specified global point, in Tesla.
void SetField(double B)
Definition: BFit.cc:101
bool isDefined(const GlobalPoint &gp) const
True if the point is within the region where the concrete field.
Global3DVector GlobalVector
Definition: GlobalVector.h:10