Inconsistent documentation of geo::GeometryCore::NearestWireID() and geo::GeometryCore::NearestChannel()
Both methods declare to return an invalid value on failure, while they actually throw an exception.
This inconsistency must be fixed.
#1 Updated by Gianluca Petrillo almost 2 years ago
While the easiest way is to change the documentation, the behaviour reported by the documentation yields to faster code, which is potentially relevant for example in
LArG4 module, where
geo::Geometry::NearestChannel() takes non-negligible time.
The solution goes upstream to a change in
geo::PlaneGeo::NearestWireID(), which should be modified (breaking change) to return an invalid wire instead of throwing an exception. After that, the methods using it should be modified to correctly react. For the two methods of
geo::GeometryCore subject of this ticket, this means to just act as pass-through.
Note that the standard geometry test (larcorealg:source:test/Geometry/GeometryTestAlg.cxx) is actually testing the throw of an exception, and it will have to be updated too.