diff --git a/VecGeom/volumes/PlacedAssembly.h b/VecGeom/volumes/PlacedAssembly.h index 51c67825ed1fc0642aa91837a96e6cb1c5e8f348..89811fa00de66843111c8e9ab9d721e15906882b 100644 --- a/VecGeom/volumes/PlacedAssembly.h +++ b/VecGeom/volumes/PlacedAssembly.h @@ -262,6 +262,8 @@ public: // if this function returns true it modifies the navigation state to point to the first non-assembly volume // the point is contained in // this function is not part of the generic UnplacedVolume interface but we could consider doing so + // N.B To work correctly, the input state must be initialized to point to the parent volume of this placed assembly + // otherwise the Push/Pop cannot work correctly since they do not match a valid navigation state VECCORE_ATT_HOST_DEVICE bool Contains(Vector3D const &p, Vector3D &lp, NavigationState &state) const { diff --git a/test/core/AssemblyTest.cpp b/test/core/AssemblyTest.cpp index 7780c2e7a1053cf6e2e8f2903e9662e191e1440b..caa55d70dfee44a7efd3e03d20646f171b6a5c5b 100644 --- a/test/core/AssemblyTest.cpp +++ b/test/core/AssemblyTest.cpp @@ -54,13 +54,22 @@ int main() Vector3D p2(20., 0., 0.); Vector3D lp(0., 0., 0.); NavigationState *state = NavigationState::MakeInstance(10); + // State must point to assembly parent (none in this case) + state->Clear(); std::cerr << pa->Contains(p, lp, *state) << "\n"; + state->Clear(); assert(!pa->Contains(p, lp, *state)); + state->Clear(); std::cerr << pa->Contains(p2, lp, *state) << "\n"; + state->Clear(); assert(pa->Contains(p2, lp, *state)); + state->Clear(); std::cerr << pa->Contains(p) << "\n"; + state->Clear(); assert(!pa->Contains(p)); + state->Clear(); std::cerr << pa->Contains(p2) << "\n"; + state->Clear(); assert(pa->Contains(p2)); assert(pa->SafetyToIn(Vector3D(-10, 0, 0)) == 0.);