Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:04:14

0001 
0002 
0003 #include "DataFormats/GeometrySurface/interface/Cone.h"
0004 #include "DataFormats/GeometrySurface/interface/TangentPlane.h"
0005 
0006 #include <iostream>
0007 
0008 ConstReferenceCountingPointer<TangentPlane> Cone::tangentPlane(const GlobalPoint&) const {
0009   // FIXME: to be implemented...
0010   std::cout << "*** WARNING: Cone::tangentPlane not implemented." << std::endl;
0011   abort();
0012   return ConstReferenceCountingPointer<TangentPlane>();
0013 }
0014 
0015 ConstReferenceCountingPointer<TangentPlane> Cone::tangentPlane(const LocalPoint&) const {
0016   // FIXME: to be implemented...
0017   std::cout << "*** WARNING: Cone::tangentPlane not implemented." << std::endl;
0018   abort();
0019   return ConstReferenceCountingPointer<TangentPlane>();
0020 }
0021 
0022 Surface::Side Cone::side(const GlobalPoint& p, Scalar tolerance) const {
0023   // FIXME: should be done in local coordinates as this is not correct in the case the verstex is not on the (global) Z axis!!!!
0024 
0025   // tolerance is interpreted as max distance from cone surface.
0026   // FIXME: check case when vertex().z()==inf.
0027   GlobalPoint p1(p.x(), p.y(), p.z() - vertex().z());
0028 
0029   // handle the singularity of p=vertex (i.e. p1.mag() undefined)
0030   if (p1.mag() < tolerance)
0031     return SurfaceOrientation::onSurface;
0032   double delta = double(p1.theta()) - double(openingAngle());
0033   if (fabs(delta) < tolerance / p1.mag())
0034     return SurfaceOrientation::onSurface;
0035 
0036   if (p1.theta() < Geom::pi() / 2.) {
0037     return (delta > 0. ? SurfaceOrientation::positiveSide : SurfaceOrientation::negativeSide);
0038   } else {
0039     return (delta > 0. ? SurfaceOrientation::negativeSide : SurfaceOrientation::positiveSide);
0040   }
0041 }