63 "If G4 kernel is not initialized, it will be initialized.");
64 beamOnCmd->
SetGuidance(
"Default number of events to be processed is 1.");
65 beamOnCmd->
SetGuidance(
"The second and third arguments can be used for");
66 beamOnCmd->
SetGuidance(
"executing a macro file at the end of each event.");
67 beamOnCmd->
SetGuidance(
"If the second argument, i.e. name of the macro");
68 beamOnCmd->
SetGuidance(
"file, is given but the third argument is not,");
69 beamOnCmd->
SetGuidance(
"the macro file will be executed for all of the");
71 beamOnCmd->
SetGuidance(
"If the third argument (nSelect) is given, the");
72 beamOnCmd->
SetGuidance(
"macro file will be executed only for the first");
90 verboseCmd->
SetGuidance(
"Set the Verbose level of G4RunManager.");
92 verboseCmd->
SetGuidance(
" 1 : Display main topics");
93 verboseCmd->
SetGuidance(
" 2 : Display main topics and run summary");
96 verboseCmd->
SetRange(
"level >=0 && level <=2");
100 "Display begin_of_event information at given frequency.");
102 "If it is set to zero, only the begin_of_run is shown.");
103 printProgCmd->
SetGuidance(
"If it is set to -1, no print-out is shown.");
109 nThreadsCmd->
SetGuidance(
"Set the number of threads to be used.");
110 nThreadsCmd->
SetGuidance(
"This command works only in PreInit state.");
112 "This command is valid only for multi-threaded mode.");
114 "The command is ignored if it is issued in sequential mode.");
117 nThreadsCmd->
SetRange(
"nThreads >0");
124 "Set the number of threads to be the number of available logical cores.");
125 maxThreadsCmd->
SetGuidance(
"This command works only in PreInit state.");
127 "This command is valid only for multi-threaded mode.");
129 "The command is ignored if it is issued in sequential mode.");
135 "Locks each thread to a specific logical core. Workers "
136 "are locked in round robin to logical cores.");
138 "This command is valid only for multi-threaded mode.");
139 pinAffinityCmd->
SetGuidance(
"This command works only in PreInit state.");
141 "This command is ignored if it is issued in sequential mode.");
143 "If a value n>0 is provided it starts setting affinity "
144 "from the n-th CPU (note: counting from 1).");
145 pinAffinityCmd->
SetGuidance(
"E.g. /run/pinAffinity 3 locks first thread on "
146 "third logical CPU (number 2).");
148 "If a value n<0 is provided never locks on n-th CPU.");
152 pinAffinityCmd->
SetRange(
"pinAffinity > 0 || pinAffinity < 0");
155 evModCmd =
new G4UIcommand(
"/run/eventModulo",
this);
157 "Set the event modulo for dispatching events to worker threads");
159 "i.e. each worker thread is ordered to simulate N events and then");
160 evModCmd->
SetGuidance(
"comes back to G4MTRunManager for next set.");
162 "If it is set to zero (default value), N is roughly given by this.");
164 " N = int( sqrt( number_of_events / number_of_threads ) )");
166 "The value N may affect on the computing performance in particular");
168 "if N is too small compared to the total number of events.");
170 "The second parameter seedOnce specifies how frequently each worker");
172 "thread is seeded by the random number sequence centrally managed");
173 evModCmd->
SetGuidance(
"by the master G4MTRunManager.");
175 " - If seedOnce is set to 0 (default), seeds that are centrally managed");
177 " by G4MTRunManager are set for every event of every worker thread.");
179 " This option guarantees event reproducibility regardless of number");
182 " - If seedOnce is set to 1, seeds are set only once for the first");
184 " event of each run of each worker thread. Event reproducibility is");
186 " guaranteed only if the same number of worker threads are used.");
188 " On the other hand, this option offers better computing performance");
190 " in particular for applications with relatively small primary");
191 evModCmd->
SetGuidance(
" particle energy and large number of events.");
193 " - If seedOnce is set to 2, seeds are set only for the first event of");
195 " group of N events. This option is reserved for the future use when");
197 " Geant4 allows number of threads to be dynamically changed during an");
199 evModCmd->
SetGuidance(
"This command is valid only for multi-threaded mode.");
201 "This command is ignored if it is issued in sequential mode.");
214 dumpRegCmd->
SetGuidance(
"Dump region information.");
216 "In case name of a region is not given, all regions will be displayed.");
222 dumpCoupleCmd->
SetGuidance(
"Dump material-cuts-couple information.");
224 "Note that material-cuts-couple information is updated");
225 dumpCoupleCmd->
SetGuidance(
"after BeamOn has started.");
229 optCmd->
SetGuidance(
"Set the optimization flag for geometry.");
230 optCmd->
SetGuidance(
"If it is set to TRUE, G4GeometryManager will optimize");
232 optCmd->
SetGuidance(
"GEANT4 is initialized with this flag as TRUE.");
238 brkBoECmd->
SetGuidance(
"Set a break point at the beginning of every event.");
243 brkEoECmd->
SetGuidance(
"Set a break point at the end of every event.");
248 abortCmd->
SetGuidance(
"Abort current run processing.");
250 "If softAbort is false (default), currently processing event "
251 "will be immediately aborted,");
252 abortCmd->
SetGuidance(
"while softAbort is true, abortion occurs after "
253 "processing the current event.");
259 abortEventCmd->
SetGuidance(
"Abort currently processing event.");
263 geomCmd->
SetGuidance(
"Force geometry to be closed (re-voxellized) again.");
265 "This command must be applied if geometry has been modified");
266 geomCmd->
SetGuidance(
" after the first initialization (or BeamOn).");
270 geomRebCmd->
SetGuidance(
"Force geometry to be rebuilt once again.");
272 "This command must be applied if the user needs his/her");
273 geomRebCmd->
SetGuidance(
" detector construction to be reinvoked.");
275 "/run/geometryModified is automatically issued with this command.");
281 physCmd->
SetGuidance(
"Force all physics tables recalculated again.");
282 physCmd->
SetGuidance(
"This command must be applied");
283 physCmd->
SetGuidance(
" if physics process has been modified after the");
284 physCmd->
SetGuidance(
" first initialization (or BeamOn).");
289 constScoreCmd->
SetGuidance(
"Construct scoring parallel world(s) if defined.");
290 constScoreCmd->
SetGuidance(
"This command is not mandatory, but automatically "
291 "called when a run starts.");
293 "But the user may use this to visualize the scoring "
294 "world(s) before a run to start.");
300 randomDirectory->
SetGuidance(
"Random number status control commands.");
304 "Initialize the random number generator with integer seed stream.");
305 seedCmd->
SetGuidance(
"Number of integers should be more than 1.");
307 "Actual number of integers to be used depends on the individual "
308 "random number engine.");
309#ifdef G4MULTITHREADED
310 seedCmd->
SetGuidance(
"This command sets the seeds for the master thread.");
319 "Define the directory name of the rndm status files.");
320 randDirCmd->
SetGuidance(
"Directory will be created if it does not exist.");
327 savingFlagCmd->
SetGuidance(
"The randomNumberStatus will be saved at :");
328 savingFlagCmd->
SetGuidance(
"beginning of run (currentRun.rndm) and "
329 "beginning of event (currentEvent.rndm) ");
334 saveThisRunCmd->
SetGuidance(
"copy currentRun.rndm to runXXX.rndm");
339 saveThisEventCmd->
SetGuidance(
"copy currentEvent.rndm to runXXXevtYYY.rndm");
344 "Reset the status of the rndm engine from a file.");
345 restoreRandCmd->
SetGuidance(
"See CLHEP manual for detail.");
346 restoreRandCmd->
SetGuidance(
"The engine status must be stored beforehand.");
347 restoreRandCmd->
SetGuidance(
"Directory of the status file should be set by"
348 " /random/setDirectoryName.");
358 "Reset the status of the rndm engine from a file at each event.");
360 "Note that the file must follow the following naming convention:");
361 restoreRandCmdMT->
SetGuidance(
"run{#1}evt{#2}.rndm ; where #1 is the run "
362 "number and #2 is the event number.");
364 "For example to re-seed the first event of the first "
365 "run the file should be called run0evt0.rndm.");
367 "If for a specific run/event the file is not found, "
368 "the standard re-seeding strategy is used.");
369 restoreRandCmdMT->
SetGuidance(
"This command has meaning only in MT mode for "
370 "strong reproducibility studies.");
371 restoreRandCmdMT->
SetGuidance(
"Directory of the status file should be set by"
372 " /random/setDirectoryName.");
379 "Save random number status at beginning of each event.");
381 "File name contains run and event numbers: runXXXevtYYY.rndm");
386 randEvtCmd->
SetGuidance(
"Flag to store rndm status to G4Event object.");
387 randEvtCmd->
SetGuidance(
" flag = 0 : not store (default)");
389 " flag = 1 : status before primary particle generation is stored");
391 " flag = 2 : status before event processing (after primary "
392 "particle generation) is stored");
393 randEvtCmd->
SetGuidance(
" flag = 3 : both are stored");
395 "Note: Some performance overhead may be seen by storing rndm "
396 "status, in particular");
398 "for the case of simplest geometry and small number of tracks per event.");
401 randEvtCmd->
SetRange(
"flag>=0 && flag<=3");
407 "Force workers to process current stack of UI commands.");
408 procUICmds->
SetGuidance(
"This commands is meaningful only in MT mode.");
416 delete materialScanner;
421 delete maxThreadsCmd;
422 delete pinAffinityCmd;
426 delete dumpCoupleCmd;
430 delete abortEventCmd;
436 delete constScoreCmd;
440 delete savingFlagCmd;
441 delete saveThisRunCmd;
442 delete saveThisEventCmd;
443 delete restoreRandCmd;
444 delete randomDirectory;
445 delete saveEachEventCmd;
450 delete restoreRandCmdMT;
456 if(command == beamOnCmd)
460 const char* nv = (
const char*) newValue;
461 std::istringstream is(nv);
462 is >> nev >> macroFileName >> nst;
463 if(macroFileName ==
"***NULL***")
469 runManager->
BeamOn(nev, macroFileName, nst);
472 else if(command == verboseCmd)
476 else if(command == printProgCmd)
480 else if(command == nThreadsCmd)
490 G4cout <<
"*** /run/numberOfThreads command is issued in sequential mode."
491 <<
"\nCommand is ignored." <<
G4endl;
496 "/run/numberOfThreads command is issued to local thread.");
499 else if(command == maxThreadsCmd)
509 G4cout <<
"*** /run/useMaximumLogicalCores command is issued in "
511 <<
"\nCommand is ignored." <<
G4endl;
517 "/run/useMaximumLogicalCores command is issued to local thread.");
520 else if(command == pinAffinityCmd)
530 G4cout <<
"*** /run/pinAffinity command is issued in sequential mode."
531 <<
"\nCommand is ignored." <<
G4endl;
536 "/run/pinAffinity command is issued to local thread.");
539 else if(command == evModCmd)
546 const char* nv = (
const char*) newValue;
547 std::istringstream is(nv);
548 is >> nevMod >> sOnce;
554 G4cout <<
"*** /run/eventModulo command is issued in sequential mode."
555 <<
"\nCommand is ignored." <<
G4endl;
560 "/run/eventModulo command is issued to local thread.");
563 else if(command == dumpRegCmd)
565 if(newValue ==
"**ALL**")
574 else if(command == dumpCoupleCmd)
578 else if(command == optCmd)
582 else if(command == brkBoECmd)
587 else if(command == brkEoECmd)
592 else if(command == abortCmd)
596 else if(command == abortEventCmd)
600 else if(command == initCmd)
604 else if(command == geomCmd)
608 else if(command == geomRebCmd)
613 else if(command == physCmd)
617 else if(command == seedCmd)
623 while(!(vl = next()).empty())
625 seeds[idx] =
StoL(vl);
630 G4cerr <<
"/random/setSeeds should have at least two values. "
637 G4Random::setTheSeeds(seeds);
640 else if(command == randDirCmd)
644 else if(command == savingFlagCmd)
648 else if(command == saveThisRunCmd)
652 else if(command == saveThisEventCmd)
656 else if(command == restoreRandCmd)
660 else if(command == randEvtCmd)
665 else if(command == saveEachEventCmd)
670 else if(command == constScoreCmd)
674 else if(command == restoreRandCmdMT)
679 else if(command == procUICmds)
692 "/run/workersProcessCmds command issued on a "
693 "non-G4MTRunManager class instance.");
699 <<
"*** /run/workersProcessCmds command is issued in sequential mode."
700 <<
"\nCommand is ignored." <<
G4endl;
705 "/run/workersProcessCmds command is issued to local thread.");
715 if(command == verboseCmd)
719 else if(command == printProgCmd)
723 else if(command == randDirCmd)
727 else if(command == randEvtCmd)
732 else if(command == nThreadsCmd)
745 else if(command == evModCmd)
758 G4cout <<
"*** /run/eventModulo command is valid only in MT mode."
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
G4GLOB_DLL std::ostream G4cerr
G4GLOB_DLL std::ostream G4cout
static G4int SeedOncePerCommunication()
static void SetSeedOncePerCommunication(G4int val)
virtual void RequestWorkersProcessCommandsStack()
static G4ProductionCutsTable * GetProductionCutsTable()
virtual void AbortRun(G4bool softAbort=false)
virtual void Initialize()
virtual void RestoreRandomNumberStatus(const G4String &fileN)
void ReinitializeGeometry(G4bool destroyFirst=false, G4bool prop=true)
void SetRandomNumberStoreDir(const G4String &dir)
virtual void rndmSaveThisEvent()
virtual void RestoreRndmEachEvent(G4bool)
virtual void AbortEvent()
virtual void rndmSaveThisRun()
virtual void BeamOn(G4int n_event, const char *macroFile=nullptr, G4int n_select=-1)
RMType GetRunManagerType() const
void PhysicsHasBeenModified()
void SetVerboseLevel(G4int vl)
const G4String & GetRandomNumberStoreDir() const
void SetRandomNumberStorePerEvent(G4bool flag)
void GeometryHasBeenModified(G4bool prop=true)
void SetGeometryToBeOptimized(G4bool vl)
void StoreRandomNumberStatusToG4Event(G4int vl)
G4int GetFlagRandomNumberStatusToG4Event() const
void SetRandomNumberStore(G4bool flag)
void DumpRegion(const G4String &rname) const
G4int GetVerboseLevel() const
virtual void ConstructScoringWorlds()
void SetPrintProgress(G4int i)
G4RunMessenger(G4RunManager *runMgr)
G4String GetCurrentValue(G4UIcommand *command)
void SetNewValue(G4UIcommand *command, G4String newValues)
static G4bool GetNewBoolValue(const char *paramString)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetDefaultValue(G4bool defVal)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetDefaultValue(const char *defVal)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
static G4int GetNewIntValue(const char *paramString)
void SetDefaultValue(G4int defVal)
void SetToBeBroadcasted(G4bool val)
static G4String ConvertToString(G4bool boolVal)
void SetParameter(G4UIparameter *const newParameter)
void SetGuidance(const char *aGuidance)
void SetRange(const char *rs)
void AvailableForStates(G4ApplicationState s1)
void SetPauseAtBeginOfEvent(G4bool vl)
static G4UImanager * GetUIpointer()
void SetPauseAtEndOfEvent(G4bool vl)
G4long StoL(const G4String &s)
void SetDefaultValue(const char *theDefaultValue)
void SetParameterRange(const char *theRange)
G4int G4GetNumberOfCores()