Bug #1790
G4Navigator->LocateGlobalPointAndSetup() segfaults when using GDML Geometry
Status:
Closed
Priority:
Normal
Assignee:
Category:
Global Reconstruction
Target version:
Start date:
03 November 2015
Due date:
% Done:
100%
Estimated time:
Workflow:
New Issue
Description
It works fine using legacy geometry, but when using GDML it segfaults.
I'm calling it as
G4Navigator* g4navigator = G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking(); G4VPhysicalVolume* volume = g4navigator->LocateGlobalPointAndSetup(posvector, &momvector);
The two vectors passed are checked to be good (i.e. all 3 components are sensible)
Initially I got the following output from the segfault:
#5 0x00007f898d2b6022 in G4ParameterisedNavigation::LevelLocate(G4NavigationHistory&, G4VPhysicalVolume const*, int, CLHEP::Hep3Vector const&, CLHEP::Hep3Vector const*, bool, CLHEP::Hep3Vector&) () from /home/jan/MICE/.MAUSSTABLE/maus-v1.0.0/third_party/install/lib/libG4geometry.so #6 0x00007f898d2af494 in G4Navigator::LocateGlobalPointAndSetup(CLHEP::Hep3Vector const&, CLHEP::Hep3Vector const*, bool, bool) () from /home/jan/MICE/.MAUSSTABLE/maus-v1.0.0/third_party/install/lib/libG4geometry.so #7 0x00007f898fd04ad9 in MAUS::GlobalTools::propagate(double*, double, BTField const*, double, MAUS::DataStructure::Global::PID, bool) () from /home/jan/MICE/MAUS/maus-straighttrackdata/build/libMausCpp.so #8 0x00007f898fd084c2 in MAUS::recon::global::TrackMatching::USTrack(MAUS::GlobalEvent*, std::string) () from /home/jan/MICE/MAUS/maus-straighttrackdata/build/libMausCpp.so #9 0x00007f89859a1d72 in MAUS::MapCppGlobalTrackMatching::_process(MAUS::Data*) const () from /home/jan/MICE/MAUS/maus-straighttrackdata/build/_MapCppGlobalTrackMatching.so #10 0x00007f89859a9654 in MAUS::MapBase<MAUS::Data>::process_pyobj(_object*) const () from /home/jan/MICE/MAUS/maus-straighttrackdata/build/_MapCppGlobalTrackMatching.so #11 0x00007f89859a3b73 in MAUS::PyWrapMapBase<MAUS::MapCppGlobalTrackMatching>::process(_object*, _object*, _object*) () from /home/jan/MICE/MAUS/maus-straighttrackdata/build/_MapCppGlobalTrackMatching.so #12 0x00007f89998bec2c in call_function (oparg=<optimised out>, pp_stack=0x7fff46de5a10) at Python/ceval.c:4013
After a recompile of Geant4 in Debug mode this changed to
#5 0x00007f80da39391e in G4SmartVoxelHeader::GetParamAxis (this=0x0) at /home/jan/MICE/.MAUSSTABLE/maus-v1.2.0/third_party/source/geant4.9.6.p02/source/geometry/management/include/G4SmartVoxelHeader.icc:67 #6 0x00007f80da393d74 in G4ParameterisedNavigation::ParamVoxelLocate (this=0x3cf94a0, pHead=0x0, localPoint=...) at /home/jan/MICE/.MAUSSTABLE/maus-v1.2.0/third_party/source/geant4.9.6.p02/source/geometry/navigation/include/G4ParameterisedNavigation.icc:65 #7 0x00007f80da3983d6 in G4ParameterisedNavigation::LevelLocate (this=0x3cf94a0, history=..., blockedVol=0x0, blockedNum=-1, globalPoint=..., globalDirection=0x7ffdf39d01b0, pLocatedOnEdge=false, localPoint=...) at /home/jan/MICE/.MAUSSTABLE/maus-v1.2.0/third_party/source/geant4.9.6.p02/source/geometry/navigation/src/G4ParameterisedNavigation.cc:592 #8 0x00007f80da38d80b in G4Navigator::LocateGlobalPointAndSetup (this=0x3cf9220, globalPoint=..., pGlobalDirection=0x7ffdf39d01b0, relativeSearch=true, ignoreDirection=true) at /home/jan/MICE/.MAUSSTABLE/maus-v1.2.0/third_party/source/geant4.9.6.p02/source/geometry/navigation/src/G4Navigator.cc:454 #9 0x00007f80dcdcdfcf in MAUS::GlobalTools::propagate(double*, double, BTField const*, double, MAUS::DataStructure::Global::PID, bool) () from /home/jan/MICE/MAUS/maus-temp1.2.0/build/libMausCpp.so #10 0x00007f80dcdd148f in MAUS::recon::global::TrackMatching::USTrack(MAUS::GlobalEvent*, std::string) () from /home/jan/MICE/MAUS/maus-temp1.2.0/build/libMausCpp.so #11 0x00007f80ce203d42 in MAUS::MapCppGlobalTrackMatching::_process(MAUS::Data*) const () from /home/jan/MICE/MAUS/maus-temp1.2.0/build/_MapCppGlobalTrackMatching.so #12 0x00007f80ce20b424 in MAUS::MapBase<MAUS::Data>::process_pyobj(_object*) const () from /home/jan/MICE/MAUS/maus-temp1.2.0/build/_MapCppGlobalTrackMatching.so #13 0x00007f80ce2059a3 in MAUS::PyWrapMapBase<MAUS::MapCppGlobalTrackMatching>::process(_object*, _object*, _object*) () from /home/jan/MICE/MAUS/maus-temp1.2.0/build/_MapCppGlobalTrackMatching.so #14 0x00007f80e6aabc2c in call_function (oparg=<optimised out>, pp_stack=0x7ffdf39d0f10) at Python/ceval.c:4013
Ryan has suggested the code above might be violating some strange G4 casting rules by making a copy of a physical volume but I have very little understanding of either the GDML Geometry or Geant4 so I don't know where to go from here.