CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
MagCylinder.cc
Go to the documentation of this file.
1 //
2 //#include "Utilities/Configuration/interface/Architecture.h"
3 
7 
9  const RotationType& rot,
10  DDSolidShape shape,
11  const std::vector<VolumeSide>& faces,
12  const MagneticFieldProvider<float> * mfp)
13  : MagVolume(pos,rot,shape,mfp), theFaces(faces), theZmin(0.), theZmax(0.), theInnerR(0.), theOuterR(0.)
14 {
16 
17  unsigned int def = 0;
18  for (std::vector<VolumeSide>::const_iterator i=faces.begin(); i!= faces.end(); ++i) {
19  if (i->globalFace() == SurfaceOrientation::zminus) {
20  theZmin = MagVolume::toLocal( i->surface().position()).z();
21  ++def;
22  }
23  else if (i->globalFace() == SurfaceOrientation::zplus) {
24  theZmax = MagVolume::toLocal( i->surface().position()).z();
25  ++def;
26  }
27  else if (i->globalFace() == SurfaceOrientation::outer || i->globalFace() == SurfaceOrientation::inner) {
28  const Cylinder* cyl = dynamic_cast<const Cylinder*>(&(i->surface()));
29  if (cyl == 0) {
30  throw MagGeometryError("MagCylinder inner/outer surface is not a cylinder");
31  }
32  if (i->globalFace() == SurfaceOrientation::outer) theOuterR = cyl->radius();
33  else theInnerR = cyl->radius();
34  ++def;
35  }
36  }
37  if (def != faces.size()) {
38  throw MagGeometryError("MagCylinder constructed with wrong number/type of faces");
39  }
40 
41 }
42 
43 bool MagCylinder::inside( const GlobalPoint& gp, double tolerance) const
44 {
45  return inside( toLocal(gp), tolerance);
46 }
47 
48 bool MagCylinder::inside( const LocalPoint& lp, double tolerance) const
49 {
50  Scalar r( lp.perp());
51  return
52  lp.z() > theZmin - tolerance &&
53  lp.z() < theZmax + tolerance &&
54  r > theInnerR - tolerance &&
55  r < theOuterR + tolerance;
56 }
int i
Definition: DBlmapReader.cc:9
Scalar theZmax
Definition: MagCylinder.h:37
GloballyPositioned< float >::GlobalPoint GlobalPoint
Definition: MagVolume.h:20
DDSolidShape
Definition: DDSolidShapes.h:6
float float float z
Scalar theInnerR
Definition: MagCylinder.h:38
GloballyPositioned< float >::LocalPoint LocalPoint
Definition: MagVolume.h:18
LocalPoint toLocal(const GlobalPoint &gp) const
virtual bool inside(const GlobalPoint &gp, double tolerance=0.) const
Definition: MagCylinder.cc:43
MagCylinder(const PositionType &pos, const RotationType &rot, DDSolidShape shape, const std::vector< VolumeSide > &faces, const MagneticFieldProvider< float > *mfp)
Definition: MagCylinder.cc:8
Scalar theOuterR
Definition: MagCylinder.h:39
Scalar theZmin
Definition: MagCylinder.h:36
JetCorrectorParameters::Definitions def
Definition: classes.h:12