CMS 3D CMS Logo

Public Member Functions | Public Attributes | Private Attributes

MagCylinder Class Reference

#include <MagCylinder.h>

Inheritance diagram for MagCylinder:
MagVolume GloballyPositioned< float > MagneticField

List of all members.

Public Member Functions

virtual const std::vector
< VolumeSide > & 
faces () const
 Access to volume faces.
virtual bool inside (const GlobalPoint &gp, double tolerance=0.) const
virtual bool inside (const LocalPoint &lp, double tolerance=0.) const
 MagCylinder (const PositionType &pos, const RotationType &rot, DDSolidShape shape, const std::vector< VolumeSide > &faces, const MagneticFieldProvider< float > *mfp)

Public Attributes

std::string name

Private Attributes

std::vector< VolumeSidetheFaces
Scalar theInnerR
Scalar theOuterR
Scalar theZmax
Scalar theZmin

Detailed Description

Definition at line 16 of file MagCylinder.h.


Constructor & Destructor Documentation

MagCylinder::MagCylinder ( const PositionType pos,
const RotationType rot,
DDSolidShape  shape,
const std::vector< VolumeSide > &  faces,
const MagneticFieldProvider< float > *  mfp 
)

Definition at line 8 of file MagCylinder.cc.

References def, i, SurfaceOrientation::inner, SurfaceOrientation::outer, Cylinder::radius(), theInnerR, theOuterR, theZmax, theZmin, GloballyPositioned< float >::toLocal(), z, SurfaceOrientation::zminus, and SurfaceOrientation::zplus.

  : MagVolume(pos,rot,shape,mfp), theFaces(faces), theZmin(0.), theZmax(0.), theInnerR(0.), theOuterR(0.)
{
  using SurfaceOrientation::GlobalFace;

  unsigned int def = 0;
  for (std::vector<VolumeSide>::const_iterator i=faces.begin(); i!= faces.end(); ++i) {
    if (i->globalFace() == SurfaceOrientation::zminus) {
      theZmin = MagVolume::toLocal( i->surface().position()).z();
      ++def;
    }
    else if (i->globalFace() == SurfaceOrientation::zplus) {
      theZmax = MagVolume::toLocal( i->surface().position()).z();
      ++def;
    }
    else if (i->globalFace() == SurfaceOrientation::outer || i->globalFace() == SurfaceOrientation::inner) {
      const Cylinder* cyl = dynamic_cast<const Cylinder*>(&(i->surface()));
      if (cyl == 0) {
        throw MagGeometryError("MagCylinder inner/outer surface is not a cylinder");
      }
      if (i->globalFace() == SurfaceOrientation::outer) theOuterR = cyl->radius();
      else                                              theInnerR = cyl->radius();
      ++def;
    }
  }
  if (def != faces.size()) {
    throw MagGeometryError("MagCylinder constructed with wrong number/type of faces");
  }
  
}

Member Function Documentation

virtual const std::vector<VolumeSide>& MagCylinder::faces ( ) const [inline, virtual]

Access to volume faces.

Implements MagVolume.

Definition at line 27 of file MagCylinder.h.

References theFaces.

{return theFaces;}
bool MagCylinder::inside ( const GlobalPoint gp,
double  tolerance = 0. 
) const [virtual]

Implements MagVolume.

Definition at line 43 of file MagCylinder.cc.

References GloballyPositioned< float >::toLocal().

{
  return inside( toLocal(gp), tolerance);
}
bool MagCylinder::inside ( const LocalPoint lp,
double  tolerance = 0. 
) const [virtual]

Reimplemented from MagVolume.

Definition at line 48 of file MagCylinder.cc.

References alignCSCRings::r, theInnerR, theOuterR, theZmax, and theZmin.

{
  Scalar r( lp.perp());
  return 
    lp.z() > theZmin - tolerance &&
    lp.z() < theZmax + tolerance &&
    r      > theInnerR - tolerance && 
    r      < theOuterR + tolerance;
}

Member Data Documentation

std::string MagCylinder::name

Definition at line 30 of file MagCylinder.h.

std::vector<VolumeSide> MagCylinder::theFaces [private]

Definition at line 35 of file MagCylinder.h.

Referenced by faces().

Definition at line 38 of file MagCylinder.h.

Referenced by inside(), and MagCylinder().

Definition at line 39 of file MagCylinder.h.

Referenced by inside(), and MagCylinder().

Definition at line 37 of file MagCylinder.h.

Referenced by inside(), and MagCylinder().

Definition at line 36 of file MagCylinder.h.

Referenced by inside(), and MagCylinder().