Geant4-11
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Attributes | Static Private Attributes | Friends
G4RunManager Class Reference

#include <G4RunManager.hh>

Inheritance diagram for G4RunManager:
G4MTRunManager G4WorkerRunManager G4TaskRunManager G4WorkerTaskRunManager

Public Types

using ProfilerConfig = G4ProfilerConfig< G4ProfileType::Run >
 
enum  RMType { sequentialRM , masterRM , workerRM }
 

Public Member Functions

virtual void AbortEvent ()
 
virtual void AbortRun (G4bool softAbort=false)
 
virtual void AnalyzeEvent (G4Event *anEvent)
 
virtual void BeamOn (G4int n_event, const char *macroFile=nullptr, G4int n_select=-1)
 
virtual void ConfigureProfilers (const std::vector< std::string > &args={})
 
void ConfigureProfilers (G4int argc, char **argv)
 
virtual G4bool ConfirmBeamOnCondition ()
 
virtual void ConstructScoringWorlds ()
 
void CutOffHasBeenModified ()
 
virtual void DefineWorldVolume (G4VPhysicalVolume *worldVol, G4bool topologyIsChanged=true)
 
virtual void DoEventLoop (G4int n_event, const char *macroFile=nullptr, G4int n_select=-1)
 
void DumpRegion (const G4String &rname) const
 
void DumpRegion (G4Region *region=nullptr) const
 
 G4RunManager ()
 
 G4RunManager (const G4RunManager &)=delete
 
virtual G4EventGenerateEvent (G4int i_event)
 
void GeometryDirectlyUpdated (G4bool val=true)
 
void GeometryHasBeenModified (G4bool prop=true)
 
const G4EventGetCurrentEvent () const
 
const G4RunGetCurrentRun () const
 
G4int GetFlagRandomNumberStatusToG4Event () const
 
G4bool GetGeometryToBeOptimized ()
 
G4RunGetNonConstCurrentRun () const
 
G4VUserActionInitializationGetNonConstUserActionInitialization () const
 
G4int GetNumberOfEventsToBeProcessed () const
 
G4int GetNumberOfParallelWorld () const
 
G4int GetNumberOfSelectEvents () const
 
virtual G4int GetNumberOfThreads () const
 
const G4EventGetPreviousEvent (G4int i) const
 
G4int GetPrintProgress ()
 
const G4StringGetRandomNumberStatusForThisEvent () const
 
const G4StringGetRandomNumberStatusForThisRun () const
 
G4bool GetRandomNumberStore () const
 
const G4StringGetRandomNumberStoreDir () const
 
G4bool GetRandomNumberStorePerEvent () const
 
RMType GetRunManagerType () const
 
const G4StringGetSelectMacro () const
 
const G4VUserActionInitializationGetUserActionInitialization () const
 
const G4VUserDetectorConstructionGetUserDetectorConstruction () const
 
const G4UserEventActionGetUserEventAction () const
 
const G4VUserPhysicsListGetUserPhysicsList () const
 
const G4VUserPrimaryGeneratorActionGetUserPrimaryGeneratorAction () const
 
const G4UserRunActionGetUserRunAction () const
 
const G4UserStackingActionGetUserStackingAction () const
 
const G4UserSteppingActionGetUserSteppingAction () const
 
const G4UserTrackingActionGetUserTrackingAction () const
 
const G4UserWorkerInitializationGetUserWorkerInitialization () const
 
const G4UserWorkerThreadInitializationGetUserWorkerThreadInitialization () const
 
G4int GetVerboseLevel () const
 
const G4StringGetVersionString () const
 
virtual void Initialize ()
 
virtual void InitializeEventLoop (G4int n_event, const char *macroFile=nullptr, G4int n_select=-1)
 
virtual void InitializeGeometry ()
 
virtual void InitializePhysics ()
 
G4RunManageroperator= (const G4RunManager &)=delete
 
void PhysicsHasBeenModified ()
 
virtual void ProcessOneEvent (G4int i_event)
 
void ReinitializeGeometry (G4bool destroyFirst=false, G4bool prop=true)
 
void ReOptimize (G4LogicalVolume *)
 
void ReOptimizeMotherOf (G4VPhysicalVolume *)
 
virtual void RestoreRandomNumberStatus (const G4String &fileN)
 
virtual void RestoreRndmEachEvent (G4bool)
 
virtual void rndmSaveThisEvent ()
 
virtual void rndmSaveThisRun ()
 
virtual void RunInitialization ()
 
virtual void RunTermination ()
 
void SetDCtable (G4DCtable *DCtbl)
 
void SetGeometryToBeOptimized (G4bool vl)
 
void SetNumberOfAdditionalWaitingStacks (G4int iAdd)
 
void SetNumberOfEventsToBeProcessed (G4int val)
 
void SetNumberOfEventsToBeStored (G4int val)
 
virtual void SetNumberOfThreads (G4int)
 
void SetPrimaryTransformer (G4PrimaryTransformer *pt)
 
void SetPrintProgress (G4int i)
 
void SetRandomNumberStore (G4bool flag)
 
void SetRandomNumberStoreDir (const G4String &dir)
 
void SetRandomNumberStorePerEvent (G4bool flag)
 
void SetRunIDCounter (G4int i)
 
virtual void SetUserAction (G4UserEventAction *userAction)
 
virtual void SetUserAction (G4UserRunAction *userAction)
 
virtual void SetUserAction (G4UserStackingAction *userAction)
 
virtual void SetUserAction (G4UserSteppingAction *userAction)
 
virtual void SetUserAction (G4UserTrackingAction *userAction)
 
virtual void SetUserAction (G4VUserPrimaryGeneratorAction *userAction)
 
virtual void SetUserInitialization (G4UserWorkerInitialization *userInit)
 
virtual void SetUserInitialization (G4UserWorkerThreadInitialization *userInit)
 
virtual void SetUserInitialization (G4VUserActionInitialization *userInit)
 
virtual void SetUserInitialization (G4VUserDetectorConstruction *userInit)
 
virtual void SetUserInitialization (G4VUserPhysicsList *userInit)
 
void SetVerboseLevel (G4int vl)
 
void StoreRandomNumberStatusToG4Event (G4int vl)
 
virtual void TerminateEventLoop ()
 
virtual void TerminateOneEvent ()
 
virtual ~G4RunManager ()
 

Static Public Member Functions

static G4RunManagerGetRunManager ()
 
static G4bool IfGeometryHasBeenDestroyed ()
 

Protected Member Functions

void CleanUpPreviousEvents ()
 
void CleanUpUnnecessaryEvents (G4int keepNEvents)
 
virtual void DeleteUserInitializations ()
 
 G4RunManager (RMType rmType)
 
void StackPreviousEvent (G4Event *anEvent)
 
virtual void StoreRNGStatus (const G4String &filenamePrefix)
 
void UpdateScoring ()
 

Protected Attributes

G4EventcurrentEvent = nullptr
 
G4RuncurrentRun = nullptr
 
G4VPhysicalVolumecurrentWorld = nullptr
 
G4DCtableDCtable = nullptr
 
G4EventManagereventManager = nullptr
 
G4bool fakeRun = false
 
G4bool geometryDirectlyUpdated = false
 
G4bool geometryInitialized = false
 
G4bool geometryToBeOptimized = true
 
G4bool initializedAtLeastOnce = false
 
G4bool isScoreNtupleWriter = false
 
G4RunManagerKernelkernel = nullptr
 
G4String msgText = " "
 
G4int n_perviousEventsToBeStored = 0
 
G4int n_select_msg = -1
 
G4int nParallelWorlds = 0
 
G4int numberOfEventProcessed = 0
 
G4int numberOfEventToBeProcessed = 0
 
G4bool physicsInitialized = false
 
G4VUserPhysicsListphysicsList = nullptr
 
std::list< G4Event * > * previousEvents = nullptr
 
G4int printModulo = -1
 
G4String randomNumberStatusDir = "./"
 
G4String randomNumberStatusForThisEvent = ""
 
G4String randomNumberStatusForThisRun = ""
 
G4bool rngStatusEventsFlag = false
 
G4bool runAborted = false
 
G4int runIDCounter = 0
 
RMType runManagerType
 
G4String selectMacro = ""
 
G4bool storeRandomNumberStatus = false
 
G4int storeRandomNumberStatusToG4Event = 0
 
G4Timertimer = nullptr
 
G4VUserActionInitializationuserActionInitialization = nullptr
 
G4VUserDetectorConstructionuserDetector = nullptr
 
G4UserEventActionuserEventAction = nullptr
 
G4VUserPrimaryGeneratorActionuserPrimaryGeneratorAction = nullptr
 
G4UserRunActionuserRunAction = nullptr
 
G4UserStackingActionuserStackingAction = nullptr
 
G4UserSteppingActionuserSteppingAction = nullptr
 
G4UserTrackingActionuserTrackingAction = nullptr
 
G4UserWorkerInitializationuserWorkerInitialization = nullptr
 
G4UserWorkerThreadInitializationuserWorkerThreadInitialization = nullptr
 
G4int verboseLevel = 0
 

Static Protected Attributes

static G4RUN_DLL G4bool fGeometryHasBeenDestroyed = false
 

Private Attributes

std::unique_ptr< ProfilerConfigmasterRunProfiler
 
G4RunMessengerrunMessenger = nullptr
 

Static Private Attributes

static G4ThreadLocal G4RunManagerfRunManager = nullptr
 

Friends

class G4RunManagerFactory
 

Detailed Description

Definition at line 137 of file G4RunManager.hh.

Member Typedef Documentation

◆ ProfilerConfig

Definition at line 143 of file G4RunManager.hh.

Member Enumeration Documentation

◆ RMType

Enumerator
sequentialRM 
masterRM 
workerRM 

Definition at line 575 of file G4RunManager.hh.

576 {
578 masterRM,
580 };

Constructor & Destructor Documentation

◆ G4RunManager() [1/3]

G4RunManager::G4RunManager ( )

Definition at line 117 of file G4RunManager.cc.

118{
119 if(fRunManager)
120 {
121 G4Exception("G4RunManager::G4RunManager()", "Run0031", FatalException,
122 "G4RunManager constructed twice.");
123 }
124 fRunManager = this;
125
128
129 timer = new G4Timer();
130 runMessenger = new G4RunMessenger(this);
131 previousEvents = new std::list<G4Event*>;
134 std::ostringstream oss;
135 G4Random::saveFullState(oss);
139}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35
static G4ParticleTable * GetParticleTable()
G4UImessenger * CreateMessenger()
static G4ProcessTable * GetProcessTable()
G4EventManager * GetEventManager() const
std::list< G4Event * > * previousEvents
G4Timer * timer
G4RunManagerKernel * kernel
G4String randomNumberStatusForThisRun
G4RunMessenger * runMessenger
static G4ThreadLocal G4RunManager * fRunManager
G4String randomNumberStatusForThisEvent
RMType runManagerType
G4EventManager * eventManager

References G4ParticleTable::CreateMessenger(), eventManager, FatalException, fRunManager, G4Exception(), G4RunManagerKernel::GetEventManager(), G4ParticleTable::GetParticleTable(), G4ProcessTable::GetProcessTable(), kernel, previousEvents, randomNumberStatusForThisEvent, randomNumberStatusForThisRun, runManagerType, runMessenger, sequentialRM, and timer.

