attempt to make re-init possible
This commit is contained in:
+25
-6
@@ -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
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user