Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-10 07:50:27

0001 /**
0002 U4NavigatorTest.cc
0003 ====================
0004 
0005 This fails with fHistory.GetTopVolume() giving nullptr
0006 however U4Navigator::Check() works from U4App.h
0007 following Geant4 run manager setup.
0008 
0009 So are missing some geometry and/or tracking setup here,
0010 probably the voxelization happens as part of the full
0011 setup or some such.
0012 
0013 This means that G4Navigator based simtracing needs to be added
0014 as a sibling alternative method to U4App::BeamOn rather
0015 than implementing in a separate binary as the limited G4VSolid based
0016 simtracing is currently done.
0017 
0018 **/
0019 
0020 #include "OPTICKS_LOG.hh"
0021 #include "U4VolumeMaker.hh"
0022 #include "U4Navigator.h"
0023 
0024 int main(int argc, char** argv)
0025 {
0026     OPTICKS_LOG(argc, argv);
0027 
0028     const G4VPhysicalVolume* pv = U4VolumeMaker::PV();  // sensitive to GEOM envvar
0029     if(pv == nullptr) return 0 ;
0030 
0031     G4ThreeVector ori(0.,0.,0.);
0032     G4ThreeVector dir(0.,0.,1.);
0033 
0034     G4double dist = U4Navigator::Distance( ori, dir );
0035     LOG(info) << " dist " << dist  ;
0036 
0037     return 0 ;
0038 }
0039