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 
9 
10 #include "BFit.h"
11 
12 
13 using namespace std;
14 using namespace magfieldparam;
15 
17  theParam(new BFit())
18 {
19  theParam->SetField(bVal);
20 }
21 
22 
24  theParam->SetField(parameters.getParameter<double>("BValue"));
25 }
26 
27 
29  delete theParam;
30 }
31 
32 
35 
36  if (isDefined(gp)) {
37  return inTeslaUnchecked(gp);
38  } else {
39  edm::LogWarning("MagneticField|FieldOutsideValidity") << " Point " << gp << " is outside the validity region of PolyFit2DParametrizedMagneticField";
40  return GlobalVector();
41  }
42 }
43 
46  double Br, Bz, Bphi;
47  theParam->GetField(gp.perp()/100., gp.z()/100., gp.phi(),
48  Br, Bz, Bphi);
49 
50  double cosphi = cos(gp.phi());
51  double sinphi = sin(gp.phi());
52 
53  return GlobalVector(Br*cosphi - Bphi*sinphi,
54  Br*sinphi + Bphi*cosphi,
55  Bz);
56 }
57 
58 bool
60  double z = fabs(gp.z());
61  double r = gp.perp();
62  //"rectangle" |z|<3.5, r<1.9 _except_ the "corners" |z|+2.5*r>6.7, everything in meters
63  if (z>350. || r>190 || z+2.5*r>670.) return false;
64  return true;
65 }
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) const
Definition: BFit.cc:139
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