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

Method RunInitialization

source/run/src/G4RunManagerKernel.cc:608–658  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

606
607// --------------------------------------------------------------------
608G4bool G4RunManagerKernel::RunInitialization(G4bool fakeRun)
609{
610 G4StateManager* stateManager = G4StateManager::GetStateManager();
611 G4ApplicationState currentState = stateManager->GetCurrentState();
612
613 if (!geometryInitialized) {
614 G4Exception("G4RunManagerKernel::RunInitialization", "Run0021", JustWarning,
615 "Geometry has not yet initialized : method ignored.");
616 return false;
617 }
618
619 if (!physicsInitialized) {
620 G4Exception("G4RunManagerKernel::RunInitialization", "Run0022", JustWarning,
621 "Physics has not yet initialized : method ignored.");
622 return false;
623 }
624
625 if (currentState != G4State_Idle) {
626 G4Exception("G4RunManagerKernel::RunInitialization", "Run0023", JustWarning,
627 "Geant4 kernel not in Idle state : method ignored.");
628 return false;
629 }
630
631 if (geometryNeedsToBeClosed) CheckRegularGeometry();
632
633 stateManager->SetNewState(G4State_Init);
634 PropagateGenericIonID();
635 SetupShadowProcess();
636 UpdateRegion();
637 BuildPhysicsTables(fakeRun);
638
639 if (geometryNeedsToBeClosed) {
640 if(!fakeRun || resetNavigatorAtInitialization) ResetNavigator();
641 // CheckRegularGeometry();
642 // Notify the VisManager as well
643 if (G4Threading::IsMasterThread()) {
644 G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
645 if (pVVisManager != nullptr) pVVisManager->GeometryHasChanged();
646 }
647 }
648
649 GetPrimaryTransformer()->CheckUnknown();
650
651#ifdef G4MULTITHREADED
652 G4UnitDefinition::GetUnitsTable().Synchronize();
653#endif
654
655 stateManager->SetNewState(G4State_Idle);
656 stateManager->SetNewState(G4State_GeomClosed);
657 return true;
658}
659
660// --------------------------------------------------------------------
661void G4RunManagerKernel::PropagateGenericIonID()

Callers

nothing calls this directly

Calls 5

G4ExceptionFunction · 0.85
SetNewStateMethod · 0.80
GeometryHasChangedMethod · 0.80
CheckUnknownMethod · 0.80
SynchronizeMethod · 0.80

Tested by

no test coverage detected