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 ()
 
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

Date:
2011/04/16 10:20:40
Revision:
1.1
Author
N. Amapane - CERN

Definition at line 19 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 18 of file OAE85lParametrizedMagneticField.cc.

References init().

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

Constructor. Parameters taken from a PSet.

Definition at line 29 of file OAE85lParametrizedMagneticField.cc.

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

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

Destructor.

Definition at line 45 of file OAE85lParametrizedMagneticField.cc.

45 {}

Member Function Documentation

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

Definition at line 120 of file OAE85lParametrizedMagneticField.cc.

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

Referenced by inTeslaUnchecked().

120  {
121 // Function and its 3 derivatives
122  float a,b;
123  a=1.0/(1.0+u*u);
124  b=sqrt(a);
125  ff[0]=u*b;
126  ff[1]=a*b;
127  ff[2]=-3.0*u*a*ff[1];
128  ff[3]=a*ff[2]*((1.0/u)-4.0*u);
129  return;
130 }
T sqrt(T t)
Definition: SSEVec.h:46
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 49 of file OAE85lParametrizedMagneticField.cc.

References inTeslaUnchecked(), and isDefined().

49  {
50 
51  if (isDefined(gp)) {
52  return inTeslaUnchecked(gp);
53  } else {
54  edm::LogWarning("MagneticField|FieldOutsideValidity") << " Point " << gp << " is outside the validity region of OAE85lParametrizedMagneticField";
55  return GlobalVector();
56  }
57 }
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 61 of file OAE85lParametrizedMagneticField.cc.

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

Referenced by inTesla().

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

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

Referenced by inTesla().

134  {
135  return (gp.perp()<120. && fabs(gp.z())<300.);
136 }
T perp() const
Definition: PV3DBase.h:71
T z() const
Definition: PV3DBase.h:63

Member Data Documentation

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

Definition at line 56 of file OAE85lParametrizedMagneticField.h.

Referenced by init(), and inTeslaUnchecked().

float OAE85lParametrizedMagneticField::ap2
private

Definition at line 53 of file OAE85lParametrizedMagneticField.h.

Referenced by init().

float OAE85lParametrizedMagneticField::b0
private

Definition at line 49 of file OAE85lParametrizedMagneticField.h.

Referenced by init(), and OAE85lParametrizedMagneticField().

float OAE85lParametrizedMagneticField::hb0
private

Definition at line 54 of file OAE85lParametrizedMagneticField.h.

Referenced by init(), and inTeslaUnchecked().

float OAE85lParametrizedMagneticField::hlova
private

Definition at line 55 of file OAE85lParametrizedMagneticField.h.

Referenced by init(), and inTeslaUnchecked().

float OAE85lParametrizedMagneticField::l
private

Definition at line 50 of file OAE85lParametrizedMagneticField.h.

Referenced by init(), and OAE85lParametrizedMagneticField().