| [828] | 1 | //
|
|---|
| 2 | // ********************************************************************
|
|---|
| 3 | // * License and Disclaimer *
|
|---|
| 4 | // * *
|
|---|
| 5 | // * The Geant4 software is copyright of the Copyright Holders of *
|
|---|
| 6 | // * the Geant4 Collaboration. It is provided under the terms and *
|
|---|
| 7 | // * conditions of the Geant4 Software License, included in the file *
|
|---|
| 8 | // * LICENSE and available at http://cern.ch/geant4/license . These *
|
|---|
| 9 | // * include a list of copyright holders. *
|
|---|
| 10 | // * *
|
|---|
| 11 | // * Neither the authors of this software system, nor their employing *
|
|---|
| 12 | // * institutes,nor the agencies providing financial support for this *
|
|---|
| 13 | // * work make any representation or warranty, express or implied, *
|
|---|
| 14 | // * regarding this software system or assume any liability for its *
|
|---|
| 15 | // * use. Please see the license in the file LICENSE and URL above *
|
|---|
| 16 | // * for the full disclaimer and the limitation of liability. *
|
|---|
| 17 | // * *
|
|---|
| 18 | // * This code implementation is the result of the scientific and *
|
|---|
| 19 | // * technical work of the GEANT4 collaboration. *
|
|---|
| 20 | // * By using, copying, modifying or distributing the software (or *
|
|---|
| 21 | // * any work based on the software) you agree to acknowledge its *
|
|---|
| 22 | // * use in resulting scientific publications, and indicate your *
|
|---|
| 23 | // * acceptance of all terms of the Geant4 Software license. *
|
|---|
| 24 | // ********************************************************************
|
|---|
| 25 | //
|
|---|
| 26 | //
|
|---|
| 27 | // $Id: G4RunMessenger.cc,v 1.31 2007/11/16 22:37:43 asaim Exp $
|
|---|
| [850] | 28 | // GEANT4 tag $Name: HEAD $
|
|---|
| [828] | 29 | //
|
|---|
| 30 |
|
|---|
| 31 | #include "G4RunMessenger.hh"
|
|---|
| 32 | #include "G4RunManager.hh"
|
|---|
| 33 | #include "G4UIdirectory.hh"
|
|---|
| 34 | #include "G4UIcmdWithoutParameter.hh"
|
|---|
| 35 | #include "G4UIcmdWithAString.hh"
|
|---|
| 36 | #include "G4UIcmdWithAnInteger.hh"
|
|---|
| 37 | #include "G4UIcmdWithABool.hh"
|
|---|
| 38 | #include "G4UIcommand.hh"
|
|---|
| 39 | #include "G4UIparameter.hh"
|
|---|
| 40 | #include "G4UImanager.hh"
|
|---|
| 41 | #include "G4ProductionCutsTable.hh"
|
|---|
| 42 | #include "G4ios.hh"
|
|---|
| 43 | #include "G4MaterialScanner.hh"
|
|---|
| 44 | #include "G4Tokenizer.hh"
|
|---|
| 45 | #include "Randomize.hh"
|
|---|
| 46 | #include <sstream>
|
|---|
| 47 |
|
|---|
| 48 | G4RunMessenger::G4RunMessenger(G4RunManager * runMgr)
|
|---|
| 49 | :runManager(runMgr)
|
|---|
| 50 | {
|
|---|
| 51 | runDirectory = new G4UIdirectory("/run/");
|
|---|
| 52 | runDirectory->SetGuidance("Run control commands.");
|
|---|
| 53 |
|
|---|
| 54 | initCmd = new G4UIcmdWithoutParameter("/run/initialize",this);
|
|---|
| 55 | initCmd->SetGuidance("Initialize G4 kernel.");
|
|---|
| 56 | initCmd->AvailableForStates(G4State_PreInit,G4State_Idle),
|
|---|
| 57 |
|
|---|
| 58 | beamOnCmd = new G4UIcommand("/run/beamOn",this);
|
|---|
| 59 | beamOnCmd->SetGuidance("Start a Run.");
|
|---|
| 60 | beamOnCmd->SetGuidance("If G4 kernel is not initialized, it will be initialized.");
|
|---|
| 61 | beamOnCmd->SetGuidance("Default number of events to be processed is 1.");
|
|---|
| 62 | beamOnCmd->SetGuidance("The second and third arguments can be used for");
|
|---|
| 63 | beamOnCmd->SetGuidance("executing a macro file at the end of each event.");
|
|---|
| 64 | beamOnCmd->SetGuidance("If the second argument, i.e. name of the macro");
|
|---|
| 65 | beamOnCmd->SetGuidance("file, is given but the third argument is not,");
|
|---|
| 66 | beamOnCmd->SetGuidance("the macro file will be executed for all of the");
|
|---|
| 67 | beamOnCmd->SetGuidance("event.");
|
|---|
| 68 | beamOnCmd->SetGuidance("If the third argument (nSelect) is given, the");
|
|---|
| 69 | beamOnCmd->SetGuidance("macro file will be executed only for the first");
|
|---|
| 70 | beamOnCmd->SetGuidance("nSelect events.");
|
|---|
| 71 | beamOnCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
|---|
| 72 | G4UIparameter* p1 = new G4UIparameter("numberOfEvent",'i',true);
|
|---|
| 73 | p1->SetDefaultValue(1);
|
|---|
| 74 | p1->SetParameterRange("numberOfEvent >= 0");
|
|---|
| 75 | beamOnCmd->SetParameter(p1);
|
|---|
| 76 | G4UIparameter* p2 = new G4UIparameter("macroFile",'s',true);
|
|---|
| 77 | p2->SetDefaultValue("***NULL***");
|
|---|
| 78 | beamOnCmd->SetParameter(p2);
|
|---|
| 79 | G4UIparameter* p3 = new G4UIparameter("nSelect",'i',true);
|
|---|
| 80 | p3->SetDefaultValue(-1);
|
|---|
| 81 | p3->SetParameterRange("nSelect>=-1");
|
|---|
| 82 | beamOnCmd->SetParameter(p3);
|
|---|
| 83 |
|
|---|
| 84 | verboseCmd = new G4UIcmdWithAnInteger("/run/verbose",this);
|
|---|
| 85 | verboseCmd->SetGuidance("Set the Verbose level of G4RunManager.");
|
|---|
| 86 | verboseCmd->SetGuidance(" 0 : Silent (default)");
|
|---|
| 87 | verboseCmd->SetGuidance(" 1 : Display main topics");
|
|---|
| 88 | verboseCmd->SetGuidance(" 2 : Display main topics and run summary");
|
|---|
| 89 | verboseCmd->SetParameterName("level",true);
|
|---|
| 90 | verboseCmd->SetDefaultValue(0);
|
|---|
| 91 | verboseCmd->SetRange("level >=0 && level <=2");
|
|---|
| 92 |
|
|---|
| 93 | dumpRegCmd = new G4UIcmdWithAString("/run/dumpRegion",this);
|
|---|
| 94 | dumpRegCmd->SetGuidance("Dump region information.");
|
|---|
| 95 | dumpRegCmd->SetGuidance("In case name of a region is not given, all regions will be displayed.");
|
|---|
| 96 | dumpRegCmd->SetParameterName("regionName", true);
|
|---|
| 97 | dumpRegCmd->SetDefaultValue("**ALL**");
|
|---|
| 98 | dumpRegCmd->AvailableForStates(G4State_Idle);
|
|---|
| 99 |
|
|---|
| 100 | dumpCoupleCmd = new G4UIcmdWithoutParameter("/run/dumpCouples",this);
|
|---|
| 101 | dumpCoupleCmd->SetGuidance("Dump material-cuts-couple information.");
|
|---|
| 102 | dumpCoupleCmd->SetGuidance("Note that material-cuts-couple information is updated");
|
|---|
| 103 | dumpCoupleCmd->SetGuidance("after BeamOn has started.");
|
|---|
| 104 | dumpCoupleCmd->AvailableForStates(G4State_Idle);
|
|---|
| 105 |
|
|---|
| 106 | optCmd = new G4UIcmdWithABool("/run/optimizeGeometry",this);
|
|---|
| 107 | optCmd->SetGuidance("Set the optimization flag for geometry.");
|
|---|
| 108 | optCmd->SetGuidance("If it is set to TRUE, G4GeometryManager will optimize");
|
|---|
| 109 | optCmd->SetGuidance("the geometry definitions.");
|
|---|
| 110 | optCmd->SetGuidance("GEANT4 is initialized with this flag as TRUE.");
|
|---|
| 111 | optCmd->SetParameterName("optimizeFlag",true);
|
|---|
| 112 | optCmd->SetDefaultValue(true);
|
|---|
| 113 | optCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
|---|
| 114 |
|
|---|
| 115 | brkBoECmd = new G4UIcmdWithABool("/run/breakAtBeginOfEvent",this);
|
|---|
| 116 | brkBoECmd->SetGuidance("Set a break point at the begining of every event.");
|
|---|
| 117 | brkBoECmd->SetParameterName("flag",true);
|
|---|
| 118 | brkBoECmd->SetDefaultValue(true);
|
|---|
| 119 |
|
|---|
| 120 | brkEoECmd = new G4UIcmdWithABool("/run/breakAtEndOfEvent",this);
|
|---|
| 121 | brkEoECmd->SetGuidance("Set a break point at the end of every event.");
|
|---|
| 122 | brkEoECmd->SetParameterName("flag",true);
|
|---|
| 123 | brkEoECmd->SetDefaultValue(true);
|
|---|
| 124 |
|
|---|
| 125 | abortCmd = new G4UIcmdWithABool("/run/abort",this);
|
|---|
| 126 | abortCmd->SetGuidance("Abort current run processing.");
|
|---|
| 127 | abortCmd->SetGuidance("If softAbort is false (default), currently processing event will be immediately aborted,");
|
|---|
| 128 | abortCmd->SetGuidance("while softAbort is true, abortion occurs after processing the current event.");
|
|---|
| 129 | abortCmd->AvailableForStates(G4State_GeomClosed,G4State_EventProc);
|
|---|
| 130 | abortCmd->SetParameterName("softAbort",true);
|
|---|
| 131 | abortCmd->SetDefaultValue(false);
|
|---|
| 132 |
|
|---|
| 133 | abortEventCmd = new G4UIcmdWithoutParameter("/run/abortCurrentEvent",this);
|
|---|
| 134 | abortEventCmd->SetGuidance("Abort currently processing event.");
|
|---|
| 135 | abortEventCmd->AvailableForStates(G4State_EventProc);
|
|---|
| 136 |
|
|---|
| 137 | geomCmd = new G4UIcmdWithoutParameter("/run/geometryModified",this);
|
|---|
| 138 | geomCmd->SetGuidance("Force geometry to be closed again.");
|
|---|
| 139 | geomCmd->SetGuidance("This command must be applied");
|
|---|
| 140 | geomCmd->SetGuidance(" if geometry has been modified after the");
|
|---|
| 141 | geomCmd->SetGuidance(" first initialization (or BeamOn).");
|
|---|
| 142 | geomCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
|---|
| 143 |
|
|---|
| 144 | physCmd = new G4UIcmdWithoutParameter("/run/physicsModified",this);
|
|---|
| 145 | physCmd->SetGuidance("Force all physics tables recalculated again.");
|
|---|
| 146 | physCmd->SetGuidance("This command must be applied");
|
|---|
| 147 | physCmd->SetGuidance(" if physics process has been modified after the");
|
|---|
| 148 | physCmd->SetGuidance(" first initialization (or BeamOn).");
|
|---|
| 149 | physCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
|---|
| 150 |
|
|---|
| 151 | cutCmd = new G4UIcmdWithoutParameter("/run/cutoffModified",this);
|
|---|
| 152 | cutCmd->SetGuidance("/run/cutoffModified becomes obsolete.");
|
|---|
| 153 | cutCmd->SetGuidance("It is safe to remove invoking this command.");
|
|---|
| 154 |
|
|---|
| 155 | constScoreCmd = new G4UIcmdWithoutParameter("/run/constructScoringWorlds",this);
|
|---|
| 156 | constScoreCmd->SetGuidance("Constrct scoring parallel world(s) if defined.");
|
|---|
| 157 | constScoreCmd->SetGuidance("This command is not mandatory, but automatically called when a run starts.");
|
|---|
| 158 | constScoreCmd->SetGuidance("But the user may use this to visualize the scoring world(s) before a run to start.");
|
|---|
| 159 | constScoreCmd->AvailableForStates(G4State_Idle);
|
|---|
| 160 |
|
|---|
| 161 | materialScanner = new G4MaterialScanner();
|
|---|
| 162 |
|
|---|
| 163 | randomDirectory = new G4UIdirectory("/random/");
|
|---|
| 164 | randomDirectory->SetGuidance("Random number status control commands.");
|
|---|
| 165 |
|
|---|
| 166 | seedCmd = new G4UIcmdWithAString("/random/setSeeds",this);
|
|---|
| 167 | seedCmd->SetGuidance("Initialize the random number generator with integer seed stream.");
|
|---|
| 168 | seedCmd->SetGuidance("Number of integers should be more than 1.");
|
|---|
| 169 | seedCmd->SetGuidance("Actual number of integers to be used depends on the individual random number engine.");
|
|---|
| 170 | seedCmd->SetParameterName("IntArray",false);
|
|---|
| 171 | seedCmd->AvailableForStates(G4State_PreInit,G4State_Idle,G4State_GeomClosed);
|
|---|
| 172 |
|
|---|
| 173 | randDirCmd = new G4UIcmdWithAString("/random/setDirectoryName",this);
|
|---|
| 174 | randDirCmd->SetGuidance("Define the directory name of the rndm status files.");
|
|---|
| 175 | randDirCmd->SetGuidance("Directory will be created if it does not exist.");
|
|---|
| 176 | randDirCmd->SetParameterName("fileName",true);
|
|---|
| 177 | randDirCmd->SetDefaultValue("./");
|
|---|
| 178 | randDirCmd->AvailableForStates(G4State_PreInit,G4State_Idle,G4State_GeomClosed);
|
|---|
| 179 |
|
|---|
| 180 | savingFlagCmd = new G4UIcmdWithABool("/random/setSavingFlag",this);
|
|---|
| 181 | savingFlagCmd->SetGuidance("The randomNumberStatus will be saved at :");
|
|---|
| 182 | savingFlagCmd->SetGuidance("begining of run (currentRun.rndm) and "
|
|---|
| 183 | "begining of event (currentEvent.rndm) ");
|
|---|
| 184 | savingFlagCmd->SetParameterName("flag",true);
|
|---|
| 185 | savingFlagCmd->SetDefaultValue(true);
|
|---|
| 186 |
|
|---|
| 187 | saveThisRunCmd = new G4UIcmdWithoutParameter("/random/saveThisRun",this);
|
|---|
| 188 | saveThisRunCmd->SetGuidance("copy currentRun.rndm to runXXX.rndm");
|
|---|
| 189 | saveThisRunCmd->AvailableForStates(G4State_Idle,G4State_GeomClosed,G4State_EventProc);
|
|---|
| 190 |
|
|---|
| 191 | saveThisEventCmd = new G4UIcmdWithoutParameter("/random/saveThisEvent",this);
|
|---|
| 192 | saveThisEventCmd->SetGuidance("copy currentEvent.rndm to runXXXevtYYY.rndm");
|
|---|
| 193 | saveThisEventCmd->AvailableForStates(G4State_EventProc);
|
|---|
| 194 |
|
|---|
| 195 | restoreRandCmd = new G4UIcmdWithAString("/random/resetEngineFrom",this);
|
|---|
| 196 | restoreRandCmd->SetGuidance("Reset the status of the rndm engine from a file.");
|
|---|
| 197 | restoreRandCmd->SetGuidance("See CLHEP manual for detail.");
|
|---|
| 198 | restoreRandCmd->SetGuidance("The engine status must be stored beforehand.");
|
|---|
| 199 | restoreRandCmd->SetGuidance("Directory of the status file should be set by"
|
|---|
| 200 | " /random/setDirectoryName.");
|
|---|
| 201 | restoreRandCmd->SetParameterName("fileName",true);
|
|---|
| 202 | restoreRandCmd->SetDefaultValue("currentRun.rndm");
|
|---|
| 203 | restoreRandCmd->AvailableForStates(G4State_PreInit,G4State_Idle,G4State_GeomClosed);
|
|---|
| 204 |
|
|---|
| 205 | randEvtCmd = new G4UIcmdWithAnInteger("/run/storeRndmStatToEvent",this);
|
|---|
| 206 | randEvtCmd->SetGuidance("Flag to store rndm status to G4Event object.");
|
|---|
| 207 | randEvtCmd->SetGuidance(" flag = 0 : not store (default)");
|
|---|
| 208 | randEvtCmd->SetGuidance(" flag = 1 : status before primary particle generation is stored");
|
|---|
| 209 | randEvtCmd->SetGuidance(" flag = 2 : status before event processing (after primary particle generation) is stored");
|
|---|
| 210 | randEvtCmd->SetGuidance(" flag = 3 : both are stored");
|
|---|
| 211 | randEvtCmd->SetGuidance("Note: Some performance overhead may be seen by storing rndm status, in particular");
|
|---|
| 212 | randEvtCmd->SetGuidance("for the case of simplest geometry and small number of tracks per event.");
|
|---|
| 213 | randEvtCmd->SetParameterName("flag",true);
|
|---|
| 214 | randEvtCmd->SetDefaultValue(0);
|
|---|
| 215 | randEvtCmd->SetRange("flag>=0 && flag<3");
|
|---|
| 216 | randEvtCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
|---|
| 217 |
|
|---|
| 218 | //old commands for the rndm engine status handling
|
|---|
| 219 | //
|
|---|
| 220 | randDirOld = new G4UIcmdWithAString("/run/randomNumberStatusDirectory",this);
|
|---|
| 221 | randDirOld->SetGuidance("Define the directory name of the rndm status files.");
|
|---|
| 222 | randDirOld->SetGuidance("Directory must be creates before storing the files.");
|
|---|
| 223 | randDirOld->SetGuidance("OBSOLETE --- Please use commands in /random/ directory");
|
|---|
| 224 | randDirOld->SetParameterName("fileName",true);
|
|---|
| 225 | randDirOld->SetDefaultValue("./");
|
|---|
| 226 | randDirOld->AvailableForStates(G4State_PreInit,G4State_Idle,G4State_GeomClosed);
|
|---|
| 227 |
|
|---|
| 228 | storeRandOld = new G4UIcmdWithAnInteger("/run/storeRandomNumberStatus",this);
|
|---|
| 229 | storeRandOld->SetGuidance("The randomNumberStatus will be saved at :");
|
|---|
| 230 | storeRandOld->SetGuidance("begining of run (currentRun.rndm) and "
|
|---|
| 231 | "begining of event (currentEvent.rndm) ");
|
|---|
| 232 | storeRandOld->SetGuidance("OBSOLETE --- Please use commands in /random/ directory");
|
|---|
| 233 | storeRandOld->SetParameterName("flag",true);
|
|---|
| 234 | storeRandOld->SetDefaultValue(1);
|
|---|
| 235 |
|
|---|
| 236 | restoreRandOld = new G4UIcmdWithAString("/run/restoreRandomNumberStatus",this);
|
|---|
| 237 | restoreRandOld->SetGuidance("Reset the status of the rndm engine from a file.");
|
|---|
| 238 | restoreRandOld->SetGuidance("See CLHEP manual for detail.");
|
|---|
| 239 | restoreRandOld->SetGuidance("The engine status must be stored beforehand.");
|
|---|
| 240 | restoreRandOld->SetGuidance("Directory of the status file should be set by"
|
|---|
| 241 | " /random/setDirectoryName.");
|
|---|
| 242 | restoreRandOld->SetGuidance("OBSOLETE --- Please use commands in /random/ directory");
|
|---|
| 243 | restoreRandOld->SetParameterName("fileName",true);
|
|---|
| 244 | restoreRandOld->SetDefaultValue("currentRun.rndm");
|
|---|
| 245 | restoreRandOld->AvailableForStates(G4State_PreInit,G4State_Idle,G4State_GeomClosed);
|
|---|
| 246 | }
|
|---|
| 247 |
|
|---|
| 248 | G4RunMessenger::~G4RunMessenger()
|
|---|
| 249 | {
|
|---|
| 250 | delete materialScanner;
|
|---|
| 251 | delete beamOnCmd;
|
|---|
| 252 | delete verboseCmd;
|
|---|
| 253 | delete optCmd;
|
|---|
| 254 | delete dumpRegCmd;
|
|---|
| 255 | delete dumpCoupleCmd;
|
|---|
| 256 | delete brkBoECmd;
|
|---|
| 257 | delete brkEoECmd;
|
|---|
| 258 | delete abortCmd;
|
|---|
| 259 | delete abortEventCmd;
|
|---|
| 260 | delete initCmd;
|
|---|
| 261 | delete geomCmd;
|
|---|
| 262 | delete physCmd;
|
|---|
| 263 | delete cutCmd;
|
|---|
| 264 | delete randEvtCmd;
|
|---|
| 265 | delete randDirOld; delete storeRandOld; delete restoreRandOld;
|
|---|
| 266 | delete constScoreCmd;
|
|---|
| 267 | delete runDirectory;
|
|---|
| 268 |
|
|---|
| 269 | delete randDirCmd;
|
|---|
| 270 | delete seedCmd;
|
|---|
| 271 | delete savingFlagCmd;
|
|---|
| 272 | delete saveThisRunCmd;
|
|---|
| 273 | delete saveThisEventCmd;
|
|---|
| 274 | delete restoreRandCmd;
|
|---|
| 275 | delete randomDirectory;
|
|---|
| 276 | }
|
|---|
| 277 |
|
|---|
| 278 | void G4RunMessenger::SetNewValue(G4UIcommand * command,G4String newValue)
|
|---|
| 279 | {
|
|---|
| 280 | if( command==beamOnCmd )
|
|---|
| 281 | {
|
|---|
| 282 | G4int nev;
|
|---|
| 283 | G4int ns;
|
|---|
| 284 | const char* nv = (const char*)newValue;
|
|---|
| 285 | std::istringstream is(nv);
|
|---|
| 286 | is >> nev >> macroFileName >> ns;
|
|---|
| 287 | if(macroFileName=="***NULL***")
|
|---|
| 288 | { runManager->BeamOn(nev); }
|
|---|
| 289 | else
|
|---|
| 290 | { runManager->BeamOn(nev,macroFileName,ns); }
|
|---|
| 291 | }
|
|---|
| 292 | else if( command==verboseCmd )
|
|---|
| 293 | { runManager->SetVerboseLevel(verboseCmd->GetNewIntValue(newValue)); }
|
|---|
| 294 | else if( command==dumpRegCmd )
|
|---|
| 295 | {
|
|---|
| 296 | if(newValue=="**ALL**")
|
|---|
| 297 | { runManager->DumpRegion(); }
|
|---|
| 298 | else
|
|---|
| 299 | { runManager->DumpRegion(newValue); }
|
|---|
| 300 | }
|
|---|
| 301 | else if( command==dumpCoupleCmd)
|
|---|
| 302 | {
|
|---|
| 303 | G4ProductionCutsTable::GetProductionCutsTable()->DumpCouples();
|
|---|
| 304 | }
|
|---|
| 305 | else if( command==optCmd )
|
|---|
| 306 | { runManager->SetGeometryToBeOptimized(optCmd->GetNewBoolValue(newValue)); }
|
|---|
| 307 | else if( command==brkBoECmd )
|
|---|
| 308 | { G4UImanager::GetUIpointer()->SetPauseAtBeginOfEvent(brkBoECmd->GetNewBoolValue(newValue)); }
|
|---|
| 309 | else if( command==brkEoECmd )
|
|---|
| 310 | { G4UImanager::GetUIpointer()->SetPauseAtEndOfEvent(brkEoECmd->GetNewBoolValue(newValue)); }
|
|---|
| 311 | else if( command==abortCmd )
|
|---|
| 312 | { runManager->AbortRun(abortCmd->GetNewBoolValue(newValue)); }
|
|---|
| 313 | else if( command==abortEventCmd )
|
|---|
| 314 | { runManager->AbortEvent(); }
|
|---|
| 315 | else if( command==initCmd )
|
|---|
| 316 | { runManager->Initialize(); }
|
|---|
| 317 | else if( command==geomCmd )
|
|---|
| 318 | { runManager->GeometryHasBeenModified(); }
|
|---|
| 319 | else if( command==physCmd )
|
|---|
| 320 | { runManager->PhysicsHasBeenModified(); }
|
|---|
| 321 | else if( command==cutCmd )
|
|---|
| 322 | { runManager->CutOffHasBeenModified(); }
|
|---|
| 323 |
|
|---|
| 324 | else if( command==seedCmd )
|
|---|
| 325 | {
|
|---|
| 326 | G4Tokenizer next(newValue);
|
|---|
| 327 | G4int idx=0;
|
|---|
| 328 | long seeds[100];
|
|---|
| 329 | G4String vl;
|
|---|
| 330 | while(!(vl=next()).isNull())
|
|---|
| 331 | { seeds[idx] = (long)(StoI(vl)); idx++; }
|
|---|
| 332 | if(idx<2)
|
|---|
| 333 | { G4cerr << "/random/setSeeds should have at least two integers. Command ignored." << G4endl; }
|
|---|
| 334 | else
|
|---|
| 335 | {
|
|---|
| 336 | seeds[idx] = 0;
|
|---|
| 337 | CLHEP::HepRandom::setTheSeeds(seeds);
|
|---|
| 338 | }
|
|---|
| 339 | }
|
|---|
| 340 | else if( command==randDirCmd )
|
|---|
| 341 | { runManager->SetRandomNumberStoreDir(newValue); }
|
|---|
| 342 | else if( command==savingFlagCmd )
|
|---|
| 343 | { runManager->SetRandomNumberStore(savingFlagCmd->GetNewBoolValue(newValue)); }
|
|---|
| 344 | else if( command==saveThisRunCmd )
|
|---|
| 345 | { runManager->rndmSaveThisRun(); }
|
|---|
| 346 | else if( command==saveThisEventCmd )
|
|---|
| 347 | { runManager->rndmSaveThisEvent(); }
|
|---|
| 348 | else if( command==restoreRandCmd )
|
|---|
| 349 | { runManager->RestoreRandomNumberStatus(newValue); }
|
|---|
| 350 | else if( command==randEvtCmd )
|
|---|
| 351 | { runManager->StoreRandomNumberStatusToG4Event(randEvtCmd->GetNewIntValue(newValue)); }
|
|---|
| 352 |
|
|---|
| 353 | else if( command==randDirOld )
|
|---|
| 354 | {G4cout << "warning: deprecated command. Use /random/setDirectoryName"
|
|---|
| 355 | << G4endl;
|
|---|
| 356 | // runManager->SetRandomNumberStoreDir(newValue);
|
|---|
| 357 | }
|
|---|
| 358 | else if( command==storeRandOld )
|
|---|
| 359 | {G4cout << "warning: deprecated command. Use /random/setSavingFlag"
|
|---|
| 360 | << G4endl;
|
|---|
| 361 | // G4int frequency = storeRandOld->GetNewIntValue(newValue);
|
|---|
| 362 | // G4bool flag = false;
|
|---|
| 363 | // if(frequency != 0) flag = true;
|
|---|
| 364 | // runManager->SetRandomNumberStore(flag);
|
|---|
| 365 | }
|
|---|
| 366 | else if( command==restoreRandOld )
|
|---|
| 367 | {G4cout << "warning: deprecated command. Use /random/resetEngineFrom"
|
|---|
| 368 | << G4endl;
|
|---|
| 369 | // runManager->RestoreRandomNumberStatus(newValue);
|
|---|
| 370 | }
|
|---|
| 371 | else if( command==constScoreCmd )
|
|---|
| 372 | { runManager->ConstructScoringWorlds(); }
|
|---|
| 373 |
|
|---|
| 374 | }
|
|---|
| 375 |
|
|---|
| 376 | G4String G4RunMessenger::GetCurrentValue(G4UIcommand * command)
|
|---|
| 377 | {
|
|---|
| 378 | G4String cv;
|
|---|
| 379 |
|
|---|
| 380 | if( command==verboseCmd )
|
|---|
| 381 | { cv = verboseCmd->ConvertToString(runManager->GetVerboseLevel()); }
|
|---|
| 382 | else if( command==randDirCmd )
|
|---|
| 383 | { cv = runManager->GetRandomNumberStoreDir(); }
|
|---|
| 384 | else if( command==randEvtCmd )
|
|---|
| 385 | { cv = randEvtCmd->ConvertToString(runManager->GetFlagRandomNumberStatusToG4Event()); }
|
|---|
| 386 |
|
|---|
| 387 | return cv;
|
|---|
| 388 | }
|
|---|
| 389 |
|
|---|