CMS 3D CMS Logo

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

#include <SimpleConeBounds.h>

Inheritance diagram for SimpleConeBounds:
Bounds

Public Member Functions

virtual Boundsclone () const
 
virtual bool inside (const Local3DPoint &p) const
 Determine if the point is inside the bounds. More...
 
virtual bool inside (const Local3DPoint &p, const LocalError &err, float scale) const
 Determine if a point is inside the bounds, taking error into account. More...
 
virtual bool inside (const Local2DPoint &p, const LocalError &err) const
 
virtual float length () const
 Length along Z. More...
 
Geom::Theta< float > openingAngle () const
 
 SimpleConeBounds (float zmin, float rmin_zmin, float rmax_zmin, float zmax, float rmin_zmax, float rmax_zmax)
 Construct from inner/outer radius on the two Z faces. More...
 
virtual float thickness () const
 
GlobalPoint vertex () const
 
virtual float width () const
 Maximum diameter. More...
 
- Public Member Functions inherited from Bounds
void computeSpan (Surface const &plane)
 
virtual bool inside (const Local2DPoint &p) const
 
virtual bool inside (const Local2DPoint &p, float tollerance) const
 Determine if a point is inside the bounds, taking a tollerance into account. More...
 
virtual bool inside (const Local2DPoint &p, const LocalError &err, float scale=1.f) const
 Determine if a 2D point is inside the bounds, taking error into account. More...
 
std::pair< float, float > const & phiSpan () const
 
std::pair< float, float > const & rSpan () const
 
virtual float widthAtHalfLength () const
 Width at half length. Useful for e.g. pitch definition. More...
 
std::pair< float, float > const & zSpan () const
 
virtual ~Bounds ()
 

Private Attributes

float theRmaxZmax
 
float theRmaxZmin
 
float theRminZmax
 
float theRminZmin
 
float theZmax
 
float theZmin
 

Detailed Description

Cone bounds. The cone axis coincides with the Z axis. The bounds limit the length at constant Z, and allow finite thickness.

Warning
: should be revised, probably works only when local and global Z axis coincide

Definition at line 24 of file SimpleConeBounds.h.

Constructor & Destructor Documentation

SimpleConeBounds::SimpleConeBounds ( float  zmin,
float  rmin_zmin,
float  rmax_zmin,
float  zmax,
float  rmin_zmax,
float  rmax_zmax 
)
inline

Construct from inner/outer radius on the two Z faces.

Definition at line 28 of file SimpleConeBounds.h.

References std::swap(), theRmaxZmax, theRmaxZmin, theRminZmax, theRminZmin, theZmax, and theZmin.

Referenced by clone().

Member Function Documentation

virtual Bounds* SimpleConeBounds::clone ( void  ) const
inlinevirtual

Implements Bounds.

Definition at line 72 of file SimpleConeBounds.h.

References SimpleConeBounds().

72  {
73  return new SimpleConeBounds(*this);
74  }
SimpleConeBounds(float zmin, float rmin_zmin, float rmax_zmin, float zmax, float rmin_zmax, float rmax_zmax)
Construct from inner/outer radius on the two Z faces.
virtual bool SimpleConeBounds::inside ( const Local3DPoint ) const
inlinevirtual

Determine if the point is inside the bounds.

Implements Bounds.

Definition at line 51 of file SimpleConeBounds.h.

References PV3DBase< T, PVType, FrameType >::perp(), theRmaxZmax, theRmaxZmin, theRminZmax, theRminZmin, theZmax, theZmin, and PV3DBase< T, PVType, FrameType >::z().

Referenced by inside().

51  {
52  float lrmin = (p.z()-theZmin)*(theRminZmax-theRminZmin)/(theZmax-theZmin);
53  float lrmax = (p.z()-theZmin)*(theRmaxZmax-theRmaxZmin)/(theZmax-theZmin);
54  return p.z() > theZmin && p.z() < theZmax &&
55  p.perp() > lrmin && p.perp() < lrmax;
56  }
virtual bool SimpleConeBounds::inside ( const Local3DPoint ,
const LocalError ,
float  scale 
) const
inlinevirtual

