WCSim
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
WCSimRunActionMessenger.cc
Go to the documentation of this file.
2 
3 #include "WCSimRunAction.hh"
4 #include "G4UIdirectory.hh"
5 #include "G4UIcommand.hh"
6 #include "G4UIparameter.hh"
7 #include "G4UIcmdWithAString.hh"
8 #include "G4UIcmdWithABool.hh"
9 
11 :WCSimRun(WCSimRA)
12 {
13  WCSimIODir = new G4UIdirectory("/WCSimIO/");
14  WCSimIODir->SetGuidance("Commands to select I/O options");
15 
16  RootFile = new G4UIcmdWithAString("/WCSimIO/RootFile",this);
17  RootFile->SetGuidance("Set the root file name");
18  RootFile->SetGuidance("Enter the name of the output ROOT file");
19  RootFile->SetParameterName("RootFileName",true);
20  RootFile->SetDefaultValue("wcsim.root");
21 
22  UseTimer = new G4UIcmdWithABool("/WCSimIO/Timer",this);
23  UseTimer->SetGuidance("Use a timer for runtime");
24  UseTimer->SetParameterName("UseTimer",true);
25  UseTimer->SetDefaultValue(false);
26 }
27 
29 {
30  delete RootFile;
31  delete UseTimer;
32  delete WCSimIODir;
33 }
34 
35 void WCSimRunActionMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
36 {
37 
38  if ( command == RootFile)
39  {
40  WCSimRun->SetRootFileName(newValue);
41  G4cout << "Output ROOT file set to " << newValue << G4endl;
42  }
43  else if(command == UseTimer)
44  {
45  bool use = UseTimer->GetNewBoolValue(newValue);
46  WCSimRun->SetUseTimer(use);
47  G4cout << "WCSimRunAction timer " << (use ? "ENABLED" : "DISABLED") << G4endl;
48  }
49 
50 }
WCSimRunActionMessenger(WCSimRunAction *mpga)
void SetUseTimer(bool use)
void SetRootFileName(G4String fname)
void SetNewValue(G4UIcommand *command, G4String newValues)