CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
PolyFit3DParametrizedMagneticField Class Reference

#include <PolyFit3DParametrizedMagneticField.h>

Inheritance diagram for PolyFit3DParametrizedMagneticField:
MagneticField

Public Member Functions

GlobalVector inTesla (const GlobalPoint &gp) const
 Field value ad specified global point, in Tesla. More...
 
GlobalVector inTeslaUnchecked (const GlobalPoint &gp) const
 
bool isDefined (const GlobalPoint &gp) const
 True if the point is within the region where the concrete field. More...
 
 PolyFit3DParametrizedMagneticField (double bVal=3.8114)
 
 PolyFit3DParametrizedMagneticField (const edm::ParameterSet &parameters)
 Constructor. Parameters taken from a PSet. More...
 
virtual ~PolyFit3DParametrizedMagneticField ()
 Destructor. More...
 
- Public Member Functions inherited from MagneticField
virtual MagneticFieldclone () const
 
GlobalVector inInverseGeV (const GlobalPoint &gp) const
 Field value ad specified global point, in 1/Gev. More...
 
GlobalVector inKGauss (const GlobalPoint &gp) const
 Field value ad specified global point, in KGauss. More...
 
 MagneticField ()
 
 MagneticField (const MagneticField &orig)
 
int nominalValue () const
 The nominal field value for this map in kGauss. More...
 
virtual ~MagneticField ()
 

Private Attributes

magfieldparam::BFit3DtheParam
 

Detailed Description

Magnetic Field engine wrapper for V. Maroussov's 3D parametrization of the MT data.

Author
N. Amapane

Definition at line 18 of file PolyFit3DParametrizedMagneticField.h.

Constructor & Destructor Documentation

PolyFit3DParametrizedMagneticField::PolyFit3DParametrizedMagneticField ( double  bVal = 3.8114)

Constructor. Fitted bVal for the nominal currents are: 2.0216; 3.5162; 3.8114; 4.01242188708911

Definition at line 16 of file PolyFit3DParametrizedMagneticField.cc.

References magfieldparam::BFit3D::SetField(), and theParam.

16  :
17  theParam(new BFit3D())
18 {
19  theParam->SetField(bVal);
20 }
void SetField(const double B)
Definition: BFit3D.h:47
PolyFit3DParametrizedMagneticField::PolyFit3DParametrizedMagneticField ( const edm::ParameterSet parameters)

Constructor. Parameters taken from a PSet.

Definition at line 23 of file PolyFit3DParametrizedMagneticField.cc.

References edm::ParameterSet::getParameter(), magfieldparam::BFit3D::SetField(), and theParam.

23  : theParam(new BFit3D()) {
24  theParam->SetField(parameters.getParameter<double>("BValue"));
25 
26  // Additional options (documentation by Vassili):
27 
28  // By default, the package accepts signed value of "r". That means,
29  // one can cross r=0 and orientation of the coordinate "orts"
30  // e_r and e_phi will not be flipped over.
31  // In other words for an r<0 the e_r points inward, in the direction r=0.
32  // This is a "natural" mode. However, the default behavior may be
33  // changed by the call
34 
35  // theParam->UseSignedRad(false);
36 
37  // In that case with crossing of r=0 e_r and e_phi will be flipped in
38  // such a way that e_r always points outward. In other words instead of
39  // (r<0, phi) the (abs(r), phi+PI) will be used in this mode.
40 
41  // The expansion coefficients for a nominal field in between measurement
42  // field values (2.0T, 3.5T, 3.8T and 4.0T) by default are calculated by
43  // means of a linear piecewise interpolation. Another provided
44  // interpolation mode is cubic spline. This mode can be switched
45  // on by the call:
46 
47  // theParam->UseSpline(true);
48 
49  // From practical point of view the use of spline interpolation doesn't
50  // change much, but it makes the coefficients' behavior a bit more
51  // physical at very low/high field values.
52 }
T getParameter(std::string const &) const
void SetField(const double B)
Definition: BFit3D.h:47
PolyFit3DParametrizedMagneticField::~PolyFit3DParametrizedMagneticField ( )
virtual

Destructor.

Definition at line 55 of file PolyFit3DParametrizedMagneticField.cc.

References theParam.

55  {
56  delete theParam;
57 }

Member Function Documentation

GlobalVector PolyFit3DParametrizedMagneticField::inTesla ( const GlobalPoint gp) const
virtual

Field value ad specified global point, in Tesla.

Implements MagneticField.

Definition at line 61 of file PolyFit3DParametrizedMagneticField.cc.

References inTeslaUnchecked(), and isDefined().

61  {
62 
63  if (isDefined(gp)) {
64  return inTeslaUnchecked(gp);
65  } else {
66  edm::LogWarning("MagneticField|FieldOutsideValidity") << " Point " << gp << " is outside the validity region of PolyFit3DParametrizedMagneticField";
67  return GlobalVector();
68  }
69 }
bool isDefined(const GlobalPoint &gp) const
True if the point is within the region where the concrete field.
GlobalVector inTeslaUnchecked(const GlobalPoint &gp) const
Global3DVector GlobalVector
Definition: GlobalVector.h:10
GlobalVector PolyFit3DParametrizedMagneticField::inTeslaUnchecked ( const GlobalPoint gp) const
virtual

Optional implementation that derived classes can implement to provide faster query by skipping the check to isDefined.

Reimplemented from MagneticField.

Definition at line 72 of file PolyFit3DParametrizedMagneticField.cc.

References funct::cos(), magfieldparam::BFit3D::GetField(), PV3DBase< T, PVType, FrameType >::perp(), PV3DBase< T, PVType, FrameType >::phi(), funct::sin(), theParam, and PV3DBase< T, PVType, FrameType >::z().

Referenced by inTesla().

72  {
73  double Br, Bz, Bphi;
74  theParam->GetField(gp.perp()/100., gp.z()/100., gp.phi(),
75  Br, Bz, Bphi);
76 
77  double cosphi = cos(gp.phi());
78  double sinphi = sin(gp.phi());
79 
80  return GlobalVector(Br*cosphi - Bphi*sinphi,
81  Br*sinphi + Bphi*cosphi,
82  Bz);
83 }
T perp() const
Definition: PV3DBase.h:72
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
void GetField(const double r, const double z, const double phi, double &Br, double &Bz, double &Bphi)
Definition: BFit3D.cc:70
T z() const
Definition: PV3DBase.h:64
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Global3DVector GlobalVector
Definition: GlobalVector.h:10
bool PolyFit3DParametrizedMagneticField::isDefined ( const GlobalPoint gp) const
virtual

True if the point is within the region where the concrete field.

Reimplemented from MagneticField.

Definition at line 86 of file PolyFit3DParametrizedMagneticField.cc.

References PV3DBase< T, PVType, FrameType >::perp(), alignCSCRings::r, detailsBasic3DVector::z, and PV3DBase< T, PVType, FrameType >::z().

Referenced by inTesla().

86  {
87  double z = fabs(gp.z());
88  double r = gp.perp();
89  //"rectangle" |z|<3.5, r<1.9 _except_ the "corners" |z|+2.5*r>6.7, everything in meters
90  if (z>350. || r>190 || z+2.5*r>670.) return false;
91  return true;
92 }
T perp() const
Definition: PV3DBase.h:72
float float float z
T z() const
Definition: PV3DBase.h:64

Member Data Documentation

magfieldparam::BFit3D* PolyFit3DParametrizedMagneticField::theParam
private