diff --git a/DDRec/include/DDRec/ISurface.h b/DDRec/include/DDRec/ISurface.h index b298416a9a88de34581d4144c937c2a5fce82333..4ad311c35810b6a64652f861d3919190cbbdba3a 100644 --- a/DDRec/include/DDRec/ISurface.h +++ b/DDRec/include/DDRec/ISurface.h @@ -138,7 +138,8 @@ namespace dd4hep { namespace rec { OrthogonalToZ, Invisible, Measurement1D, - Cone + Cone, + Unbounded } ; ///default c'tor @@ -222,6 +223,9 @@ namespace dd4hep { namespace rec { /// true if the measurement is only 1D, i.e. the second direction v is not used bool isMeasurement1D() const { return _bits[ SurfaceType::Measurement1D ] ; } + /// true if the surface is unbounded ( ISurface::insideBounds() does not check volume boundaries) + + bool isUnbounded() const { return _bits[ SurfaceType::Unbounded ] ; } /// true if all properties of otherType are also true for this type. bool isSimilar( const SurfaceType& otherType) const { @@ -286,7 +290,9 @@ namespace dd4hep { namespace rec { << "] zCylinder[" << t.isZCylinder() << "] zCone[" << t.isZCone() << "] zPlane[" << t.isZPlane() - << "] zDisk[" << t.isZDisk() << "]" ; + << "] zDisk[" << t.isZDisk() + << "] unbounded[" << t.isUnbounded() + << "]" ; return os ; } diff --git a/DDRec/src/Surface.cpp b/DDRec/src/Surface.cpp index b70cea3d298045ddd76fe93db9e86cc125df045a..578be09bf8f36df029d626c4b36e22a35e2d165e 100644 --- a/DDRec/src/Surface.cpp +++ b/DDRec/src/Surface.cpp @@ -194,22 +194,30 @@ namespace dd4hep { /// Checks if the given point lies within the surface bool VolSurfaceBase::insideBounds(const Vector3D& point, double epsilon) const { - + #if 0 + + bool inShape = ( type().isUnbounded() ? true : volume()->GetShape()->Contains( point.const_array() ) ) ; + double dist = std::abs ( distance( point ) ) ; - - bool inShape = volume()->GetShape()->Contains( point.const_array() ) ; - + std::cout << " ** Surface::insideBound( " << point << " ) - distance = " << dist << " origin = " << origin() << " normal = " << normal() << " p * n = " << point * normal() << " isInShape : " << inShape << std::endl ; - + return dist < epsilon && inShape ; #else - - //fixme: older versions of ROOT (~<5.34.10 ) take a non const pointer as argument - therefore use a const cast here for the time being ... - return ( std::abs ( distance( point ) ) < epsilon ) && volume()->GetShape()->Contains( const_cast<double*> (point.const_array() ) ) ; + + if( type().isUnbounded() ){ + + return std::abs ( distance( point ) ) < epsilon ; + + } else { + + return ( std::abs ( distance( point ) ) < epsilon && volume()->GetShape()->Contains( point.const_array() ) ) ; + } + #endif }