CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Private Attributes
Cylinder Class Reference

#include <Cylinder.h>

Inheritance diagram for Cylinder:
Surface GloballyPositioned< float > BasicReferenceCounted

Public Types

typedef
ReferenceCountingPointer
< Cylinder
BoundCylinderPointer
 
typedef
ConstReferenceCountingPointer
< Cylinder
ConstBoundCylinderPointer
 
typedef
ConstReferenceCountingPointer
< Cylinder
ConstCylinderPointer
 
typedef
ReferenceCountingPointer
< Cylinder
CylinderPointer
 
- Public Types inherited from Surface
typedef GloballyPositioned< float > Base
 
typedef SurfaceOrientation::Side Side
 
- Public Types inherited from GloballyPositioned< float >
typedef Point3DBase< float,
GlobalTag
GlobalPoint
 
typedef Vector3DBase< float,
GlobalTag
GlobalVector
 
typedef Point3DBase< float,
LocalTag
LocalPoint
 
typedef Vector3DBase< float,
LocalTag
LocalVector
 
typedef Point3DBase< float,
GlobalTag
PositionType
 
typedef TkRotation< float > RotationType
 
typedef float Scalar
 

Public Member Functions

template<typename... Args>
 Cylinder (Scalar radius, Args &&...args)
 
 Cylinder (const PositionType &pos, const RotationType &rot, SimpleCylinderBounds const &bounds)
 
Plane fastTangent (const GlobalPoint &aPoint) const
 tangent plane to surface from global point More...
 
Plane fastTangent (const LocalPoint &aPoint) const
 tangent plane to surface from local point More...
 
Scalar radius () const
 Radius of the cylinder. More...
 
virtual Side side (const LocalPoint &p, Scalar toler) const
 
virtual
ConstReferenceCountingPointer
< TangentPlane
tangentPlane (const GlobalPoint &) const
 tangent plane to surface from global point More...
 
virtual
ConstReferenceCountingPointer
< TangentPlane
tangentPlane (const LocalPoint &) const
 tangent plane to surface from local point More...
 
 ~Cylinder ()
 
- Public Member Functions inherited from Surface
const Boundsbounds () const
 
const MediumPropertiesmediumProperties () const
 
std::pair< float, float > const & phiSpan () const
 
std::pair< float, float > const & rSpan () const
 
void setMediumProperties (const MediumProperties &mp)
 
virtual Side side (const GlobalPoint &p, Scalar tolerance=0) const
 
GlobalPoint toGlobal (const Point2DBase< Scalar, LocalTag > lp) const
 
std::pair< float, float > const & zSpan () const
 
virtual ~Surface ()
 
- Public Member Functions inherited from GloballyPositioned< float >
float eta () const
 
 GloballyPositioned ()
 
 GloballyPositioned (const PositionType &pos, const RotationType &rot)
 
void move (const GlobalVector &displacement)
 
float phi () const
 
const PositionTypeposition () const
 
void rotate (const RotationType &rotation)
 
const RotationTyperotation () const
 
GlobalPoint toGlobal (const LocalPoint &lp) const
 
Point3DBase< U, GlobalTagtoGlobal (const Point3DBase< U, LocalTag > &lp) const
 
GlobalVector toGlobal (const LocalVector &lv) const
 
Vector3DBase< U, GlobalTagtoGlobal (const Vector3DBase< U, LocalTag > &lv) const
 
LocalPoint toLocal (const GlobalPoint &gp) const
 
Point3DBase< U, LocalTagtoLocal (const Point3DBase< U, GlobalTag > &gp) const
 
LocalVector toLocal (const GlobalVector &gv) const
 
Vector3DBase< U, LocalTagtoLocal (const Vector3DBase< U, GlobalTag > &gv) const
 
virtual ~GloballyPositioned ()
 
- Public Member Functions inherited from BasicReferenceCounted
void addReference () const
 
 BasicReferenceCounted ()
 
 BasicReferenceCounted (const BasicReferenceCounted &)
 
const BasicReferenceCountedoperator= (const BasicReferenceCounted &)
 
unsigned int references () const
 
void removeReference () const
 
virtual ~BasicReferenceCounted ()
 

Static Public Member Functions

