CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

OAE85lParametrizedMagneticField Class Reference

#include <OAE85lParametrizedMagneticField.h>

Inheritance diagram for OAE85lParametrizedMagneticField:
MagneticField

List of all members.

Public Member Functions

GlobalVector inTesla (const GlobalPoint &gp) const
 Field value ad specified global point, in Tesla.
GlobalVector inTeslaUnchecked (const GlobalPoint &gp) const
bool isDefined (const GlobalPoint &gp) const
 True if the point is within the region where the concrete field.
 OAE85lParametrizedMagneticField (const edm::ParameterSet &parameters)
 Constructor. Parameters taken from a PSet.
 OAE85lParametrizedMagneticField (float b0_=40.681, float a_=4.6430, float l_=15.284)
virtual ~OAE85lParametrizedMagneticField ()
 Destructor.

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

  : b0(b0_),
    l(l_),
    a(a_)    
{
  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.

                                                                                                  {
  b0 =  parameters.getParameter<double>("b0");
  l = parameters.getParameter<double>("l");
  a = parameters.getParameter<double>("a");
  init();
}
OAE85lParametrizedMagneticField::~OAE85lParametrizedMagneticField ( ) [virtual]

Destructor.

Definition at line 45 of file OAE85lParametrizedMagneticField.cc.

{}

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

                                                                      {
// Function and its 3 derivatives
 float a,b; 
 a=1.0/(1.0+u*u);
 b=sqrt(a);
 ff[0]=u*b;
 ff[1]=a*b;
 ff[2]=-3.0*u*a*ff[1];
 ff[3]=a*ff[2]*((1.0/u)-4.0*u);
 return;
}
void OAE85lParametrizedMagneticField::init ( void  ) [private]

Definition at line 36 of file OAE85lParametrizedMagneticField.cc.

References a, ainv, ap2, b0, hb0, hlova, l, and mathSSE::sqrt().

Referenced by OAE85lParametrizedMagneticField().

                                           {
  ap2=4.0*a*a/(l*l);  
  hb0=0.5*b0*sqrt(1.0+ap2);
  hlova=1.0/sqrt(ap2);
  ainv=2.0*hlova/l;
}
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().

                                                                    {
  
  if (isDefined(gp)) {
    return inTeslaUnchecked(gp);
  } else {
    edm::LogWarning("MagneticField|FieldOutsideValidity") << " Point " << gp << " is outside the validity region of OAE85lParametrizedMagneticField";
    return GlobalVector();
  }
}
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, funct::exp(), ffunkti(), hb0, hlova, alignCSCRings::r, mathSSE::sqrt(), v, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), PV3DBase< T, PVType, FrameType >::z(), and z.

Referenced by inTesla().

                                                                             {
  
// Method formerly named "trackerField"

//
//    B-field in Tracker volume
//    
//     In:   xyz[3]: coordinates (m)
//    Out:  bxyz[3]: Bx,By,Bz    (kG)
//
//    Valid for r<1.2 and |z|<3.0               V.Karimäki 040301
//                                 Updated for CMSSW field 070424
//

// b0=field at centre, l=solenoid length, a=radius (m) (phenomen. parameters) 

  // FIXME: beware of statics...
//  static float ap2=4.0*a*a/(l*l);  
//  static float hb0=0.5*b0*sqrt(1.0+ap2);
//  static float hlova=1.0/sqrt(ap2);
//  static float ainv=2.0*hlova/l;
 float xyz[3];//, bxyz[3];
 // convert to m (CMSSW)
 xyz[0]=0.01*gp.x();
 xyz[1]=0.01*gp.y();
 xyz[2]=0.01*gp.z();

 float r=sqrt(xyz[0]*xyz[0]+xyz[1]*xyz[1]);
 float z=xyz[2];
 float az = fabs(z);
 // if (r<1.2&&az<3.0) // NOTE: check omitted, is done already by inTesla (NA)
 {
  float zainv=z*ainv;
  float rinv=(r>0.0) ? 1.0/r : 0.0;
  float u=hlova-zainv;
  float v=hlova+zainv;
  float fu[5],gv[5];
  ffunkti(u,fu);
  ffunkti(v,gv);
  float rat=r*ainv;
  float corrr=0.00894*r*z*(az-2.2221)*(az-2.2221);
  float corrz=-0.02996*exp(-0.5*(az-1.9820)*(az-1.9820)/(0.78915*0.78915));
  float br=hb0*0.5*rat*(fu[1]-gv[1]-0.125*(fu[3]-gv[3])*rat*rat)+corrr;
  float bz=hb0*(fu[0]+gv[0]-(fu[2]+gv[2])*0.25*rat*rat)+corrz;
  //bxyz[0]=br*xyz[0]*rinv;
  //bxyz[1]=br*xyz[1]*rinv;
  //bxyz[2]=bz;
  //  bvec.x()=0.1*br*xyz[0]*rinv;
  //bvec.y()=0.1*br*xyz[1]*rinv;
  //bvec.z()=0.1*bz;
  return  0.1*GlobalVector(br*xyz[0]*rinv, br*xyz[1]*rinv, bz);
 }
 // else {
 // cout <<"The point is outside the region r<1.2m && |z|<3.0m"<<endl;
 //}
 // return GlobalVector();
}
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().

                                                                      {
  return (gp.perp()<120. && fabs(gp.z())<300.);
}

Member Data Documentation

Definition at line 56 of file OAE85lParametrizedMagneticField.h.

Referenced by init(), and inTeslaUnchecked().

Definition at line 53 of file OAE85lParametrizedMagneticField.h.

Referenced by init().

Definition at line 49 of file OAE85lParametrizedMagneticField.h.

Referenced by init(), and OAE85lParametrizedMagneticField().

Definition at line 54 of file OAE85lParametrizedMagneticField.h.

Referenced by init(), and inTeslaUnchecked().

Definition at line 55 of file OAE85lParametrizedMagneticField.h.

Referenced by init(), and inTeslaUnchecked().

Definition at line 50 of file OAE85lParametrizedMagneticField.h.

Referenced by init(), and OAE85lParametrizedMagneticField().