◆ ~G4RunManager()

G4RunManager::~G4RunManager ( )
virtual

Definition at line 197 of file G4RunManager.cc.

198{
199 // finalise profiler before shutting down the threads
202 // set the application state to the quite state
203 if(pStateManager->GetCurrentState() != G4State_Quit)
204 {
205 if(verboseLevel > 0)
206 G4cout << "G4 kernel has come to Quit state." << G4endl;
207 pStateManager->SetNewState(G4State_Quit);
208 }
209
211 delete currentRun;
212 delete timer;
213 delete runMessenger;
214 delete previousEvents;
215
216 // The following will work for all RunManager types
217 // if derived class does the correct thing in the derived
218 // destructor that is: set to zero pointers of
219 // user initialization objects for which have no
220 // ownership
222 delete userRunAction;
223 userRunAction = nullptr;
224 if(verboseLevel > 1)
225 G4cout << "UserRunAction deleted." << G4endl;
226
229 if(verboseLevel > 1)
230 G4cout << "UserPrimaryGenerator deleted." << G4endl;
231
232 if(verboseLevel > 1)
233 G4cout << "RunManager is deleting RunManagerKernel." << G4endl;
234
235 delete kernel;
236
237 fRunManager = nullptr;
238
239 if(verboseLevel > 1)
240 G4cout << "RunManager is deleted." << G4endl;
241}
@ G4State_Quit
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
static void Finalize()
Definition: G4Profiler.cc:331
void CleanUpPreviousEvents()
virtual void DeleteUserInitializations()
G4int verboseLevel
G4Run * currentRun
G4UserRunAction * userRunAction
G4VUserPrimaryGeneratorAction * userPrimaryGeneratorAction
const G4ApplicationState & GetCurrentState() const
static G4StateManager * GetStateManager()
G4bool SetNewState(const G4ApplicationState &requestedState)

References CleanUpPreviousEvents(), currentRun, DeleteUserInitializations(), G4Profiler::Finalize(), fRunManager, G4cout, G4endl, G4State_Quit, G4StateManager::GetCurrentState(), G4StateManager::GetStateManager(), kernel, previousEvents, runMessenger, G4StateManager::SetNewState(), timer, userPrimaryGeneratorAction, userRunAction, and verboseLevel.

◆ G4RunManager() [2/3]

G4RunManager::G4RunManager ( const G4RunManager )
delete

◆ G4RunManager() [3/3]

G4RunManager::G4RunManager ( RMType  rmType)
protected

Definition at line 142 of file G4RunManager.cc.

143{
144 // This version of the constructor should never be called in sequential mode!
145#ifndef G4MULTITHREADED
147 msg << "Geant4 code is compiled without multi-threading support "
148 "(-DG4MULTITHREADED is set to off).";
149 msg << " This type of RunManager can only be used in mult-threaded "
150 "applications.";
151 G4Exception("G4RunManager::G4RunManager(G4bool)", "Run0107",
152 FatalException, msg);
153#endif
154
155 if(fRunManager != nullptr)
156 {
157 G4Exception("G4RunManager::G4RunManager()", "Run0031", FatalException,
158 "G4RunManager constructed twice.");
159 return;
160 }
161 fRunManager = this;
162
163 switch(rmType)
164 {
165 case masterRM:
167 break;
168 case workerRM:
170 break;
171 default:
173 msgx << "This type of RunManager can only be used in multi-threaded "
174 "applications.";
175 G4Exception("G4RunManager::G4RunManager(G4bool)", "Run0108",
176 FatalException, msgx);
177 return;
178 }
179 runManagerType = rmType;
180
182
183 timer = new G4Timer();
184 runMessenger = new G4RunMessenger(this);
185 previousEvents = new std::list<G4Event*>;
189 std::ostringstream oss;
190 G4Random::saveFullState(oss);
194}
std::ostringstream G4ExceptionDescription
Definition: G4Exception.hh:40
G4String randomNumberStatusDir
virtual void ConfigureProfilers(const std::vector< std::string > &args={})

References ConfigureProfilers(), G4ParticleTable::CreateMessenger(), eventManager, FatalException, fRunManager, G4Exception(), G4RunManagerKernel::GetEventManager(), G4ParticleTable::GetParticleTable(), G4ProcessTable::GetProcessTable(), kernel, masterRM, previousEvents, randomNumberStatusDir, randomNumberStatusForThisEvent, randomNumberStatusForThisRun, runManagerType, runMessenger, timer, and workerRM.

Member Function Documentation

◆ AbortEvent()

void G4RunManager::AbortEvent ( )
virtual

Reimplemented in G4MTRunManager, and G4TaskRunManager.

Definition at line 774 of file G4RunManager.cc.

775{
776 // This method is valid only for EventProc state
777 G4ApplicationState currentState =
779 if(currentState == G4State_EventProc)
780 {
783 }
784 else
785 {
786 G4cerr << "Event is not in progress. AbortEevnt() ignored." << G4endl;
787 }
788}
G4ApplicationState
@ G4State_EventProc
G4GLOB_DLL std::ostream G4cerr
void AbortCurrentEvent()
void SetEventAborted()
Definition: G4Event.hh:88
G4Event * currentEvent

References G4EventManager::AbortCurrentEvent(), currentEvent, eventManager, G4cerr, G4endl, G4State_EventProc, G4StateManager::GetCurrentState(), G4StateManager::GetStateManager(), and G4Event::SetEventAborted().

Referenced by export_G4RunManager(), G4ExceptionHandler::Notify(), and G4RunMessenger::SetNewValue().

◆ AbortRun()

void G4RunManager::AbortRun ( G4bool  softAbort = false)
virtual

Reimplemented in G4MTRunManager, and G4TaskRunManager.

Definition at line 753 of file G4RunManager.cc.

754{
755 // This method is valid only for GeomClosed or EventProc state
756 G4ApplicationState currentState =
758 if(currentState == G4State_GeomClosed || currentState == G4State_EventProc)
759 {
760 runAborted = true;
761 if(currentState == G4State_EventProc && !softAbort)
762 {
765 }
766 }
767 else
768 {
769 G4cerr << "Run is not in progress. AbortRun() ignored." << G4endl;
770 }
771}
@ G4State_GeomClosed
G4bool runAborted

References G4EventManager::AbortCurrentEvent(), currentEvent, eventManager, G4cerr, G4endl, G4State_EventProc, G4State_GeomClosed, G4StateManager::GetCurrentState(), G4StateManager::GetStateManager(), runAborted, and G4Event::SetEventAborted().

Referenced by export_G4RunManager(), G4ExceptionHandler::Notify(), and G4RunMessenger::SetNewValue().

◆ AnalyzeEvent()

void G4RunManager::AnalyzeEvent ( G4Event anEvent)
virtual

Definition at line 548 of file G4RunManager.cc.

549{
550 G4VPersistencyManager* fPersM =
552 if(fPersM != nullptr)
553 fPersM->Store(anEvent);
554 currentRun->RecordEvent(anEvent);
555}
virtual void RecordEvent(const G4Event *)
Definition: G4Run.cc:61
static G4VPersistencyManager * GetPersistencyManager()
virtual G4bool Store(const G4Event *anEvent)=0

References currentRun, G4VPersistencyManager::GetPersistencyManager(), G4Run::RecordEvent(), and G4VPersistencyManager::Store().

Referenced by ProcessOneEvent(), G4WorkerRunManager::ProcessOneEvent(), and G4WorkerTaskRunManager::ProcessOneEvent().

◆ BeamOn()

void G4RunManager::BeamOn ( G4int  n_event,
const char *  macroFile = nullptr,
G4int  n_select = -1 
)
virtual

Definition at line 273 of file G4RunManager.cc.

274{
275 if(n_event <= 0)
276 {
277 fakeRun = true;
278 }
279 else
280 {
281 fakeRun = false;
282 }
284 if(cond)
285 {
290 DoEventLoop(n_event, macroFile, n_select);
292 }
293 fakeRun = false;
294}
bool G4bool
Definition: G4Types.hh:86
G4int numberOfEventProcessed
virtual G4bool ConfirmBeamOnCondition()
virtual void RunTermination()
G4int numberOfEventToBeProcessed
virtual void DoEventLoop(G4int n_event, const char *macroFile=nullptr, G4int n_select=-1)
virtual void RunInitialization()
virtual void ConstructScoringWorlds()

References ConfirmBeamOnCondition(), ConstructScoringWorlds(), DoEventLoop(), fakeRun, numberOfEventProcessed, numberOfEventToBeProcessed, RunInitialization(), and RunTermination().

Referenced by G4WorkerRunManager::DoWork(), export_G4RunManager(), G4MTRunManager::Initialize(), G4TaskRunManager::Initialize(), G4AdjointSimManager::RunAdjointSimulation(), and G4RunMessenger::SetNewValue().

◆ CleanUpPreviousEvents()

void G4RunManager::CleanUpPreviousEvents ( )
protected

Definition at line 589 of file G4RunManager.cc.

590{
591 // Delete all events carried over from previous run.
592 // This method is invoked at the beginning of the next run
593 // or from the destructor of G4RunManager at the very end of
594 // the program.
595 // N.B. If ToBeKept() is true, the pointer of this event is
596 // kept in G4Run of the previous run, and deleted along with
597 // the deletion of G4Run.
598
599 auto evItr = previousEvents->cbegin();
600 while(evItr != previousEvents->cend())
601 {
602 G4Event* evt = *evItr;
603 if(evt != nullptr && !(evt->ToBeKept()))
604 delete evt;
605 evItr = previousEvents->erase(evItr);
606 }
607}
G4bool ToBeKept() const
Definition: G4Event.hh:102

References previousEvents, and G4Event::ToBeKept().

Referenced by G4WorkerTaskRunManager::DoCleanup(), RunInitialization(), G4WorkerRunManager::RunInitialization(), G4WorkerTaskRunManager::RunInitialization(), and ~G4RunManager().

◆ CleanUpUnnecessaryEvents()

void G4RunManager::CleanUpUnnecessaryEvents ( G4int  keepNEvents)
protected

Definition at line 610 of file G4RunManager.cc.

611{
612 // Delete events that are no longer necessary for post
613 // processing such as visualization.
614 // N.B. If ToBeKept() is true, the pointer of this event is
615 // kept in G4Run of the previous run, and deleted along with
616 // the deletion of G4Run.
617
618 auto evItr = previousEvents->cbegin();
619 while(evItr != previousEvents->cend())
620 {
621 if(G4int(previousEvents->size()) <= keepNEvents)
622 return;
623
624 G4Event* evt = *evItr;
625 if(evt != nullptr)
626 {
627 if(evt->GetNumberOfGrips() == 0)
628 {
629 if(!(evt->ToBeKept()))
630 delete evt;
631 evItr = previousEvents->erase(evItr);
632 }
633 else
634 {
635 ++evItr;
636 }
637 }
638 else
639 {
640 evItr = previousEvents->erase(evItr);
641 }
642 }
643}
int G4int
Definition: G4Types.hh:85
G4int GetNumberOfGrips() const
Definition: G4Event.hh:115

References G4Event::GetNumberOfGrips(), previousEvents, and G4Event::ToBeKept().

Referenced by RunTermination(), and StackPreviousEvent().

◆ ConfigureProfilers() [1/2]

void G4RunManager::ConfigureProfilers ( const std::vector< std::string > &  args = {})
virtual

