Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions
F04RunActionMessenger Class Reference

#include <F04RunActionMessenger.hh>

Inheritance diagram for F04RunActionMessenger:
G4UImessenger

Public Member Functions

 F04RunActionMessenger (F04RunAction *)
 
virtual ~F04RunActionMessenger ()
 
virtual void SetNewValue (G4UIcommand *, G4String)
 
- Public Member Functions inherited from G4UImessenger
 G4UImessenger ()
 
 G4UImessenger (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
 
virtual ~G4UImessenger ()
 
virtual G4String GetCurrentValue (G4UIcommand *command)
 
G4bool operator== (const G4UImessenger &messenger) const
 

Additional Inherited Members

- Protected Member Functions inherited from G4UImessenger
G4String ItoS (G4int i)
 
G4String DtoS (G4double a)
 
G4String BtoS (G4bool b)
 
G4int StoI (G4String s)
 
G4double StoD (G4String s)
 
G4bool StoB (G4String s)
 
void AddUIcommand (G4UIcommand *newCommand)
 
void CreateDirectory (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
 
template<typename T >
T * CreateCommand (const G4String &cname, const G4String &dsc)
 
- Protected Attributes inherited from G4UImessenger
G4UIdirectorybaseDir
 
G4String baseDirName
 

Detailed Description

Definition at line 46 of file F04RunActionMessenger.hh.

Constructor & Destructor Documentation

F04RunActionMessenger::F04RunActionMessenger ( F04RunAction runAction)

Definition at line 45 of file F04RunActionMessenger.cc.

References G4UIcommand::AvailableForStates(), G4State_Idle, G4State_PreInit, G4UIcmdWithAString::SetDefaultValue(), G4UIcommand::SetGuidance(), G4UIcmdWithAString::SetParameterName(), G4UIcmdWithAnInteger::SetParameterName(), G4UIcmdWithABool::SetParameterName(), and G4UIcommand::SetRange().

46  : fRunAction (runAction)
47 {
48  fRndmDir = new G4UIdirectory("/rndm/");
49  fRndmDir->SetGuidance("Rndm status control.");
50 
51  fRndmSaveCmd = new G4UIcmdWithAnInteger("/rndm/save",this);
52  fRndmSaveCmd->
53  SetGuidance("set frequency to save rndm status on external files.");
54  fRndmSaveCmd->SetGuidance("freq = 0 not saved");
55  fRndmSaveCmd->SetGuidance("freq > 0 saved on: beginOfRun.rndm");
56  fRndmSaveCmd->SetGuidance("freq = 1 saved on: endOfRun.rndm");
57  fRndmSaveCmd->SetGuidance("freq = 2 saved on: endOfEvent.rndm");
58  fRndmSaveCmd->SetParameterName("frequency",false);
59  fRndmSaveCmd->SetRange("frequency>=0 && frequency<=2");
61 
62  fRndmReadCmd = new G4UIcmdWithAString("/rndm/read",this);
63  fRndmReadCmd->SetGuidance("get rndm status from an external file.");
64  fRndmReadCmd->SetParameterName("fileName",true);
65  fRndmReadCmd->SetDefaultValue ("beginOfRun.rndm");
67 
68  fSetAutoSeedCmd = new G4UIcmdWithABool("/rndm/autoSeed",this);
69  fSetAutoSeedCmd->SetGuidance("Switch on/off time-based random seeds");
70  fSetAutoSeedCmd->SetGuidance(" true: run seeds determined by system time");
71  fSetAutoSeedCmd->SetGuidance("false: use command 'random/resetEngineFrom'");
72  fSetAutoSeedCmd->SetGuidance("Default = false");
73  fSetAutoSeedCmd->SetParameterName("autoSeed", false);
75 }
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetRange(const char *rs)
Definition: G4UIcommand.hh:125
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:161
void AvailableForStates(G4ApplicationState s1)
Definition: G4UIcommand.cc:225
void SetDefaultValue(const char *defVal)
F04RunActionMessenger::~F04RunActionMessenger ( )
virtual

Definition at line 79 of file F04RunActionMessenger.cc.

80 {
81  delete fRndmDir; delete fRndmSaveCmd;
82  delete fRndmReadCmd; delete fSetAutoSeedCmd;
83 }

Member Function Documentation

void F04RunActionMessenger::SetNewValue ( G4UIcommand command,
G4String  newValue 
)
virtual

Reimplemented from G4UImessenger.

Definition at line 87 of file F04RunActionMessenger.cc.

References G4cout, G4endl, G4UIcmdWithABool::GetNewBoolValue(), G4UIcmdWithAnInteger::GetNewIntValue(), F04RunAction::SetAutoSeed(), and F04RunAction::SetRndmFreq().

88 {
89  if (command == fRndmSaveCmd)
90  fRunAction->SetRndmFreq(fRndmSaveCmd->GetNewIntValue(newValue));
91 
92  if (command == fRndmReadCmd)
93  { G4cout << "\n---> rndm status restored from file: " << newValue << G4endl;
94  G4Random::restoreEngineStatus(newValue);
95  G4Random::showEngineStatus();
96  }
97 
98  if(command == fSetAutoSeedCmd)
99  fRunAction->SetAutoSeed(fSetAutoSeedCmd->GetNewBoolValue(newValue));
100 }
static G4int GetNewIntValue(const char *paramString)
void SetRndmFreq(G4int val)
Definition: F04RunAction.hh:54
static G4bool GetNewBoolValue(const char *paramString)
G4GLOB_DLL std::ostream G4cout
void SetAutoSeed(const G4bool val)
Definition: F04RunAction.hh:57
#define G4endl
Definition: G4ios.hh:61

The documentation for this class was generated from the following files: