Geant4_10
ExG4RunAction01Messenger.cc
Go to the documentation of this file.
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 // $Id$
27 //
30 
32 #include "ExG4RunAction01.hh"
33 
34 #include "G4UIdirectory.hh"
35 #include "G4UIcmdWithABool.hh"
36 #include "G4UIcmdWithAnInteger.hh"
37 #include "G4UIcmdWithAString.hh"
38 #include "globals.hh"
39 
40 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
41 
43  : G4UImessenger(),
44  fRunAction (runAction),
45  fTopDirectory(0),
46  fDirectory(0),
47  fSetVerboseLevelCmd(0),
48  fSetSaveRndmCmd(0),
49  fSetReadRndmCmd(0),
50  fSetRndmFileNameCmd(0),
51  fSetAutoSeedCmd(0)
52 {
53  fTopDirectory = new G4UIdirectory("/ExG4/");
54  fTopDirectory->SetGuidance("UI commands of common example classes");
55 
56  fDirectory = new G4UIdirectory("/ExG4/event/");
57  fDirectory->SetGuidance("Event control");
58 
59  fSetVerboseLevelCmd = new G4UIcmdWithAnInteger("/ExG4/run/verboseLevel",this);
60  fSetVerboseLevelCmd->SetGuidance("Set run verbose level ." );
61  fSetVerboseLevelCmd->SetParameterName("VerboseLevel",false);
62  fSetVerboseLevelCmd->AvailableForStates(G4State_PreInit, G4State_Init);
63 
64  fSetSaveRndmCmd = new G4UIcmdWithABool("/ExG4/run/saveRndm",this);
65  fSetSaveRndmCmd
66  ->SetGuidance("Activate saving random number at beginOfRun and endOfRun .");
67  fSetSaveRndmCmd->SetParameterName("SaveRndm",false);
69 
70  fSetReadRndmCmd = new G4UIcmdWithABool("/ExG4/run/readRndm",this);
71  fSetReadRndmCmd->SetGuidance("Get rndm status from an external file at beginOfRun.");
72  fSetReadRndmCmd->SetParameterName("ReadRndm",false);
74 
75  fSetRndmFileNameCmd = new G4UIcmdWithAString("/ExG4/run/rndmFileName",this);
76  fSetRndmFileNameCmd->SetGuidance("Set rndm file name (to read from).");
77  fSetRndmFileNameCmd->SetParameterName("RndmFileName",false);
78  fSetRndmFileNameCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
79 
80  fSetAutoSeedCmd = new G4UIcmdWithABool("/ExG4/run/autoSeed",this);
81  fSetAutoSeedCmd->SetGuidance("Switch on/off time-based random seeds");
82  fSetAutoSeedCmd->SetGuidance(" true: run seeds determined by system time");
83  fSetAutoSeedCmd->SetGuidance(" false: use command 'random/resetEngineFrom'");
84  fSetAutoSeedCmd->SetParameterName("AutoSeed",false);
86 }
87 
88 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
89 
91 {
92  delete fTopDirectory;
93  delete fDirectory;
94  delete fSetVerboseLevelCmd;
95  delete fSetSaveRndmCmd;
96  delete fSetReadRndmCmd;
97  delete fSetRndmFileNameCmd;
98  delete fSetAutoSeedCmd;
99 }
100 
101 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
102 
104 {
105  if ( command == fSetVerboseLevelCmd ) {
106  fRunAction->SetVerboseLevel(fSetVerboseLevelCmd->GetNewIntValue(newValues));
107  }
108  else if ( command == fSetSaveRndmCmd ) {
109  fRunAction->SetSaveRndm(fSetSaveRndmCmd->GetNewBoolValue(newValues));
110  }
111  else if ( command == fSetReadRndmCmd ) {
112  fRunAction->SetReadRndm(fSetReadRndmCmd->GetNewBoolValue(newValues));
113  }
114  else if (command == fSetRndmFileNameCmd) {
115  fRunAction->SetRndmFileName(newValues);
116  }
117  else if ( command == fSetAutoSeedCmd ) {
118  fRunAction->SetAutoSeed(fSetAutoSeedCmd->GetNewBoolValue(newValues));
119  }
120 }
121 
122 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetRndmFileName(const G4String &fileName)
void SetSaveRndm(G4bool value)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
static G4int GetNewIntValue(const char *paramString)
static G4bool GetNewBoolValue(const char *paramString)
void SetVerboseLevel(G4int level)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
virtual void SetNewValue(G4UIcommand *command, G4String newValue)
ExG4RunAction01Messenger(ExG4RunAction01 *)
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:161
void AvailableForStates(G4ApplicationState s1)
Definition: G4UIcommand.cc:225
void SetReadRndm(G4bool value)
Definition of the ExG4RunAction01Messenger class.
void SetAutoSeed(G4bool value)
Definition of the ExG4RunAction01 class.