ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4RunMessenger.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4RunMessenger.cc
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 //
27 //
28 
29 #include "G4RunMessenger.hh"
30 #include "G4RunManager.hh"
31 #include "G4MTRunManager.hh"
32 #include "G4UIdirectory.hh"
34 #include "G4UIcmdWithAString.hh"
35 #include "G4UIcmdWithAnInteger.hh"
36 #include "G4UIcmdWithABool.hh"
37 #include "G4UIcommand.hh"
38 #include "G4UIparameter.hh"
39 #include "G4UImanager.hh"
40 #include "G4ProductionCutsTable.hh"
41 #include "G4ios.hh"
42 #include "G4MaterialScanner.hh"
43 #include "G4Tokenizer.hh"
44 #include "Randomize.hh"
45 #include <sstream>
46 
48 :runManager(runMgr)
49 {
50  runDirectory = new G4UIdirectory("/run/");
51  runDirectory->SetGuidance("Run control commands.");
52 
53  initCmd = new G4UIcmdWithoutParameter("/run/initialize",this);
54  initCmd->SetGuidance("Initialize G4 kernel.");
56 
57  beamOnCmd = new G4UIcommand("/run/beamOn",this);
58  beamOnCmd->SetGuidance("Start a Run.");
59  beamOnCmd->SetGuidance("If G4 kernel is not initialized, it will be initialized.");
60  beamOnCmd->SetGuidance("Default number of events to be processed is 1.");
61  beamOnCmd->SetGuidance("The second and third arguments can be used for");
62  beamOnCmd->SetGuidance("executing a macro file at the end of each event.");
63  beamOnCmd->SetGuidance("If the second argument, i.e. name of the macro");
64  beamOnCmd->SetGuidance("file, is given but the third argument is not,");
65  beamOnCmd->SetGuidance("the macro file will be executed for all of the");
66  beamOnCmd->SetGuidance("event.");
67  beamOnCmd->SetGuidance("If the third argument (nSelect) is given, the");
68  beamOnCmd->SetGuidance("macro file will be executed only for the first");
69  beamOnCmd->SetGuidance("nSelect events.");
72  G4UIparameter* p1 = new G4UIparameter("numberOfEvent",'i',true);
73  p1->SetDefaultValue(1);
74  p1->SetParameterRange("numberOfEvent >= 0");
76  G4UIparameter* p2 = new G4UIparameter("macroFile",'s',true);
77  p2->SetDefaultValue("***NULL***");
79  G4UIparameter* p3 = new G4UIparameter("nSelect",'i',true);
80  p3->SetDefaultValue(-1);
81  p3->SetParameterRange("nSelect>=-1");
83  //beamOnCmd->SetToBeBroadcasted(false);
84 
85  verboseCmd = new G4UIcmdWithAnInteger("/run/verbose",this);
86  verboseCmd->SetGuidance("Set the Verbose level of G4RunManager.");
87  verboseCmd->SetGuidance(" 0 : Silent (default)");
88  verboseCmd->SetGuidance(" 1 : Display main topics");
89  verboseCmd->SetGuidance(" 2 : Display main topics and run summary");
90  verboseCmd->SetParameterName("level",true);
92  verboseCmd->SetRange("level >=0 && level <=2");
93 
94  printProgCmd = new G4UIcmdWithAnInteger("/run/printProgress",this);
95  printProgCmd->SetGuidance("Display begin_of_event information at given frequency.");
96  printProgCmd->SetGuidance("If it is set to zero, only the begin_of_run is shown.");
97  printProgCmd->SetGuidance("If it is set to -1, no print-out is shown.");
98  printProgCmd->SetParameterName("mod",true);
100  printProgCmd->SetRange("mod>=-1");
101 
102  nThreadsCmd = new G4UIcmdWithAnInteger("/run/numberOfThreads",this);
103  nThreadsCmd->SetGuidance("Set the number of threads to be used.");
104  nThreadsCmd->SetGuidance("This command works only in PreInit state.");
105  nThreadsCmd->SetGuidance("This command is valid only for multi-threaded mode.");
106  nThreadsCmd->SetGuidance("The command is ignored if it is issued in sequential mode.");
107  nThreadsCmd->SetParameterName("nThreads",true);
109  nThreadsCmd->SetRange("nThreads >0");
112 
113  maxThreadsCmd = new G4UIcmdWithoutParameter("/run/useMaximumLogicalCores",this);
114  maxThreadsCmd->SetGuidance("Set the number of threads to be the number of available logical cores.");
115  maxThreadsCmd->SetGuidance("This command works only in PreInit state.");
116  maxThreadsCmd->SetGuidance("This command is valid only for multi-threaded mode.");
117  maxThreadsCmd->SetGuidance("The command is ignored if it is issued in sequential mode.");
120 
121  pinAffinityCmd = new G4UIcmdWithAnInteger("/run/pinAffinity",this);
122  pinAffinityCmd->SetGuidance("Locks each thread to a specific logical core. Workers are locked in round robin to logical cores.");
123  pinAffinityCmd->SetGuidance("This command is valid only for multi-threaded mode.");
124  pinAffinityCmd->SetGuidance("This command works only in PreInit state.");
125  pinAffinityCmd->SetGuidance("This command is ignored if it is issued in sequential mode.");
126  pinAffinityCmd->SetGuidance("If a value n>0 is provided it starts setting affinity from the n-th CPU (note: counting from 1).");
127  pinAffinityCmd->SetGuidance("E.g. /run/pinAffinity 3 locks first thread on third logical CPU (number 2).");
128  pinAffinityCmd->SetGuidance("If a value n<0 is provided never locks on n-th CPU.");
129  pinAffinityCmd->SetParameterName("pinAffinity",true);
132  pinAffinityCmd->SetRange("pinAffinity > 0 || pinAffinity < 0");
134 
135  evModCmd = new G4UIcommand("/run/eventModulo",this);
136  evModCmd->SetGuidance("Set the event modulo for dispatching events to worker threads");
137  evModCmd->SetGuidance("i.e. each worker thread is ordered to simulate N events and then");
138  evModCmd->SetGuidance("comes back to G4MTRunManager for next set.");
139  evModCmd->SetGuidance("If it is set to zero (default value), N is roughly given by this.");
140  evModCmd->SetGuidance(" N = int( sqrt( number_of_events / number_of_threads ) )");
141  evModCmd->SetGuidance("The value N may affect on the computing performance in particular");
142  evModCmd->SetGuidance("if N is too small compared to the total number of events.");
143  evModCmd->SetGuidance("The second parameter seedOnce specifies how frequently each worker");
144  evModCmd->SetGuidance("thread is seeded by the random number sequence centrally managed");
145  evModCmd->SetGuidance("by the master G4MTRunManager.");
146  evModCmd->SetGuidance(" - If seedOnce is set to 0 (default), seeds that are centrally managed");
147  evModCmd->SetGuidance(" by G4MTRunManager are set for every event of every worker thread.");
148  evModCmd->SetGuidance(" This option guarantees event reproducibility regardless of number");
149  evModCmd->SetGuidance(" of threads.");
150  evModCmd->SetGuidance(" - If seedOnce is set to 1, seeds are set only once for the first");
151  evModCmd->SetGuidance(" event of each run of each worker thread. Event reproducibility is");
152  evModCmd->SetGuidance(" guaranteed only if the same number of worker threads are used.");
153  evModCmd->SetGuidance(" On the other hand, this option offers better computing performance");
154  evModCmd->SetGuidance(" in particular for applications with relatively small primary");
155  evModCmd->SetGuidance(" particle energy and large number of events.");
156  evModCmd->SetGuidance(" - If seedOnce is set to 2, seeds are set only for the first event of");
157  evModCmd->SetGuidance(" group of N events. This option is reserved for the future use when");
158  evModCmd->SetGuidance(" Geant4 allows number of threads to be dynamically changed during an");
159  evModCmd->SetGuidance(" event loop.");
160  evModCmd->SetGuidance("This command is valid only for multi-threaded mode.");
161  evModCmd->SetGuidance("This command is ignored if it is issued in sequential mode.");
162  G4UIparameter* emp1 = new G4UIparameter("N",'i',true);
163  emp1->SetDefaultValue(0);
164  emp1->SetParameterRange("N >= 0");
165  evModCmd->SetParameter(emp1);
166  G4UIparameter* emp2 = new G4UIparameter("seedOnce",'i',true);
167  emp2->SetDefaultValue(0);
168  emp2->SetParameterRange("seedOnce >= 0 && seedOnce <=2");
169  evModCmd->SetParameter(emp2);
172 
173  dumpRegCmd = new G4UIcmdWithAString("/run/dumpRegion",this);
174  dumpRegCmd->SetGuidance("Dump region information.");
175  dumpRegCmd->SetGuidance("In case name of a region is not given, all regions will be displayed.");
176  dumpRegCmd->SetParameterName("regionName", true);
177  dumpRegCmd->SetDefaultValue("**ALL**");
179 
180  dumpCoupleCmd = new G4UIcmdWithoutParameter("/run/dumpCouples",this);
181  dumpCoupleCmd->SetGuidance("Dump material-cuts-couple information.");
182  dumpCoupleCmd->SetGuidance("Note that material-cuts-couple information is updated");
183  dumpCoupleCmd->SetGuidance("after BeamOn has started.");
185 
186  optCmd = new G4UIcmdWithABool("/run/optimizeGeometry",this);
187  optCmd->SetGuidance("Set the optimization flag for geometry.");
188  optCmd->SetGuidance("If it is set to TRUE, G4GeometryManager will optimize");
189  optCmd->SetGuidance("the geometry definitions.");
190  optCmd->SetGuidance("GEANT4 is initialized with this flag as TRUE.");
191  optCmd->SetParameterName("optimizeFlag",true);
192  optCmd->SetDefaultValue(true);
194 
195  brkBoECmd = new G4UIcmdWithABool("/run/breakAtBeginOfEvent",this);
196  brkBoECmd->SetGuidance("Set a break point at the beginning of every event.");
197  brkBoECmd->SetParameterName("flag",true);
198  brkBoECmd->SetDefaultValue(true);
199 
200  brkEoECmd = new G4UIcmdWithABool("/run/breakAtEndOfEvent",this);
201  brkEoECmd->SetGuidance("Set a break point at the end of every event.");
202  brkEoECmd->SetParameterName("flag",true);
203  brkEoECmd->SetDefaultValue(true);
204 
205  abortCmd = new G4UIcmdWithABool("/run/abort",this);
206  abortCmd->SetGuidance("Abort current run processing.");
207  abortCmd->SetGuidance("If softAbort is false (default), currently processing event will be immediately aborted,");
208  abortCmd->SetGuidance("while softAbort is true, abortion occurs after processing the current event.");
210  abortCmd->SetParameterName("softAbort",true);
211  abortCmd->SetDefaultValue(false);
212 
213  abortEventCmd = new G4UIcmdWithoutParameter("/run/abortCurrentEvent",this);
214  abortEventCmd->SetGuidance("Abort currently processing event.");
216 
217  geomCmd = new G4UIcmdWithoutParameter("/run/geometryModified",this);
218  geomCmd->SetGuidance("Force geometry to be closed (re-voxellized) again.");
219  geomCmd->SetGuidance("This command must be applied if geometry has been modified");
220  geomCmd->SetGuidance(" after the first initialization (or BeamOn).");
222 
223  geomRebCmd = new G4UIcmdWithABool("/run/reinitializeGeometry",this);
224  geomRebCmd->SetGuidance("Force geometry to be rebuilt once again.");
225  geomRebCmd->SetGuidance("This command must be applied if the user needs his/her");
226  geomRebCmd->SetGuidance(" detector construction to be reinvoked.");
227  geomRebCmd->SetGuidance("/run/geometryModified is automatically issued with this command.");
228  geomRebCmd->SetParameterName("destroyFirst",true);
229  geomRebCmd->SetDefaultValue(false);
231 
232  physCmd = new G4UIcmdWithoutParameter("/run/physicsModified",this);
233  physCmd->SetGuidance("Force all physics tables recalculated again.");
234  physCmd->SetGuidance("This command must be applied");
235  physCmd->SetGuidance(" if physics process has been modified after the");
236  physCmd->SetGuidance(" first initialization (or BeamOn).");
238 
239  constScoreCmd = new G4UIcmdWithoutParameter("/run/constructScoringWorlds",this);
240  constScoreCmd->SetGuidance("Construct scoring parallel world(s) if defined.");
241  constScoreCmd->SetGuidance("This command is not mandatory, but automatically called when a run starts.");
242  constScoreCmd->SetGuidance("But the user may use this to visualize the scoring world(s) before a run to start.");
244 
246 
247  randomDirectory = new G4UIdirectory("/random/");
248  randomDirectory->SetGuidance("Random number status control commands.");
249 
250  seedCmd = new G4UIcmdWithAString("/random/setSeeds",this);
251  seedCmd->SetGuidance("Initialize the random number generator with integer seed stream.");
252  seedCmd->SetGuidance("Number of integers should be more than 1.");
253  seedCmd->SetGuidance("Actual number of integers to be used depends on the individual random number engine.");
254 #ifdef G4MULTITHREADED
255  seedCmd->SetGuidance("This command sets the seeds for the master thread.");
256 #endif
257  seedCmd->SetParameterName("IntArray",false);
259  seedCmd->SetToBeBroadcasted(false);
260 
261  randDirCmd = new G4UIcmdWithAString("/random/setDirectoryName",this);
262  randDirCmd->SetGuidance("Define the directory name of the rndm status files.");
263  randDirCmd->SetGuidance("Directory will be created if it does not exist.");
264  randDirCmd->SetParameterName("fileName",true);
267 
268  savingFlagCmd = new G4UIcmdWithABool("/random/setSavingFlag",this);
269  savingFlagCmd->SetGuidance("The randomNumberStatus will be saved at :");
270  savingFlagCmd->SetGuidance("beginning of run (currentRun.rndm) and "
271  "beginning of event (currentEvent.rndm) ");
272  savingFlagCmd->SetParameterName("flag",true);
274 
275  saveThisRunCmd = new G4UIcmdWithoutParameter("/random/saveThisRun",this);
276  saveThisRunCmd->SetGuidance("copy currentRun.rndm to runXXX.rndm");
278 
279  saveThisEventCmd = new G4UIcmdWithoutParameter("/random/saveThisEvent",this);
280  saveThisEventCmd->SetGuidance("copy currentEvent.rndm to runXXXevtYYY.rndm");
282 
283  restoreRandCmd = new G4UIcmdWithAString("/random/resetEngineFrom",this);
284  restoreRandCmd->SetGuidance("Reset the status of the rndm engine from a file.");
285  restoreRandCmd->SetGuidance("See CLHEP manual for detail.");
286  restoreRandCmd->SetGuidance("The engine status must be stored beforehand.");
287  restoreRandCmd->SetGuidance("Directory of the status file should be set by"
288  " /random/setDirectoryName.");
289  restoreRandCmd->SetParameterName("fileName",true);
290  restoreRandCmd->SetDefaultValue("currentRun.rndm");
293 
294  restoreRandCmdMT = new G4UIcmdWithABool("/random/resetEngineFromEachEvent",this);
295  restoreRandCmdMT->SetGuidance("Reset the status of the rndm engine from a file at each event.");
296  restoreRandCmdMT->SetGuidance("Note that the file must follow the following naming convention:");
297  restoreRandCmdMT->SetGuidance("run{#1}evt{#2}.rndm ; where #1 is the run number and #2 is the event number.");
298  restoreRandCmdMT->SetGuidance("For example to re-seed the first event of the first run the file should be called run0evt0.rndm.");
299  restoreRandCmdMT->SetGuidance("If for a specific run/event the file is not found, the standard re-seeding strategy is used.");
300  restoreRandCmdMT->SetGuidance("This command has meaning only in MT mode for strong reproducibility studies.");
301  restoreRandCmdMT->SetGuidance("Directory of the status file should be set by"
302  " /random/setDirectoryName.");
305 
306 
307  saveEachEventCmd = new G4UIcmdWithABool("/random/saveEachEventFlag",this);
308  saveEachEventCmd->SetGuidance("Save random number status at beginning of each event.");
309  saveEachEventCmd->SetGuidance("File name contains run and event numbers: runXXXevtYYY.rndm");
310  saveEachEventCmd->SetParameterName("flag",true);
312 
313  randEvtCmd = new G4UIcmdWithAnInteger("/run/storeRndmStatToEvent",this);
314  randEvtCmd->SetGuidance("Flag to store rndm status to G4Event object.");
315  randEvtCmd->SetGuidance(" flag = 0 : not store (default)");
316  randEvtCmd->SetGuidance(" flag = 1 : status before primary particle generation is stored");
317  randEvtCmd->SetGuidance(" flag = 2 : status before event processing (after primary particle generation) is stored");
318  randEvtCmd->SetGuidance(" flag = 3 : both are stored");
319  randEvtCmd->SetGuidance("Note: Some performance overhead may be seen by storing rndm status, in particular");
320  randEvtCmd->SetGuidance("for the case of simplest geometry and small number of tracks per event.");
321  randEvtCmd->SetParameterName("flag",true);
323  randEvtCmd->SetRange("flag>=0 && flag<=3");
325 
326  procUICmds = new G4UIcmdWithoutParameter("/run/workersProcessCmds",this);
328  procUICmds->SetGuidance("Force workers to process current stack of UI commands.");
329  procUICmds->SetGuidance("This commands is meaningful only in MT mode.");
331 
332 }
333 
335 {
336  delete materialScanner;
337  delete beamOnCmd;
338  delete verboseCmd;
339  delete printProgCmd;
340  delete nThreadsCmd;
341  delete maxThreadsCmd;
342  delete pinAffinityCmd;
343  delete evModCmd;
344  delete optCmd;
345  delete dumpRegCmd;
346  delete dumpCoupleCmd;
347  delete brkBoECmd;
348  delete brkEoECmd;
349  delete abortCmd;
350  delete abortEventCmd;
351  delete initCmd;
352  delete geomCmd;
353  delete geomRebCmd;
354  delete physCmd;
355  delete randEvtCmd;
356  delete constScoreCmd;
357  delete procUICmds;
358 
359  delete seedCmd;
360  delete savingFlagCmd;
361  delete saveThisRunCmd;
362  delete saveThisEventCmd;
363  delete restoreRandCmd;
364  delete randomDirectory;
365  delete saveEachEventCmd;
366 
367  delete randDirCmd;
368  delete runDirectory;
369 
370  delete restoreRandCmdMT;
371 }
372 
374 {
375  if( command==beamOnCmd )
376  {
377  G4int nev;
378  G4int nst;
379  const char* nv = (const char*)newValue;
380  std::istringstream is(nv);
381  is >> nev >> macroFileName >> nst;
382  if(macroFileName=="***NULL***")
383  { runManager->BeamOn(nev); }
384  else
385  { runManager->BeamOn(nev,macroFileName,nst); }
386  }
387  else if( command==verboseCmd )
389  else if( command == printProgCmd )
391  else if( command==nThreadsCmd )
392  {
394  if( rmType==G4RunManager::masterRM )
395  {
396  static_cast<G4MTRunManager*>(runManager)->SetNumberOfThreads(
397  nThreadsCmd->GetNewIntValue(newValue));
398  }
399  else if ( rmType==G4RunManager::sequentialRM )
400  {
401  G4cout<<"*** /run/numberOfThreads command is issued in sequential mode."
402  <<"\nCommand is ignored."<<G4endl;
403  }
404  else
405  {
406  G4Exception("G4RunMessenger::ApplyNewCommand","Run0901",FatalException,
407  "/run/numberOfThreads command is issued to local thread.");
408  }
409  }
410  else if( command==maxThreadsCmd)
411  {
413  if( rmType==G4RunManager::masterRM )
414  {
415  static_cast<G4MTRunManager*>(runManager)->SetNumberOfThreads(
417  }
418  else if ( rmType==G4RunManager::sequentialRM )
419  {
420  G4cout<<"*** /run/useMaximumLogicalCores command is issued in sequential mode."
421  <<"\nCommand is ignored."<<G4endl;
422  }
423  else
424  {
425  G4Exception("G4RunMessenger::ApplyNewCommand","Run0901",FatalException,
426  "/run/useMaximumLogicalCores command is issued to local thread.");
427  }
428  }
429  else if ( command == pinAffinityCmd )
430  {
432  if( rmType==G4RunManager::masterRM )
433  {
434  static_cast<G4MTRunManager*>(runManager)->SetPinAffinity(
435  pinAffinityCmd->GetNewIntValue(newValue) );
436  }
437  else if ( rmType==G4RunManager::sequentialRM )
438  {
439  G4cout<<"*** /run/pinAffinity command is issued in sequential mode."
440  <<"\nCommand is ignored."<<G4endl;
441  }
442  else
443  {
444  G4Exception("G4RunMessenger::ApplyNewCommand","Run0901",FatalException,
445  "/run/pinAffinity command is issued to local thread.");
446  }
447 
448  }
449  else if( command==evModCmd)
450  {
452  if( rmType==G4RunManager::masterRM )
453  {
454  G4int nevMod = 0;
455  G4int sOnce = 0;
456  const char* nv = (const char*)newValue;
457  std::istringstream is(nv);
458  is >> nevMod >> sOnce;
459  static_cast<G4MTRunManager*>(runManager)->SetEventModulo(nevMod);
461  }
462  else if ( rmType==G4RunManager::sequentialRM )
463  {
464  G4cout<<"*** /run/eventModulo command is issued in sequential mode."
465  <<"\nCommand is ignored."<<G4endl;
466  }
467  else
468  {
469  G4Exception("G4RunMessenger::ApplyNewCommand","Run0902",FatalException,
470  "/run/eventModulo command is issued to local thread.");
471  }
472  }
473  else if( command==dumpRegCmd )
474  {
475  if(newValue=="**ALL**")
476  { runManager->DumpRegion(); }
477  else
478  { runManager->DumpRegion(newValue); }
479  }
480  else if( command==dumpCoupleCmd)
481  {
483  }
484  else if( command==optCmd )
486  else if( command==brkBoECmd )
488  else if( command==brkEoECmd )
490  else if( command==abortCmd )
491  { runManager->AbortRun(abortCmd->GetNewBoolValue(newValue)); }
492  else if( command==abortEventCmd )
493  { runManager->AbortEvent(); }
494  else if( command==initCmd )
495  { runManager->Initialize(); }
496  else if( command==geomCmd )
498  else if( command==geomRebCmd )
500  else if( command==physCmd )
502  else if( command==seedCmd )
503  {
504  G4Tokenizer next(newValue);
505  G4int idx=0;
506  long seeds[100];
507  G4String vl;
508  while(!(vl=next()).isNull())
509  {
510  seeds[idx] = StoL(vl);
511  idx++;
512  }
513  if(idx<2)
514  { G4cerr << "/random/setSeeds should have at least two integers. Command ignored." << G4endl; }
515  else
516  {
517  seeds[idx] = 0;
518  G4Random::setTheSeeds(seeds);
519  }
520  }
521  else if( command==randDirCmd )
522  { runManager->SetRandomNumberStoreDir(newValue); }
523  else if( command==savingFlagCmd )
525  else if( command==saveThisRunCmd )
527  else if( command==saveThisEventCmd )
529  else if( command==restoreRandCmd )
530  { runManager->RestoreRandomNumberStatus(newValue); }
531  else if( command==randEvtCmd )
533  else if( command==saveEachEventCmd)
535  else if( command==constScoreCmd )
537  else if( command==restoreRandCmdMT)
539  else if ( command==procUICmds)
540  {
542  if( rmType==G4RunManager::masterRM ) {
543  auto rm = dynamic_cast<G4MTRunManager*>(runManager);
544  if ( rm != nullptr ) {
546  }
547  else { G4Exception("G4RunManager::ApplyNewCommand","Run0128",FatalException,"/run/workersProcessCmds command issued on a non-G4MTRunManager class instance."); }
548  } else if ( rmType==G4RunManager::sequentialRM ) {
549  G4cout<<"*** /run/workersProcessCmds command is issued in sequential mode."
550  <<"\nCommand is ignored."<<G4endl;
551  } else {
552  G4Exception("G4RunMessenger::ApplyNewCommand","Run0129",FatalException,
553  "/run/workersProcessCmds command is issued to local thread.");
554  }
555  }
556 
557 }
558 
560 {
561  G4String cv;
562 
563  if( command==verboseCmd )
565  else if( command == printProgCmd )
567  else if( command==randDirCmd )
569  else if( command==randEvtCmd )
571  else if( command==nThreadsCmd )
572  {
574  if( rmType==G4RunManager::masterRM )
575  {
577  static_cast<G4MTRunManager*>(runManager)->GetNumberOfThreads());
578  }
579  else if ( rmType==G4RunManager::sequentialRM )
580  {
581  cv = "0";
582  }
583  }
584  else if( command==evModCmd)
585  {
587  if( rmType==G4RunManager::masterRM )
588  {
590  static_cast<G4MTRunManager*>(runManager)->GetEventModulo() )
592  }
593  else if ( rmType==G4RunManager::sequentialRM )
594  { G4cout<<"*** /run/eventModulo command is valid only in MT mode."<<G4endl; }
595  }
596 
597  return cv;
598 }
599