Geant4 VMC
Version 6.8
Toggle main menu visibility
Loading...
Searching...
No Matches
source
run
src
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
15
#include "
TG4RunActionMessenger.h
"
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
//_____________________________________________________________________________
26
TG4RunActionMessenger::TG4RunActionMessenger
(
TG4RunAction
* runAction)
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"
);
70
fSetLooperThresholdWarningEnergyCmd
->SetParameterName(
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"
);
83
fSetLooperThresholdImportantEnergyCmd
->SetParameterName(
84
"LooperThresholdImportantEnergy"
,
false
);
85
fSetLooperThresholdImportantEnergyCmd
->AvailableForStates(G4State_PreInit);
86
87
fSetNumberOfLooperThresholdTrialsCmd
=
88
new
G4UIcmdWithAnInteger(
"/mcRun/setNumberOfLooperThresholdTrials"
,
this
);
89
guidance =
"Set number of trials to propagate a looping track"
;
90
fSetNumberOfLooperThresholdTrialsCmd
->SetGuidance(guidance);
91
fSetNumberOfLooperThresholdTrialsCmd
->SetParameterName(
92
"NumberOfLooperThresholdTrials"
,
false
);
93
fSetNumberOfLooperThresholdTrialsCmd
->AvailableForStates(G4State_PreInit);
94
}
95
96
//_____________________________________________________________________________
97
TG4RunActionMessenger::~TG4RunActionMessenger
()
98
{
100
101
delete
fRunDirectory
;
102
delete
fSaveRandomStatusCmd
;
103
delete
fReadRandomStatusCmd
;
104
delete
fRandomStatusFileCmd
;
105
delete
fSetLooperThresholdWarningEnergyCmd
;
106
delete
fSetLooperThresholdImportantEnergyCmd
;
107
delete
fSetNumberOfLooperThresholdTrialsCmd
;
108
}
109
110
//
111
// public methods
112
//
113
114
//_____________________________________________________________________________
115
void
TG4RunActionMessenger::SetNewValue
(
G4UIcommand
* command, G4String newValue)
116
{
118
119
if
(command ==
fSaveRandomStatusCmd
) {
120
fRunAction
->SetSaveRandomStatus(
121
fSaveRandomStatusCmd
->GetNewBoolValue(newValue));
122
}
123
else
if
(command ==
fReadRandomStatusCmd
) {
124
fRunAction
->SetReadRandomStatus(
125
fReadRandomStatusCmd
->GetNewBoolValue(newValue));
126
}
127
else
if
(command ==
fRandomStatusFileCmd
) {
128
fRunAction
->SetRandomStatusFile(newValue);
129
}
130
else
if
(command ==
fSetLooperThresholdWarningEnergyCmd
) {
131
G4double value = G4UIcommand::ConvertToDouble(newValue);
132
fRunAction
->SetThresholdWarningEnergy(value);
133
}
134
else
if
(command ==
fSetLooperThresholdImportantEnergyCmd
) {
135
G4double value = G4UIcommand::ConvertToDouble(newValue);
136
fRunAction
->SetThresholdImportantEnergy(value);
137
}
138
else
if
(command ==
fSetNumberOfLooperThresholdTrialsCmd
) {
139
G4double value = G4UIcommand::ConvertToInt(newValue);
140
fRunAction
->SetNumberOfThresholdTrials(value);
141
}
142
}
TG4Globals.h
Definition of the TG4Globals class and basic container types.
TG4RunActionMessenger.h
Definition of the TG4RunActionMessenger class.
TG4RunAction.h
Definition of the TG4RunAction class.
G4UIcommand
G4UImessenger
TG4RunActionMessenger::fSaveRandomStatusCmd
G4UIcmdWithABool * fSaveRandomStatusCmd
command: saveRandom
Definition
TG4RunActionMessenger.h:61
TG4RunActionMessenger::fRandomStatusFileCmd
G4UIcmdWithAString * fRandomStatusFileCmd
command: setRandomFile
Definition
TG4RunActionMessenger.h:63
TG4RunActionMessenger::fRunAction
TG4RunAction * fRunAction
associated class
Definition
TG4RunActionMessenger.h:59
TG4RunActionMessenger::fSetLooperThresholdWarningEnergyCmd
G4UIcmdWithADoubleAndUnit * fSetLooperThresholdWarningEnergyCmd
setLooperThresholdWarningEnergy command
Definition
TG4RunActionMessenger.h:66
TG4RunActionMessenger::fSetNumberOfLooperThresholdTrialsCmd
G4UIcmdWithAnInteger * fSetNumberOfLooperThresholdTrialsCmd
setNumberOfLooperThresholdTrials
Definition
TG4RunActionMessenger.h:72
TG4RunActionMessenger::~TG4RunActionMessenger
virtual ~TG4RunActionMessenger()
Definition
TG4RunActionMessenger.cxx:97
TG4RunActionMessenger::fReadRandomStatusCmd
G4UIcmdWithABool * fReadRandomStatusCmd
command: readRandom
Definition
TG4RunActionMessenger.h:62
TG4RunActionMessenger::TG4RunActionMessenger
TG4RunActionMessenger()
Not implemented.
TG4RunActionMessenger::fRunDirectory
G4UIdirectory * fRunDirectory
command directory
Definition
TG4RunActionMessenger.h:60
TG4RunActionMessenger::fSetLooperThresholdImportantEnergyCmd
G4UIcmdWithADoubleAndUnit * fSetLooperThresholdImportantEnergyCmd
setLooperThresholImportantEnergy command
Definition
TG4RunActionMessenger.h:69
TG4RunActionMessenger::SetNewValue
virtual void SetNewValue(G4UIcommand *command, G4String string)
Definition
TG4RunActionMessenger.cxx:115
TG4RunAction
Actions at the beginning and the end of run.
Definition
TG4RunAction.h:36
Generated on
for Geant4 VMC by
1.17.0