seems to work with different geometries
This commit is contained in:
+19
-15
@@ -11,16 +11,19 @@ void G4System::init(ConstructionWrapper &CW){
|
||||
|
||||
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
|
||||
runManager->SetVerboseLevel(0);
|
||||
}
|
||||
else{
|
||||
|
||||
// Abort the current run
|
||||
G4RunManager::GetRunManager()->AbortRun(true);
|
||||
//G4RunManager::GetRunManager()->AbortRun(true);
|
||||
first_init = false;
|
||||
//delete actionInitialization;
|
||||
//delete detConstruction;
|
||||
@@ -28,6 +31,7 @@ void G4System::init(ConstructionWrapper &CW){
|
||||
}
|
||||
|
||||
|
||||
|
||||
G4String session;
|
||||
ui = nullptr;
|
||||
if ( gui ) {
|
||||
@@ -36,10 +40,11 @@ void G4System::init(ConstructionWrapper &CW){
|
||||
|
||||
// Set mandatory initialization classes
|
||||
//
|
||||
|
||||
detConstruction = new B4::DetectorConstruction(&CW);
|
||||
if(first_init){
|
||||
|
||||
detConstruction = new B4::DetectorConstruction(&CW);
|
||||
runManager->SetUserInitialization(detConstruction);
|
||||
|
||||
auto physicsList = new FTFP_BERT;
|
||||
runManager->SetUserInitialization(physicsList);
|
||||
|
||||
@@ -47,26 +52,25 @@ void G4System::init(ConstructionWrapper &CW){
|
||||
runManager->SetUserInitialization(actionInitialization);
|
||||
}
|
||||
else{
|
||||
actionInitialization->setDetectorConstruction(detConstruction);
|
||||
|
||||
G4RunManager::GetRunManager()->GeometryHasBeenModified();
|
||||
G4RunManager::GetRunManager()->ReinitializeGeometry(true);
|
||||
//runManager->SetUserInitialization(detConstruction);
|
||||
detConstruction->setConstructionWrapper(&CW);
|
||||
runManager->ReinitializeGeometry(true);
|
||||
}
|
||||
|
||||
if(visManager == nullptr){
|
||||
// Initialize visualization
|
||||
//
|
||||
visManager = new G4VisExecutive;
|
||||
// G4VisExecutive can take a verbosity argument - see /vis/verbose guidance.
|
||||
// G4VisManager* visManager = new G4VisExecutive("Quiet");
|
||||
|
||||
visManager->Initialize();
|
||||
// Initialize visualization
|
||||
//
|
||||
visManager = new G4VisExecutive;
|
||||
// G4VisExecutive can take a verbosity argument - see /vis/verbose guidance.
|
||||
// G4VisManager* visManager = new G4VisExecutive("Quiet");
|
||||
|
||||
visManager->Initialize();
|
||||
}
|
||||
|
||||
// Get the pointer to the User Interface manager
|
||||
UImanager = G4UImanager::GetUIpointer();
|
||||
|
||||
runManager->Initialize();
|
||||
|
||||
// Process macro or start UI session
|
||||
//
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user