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
DetectorMessenger.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file DetectorMessenger.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
//
29
//
30
// -------------------------------------------------------------
31
// GEANT4 test IBREM
32
//
33
// Authors: V.Grichine, V.Ivanchenko
34
//
35
// Modified:
36
//
37
// 18-02-03 V.Ivanchenko create
38
//
39
// -------------------------------------------------------------
40
41
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
42
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
43
44
#include "DetectorMessenger.hh"
45
#include "DetectorConstruction.hh"
46
#include "
G4UIdirectory.hh
"
47
#include "
G4UIcmdWithABool.hh
"
48
#include "
G4UIcmdWithAString.hh
"
49
#include "
G4UIcmdWithAnInteger.hh
"
50
#include "
G4UIcmdWithADoubleAndUnit.hh
"
51
#include "
G4UIcmdWithoutParameter.hh
"
52
53
//#include "g4root.hh"
54
55
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
56
57
DetectorMessenger::DetectorMessenger
(
DetectorConstruction
*
h
):
58
fDetector(h)
59
{
60
fDetDir
=
new
G4UIdirectory
(
"/testem/"
);
61
fDetDir
->
SetGuidance
(
"General commands"
);
62
fDetDir1
=
new
G4UIdirectory
(
"/testem/physics/"
);
63
fDetDir1
->
SetGuidance
(
" commands to define physics"
);
64
fDetDir2
=
new
G4UIdirectory
(
"/testem/gun/"
);
65
fDetDir2
->
SetGuidance
(
" commands to define gun"
);
66
67
fAbsMaterCmd
=
new
G4UIcmdWithAString
(
"/testem/target1Material"
,
this
);
68
fAbsMaterCmd
->
SetGuidance
(
"Select Material of the target1."
);
69
fAbsMaterCmd
->
SetParameterName
(
"Material1"
,
false
);
70
fAbsMaterCmd
->
AvailableForStates
(
G4State_PreInit
,
G4State_Idle
);
71
72
fWorldMaterCmd
=
new
G4UIcmdWithAString
(
"/testem/target2Material"
,
this
);
73
fWorldMaterCmd
->
SetGuidance
(
"Select Material of the target2."
);
74
fWorldMaterCmd
->
SetParameterName
(
"Material2"
,
false
);
75
fWorldMaterCmd
->
AvailableForStates
(
G4State_PreInit
,
G4State_Idle
);
76
77
fAbsThickCmd
=
new
G4UIcmdWithADoubleAndUnit
(
"/testem/mylarZ"
,
this
);
78
fAbsThickCmd
->
SetGuidance
(
"Set mylarZ"
);
79
fAbsThickCmd
->
SetParameterName
(
"mylarZ"
,
false
);
80
fAbsThickCmd
->
SetUnitCategory
(
"Length"
);
81
fAbsThickCmd
->
AvailableForStates
(
G4State_PreInit
);
82
83
fAbsGapCmd
=
new
G4UIcmdWithADoubleAndUnit
(
"/testem/delta"
,
this
);
84
fAbsGapCmd
->
SetGuidance
(
"Set gap between absorbers"
);
85
fAbsGapCmd
->
SetParameterName
(
"delta"
,
false
);
86
fAbsGapCmd
->
SetUnitCategory
(
"Length"
);
87
fAbsGapCmd
->
AvailableForStates
(
G4State_PreInit
);
88
89
fAbsSizYZCmd
=
new
G4UIcmdWithADoubleAndUnit
(
"/testem/target1Z"
,
this
);
90
fAbsSizYZCmd
->
SetGuidance
(
"Set targeet1Z"
);
91
fAbsSizYZCmd
->
SetParameterName
(
"target1Z"
,
false
);
92
fAbsSizYZCmd
->
SetUnitCategory
(
"Length"
);
93
fAbsSizYZCmd
->
AvailableForStates
(
G4State_PreInit
);
94
95
fWorldXCmd
=
new
G4UIcmdWithADoubleAndUnit
(
"/testem/target2Z"
,
this
);
96
fWorldXCmd
->
SetGuidance
(
"Set target2Z"
);
97
fWorldXCmd
->
SetParameterName
(
"target2Z"
,
false
);
98
fWorldXCmd
->
SetUnitCategory
(
"Length"
);
99
fWorldXCmd
->
AvailableForStates
(
G4State_PreInit
);
100
101
fXMagFieldCmd
=
new
G4UIcmdWithADoubleAndUnit
(
"/testem/checkShiftZ"
,
this
);
102
fXMagFieldCmd
->
SetGuidance
(
"Define checkShftZ"
);
103
fXMagFieldCmd
->
SetParameterName
(
"CheckSZ"
,
false
);
104
fXMagFieldCmd
->
SetUnitCategory
(
"Length"
);
105
fXMagFieldCmd
->
AvailableForStates
(
G4State_PreInit
);
106
107
fYMagFieldCmd
=
new
G4UIcmdWithADoubleAndUnit
(
"/testem/sdZ"
,
this
);
108
fYMagFieldCmd
->
SetGuidance
(
"Define sensitive detector Z"
);
109
fYMagFieldCmd
->
SetParameterName
(
"sdZ"
,
false
);
110
fYMagFieldCmd
->
SetUnitCategory
(
"Length"
);
111
fYMagFieldCmd
->
AvailableForStates
(
G4State_PreInit
);
112
113
fZMagFieldCmd
=
new
G4UIcmdWithADoubleAndUnit
(
"/testem/sdShiftZ"
,
this
);
114
fZMagFieldCmd
->
SetGuidance
(
"Define shift of sensitive detector"
);
115
fZMagFieldCmd
->
SetParameterName
(
"sdShiftZ"
,
false
);
116
fZMagFieldCmd
->
SetUnitCategory
(
"Length"
);
117
fZMagFieldCmd
->
AvailableForStates
(
G4State_PreInit
);
118
119
fNumOfAbsCmd
=
new
G4UIcmdWithAnInteger
(
"/testem/numberDivR"
,
this
);
120
fNumOfAbsCmd
->
SetGuidance
(
"Set number divisions R"
);
121
fNumOfAbsCmd
->
SetParameterName
(
"NR"
,
false
);
122
fNumOfAbsCmd
->
AvailableForStates
(
G4State_PreInit
);
123
124
fNumOfEvt
=
new
G4UIcmdWithAnInteger
(
"/testem/numberDivZ"
,
this
);
125
fNumOfEvt
->
SetGuidance
(
"Set number of divisions Z"
);
126
fNumOfEvt
->
SetParameterName
(
"NZ"
,
false
);
127
fNumOfEvt
->
AvailableForStates
(
G4State_PreInit
);
128
129
fVerbCmd
=
new
G4UIcmdWithAnInteger
(
"/testem/verbose"
,
this
);
130
fVerbCmd
->
SetGuidance
(
"Set verbose for "
);
131
fVerbCmd
->
SetParameterName
(
"verb"
,
false
);
132
fVerbCmd
->
AvailableForStates
(
G4State_PreInit
,
G4State_Idle
);
133
134
fIntCmd
=
new
G4UIcmdWithAnInteger
(
"/testem/numberDivE"
,
this
);
135
fIntCmd
->
SetGuidance
(
"Set number of divisions E"
);
136
fIntCmd
->
SetParameterName
(
"NZ"
,
false
);
137
fIntCmd
->
AvailableForStates
(
G4State_PreInit
);
138
139
fDeltaECmd
=
new
G4UIcmdWithADoubleAndUnit
(
"/testem/maxEnergy"
,
this
);
140
fDeltaECmd
->
SetGuidance
(
"Define scale of secondary energy histogram"
);
141
fDeltaECmd
->
SetParameterName
(
"DeltaE"
,
false
);
142
fDeltaECmd
->
SetUnitCategory
(
"Energy"
);
143
fDeltaECmd
->
AvailableForStates
(
G4State_PreInit
,
G4State_Idle
);
144
145
}
146
147
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
148
149
DetectorMessenger::~DetectorMessenger
()
150
{
151
delete
fDetDir
;
152
delete
fDetDir1
;
153
delete
fDetDir2
;
154
155
delete
fAbsMaterCmd
;
156
delete
fAbsThickCmd
;
157
delete
fAbsGapCmd
;
158
delete
fAbsSizYZCmd
;
159
delete
fWorldMaterCmd
;
160
delete
fWorldXCmd
;
161
delete
fXMagFieldCmd
;
162
delete
fYMagFieldCmd
;
163
delete
fZMagFieldCmd
;
164
delete
fNumOfAbsCmd
;
165
delete
fNumOfEvt
;
166
delete
fVerbCmd
;
167
delete
fIntCmd
;
168
delete
fDeltaECmd
;
169
170
}
171
172
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
173
174
void
DetectorMessenger::SetNewValue
(
G4UIcommand
* command,
G4String
newValue)
175
{
176
177
if
( command ==
fAbsMaterCmd
)
178
{
fDetector
->
SetTarget1Material
(newValue);}
179
180
if
( command ==
fWorldMaterCmd
)
181
{
fDetector
->
SetTarget2Material
(newValue);}
182
183
if
( command ==
fAbsThickCmd
)
184
{
fDetector
->
SetMylarZ
(
fAbsThickCmd
->
GetNewDoubleValue
(newValue));}
185
186
if
( command ==
fAbsGapCmd
)
187
{
fDetector
->
SetGap
(
fAbsGapCmd
->
GetNewDoubleValue
(newValue));}
188
189
if
( command ==
fAbsSizYZCmd
)
190
{
fDetector
->
SetTarget1Z
(
fAbsSizYZCmd
->
GetNewDoubleValue
(newValue));}
191
192
if
( command ==
fWorldXCmd
)
193
{
fDetector
->
SetTarget2Z
(
fWorldXCmd
->
GetNewDoubleValue
(newValue));}
194
195
if
( command ==
fXMagFieldCmd
)
196
{
fDetector
->
SetCheckShiftZ
(
fXMagFieldCmd
->
GetNewDoubleValue
(newValue));}
197
198
if
( command ==
fYMagFieldCmd
)
199
{
G4double
x
=
fYMagFieldCmd
->
GetNewDoubleValue
(newValue);
200
fDetector
->
SetAbsorberZ
(x);
201
}
202
203
if
( command ==
fZMagFieldCmd
)
204
{
fDetector
->
SetAbsorberShiftZ
(
fZMagFieldCmd
->
GetNewDoubleValue
(newValue));}
205
206
if
( command ==
fNumOfAbsCmd
)
207
{
208
fDetector
->
SetNumberDivR
(
fNumOfAbsCmd
->
GetNewIntValue
(newValue));
209
}
210
211
if
( command ==
fNumOfEvt
)
212
{
fDetector
->
SetNumberDivZ
(
fNumOfEvt
->
GetNewIntValue
(newValue));}
213
214
if
( command ==
fIntCmd
)
215
{
fDetector
->
SetNumberDivE
(
fIntCmd
->
GetNewIntValue
(newValue));}
216
if
( command ==
fDeltaECmd
)
217
{
fDetector
->
SetMaxEnergy
(
fDeltaECmd
->
GetNewDoubleValue
(newValue));}
218
219
if
( command ==
fVerbCmd
){
220
G4int
ver =
fVerbCmd
->
GetNewIntValue
(newValue);
221
fDetector
->
SetVerbose
(ver);
222
}
223
224
}
225
226
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
geant4
tree
geant4-10.6-release
examples
extended
medical
GammaTherapy
src
DetectorMessenger.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:24:50
using
1.8.2 with
ECCE GitHub integration