static CylinderPointer build (const PositionType &pos, const RotationType &rot, Scalar radius, Bounds *bounds=0)
 
static CylinderPointer build (Scalar radius, const PositionType &pos, const RotationType &rot, Bounds *bounds=0)
 
static float computeRadius (Bounds const &bounds)
 
- Static Public Member Functions inherited from GloballyPositioned< float >
static float iniEta ()
 
static float iniPhi ()
 

Private Attributes

Scalar theRadius
 

Additional Inherited Members

- Protected Member Functions inherited from Surface
 Surface ()
 
 Surface (const PositionType &pos, const RotationType &rot)
 
 Surface (const PositionType &pos, const RotationType &rot, Bounds *bounds)
 
 Surface (const PositionType &pos, const RotationType &rot, MediumProperties mp)
 
 Surface (const PositionType &pos, const RotationType &rot, MediumProperties mp, Bounds *bounds)
 
 Surface (const Surface &iSurface)
 
- Protected Attributes inherited from Surface
BoundstheBounds
 
MediumProperties theMediumProperties
 

Detailed Description

A Cylinder.

Warning
Surfaces are reference counted, so only ReferenceCountingPointer should be used to point to them. For this reason, they should be using the static build() methods. (The normal constructor will become private in the future).

Definition at line 19 of file Cylinder.h.

Member Typedef Documentation

Definition at line 37 of file Cylinder.h.

Definition at line 38 of file Cylinder.h.

Definition at line 36 of file Cylinder.h.

Definition at line 35 of file Cylinder.h.

Constructor & Destructor Documentation

template<typename... Args>
Cylinder::Cylinder ( Scalar  radius,
Args &&...  args 
)
inline

Definition at line 23 of file Cylinder.h.

Referenced by build().

23  :
24  Surface(std::forward<Args>(args)...), theRadius(radius){}
Surface()
Definition: Surface.h:59
Scalar radius() const
Radius of the cylinder.
Definition: Cylinder.h:67
Scalar theRadius
Definition: Cylinder.h:93
Cylinder::Cylinder ( const PositionType pos,
const RotationType rot,
SimpleCylinderBounds const &  bounds 
)
inline

Definition at line 26 of file Cylinder.h.

26  :
const Bounds & bounds() const
Definition: Surface.h:128
Surface()
Definition: Surface.h:59
Scalar theRadius
Definition: Cylinder.h:93
static float computeRadius(Bounds const &bounds)
Definition: Cylinder.h:30
virtual Bounds * clone() const =0
Cylinder::~Cylinder ( )
inline

Definition at line 61 of file Cylinder.h.

61 {}

Member Function Documentation

static CylinderPointer Cylinder::build ( const PositionType pos,
const RotationType rot,
Scalar  radius,
Bounds bounds = 0 
)
inlinestatic
static CylinderPointer Cylinder::build ( Scalar  radius,
const PositionType pos,
const RotationType rot,
Bounds bounds = 0 
)
inlinestatic

Definition at line 56 of file Cylinder.h.

References Surface::bounds(), and Cylinder().

Referenced by psClasses.BuildThread::run().

57  {
58  return CylinderPointer(new Cylinder(radius,pos,rot,bounds));
59  }
Cylinder(Scalar radius, Args &&...args)
Definition: Cylinder.h:23
Scalar radius() const
Radius of the cylinder.
Definition: Cylinder.h:67
ReferenceCountingPointer< Cylinder > CylinderPointer
Definition: Cylinder.h:35
static float Cylinder::computeRadius ( Bounds const &  bounds)
inlinestatic

Definition at line 30 of file Cylinder.h.

References Bounds::thickness(), and Bounds::width().

Referenced by CylinderBuilderFromDet::build(), BarrelDetLayer::computeSurface(), initCylinder(), CylinderBuilderFromDet::operator()(), and TkConvValidator::recalculateMomentumAtFittedVertex().

30  {
31  return 0.5f*(bounds.width() - bounds.thickness());
32  }
const Bounds & bounds() const
Definition: Surface.h:128
virtual float thickness() const =0
virtual float width() const =0
Plane Cylinder::fastTangent ( const GlobalPoint aPoint) const
inline

tangent plane to surface from global point

