ECCE @ EIC Software
Reference for
ECCE @ EIC
simulation and reconstruction software on GitHub
Home page
Related Pages
Modules
Namespaces
Classes
Files
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
G4SchedulerMessenger.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file G4SchedulerMessenger.cc
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
//
27
// Author: Mathieu Karamitros (kara (AT) cenbg . in2p3 . fr)
28
//
29
// History:
30
// -----------
31
//
32
// -------------------------------------------------------------------
33
#include <
G4Scheduler.hh
>
34
#include <
G4SchedulerMessenger.hh
>
35
36
#include "
G4UIdirectory.hh
"
37
#include "
G4UIcmdWithoutParameter.hh
"
38
#include "
G4UIcmdWithAnInteger.hh
"
39
#include "
G4UIcmdWithADoubleAndUnit.hh
"
40
#include "
G4UIcmdWithABool.hh
"
41
#include "
G4UIcommand.hh
"
42
#include "
G4UIparameter.hh
"
43
#include "
G4UImanager.hh
"
44
#include "
G4ios.hh
"
45
46
G4SchedulerMessenger::G4SchedulerMessenger
(
G4Scheduler
* stepMgr) :
47
fScheduler(stepMgr)
48
{
49
fITDirectory
=
new
G4UIdirectory
(
"/scheduler/"
);
50
fITDirectory
->
SetGuidance
(
"Control commands for the time scheduler "
51
"(dna chemistry applications)."
);
52
53
// Set end time
54
fEndTime
=
new
G4UIcmdWithADoubleAndUnit
(
"/scheduler/endTime"
,
this
);
55
fEndTime
->
SetGuidance
(
"Set time at which the simulation must stop."
);
56
fEndTime
->
AvailableForStates
(
G4State_PreInit
,
G4State_Idle
);
57
fEndTime
->
SetUnitCategory
(
"Time"
);
58
fEndTime
->
SetDefaultUnit
(
"picosecond"
);
59
fEndTime
->
SetDefaultValue
(1);
60
61
// Set time tolerance
62
fTimeTolerance
=
new
G4UIcmdWithADoubleAndUnit
(
"/scheduler/timeTolerance"
,
63
this
);
64
fTimeTolerance
->
SetGuidance
(
"This command aims at resolving issues related to"
65
" floating points. If two time events are separated by less than the "
66
"selected tolerance, they are assumed to belong to the same time step."
);
67
fTimeTolerance
->
AvailableForStates
(
G4State_PreInit
,
G4State_Idle
);
68
fTimeTolerance
->
SetUnitCategory
(
"Time"
);
69
fTimeTolerance
->
SetDefaultUnit
(
"picosecond"
);
70
fTimeTolerance
->
SetDefaultValue
(1);
71
72
// Initialize
73
fInitCmd
=
new
G4UIcmdWithoutParameter
(
"/scheduler/initialize"
,
this
);
74
fInitCmd
->
SetGuidance
(
"Initialize G4Scheduler. This is done "
75
"for standalone application only (no physics)."
);
76
fInitCmd
->
AvailableForStates
(
G4State_PreInit
,
G4State_Idle
);
77
78
// Set Max Null time Step
79
fMaxNULLTimeSteps
=
new
G4UIcmdWithAnInteger
(
"/scheduler/maxNullTimeSteps"
,
80
this
);
81
fMaxNULLTimeSteps
->
SetGuidance
(
"Set maximum allowed zero time steps. After this "
82
"threshold, the simulation is stopped."
);
83
fMaxNULLTimeSteps
->
SetParameterName
(
"numberOfNullTimeSteps"
,
true
);
84
fMaxNULLTimeSteps
->
SetDefaultValue
(10);
85
fMaxNULLTimeSteps
->
SetRange
(
"numberOfNullTimeSteps >=0 "
);
86
87
fMaxStepNumber
=
new
G4UIcmdWithAnInteger
(
"/scheduler/maxStepNumber"
,
this
);
88
fMaxStepNumber
->
SetGuidance
(
"Set the maximum number of time steps. After this "
89
"threshold, the simulation is stopped."
);
90
fMaxStepNumber
->
SetParameterName
(
"maximumNumberOfSteps"
,
true
);
91
fMaxStepNumber
->
SetDefaultValue
(-1);
92
93
// Beam On
94
fProcessCmd
=
new
G4UIcmdWithoutParameter
(
"/scheduler/process"
,
this
);
95
fProcessCmd
->
SetGuidance
(
"Process stacked tracks in G4Scheduler. This is done "
96
"for standalone application only (no physics)."
);
97
fProcessCmd
->
AvailableForStates
(
G4State_PreInit
,
G4State_Idle
);
98
99
// Verbose
100
fVerboseCmd
=
new
G4UIcmdWithAnInteger
(
"/scheduler/verbose"
,
this
);
101
fVerboseCmd
->
SetGuidance
(
"Set the Verbose level of G4Scheduler."
);
102
fVerboseCmd
->
SetGuidance
(
" 0 : Silent (default)"
);
103
fVerboseCmd
->
SetGuidance
(
" 1 : Display reactions"
);
104
fVerboseCmd
->
SetGuidance
(
" 2 "
);
105
fVerboseCmd
->
SetParameterName
(
"level"
,
true
);
106
fVerboseCmd
->
SetDefaultValue
(1);
107
// fVerboseCmd->SetRange("level >=0 && level <=4");
108
109
fWhyDoYouStop
=
new
G4UIcmdWithoutParameter
(
"/scheduler/whyDoYouStop"
,
this
);
110
fWhyDoYouStop
->
SetGuidance
(
"Will print information on why the scheduler is "
111
"stopping the process"
);
112
113
fUseDefaultTimeSteps
=
new
G4UIcmdWithABool
(
"/scheduler/useDefaultTimeSteps"
,
114
this
);
115
fUseDefaultTimeSteps
->
SetGuidance
(
"Let the G4 processes decided for the next "
116
"time step interval. This command would be interesting if no reaction has "
117
"been set and if one will want to track down Brownian objects. "
118
"NB: This command gets in conflicts with the declaration of time steps."
);
119
}
120
121
G4SchedulerMessenger::~G4SchedulerMessenger
()
122
{
123
delete
fTimeTolerance
;
124
delete
fITDirectory
;
125
delete
fInitCmd
;
126
delete
fEndTime
;
127
delete
fMaxNULLTimeSteps
;
128
delete
fMaxStepNumber
;
129
delete
fProcessCmd
;
130
delete
fVerboseCmd
;
131
delete
fWhyDoYouStop
;
132
delete
fUseDefaultTimeSteps
;
133
}
134
135
void
G4SchedulerMessenger::SetNewValue
(
G4UIcommand
* command,
136
G4String
newValue)
137
{
138
if
(command ==
fProcessCmd
)
139
{
140
fScheduler
->
Process
();
141
}
142
else
if
(command ==
fEndTime
)
143
{
144
fScheduler
->
SetEndTime
(
fEndTime
->
GetNewDoubleValue
(newValue));
145
}
146
else
if
(command ==
fTimeTolerance
)
147
{
148
fScheduler
->
SetTimeTolerance
(
149
fTimeTolerance
->
GetNewDoubleValue
(newValue));
150
}
151
else
if
(command ==
fVerboseCmd
)
152
{
153
fScheduler
->
SetVerbose
(
fVerboseCmd
->
GetNewIntValue
(newValue));
154
}
155
else
if
(command ==
fInitCmd
)
156
{
157
fScheduler
->
Initialize
();
158
}
159
else
if
(command ==
fMaxNULLTimeSteps
)
160
{
161
fScheduler
->
SetMaxZeroTimeAllowed
(
162
fMaxNULLTimeSteps
->
GetNewIntValue
(newValue));
163
}
164
else
if
(command ==
fMaxStepNumber
)
165
{
166
fScheduler
->
SetMaxNbSteps
(
fMaxStepNumber
->
GetNewIntValue
(newValue));
167
}
168
else
if
(command ==
fWhyDoYouStop
)
169
{
170
fScheduler
->
WhyDoYouStop
();
171
}
172
else
if
(command ==
fUseDefaultTimeSteps
)
173
{
174
fScheduler
->
UseDefaultTimeSteps
(
fUseDefaultTimeSteps
->
GetNewBoolValue
(newValue));
175
}
176
}
177
178
G4String
G4SchedulerMessenger::GetCurrentValue
(
G4UIcommand
* command)
179
{
180
G4String
cv;
181
182
if
(command ==
fVerboseCmd
)
183
{
184
cv =
fVerboseCmd
->
ConvertToString
(
fScheduler
->
GetVerbose
());
185
}
186
else
if
(command ==
fEndTime
)
187
{
188
cv =
fEndTime
->
ConvertToString
(
fScheduler
->
GetEndTime
());
189
}
190
else
if
(command ==
fTimeTolerance
)
191
{
192
cv =
fTimeTolerance
->
ConvertToString
(
fScheduler
->
GetTimeTolerance
());
193
}
194
else
if
(command ==
fInitCmd
)
195
{
196
cv =
fInitCmd
->
ConvertToString
(
fScheduler
->
IsInitialized
());
197
}
198
else
if
(command ==
fMaxNULLTimeSteps
)
199
{
200
cv =
fMaxNULLTimeSteps
->
ConvertToString
(
201
fScheduler
->
GetMaxZeroTimeAllowed
());
202
}
203
else
if
(command ==
fMaxStepNumber
)
204
{
205
cv =
fMaxStepNumber
->
ConvertToString
(
fScheduler
->
GetMaxNbSteps
());
206
}
207
else
if
(command ==
fUseDefaultTimeSteps
)
208
{
209
cv =
fUseDefaultTimeSteps
->
ConvertToString
(
fScheduler
->
AreDefaultTimeStepsUsed
());
210
}
211
212
return
cv;
213
}
214
geant4
tree
geant4-10.6-release
source
processes
electromagnetic
dna
management
src
G4SchedulerMessenger.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:25:29
using
1.8.2 with
ECCE GitHub integration