Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/run/src/G4RunMessenger.cc

Version: [ ReleaseNotes ] [ 1.0 ] [ 1.1 ] [ 2.0 ] [ 3.0 ] [ 3.1 ] [ 3.2 ] [ 4.0 ] [ 4.0.p1 ] [ 4.0.p2 ] [ 4.1 ] [ 4.1.p1 ] [ 5.0 ] [ 5.0.p1 ] [ 5.1 ] [ 5.1.p1 ] [ 5.2 ] [ 5.2.p1 ] [ 5.2.p2 ] [ 6.0 ] [ 6.0.p1 ] [ 6.1 ] [ 6.2 ] [ 6.2.p1 ] [ 6.2.p2 ] [ 7.0 ] [ 7.0.p1 ] [ 7.1 ] [ 7.1.p1 ] [ 8.0 ] [ 8.0.p1 ] [ 8.1 ] [ 8.1.p1 ] [ 8.1.p2 ] [ 8.2 ] [ 8.2.p1 ] [ 8.3 ] [ 8.3.p1 ] [ 8.3.p2 ] [ 9.0 ] [ 9.0.p1 ] [ 9.0.p2 ] [ 9.1 ] [ 9.1.p1 ] [ 9.1.p2 ] [ 9.1.p3 ] [ 9.2 ] [ 9.2.p1 ] [ 9.2.p2 ] [ 9.2.p3 ] [ 9.2.p4 ] [ 9.3 ] [ 9.3.p1 ] [ 9.3.p2 ] [ 9.4 ] [ 9.4.p1 ] [ 9.4.p2 ] [ 9.4.p3 ] [ 9.4.p4 ] [ 9.5 ] [ 9.5.p1 ] [ 9.5.p2 ] [ 9.6 ] [ 9.6.p1 ] [ 9.6.p2 ] [ 9.6.p3 ] [ 9.6.p4 ] [ 10.0 ] [ 10.0.p1 ] [ 10.0.p2 ] [ 10.0.p3 ] [ 10.0.p4 ] [ 10.1 ] [ 10.1.p1 ] [ 10.1.p2 ] [ 10.1.p3 ] [ 10.2 ] [ 10.2.p1 ] [ 10.2.p2 ] [ 10.2.p3 ] [ 10.3 ] [ 10.3.p1 ] [ 10.3.p2 ] [ 10.3.p3 ] [ 10.4 ] [ 10.4.p1 ] [ 10.4.p2 ] [ 10.4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /run/src/G4RunMessenger.cc (Version 11.3.0) and /run/src/G4RunMessenger.cc (Version 10.7.p3)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                         3 // * License and Disclaimer                                           *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th      5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided      6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License      7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/      8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.           9 // * include a list of copyright holders.                             *
 10 // *                                               10 // *                                                                  *
 11 // * Neither the authors of this software syst     11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file      15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitatio     16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                               17 // *                                                                  *
 18 // * This  code  implementation is the result      18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboratio     19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distri     20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  ag     21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publicati     22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Sof     23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // *******************************************     24 // ********************************************************************
 25 //                                                 25 //
 26 // G4RunMessenger implementation               << 
 27 //                                                 26 //
 28 // Original author: M.Asai, 1997               <<  27 //
 29 // ------------------------------------------- << 
 30                                                    28 
 31 #include "G4RunMessenger.hh"                       29 #include "G4RunMessenger.hh"
 32                                                << 
 33 #include "G4MTRunManager.hh"                       30 #include "G4MTRunManager.hh"
 34 #include "G4SubEvtRunManager.hh"               <<  31 #include "G4MaterialScanner.hh"
 35 #include "G4ProductionCutsTable.hh"                32 #include "G4ProductionCutsTable.hh"
 36 #include "G4RunManager.hh"                         33 #include "G4RunManager.hh"
 37 #include "G4Tokenizer.hh"                          34 #include "G4Tokenizer.hh"
 38 #include "G4UIcmdWithABool.hh"                     35 #include "G4UIcmdWithABool.hh"
 39 #include "G4UIcmdWithAString.hh"                   36 #include "G4UIcmdWithAString.hh"
 40 #include "G4UIcmdWithAnInteger.hh"                 37 #include "G4UIcmdWithAnInteger.hh"
 41 #include "G4UIcmdWithoutParameter.hh"              38 #include "G4UIcmdWithoutParameter.hh"
 42 #include "G4UIcommand.hh"                          39 #include "G4UIcommand.hh"
 43 #include "G4UIdirectory.hh"                        40 #include "G4UIdirectory.hh"
 44 #include "G4UImanager.hh"                          41 #include "G4UImanager.hh"
 45 #include "G4UIparameter.hh"                        42 #include "G4UIparameter.hh"
 46 #include "G4ios.hh"                                43 #include "G4ios.hh"
 47 #include "Randomize.hh"                            44 #include "Randomize.hh"
 48                                                << 
 49 #include <sstream>                                 45 #include <sstream>
 50                                                    46 
 51 G4RunMessenger::G4RunMessenger(G4RunManager* r <<  47 G4RunMessenger::G4RunMessenger(G4RunManager* runMgr)
                                                   >>  48   : runManager(runMgr)
 52 {                                                  49 {
 53   runDirectory = new G4UIdirectory("/run/");       50   runDirectory = new G4UIdirectory("/run/");
 54   runDirectory->SetGuidance("Run control comma     51   runDirectory->SetGuidance("Run control commands.");
 55                                                    52 
 56   initCmd = new G4UIcmdWithoutParameter("/run/     53   initCmd = new G4UIcmdWithoutParameter("/run/initialize", this);
 57   initCmd->SetGuidance("Initialize G4 kernel."     54   initCmd->SetGuidance("Initialize G4 kernel.");
 58   initCmd->AvailableForStates(G4State_PreInit,     55   initCmd->AvailableForStates(G4State_PreInit, G4State_Idle),
 59                                                    56 
 60     beamOnCmd = new G4UIcommand("/run/beamOn",     57     beamOnCmd = new G4UIcommand("/run/beamOn", this);
 61   beamOnCmd->SetGuidance("Start a Run.");          58   beamOnCmd->SetGuidance("Start a Run.");
 62   beamOnCmd->SetGuidance("If G4 kernel is not  <<  59   beamOnCmd->SetGuidance(
                                                   >>  60     "If G4 kernel is not initialized, it will be initialized.");
 63   beamOnCmd->SetGuidance("Default number of ev     61   beamOnCmd->SetGuidance("Default number of events to be processed is 1.");
 64   beamOnCmd->SetGuidance("The second and third     62   beamOnCmd->SetGuidance("The second and third arguments can be used for");
 65   beamOnCmd->SetGuidance("executing a macro fi     63   beamOnCmd->SetGuidance("executing a macro file at the end of each event.");
 66   beamOnCmd->SetGuidance("If the second argume     64   beamOnCmd->SetGuidance("If the second argument, i.e. name of the macro");
 67   beamOnCmd->SetGuidance("file, is given but t     65   beamOnCmd->SetGuidance("file, is given but the third argument is not,");
 68   beamOnCmd->SetGuidance("the macro file will      66   beamOnCmd->SetGuidance("the macro file will be executed for all of the");
 69   beamOnCmd->SetGuidance("event.");                67   beamOnCmd->SetGuidance("event.");
 70   beamOnCmd->SetGuidance("If the third argumen     68   beamOnCmd->SetGuidance("If the third argument (nSelect) is given, the");
 71   beamOnCmd->SetGuidance("macro file will be e     69   beamOnCmd->SetGuidance("macro file will be executed only for the first");
 72   beamOnCmd->SetGuidance("nSelect events.");       70   beamOnCmd->SetGuidance("nSelect events.");
 73   beamOnCmd->AvailableForStates(G4State_PreIni     71   beamOnCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
 74   beamOnCmd->SetToBeBroadcasted(false);            72   beamOnCmd->SetToBeBroadcasted(false);
 75   auto p1 = new G4UIparameter("numberOfEvent", <<  73   G4UIparameter* p1 = new G4UIparameter("numberOfEvent", 'i', true);
 76   p1->SetDefaultValue(1);                          74   p1->SetDefaultValue(1);
 77   p1->SetParameterRange("numberOfEvent >= 0");     75   p1->SetParameterRange("numberOfEvent >= 0");
 78   beamOnCmd->SetParameter(p1);                     76   beamOnCmd->SetParameter(p1);
 79   auto p2 = new G4UIparameter("macroFile", 's' <<  77   G4UIparameter* p2 = new G4UIparameter("macroFile", 's', true);
 80   p2->SetDefaultValue("***NULL***");               78   p2->SetDefaultValue("***NULL***");
 81   beamOnCmd->SetParameter(p2);                     79   beamOnCmd->SetParameter(p2);
 82   auto p3 = new G4UIparameter("nSelect", 'i',  <<  80   G4UIparameter* p3 = new G4UIparameter("nSelect", 'i', true);
 83   p3->SetDefaultValue(-1);                         81   p3->SetDefaultValue(-1);
 84   p3->SetParameterRange("nSelect>=-1");            82   p3->SetParameterRange("nSelect>=-1");
 85   beamOnCmd->SetParameter(p3);                     83   beamOnCmd->SetParameter(p3);
 86   // beamOnCmd->SetToBeBroadcasted(false);         84   // beamOnCmd->SetToBeBroadcasted(false);
 87                                                    85 
 88   verboseCmd = new G4UIcmdWithAnInteger("/run/     86   verboseCmd = new G4UIcmdWithAnInteger("/run/verbose", this);
 89   verboseCmd->SetGuidance("Set the Verbose lev     87   verboseCmd->SetGuidance("Set the Verbose level of G4RunManager.");
 90   verboseCmd->SetGuidance(" 0 : Silent (defaul     88   verboseCmd->SetGuidance(" 0 : Silent (default)");
 91   verboseCmd->SetGuidance(" 1 : Display main t     89   verboseCmd->SetGuidance(" 1 : Display main topics");
 92   verboseCmd->SetGuidance(" 2 : Display main t     90   verboseCmd->SetGuidance(" 2 : Display main topics and run summary");
 93   verboseCmd->SetGuidance(" 3 : Display some a << 
 94   verboseCmd->SetGuidance(" 4 : Display detail << 
 95   verboseCmd->SetGuidance(" N.B. 3 or 4 may ca << 
 96   verboseCmd->SetParameterName("level", true);     91   verboseCmd->SetParameterName("level", true);
 97   verboseCmd->SetDefaultValue(0);                  92   verboseCmd->SetDefaultValue(0);
 98   verboseCmd->SetRange("level >=0 && level <=4 <<  93   verboseCmd->SetRange("level >=0 && level <=2");
 99                                                    94 
100   printProgCmd = new G4UIcmdWithAnInteger("/ru     95   printProgCmd = new G4UIcmdWithAnInteger("/run/printProgress", this);
101   printProgCmd->SetGuidance("Display begin_of_ <<  96   printProgCmd->SetGuidance(
102   printProgCmd->SetGuidance("If it is set to z <<  97     "Display begin_of_event information at given frequency.");
                                                   >>  98   printProgCmd->SetGuidance(
                                                   >>  99     "If it is set to zero, only the begin_of_run is shown.");
103   printProgCmd->SetGuidance("If it is set to -    100   printProgCmd->SetGuidance("If it is set to -1, no print-out is shown.");
104   printProgCmd->SetParameterName("mod", true);    101   printProgCmd->SetParameterName("mod", true);
105   printProgCmd->SetDefaultValue(-1);              102   printProgCmd->SetDefaultValue(-1);
106   printProgCmd->SetRange("mod>=-1");              103   printProgCmd->SetRange("mod>=-1");
107                                                   104 
108   nThreadsCmd = new G4UIcmdWithAnInteger("/run    105   nThreadsCmd = new G4UIcmdWithAnInteger("/run/numberOfThreads", this);
109   nThreadsCmd->SetGuidance("Set the number of     106   nThreadsCmd->SetGuidance("Set the number of threads to be used.");
110   nThreadsCmd->SetGuidance("This command works    107   nThreadsCmd->SetGuidance("This command works only in PreInit state.");
111   nThreadsCmd->SetGuidance("This command is va << 108   nThreadsCmd->SetGuidance(
112   nThreadsCmd->SetGuidance("The command is ign << 109     "This command is valid only for multi-threaded mode.");
                                                   >> 110   nThreadsCmd->SetGuidance(
                                                   >> 111     "The command is ignored if it is issued in sequential mode.");
113   nThreadsCmd->SetParameterName("nThreads", tr    112   nThreadsCmd->SetParameterName("nThreads", true);
114   nThreadsCmd->SetDefaultValue(2);                113   nThreadsCmd->SetDefaultValue(2);
115   nThreadsCmd->SetRange("nThreads >0");           114   nThreadsCmd->SetRange("nThreads >0");
116   nThreadsCmd->SetToBeBroadcasted(false);         115   nThreadsCmd->SetToBeBroadcasted(false);
117   nThreadsCmd->AvailableForStates(G4State_PreI    116   nThreadsCmd->AvailableForStates(G4State_PreInit);
118                                                   117 
119   maxThreadsCmd = new G4UIcmdWithoutParameter( << 118   maxThreadsCmd =
                                                   >> 119     new G4UIcmdWithoutParameter("/run/useMaximumLogicalCores", this);
120   maxThreadsCmd->SetGuidance(                     120   maxThreadsCmd->SetGuidance(
121     "Set the number of threads to be the numbe    121     "Set the number of threads to be the number of available logical cores.");
122   maxThreadsCmd->SetGuidance("This command wor    122   maxThreadsCmd->SetGuidance("This command works only in PreInit state.");
123   maxThreadsCmd->SetGuidance("This command is  << 123   maxThreadsCmd->SetGuidance(
124   maxThreadsCmd->SetGuidance("The command is i << 124     "This command is valid only for multi-threaded mode.");
                                                   >> 125   maxThreadsCmd->SetGuidance(
                                                   >> 126     "The command is ignored if it is issued in sequential mode.");
125   maxThreadsCmd->SetToBeBroadcasted(false);       127   maxThreadsCmd->SetToBeBroadcasted(false);
126   maxThreadsCmd->AvailableForStates(G4State_Pr    128   maxThreadsCmd->AvailableForStates(G4State_PreInit);
127                                                   129 
128   pinAffinityCmd = new G4UIcmdWithAnInteger("/    130   pinAffinityCmd = new G4UIcmdWithAnInteger("/run/pinAffinity", this);
129   pinAffinityCmd->SetGuidance(                    131   pinAffinityCmd->SetGuidance(
130     "Locks each thread to a specific logical c    132     "Locks each thread to a specific logical core. Workers "
131     "are locked in round robin to logical core    133     "are locked in round robin to logical cores.");
132   pinAffinityCmd->SetGuidance("This command is << 134   pinAffinityCmd->SetGuidance(
                                                   >> 135     "This command is valid only for multi-threaded mode.");
133   pinAffinityCmd->SetGuidance("This command wo    136   pinAffinityCmd->SetGuidance("This command works only in PreInit state.");
134   pinAffinityCmd->SetGuidance("This command is << 137   pinAffinityCmd->SetGuidance(
                                                   >> 138     "This command is ignored if it is issued in sequential mode.");
135   pinAffinityCmd->SetGuidance(                    139   pinAffinityCmd->SetGuidance(
136     "If a value n>0 is provided it starts sett    140     "If a value n>0 is provided it starts setting affinity "
137     "from the n-th CPU (note: counting from 1)    141     "from the n-th CPU (note: counting from 1).");
                                                   >> 142   pinAffinityCmd->SetGuidance("E.g. /run/pinAffinity 3 locks first thread on "
                                                   >> 143                               "third logical CPU (number 2).");
138   pinAffinityCmd->SetGuidance(                    144   pinAffinityCmd->SetGuidance(
139     "E.g. /run/pinAffinity 3 locks first threa << 145     "If a value n<0 is provided never locks on n-th CPU.");
140     "third logical CPU (number 2).");          << 
141   pinAffinityCmd->SetGuidance("If a value n<0  << 
142   pinAffinityCmd->SetParameterName("pinAffinit    146   pinAffinityCmd->SetParameterName("pinAffinity", true);
143   pinAffinityCmd->SetDefaultValue(1);             147   pinAffinityCmd->SetDefaultValue(1);
144   pinAffinityCmd->SetToBeBroadcasted(false);      148   pinAffinityCmd->SetToBeBroadcasted(false);
145   pinAffinityCmd->SetRange("pinAffinity > 0 ||    149   pinAffinityCmd->SetRange("pinAffinity > 0 || pinAffinity < 0");
146   pinAffinityCmd->AvailableForStates(G4State_P    150   pinAffinityCmd->AvailableForStates(G4State_PreInit);
147                                                   151 
148   evModCmd = new G4UIcommand("/run/eventModulo    152   evModCmd = new G4UIcommand("/run/eventModulo", this);
149   evModCmd->SetGuidance("Set the event modulo  << 153   evModCmd->SetGuidance(
150   evModCmd->SetGuidance("i.e. each worker thre << 154     "Set the event modulo for dispatching events to worker threads");
                                                   >> 155   evModCmd->SetGuidance(
                                                   >> 156     "i.e. each worker thread is ordered to simulate N events and then");
151   evModCmd->SetGuidance("comes back to G4MTRun    157   evModCmd->SetGuidance("comes back to G4MTRunManager for next set.");
152   evModCmd->SetGuidance("If it is set to zero  << 158   evModCmd->SetGuidance(
153   evModCmd->SetGuidance("   N = int( sqrt( num << 159     "If it is set to zero (default value), N is roughly given by this.");
154   evModCmd->SetGuidance("The value N may affec << 160   evModCmd->SetGuidance(
155   evModCmd->SetGuidance("if N is too small com << 161     "   N = int( sqrt( number_of_events / number_of_threads ) )");
156   evModCmd->SetGuidance("The second parameter  << 162   evModCmd->SetGuidance(
157   evModCmd->SetGuidance("thread is seeded by t << 163     "The value N may affect on the computing performance in particular");
                                                   >> 164   evModCmd->SetGuidance(
                                                   >> 165     "if N is too small compared to the total number of events.");
                                                   >> 166   evModCmd->SetGuidance(
                                                   >> 167     "The second parameter seedOnce specifies how frequently each worker");
                                                   >> 168   evModCmd->SetGuidance(
                                                   >> 169     "thread is seeded by the random number sequence centrally managed");
158   evModCmd->SetGuidance("by the master G4MTRun    170   evModCmd->SetGuidance("by the master G4MTRunManager.");
159   evModCmd->SetGuidance(" - If seedOnce is set << 171   evModCmd->SetGuidance(
160   evModCmd->SetGuidance("   by G4MTRunManager  << 172     " - If seedOnce is set to 0 (default), seeds that are centrally managed");
161   evModCmd->SetGuidance("   This option guaran << 173   evModCmd->SetGuidance(
                                                   >> 174     "   by G4MTRunManager are set for every event of every worker thread.");
                                                   >> 175   evModCmd->SetGuidance(
                                                   >> 176     "   This option guarantees event reproducibility regardless of number");
162   evModCmd->SetGuidance("   of threads.");        177   evModCmd->SetGuidance("   of threads.");
163   evModCmd->SetGuidance(" - If seedOnce is set << 178   evModCmd->SetGuidance(
164   evModCmd->SetGuidance("   event of each run  << 179     " - If seedOnce is set to 1, seeds are set only once for the first");
165   evModCmd->SetGuidance("   guaranteed only if << 180   evModCmd->SetGuidance(
166   evModCmd->SetGuidance("   On the other hand, << 181     "   event of each run of each worker thread. Event reproducibility is");
167   evModCmd->SetGuidance("   in particular for  << 182   evModCmd->SetGuidance(
                                                   >> 183     "   guaranteed only if the same number of worker threads are used.");
                                                   >> 184   evModCmd->SetGuidance(
                                                   >> 185     "   On the other hand, this option offers better computing performance");
                                                   >> 186   evModCmd->SetGuidance(
                                                   >> 187     "   in particular for applications with relatively small primary");
168   evModCmd->SetGuidance("   particle energy an    188   evModCmd->SetGuidance("   particle energy and large number of events.");
169   evModCmd->SetGuidance(" - If seedOnce is set << 189   evModCmd->SetGuidance(
170   evModCmd->SetGuidance("   group of N events. << 190     " - If seedOnce is set to 2, seeds are set only for the first event of");
171   evModCmd->SetGuidance("   Geant4 allows numb << 191   evModCmd->SetGuidance(
                                                   >> 192     "   group of N events. This option is reserved for the future use when");
                                                   >> 193   evModCmd->SetGuidance(
                                                   >> 194     "   Geant4 allows number of threads to be dynamically changed during an");
172   evModCmd->SetGuidance("   event loop.");        195   evModCmd->SetGuidance("   event loop.");
173   evModCmd->SetGuidance("This command is valid << 196   evModCmd->SetGuidance("This command is valid only for multi-threaded mode.");
174   evModCmd->SetGuidance("This command is ignor << 197   evModCmd->SetGuidance(
175   evModCmd->SetGuidance("sub-event parallel mo << 198     "This command is ignored if it is issued in sequential mode.");
176   auto emp1 = new G4UIparameter("N", 'i', true << 199   G4UIparameter* emp1 = new G4UIparameter("N", 'i', true);
177   emp1->SetDefaultValue(0);                       200   emp1->SetDefaultValue(0);
178   emp1->SetParameterRange("N >= 0");              201   emp1->SetParameterRange("N >= 0");
179   evModCmd->SetParameter(emp1);                   202   evModCmd->SetParameter(emp1);
180   auto emp2 = new G4UIparameter("seedOnce", 'i << 203   G4UIparameter* emp2 = new G4UIparameter("seedOnce", 'i', true);
181   emp2->SetDefaultValue(0);                       204   emp2->SetDefaultValue(0);
182   emp2->SetParameterRange("seedOnce >= 0 && se    205   emp2->SetParameterRange("seedOnce >= 0 && seedOnce <=2");
183   evModCmd->SetParameter(emp2);                   206   evModCmd->SetParameter(emp2);
184   evModCmd->SetToBeBroadcasted(false);            207   evModCmd->SetToBeBroadcasted(false);
185   evModCmd->AvailableForStates(G4State_PreInit    208   evModCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
186                                                   209 
187   dumpRegCmd = new G4UIcmdWithAString("/run/du    210   dumpRegCmd = new G4UIcmdWithAString("/run/dumpRegion", this);
188   dumpRegCmd->SetGuidance("Dump region informa    211   dumpRegCmd->SetGuidance("Dump region information.");
189   dumpRegCmd->SetGuidance("In case name of a r << 212   dumpRegCmd->SetGuidance(
                                                   >> 213     "In case name of a region is not given, all regions will be displayed.");
190   dumpRegCmd->SetParameterName("regionName", t    214   dumpRegCmd->SetParameterName("regionName", true);
191   dumpRegCmd->SetDefaultValue("**ALL**");         215   dumpRegCmd->SetDefaultValue("**ALL**");
192   dumpRegCmd->AvailableForStates(G4State_Idle)    216   dumpRegCmd->AvailableForStates(G4State_Idle);
193                                                   217 
194   dumpCoupleCmd = new G4UIcmdWithoutParameter(    218   dumpCoupleCmd = new G4UIcmdWithoutParameter("/run/dumpCouples", this);
195   dumpCoupleCmd->SetGuidance("Dump material-cu    219   dumpCoupleCmd->SetGuidance("Dump material-cuts-couple information.");
196   dumpCoupleCmd->SetGuidance("Note that materi << 220   dumpCoupleCmd->SetGuidance(
                                                   >> 221     "Note that material-cuts-couple information is updated");
197   dumpCoupleCmd->SetGuidance("after BeamOn has    222   dumpCoupleCmd->SetGuidance("after BeamOn has started.");
198   dumpCoupleCmd->AvailableForStates(G4State_Id    223   dumpCoupleCmd->AvailableForStates(G4State_Idle);
199                                                   224 
200   optCmd = new G4UIcmdWithABool("/run/optimize    225   optCmd = new G4UIcmdWithABool("/run/optimizeGeometry", this);
201   optCmd->SetGuidance("Set the optimization fl    226   optCmd->SetGuidance("Set the optimization flag for geometry.");
202   optCmd->SetGuidance("If it is set to TRUE, G    227   optCmd->SetGuidance("If it is set to TRUE, G4GeometryManager will optimize");
203   optCmd->SetGuidance("the geometry definition    228   optCmd->SetGuidance("the geometry definitions.");
204   optCmd->SetGuidance("GEANT4 is initialized w    229   optCmd->SetGuidance("GEANT4 is initialized with this flag as TRUE.");
205   optCmd->SetParameterName("optimizeFlag", tru    230   optCmd->SetParameterName("optimizeFlag", true);
206   optCmd->SetDefaultValue(true);                  231   optCmd->SetDefaultValue(true);
207   optCmd->AvailableForStates(G4State_PreInit,     232   optCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
208                                                   233 
209   brkBoECmd = new G4UIcmdWithABool("/run/break    234   brkBoECmd = new G4UIcmdWithABool("/run/breakAtBeginOfEvent", this);
210   brkBoECmd->SetGuidance("Set a break point at    235   brkBoECmd->SetGuidance("Set a break point at the beginning of every event.");
211   brkBoECmd->SetParameterName("flag", true);      236   brkBoECmd->SetParameterName("flag", true);
212   brkBoECmd->SetDefaultValue(true);               237   brkBoECmd->SetDefaultValue(true);
213                                                   238 
214   brkEoECmd = new G4UIcmdWithABool("/run/break    239   brkEoECmd = new G4UIcmdWithABool("/run/breakAtEndOfEvent", this);
215   brkEoECmd->SetGuidance("Set a break point at    240   brkEoECmd->SetGuidance("Set a break point at the end of every event.");
216   brkEoECmd->SetParameterName("flag", true);      241   brkEoECmd->SetParameterName("flag", true);
217   brkEoECmd->SetDefaultValue(true);               242   brkEoECmd->SetDefaultValue(true);
218                                                   243 
219   abortCmd = new G4UIcmdWithABool("/run/abort"    244   abortCmd = new G4UIcmdWithABool("/run/abort", this);
220   abortCmd->SetGuidance("Abort current run pro    245   abortCmd->SetGuidance("Abort current run processing.");
221   abortCmd->SetGuidance(                          246   abortCmd->SetGuidance(
222     "If softAbort is false (default), currentl    247     "If softAbort is false (default), currently processing event "
223     "will be immediately aborted,");              248     "will be immediately aborted,");
224   abortCmd->SetGuidance(                       << 249   abortCmd->SetGuidance("while softAbort is true, abortion occurs after "
225     "while softAbort is true, abortion occurs  << 250                         "processing the current event.");
226     "processing the current event.");          << 
227   abortCmd->AvailableForStates(G4State_GeomClo    251   abortCmd->AvailableForStates(G4State_GeomClosed, G4State_EventProc);
228   abortCmd->SetParameterName("softAbort", true    252   abortCmd->SetParameterName("softAbort", true);
229   abortCmd->SetDefaultValue(false);               253   abortCmd->SetDefaultValue(false);
230                                                   254 
231   abortEventCmd = new G4UIcmdWithoutParameter(    255   abortEventCmd = new G4UIcmdWithoutParameter("/run/abortCurrentEvent", this);
232   abortEventCmd->SetGuidance("Abort currently     256   abortEventCmd->SetGuidance("Abort currently processing event.");
233   abortEventCmd->AvailableForStates(G4State_Ev    257   abortEventCmd->AvailableForStates(G4State_EventProc);
234                                                   258 
235   geomCmd = new G4UIcmdWithoutParameter("/run/    259   geomCmd = new G4UIcmdWithoutParameter("/run/geometryModified", this);
236   geomCmd->SetGuidance("Force geometry to be c    260   geomCmd->SetGuidance("Force geometry to be closed (re-voxellized) again.");
237   geomCmd->SetGuidance("This command must be a << 261   geomCmd->SetGuidance(
                                                   >> 262     "This command must be applied if geometry has been modified");
238   geomCmd->SetGuidance(" after the first initi    263   geomCmd->SetGuidance(" after the first initialization (or BeamOn).");
239   geomCmd->AvailableForStates(G4State_PreInit,    264   geomCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
240                                                   265 
241   geomRebCmd = new G4UIcmdWithABool("/run/rein    266   geomRebCmd = new G4UIcmdWithABool("/run/reinitializeGeometry", this);
242   geomRebCmd->SetGuidance("Force geometry to b    267   geomRebCmd->SetGuidance("Force geometry to be rebuilt once again.");
243   geomRebCmd->SetGuidance("This command must b << 268   geomRebCmd->SetGuidance(
                                                   >> 269     "This command must be applied if the user needs his/her");
244   geomRebCmd->SetGuidance(" detector construct    270   geomRebCmd->SetGuidance(" detector construction to be reinvoked.");
245   geomRebCmd->SetGuidance("/run/geometryModifi << 271   geomRebCmd->SetGuidance(
                                                   >> 272     "/run/geometryModified is automatically issued with this command.");
246   geomRebCmd->SetParameterName("destroyFirst",    273   geomRebCmd->SetParameterName("destroyFirst", true);
247   geomRebCmd->SetDefaultValue(false);             274   geomRebCmd->SetDefaultValue(false);
248   geomRebCmd->AvailableForStates(G4State_PreIn    275   geomRebCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
249                                                   276 
250   physCmd = new G4UIcmdWithoutParameter("/run/    277   physCmd = new G4UIcmdWithoutParameter("/run/physicsModified", this);
251   physCmd->SetGuidance("Force all physics tabl    278   physCmd->SetGuidance("Force all physics tables recalculated again.");
252   physCmd->SetGuidance("This command must be a    279   physCmd->SetGuidance("This command must be applied");
253   physCmd->SetGuidance(" if physics process ha    280   physCmd->SetGuidance(" if physics process has been modified after the");
254   physCmd->SetGuidance(" first initialization     281   physCmd->SetGuidance(" first initialization (or BeamOn).");
255   physCmd->AvailableForStates(G4State_PreInit,    282   physCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
256                                                   283 
257   constScoreCmd = new G4UIcmdWithoutParameter( << 284   constScoreCmd =
                                                   >> 285     new G4UIcmdWithoutParameter("/run/constructScoringWorlds", this);
258   constScoreCmd->SetGuidance("Construct scorin    286   constScoreCmd->SetGuidance("Construct scoring parallel world(s) if defined.");
259   constScoreCmd->SetGuidance(                  << 287   constScoreCmd->SetGuidance("This command is not mandatory, but automatically "
260     "This command is not mandatory, but automa << 288                              "called when a run starts.");
261     "called when a run starts.");              << 
262   constScoreCmd->SetGuidance(                     289   constScoreCmd->SetGuidance(
263     "But the user may use this to visualize th    290     "But the user may use this to visualize the scoring "
264     "world(s) before a run to start.");           291     "world(s) before a run to start.");
265   constScoreCmd->AvailableForStates(G4State_Id    292   constScoreCmd->AvailableForStates(G4State_Idle);
266                                                   293 
                                                   >> 294   materialScanner = new G4MaterialScanner();
                                                   >> 295 
267   randomDirectory = new G4UIdirectory("/random    296   randomDirectory = new G4UIdirectory("/random/");
268   randomDirectory->SetGuidance("Random number     297   randomDirectory->SetGuidance("Random number status control commands.");
269                                                   298 
270   seedCmd = new G4UIcmdWithAString("/random/se    299   seedCmd = new G4UIcmdWithAString("/random/setSeeds", this);
271   seedCmd->SetGuidance("Initialize the random  << 300   seedCmd->SetGuidance(
                                                   >> 301     "Initialize the random number generator with integer seed stream.");
272   seedCmd->SetGuidance("Number of integers sho    302   seedCmd->SetGuidance("Number of integers should be more than 1.");
273   seedCmd->SetGuidance(                           303   seedCmd->SetGuidance(
274     "Actual number of integers to be used depe    304     "Actual number of integers to be used depends on the individual "
275     "random number engine.");                     305     "random number engine.");
276 #ifdef G4MULTITHREADED                            306 #ifdef G4MULTITHREADED
277   seedCmd->SetGuidance("This command sets the     307   seedCmd->SetGuidance("This command sets the seeds for the master thread.");
278 #endif                                            308 #endif
279   seedCmd->SetParameterName("IntArray", false)    309   seedCmd->SetParameterName("IntArray", false);
280   seedCmd->AvailableForStates(G4State_PreInit, << 310   seedCmd->AvailableForStates(G4State_PreInit, G4State_Idle,
                                                   >> 311                               G4State_GeomClosed);
281   seedCmd->SetToBeBroadcasted(false);             312   seedCmd->SetToBeBroadcasted(false);
282                                                   313 
283   randDirCmd = new G4UIcmdWithAString("/random    314   randDirCmd = new G4UIcmdWithAString("/random/setDirectoryName", this);
284   randDirCmd->SetGuidance("Define the director << 315   randDirCmd->SetGuidance(
                                                   >> 316     "Define the directory name of the rndm status files.");
285   randDirCmd->SetGuidance("Directory will be c    317   randDirCmd->SetGuidance("Directory will be created if it does not exist.");
286   randDirCmd->SetParameterName("fileName", tru    318   randDirCmd->SetParameterName("fileName", true);
287   randDirCmd->SetDefaultValue("./");              319   randDirCmd->SetDefaultValue("./");
288   randDirCmd->AvailableForStates(G4State_PreIn << 320   randDirCmd->AvailableForStates(G4State_PreInit, G4State_Idle,
                                                   >> 321                                  G4State_GeomClosed);
289                                                   322 
290   savingFlagCmd = new G4UIcmdWithABool("/rando    323   savingFlagCmd = new G4UIcmdWithABool("/random/setSavingFlag", this);
291   savingFlagCmd->SetGuidance("The randomNumber    324   savingFlagCmd->SetGuidance("The randomNumberStatus will be saved at :");
292   savingFlagCmd->SetGuidance(                  << 325   savingFlagCmd->SetGuidance("beginning of run (currentRun.rndm) and "
293     "beginning of run (currentRun.rndm) and "  << 326                              "beginning of event (currentEvent.rndm) ");
294     "beginning of event (currentEvent.rndm) ") << 
295   savingFlagCmd->SetParameterName("flag", true    327   savingFlagCmd->SetParameterName("flag", true);
296   savingFlagCmd->SetDefaultValue(true);           328   savingFlagCmd->SetDefaultValue(true);
297                                                   329 
298   saveThisRunCmd = new G4UIcmdWithoutParameter    330   saveThisRunCmd = new G4UIcmdWithoutParameter("/random/saveThisRun", this);
299   saveThisRunCmd->SetGuidance("copy currentRun    331   saveThisRunCmd->SetGuidance("copy currentRun.rndm to runXXX.rndm");
300   saveThisRunCmd->AvailableForStates(G4State_I << 332   saveThisRunCmd->AvailableForStates(G4State_Idle, G4State_GeomClosed,
                                                   >> 333                                      G4State_EventProc);
301                                                   334 
302   saveThisEventCmd = new G4UIcmdWithoutParamet    335   saveThisEventCmd = new G4UIcmdWithoutParameter("/random/saveThisEvent", this);
303   saveThisEventCmd->SetGuidance("copy currentE    336   saveThisEventCmd->SetGuidance("copy currentEvent.rndm to runXXXevtYYY.rndm");
304   saveThisEventCmd->AvailableForStates(G4State    337   saveThisEventCmd->AvailableForStates(G4State_EventProc);
305                                                   338 
306   restoreRandCmd = new G4UIcmdWithAString("/ra    339   restoreRandCmd = new G4UIcmdWithAString("/random/resetEngineFrom", this);
307   restoreRandCmd->SetGuidance("Reset the statu << 340   restoreRandCmd->SetGuidance(
                                                   >> 341     "Reset the status of the rndm engine from a file.");
308   restoreRandCmd->SetGuidance("See CLHEP manua    342   restoreRandCmd->SetGuidance("See CLHEP manual for detail.");
309   restoreRandCmd->SetGuidance("The engine stat    343   restoreRandCmd->SetGuidance("The engine status must be stored beforehand.");
310   restoreRandCmd->SetGuidance(                 << 344   restoreRandCmd->SetGuidance("Directory of the status file should be set by"
311     "Directory of the status file should be se << 345                               " /random/setDirectoryName.");
312     " /random/setDirectoryName.");             << 
313   restoreRandCmd->SetParameterName("fileName",    346   restoreRandCmd->SetParameterName("fileName", true);
314   restoreRandCmd->SetDefaultValue("currentRun.    347   restoreRandCmd->SetDefaultValue("currentRun.rndm");
315   restoreRandCmd->AvailableForStates(G4State_P << 348   restoreRandCmd->AvailableForStates(G4State_PreInit, G4State_Idle,
                                                   >> 349                                      G4State_GeomClosed);
316   restoreRandCmd->SetToBeBroadcasted(false);      350   restoreRandCmd->SetToBeBroadcasted(false);
317                                                   351 
318   restoreRandCmdMT = new G4UIcmdWithABool("/ra << 352   restoreRandCmdMT =
319   restoreRandCmdMT->SetGuidance("Reset the sta << 353     new G4UIcmdWithABool("/random/resetEngineFromEachEvent", this);
320   restoreRandCmdMT->SetGuidance("Note that the << 
321   restoreRandCmdMT->SetGuidance(                  354   restoreRandCmdMT->SetGuidance(
322     "run{#1}evt{#2}.rndm ; where #1 is the run << 355     "Reset the status of the rndm engine from a file at each event.");
323     "number and #2 is the event number.");     << 356   restoreRandCmdMT->SetGuidance(
                                                   >> 357     "Note that the file must follow the following naming convention:");
                                                   >> 358   restoreRandCmdMT->SetGuidance("run{#1}evt{#2}.rndm ; where #1 is the run "
                                                   >> 359                                 "number and #2 is the event number.");
324   restoreRandCmdMT->SetGuidance(                  360   restoreRandCmdMT->SetGuidance(
325     "For example to re-seed the first event of    361     "For example to re-seed the first event of the first "
326     "run the file should be called run0evt0.rn    362     "run the file should be called run0evt0.rndm.");
327   restoreRandCmdMT->SetGuidance(                  363   restoreRandCmdMT->SetGuidance(
328     "If for a specific run/event the file is n    364     "If for a specific run/event the file is not found, "
329     "the standard re-seeding strategy is used.    365     "the standard re-seeding strategy is used.");
330   restoreRandCmdMT->SetGuidance(               << 366   restoreRandCmdMT->SetGuidance("This command has meaning only in MT mode for "
331     "This command has meaning only in MT mode  << 367                                 "strong reproducibility studies.");
332     "strong reproducibility studies.");        << 368   restoreRandCmdMT->SetGuidance("Directory of the status file should be set by"
333   restoreRandCmdMT->SetGuidance(               << 369                                 " /random/setDirectoryName.");
334     "Directory of the status file should be se << 
335     " /random/setDirectoryName.");             << 
336   restoreRandCmdMT->SetDefaultValue(false);       370   restoreRandCmdMT->SetDefaultValue(false);
337   restoreRandCmdMT->AvailableForStates(G4State << 371   restoreRandCmdMT->AvailableForStates(G4State_PreInit, G4State_Idle,
                                                   >> 372                                        G4State_GeomClosed);
338                                                   373 
339   saveEachEventCmd = new G4UIcmdWithABool("/ra    374   saveEachEventCmd = new G4UIcmdWithABool("/random/saveEachEventFlag", this);
340   saveEachEventCmd->SetGuidance("Save random n << 375   saveEachEventCmd->SetGuidance(
341   saveEachEventCmd->SetGuidance("File name con << 376     "Save random number status at beginning of each event.");
                                                   >> 377   saveEachEventCmd->SetGuidance(
                                                   >> 378     "File name contains run and event numbers: runXXXevtYYY.rndm");
342   saveEachEventCmd->SetParameterName("flag", t    379   saveEachEventCmd->SetParameterName("flag", true);
343   saveEachEventCmd->SetDefaultValue(true);        380   saveEachEventCmd->SetDefaultValue(true);
344                                                   381 
345   randEvtCmd = new G4UIcmdWithAnInteger("/run/    382   randEvtCmd = new G4UIcmdWithAnInteger("/run/storeRndmStatToEvent", this);
346   randEvtCmd->SetGuidance("Flag to store rndm     383   randEvtCmd->SetGuidance("Flag to store rndm status to G4Event object.");
347   randEvtCmd->SetGuidance(" flag = 0 : not sto    384   randEvtCmd->SetGuidance(" flag = 0 : not store (default)");
348   randEvtCmd->SetGuidance(" flag = 1 : status  << 385   randEvtCmd->SetGuidance(
                                                   >> 386     " flag = 1 : status before primary particle generation is stored");
349   randEvtCmd->SetGuidance(                        387   randEvtCmd->SetGuidance(
350     " flag = 2 : status before event processin    388     " flag = 2 : status before event processing (after primary "
351     "particle generation) is stored");            389     "particle generation) is stored");
352   randEvtCmd->SetGuidance(" flag = 3 : both ar    390   randEvtCmd->SetGuidance(" flag = 3 : both are stored");
353   randEvtCmd->SetGuidance(                        391   randEvtCmd->SetGuidance(
354     "Note: Some performance overhead may be se    392     "Note: Some performance overhead may be seen by storing rndm "
355     "status, in particular");                     393     "status, in particular");
356   randEvtCmd->SetGuidance(                        394   randEvtCmd->SetGuidance(
357     "for the case of simplest geometry and sma    395     "for the case of simplest geometry and small number of tracks per event.");
358   randEvtCmd->SetParameterName("flag", true);     396   randEvtCmd->SetParameterName("flag", true);
359   randEvtCmd->SetDefaultValue(0);                 397   randEvtCmd->SetDefaultValue(0);
360   randEvtCmd->SetRange("flag>=0 && flag<=3");     398   randEvtCmd->SetRange("flag>=0 && flag<=3");
361   randEvtCmd->AvailableForStates(G4State_PreIn    399   randEvtCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
362                                                   400 
363   procUICmds = new G4UIcmdWithoutParameter("/r    401   procUICmds = new G4UIcmdWithoutParameter("/run/workersProcessCmds", this);
364   procUICmds->SetToBeBroadcasted(false);          402   procUICmds->SetToBeBroadcasted(false);
365   procUICmds->SetGuidance("Force workers to pr << 403   procUICmds->SetGuidance(
                                                   >> 404     "Force workers to process current stack of UI commands.");
366   procUICmds->SetGuidance("This commands is me    405   procUICmds->SetGuidance("This commands is meaningful only in MT mode.");
367   procUICmds->AvailableForStates(G4State_PreIn << 406   procUICmds->AvailableForStates(G4State_PreInit, G4State_Idle,
368                                                << 407                                  G4State_GeomClosed);
369   trajMergeCmd = new G4UIcmdWithABool("/run/tr << 
370   trajMergeCmd->SetGuidance("Merge trajectorie << 
371   trajMergeCmd->SetGuidance("In sub-event para << 
372   trajMergeCmd->SetGuidance("threads are not m << 
373   trajMergeCmd->SetGuidance("due to the perfor << 
374   trajMergeCmd->SetGuidance("This command enab << 
375   trajMergeCmd->SetGuidance("/tracking/storeTr << 
376   trajMergeCmd->SetGuidance("This command is v << 
377   trajMergeCmd->AvailableForStates(G4State_Pre << 
378   trajMergeCmd->SetParameterName("flag", true) << 
379   trajMergeCmd->SetDefaultValue(true);         << 
380   trajMergeCmd->SetToBeBroadcasted(false);     << 
381 }                                                 408 }
382                                                   409 
383 // ------------------------------------------- << 
384 G4RunMessenger::~G4RunMessenger()                 410 G4RunMessenger::~G4RunMessenger()
385 {                                                 411 {
                                                   >> 412   delete materialScanner;
386   delete beamOnCmd;                               413   delete beamOnCmd;
387   delete verboseCmd;                              414   delete verboseCmd;
388   delete printProgCmd;                            415   delete printProgCmd;
389   delete nThreadsCmd;                             416   delete nThreadsCmd;
390   delete maxThreadsCmd;                           417   delete maxThreadsCmd;
391   delete pinAffinityCmd;                          418   delete pinAffinityCmd;
392   delete evModCmd;                                419   delete evModCmd;
393   delete optCmd;                                  420   delete optCmd;
394   delete dumpRegCmd;                              421   delete dumpRegCmd;
395   delete dumpCoupleCmd;                           422   delete dumpCoupleCmd;
396   delete brkBoECmd;                               423   delete brkBoECmd;
397   delete brkEoECmd;                               424   delete brkEoECmd;
398   delete abortCmd;                                425   delete abortCmd;
399   delete abortEventCmd;                           426   delete abortEventCmd;
400   delete initCmd;                                 427   delete initCmd;
401   delete geomCmd;                                 428   delete geomCmd;
402   delete geomRebCmd;                              429   delete geomRebCmd;
403   delete physCmd;                                 430   delete physCmd;
404   delete randEvtCmd;                              431   delete randEvtCmd;
405   delete constScoreCmd;                           432   delete constScoreCmd;
406   delete procUICmds;                              433   delete procUICmds;
407   delete trajMergeCmd;                         << 
408                                                   434 
409   delete seedCmd;                                 435   delete seedCmd;
410   delete savingFlagCmd;                           436   delete savingFlagCmd;
411   delete saveThisRunCmd;                          437   delete saveThisRunCmd;
412   delete saveThisEventCmd;                        438   delete saveThisEventCmd;
413   delete restoreRandCmd;                          439   delete restoreRandCmd;
414   delete randomDirectory;                         440   delete randomDirectory;
415   delete saveEachEventCmd;                        441   delete saveEachEventCmd;
416                                                   442 
417   delete randDirCmd;                              443   delete randDirCmd;
418   delete runDirectory;                            444   delete runDirectory;
419                                                   445 
420   delete restoreRandCmdMT;                        446   delete restoreRandCmdMT;
421 }                                                 447 }
422                                                   448 
423 // ------------------------------------------- << 
424 void G4RunMessenger::SetNewValue(G4UIcommand*     449 void G4RunMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
425 {                                                 450 {
426   if (command == beamOnCmd) {                  << 451   if(command == beamOnCmd)
                                                   >> 452   {
427     G4int nev;                                    453     G4int nev;
428     G4int nst;                                    454     G4int nst;
429     const auto nv = (const char*)newValue;     << 455     const char* nv = (const char*) newValue;
430     std::istringstream is(nv);                    456     std::istringstream is(nv);
431     is >> nev >> macroFileName >> nst;            457     is >> nev >> macroFileName >> nst;
432     if (macroFileName == "***NULL***") {       << 458     if(macroFileName == "***NULL***")
                                                   >> 459     {
433       runManager->BeamOn(nev);                    460       runManager->BeamOn(nev);
434     }                                             461     }
435     else {                                     << 462     else
                                                   >> 463     {
436       runManager->BeamOn(nev, macroFileName, n    464       runManager->BeamOn(nev, macroFileName, nst);
437     }                                             465     }
438   }                                               466   }
439   else if (command == verboseCmd) {            << 467   else if(command == verboseCmd)
                                                   >> 468   {
440     runManager->SetVerboseLevel(verboseCmd->Ge    469     runManager->SetVerboseLevel(verboseCmd->GetNewIntValue(newValue));
441   }                                               470   }
442   else if (command == printProgCmd) {          << 471   else if(command == printProgCmd)
                                                   >> 472   {
443     runManager->SetPrintProgress(printProgCmd-    473     runManager->SetPrintProgress(printProgCmd->GetNewIntValue(newValue));
444   }                                               474   }
445   else if (command == nThreadsCmd) {           << 475   else if(command == nThreadsCmd)
                                                   >> 476   {
446     G4RunManager::RMType rmType = runManager->    477     G4RunManager::RMType rmType = runManager->GetRunManagerType();
447     if (rmType == G4RunManager::masterRM) {    << 478     if(rmType == G4RunManager::masterRM)
                                                   >> 479     {
448       static_cast<G4MTRunManager*>(runManager)    480       static_cast<G4MTRunManager*>(runManager)
449         ->SetNumberOfThreads(nThreadsCmd->GetN    481         ->SetNumberOfThreads(nThreadsCmd->GetNewIntValue(newValue));
450     }                                             482     }
451     else if (rmType == G4RunManager::sequentia << 483     else if(rmType == G4RunManager::sequentialRM)
                                                   >> 484     {
452       G4cout << "*** /run/numberOfThreads comm    485       G4cout << "*** /run/numberOfThreads command is issued in sequential mode."
453              << "\nCommand is ignored." << G4e    486              << "\nCommand is ignored." << G4endl;
454     }                                             487     }
455     else {                                     << 488     else
                                                   >> 489     {
456       G4Exception("G4RunMessenger::ApplyNewCom    490       G4Exception("G4RunMessenger::ApplyNewCommand", "Run0901", FatalException,
457                   "/run/numberOfThreads comman    491                   "/run/numberOfThreads command is issued to local thread.");
458     }                                             492     }
459   }                                               493   }
460   else if (command == maxThreadsCmd) {         << 494   else if(command == maxThreadsCmd)
                                                   >> 495   {
461     G4RunManager::RMType rmType = runManager->    496     G4RunManager::RMType rmType = runManager->GetRunManagerType();
462     if (rmType == G4RunManager::masterRM) {    << 497     if(rmType == G4RunManager::masterRM)
                                                   >> 498     {
463       static_cast<G4MTRunManager*>(runManager)    499       static_cast<G4MTRunManager*>(runManager)
464         ->SetNumberOfThreads(G4Threading::G4Ge    500         ->SetNumberOfThreads(G4Threading::G4GetNumberOfCores());
465     }                                             501     }
466     else if (rmType == G4RunManager::sequentia << 502     else if(rmType == G4RunManager::sequentialRM)
                                                   >> 503     {
467       G4cout << "*** /run/useMaximumLogicalCor    504       G4cout << "*** /run/useMaximumLogicalCores command is issued in "
468                 "sequential mode."                505                 "sequential mode."
469              << "\nCommand is ignored." << G4e    506              << "\nCommand is ignored." << G4endl;
470     }                                             507     }
471     else {                                     << 508     else
472       G4Exception("G4RunMessenger::ApplyNewCom << 509     {
473                   "/run/useMaximumLogicalCores << 510       G4Exception(
                                                   >> 511         "G4RunMessenger::ApplyNewCommand", "Run0901", FatalException,
                                                   >> 512         "/run/useMaximumLogicalCores command is issued to local thread.");
474     }                                             513     }
475   }                                               514   }
476   else if (command == pinAffinityCmd) {        << 515   else if(command == pinAffinityCmd)
                                                   >> 516   {
477     G4RunManager::RMType rmType = runManager->    517     G4RunManager::RMType rmType = runManager->GetRunManagerType();
478     if (rmType == G4RunManager::masterRM) {    << 518     if(rmType == G4RunManager::masterRM)
                                                   >> 519     {
479       static_cast<G4MTRunManager*>(runManager)    520       static_cast<G4MTRunManager*>(runManager)
480         ->SetPinAffinity(pinAffinityCmd->GetNe    521         ->SetPinAffinity(pinAffinityCmd->GetNewIntValue(newValue));
481     }                                             522     }
482     else if (rmType == G4RunManager::sequentia << 523     else if(rmType == G4RunManager::sequentialRM)
                                                   >> 524     {
483       G4cout << "*** /run/pinAffinity command     525       G4cout << "*** /run/pinAffinity command is issued in sequential mode."
484              << "\nCommand is ignored." << G4e    526              << "\nCommand is ignored." << G4endl;
485     }                                             527     }
486     else {                                     << 528     else
                                                   >> 529     {
487       G4Exception("G4RunMessenger::ApplyNewCom    530       G4Exception("G4RunMessenger::ApplyNewCommand", "Run0901", FatalException,
488                   "/run/pinAffinity command is    531                   "/run/pinAffinity command is issued to local thread.");
489     }                                             532     }
490   }                                               533   }
491   else if (command == evModCmd) {              << 534   else if(command == evModCmd)
                                                   >> 535   {
492     G4RunManager::RMType rmType = runManager->    536     G4RunManager::RMType rmType = runManager->GetRunManagerType();
493     if (rmType == G4RunManager::masterRM) {    << 537     if(rmType == G4RunManager::masterRM)
494       G4int nevMod = 0;                        << 538     {
495       G4int sOnce = 0;                         << 539       G4int nevMod   = 0;
496       const auto nv = (const char*)newValue;   << 540       G4int sOnce    = 0;
                                                   >> 541       const char* nv = (const char*) newValue;
497       std::istringstream is(nv);                  542       std::istringstream is(nv);
498       is >> nevMod >> sOnce;                      543       is >> nevMod >> sOnce;
499       static_cast<G4MTRunManager*>(runManager)    544       static_cast<G4MTRunManager*>(runManager)->SetEventModulo(nevMod);
500       G4MTRunManager::SetSeedOncePerCommunicat    545       G4MTRunManager::SetSeedOncePerCommunication(sOnce);
501     }                                             546     }
502     else if (rmType == G4RunManager::sequentia << 547     else if(rmType == G4RunManager::sequentialRM)
                                                   >> 548     {
503       G4cout << "*** /run/eventModulo command     549       G4cout << "*** /run/eventModulo command is issued in sequential mode."
504              << "\nCommand is ignored." << G4e    550              << "\nCommand is ignored." << G4endl;
505     }                                             551     }
506     else if (rmType == G4RunManager::subEventM << 552     else
507       G4cout << "*** /run/eventModulo command  << 553     {
508              << "\nCommand is ignored." << G4e << 
509     }                                          << 
510     else {                                     << 
511       G4Exception("G4RunMessenger::ApplyNewCom    554       G4Exception("G4RunMessenger::ApplyNewCommand", "Run0902", FatalException,
512                   "/run/eventModulo command is << 555                   "/run/eventModulo command is issued to local thread.");
513     }                                             556     }
514   }                                               557   }
515   else if (command == dumpRegCmd) {            << 558   else if(command == dumpRegCmd)
516     if (newValue == "**ALL**") {               << 559   {
                                                   >> 560     if(newValue == "**ALL**")
                                                   >> 561     {
517       runManager->DumpRegion();                   562       runManager->DumpRegion();
518     }                                             563     }
519     else {                                     << 564     else
                                                   >> 565     {
520       runManager->DumpRegion(newValue);           566       runManager->DumpRegion(newValue);
521     }                                             567     }
522   }                                               568   }
523   else if (command == dumpCoupleCmd) {         << 569   else if(command == dumpCoupleCmd)
                                                   >> 570   {
524     G4ProductionCutsTable::GetProductionCutsTa    571     G4ProductionCutsTable::GetProductionCutsTable()->DumpCouples();
525   }                                               572   }
526   else if (command == optCmd) {                << 573   else if(command == optCmd)
                                                   >> 574   {
527     runManager->SetGeometryToBeOptimized(optCm    575     runManager->SetGeometryToBeOptimized(optCmd->GetNewBoolValue(newValue));
528   }                                               576   }
529   else if (command == brkBoECmd) {             << 577   else if(command == brkBoECmd)
530     G4UImanager::GetUIpointer()->SetPauseAtBeg << 578   {
                                                   >> 579     G4UImanager::GetUIpointer()->SetPauseAtBeginOfEvent(
                                                   >> 580       brkBoECmd->GetNewBoolValue(newValue));
                                                   >> 581   }
                                                   >> 582   else if(command == brkEoECmd)
                                                   >> 583   {
                                                   >> 584     G4UImanager::GetUIpointer()->SetPauseAtEndOfEvent(
                                                   >> 585       brkEoECmd->GetNewBoolValue(newValue));
531   }                                               586   }
532   else if (command == brkEoECmd) {             << 587   else if(command == abortCmd)
533     G4UImanager::GetUIpointer()->SetPauseAtEnd << 588   {
534   }                                            << 
535   else if (command == abortCmd) {              << 
536     runManager->AbortRun(abortCmd->GetNewBoolV    589     runManager->AbortRun(abortCmd->GetNewBoolValue(newValue));
537   }                                               590   }
538   else if (command == abortEventCmd) {         << 591   else if(command == abortEventCmd)
                                                   >> 592   {
539     runManager->AbortEvent();                     593     runManager->AbortEvent();
540   }                                               594   }
541   else if (command == initCmd) {               << 595   else if(command == initCmd)
                                                   >> 596   {
542     runManager->Initialize();                     597     runManager->Initialize();
543   }                                               598   }
544   else if (command == geomCmd) {               << 599   else if(command == geomCmd)
                                                   >> 600   {
545     runManager->GeometryHasBeenModified(false)    601     runManager->GeometryHasBeenModified(false);
546   }                                               602   }
547   else if (command == geomRebCmd) {            << 603   else if(command == geomRebCmd)
548     runManager->ReinitializeGeometry(geomRebCm << 604   {
                                                   >> 605     runManager->ReinitializeGeometry(geomRebCmd->GetNewBoolValue(newValue),
                                                   >> 606                                      false);
549   }                                               607   }
550   else if (command == physCmd) {               << 608   else if(command == physCmd)
                                                   >> 609   {
551     runManager->PhysicsHasBeenModified();         610     runManager->PhysicsHasBeenModified();
552   }                                               611   }
553   else if (command == seedCmd) {               << 612   else if(command == seedCmd)
                                                   >> 613   {
554     G4Tokenizer next(newValue);                   614     G4Tokenizer next(newValue);
555     G4int idx = 0;                                615     G4int idx = 0;
556     G4long seeds[100];                         << 616     long seeds[100];
557     G4String vl;                                  617     G4String vl;
558     while (!(vl = next()).empty()) {           << 618     while(!(vl = next()).isNull())
                                                   >> 619     {
559       seeds[idx] = StoL(vl);                      620       seeds[idx] = StoL(vl);
560       ++idx;                                   << 621       idx++;
561     }                                             622     }
562     if (idx < 2) {                             << 623     if(idx < 2)
563       G4cerr << "/random/setSeeds should have  << 624     {
564                 "Command ignored."             << 625       G4cerr << "/random/setSeeds should have at least two integers. Command "
                                                   >> 626                 "ignored."
565              << G4endl;                           627              << G4endl;
566     }                                             628     }
567     else {                                     << 629     else
                                                   >> 630     {
568       seeds[idx] = 0;                             631       seeds[idx] = 0;
569       G4Random::setTheSeeds(seeds);               632       G4Random::setTheSeeds(seeds);
570     }                                             633     }
571   }                                               634   }
572   else if (command == randDirCmd) {            << 635   else if(command == randDirCmd)
                                                   >> 636   {
573     runManager->SetRandomNumberStoreDir(newVal    637     runManager->SetRandomNumberStoreDir(newValue);
574   }                                               638   }
575   else if (command == savingFlagCmd) {         << 639   else if(command == savingFlagCmd)
                                                   >> 640   {
576     runManager->SetRandomNumberStore(savingFla    641     runManager->SetRandomNumberStore(savingFlagCmd->GetNewBoolValue(newValue));
577   }                                               642   }
578   else if (command == saveThisRunCmd) {        << 643   else if(command == saveThisRunCmd)
                                                   >> 644   {
579     runManager->rndmSaveThisRun();                645     runManager->rndmSaveThisRun();
580   }                                               646   }
581   else if (command == saveThisEventCmd) {      << 647   else if(command == saveThisEventCmd)
                                                   >> 648   {
582     runManager->rndmSaveThisEvent();              649     runManager->rndmSaveThisEvent();
583   }                                               650   }
584   else if (command == restoreRandCmd) {        << 651   else if(command == restoreRandCmd)
                                                   >> 652   {
585     runManager->RestoreRandomNumberStatus(newV    653     runManager->RestoreRandomNumberStatus(newValue);
586   }                                               654   }
587   else if (command == randEvtCmd) {            << 655   else if(command == randEvtCmd)
588     runManager->StoreRandomNumberStatusToG4Eve << 656   {
589   }                                            << 657     runManager->StoreRandomNumberStatusToG4Event(
590   else if (command == saveEachEventCmd) {      << 658       randEvtCmd->GetNewIntValue(newValue));
591     runManager->SetRandomNumberStorePerEvent(s << 659   }
                                                   >> 660   else if(command == saveEachEventCmd)
                                                   >> 661   {
                                                   >> 662     runManager->SetRandomNumberStorePerEvent(
                                                   >> 663       saveEachEventCmd->GetNewBoolValue(newValue));
592   }                                               664   }
593   else if (command == constScoreCmd) {         << 665   else if(command == constScoreCmd)
                                                   >> 666   {
594     runManager->ConstructScoringWorlds();         667     runManager->ConstructScoringWorlds();
595   }                                               668   }
596   else if (command == restoreRandCmdMT) {      << 669   else if(command == restoreRandCmdMT)
597     runManager->RestoreRndmEachEvent(restoreRa << 670   {
                                                   >> 671     runManager->RestoreRndmEachEvent(
                                                   >> 672       restoreRandCmdMT->GetNewBoolValue(newValue));
598   }                                               673   }
599   else if (command == procUICmds) {            << 674   else if(command == procUICmds)
                                                   >> 675   {
600     G4RunManager::RMType rmType = runManager->    676     G4RunManager::RMType rmType = runManager->GetRunManagerType();
601     if (rmType == G4RunManager::masterRM) {    << 677     if(rmType == G4RunManager::masterRM)
                                                   >> 678     {
602       auto rm = dynamic_cast<G4MTRunManager*>(    679       auto rm = dynamic_cast<G4MTRunManager*>(runManager);
603       if (rm != nullptr) {                     << 680       if(rm != nullptr)
                                                   >> 681       {
604         rm->RequestWorkersProcessCommandsStack    682         rm->RequestWorkersProcessCommandsStack();
605       }                                           683       }
606       else {                                   << 684       else
                                                   >> 685       {
607         G4Exception("G4RunManager::ApplyNewCom    686         G4Exception("G4RunManager::ApplyNewCommand", "Run0128", FatalException,
608                     "/run/workersProcessCmds c    687                     "/run/workersProcessCmds command issued on a "
609                     "non-G4MTRunManager class     688                     "non-G4MTRunManager class instance.");
610       }                                           689       }
611     }                                             690     }
612     else if (rmType == G4RunManager::sequentia << 691     else if(rmType == G4RunManager::sequentialRM)
613       G4cout << "*** /run/workersProcessCmds c << 692     {
614              << "\nCommand is ignored." << G4e << 693       G4cout
                                                   >> 694         << "*** /run/workersProcessCmds command is issued in sequential mode."
                                                   >> 695         << "\nCommand is ignored." << G4endl;
615     }                                             696     }
616     else {                                     << 697     else
                                                   >> 698     {
617       G4Exception("G4RunMessenger::ApplyNewCom    699       G4Exception("G4RunMessenger::ApplyNewCommand", "Run0129", FatalException,
618                   "/run/workersProcessCmds com    700                   "/run/workersProcessCmds command is issued to local thread.");
619     }                                             701     }
620   }                                               702   }
621   else if (command == trajMergeCmd) {          << 
622     G4RunManager::RMType rmType = runManager-> << 
623     if (rmType == G4RunManager::subEventMaster << 
624       auto rm = dynamic_cast<G4SubEvtRunManage << 
625       if (rm != nullptr) {                     << 
626         rm->TrajectoriesToBeMerged(trajMergeCm << 
627       }                                        << 
628       else {                                   << 
629         G4ExceptionDescription ed;             << 
630         ed << "/run/trajectoriesToBeMerged com << 
631            << "instance that is not G4SubEvtRu << 
632         G4Exception("G4RunManager::ApplyNewCom << 
633       }                                        << 
634     }                                          << 
635     else {                                     << 
636       G4cout << "*** /run/trajectoriesToBeMerg << 
637              << "class instance that is not G4 << 
638              << "\nCommand is ignored." << G4e << 
639     }                                          << 
640   }                                            << 
641 }                                                 703 }
642                                                   704 
643 // ------------------------------------------- << 
644 G4String G4RunMessenger::GetCurrentValue(G4UIc    705 G4String G4RunMessenger::GetCurrentValue(G4UIcommand* command)
645 {                                                 706 {
646   G4String cv;                                    707   G4String cv;
647                                                   708 
648   if (command == verboseCmd) {                 << 709   if(command == verboseCmd)
                                                   >> 710   {
649     cv = verboseCmd->ConvertToString(runManage    711     cv = verboseCmd->ConvertToString(runManager->GetVerboseLevel());
650   }                                               712   }
651   else if (command == printProgCmd) {          << 713   else if(command == printProgCmd)
                                                   >> 714   {
652     cv = printProgCmd->ConvertToString(runMana    715     cv = printProgCmd->ConvertToString(runManager->GetPrintProgress());
653   }                                               716   }
654   else if (command == randDirCmd) {            << 717   else if(command == randDirCmd)
                                                   >> 718   {
655     cv = runManager->GetRandomNumberStoreDir()    719     cv = runManager->GetRandomNumberStoreDir();
656   }                                               720   }
657   else if (command == randEvtCmd) {            << 721   else if(command == randEvtCmd)
658     cv = randEvtCmd->ConvertToString(runManage << 722   {
                                                   >> 723     cv = randEvtCmd->ConvertToString(
                                                   >> 724       runManager->GetFlagRandomNumberStatusToG4Event());
659   }                                               725   }
660   else if (command == nThreadsCmd) {           << 726   else if(command == nThreadsCmd)
                                                   >> 727   {
661     G4RunManager::RMType rmType = runManager->    728     G4RunManager::RMType rmType = runManager->GetRunManagerType();
662     if (rmType == G4RunManager::masterRM) {    << 729     if(rmType == G4RunManager::masterRM)
                                                   >> 730     {
663       cv = nThreadsCmd->ConvertToString(          731       cv = nThreadsCmd->ConvertToString(
664         static_cast<G4MTRunManager*>(runManage    732         static_cast<G4MTRunManager*>(runManager)->GetNumberOfThreads());
665     }                                             733     }
666     else if (rmType == G4RunManager::sequentia << 734     else if(rmType == G4RunManager::sequentialRM)
                                                   >> 735     {
667       cv = "0";                                   736       cv = "0";
668     }                                             737     }
669   }                                               738   }
670   else if (command == evModCmd) {              << 739   else if(command == evModCmd)
                                                   >> 740   {
671     G4RunManager::RMType rmType = runManager->    741     G4RunManager::RMType rmType = runManager->GetRunManagerType();
672     if (rmType == G4RunManager::masterRM) {    << 742     if(rmType == G4RunManager::masterRM)
673       cv = evModCmd->ConvertToString(static_ca << 743     {
674            + " " + evModCmd->ConvertToString(G << 744       cv =
675     }                                          << 745         evModCmd->ConvertToString(
676     else if (rmType == G4RunManager::sequentia << 746           static_cast<G4MTRunManager*>(runManager)->GetEventModulo()) +
677       G4cout << "*** /run/eventModulo command  << 747         " " +
                                                   >> 748         evModCmd->ConvertToString(G4MTRunManager::SeedOncePerCommunication());
                                                   >> 749     }
                                                   >> 750     else if(rmType == G4RunManager::sequentialRM)
                                                   >> 751     {
                                                   >> 752       G4cout << "*** /run/eventModulo command is valid only in MT mode."
                                                   >> 753              << G4endl;
678     }                                             754     }
679   }                                               755   }
680                                                   756 
681   return cv;                                      757   return cv;
682 }                                                 758 }
683                                                   759