Definition at line 1198 of file G4RunManager.cc.

1199{
1200#ifdef GEANT4_USE_TIMEMORY
1201 // parse command line if arguments were passed
1203#else
1205#endif
1206}
static char ** args
Definition: G4Xt.cc:51
static void Configure(const std::vector< std::string > &args)
Definition: G4Profiler.cc:91
void G4ConsumeParameters(_Args &&...)
Definition: templates.hh:187

References args, G4Profiler::Configure(), and G4ConsumeParameters().

Referenced by ConfigureProfilers(), and G4RunManager().

◆ ConfigureProfilers() [2/2]

void G4RunManager::ConfigureProfilers ( G4int  argc,
char **  argv 
)

Definition at line 1189 of file G4RunManager.cc.

1190{
1191 std::vector<std::string> _args;
1192 for(G4int i = 0; i < argc; ++i)
1193 _args.push_back(argv[i]);
1194 ConfigureProfilers(_args);
1195}

References ConfigureProfilers().

◆ ConfirmBeamOnCondition()

G4bool G4RunManager::ConfirmBeamOnCondition ( )
virtual

Definition at line 297 of file G4RunManager.cc.

298{
300
301 G4ApplicationState currentState = stateManager->GetCurrentState();
302 if(currentState != G4State_PreInit && currentState != G4State_Idle)
303 {
304 G4cerr << "Illegal application state - BeamOn() ignored." << G4endl;
305 return false;
306 }
307
309 {
310 G4cerr << " Geant4 kernel should be initialized" << G4endl;
311 G4cerr << "before the first BeamOn(). - BeamOn ignored." << G4endl;
312 return false;
313 }
314
316 {
317 if(verboseLevel > 0)
318 {
319 G4cout << "Start re-initialization because " << G4endl;
321 G4cout << " Geometry" << G4endl;
323 G4cout << " Physics processes" << G4endl;
324 G4cout << "has been modified since last Run." << G4endl;
325 }
326 Initialize();
327 }
328 return true;
329}
@ G4State_Idle
@ G4State_PreInit
G4bool geometryInitialized
virtual void Initialize()
G4bool physicsInitialized
G4bool initializedAtLeastOnce

References G4cerr, G4cout, G4endl, G4State_Idle, G4State_PreInit, geometryInitialized, G4StateManager::GetCurrentState(), G4StateManager::GetStateManager(), Initialize(), initializedAtLeastOnce, physicsInitialized, and verboseLevel.

Referenced by BeamOn(), and G4WorkerTaskRunManager::DoWork().

◆ ConstructScoringWorlds()

void G4RunManager::ConstructScoringWorlds ( )
virtual

Reimplemented in G4MTRunManager, G4WorkerRunManager, and G4TaskRunManager.

Definition at line 902 of file G4RunManager.cc.

