CMS 3D CMS Logo

SimpleConeBounds Class Reference

Cone bounds. More...

#include <DataFormats/GeometrySurface/interface/SimpleConeBounds.h>

Inheritance diagram for SimpleConeBounds:

Bounds

List of all members.

Public Member Functions

virtual Boundsclone () const
virtual bool inside (const Local2DPoint &p, const LocalError &err) const
virtual bool inside (const Local3DPoint &p, const LocalError &err, float scale) const
 Determine if a point is inside the bounds, taking error into account.
virtual bool inside (const Local3DPoint &p) const
 Determine if the point is inside the bounds.
virtual float length () const
 Length along Z.
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.
virtual float thickness () const
 Thickness in the middle (Z center).
GlobalPoint vertex () const
virtual float width () const
 Maximum diameter.

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
Date
2007/01/17 20:58:44
Revision
1.1

Definition at line 26 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 30 of file SimpleConeBounds.h.

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

Referenced by clone().

00031                                                                   : 
00032     theZmin(zmin), theRminZmin(rmin_zmin), theRmaxZmin(rmax_zmin),
00033     theZmax(zmax), theRminZmax(rmin_zmax), theRmaxZmax(rmax_zmax) {
00034     if (theZmin > theZmax) {
00035       std::swap(theRminZmin, theRminZmax);
00036       std::swap(theRmaxZmin, theRmaxZmax);
00037     }
00038     if (theRminZmin > theRmaxZmin) std::swap(theRminZmin, theRmaxZmin);    
00039     if (theRminZmax > theRmaxZmax) std::swap(theRminZmax, theRmaxZmax);
00040   }


Member Function Documentation

virtual Bounds* SimpleConeBounds::clone ( void   )  const [inline, virtual]

Implements Bounds.

Definition at line 72 of file SimpleConeBounds.h.

References SimpleConeBounds().

00072                                 { 
00073     return new SimpleConeBounds(*this);
00074   }

virtual bool SimpleConeBounds::inside ( const Local2DPoint p,
const LocalError err 
) const [inline, virtual]

Definition at line 68 of file SimpleConeBounds.h.

References Bounds::inside().

00068                                                                            {
00069     return Bounds::inside(p,err);
00070   }

virtual bool SimpleConeBounds::inside ( const Local3DPoint ,
const LocalError ,
float  scale 
) const [inline, virtual]

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

Implements Bounds.

Definition at line 58 of file SimpleConeBounds.h.

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

00058                                                                                         {
00059     // std::cout << "WARNING: SimpleConeBounds::inside(const Local3DPoint&, const LocalError not fully implemented" 
00060     //        << std::endl;     // FIXME! does not check R.
00061     SimpleConeBounds tmp(theZmin - sqrt(err.yy())*scale,
00062                          theRminZmin, theRmaxZmin,
00063                          theZmax+ sqrt(err.yy())*scale,
00064                          theRminZmax, theRmaxZmax);
00065     return tmp.inside(p);
00066   }

virtual bool SimpleConeBounds::inside ( const Local3DPoint  )  const [inline, virtual]

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().

00051                                                     {
00052     float lrmin = (p.z()-theZmin)*(theRminZmax-theRminZmin)/(theZmax-theZmin);
00053     float lrmax = (p.z()-theZmin)*(theRmaxZmax-theRmaxZmin)/(theZmax-theZmin);
00054     return p.z()    > theZmin && p.z()    < theZmax &&
00055            p.perp() > lrmin && p.perp() < lrmax;
00056   }

virtual float SimpleConeBounds::length (  )  const [inline, virtual]

Length along Z.

Implements Bounds.

Definition at line 43 of file SimpleConeBounds.h.

References theZmax, and theZmin.

Referenced by openingAngle().

00043 { return theZmax - theZmin;}

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.

00077                                         {
00078     float theta = atan(((theRmaxZmax+theRminZmax)/2.-
00079                         (theRmaxZmin+theRminZmin)/2.)/length());
00080     return Geom::Theta<float>(theta < 0 ? theta+Geom::pi() : theta);
00081   }

virtual float SimpleConeBounds::thickness (  )  const [inline, virtual]

Thickness in the middle (Z center).

Maybe it's useless, but it is pure abstract in Bounds...

Implements Bounds.

Definition at line 48 of file SimpleConeBounds.h.

References theRmaxZmax, theRmaxZmin, theRminZmax, and theRminZmin.

00048                                   { return ((theRmaxZmin-theRminZmin)+
00049                                             (theRmaxZmax-theRminZmax))/2.;}

GlobalPoint SimpleConeBounds::vertex (  )  const [inline]

Definition at line 83 of file SimpleConeBounds.h.

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

00083                             {
00084     float rAtZmax = (theRmaxZmax+theRminZmax)/2.;
00085     float rAtZmin = (theRmaxZmin+theRminZmin)/2.;
00086     float dr = (rAtZmax-rAtZmin);
00087 
00088     if (std::abs(dr) < 0.0001) { // handle degenerate case (cone->cylinder)
00089       return GlobalPoint(0,0,std::numeric_limits<float>::max());
00090     } else {
00091       return GlobalPoint(0,0,(theZmin*rAtZmax - theZmax*rAtZmin)/dr);
00092     }
00093   }

virtual float SimpleConeBounds::width (  )  const [inline, virtual]

Maximum diameter.

Implements Bounds.

Definition at line 45 of file SimpleConeBounds.h.

References max, theRmaxZmax, and theRmaxZmin.

00045 { return 2*std::max(theRmaxZmin,theRmaxZmax);}


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().


The documentation for this class was generated from the following file:
Generated on Tue Jun 9 18:31:37 2009 for CMSSW by  doxygen 1.5.4