CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_1/src/DataFormats/GeometrySurface/src/GeneralNSurfaceDelimitedBounds.cc

Go to the documentation of this file.
00001 
00002 
00003 #include "DataFormats/GeometrySurface/interface/GeneralNSurfaceDelimitedBounds.h"
00004 #include "DataFormats/GeometrySurface/interface/LocalError.h"
00005 
00006 bool GeneralNSurfaceDelimitedBounds::inside( const Local3DPoint& lp, 
00007                                              const LocalError& le, float scale) const
00008 {
00009     // derive on-surface tolerance from LocalError in a very approximate way
00010     float tolerance = scale * sqrt( le.xx()*le.xx() + le.yy()*le.yy());
00011 
00012     return myInside( lp, tolerance);
00013 }
00014 
00015 bool GeneralNSurfaceDelimitedBounds::myInside( const Local3DPoint& lp, float tolerance) const
00016 {
00017     // cout << "GeneralNSurfaceDelimitedBounds::myInside called with local point " << lp << endl;
00018 
00019     Surface::GlobalPoint gp = theSurface->toGlobal(lp);
00020 
00021     // cout << "corresponding Global point " << gp << endl;
00022 
00023     for (SurfaceContainer::const_iterator i=theLimits.begin(); i!=theLimits.end(); i++) {
00024 
00025 //      cout << "Local pos in boundary surface " <<  i->first->toLocal(gp) 
00026 //           << " side " << i->first->side(gp, tolerance) << " should be " 
00027 //           << i->second << endl;
00028 
00029         SurfaceOrientation::Side side = i->first->side(gp, tolerance);
00030         if (side != i->second && side != SurfaceOrientation::onSurface) return false;
00031     }
00032     return true;
00033 }