903{
904 using MeshShape = G4VScoringMesh::MeshShape;
905
907 if(ScM == nullptr)
908 return;
909
910 G4int nPar = ScM->GetNumberOfMesh();
911 if(nPar < 1)
912 return;
913
915 for(G4int iw = 0; iw < nPar; ++iw)
916 {
917 G4VScoringMesh* mesh = ScM->GetMesh(iw);
920 G4VPhysicalVolume* pWorld = nullptr;
921 if(mesh->GetShape() != MeshShape::realWorldLogVol)
922 {
924 ->IsWorldExisting(ScM->GetWorldName(iw));
925 if(pWorld == nullptr)
926 {
928 ->GetParallelWorld(ScM->GetWorldName(iw));
929 pWorld->SetName(ScM->GetWorldName(iw));
930
931 G4ParallelWorldProcess* theParallelWorldProcess =
933 if(theParallelWorldProcess != nullptr)
934 {
935 theParallelWorldProcess->SetParallelWorld(ScM->GetWorldName(iw));
936 }
937 else
938 {
939 theParallelWorldProcess =
941 mesh->SetParallelWorldProcess(theParallelWorldProcess);
942 theParallelWorldProcess->SetParallelWorld(ScM->GetWorldName(iw));
943
944 theParticleIterator->reset();
945 while((*theParticleIterator)())
946 {
947 G4ParticleDefinition* particle = theParticleIterator->value();
948 G4ProcessManager* pmanager = particle->GetProcessManager();
949 if(pmanager != nullptr)
950 {
951 pmanager->AddProcess(theParallelWorldProcess);
952 if(theParallelWorldProcess->IsAtRestRequired(particle))
953 {
954 pmanager->SetProcessOrdering(theParallelWorldProcess, idxAtRest,
955 9900);
956 }
957 pmanager->SetProcessOrderingToSecond(theParallelWorldProcess,
959 pmanager->SetProcessOrdering(theParallelWorldProcess, idxPostStep,
960 9900);
961 }
962 }
963 }
964 theParallelWorldProcess->SetLayeredMaterialFlag(mesh->LayeredMassFlg());
965 }
966 }
967 mesh->Construct(pWorld);
968 }
970}
@ idxPostStep
@ idxAtRest
@ idxAlongStep
#define theParticleIterator
void SetLayeredMaterialFlag(G4bool flg=true)
void SetParallelWorld(G4String parallelWorldName)
G4bool IsAtRestRequired(G4ParticleDefinition *)
G4ProcessManager * GetProcessManager() const
G4PTblDicIterator * GetIterator() const
void SetProcessOrdering(G4VProcess *aProcess, G4ProcessVectorDoItIndex idDoIt, G4int ordDoIt=ordDefault)
void SetProcessOrderingToSecond(G4VProcess *aProcess, G4ProcessVectorDoItIndex idDoIt)
G4int AddProcess(G4VProcess *aProcess, G4int ordAtRestDoIt=ordInActive, G4int ordAlongSteptDoIt=ordInActive, G4int ordPostStepDoIt=ordInActive)
static G4RUN_DLL G4bool fGeometryHasBeenDestroyed
void GeometryHasBeenModified(G4bool prop=true)
G4VScoringMesh * GetMesh(G4int i) const
size_t GetNumberOfMesh() const
G4String GetWorldName(G4int i) const
static G4ScoringManager * GetScoringManagerIfExist()
G4VPhysicalVolume * GetParallelWorld(const G4String &worldName)
static G4TransportationManager * GetTransportationManager()
G4VPhysicalVolume * IsWorldExisting(const G4String &worldName)
void SetName(const G4String &pName)
MeshShape GetShape() const
void GeometryHasBeenDestroyed()
G4ParallelWorldProcess * GetParallelWorldProcess() const
void SetParallelWorldProcess(G4ParallelWorldProcess *proc)
virtual void Construct(G4VPhysicalVolume *fWorldPhys)
G4bool LayeredMassFlg()

References G4ProcessManager::AddProcess(), G4VScoringMesh::Construct(), fGeometryHasBeenDestroyed, G4VScoringMesh::GeometryHasBeenDestroyed(), GeometryHasBeenModified(), G4ParticleTable::GetIterator(), G4ScoringManager::GetMesh(), G4ScoringManager::GetNumberOfMesh(), G4TransportationManager::GetParallelWorld(), G4VScoringMesh::GetParallelWorldProcess(), G4ParticleTable::GetParticleTable(), G4ParticleDefinition::GetProcessManager(), G4ScoringManager::GetScoringManagerIfExist(), G4VScoringMesh::GetShape(), G4TransportationManager::GetTransportationManager(), G4ScoringManager::GetWorldName(), idxAlongStep, idxAtRest, idxPostStep, G4ParallelWorldProcess::IsAtRestRequired(), G4TransportationManager::IsWorldExisting(), G4VScoringMesh::LayeredMassFlg(), G4ParallelWorldProcess::SetLayeredMaterialFlag(), G4VPhysicalVolume::SetName(), G4ParallelWorldProcess::SetParallelWorld(), G4VScoringMesh::SetParallelWorldProcess(), G4ProcessManager::SetProcessOrdering(), G4ProcessManager::SetProcessOrderingToSecond(), and theParticleIterator.

Referenced by BeamOn(), G4MTRunManager::ConstructScoringWorlds(), G4TaskRunManager::ConstructScoringWorlds(), and G4RunMessenger::SetNewValue().

◆ CutOffHasBeenModified()

void G4RunManager::CutOffHasBeenModified ( )
inline

Definition at line 301 of file G4RunManager.hh.

302 {
303 G4cerr << "CutOffHasBeenModified becomes obsolete." << G4endl;
304 G4cerr << "It is safe to remove invoking this method." << G4endl;
305 }

References G4cerr, and G4endl.

◆ DefineWorldVolume()

void G4RunManager::DefineWorldVolume ( G4VPhysicalVolume worldVol,
G4bool  topologyIsChanged = true 
)
virtual

Definition at line 791 of file G4RunManager.cc.

793{
794 kernel->DefineWorldVolume(worldVol, topologyIsChanged);
795}
void DefineWorldVolume(G4VPhysicalVolume *worldVol, G4bool topologyIsChanged=true)

References G4RunManagerKernel::DefineWorldVolume(), and kernel.

Referenced by export_G4RunManager(), DetectorConstruction::SetMaterial(), G4GDMLMessenger::SetNewValue(), and ExN03DetectorConstruction::UpdateGeometry().

◆ DeleteUserInitializations()

void G4RunManager::DeleteUserInitializations ( )
protectedvirtual

Definition at line 244 of file G4RunManager.cc.

245{
246 delete userDetector;
247 userDetector = nullptr;
248 if(verboseLevel > 1)
249 G4cout << "UserDetectorConstruction deleted." << G4endl;
250
251 delete physicsList;
252 physicsList = nullptr;
253 if(verboseLevel > 1)
254 G4cout << "UserPhysicsList deleted." << G4endl;
255
257 userActionInitialization = nullptr;
258 if(verboseLevel > 1)
259 G4cout << "UserActionInitialization deleted." << G4endl;
260
262 userWorkerInitialization = nullptr;
263 if(verboseLevel > 1)
264 G4cout << "UserWorkerInitialization deleted." << G4endl;
265
268 if(verboseLevel > 1)
269 G4cout << "UserWorkerThreadInitialization deleted." << G4endl;
270}
G4UserWorkerInitialization * userWorkerInitialization
G4UserWorkerThreadInitialization * userWorkerThreadInitialization
G4VUserActionInitialization * userActionInitialization
G4VUserDetectorConstruction * userDetector
G4VUserPhysicsList * physicsList

References G4cout, G4endl, physicsList, userActionInitialization, userDetector, userWorkerInitialization, userWorkerThreadInitialization, and verboseLevel.

Referenced by ~G4RunManager().

◆ DoEventLoop()

void G4RunManager::DoEventLoop ( G4int  n_event,
const char *  macroFile = nullptr,
G4int  n_select = -1 
)
virtual

Reimplemented in G4WorkerRunManager, and G4WorkerTaskRunManager.

Definition at line 412 of file G4RunManager.cc.

414{
415 InitializeEventLoop(n_event, macroFile, n_select);
416
417 // Event loop
418 for(G4int i_event = 0; i_event < n_event; ++i_event)
419 {
420 ProcessOneEvent(i_event);
422 if(runAborted)
423 break;
424 }
425
426 // For G4MTRunManager, TerminateEventLoop() is invoked after all threads are
427 // finished.
430}
virtual void InitializeEventLoop(G4int n_event, const char *macroFile=nullptr, G4int n_select=-1)
virtual void TerminateEventLoop()
virtual void ProcessOneEvent(G4int i_event)
virtual void TerminateOneEvent()

References InitializeEventLoop(), ProcessOneEvent(), runAborted, runManagerType, sequentialRM, TerminateEventLoop(), and TerminateOneEvent().

Referenced by BeamOn().

◆ DumpRegion() [1/2]

void G4RunManager::DumpRegion ( const G4String rname) const

Definition at line 890 of file G4RunManager.cc.

891{
892 kernel->DumpRegion(rname);
893}
void DumpRegion(const G4String &rname) const

References G4RunManagerKernel::DumpRegion(), and kernel.

Referenced by G4RunMessenger::SetNewValue().

◆ DumpRegion() [2/2]

void G4RunManager::DumpRegion ( G4Region region = nullptr) const

Definition at line 896 of file G4RunManager.cc.

897{
898 kernel->DumpRegion(region);
899}

References G4RunManagerKernel::DumpRegion(), and kernel.

◆ GenerateEvent()

G4Event * G4RunManager::GenerateEvent ( G4int  i_event)
virtual

Reimplemented in G4WorkerRunManager, and G4WorkerTaskRunManager.

Definition at line 500 of file G4RunManager.cc.

501{
502 if(userPrimaryGeneratorAction == nullptr)
503 {
504 G4Exception("G4RunManager::GenerateEvent()", "Run0032", FatalException,
505 "G4VUserPrimaryGeneratorAction is not defined!");
506 return nullptr;
507 }
508
509 G4Event* anEvent = new G4Event(i_event);
510
513 {
514 std::ostringstream oss;
515 G4Random::saveFullState(oss);
518 }
519
521 {
522 G4String fileN = "currentEvent";
524 {
525 std::ostringstream os;
526 os << "run" << currentRun->GetRunID() << "evt" << anEvent->GetEventID();
527 fileN = os.str();
528 }
529 StoreRNGStatus(fileN);
530 }
531
532 if(printModulo > 0 && anEvent->GetEventID() % printModulo == 0)
533 {
534 G4cout << "--> Event " << anEvent->GetEventID() << " starts." << G4endl;
535 }
537 return anEvent;
538}
void SetRandomNumberStatus(G4String &st)
Definition: G4Event.hh:90
G4int GetEventID() const
Definition: G4Event.hh:118
G4int storeRandomNumberStatusToG4Event
G4bool rngStatusEventsFlag
G4bool storeRandomNumberStatus
virtual void StoreRNGStatus(const G4String &filenamePrefix)
G4int GetRunID() const
Definition: G4Run.hh:78
virtual void GeneratePrimaries(G4Event *anEvent)=0

References currentRun, FatalException, G4cout, G4endl, G4Exception(), G4VUserPrimaryGeneratorAction::GeneratePrimaries(), G4Event::GetEventID(), G4Run::GetRunID(), printModulo, randomNumberStatusForThisEvent, rngStatusEventsFlag, G4Event::SetRandomNumberStatus(), storeRandomNumberStatus, storeRandomNumberStatusToG4Event, StoreRNGStatus(), and userPrimaryGeneratorAction.

Referenced by ProcessOneEvent().

◆ GeometryDirectlyUpdated()

void G4RunManager::GeometryDirectlyUpdated ( G4bool  val = true)
inline

Definition at line 331 of file G4RunManager.hh.

332 {
334 }
G4bool geometryDirectlyUpdated

References geometryDirectlyUpdated.

Referenced by G4GDMLMessenger::SetNewValue().

◆ GeometryHasBeenModified()

void G4RunManager::GeometryHasBeenModified ( G4bool  prop = true)

Definition at line 1117 of file G4RunManager.cc.

1118{
1119 if(prop)
1120 {
1121 G4UImanager::GetUIpointer()->ApplyCommand("/run/geometryModified");
1122 }
1123 else
1124 {
1126 }
1127}
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:485
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:77

References G4UImanager::ApplyCommand(), G4RunManagerKernel::GeometryHasBeenModified(), G4UImanager::GetUIpointer(), and kernel.

Referenced by ConstructScoringWorlds(), export_G4RunManager(), and G4RunMessenger::SetNewValue().

◆ GetCurrentEvent()

const G4Event * G4RunManager::GetCurrentEvent ( ) const
inline

◆ GetCurrentRun()

const G4Run * G4RunManager::GetCurrentRun ( ) const
inline

◆ GetFlagRandomNumberStatusToG4Event()

G4int G4RunManager::GetFlagRandomNumberStatusToG4Event ( ) const
inline

Definition at line 451 of file G4RunManager.hh.

452 {
454 }

References storeRandomNumberStatusToG4Event.

Referenced by G4RunMessenger::GetCurrentValue().

◆ GetGeometryToBeOptimized()

G4bool G4RunManager::GetGeometryToBeOptimized ( )
inline

Definition at line 326 of file G4RunManager.hh.

327 {
329 }
G4bool geometryToBeOptimized

References geometryToBeOptimized.

Referenced by export_G4RunManager().

◆ GetNonConstCurrentRun()

G4Run * G4RunManager::GetNonConstCurrentRun ( ) const
inline

Definition at line 534 of file G4RunManager.hh.

534{ return currentRun; }

References currentRun.

◆ GetNonConstUserActionInitialization()

G4VUserActionInitialization * G4RunManager::GetNonConstUserActionInitialization ( ) const
inline

◆ GetNumberOfEventsToBeProcessed()

G4int G4RunManager::GetNumberOfEventsToBeProcessed ( ) const
inline

◆ GetNumberOfParallelWorld()

G4int G4RunManager::GetNumberOfParallelWorld ( ) const
inline

Definition at line 562 of file G4RunManager.hh.

562{ return nParallelWorlds; }
G4int nParallelWorlds

References nParallelWorlds.

◆ GetNumberOfSelectEvents()

G4int G4RunManager::GetNumberOfSelectEvents ( ) const
inline

Definition at line 571 of file G4RunManager.hh.

571{ return n_select_msg; }
G4int n_select_msg

References n_select_msg.

Referenced by G4WorkerRunManager::DoWork(), and G4WorkerTaskRunManager::DoWork().

◆ GetNumberOfThreads()

virtual G4int G4RunManager::GetNumberOfThreads ( ) const
inlinevirtual

Reimplemented in G4MTRunManager, and G4TaskRunManager.

Definition at line 265 of file G4RunManager.hh.

265{ return 1; }

◆ GetPreviousEvent()

const G4Event * G4RunManager::GetPreviousEvent ( G4int  i) const
inline

Definition at line 540 of file G4RunManager.hh.

546 {
547 if(i >= 1 && i <= n_perviousEventsToBeStored)
548 {
549 auto itr = previousEvents->cbegin();
550 for(G4int j = 1; j < i; ++j)
551 {
552 ++itr;
553 }
554 return *itr;
555 }
556 return nullptr;
557 }
G4int n_perviousEventsToBeStored

References n_perviousEventsToBeStored, and previousEvents.

Referenced by G4DigiManager::GetDigiCollection(), and G4DigiManager::GetHitsCollection().

◆ GetPrintProgress()

G4int G4RunManager::GetPrintProgress ( )
inline

Definition at line 521 of file G4RunManager.hh.

521{ return printModulo; }

References printModulo.

Referenced by G4TheMTRayTracer::CreateBitMap(), and G4RunMessenger::GetCurrentValue().

◆ GetRandomNumberStatusForThisEvent()

const G4String & G4RunManager::GetRandomNumberStatusForThisEvent ( ) const
inline

Definition at line 495 of file G4RunManager.hh.

496 {
499 {
500 G4Exception("GrRunManager::SetRandomNumberStoreDir", "Run0072",
502 "Random number status is not available for this event.");
503 }
505 }
@ JustWarning

References G4Exception(), JustWarning, randomNumberStatusForThisEvent, and storeRandomNumberStatusToG4Event.

◆ GetRandomNumberStatusForThisRun()

const G4String & G4RunManager::GetRandomNumberStatusForThisRun ( ) const
inline

Definition at line 491 of file G4RunManager.hh.

492 {
494 }

References randomNumberStatusForThisRun.

◆ GetRandomNumberStore()

G4bool G4RunManager::GetRandomNumberStore ( ) const
inline

Definition at line 460 of file G4RunManager.hh.

461 {
463 }

References storeRandomNumberStatus.

Referenced by export_G4RunManager().

◆ GetRandomNumberStoreDir()

const G4String & G4RunManager::GetRandomNumberStoreDir ( ) const
inline

Definition at line 487 of file G4RunManager.hh.

488 {
490 }

References randomNumberStatusDir.

Referenced by export_G4RunManager(), and G4RunMessenger::GetCurrentValue().

◆ GetRandomNumberStorePerEvent()

G4bool G4RunManager::GetRandomNumberStorePerEvent ( ) const
inline

Definition at line 510 of file G4RunManager.hh.

511 {
512 return rngStatusEventsFlag;
513 }

References rngStatusEventsFlag.

◆ GetRunManager()

G4RunManager * G4RunManager::GetRunManager ( )
static

◆ GetRunManagerType()

RMType G4RunManager::GetRunManagerType ( ) const
inline

Definition at line 582 of file G4RunManager.hh.

582{ return runManagerType; }

References runManagerType.

Referenced by G4RunMessenger::GetCurrentValue(), G4RunMessenger::SetNewValue(), and G4Run::~G4Run().

◆ GetSelectMacro()

const G4String & G4RunManager::GetSelectMacro ( ) const
inline

Definition at line 572 of file G4RunManager.hh.

572{ return selectMacro; }
G4String selectMacro

References selectMacro.

Referenced by G4WorkerRunManager::DoWork(), and G4WorkerTaskRunManager::DoWork().

◆ GetUserActionInitialization()

const G4VUserActionInitialization * G4RunManager::GetUserActionInitialization ( ) const
inline

◆ GetUserDetectorConstruction()

const G4VUserDetectorConstruction * G4RunManager::GetUserDetectorConstruction ( ) const
inline

◆ GetUserEventAction()

const G4UserEventAction * G4RunManager::GetUserEventAction ( ) const
inline

Definition at line 404 of file G4RunManager.hh.

405 {
406 return userEventAction;
407 }
G4UserEventAction * userEventAction

References userEventAction.

Referenced by G4AdjointSimManager::DefineUserActions(), export_G4RunManager(), and G4RTWorkerInitialization::WorkerRunStart().

◆ GetUserPhysicsList()

const G4VUserPhysicsList * G4RunManager::GetUserPhysicsList ( ) const
inline

Definition at line 376 of file G4RunManager.hh.

377 {
378 return physicsList;
379 }

References physicsList.

Referenced by export_G4RunManager(), G4TaskRunManagerKernel::InitializeWorker(), and G4MTRunManagerKernel::StartThread().

◆ GetUserPrimaryGeneratorAction()

const G4VUserPrimaryGeneratorAction * G4RunManager::GetUserPrimaryGeneratorAction ( ) const
inline

◆ GetUserRunAction()

const G4UserRunAction * G4RunManager::GetUserRunAction ( ) const
inline

◆ GetUserStackingAction()

const G4UserStackingAction * G4RunManager::GetUserStackingAction ( ) const
inline

Definition at line 408 of file G4RunManager.hh.

409 {
410 return userStackingAction;
411 }
G4UserStackingAction * userStackingAction

References userStackingAction.

Referenced by G4AdjointSimManager::DefineUserActions(), export_G4RunManager(), and G4RTWorkerInitialization::WorkerRunStart().

◆ GetUserSteppingAction()

const G4UserSteppingAction * G4RunManager::GetUserSteppingAction ( ) const
inline

Definition at line 416 of file G4RunManager.hh.

417 {
418 return userSteppingAction;
419 }
G4UserSteppingAction * userSteppingAction

References userSteppingAction.

Referenced by G4AdjointSimManager::DefineUserActions(), export_G4RunManager(), and G4RTWorkerInitialization::WorkerRunStart().

◆ GetUserTrackingAction()

const G4UserTrackingAction * G4RunManager::GetUserTrackingAction ( ) const
inline

Definition at line 412 of file G4RunManager.hh.

413 {
414 return userTrackingAction;
415 }
G4UserTrackingAction * userTrackingAction

References userTrackingAction.

Referenced by G4AdjointSimManager::DefineUserActions(), export_G4RunManager(), and G4RTWorkerInitialization::WorkerRunStart().

◆ GetUserWorkerInitialization()

const G4UserWorkerInitialization * G4RunManager::GetUserWorkerInitialization ( ) const
inline

◆ GetUserWorkerThreadInitialization()

const G4UserWorkerThreadInitialization * G4RunManager::GetUserWorkerThreadInitialization ( ) const
inline

◆ GetVerboseLevel()

G4int G4RunManager::GetVerboseLevel ( ) const
inline

◆ GetVersionString()

const G4String & G4RunManager::GetVersionString ( ) const
inline

Definition at line 431 of file G4RunManager.hh.

432 {
433 return kernel->GetVersionString();
434 }
const G4String & GetVersionString() const

References G4RunManagerKernel::GetVersionString(), and kernel.

Referenced by export_G4RunManager().

◆ IfGeometryHasBeenDestroyed()

G4bool G4RunManager::IfGeometryHasBeenDestroyed ( )
static

Definition at line 105 of file G4RunManager.cc.

106{
108}

References fGeometryHasBeenDestroyed.

Referenced by G4WorkerTaskRunManager::RunInitialization().

◆ Initialize()

void G4RunManager::Initialize ( void  )
virtual

Reimplemented in G4MTRunManager, and G4TaskRunManager.

Definition at line 667 of file G4RunManager.cc.

668{
670 G4ApplicationState currentState = stateManager->GetCurrentState();
671 if(currentState != G4State_PreInit && currentState != G4State_Idle)
672 {
673 G4cerr << "Illegal application state - "
674 << "G4RunManager::Initialize() ignored." << G4endl;
675 return;
676 }
677
678 stateManager->SetNewState(G4State_Init);
684 if(stateManager->GetCurrentState() != G4State_Idle)
685 {
686 stateManager->SetNewState(G4State_Idle);
687 }
688}
@ G4State_Init
virtual void InitializePhysics()
virtual void InitializeGeometry()

References G4cerr, G4endl, G4State_Idle, G4State_Init, G4State_PreInit, geometryInitialized, G4StateManager::GetCurrentState(), G4StateManager::GetStateManager(), initializedAtLeastOnce, InitializeGeometry(), InitializePhysics(), physicsInitialized, and G4StateManager::SetNewState().

Referenced by ConfirmBeamOnCondition(), export_G4RunManager(), G4MTRunManager::Initialize(), G4TaskRunManager::Initialize(), G4RunMessenger::SetNewValue(), and G4MTRunManagerKernel::StartThread().

◆ InitializeEventLoop()

void G4RunManager::InitializeEventLoop ( G4int  n_event,
const char *  macroFile = nullptr,
G4int  n_select = -1 
)
virtual

Reimplemented in G4MTRunManager, and G4TaskRunManager.

Definition at line 433 of file G4RunManager.cc.

435{
436 if(verboseLevel > 0)
437 {
438 timer->Start();
439 }
440
441 n_select_msg = n_select;
442 if(macroFile != 0)
443 {
444 if(n_select_msg < 0)
445 n_select_msg = n_event;
446 msgText = "/control/execute ";
447 msgText += macroFile;
448 selectMacro = macroFile;
449 }
450 else
451 {
452 n_select_msg = -1;
453 selectMacro = "";
454 }
455}
G4String msgText
void Start()

References msgText, n_select_msg, selectMacro, G4Timer::Start(), timer, and verboseLevel.

Referenced by G4WorkerRunManager::DoEventLoop(), DoEventLoop(), and G4WorkerTaskRunManager::DoEventLoop().

◆ InitializeGeometry()

void G4RunManager::InitializeGeometry ( )
virtual

Reimplemented in G4WorkerRunManager.

Definition at line 691 of file G4RunManager.cc.

692{
693 if(userDetector == nullptr)
694 {
695 G4Exception("G4RunManager::InitializeGeometry", "Run0033", FatalException,
696 "G4VUserDetectorConstruction is not defined!");
697 return;
698 }
699
700 if(verboseLevel > 1)
701 G4cout << "userDetector->Construct() start." << G4endl;
702
704 G4ApplicationState currentState = stateManager->GetCurrentState();
705 if(currentState == G4State_PreInit || currentState == G4State_Idle)
706 {
707 stateManager->SetNewState(G4State_Init);
708 }
710 {
716 }
717 // Notify the VisManager as well
719 {
721 if(pVVisManager != nullptr)
722 pVVisManager->GeometryHasChanged();
723 }
724
726 geometryInitialized = true;
727 stateManager->SetNewState(currentState);
728}
void SetNumberOfParallelWorld(G4int i)
virtual G4VPhysicalVolume * Construct()=0
static G4VVisManager * GetConcreteInstance()
virtual void GeometryHasChanged()=0
G4bool IsMasterThread()
Definition: G4Threading.cc:124

References G4VUserDetectorConstruction::Construct(), G4VUserDetectorConstruction::ConstructParallelGeometries(), G4VUserDetectorConstruction::ConstructParallelSD(), G4VUserDetectorConstruction::ConstructSDandField(), G4RunManagerKernel::DefineWorldVolume(), FatalException, G4cout, G4endl, G4Exception(), G4State_Idle, G4State_Init, G4State_PreInit, geometryDirectlyUpdated, G4VVisManager::GeometryHasChanged(), geometryInitialized, G4VVisManager::GetConcreteInstance(), G4StateManager::GetCurrentState(), G4StateManager::GetStateManager(), G4Threading::IsMasterThread(), kernel, nParallelWorlds, G4StateManager::SetNewState(), G4RunManagerKernel::SetNumberOfParallelWorld(), userDetector, and verboseLevel.

Referenced by Initialize().

◆ InitializePhysics()

void G4RunManager::InitializePhysics ( )
virtual

Definition at line 731 of file G4RunManager.cc.

732{
734 G4ApplicationState currentState = stateManager->GetCurrentState();
735 if(currentState == G4State_PreInit || currentState == G4State_Idle)
736 {
737 stateManager->SetNewState(G4State_Init);
738 }
739 if(physicsList != nullptr)
740 {
742 }
743 else
744 {
745 G4Exception("G4RunManager::InitializePhysics()", "Run0034", FatalException,
746 "G4VUserPhysicsList is not defined!");
747 }
748 physicsInitialized = true;
749 stateManager->SetNewState(currentState);
750}

References FatalException, G4Exception(), G4State_Idle, G4State_Init, G4State_PreInit, G4StateManager::GetCurrentState(), G4StateManager::GetStateManager(), G4RunManagerKernel::InitializePhysics(), kernel, physicsInitialized, physicsList, and G4StateManager::SetNewState().

Referenced by Initialize().

◆ operator=()

G4RunManager & G4RunManager::operator= ( const G4RunManager )
delete

◆ PhysicsHasBeenModified()

void G4RunManager::PhysicsHasBeenModified ( )
inline

◆ ProcessOneEvent()

void G4RunManager::ProcessOneEvent ( G4int  i_event)
virtual

◆ ReinitializeGeometry()

void G4RunManager::ReinitializeGeometry ( G4bool  destroyFirst = false,
G4bool  prop = true 
)

Definition at line 1130 of file G4RunManager.cc.

1131{
1132 if(destroyFirst && G4Threading::IsMasterThread())
1133 {
1134 if(verboseLevel > 0)
1135 {
1136 G4cout << "#### Assemblies, Volumes and Solids Stores are wiped out."
1137 << G4endl;
1138 }
1144
1145 // remove all logical volume pointers from regions
1146 // exception: world logical volume pointer must be kept
1148 for(auto rItr = regionStore->cbegin(); rItr != regionStore->cend(); ++rItr)
1149 {
1150 if((*rItr)->GetName() == "DefaultRegionForTheWorld")
1151 continue;
1152 // if((*rItr)->GetName()=="DefaultRegionForParallelWorld") continue;
1153 auto lvItr = (*rItr)->GetRootLogicalVolumeIterator();
1154 for(std::size_t iRLV=0; iRLV<(*rItr)->GetNumberOfRootVolumes(); ++iRLV)
1155 {
1156 (*rItr)->RemoveRootLogicalVolume(*lvItr, false);
1157 ++lvItr;
1158 }
1159 if(verboseLevel > 0)
1160 {
1161 G4cout << "#### Region <" << (*rItr)->GetName() << "> is cleared."
1162 << G4endl;
1163 }
1164 }
1165
1166 // clear transportation manager
1169 }
1170 if(prop)
1171 {
1172 G4UImanager::GetUIpointer()->ApplyCommand("/run/reinitializeGeometry");
1173 }
1174 else
1175 {
1177 geometryInitialized = false;
1178 // Notify the VisManager as well
1180 {
1182 if(pVVisManager != nullptr)
1183 pVVisManager->GeometryHasChanged();
1184 }
1185 }
1186}
static G4AssemblyStore * GetInstance()
static void Clean()
static G4GeometryManager * GetInstance()
void OpenGeometry(G4VPhysicalVolume *vol=nullptr)
static G4LogicalVolumeStore * GetInstance()
static G4PhysicalVolumeStore * GetInstance()
static G4RegionStore * GetInstance()
static void Clean()
Definition: G4SolidStore.cc:74
static G4SolidStore * GetInstance()

References G4UImanager::ApplyCommand(), G4LogicalVolumeStore::Clean(), G4PhysicalVolumeStore::Clean(), G4SolidStore::Clean(), G4AssemblyStore::Clean(), G4TransportationManager::ClearParallelWorlds(), fGeometryHasBeenDestroyed, G4cout, G4endl, G4RunManagerKernel::GeometryHasBeenModified(), G4VVisManager::GeometryHasChanged(), geometryInitialized, G4VVisManager::GetConcreteInstance(), G4GeometryManager::GetInstance(), G4LogicalVolumeStore::GetInstance(), G4PhysicalVolumeStore::GetInstance(), G4RegionStore::GetInstance(), G4SolidStore::GetInstance(), G4AssemblyStore::GetInstance(), G4TransportationManager::GetTransportationManager(), G4UImanager::GetUIpointer(), G4Threading::IsMasterThread(), kernel, G4GeometryManager::OpenGeometry(), and verboseLevel.

Referenced by G4GDMLMessenger::SetNewValue(), and G4RunMessenger::SetNewValue().

◆ ReOptimize()

void G4RunManager::ReOptimize ( G4LogicalVolume pLog)

Definition at line 1009 of file G4RunManager.cc.

1010{
1011 G4Timer localtimer;
1012 if(verboseLevel > 1)
1013 {
1014 localtimer.Start();
1015 }
1016 G4SmartVoxelHeader* header = pLog->GetVoxelHeader();
1017 delete header;
1018 header = new G4SmartVoxelHeader(pLog);
1019 pLog->SetVoxelHeader(header);
1020 if(verboseLevel > 1)
1021 {
1022 localtimer.Stop();
1023 G4SmartVoxelStat stat(pLog, header, localtimer.GetSystemElapsed(),
1024 localtimer.GetUserElapsed());
1025 G4cout << G4endl << "Voxelisation of logical volume <" << pLog->GetName()
1026 << ">" << G4endl;
1027 G4cout << " heads : " << stat.GetNumberHeads()
1028 << " - nodes : " << stat.GetNumberNodes()
1029 << " - pointers : " << stat.GetNumberPointers() << G4endl;
1030 G4cout << " Memory used : " << (stat.GetMemoryUse() + 512) / 1024
1031 << "k - total time : " << stat.GetTotalTime()
1032 << " - system time : " << stat.GetSysTime() << G4endl;
1033 }
1034}
void SetVoxelHeader(G4SmartVoxelHeader *pVoxel)
const G4String & GetName() const
G4SmartVoxelHeader * GetVoxelHeader() const
void Stop()
G4double GetSystemElapsed() const
Definition: G4Timer.cc:132
G4double GetUserElapsed() const
Definition: G4Timer.cc:143

References G4cout, G4endl, G4SmartVoxelStat::GetMemoryUse(), G4LogicalVolume::GetName(), G4SmartVoxelStat::GetNumberHeads(), G4SmartVoxelStat::GetNumberNodes(), G4SmartVoxelStat::GetNumberPointers(), G4Timer::GetSystemElapsed(), G4SmartVoxelStat::GetSysTime(), G4SmartVoxelStat::GetTotalTime(), G4Timer::GetUserElapsed(), G4LogicalVolume::GetVoxelHeader(), G4LogicalVolume::SetVoxelHeader(), G4Timer::Start(), G4Timer::Stop(), and verboseLevel.

Referenced by ReOptimizeMotherOf().

◆ ReOptimizeMotherOf()

void G4RunManager::ReOptimizeMotherOf ( G4VPhysicalVolume pPhys)

Definition at line 1001 of file G4RunManager.cc.

1002{
1003 G4LogicalVolume* pMotherL = pPhys->GetMotherLogical();
1004 if(pMotherL != nullptr)
1005 ReOptimize(pMotherL);
1006}
void ReOptimize(G4LogicalVolume *)
G4LogicalVolume * GetMotherLogical() const

References G4VPhysicalVolume::GetMotherLogical(), and ReOptimize().

◆ RestoreRandomNumberStatus()

void G4RunManager::RestoreRandomNumberStatus ( const G4String fileN)
virtual

Definition at line 870 of file G4RunManager.cc.

871{
872 G4String fileNameWithDirectory;
873 if(fileN.find("/") == std::string::npos)
874 {
875 fileNameWithDirectory = randomNumberStatusDir + fileN;
876 }
877 else
878 {
879 fileNameWithDirectory = fileN;
880 }
881
882 G4Random::restoreEngineStatus(fileNameWithDirectory);
883 if(verboseLevel > 0)
884 G4cout << "RandomNumberEngineStatus restored from file: "
885 << fileNameWithDirectory << G4endl;
886 G4Random::showEngineStatus();
887}

References G4cout, G4endl, randomNumberStatusDir, and verboseLevel.

Referenced by export_G4RunManager(), and G4RunMessenger::SetNewValue().

◆ RestoreRndmEachEvent()

virtual void G4RunManager::RestoreRndmEachEvent ( G4bool  )
inlinevirtual

Reimplemented in G4WorkerRunManager, and G4WorkerTaskRunManager.

Definition at line 346 of file G4RunManager.hh.

346{ /* No effect in SEQ */ }

Referenced by G4RunMessenger::SetNewValue().

◆ rndmSaveThisEvent()

void G4RunManager::rndmSaveThisEvent ( )
virtual

Reimplemented in G4MTRunManager, and G4WorkerRunManager.

Definition at line 831 of file G4RunManager.cc.

832{
833 if(currentEvent == 0)
834 {
835 G4cerr << "Warning from G4RunManager::rndmSaveThisEvent():"
836 << " there is no currentEvent available." << G4endl
837 << "Command ignored." << G4endl;
838 return;
839 }
840
842 {
843 G4cerr << "Warning from G4RunManager::rndmSaveThisEvent():"
844 << " Random number engine status is not available." << G4endl
845 << "/random/setSavingFlag command must be issued "
846 << "prior to the start of the run. Command ignored." << G4endl;
847 return;
848 }
849
850 G4String fileIn = randomNumberStatusDir + "currentEvent.rndm";
851
852 std::ostringstream os;
853 os << "run" << currentRun->GetRunID() << "evt" << currentEvent->GetEventID()
854 << ".rndm" << '\0';
855 G4String fileOut = randomNumberStatusDir + os.str();
856
857#ifdef WIN32
858 G4String copCmd = "/control/shell copy " + fileIn + " " + fileOut;
859#else
860 G4String copCmd = "/control/shell cp " + fileIn + " " + fileOut;
861#endif
863 if(verboseLevel > 0)
864 {
865 G4cout << fileIn << " is copied to " << fileOut << G4endl;
866 }
867}

References G4UImanager::ApplyCommand(), currentEvent, currentRun, G4cerr, G4cout, G4endl, G4Event::GetEventID(), G4Run::GetRunID(), G4UImanager::GetUIpointer(), randomNumberStatusDir, storeRandomNumberStatus, and verboseLevel.

Referenced by export_G4RunManager(), and G4RunMessenger::SetNewValue().

◆ rndmSaveThisRun()

void G4RunManager::rndmSaveThisRun ( )
virtual

Reimplemented in G4MTRunManager, and G4WorkerRunManager.

Definition at line 798 of file G4RunManager.cc.

799{
800 G4int runNumber = 0;
801 if(currentRun != nullptr)
802 runNumber = currentRun->GetRunID();
804 {
805 G4cerr << "Warning from G4RunManager::rndmSaveThisRun():"
806 << " Random number status was not stored prior to this run."
807 << G4endl << "/random/setSavingFlag command must be issued. "
808 << "Command ignored." << G4endl;
809 return;
810 }
811
812 G4String fileIn = randomNumberStatusDir + "currentRun.rndm";
813
814 std::ostringstream os;
815 os << "run" << runNumber << ".rndm" << '\0';
816 G4String fileOut = randomNumberStatusDir + os.str();
817
818#ifdef WIN32
819 G4String copCmd = "/control/shell copy " + fileIn + " " + fileOut;
820#else
821 G4String copCmd = "/control/shell cp " + fileIn + " " + fileOut;
822#endif
824 if(verboseLevel > 0)
825 {
826 G4cout << fileIn << " is copied to " << fileOut << G4endl;
827 }
828}

References G4UImanager::ApplyCommand(), currentRun, G4cerr, G4cout, G4endl, G4Run::GetRunID(), G4UImanager::GetUIpointer(), randomNumberStatusDir, storeRandomNumberStatus, and verboseLevel.

Referenced by export_G4RunManager(), and G4RunMessenger::SetNewValue().

◆ RunInitialization()

void G4RunManager::RunInitialization ( )
virtual

Reimplemented in G4WorkerRunManager, and G4WorkerTaskRunManager.

Definition at line 332 of file G4RunManager.cc.

333{
335 return;
336
337 runAborted = false;
339
341 delete currentRun;
342 currentRun = nullptr;
343
344 if(fakeRun)
345 return;
346
349
350 if(userRunAction != nullptr)
352 if(currentRun == nullptr)
353 currentRun = new G4Run();
354
357
360 if(fSDM != nullptr)
361 {
363 }
364
365 if(G4VScoreNtupleWriter::Instance() != nullptr)
366 {
367 auto hce = fSDM->PrepareNewEvent();
369 delete hce;
370 }
371
372 std::ostringstream oss;
373 G4Random::saveFullState(oss);
376
377 for(G4int i_prev = 0; i_prev < n_perviousEventsToBeStored; ++i_prev)
378 {
379 previousEvents->push_back(nullptr);
380 }
381
382 if(printModulo >= 0 || verboseLevel > 0)
383 {
384 G4cout << "### Run " << currentRun->GetRunID() << " starts." << G4endl;
385 }
386 if(userRunAction != nullptr)
388
389#if defined(GEANT4_USE_TIMEMORY)
391#endif
392
394 {
396 }
397
399 {
400 G4String fileN = "currentRun";
402 {
403 std::ostringstream os;
404 os << "run" << currentRun->GetRunID();
405 fileN = os.str();
406 }
407 StoreRNGStatus(fileN);
408 }
409}
static G4ParallelWorldProcessStore * GetInstance()
G4bool RunInitialization(G4bool fakeRun=false)
G4bool isScoreNtupleWriter
G4int runIDCounter
std::unique_ptr< ProfilerConfig > masterRunProfiler
G4DCtable * DCtable
G4ProfilerConfig< G4ProfileType::Run > ProfilerConfig
Definition: G4Run.hh:49
void SetHCtable(G4HCtable *HCtbl)
Definition: G4Run.hh:107
void SetNumberOfEventToBeProcessed(G4int n_ev)
Definition: G4Run.hh:103
void SetRunID(G4int id)
Definition: G4Run.hh:102
void SetDCtable(G4DCtable *DCtbl)
Definition: G4Run.hh:108
void SetRandomNumberStatus(G4String &st)
Definition: G4Run.hh:109
G4HCofThisEvent * PrepareNewEvent()
Definition: G4SDManager.cc:113
static G4SDManager * GetSDMpointerIfExist()
Definition: G4SDManager.cc:47
G4HCtable * GetHCtable() const
Definition: G4SDManager.hh:101
virtual void BeginOfRunAction(const G4Run *aRun)
virtual G4Run * GenerateRun()
virtual G4bool Book(G4HCofThisEvent *hce)=0
static G4VScoreNtupleWriter * Instance()
virtual void OpenFile()=0

References G4UserRunAction::BeginOfRunAction(), G4VScoreNtupleWriter::Book(), CleanUpPreviousEvents(), currentRun, DCtable, fakeRun, fGeometryHasBeenDestroyed, G4cout, G4endl, G4UserRunAction::GenerateRun(), G4SDManager::GetHCtable(), G4ParallelWorldProcessStore::GetInstance(), G4Run::GetRunID(), G4SDManager::GetSDMpointerIfExist(), G4VScoreNtupleWriter::Instance(), isScoreNtupleWriter, kernel, masterRunProfiler, n_perviousEventsToBeStored, numberOfEventProcessed, numberOfEventToBeProcessed, G4VScoreNtupleWriter::OpenFile(), G4SDManager::PrepareNewEvent(), previousEvents, printModulo, randomNumberStatusForThisRun, rngStatusEventsFlag, runAborted, runIDCounter, G4RunManagerKernel::RunInitialization(), G4Run::SetDCtable(), G4Run::SetHCtable(), G4Run::SetNumberOfEventToBeProcessed(), G4Run::SetRandomNumberStatus(), G4Run::SetRunID(), storeRandomNumberStatus, StoreRNGStatus(), G4ParallelWorldProcessStore::UpdateWorlds(), userRunAction, and verboseLevel.

Referenced by BeamOn().

◆ RunTermination()

void G4RunManager::RunTermination ( )
virtual

Reimplemented in G4MTRunManager, G4WorkerRunManager, G4TaskRunManager, and G4WorkerTaskRunManager.

Definition at line 558 of file G4RunManager.cc.

559{
560 if(!fakeRun)
561 {
562#if defined(GEANT4_USE_TIMEMORY)
563 masterRunProfiler.reset();
564#endif
566 // tasking occasionally will call this function even
567 // if there was not a current run
568 if(currentRun != nullptr)
569 {
570 if(userRunAction != nullptr)
572 G4VPersistencyManager* fPersM =
574 if(fPersM != nullptr)
575 fPersM->Store(currentRun);
576 // write & close analysis output
578 {
580 }
581 }
582 ++runIDCounter;
583 }
584
586}
void CleanUpUnnecessaryEvents(G4int keepNEvents)
virtual void EndOfRunAction(const G4Run *aRun)
virtual void Write()=0

References CleanUpUnnecessaryEvents(), currentRun, G4UserRunAction::EndOfRunAction(), fakeRun, G4VPersistencyManager::GetPersistencyManager(), G4VScoreNtupleWriter::Instance(), isScoreNtupleWriter, kernel, masterRunProfiler, runIDCounter, G4RunManagerKernel::RunTermination(), G4VPersistencyManager::Store(), userRunAction, and G4VScoreNtupleWriter::Write().

Referenced by BeamOn(), G4MTRunManager::RunTermination(), G4WorkerRunManager::RunTermination(), G4TaskRunManager::RunTermination(), and G4WorkerTaskRunManager::RunTermination().

◆ SetDCtable()

void G4RunManager::SetDCtable ( G4DCtable DCtbl)
inline

Definition at line 573 of file G4RunManager.hh.

573{ DCtable = DCtbl; }

References DCtable.

Referenced by G4DigiManager::AddNewModule().

◆ SetGeometryToBeOptimized()

void G4RunManager::SetGeometryToBeOptimized ( G4bool  vl)
inline

◆ SetNumberOfAdditionalWaitingStacks()

void G4RunManager::SetNumberOfAdditionalWaitingStacks ( G4int  iAdd)
inline

Definition at line 422 of file G4RunManager.hh.

427 {
429 }
void SetNumberOfAdditionalWaitingStacks(G4int iAdd)

References eventManager, and G4EventManager::SetNumberOfAdditionalWaitingStacks().

◆ SetNumberOfEventsToBeProcessed()

void G4RunManager::SetNumberOfEventsToBeProcessed ( G4int  val)
inline

Definition at line 563 of file G4RunManager.hh.

564 {
566 }

References numberOfEventToBeProcessed.

◆ SetNumberOfEventsToBeStored()

void G4RunManager::SetNumberOfEventsToBeStored ( G4int  val)
inline

Definition at line 524 of file G4RunManager.hh.

529 {
531 }

References n_perviousEventsToBeStored.

◆ SetNumberOfThreads()

virtual void G4RunManager::SetNumberOfThreads ( G4int  )
inlinevirtual

Reimplemented in G4MTRunManager, and G4TaskRunManager.

Definition at line 264 of file G4RunManager.hh.

264{}

◆ SetPrimaryTransformer()

void G4RunManager::SetPrimaryTransformer ( G4PrimaryTransformer pt)
inline

Definition at line 436 of file G4RunManager.hh.

437 {
439 }
void SetPrimaryTransformer(G4PrimaryTransformer *pt)

References kernel, and G4RunManagerKernel::SetPrimaryTransformer().

◆ SetPrintProgress()

void G4RunManager::SetPrintProgress ( G4int  i)
inline

Definition at line 522 of file G4RunManager.hh.

522{ printModulo = i; }

References printModulo.

Referenced by G4RunMessenger::SetNewValue().

◆ SetRandomNumberStore()

void G4RunManager::SetRandomNumberStore ( G4bool  flag)
inline

Definition at line 456 of file G4RunManager.hh.

457 {
459 }

References storeRandomNumberStatus.

Referenced by export_G4RunManager(), and G4RunMessenger::SetNewValue().

◆ SetRandomNumberStoreDir()

void G4RunManager::SetRandomNumberStoreDir ( const G4String dir)
inline

Definition at line 464 of file G4RunManager.hh.

465 {
466 G4String dirStr = dir;
467 if(dirStr.back() != '/')
468 dirStr += "/";
469 #ifndef WIN32
470 G4String shellCmd = "mkdir -p ";
471 #else
472 std::replace(dirStr.begin(), dirStr.end(), '/', '\\');
473 G4String shellCmd = "if not exist " + dirStr + " mkdir ";
474 #endif
475 shellCmd += dirStr;
476 randomNumberStatusDir = dirStr;
477 G4int sysret = system(shellCmd);
478 if(sysret != 0)
479 {
480 G4String errmsg = "\"" + shellCmd
481 + "\" returns non-zero value. Directory creation failed.";
482 G4Exception("GrRunManager::SetRandomNumberStoreDir", "Run0071",
483 JustWarning, errmsg);
484 G4cerr << " return value = " << sysret << G4endl;
485 }
486 }

References G4cerr, G4endl, G4Exception(), JustWarning, and randomNumberStatusDir.

Referenced by export_G4RunManager(), and G4RunMessenger::SetNewValue().

◆ SetRandomNumberStorePerEvent()

void G4RunManager::SetRandomNumberStorePerEvent ( G4bool  flag)
inline

Definition at line 506 of file G4RunManager.hh.

507 {
508 rngStatusEventsFlag = flag;
509 }

References rngStatusEventsFlag.

Referenced by G4RunMessenger::SetNewValue().

◆ SetRunIDCounter()

void G4RunManager::SetRunIDCounter ( G4int  i)
inline

Definition at line 558 of file G4RunManager.hh.

558{ runIDCounter = i; }

References runIDCounter.

Referenced by export_G4RunManager(), G4MTRunManager::Initialize(), and G4TaskRunManager::Initialize().

◆ SetUserAction() [1/6]

void G4RunManager::SetUserAction ( G4UserEventAction userAction)
virtual

Reimplemented in G4MTRunManager, and G4WorkerRunManager.

Definition at line 1089 of file G4RunManager.cc.

1090{
1091 eventManager->SetUserAction(userAction);
1092 userEventAction = userAction;
1093}
void SetUserAction(G4UserEventAction *userAction)

References eventManager, G4EventManager::SetUserAction(), and userEventAction.

◆ SetUserAction() [2/6]

void G4RunManager::SetUserAction ( G4UserRunAction userAction)
virtual

Reimplemented in G4MTRunManager, and G4WorkerRunManager.

Definition at line 1077 of file G4RunManager.cc.

1078{
1079 userRunAction = userAction;
1080}

References userRunAction.

Referenced by G4MTRunManager::SetUserAction(), G4WorkerRunManager::SetUserAction(), and G4VUserActionInitialization::SetUserAction().

◆ SetUserAction() [3/6]

void G4RunManager::SetUserAction ( G4UserStackingAction userAction)
virtual

Reimplemented in G4MTRunManager, and G4WorkerRunManager.

Definition at line 1096 of file G4RunManager.cc.

1097{
1098 eventManager->SetUserAction(userAction);
1099 userStackingAction = userAction;
1100}

References eventManager, G4EventManager::SetUserAction(), and userStackingAction.

◆ SetUserAction() [4/6]

void G4RunManager::SetUserAction ( G4UserSteppingAction userAction)
virtual

Reimplemented in G4MTRunManager, and G4WorkerRunManager.

Definition at line 1110 of file G4RunManager.cc.

1111{
1112 eventManager->SetUserAction(userAction);
1113 userSteppingAction = userAction;
1114}

References eventManager, G4EventManager::SetUserAction(), and userSteppingAction.

◆ SetUserAction() [5/6]

void G4RunManager::SetUserAction ( G4UserTrackingAction userAction)
virtual

Reimplemented in G4MTRunManager, and G4WorkerRunManager.

Definition at line 1103 of file G4RunManager.cc.

1104{
1105 eventManager->SetUserAction(userAction);
1106 userTrackingAction = userAction;
1107}

References eventManager, G4EventManager::SetUserAction(), and userTrackingAction.

◆ SetUserAction() [6/6]

void G4RunManager::SetUserAction ( G4VUserPrimaryGeneratorAction userAction)
virtual

Reimplemented in G4MTRunManager, and G4WorkerRunManager.

Definition at line 1083 of file G4RunManager.cc.

1084{
1085 userPrimaryGeneratorAction = userAction;
1086}

References userPrimaryGeneratorAction.

◆ SetUserInitialization() [1/5]

void G4RunManager::SetUserInitialization ( G4UserWorkerInitialization userInit)
virtual

Reimplemented in G4MTRunManager, and G4WorkerRunManager.

Definition at line 1050 of file G4RunManager.cc.

1052{
1054 "G4RunManager::SetUserInitialization()", "Run3001", FatalException,
1055 "Base-class G4RunManager cannot take G4UserWorkerInitialization. Use "
1056 "G4MTRunManager.");
1057}

