CMS 3D CMS Logo

MagCylinder.cc
Go to the documentation of this file.
4 
6  const RotationType& rot,
7  const std::vector<VolumeSide>& faces,
9  : MagVolume(pos, rot, mfp), theFaces(faces), theZmin(0.), theZmax(0.), theInnerR(0.), theOuterR(0.) {
11 
12  unsigned int def = 0;
13  for (std::vector<VolumeSide>::const_iterator i = faces.begin(); i != faces.end(); ++i) {
14  if (i->globalFace() == SurfaceOrientation::zminus) {
15  theZmin = MagVolume::toLocal(i->surface().position()).z();
16  ++def;
17  } else if (i->globalFace() == SurfaceOrientation::zplus) {
18  theZmax = MagVolume::toLocal(i->surface().position()).z();
19  ++def;
20  } else if (i->globalFace() == SurfaceOrientation::outer || i->globalFace() == SurfaceOrientation::inner) {
21  const Cylinder* cyl = dynamic_cast<const Cylinder*>(&(i->surface()));
22  if (cyl == nullptr) {
23  throw MagGeometryError("MagCylinder inner/outer surface is not a cylinder");
24  }
25  if (i->globalFace() == SurfaceOrientation::outer)
26  theOuterR = cyl->radius();
27  else
28  theInnerR = cyl->radius();
29  ++def;
30  }
31  }
32  if (def != faces.size()) {
33  throw MagGeometryError("MagCylinder constructed with wrong number/type of faces");
34  }
35 }
36 
37 bool MagCylinder::inside(const GlobalPoint& gp, double tolerance) const { return inside(toLocal(gp), tolerance); }
38 
39 bool MagCylinder::inside(const LocalPoint& lp, double tolerance) const {
40  Scalar r(lp.perp());
41  return lp.z() > theZmin - tolerance && lp.z() < theZmax + tolerance && r > theInnerR - tolerance &&
42  r < theOuterR + tolerance;
43 }
mps_fire.i
i
Definition: mps_fire.py:428
Cylinder.h
Cylinder::radius
Scalar radius() const
Radius of the cylinder.
Definition: Cylinder.h:64
align::RotationType
TkRotation< Scalar > RotationType
Definition: Definitions.h:27
MagCylinder::MagCylinder
MagCylinder(const PositionType &pos, const RotationType &rot, const std::vector< VolumeSide > &faces, const MagneticFieldProvider< float > *mfp)
Definition: MagCylinder.cc:5
pos
Definition: PixelAliasList.h:18
MagCylinder::inside
bool inside(const GlobalPoint &gp, double tolerance=0.) const override
Definition: MagCylinder.cc:37
align::PositionType
Point3DBase< Scalar, GlobalTag > PositionType
Definition: Definitions.h:28
MagneticFieldProvider< float >
MagExceptions.h
MagVolume::GlobalPoint
GloballyPositioned< float >::GlobalPoint GlobalPoint
Definition: MagVolume.h:18
MagCylinder::theZmax
Scalar theZmax
Definition: MagCylinder.h:36
SurfaceOrientation::inner
Definition: Surface.h:19
DDAxes::z
MagCylinder.h
SurfaceOrientation::zminus
Definition: Surface.h:19
runTauDisplay.gp
gp
Definition: runTauDisplay.py:431
MagCylinder::faces
const std::vector< VolumeSide > & faces() const override
Access to volume faces.
Definition: MagCylinder.h:27
MagCylinder::theInnerR
Scalar theInnerR
Definition: MagCylinder.h:37
MagVolume
Definition: MagVolume.h:13
tolerance
const double tolerance
Definition: HGCalGeomParameters.cc:29
MagCylinder::theZmin
Scalar theZmin
Definition: MagCylinder.h:35
alignCSCRings.r
r
Definition: alignCSCRings.py:93
MagGeometryError
Definition: MagExceptions.h:18
GloballyPositioned< float >::toLocal
LocalPoint toLocal(const GlobalPoint &gp) const
Definition: GloballyPositioned.h:98
MagVolume::LocalPoint
GloballyPositioned< float >::LocalPoint LocalPoint
Definition: MagVolume.h:16
SurfaceOrientation::zplus
Definition: Surface.h:19
makeMuonMisalignmentScenario.rot
rot
Definition: makeMuonMisalignmentScenario.py:322
SurfaceOrientation::GlobalFace
GlobalFace
Definition: Surface.h:19
Cylinder
Definition: Cylinder.h:19
spu::def
int def(FILE *, FILE *, int)
Definition: SherpackUtilities.cc:14
SurfaceOrientation::outer
Definition: Surface.h:19
GloballyPositioned< float >::Scalar
float Scalar
Definition: GloballyPositioned.h:20
MagCylinder::theOuterR
Scalar theOuterR
Definition: MagCylinder.h:38