60 beamOnCmd->
SetGuidance(
"If G4 kernel is not initialized, it will be initialized.");
61 beamOnCmd->
SetGuidance(
"Default number of events to be processed is 1.");
62 beamOnCmd->
SetGuidance(
"The second and third arguments can be used for");
63 beamOnCmd->
SetGuidance(
"executing a macro file at the end of each event.");
64 beamOnCmd->
SetGuidance(
"If the second argument, i.e. name of the macro");
65 beamOnCmd->
SetGuidance(
"file, is given but the third argument is not,");
66 beamOnCmd->
SetGuidance(
"the macro file will be executed for all of the");
68 beamOnCmd->
SetGuidance(
"If the third argument (nSelect) is given, the");
69 beamOnCmd->
SetGuidance(
"macro file will be executed only for the first");
87 verboseCmd->
SetGuidance(
"Set the Verbose level of G4RunManager.");
89 verboseCmd->
SetGuidance(
" 1 : Display main topics");
90 verboseCmd->
SetGuidance(
" 2 : Display main topics and run summary");
93 verboseCmd->
SetRange(
"level >=0 && level <=2");
96 printProgCmd->
SetGuidance(
"Display begin_of_event information at given frequency.");
97 printProgCmd->
SetGuidance(
"If it is set to zero, only the begin_of_run is shown.");
98 printProgCmd->
SetGuidance(
"If it is set to -1, no print-out is shown.");
104 nThreadsCmd->
SetGuidance(
"Set the number of threads to be used.");
105 nThreadsCmd->
SetGuidance(
"This command works only in PreInit state.");
106 nThreadsCmd->
SetGuidance(
"This command is valid only for multi-threaded mode.");
107 nThreadsCmd->
SetGuidance(
"The command is ignored if it is issued in sequential mode.");
110 nThreadsCmd->
SetRange(
"nThreads >0");
115 maxThreadsCmd->
SetGuidance(
"Set the number of threads to be the number of available logical cores.");
116 maxThreadsCmd->
SetGuidance(
"This command works only in PreInit state.");
117 maxThreadsCmd->
SetGuidance(
"This command is valid only for multi-threaded mode.");
118 maxThreadsCmd->
SetGuidance(
"The command is ignored if it is issued in sequential mode.");
123 pinAffinityCmd->
SetGuidance(
"Locks each thread to a specific logical core. Workers are locked in round robin to logical cores.");
124 pinAffinityCmd->
SetGuidance(
"This command is valid only for multi-threaded mode.");
125 pinAffinityCmd->
SetGuidance(
"This command works only in PreInit state.");
126 pinAffinityCmd->
SetGuidance(
"This command is ignored if it is issued in sequential mode.");
127 pinAffinityCmd->
SetGuidance(
"If a value n>0 is provided it starts setting affinity from the n-th CPU (note: counting from 1).");
128 pinAffinityCmd->
SetGuidance(
"E.g. /run/pinAffinity 3 locks first thread on third logical CPU (number 2).");
129 pinAffinityCmd->
SetGuidance(
"If a value n<0 is provided never locks on n-th CPU.");
133 pinAffinityCmd->
SetRange(
"pinAffinity > 0 || pinAffinity < 0");
136 evModCmd =
new G4UIcommand(
"/run/eventModulo",
this);
137 evModCmd->
SetGuidance(
"Set the event modulo for dispatching events to worker threads");
138 evModCmd->
SetGuidance(
"i.e. each worker thread is ordered to simulate N events and then");
139 evModCmd->
SetGuidance(
"comes back to G4MTRunManager for next set.");
140 evModCmd->
SetGuidance(
"If it is set to zero (default value), N is roughly given by this.");
141 evModCmd->
SetGuidance(
" N = int( sqrt( number_of_events / number_of_threads ) )");
142 evModCmd->
SetGuidance(
"The value N may affect on the computing performance in particular");
143 evModCmd->
SetGuidance(
"if N is too small compared to the total number of events.");
144 evModCmd->
SetGuidance(
"The second parameter seedOnce specifies how frequently each worker");
145 evModCmd->
SetGuidance(
"thread is seeded by the random number sequence contrally managed");
146 evModCmd->
SetGuidance(
"by the master G4MTRunManager.");
147 evModCmd->
SetGuidance(
" - If seedOnce is set to 0 (default), seeds that are centrally managed");
148 evModCmd->
SetGuidance(
" by G4MTRunManager are set for every event of every worker thread.");
149 evModCmd->
SetGuidance(
" This option guarantees event reproducability regardless of number");
151 evModCmd->
SetGuidance(
" - If seedOnce is set to 1, seeds are set only once for the first");
152 evModCmd->
SetGuidance(
" event of each run of each worker thread. Event reproducability is");
153 evModCmd->
SetGuidance(
" guaranteed only if the same number of worker threads are used.");
154 evModCmd->
SetGuidance(
" On the other hand, this option offers better computing performance");
155 evModCmd->
SetGuidance(
" in particular for applications with relatively small primary");
156 evModCmd->
SetGuidance(
" particle energy and large number of events.");
157 evModCmd->
SetGuidance(
" - If seedOnce is set to 2, seeds are set only for the first event of");
158 evModCmd->
SetGuidance(
" group of N events. This option is reserved for the future use when");
159 evModCmd->
SetGuidance(
" Geant4 allows number of threads to be dynatically changed during an");
161 evModCmd->
SetGuidance(
"This command is valid only for multi-threaded mode.");
162 evModCmd->
SetGuidance(
"This command is ignored if it is issued in sequential mode.");
175 dumpRegCmd->
SetGuidance(
"Dump region information.");
176 dumpRegCmd->
SetGuidance(
"In case name of a region is not given, all regions will be displayed.");
182 dumpCoupleCmd->
SetGuidance(
"Dump material-cuts-couple information.");
183 dumpCoupleCmd->
SetGuidance(
"Note that material-cuts-couple information is updated");
184 dumpCoupleCmd->
SetGuidance(
"after BeamOn has started.");
188 optCmd->
SetGuidance(
"Set the optimization flag for geometry.");
189 optCmd->
SetGuidance(
"If it is set to TRUE, G4GeometryManager will optimize");
191 optCmd->
SetGuidance(
"GEANT4 is initialized with this flag as TRUE.");
197 brkBoECmd->
SetGuidance(
"Set a break point at the begining of every event.");
202 brkEoECmd->
SetGuidance(
"Set a break point at the end of every event.");
207 abortCmd->
SetGuidance(
"Abort current run processing.");
208 abortCmd->
SetGuidance(
"If softAbort is false (default), currently processing event will be immediately aborted,");
209 abortCmd->
SetGuidance(
"while softAbort is true, abortion occurs after processing the current event.");
215 abortEventCmd->
SetGuidance(
"Abort currently processing event.");
219 geomCmd->
SetGuidance(
"Force geometry to be closed (re-voxellized) again.");
220 geomCmd->
SetGuidance(
"This command must be applied if geometry has been modified");
221 geomCmd->
SetGuidance(
" after the first initialization (or BeamOn).");
225 geomRebCmd->
SetGuidance(
"Force geometry to be rebuilt once again.");
226 geomRebCmd->
SetGuidance(
"This command must be applied if the user needs his/her");
227 geomRebCmd->
SetGuidance(
" detector construction to be reinvoked.");
228 geomRebCmd->
SetGuidance(
"/run/geometryModified is automatically issued with this command.");
234 physCmd->
SetGuidance(
"Force all physics tables recalculated again.");
235 physCmd->
SetGuidance(
"This command must be applied");
236 physCmd->
SetGuidance(
" if physics process has been modified after the");
237 physCmd->
SetGuidance(
" first initialization (or BeamOn).");
241 constScoreCmd->
SetGuidance(
"Constrct scoring parallel world(s) if defined.");
242 constScoreCmd->
SetGuidance(
"This command is not mandatory, but automatically called when a run starts.");
243 constScoreCmd->
SetGuidance(
"But the user may use this to visualize the scoring world(s) before a run to start.");
249 randomDirectory->
SetGuidance(
"Random number status control commands.");
252 seedCmd->
SetGuidance(
"Initialize the random number generator with integer seed stream.");
253 seedCmd->
SetGuidance(
"Number of integers should be more than 1.");
254 seedCmd->
SetGuidance(
"Actual number of integers to be used depends on the individual random number engine.");
255 #ifdef G4MULTITHREADED
256 seedCmd->
SetGuidance(
"This command sets the seeds for the master thread.");
263 randDirCmd->
SetGuidance(
"Define the directory name of the rndm status files.");
264 randDirCmd->
SetGuidance(
"Directory will be created if it does not exist.");
270 savingFlagCmd->
SetGuidance(
"The randomNumberStatus will be saved at :");
271 savingFlagCmd->
SetGuidance(
"begining of run (currentRun.rndm) and "
272 "begining of event (currentEvent.rndm) ");
277 saveThisRunCmd->
SetGuidance(
"copy currentRun.rndm to runXXX.rndm");
281 saveThisEventCmd->
SetGuidance(
"copy currentEvent.rndm to runXXXevtYYY.rndm");
285 restoreRandCmd->
SetGuidance(
"Reset the status of the rndm engine from a file.");
286 restoreRandCmd->
SetGuidance(
"See CLHEP manual for detail.");
287 restoreRandCmd->
SetGuidance(
"The engine status must be stored beforehand.");
288 restoreRandCmd->
SetGuidance(
"Directory of the status file should be set by"
289 " /random/setDirectoryName.");
295 restoreRandCmdMT =
new G4UIcmdWithABool(
"/random/resetEngineFromEachEvent",
this);
296 restoreRandCmdMT->
SetGuidance(
"Reset the status of the rndm engine from a file at each event.");
297 restoreRandCmdMT->
SetGuidance(
"Note that the file must follow the following naming convention:");
298 restoreRandCmdMT->
SetGuidance(
"run{#1}evt{#2}.rndm ; where #1 is the run number and #2 is the event number.");
299 restoreRandCmdMT->
SetGuidance(
"For example to re-seed the first event of the first run the file should be called run0evt0.rndm.");
300 restoreRandCmdMT->
SetGuidance(
"If for a specific run/event the file is not found, the standard re-seeding strategy is used.");
301 restoreRandCmdMT->
SetGuidance(
"This command has meaning only in MT mode for strong reproducibility studies.");
302 restoreRandCmdMT->
SetGuidance(
"Directory of the status file should be set by"
303 " /random/setDirectoryName.");
309 saveEachEventCmd->
SetGuidance(
"Save random number status at beginning of each event.");
310 saveEachEventCmd->
SetGuidance(
"File name contains run and event numbers: runXXXevtYYY.rndm");
315 randEvtCmd->
SetGuidance(
"Flag to store rndm status to G4Event object.");
316 randEvtCmd->
SetGuidance(
" flag = 0 : not store (default)");
317 randEvtCmd->
SetGuidance(
" flag = 1 : status before primary particle generation is stored");
318 randEvtCmd->
SetGuidance(
" flag = 2 : status before event processing (after primary particle generation) is stored");
319 randEvtCmd->
SetGuidance(
" flag = 3 : both are stored");
320 randEvtCmd->
SetGuidance(
"Note: Some performance overhead may be seen by storing rndm status, in particular");
321 randEvtCmd->
SetGuidance(
"for the case of simplest geometry and small number of tracks per event.");
324 randEvtCmd->
SetRange(
"flag>=0 && flag<3");
329 procUICmds->
SetGuidance(
"Force workers to process current stack of UI commands.");
330 procUICmds->
SetGuidance(
"This commands is meaningful only in MT mode.");
337 delete materialScanner;
342 delete maxThreadsCmd;
343 delete pinAffinityCmd;
347 delete dumpCoupleCmd;
351 delete abortEventCmd;
357 delete constScoreCmd;
361 delete savingFlagCmd;
362 delete saveThisRunCmd;
363 delete saveThisEventCmd;
364 delete restoreRandCmd;
365 delete randomDirectory;
366 delete saveEachEventCmd;
371 delete restoreRandCmdMT;
376 if( command==beamOnCmd )
380 const char* nv = (
const char*)newValue;
381 std::istringstream is(nv);
382 is >> nev >> macroFileName >> nst;
383 if(macroFileName==
"***NULL***")
384 { runManager->
BeamOn(nev); }
386 { runManager->
BeamOn(nev,macroFileName,nst); }
388 else if( command==verboseCmd )
390 else if( command == printProgCmd )
392 else if( command==nThreadsCmd )
402 G4cout<<
"*** /run/numberOfThreads command is issued in sequential mode."
403 <<
"\nCommand is ignored."<<
G4endl;
408 "/run/numberOfThreads command is issued to local thread.");
411 else if( command==maxThreadsCmd)
421 G4cout<<
"*** /run/useMaximumLogicalCores command is issued in sequential mode."
422 <<
"\nCommand is ignored."<<
G4endl;
427 "/run/useMaximumLogicalCores command is issued to local thread.");
430 else if ( command == pinAffinityCmd )
440 G4cout<<
"*** /run/pinAffinity command is issued in sequential mode."
441 <<
"\nCommand is ignored."<<
G4endl;
446 "/run/pinAffinity command is issued to local thread.");
450 else if( command==evModCmd)
457 const char* nv = (
const char*)newValue;
458 std::istringstream is(nv);
459 is >> nevMod >> sOnce;
465 G4cout<<
"*** /run/eventModulo command is issued in sequential mode."
466 <<
"\nCommand is ignored."<<
G4endl;
471 "/run/eventModulo command is issued to local thread.");
474 else if( command==dumpRegCmd )
476 if(newValue==
"**ALL**")
481 else if( command==dumpCoupleCmd)
485 else if( command==optCmd )
487 else if( command==brkBoECmd )
489 else if( command==brkEoECmd )
491 else if( command==abortCmd )
493 else if( command==abortEventCmd )
495 else if( command==initCmd )
497 else if( command==geomCmd )
499 else if( command==geomRebCmd )
501 else if( command==physCmd )
503 else if( command==seedCmd )
509 while(!(vl=next()).isNull())
510 { seeds[idx] = (long)(
StoI(vl)); idx++; }
512 {
G4cerr <<
"/random/setSeeds should have at least two integers. Command ignored." <<
G4endl; }
516 G4Random::setTheSeeds(seeds);
519 else if( command==randDirCmd )
521 else if( command==savingFlagCmd )
523 else if( command==saveThisRunCmd )
525 else if( command==saveThisEventCmd )
527 else if( command==restoreRandCmd )
529 else if( command==randEvtCmd )
531 else if( command==saveEachEventCmd)
533 else if( command==constScoreCmd )
535 else if( command==restoreRandCmdMT)
537 else if ( command==procUICmds)
542 if ( rm !=
nullptr ) {
545 else {
G4Exception(
"G4RunManager::ApplyNewCommand",
"Run0128",
FatalException,
"/run/workersProcessCmds command issued on a non-G4MTRunManager class instance."); }
547 G4cout<<
"*** /run/workersProcessCmds command is issued in sequential mode."
548 <<
"\nCommand is ignored."<<
G4endl;
551 "/run/workersProcessCmds command is issued to local thread.");
561 if( command==verboseCmd )
563 else if( command == printProgCmd )
565 else if( command==randDirCmd )
567 else if( command==randEvtCmd )
569 else if( command==nThreadsCmd )
575 static_cast<G4MTRunManager*>(runManager)->GetNumberOfThreads());
582 else if( command==evModCmd)
588 static_cast<G4MTRunManager*>(runManager)->GetEventModulo() )
592 {
G4cout<<
"*** /run/eventModulo command is valid only in MT mode."<<
G4endl; }
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void GeometryHasBeenModified(G4bool prop=true)
G4int GetVerboseLevel() const
virtual void AbortRun(G4bool softAbort=false)
void SetParameter(G4UIparameter *const newParameter)
G4RunMessenger(G4RunManager *runMgr)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
const G4String & GetRandomNumberStoreDir() const
void SetVerboseLevel(G4int vl)
static G4int GetNewIntValue(const char *paramString)
void SetParameterRange(const char *theRange)
void SetPrintProgress(G4int i)
void SetToBeBroadcasted(G4bool val)
void SetGeometryToBeOptimized(G4bool vl)
void SetDefaultValue(const char *theDefaultValue)
static G4String ConvertToString(G4bool boolVal)
void SetRandomNumberStorePerEvent(G4bool flag)
virtual void BeamOn(G4int n_event, const char *macroFile=0, G4int n_select=-1)
void SetRandomNumberStore(G4bool flag)
G4int GetFlagRandomNumberStatusToG4Event() const
G4String GetCurrentValue(G4UIcommand *command)
static G4bool GetNewBoolValue(const char *paramString)
void SetDefaultValue(G4bool defVal)
static G4UImanager * GetUIpointer()
virtual void RestoreRandomNumberStatus(const G4String &fileN)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
virtual void rndmSaveThisRun()
G4GLOB_DLL std::ostream G4cout
void StoreRandomNumberStatusToG4Event(G4int vl)
void PhysicsHasBeenModified()
RMType GetRunManagerType() const
virtual void ConstructScoringWorlds()
void SetRange(const char *rs)
void SetGuidance(const char *aGuidance)
G4int G4GetNumberOfCores()
virtual void rndmSaveThisEvent()
void AvailableForStates(G4ApplicationState s1)
virtual void RequestWorkersProcessCommandsStack()
void ReinitializeGeometry(G4bool destroyFirst=false, G4bool prop=true)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
void SetNewValue(G4UIcommand *command, G4String newValues)
static G4ProductionCutsTable * GetProductionCutsTable()
void SetDefaultValue(const char *defVal)
void SetPauseAtEndOfEvent(G4bool vl)
virtual void RestoreRndmEachEvent(G4bool)
static G4int SeedOncePerCommunication()
void SetPauseAtBeginOfEvent(G4bool vl)
virtual void Initialize()
virtual void AbortEvent()
void SetDefaultValue(G4int defVal)
void SetRandomNumberStoreDir(const G4String &dir)
static void SetSeedOncePerCommunication(G4int val)
void DumpRegion(const G4String &rname) const
G4GLOB_DLL std::ostream G4cerr