References FatalException, and G4Exception().

◆ SetUserInitialization() [2/5]

void G4RunManager::SetUserInitialization ( G4UserWorkerThreadInitialization userInit)
virtual

Reimplemented in G4MTRunManager, and G4WorkerRunManager.

Definition at line 1060 of file G4RunManager.cc.

1062{
1064 "G4RunManager::SetUserThreadInitialization()", "Run3001", FatalException,
1065 "Base-class G4RunManager cannot take G4UserWorkerThreadInitialization. "
1066 "Use G4MTRunManager.");
1067}

References FatalException, and G4Exception().

◆ SetUserInitialization() [3/5]

void G4RunManager::SetUserInitialization ( G4VUserActionInitialization userInit)
virtual

Reimplemented in G4MTRunManager, and G4WorkerRunManager.

Definition at line 1070 of file G4RunManager.cc.

1071{
1072 userActionInitialization = userInit;
1074}
virtual void Build() const =0

References G4VUserActionInitialization::Build(), and userActionInitialization.

◆ SetUserInitialization() [4/5]

void G4RunManager::SetUserInitialization ( G4VUserDetectorConstruction userInit)
virtual

Reimplemented in G4MTRunManager, and G4WorkerRunManager.

Definition at line 1037 of file G4RunManager.cc.

