Geant4 VMC Version 6.6
Loading...
Searching...
No Matches
TG4RunActionMessenger.cxx
Go to the documentation of this file.
1//------------------------------------------------
2// The Geant4 Virtual Monte Carlo package
3// Copyright (C) 2007 - 2014 Ivana Hrivnacova
4// All rights reserved.
5//
6// For the licensing terms see geant4_vmc/LICENSE.
7// Contact: root-vmc@cern.ch
8//-------------------------------------------------
9
14
16#include "TG4Globals.h"
17#include "TG4RunAction.h"
18
19#include <G4UIcmdWithABool.hh>
20#include <G4UIcmdWithADoubleAndUnit.hh>
21#include <G4UIcmdWithAString.hh>
22#include <G4UIcmdWithAnInteger.hh>
23#include <G4UIdirectory.hh>
24
25//_____________________________________________________________________________
27 : G4UImessenger(),
28 fRunAction(runAction),
29 fRunDirectory(0),
30 fSaveRandomStatusCmd(0),
31 fReadRandomStatusCmd(0),
32 fRandomStatusFileCmd(0),
33 fSetLooperThresholdWarningEnergyCmd(0),
34 fSetLooperThresholdImportantEnergyCmd(0),
35 fSetNumberOfLooperThresholdTrialsCmd(0)
36
37{
39
40 fRunDirectory = new G4UIdirectory("/mcRun/");
41 fRunDirectory->SetGuidance("TG4RunAction control commands.");
42
43 fSaveRandomStatusCmd = new G4UIcmdWithABool("/mcRun/saveRandom", this);
44 fSaveRandomStatusCmd->SetGuidance(
45 "Save random engine status in start of event");
46 fSaveRandomStatusCmd->SetParameterName("SaveRandom", false);
47 fSaveRandomStatusCmd->AvailableForStates(
48 G4State_PreInit, G4State_Init, G4State_Idle);
49
50 fReadRandomStatusCmd = new G4UIcmdWithABool("/mcRun/readRandom", this);
51 fReadRandomStatusCmd->SetGuidance(
52 "Read random engine status from a file in start of event");
53 fReadRandomStatusCmd->SetParameterName("ReadRandom", false);
54 fReadRandomStatusCmd->AvailableForStates(
55 G4State_PreInit, G4State_Init, G4State_Idle);
56
57 fRandomStatusFileCmd = new G4UIcmdWithAString("/mcRun/setRandomFile", this);
58 fRandomStatusFileCmd->SetGuidance(
59 "Set the name of the random engine status file to be read in");
60 fRandomStatusFileCmd->SetParameterName("RandomFile", false);
61 fRandomStatusFileCmd->AvailableForStates(
62 G4State_PreInit, G4State_Init, G4State_Idle);
63
64 fSetLooperThresholdWarningEnergyCmd = new G4UIcmdWithADoubleAndUnit(
65 "/mcRun/setLooperThresholdWarningEnergy", this);
66 G4String guidance =
67 "Set energy threshold for warnings about killing looping tracks";
68 fSetLooperThresholdWarningEnergyCmd->SetGuidance(guidance);
69 fSetLooperThresholdWarningEnergyCmd->SetUnitCategory("Energy");
71 "LooperThresholdWarningEnergy", false);
72 fSetLooperThresholdWarningEnergyCmd->AvailableForStates(G4State_PreInit);
73
74 fSetLooperThresholdImportantEnergyCmd = new G4UIcmdWithADoubleAndUnit(
75 "/mcRun/setLooperThresholdImportantEnergy", this);
76 guidance = "Set important energy threshold: ";
77 fSetLooperThresholdImportantEnergyCmd->SetGuidance(guidance);
78 guidance =
79 "it enables tracks above its value to survive a chosen number of "
80 "‘tracking’ steps";
81 fSetLooperThresholdImportantEnergyCmd->SetGuidance(guidance);
82 fSetLooperThresholdImportantEnergyCmd->SetUnitCategory("Energy");
84 "LooperThresholdImportantEnergy", false);
85 fSetLooperThresholdImportantEnergyCmd->AvailableForStates(G4State_PreInit);
86
88 new G4UIcmdWithAnInteger("/mcRun/setNumberOfLooperThresholdTrials", this);
89 guidance = "Set number of trials to propagate a looping track";
90 fSetNumberOfLooperThresholdTrialsCmd->SetGuidance(guidance);
92 "NumberOfLooperThresholdTrials", false);
93 fSetNumberOfLooperThresholdTrialsCmd->AvailableForStates(G4State_PreInit);
94}
95
96//_____________________________________________________________________________
109
110//
111// public methods
112//
113
114//_____________________________________________________________________________
115void TG4RunActionMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
116{
118
119 if (command == fSaveRandomStatusCmd) {
121 fSaveRandomStatusCmd->GetNewBoolValue(newValue));
122 }
123 else if (command == fReadRandomStatusCmd) {
125 fReadRandomStatusCmd->GetNewBoolValue(newValue));
126 }
127 else if (command == fRandomStatusFileCmd) {
129 }
130 else if (command == fSetLooperThresholdWarningEnergyCmd) {
131 G4double value = G4UIcommand::ConvertToDouble(newValue);
133 }
134 else if (command == fSetLooperThresholdImportantEnergyCmd) {
135 G4double value = G4UIcommand::ConvertToDouble(newValue);
137 }
138 else if (command == fSetNumberOfLooperThresholdTrialsCmd) {
139 G4double value = G4UIcommand::ConvertToInt(newValue);
141 }
142}
Definition of the TG4Globals class and basic container types.
Definition of the TG4RunActionMessenger class.
Definition of the TG4RunAction class.
G4UIcmdWithABool * fSaveRandomStatusCmd
command: saveRandom
G4UIcmdWithAString * fRandomStatusFileCmd
command: setRandomFile
TG4RunAction * fRunAction
associated class
G4UIcmdWithADoubleAndUnit * fSetLooperThresholdWarningEnergyCmd
setLooperThresholdWarningEnergy command
G4UIcmdWithAnInteger * fSetNumberOfLooperThresholdTrialsCmd
setNumberOfLooperThresholdTrials
G4UIcmdWithABool * fReadRandomStatusCmd
command: readRandom
TG4RunActionMessenger()
Not implemented.
G4UIdirectory * fRunDirectory
command directory
G4UIcmdWithADoubleAndUnit * fSetLooperThresholdImportantEnergyCmd
setLooperThresholImportantEnergy command
virtual void SetNewValue(G4UIcommand *command, G4String string)
Actions at the beginning and the end of run.
void SetNumberOfThresholdTrials(G4int value)
void SetThresholdWarningEnergy(G4double value)
void SetReadRandomStatus(G4bool readRandomStatus)
void SetSaveRandomStatus(G4bool saveRandomStatus)
void SetThresholdImportantEnergy(G4double value)
void SetRandomStatusFile(G4String RandomStatusFile)