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