Go to the documentation of this file.00001
00002
00003 #include "DataFormats/GeometrySurface/interface/SimpleDiskBounds.h"
00004 #include "DataFormats/GeometrySurface/interface/LocalError.h"
00005 #include <algorithm>
00006 #include <cmath>
00007
00008 SimpleDiskBounds::SimpleDiskBounds( float rmin, float rmax, float zmin, float zmax) :
00009 theRmin(rmin), theRmax(rmax), theZmin(zmin), theZmax(zmax) {
00010 if ( theRmin > theRmax) std::swap( theRmin, theRmax);
00011 if ( theZmin > theZmax) std::swap( theZmin, theZmax);
00012 }
00013
00014 bool SimpleDiskBounds::inside( const Local3DPoint& p) const {
00015 return p.z() > theZmin && p.z() < theZmax &&
00016 p.perp() > theRmin && p.perp() < theRmax;
00017 }
00018
00019 bool SimpleDiskBounds::inside( const Local2DPoint& p, const LocalError& err) const {
00020 return Bounds::inside(p,err);
00021 }
00022
00023 Bounds* SimpleDiskBounds::clone() const {
00024 return new SimpleDiskBounds(*this);
00025 }
00026
00027
00028
00029 bool SimpleDiskBounds::inside( const Local3DPoint& p, const LocalError& err, float scale) const
00030 {
00031 if (p.z() < theZmin || p.z() > theZmax) return false;
00032
00033 double perp2 = p.perp2();
00034 double perp = sqrt(perp2);
00035 if (perp2 == 0) return scale*scale*(err.xx() + err.xy()) > theRmin*theRmin;
00036
00037
00038
00039
00040 float deltaR = scale * sqrt( p.x()*p.x()/perp2 * err.xx() -
00041 2*p.x()*p.y()/perp2 * err.xy() +
00042 p.y()*p.y()/perp2 * err.yy());
00043 return perp > std::max(theRmin-deltaR, 0.f) && perp < theRmax+deltaR;
00044 }