diff --git a/src/G4System.cc b/src/G4System.cc index a9e819d..9b833e1 100644 --- a/src/G4System.cc +++ b/src/G4System.cc @@ -111,7 +111,10 @@ void G4System::run_visualize(const std::string& partSpecies, double minEnergy, d for(const auto& c : commands){ UImanager->ApplyCommand(c); } - run_batch(1, partSpecies, minEnergy, maxEnergy); + G4String partSpec = partSpecies; + G4cout << "running visualisation with particle species " << partSpec << G4endl; + actionInitialization->setGeneratorProperties(minEnergy, maxEnergy, partSpec); + runManager->BeamOn(1); } void G4System::run_gui(){ @@ -132,6 +135,7 @@ void G4System::run_batch(int nEvents,const std::string& partSpecies, double minE G4String partSpec = partSpecies; G4cout << "running with particle species " << partSpec << G4endl; UImanager->ApplyCommand("/run/initialize"); + UImanager->ApplyCommand("/vis/disable"); actionInitialization->setGeneratorProperties(minEnergy, maxEnergy, partSpec); runManager->BeamOn(nEvents); }