1038{
1039 userDetector = userInit;
1040}

References userDetector.

Referenced by G4WorkerRunManager::SetUserInitialization(), and G4MTRunManager::SetUserInitialization().

◆ SetUserInitialization() [5/5]

void G4RunManager::SetUserInitialization ( G4VUserPhysicsList userInit)
virtual

Reimplemented in G4WorkerRunManager, and G4MTRunManager.

Definition at line 1043 of file G4RunManager.cc.

1044{
1045 physicsList = userInit;
1046 kernel->SetPhysics(userInit);
1047}
void SetPhysics(G4VUserPhysicsList *uPhys)

References kernel, physicsList, and G4RunManagerKernel::SetPhysics().

◆ SetVerboseLevel()

void G4RunManager::SetVerboseLevel ( G4int  vl)
inline

Definition at line 515 of file G4RunManager.hh.

516 {
517 verboseLevel = vl;
519 }
void SetVerboseLevel(G4int vl)

References kernel, G4RunManagerKernel::SetVerboseLevel(), and verboseLevel.

Referenced by export_G4RunManager(), and G4RunMessenger::SetNewValue().

◆ StackPreviousEvent()

void G4RunManager::StackPreviousEvent ( G4Event anEvent)
protected

Definition at line 646 of file G4RunManager.cc.

