CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

CylinderFromSectorMFGrid Class Reference

#include <CylinderFromSectorMFGrid.h>

Inheritance diagram for CylinderFromSectorMFGrid:
MFGrid MagneticFieldProvider< float >

List of all members.

Public Member Functions

 CylinderFromSectorMFGrid (const GloballyPositioned< float > &vol, double phiMin, double phiMax, MFGrid *sectorGrid)
virtual Dimensions dimensions () const
virtual LocalPoint fromGridFrame (double a, double b, double c) const
 find grid coordinates for point. For debugging and validation only.
virtual LocalPoint nodePosition (int i, int j, int k) const
 Position of node in local frame.
virtual LocalVector nodeValue (int i, int j, int k) const
 Field value at node.
virtual void toGridFrame (const LocalPoint &p, double &a, double &b, double &c) const
 find grid coordinates for point. For debugging and validation only.
virtual LocalVector valueInTesla (const LocalPoint &p) const
 Interpolated field value at given point.
 ~CylinderFromSectorMFGrid ()

Private Member Functions

void throwUp (const char *message) const

Private Attributes

double theDelta
double thePhiMax
double thePhiMin
MFGridtheSectorGrid

Detailed Description

Definition at line 7 of file CylinderFromSectorMFGrid.h.


Constructor & Destructor Documentation

CylinderFromSectorMFGrid::CylinderFromSectorMFGrid ( const GloballyPositioned< float > &  vol,
double  phiMin,
double  phiMax,
MFGrid sectorGrid 
)

Definition at line 5 of file CylinderFromSectorMFGrid.cc.

References pi, theDelta, thePhiMax, and thePhiMin.

CylinderFromSectorMFGrid::~CylinderFromSectorMFGrid ( )

Definition at line 15 of file CylinderFromSectorMFGrid.cc.

References theSectorGrid.

{
  delete theSectorGrid;
}

Member Function Documentation

Dimensions CylinderFromSectorMFGrid::dimensions ( void  ) const [virtual]

Implements MFGrid.

Definition at line 55 of file CylinderFromSectorMFGrid.cc.

References MFGrid::dimensions(), and theSectorGrid.

MFGrid::LocalPoint CylinderFromSectorMFGrid::fromGridFrame ( double  a,
double  b,
double  c 
) const [virtual]

find grid coordinates for point. For debugging and validation only.

Implements MFGrid.

Definition at line 49 of file CylinderFromSectorMFGrid.cc.

References throwUp().

{
  throwUp("Not implemented yet");
  return LocalPoint();
}
MFGrid::LocalPoint CylinderFromSectorMFGrid::nodePosition ( int  i,
int  j,
int  k 
) const [virtual]

Position of node in local frame.

Implements MFGrid.

Definition at line 58 of file CylinderFromSectorMFGrid.cc.

References throwUp().

{
  throwUp("Not implemented yet");
  return LocalPoint();
}
MFGrid::LocalVector CylinderFromSectorMFGrid::nodeValue ( int  i,
int  j,
int  k 
) const [virtual]

Field value at node.

Implements MFGrid.

Definition at line 64 of file CylinderFromSectorMFGrid.cc.

References throwUp().

{
  throwUp("Not implemented yet");
  return LocalVector();
}
void CylinderFromSectorMFGrid::throwUp ( const char *  message) const [private]

Definition at line 39 of file CylinderFromSectorMFGrid.cc.

References gather_cfg::cout.

Referenced by fromGridFrame(), nodePosition(), nodeValue(), and toGridFrame().

{
  std::cout << "Throwing exception " << message << std::endl;
  throw MagGeometryError(message);
}
void CylinderFromSectorMFGrid::toGridFrame ( const LocalPoint p,
double &  a,
double &  b,
double &  c 
) const [virtual]

find grid coordinates for point. For debugging and validation only.

Implements MFGrid.

Definition at line 44 of file CylinderFromSectorMFGrid.cc.

References throwUp().

{
  throwUp("Not implemented yet");
}
MFGrid::LocalVector CylinderFromSectorMFGrid::valueInTesla ( const LocalPoint p) const [virtual]

Interpolated field value at given point.

Implements MFGrid.

Definition at line 20 of file CylinderFromSectorMFGrid.cc.

References trackerHits::c, funct::cos(), phi, alignCSCRings::s, funct::sin(), theDelta, thePhiMin, theSectorGrid, tmp, and MFGrid::valueInTesla().

{
  double phi = p.phi();
  if (phi < thePhiMax && phi > thePhiMin) return theSectorGrid->valueInTesla(p);
  else {
    double phiRot = floor((phi-thePhiMin)/theDelta) * theDelta;
    double c = cos(phiRot);
    double s = sin(phiRot);
    double xrot =  p.x()*c + p.y()*s;
    double yrot = -p.x()*s + p.y()*c;

    // get field in interpolation sector 
    MFGrid::LocalVector tmp = theSectorGrid->valueInTesla( LocalPoint(xrot,yrot,p.z()));

    // rotate field back to original sector
    return MFGrid::LocalVector( tmp.x()*c - tmp.y()*s, tmp.x()*s + tmp.y()*c, tmp.z());
  }
}

Member Data Documentation

Definition at line 33 of file CylinderFromSectorMFGrid.h.

Referenced by CylinderFromSectorMFGrid(), and valueInTesla().

Definition at line 31 of file CylinderFromSectorMFGrid.h.

Referenced by CylinderFromSectorMFGrid().

Definition at line 30 of file CylinderFromSectorMFGrid.h.

Referenced by CylinderFromSectorMFGrid(), and valueInTesla().

Definition at line 32 of file CylinderFromSectorMFGrid.h.

Referenced by dimensions(), valueInTesla(), and ~CylinderFromSectorMFGrid().