MCPcopy Create free account
hub / github.com/Geant4/geant4 / InitializeGeometry

Method InitializeGeometry

source/run/src/G4RunManager.cc:653–684  ·  view source on GitHub ↗

--------------------------------------------------------------------

Source from the content-addressed store, hash-verified

651
652// --------------------------------------------------------------------
653void G4RunManager::InitializeGeometry()
654{
655 if (userDetector == nullptr) {
656 G4Exception("G4RunManager::InitializeGeometry", "Run0033", FatalException,
657 "G4VUserDetectorConstruction is not defined!");
658 return;
659 }
660
661 if (verboseLevel > 1) G4cout << "userDetector->Construct() start." << G4endl;
662
663 G4StateManager* stateManager = G4StateManager::GetStateManager();
664 G4ApplicationState currentState = stateManager->GetCurrentState();
665 if (currentState == G4State_PreInit || currentState == G4State_Idle) {
666 stateManager->SetNewState(G4State_Init);
667 }
668 if (!geometryDirectlyUpdated) {
669 kernel->DefineWorldVolume(userDetector->Construct(), false);
670 userDetector->ConstructSDandField();
671 nParallelWorlds = userDetector->ConstructParallelGeometries();
672 userDetector->ConstructParallelSD();
673 kernel->SetNumberOfParallelWorld(nParallelWorlds);
674 }
675 // Notify the VisManager as well
676 if (G4Threading::IsMasterThread()) {
677 G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
678 if (pVVisManager != nullptr) pVVisManager->GeometryHasChanged();
679 }
680
681 geometryDirectlyUpdated = false;
682 geometryInitialized = true;
683 stateManager->SetNewState(currentState);
684}
685
686// --------------------------------------------------------------------
687void G4RunManager::InitializePhysics()

Callers

nothing calls this directly

Calls 9

G4ExceptionFunction · 0.85
SetNewStateMethod · 0.80
ConstructParallelSDMethod · 0.80
GeometryHasChangedMethod · 0.80
DefineWorldVolumeMethod · 0.45
ConstructMethod · 0.45
ConstructSDandFieldMethod · 0.45

Tested by

no test coverage detected