647{
648 if(anEvent->ToBeKept())
649 currentRun->StoreEvent(anEvent);
650
652 {
653 if(anEvent->GetNumberOfGrips() == 0)
654 {
655 if(!(anEvent->ToBeKept()))
656 delete anEvent;
657 }
658 else
659 {
660 previousEvents->push_back(anEvent);
661 }
662 }
664}
void StoreEvent(G4Event *evt)
Definition: G4Run.cc:78

References CleanUpUnnecessaryEvents(), currentRun, G4Event::GetNumberOfGrips(), n_perviousEventsToBeStored, previousEvents, G4Run::StoreEvent(), and G4Event::ToBeKept().

Referenced by TerminateOneEvent().

◆ StoreRandomNumberStatusToG4Event()

void G4RunManager::StoreRandomNumberStatusToG4Event ( G4int  vl)
inline

◆ StoreRNGStatus()

void G4RunManager::StoreRNGStatus ( const G4String filenamePrefix)
protectedvirtual

Reimplemented in G4MTRunManager, G4WorkerRunManager, G4TaskRunManager, and G4WorkerTaskRunManager.

Definition at line 541 of file G4RunManager.cc.

542{
543 G4String fileN = randomNumberStatusDir + fnpref + ".rndm";
544 G4Random::saveEngineStatus(fileN);
545}

