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
RE06DetectorMessenger.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file RE06DetectorMessenger.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
//
28
//
29
//
30
31
#include "
RE06DetectorMessenger.hh
"
32
33
#include "
RE06DetectorConstruction.hh
"
34
#include "
G4UIdirectory.hh
"
35
#include "
G4UIcmdWithAString.hh
"
36
#include "
G4UIcmdWithABool.hh
"
37
#include "
G4UIcmdWithAnInteger.hh
"
38
#include "
G4Material.hh
"
39
40
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
41
42
RE06DetectorMessenger::RE06DetectorMessenger
(
RE06DetectorConstruction
* det)
43
:
G4UImessenger
(),
44
fDetector(det),
45
fDirectory(0),
46
fAbsMaterialCmd(0),
47
fGapMaterialCmd(0),
48
fNumLayerCmd(0),
49
fSerialCmd(0),
50
fVerboseCmd(0),
51
fAddMaterialCmd(0)
52
{
53
fDirectory
=
new
G4UIdirectory
(
"/RE06/"
);
54
fDirectory
->
SetGuidance
(
"UI commands of this example"
);
55
56
G4String
matList;
57
const
G4MaterialTable
* matTbl =
G4Material::GetMaterialTable
();
58
for
(
size_t
i=0;i<
G4Material::GetNumberOfMaterials
();i++)
59
{
60
matList += (*matTbl)[i]->GetName();
61
matList +=
" "
;
62
}
63
64
fAbsMaterialCmd
=
new
G4UIcmdWithAString
(
"/RE06/setAbsMat"
,
this
);
65
fAbsMaterialCmd
->
SetGuidance
(
"Select Material of the Absorber."
);
66
fAbsMaterialCmd
->
SetParameterName
(
"choice"
,
false
);
67
fAbsMaterialCmd
->
AvailableForStates
(
G4State_Idle
);
68
fAbsMaterialCmd
->
SetCandidates
(matList);
69
70
fGapMaterialCmd
=
new
G4UIcmdWithAString
(
"/RE06/setGapMat"
,
this
);
71
fGapMaterialCmd
->
SetGuidance
(
"Select Material of the Gap."
);
72
fGapMaterialCmd
->
SetParameterName
(
"choice"
,
false
);
73
fGapMaterialCmd
->
AvailableForStates
(
G4State_Idle
);
74
fGapMaterialCmd
->
SetCandidates
(matList);
75
76
fNumLayerCmd
=
new
G4UIcmdWithAnInteger
(
"/RE06/numberOfLayers"
,
this
);
77
fNumLayerCmd
->
SetGuidance
(
"Set number of layers."
);
78
fNumLayerCmd
->
SetParameterName
(
"nl"
,
false
);
79
fNumLayerCmd
->
AvailableForStates
(
G4State_Idle
);
80
fNumLayerCmd
->
SetRange
(
"nl>0"
);
81
82
fSerialCmd
=
new
G4UIcmdWithABool
(
"/RE06/serialGeometry"
,
this
);
83
fSerialCmd
84
->
SetGuidance
(
"Select calorimeters to be placed in serial or parallel."
);
85
fSerialCmd
->
SetParameterName
(
"serialize"
,
false
);
86
fSerialCmd
->
AvailableForStates
(
G4State_Idle
);
87
88
fVerboseCmd
=
new
G4UIcmdWithAnInteger
(
"/RE06/verbose"
,
this
);
89
fVerboseCmd
->
SetGuidance
(
"Set verbosity level"
);
90
fVerboseCmd
->
SetParameterName
(
"verbose"
,
false
);
91
fVerboseCmd
->
AvailableForStates
(
G4State_Idle
);
92
fVerboseCmd
->
SetRange
(
"verbose>=0"
);
93
94
fAddMaterialCmd
=
new
G4UIcmdWithABool
(
"/RE06/AddMaterial"
,
this
);
95
fAddMaterialCmd
->
SetGuidance
(
"Add materials "
);
96
fAddMaterialCmd
->
SetParameterName
(
"dummy"
,
true
);
97
fAddMaterialCmd
->
AvailableForStates
(
G4State_Idle
);
98
}
99
100
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
101
102
RE06DetectorMessenger::~RE06DetectorMessenger
()
103
{
104
delete
fAbsMaterialCmd
;
105
delete
fGapMaterialCmd
;
106
delete
fNumLayerCmd
;
107
delete
fSerialCmd
;
108
delete
fDirectory
;
109
}
110
111
void
RE06DetectorMessenger::SetNewValue
(
G4UIcommand
* command,
G4String
newValue)
112
{
113
if
( command ==
fAbsMaterialCmd
) {
114
fDetector
->
SetAbsorberMaterial
(newValue);
115
116
}
else
if
( command ==
fGapMaterialCmd
){
117
fDetector
->
SetGapMaterial
(newValue);
118
119
}
else
if
( command ==
fNumLayerCmd
) {
120
fDetector
->
SetNumberOfLayers
(
fNumLayerCmd
->
GetNewIntValue
(newValue));
121
122
}
else
if
( command ==
fSerialCmd
) {
123
fDetector
->
SetSerialGeometry
(
fSerialCmd
->
GetNewBoolValue
(newValue));
124
125
}
else
if
( command ==
fVerboseCmd
) {
126
fDetector
->
SetVerboseLevel
(
fVerboseCmd
->
GetNewIntValue
(newValue));
127
128
}
else
if
( command ==
fAddMaterialCmd
) {
129
fDetector
->
AddMaterial
();
130
UpdateMaterialList
();
131
}
132
}
133
134
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
135
136
G4String
RE06DetectorMessenger::GetCurrentValue
(
G4UIcommand
* command)
137
{
138
G4String
ans;
139
if
( command ==
fAbsMaterialCmd
){
140
ans=
fDetector
->
GetAbsorberMaterial
();
141
142
}
else
if
( command ==
fGapMaterialCmd
){
143
ans=
fDetector
->
GetGapMaterial
();
144
145
}
else
if
( command ==
fNumLayerCmd
) {
146
ans=
fNumLayerCmd
->
ConvertToString
(
fDetector
->
GetNumberOfLayers
());
147
148
}
else
if
( command ==
fSerialCmd
){
149
ans=
fSerialCmd
->
ConvertToString
(
fDetector
->
IsSerial
());
150
151
}
else
if
( command ==
fSerialCmd
) {
152
ans=
fSerialCmd
->
ConvertToString
(
fDetector
->
IsSerial
());
153
154
}
else
if
( command ==
fVerboseCmd
) {
155
ans=
fVerboseCmd
->
ConvertToString
(
fDetector
->
GetVerboseLevel
());
156
157
}
158
return
ans;
159
}
160
161
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
162
163
void
RE06DetectorMessenger::UpdateMaterialList
()
164
{
165
G4String
matList;
166
const
G4MaterialTable
* matTbl =
G4Material::GetMaterialTable
();
167
for
(
size_t
i=0;i<
G4Material::GetNumberOfMaterials
();i++)
168
{
169
matList += (*matTbl)[i]->GetName();
170
matList +=
" "
;
171
}
172
173
if
(
fAbsMaterialCmd
!=0) {
174
fAbsMaterialCmd
->
SetCandidates
(matList);
175
}
176
if
(
fGapMaterialCmd
!=0) {
177
fGapMaterialCmd
->
SetCandidates
(matList);
178
}
179
}
180
181
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
geant4
tree
geant4-10.6-release
examples
extended
runAndEvent
RE06
src
RE06DetectorMessenger.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:25:11
using
1.8.2 with
ECCE GitHub integration