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 Member Functions | Private Attributes
OAE85lParametrizedMagneticField Class Reference

#include <OAE85lParametrizedMagneticField.h>

Inheritance diagram for OAE85lParametrizedMagneticField:
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...
 
 OAE85lParametrizedMagneticField (float b0_=40.681, float a_=4.6430, float l_=15.284)
 
 OAE85lParametrizedMagneticField (const edm::ParameterSet &parameters)
 Constructor. Parameters taken from a PSet. More...
 
virtual ~OAE85lParametrizedMagneticField ()
 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 Member Functions

void ffunkti (float u, float *ff) const
 
void init ()
 

Private Attributes

float a
 
float ainv
 
float ap2
 
float b0
 
float hb0
 
float hlova
 
float l
 

Detailed Description

Magnetic Field engine wrapper for V. Karimaki's "off-axis expansion" of the TOSCA field version 85l_030919 (4 T) valid in the region r<1.2 m and |z|<3.0 m

Author
N. Amapane - CERN

Definition at line 17 of file OAE85lParametrizedMagneticField.h.

Constructor & Destructor Documentation

OAE85lParametrizedMagneticField::OAE85lParametrizedMagneticField ( float  b0_ = 40.681,
float  a_ = 4.6430,
float  l_ = 15.284 
)

Constructor. The optional parameters are: b0=field at centre, l=solenoid length, a=radius (m)

Definition at line 16 of file OAE85lParametrizedMagneticField.cc.

References init().

OAE85lParametrizedMagneticField::OAE85lParametrizedMagneticField ( const edm::ParameterSet parameters)

Constructor. Parameters taken from a PSet.

Definition at line 27 of file OAE85lParametrizedMagneticField.cc.

References a, b0, edm::ParameterSet::getParameter(), init(), and l.

27  {
28  b0 = parameters.getParameter<double>("b0");
29  l = parameters.getParameter<double>("l");
30  a = parameters.getParameter<double>("a");
31  init();
32 }
T getParameter(std::string const &) const
OAE85lParametrizedMagneticField::~OAE85lParametrizedMagneticField ( )
virtual

Destructor.

Definition at line 43 of file OAE85lParametrizedMagneticField.cc.

43 {}

Member Function Documentation

void OAE85lParametrizedMagneticField::ffunkti ( float  u,
float *  ff 
) const
private

Definition at line 118 of file OAE85lParametrizedMagneticField.cc.

References a, b, and mathSSE::sqrt().

Referenced by inTeslaUnchecked().

118  {
119 // Function and its 3 derivatives
120  float a,b;
121  a=1.0/(1.0+u*u);
122  b=sqrt(a);
123  ff[0]=u*b;
124  ff[1]=a*b;
125  ff[2]=-3.0*u*a*ff[1];
126  ff[3]=a*ff[2]*((1.0/u)-4.0*u);
127  return;
128 }
T sqrt(T t)
Definition: SSEVec.h:48
double b
Definition: hdecay.h:120
void OAE85lParametrizedMagneticField::init ( void  )
private
GlobalVector OAE85lParametrizedMagneticField::inTesla ( const GlobalPoint gp) const
virtual

Field value ad specified global point, in Tesla.

Implements MagneticField.

Definition at line 47 of file OAE85lParametrizedMagneticField.cc.

References inTeslaUnchecked(), and isDefined().

47  {
48 
49  if (isDefined(gp)) {
50  return inTeslaUnchecked(gp);
51  } else {
52  edm::LogWarning("MagneticField|FieldOutsideValidity") << " Point " << gp << " is outside the validity region of OAE85lParametrizedMagneticField";
53  return GlobalVector();
54  }
55 }
GlobalVector inTeslaUnchecked(const GlobalPoint &gp) const
Global3DVector GlobalVector
Definition: GlobalVector.h:10
bool isDefined(const GlobalPoint &gp) const
True if the point is within the region where the concrete field.
GlobalVector OAE85lParametrizedMagneticField::inTeslaUnchecked ( const GlobalPoint gp) const
virtual

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

GlobalVector bresult(br*xyz[0]*rinv, br*xyz[1]*rinv, bz);

Reimplemented from MagneticField.

Definition at line 59 of file OAE85lParametrizedMagneticField.cc.

References ainv, beamvalidation::br, create_public_lumi_plots::exp, ffunkti(), hb0, hlova, alignCSCRings::r, mathSSE::sqrt(), findQualityFiles::v, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), detailsBasic3DVector::z, and PV3DBase< T, PVType, FrameType >::z().

Referenced by inTesla().