References randomNumberStatusDir.

Referenced by GenerateEvent(), and RunInitialization().

◆ TerminateEventLoop()

void G4RunManager::TerminateEventLoop ( )
virtual

Reimplemented in G4WorkerRunManager, and G4WorkerTaskRunManager.

Definition at line 477 of file G4RunManager.cc.

478{
479 if(verboseLevel > 0 && !fakeRun)
480 {
481 timer->Stop();
482 G4cout << " Run terminated." << G4endl;
483 G4cout << "Run Summary" << G4endl;
484 if(runAborted)
485 {
486 G4cout << " Run Aborted after " << numberOfEventProcessed
487 << " events processed." << G4endl;
488 }
489 else
490 {
491 G4cout << " Number of events processed : " << numberOfEventProcessed
492 << G4endl;
493 }
494 G4cout << " " << *timer << G4endl;
495 }
497}

References fakeRun, fGeometryHasBeenDestroyed, G4cout, G4endl, numberOfEventProcessed, runAborted, G4Timer::Stop(), timer, and verboseLevel.

Referenced by DoEventLoop(), G4MTRunManager::RunTermination(), and G4TaskRunManager::RunTermination().

◆ TerminateOneEvent()

void G4RunManager::TerminateOneEvent ( )
virtual

◆ UpdateScoring()

void G4RunManager::UpdateScoring ( )
protected

Definition at line 973 of file G4RunManager.cc.

974{
976 {
979 }
980
982 if(ScM == nullptr)
983 return;
984 G4int nPar = ScM->GetNumberOfMesh();
985 if(nPar < 1)
986 return;
987
989 if(HCE == nullptr)
990 return;
991 G4int nColl = HCE->GetCapacity();
992 for(G4int i = 0; i < nColl; ++i)
993 {
994 G4VHitsCollection* HC = HCE->GetHC(i);
995 if(HC != nullptr)
996 ScM->Accumulate(HC);
997 }
998}
G4HCofThisEvent * GetHCofThisEvent() const
Definition: G4Event.hh:156
G4VHitsCollection * GetHC(G4int i)
void Accumulate(G4VHitsCollection *map)
virtual void Fill(G4HCofThisEvent *hce, G4int eventNumber)=0

References G4ScoringManager::Accumulate(), currentEvent, G4VScoreNtupleWriter::Fill(), G4HCofThisEvent::GetCapacity(), G4Event::GetEventID(), G4HCofThisEvent::GetHC(), G4Event::GetHCofThisEvent(), G4ScoringManager::GetNumberOfMesh(), G4ScoringManager::GetScoringManagerIfExist(), G4VScoreNtupleWriter::Instance(), and isScoreNtupleWriter.

Referenced by ProcessOneEvent(), G4WorkerRunManager::ProcessOneEvent(), and G4WorkerTaskRunManager::ProcessOneEvent().

Friends And Related Function Documentation

◆ G4RunManagerFactory

friend class G4RunManagerFactory
friend

Definition at line 139 of file G4RunManager.hh.

Field Documentation

◆ currentEvent

G4Event* G4RunManager::currentEvent = nullptr
protected

◆ currentRun

G4Run* G4RunManager::currentRun = nullptr
protected

◆ currentWorld

G4VPhysicalVolume* G4RunManager::currentWorld = nullptr
protected

Definition at line 643 of file G4RunManager.hh.

◆ DCtable

G4DCtable* G4RunManager::DCtable = nullptr
protected

◆ eventManager

G4EventManager* G4RunManager::eventManager = nullptr
protected

◆ fakeRun

G4bool G4RunManager::fakeRun = false
protected

◆ fGeometryHasBeenDestroyed

G4bool G4RunManager::fGeometryHasBeenDestroyed = false
staticprotected

◆ fRunManager

G4ThreadLocal G4RunManager * G4RunManager::fRunManager = nullptr
staticprivate

Definition at line 663 of file G4RunManager.hh.

Referenced by G4RunManager(), GetRunManager(), and ~G4RunManager().

◆ geometryDirectlyUpdated

G4bool G4RunManager::geometryDirectlyUpdated = false
protected

Definition at line 654 of file G4RunManager.hh.

Referenced by GeometryDirectlyUpdated(), and InitializeGeometry().

◆ geometryInitialized

G4bool G4RunManager::geometryInitialized = false
protected

◆ geometryToBeOptimized

G4bool G4RunManager::geometryToBeOptimized = true
protected

Definition at line 622 of file G4RunManager.hh.

Referenced by GetGeometryToBeOptimized(), and SetGeometryToBeOptimized().

◆ initializedAtLeastOnce

G4bool G4RunManager::initializedAtLeastOnce = false
protected

Definition at line 621 of file G4RunManager.hh.

Referenced by ConfirmBeamOnCondition(), and Initialize().

◆ isScoreNtupleWriter

G4bool G4RunManager::isScoreNtupleWriter = false
protected

◆ kernel

G4RunManagerKernel* G4RunManager::kernel = nullptr
protected

◆ masterRunProfiler

std::unique_ptr<ProfilerConfig> G4RunManager::masterRunProfiler
private

Definition at line 668 of file G4RunManager.hh.

Referenced by RunInitialization(), and RunTermination().

◆ msgText

G4String G4RunManager::msgText = " "
protected

◆ n_perviousEventsToBeStored

G4int G4RunManager::n_perviousEventsToBeStored = 0
protected

◆ n_select_msg

G4int G4RunManager::n_select_msg = -1
protected

◆ nParallelWorlds

G4int G4RunManager::nParallelWorlds = 0
protected

Definition at line 645 of file G4RunManager.hh.

Referenced by GetNumberOfParallelWorld(), and InitializeGeometry().

◆ numberOfEventProcessed

G4int G4RunManager::numberOfEventProcessed = 0
protected

◆ numberOfEventToBeProcessed

G4int G4RunManager::numberOfEventToBeProcessed = 0
protected

◆ physicsInitialized

G4bool G4RunManager::physicsInitialized = false
protected

Definition at line 619 of file G4RunManager.hh.

Referenced by ConfirmBeamOnCondition(), Initialize(), and InitializePhysics().

◆ physicsList

G4VUserPhysicsList* G4RunManager::physicsList = nullptr
protected

◆ previousEvents

std::list<G4Event*>* G4RunManager::previousEvents = nullptr
protected

◆ printModulo

G4int G4RunManager::printModulo = -1
protected

◆ randomNumberStatusDir

G4String G4RunManager::randomNumberStatusDir = "./"
protected

◆ randomNumberStatusForThisEvent

G4String G4RunManager::randomNumberStatusForThisEvent = ""
protected

◆ randomNumberStatusForThisRun

G4String G4RunManager::randomNumberStatusForThisRun = ""
protected

◆ rngStatusEventsFlag

G4bool G4RunManager::rngStatusEventsFlag = false
protected

◆ runAborted

G4bool G4RunManager::runAborted = false
protected

◆ runIDCounter

G4int G4RunManager::runIDCounter = 0
protected

◆ runManagerType

RMType G4RunManager::runManagerType
protected

Definition at line 656 of file G4RunManager.hh.

Referenced by DoEventLoop(), G4RunManager(), and GetRunManagerType().

◆ runMessenger

G4RunMessenger* G4RunManager::runMessenger = nullptr
private

Definition at line 666 of file G4RunManager.hh.

Referenced by G4RunManager(), and ~G4RunManager().

◆ selectMacro

G4String G4RunManager::selectMacro = ""
protected

◆ storeRandomNumberStatus

G4bool G4RunManager::storeRandomNumberStatus = false
protected

◆ storeRandomNumberStatusToG4Event

G4int G4RunManager::storeRandomNumberStatusToG4Event = 0
protected

◆ timer

G4Timer* G4RunManager::timer = nullptr
protected

◆ userActionInitialization

G4VUserActionInitialization* G4RunManager::userActionInitialization = nullptr
protected

◆ userDetector

G4VUserDetectorConstruction* G4RunManager::userDetector = nullptr
protected

◆ userEventAction

G4UserEventAction* G4RunManager::userEventAction = nullptr
protected

Definition at line 613 of file G4RunManager.hh.

Referenced by GetUserEventAction(), and SetUserAction().

◆ userPrimaryGeneratorAction

G4VUserPrimaryGeneratorAction* G4RunManager::userPrimaryGeneratorAction = nullptr
protected

◆ userRunAction

G4UserRunAction* G4RunManager::userRunAction = nullptr
protected

◆ userStackingAction

G4UserStackingAction* G4RunManager::userStackingAction = nullptr
protected

Definition at line 614 of file G4RunManager.hh.

Referenced by GetUserStackingAction(), and SetUserAction().

◆ userSteppingAction

G4UserSteppingAction* G4RunManager::userSteppingAction = nullptr
protected

Definition at line 616 of file G4RunManager.hh.

Referenced by GetUserSteppingAction(), and SetUserAction().

◆ userTrackingAction

G4UserTrackingAction* G4RunManager::userTrackingAction = nullptr
protected

Definition at line 615 of file G4RunManager.hh.

Referenced by GetUserTrackingAction(), and SetUserAction().

◆ userWorkerInitialization

G4UserWorkerInitialization* G4RunManager::userWorkerInitialization = nullptr
protected

◆ userWorkerThreadInitialization

G4UserWorkerThreadInitialization* G4RunManager::userWorkerThreadInitialization = nullptr
protected

◆ verboseLevel

G4int G4RunManager::verboseLevel = 0
protected

The documentation for this class was generated from the following files: