attempt to make re-init possible

This commit is contained in:
Jan Kieseler
2023-09-20 20:29:25 +00:00
parent d66464f48c
commit a6dfa6079c
+25 -6
View File
@@ -5,11 +5,25 @@ void G4System::init(ConstructionWrapper &CW, bool gui){
char* argv[]={(char*)"dummy"};
// Construct the default run manager
//
runManager =
G4RunManagerFactory::CreateRunManager(G4RunManagerType::Default);
runManager->SetNumberOfThreads(20);//more doesn't make sense
bool first_init=true;
if(runManager == nullptr){
// Construct the default run manager
//
runManager =
G4RunManagerFactory::CreateRunManager(G4RunManagerType::Default);
runManager->SetNumberOfThreads(20);//more doesn't make sense
}
else{
// Abort the current run
runManager->AbortRun(true);
// Clear any pending events
runManager->Clear();
first_init = false;
}
G4String session;
ui = nullptr;
@@ -29,7 +43,12 @@ void G4System::init(ConstructionWrapper &CW, bool gui){
actionInitialization = new B4a::ActionInitialization(detConstruction);
runManager->SetUserInitialization(actionInitialization);
//actionInitialization->setGeneratorProperties(100, 10000, "e-");
if(! first_init){
runManager->GeometryHasBeenModified();
runManager->ReinitializeGeometry();
runManager->PhysicsHasBeenModified();
runManager->ReinitializePhysics();
}
// Initialize visualization
//