59  {
60 
61 // Method formerly named "trackerField"
62 
63 //
64 // B-field in Tracker volume
65 //
66 // In: xyz[3]: coordinates (m)
67 // Out: bxyz[3]: Bx,By,Bz (kG)
68 //
69 // Valid for r<1.2 and |z|<3.0 V.Karimäki 040301
70 // Updated for CMSSW field 070424
71 //
72 
73 // b0=field at centre, l=solenoid length, a=radius (m) (phenomen. parameters)
74 
75  // FIXME: beware of statics...
76 // static float ap2=4.0*a*a/(l*l);
77 // static float hb0=0.5*b0*sqrt(1.0+ap2);
78 // static float hlova=1.0/sqrt(ap2);
79 // static float ainv=2.0*hlova/l;
80  float xyz[3];//, bxyz[3];
81  // convert to m (CMSSW)
82  xyz[0]=0.01*gp.x();
83  xyz[1]=0.01*gp.y();
84  xyz[2]=0.01*gp.z();
85 
86  float r=sqrt(xyz[0]*xyz[0]+xyz[1]*xyz[1]);
87  float z=xyz[2];
88  float az = fabs(z);
89  // if (r<1.2&&az<3.0) // NOTE: check omitted, is done already by inTesla (NA)
90  {
91  float zainv=z*ainv;
92  float rinv=(r>0.0) ? 1.0/r : 0.0;
93  float u=hlova-zainv;
94  float v=hlova+zainv;
95  float fu[5],gv[5];
96  ffunkti(u,fu);
97  ffunkti(v,gv);
98  float rat=r*ainv;
99  float corrr=0.00894*r*z*(az-2.2221)*(az-2.2221);
100  float corrz=-0.02996*exp(-0.5*(az-1.9820)*(az-1.9820)/(0.78915*0.78915));
101  float br=hb0*0.5*rat*(fu[1]-gv[1]-0.125*(fu[3]-gv[3])*rat*rat)+corrr;
102  float bz=hb0*(fu[0]+gv[0]-(fu[2]+gv[2])*0.25*rat*rat)+corrz;
103  //bxyz[0]=br*xyz[0]*rinv;
104  //bxyz[1]=br*xyz[1]*rinv;
105  //bxyz[2]=bz;
107  // bvec.x()=0.1*br*xyz[0]*rinv;
108  //bvec.y()=0.1*br*xyz[1]*rinv;
109  //bvec.z()=0.1*bz;
110  return 0.1*GlobalVector(br*xyz[0]*rinv, br*xyz[1]*rinv, bz);
111  }
112  // else {
113  // cout <<"The point is outside the region r<1.2m && |z|<3.0m"<<endl;
114  //}
115  // return GlobalVector();
116 }
T y() const
Definition: PV3DBase.h:63
float float float z
T sqrt(T t)
Definition: SSEVec.h:48
T z() const
Definition: PV3DBase.h:64
T x() const
Definition: PV3DBase.h:62
Global3DVector GlobalVector
Definition: GlobalVector.h:10
bool OAE85lParametrizedMagneticField::isDefined ( const GlobalPoint gp) const
virtual

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

Reimplemented from MagneticField.

Definition at line 132 of file OAE85lParametrizedMagneticField.cc.

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

Referenced by inTesla().

132  {
133  return (gp.perp()<120. && fabs(gp.z())<300.);
134 }
T perp() const
Definition: PV3DBase.h:72
T z() const
Definition: PV3DBase.h:64

Member Data Documentation

float OAE85lParametrizedMagneticField::a
private
float OAE85lParametrizedMagneticField::ainv
private

Definition at line 54 of file OAE85lParametrizedMagneticField.h.

Referenced by init(), and inTeslaUnchecked().

float OAE85lParametrizedMagneticField::ap2
private

Definition at line 51 of file OAE85lParametrizedMagneticField.h.

Referenced by init().

float OAE85lParametrizedMagneticField::b0
private

Definition at line 47 of file OAE85lParametrizedMagneticField.h.

Referenced by init(), and OAE85lParametrizedMagneticField().

float OAE85lParametrizedMagneticField::hb0
private

Definition at line 52 of file OAE85lParametrizedMagneticField.h.

Referenced by init(), and inTeslaUnchecked().

float OAE85lParametrizedMagneticField::hlova
private

Definition at line 53 of file OAE85lParametrizedMagneticField.h.

Referenced by init(), and inTeslaUnchecked().

float OAE85lParametrizedMagneticField::l
private

Definition at line 48 of file OAE85lParametrizedMagneticField.h.

Referenced by init(), and OAE85lParametrizedMagneticField().