CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/DataFormats/GeometrySurface/src/Cone.cc

Go to the documentation of this file.
00001 
00002 
00003 #include "DataFormats/GeometrySurface/interface/Cone.h"
00004 #include "DataFormats/GeometrySurface/interface/TangentPlane.h"
00005 
00006 #include <iostream>
00007 
00008 ReferenceCountingPointer<TangentPlane> Cone::tangentPlane (const GlobalPoint&) const {
00009   // FIXME: to be implemented...
00010   std::cout << "*** WARNING: Cone::tangentPlane not implemented." <<std::endl;
00011   abort();
00012   return ReferenceCountingPointer<TangentPlane>();
00013 }
00014 
00015 ReferenceCountingPointer<TangentPlane> Cone::tangentPlane (const LocalPoint&) const {
00016   // FIXME: to be implemented...
00017   std::cout << "*** WARNING: Cone::tangentPlane not implemented." <<std::endl;
00018   abort();
00019   return ReferenceCountingPointer<TangentPlane>();
00020 }
00021 
00022 Surface::Side Cone::side( const GlobalPoint& p, Scalar tolerance) const {
00023   // FIXME: should be done in local coordinates as this is not correct in the case the verstex is not on the (global) Z axis!!!!
00024 
00025   // tolerance is interpreted as max distance from cone surface.
00026   // FIXME: check case when vertex().z()==inf.
00027   GlobalPoint p1(p.x(), p.y(), p.z()-vertex().z());
00028 
00029   // handle the singularity of p=vertex (i.e. p1.mag() undefined)
00030   if (p1.mag()<tolerance) return SurfaceOrientation::onSurface;
00031   double delta = double(p1.theta())- double(openingAngle());
00032   if (fabs(delta) < tolerance/p1.mag()) return SurfaceOrientation::onSurface;
00033   
00034   if (p1.theta() < Geom::pi()/2.) {
00035     return (delta>0. ?  SurfaceOrientation::positiveSide : SurfaceOrientation::negativeSide);
00036   } else {
00037     return (delta>0. ?  SurfaceOrientation::negativeSide : SurfaceOrientation::positiveSide);
00038   }
00039 }