Determine if a point is inside the bounds, taking error into account.

Implements Bounds.

Definition at line 58 of file SimpleConeBounds.h.

References inside(), mathSSE::sqrt(), theRmaxZmax, theRmaxZmin, theRminZmax, theRminZmin, theZmax, theZmin, tmp, and LocalError::yy().

58  {
59  // std::cout << "WARNING: SimpleConeBounds::inside(const Local3DPoint&, const LocalError not fully implemented"
60  // << std::endl; // FIXME! does not check R.
63  theZmax+ sqrt(err.yy())*scale,
65  return tmp.inside(p);
66  }
T sqrt(T t)
Definition: SSEVec.h:48
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
virtual bool SimpleConeBounds::inside ( const Local2DPoint p,
const LocalError err 
) const
inlinevirtual

Definition at line 68 of file SimpleConeBounds.h.

References Bounds::inside().

68  {
69  return Bounds::inside(p,err);
70  }
virtual bool inside(const Local3DPoint &) const =0
Determine if the point is inside the bounds.
virtual float SimpleConeBounds::length ( ) const
inlinevirtual
Geom::Theta<float> SimpleConeBounds::openingAngle ( ) const
inline

Definition at line 77 of file SimpleConeBounds.h.

References length(), Geom::pi(), theRmaxZmax, theRmaxZmin, theRminZmax, theRminZmin, and theta().

77  {
78  float theta = atan(((theRmaxZmax+theRminZmax)/2.-
80  return Geom::Theta<float>(theta < 0 ? theta+Geom::pi() : theta);
81  }
virtual float length() const
Length along Z.
Geom::Theta< T > theta() const
double pi()
Definition: Pi.h:31
virtual float SimpleConeBounds::thickness ( ) const
inlinevirtual

Thickness in the middle (Z center). Maybe it's useless, but it is pure abstract in Bounds...

Implements Bounds.

Definition at line 46 of file SimpleConeBounds.h.

References theRmaxZmax, theRmaxZmin, theRminZmax, and theRminZmin.

GlobalPoint SimpleConeBounds::vertex ( ) const
inline

Definition at line 83 of file SimpleConeBounds.h.

References funct::abs(), bookConverter::max, theRmaxZmax, theRmaxZmin, theRminZmax, theRminZmin, theZmax, and theZmin.

83  {
84  float rAtZmax = (theRmaxZmax+theRminZmax)/2.;
85  float rAtZmin = (theRmaxZmin+theRminZmin)/2.;
86  float dr = (rAtZmax-rAtZmin);
87 
88  if (std::abs(dr) < 0.0001) { // handle degenerate case (cone->cylinder)
90  } else {
91  return GlobalPoint(0,0,(theZmin*rAtZmax - theZmax*rAtZmin)/dr);
92  }
93  }
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
virtual float SimpleConeBounds::width ( ) const
inlinevirtual

Member Data Documentation

float SimpleConeBounds::theRmaxZmax
private

Definition at line 101 of file SimpleConeBounds.h.

Referenced by inside(), openingAngle(), SimpleConeBounds(), thickness(), vertex(), and width().

float SimpleConeBounds::theRmaxZmin
private

Definition at line 98 of file SimpleConeBounds.h.

Referenced by inside(), openingAngle(), SimpleConeBounds(), thickness(), vertex(), and width().

float SimpleConeBounds::theRminZmax
private

Definition at line 100 of file SimpleConeBounds.h.

Referenced by inside(), openingAngle(), SimpleConeBounds(), thickness(), and vertex().

float SimpleConeBounds::theRminZmin
private

Definition at line 97 of file SimpleConeBounds.h.

Referenced by inside(), openingAngle(), SimpleConeBounds(), thickness(), and vertex().

float SimpleConeBounds::theZmax
private

Definition at line 99 of file SimpleConeBounds.h.

Referenced by inside(), length(), SimpleConeBounds(), and vertex().

float SimpleConeBounds::theZmin
private

Definition at line 96 of file SimpleConeBounds.h.

Referenced by inside(), length(), SimpleConeBounds(), and vertex().