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);
17 }
18 
20  : theParam(new BFit()) {
21  theParam->SetField(parameters.getParameter<double>("BValue"));
22 }
23 
25 
27  if (isDefined(gp)) {
28  return inTeslaUnchecked(gp);
29  } else {
30  edm::LogWarning("MagneticField") << " Point " << gp
31  << " is outside the validity region of PolyFit2DParametrizedMagneticField";
32  return GlobalVector();
33  }
34 }
35 
37  double Br, Bz, Bphi;
38  theParam->GetField(gp.perp() / 100., gp.z() / 100., gp.phi(), Br, Bz, Bphi);
39 
40  double cosphi = cos(gp.phi());
41  double sinphi = sin(gp.phi());
42 
43  return GlobalVector(Br * cosphi - Bphi * sinphi, Br * sinphi + Bphi * cosphi, Bz);
44 }
45 
47  double z = fabs(gp.z());
48  double r = gp.perp();
49  //"rectangle" |z|<3.5, r<1.9 _except_ the "corners" |z|+2.5*r>6.7, everything in meters
50  if (z > 350. || r > 190 || z + 2.5 * r > 670.)
51  return false;
52  return true;
53 }
Vector3DBase
Definition: Vector3DBase.h:8
BFit.h
BeamSpotPI::parameters
parameters
Definition: BeamSpotPayloadInspectorHelper.h:29
PolyFit2DParametrizedMagneticField::theParam
magfieldparam::BFit * theParam
Definition: PolyFit2DParametrizedMagneticField.h:40
MessageLogger.h
magfieldparam::BFit
Definition: BFit.h:15
magfieldparam::BFit::GetField
void GetField(double r, double z, double phi, double &Br, double &Bz, double &Bphi) const
Definition: BFit.cc:190
PolyFit2DParametrizedMagneticField::inTeslaUnchecked
GlobalVector inTeslaUnchecked(const GlobalPoint &gp) const override
Definition: PolyFit2DParametrizedMagneticField.cc:36
PolyFit2DParametrizedMagneticField::isDefined
bool isDefined(const GlobalPoint &gp) const override
True if the point is within the region where the concrete field.
Definition: PolyFit2DParametrizedMagneticField.cc:46
GlobalVector
Global3DVector GlobalVector
Definition: GlobalVector.h:10
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
funct::cos
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
DDAxes::z
Point3DBase< float, GlobalTag >
magfieldparam
Definition: BCyl.h:23
runTauDisplay.gp
gp
Definition: runTauDisplay.py:431
edm::ParameterSet
Definition: ParameterSet.h:47
PolyFit2DParametrizedMagneticField::PolyFit2DParametrizedMagneticField
PolyFit2DParametrizedMagneticField(double bVal=3.8114)
Definition: PolyFit2DParametrizedMagneticField.cc:15
magfieldparam::BFit::SetField
void SetField(double B)
Definition: BFit.cc:152
alignCSCRings.r
r
Definition: alignCSCRings.py:93
std
Definition: JetResolutionObject.h:76
PolyFit2DParametrizedMagneticField.h
PolyFit2DParametrizedMagneticField::inTesla
GlobalVector inTesla(const GlobalPoint &gp) const override
Field value ad specified global point, in Tesla.
Definition: PolyFit2DParametrizedMagneticField.cc:26
ParameterSet.h
PolyFit2DParametrizedMagneticField::~PolyFit2DParametrizedMagneticField
~PolyFit2DParametrizedMagneticField() override
Destructor.
Definition: PolyFit2DParametrizedMagneticField.cc:24