Definition at line 80 of file Cylinder.h.

References Vector3DBase< T, FrameTag >::cross(), GloballyPositioned< float >::position(), GloballyPositioned< float >::rotation(), and z.

Referenced by fastTangent().

80  {
81  GlobalVector yPlane(rotation().z());
82  GlobalVector xPlane(yPlane.cross(aPoint-position()));
83  return Plane(aPoint,RotationType(xPlane, yPlane));
84  }
Definition: Plane.h:17
TkRotation< float > RotationType
const RotationType & rotation() const
const PositionType & position() const
Plane Cylinder::fastTangent ( const LocalPoint aPoint) const
inline

tangent plane to surface from local point

Definition at line 87 of file Cylinder.h.

References fastTangent(), and Surface::toGlobal().

87  {
88  return fastTangent(toGlobal(aPoint));
89  }
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:114
Plane fastTangent(const GlobalPoint &aPoint) const
tangent plane to surface from global point
Definition: Cylinder.h:80
Scalar Cylinder::radius ( ) const
inline
Surface::Side Cylinder::side ( const LocalPoint p,
Scalar  tolerance 
) const
virtual

Returns the side of the surface on which the point is. Not defined for 1-sided surfaces (Moebius leaf etc.) For normal 2-sided surfaces the meaning of side is surface type dependent.

Implements Surface.

Definition at line 9 of file Cylinder.cc.

References SurfaceOrientation::negativeSide, SurfaceOrientation::onSurface, PV3DBase< T, PVType, FrameType >::perp(), SurfaceOrientation::positiveSide, and radius().

Referenced by Geant4ePropagator::configureAnyPropagation().

10 {
11  Scalar lz = p.perp() - radius();
12  return (fabs(lz)<toler ? SurfaceOrientation::onSurface :
14 }
T perp() const
Definition: PV3DBase.h:72
Scalar radius() const
Radius of the cylinder.
Definition: Cylinder.h:67
ConstReferenceCountingPointer< TangentPlane > Cylinder::tangentPlane ( const GlobalPoint aPoint) const
virtual

tangent plane to surface from global point

Implements Surface.

Definition at line 23 of file Cylinder.cc.

References funct::abs(), Vector3DBase< T, FrameTag >::cross(), bookConverter::max, GloballyPositioned< float >::position(), GloballyPositioned< float >::rotation(), findQualityFiles::size, and z.

Referenced by tangentPlane().

24 {
25  //
26  // Tangent plane at specified point. In order to avoid
27  // possible numerical problems currently no attempt is made
28  // to verify, if the point is actually on the cylinder.
29  //
30  // local y parallel to axis
31  GlobalVector yPlane(rotation().z());
32  // local x normal to y and a vector linking the specified
33  // point with the axis
34  GlobalVector xPlane(yPlane.cross(aPoint-position()));
35  Scalar size = std::max(std::max(std::abs(xPlane.x()),std::abs(xPlane.y())), std::abs(xPlane.z()));
36  if ( size<FLT_MIN )
37  throw GeometryError("Attempt to construct TangentPlane on cylinder axis");
38 // // local z defined by x and y (should point outwards from axis)
39 // GlobalVector zPlane(xPlane.cross(yPlane));
40  // rotation constructor will normalize...
42  RotationType(xPlane,
43  yPlane)
44  ));
45 }
Plane TangentPlane
Definition: Surface.h:32
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
TkRotation< float > RotationType
const RotationType & rotation() const
const PositionType & position() const
tuple size
Write out results.
ConstReferenceCountingPointer< TangentPlane > Cylinder::tangentPlane ( const LocalPoint aPoint) const
virtual

tangent plane to surface from local point

Implements Surface.

Definition at line 17 of file Cylinder.cc.

References tangentPlane(), and Surface::toGlobal().

18 {
19  return tangentPlane(toGlobal(aPoint));
20 }
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:114
virtual ConstReferenceCountingPointer< TangentPlane > tangentPlane(const GlobalPoint &) const
tangent plane to surface from global point
Definition: Cylinder.cc:23

Member Data Documentation

Scalar Cylinder::theRadius
private

Definition at line 93 of file Cylinder.h.

Referenced by radius().