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
//
28
//
29
//
30
//
32
//
33
// TestEm9: Crystal calorimeter
34
//
35
// Created: 31.01.03 V.Ivanchenko
36
//
37
// Modified:
38
//
40
//
41
42
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
43
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
44
45
#include "DetectorMessenger.hh"
46
47
#include "DetectorConstruction.hh"
48
#include "
G4UIdirectory.hh
"
49
#include "
G4UIcmdWithAString.hh
"
50
#include "
G4UIcmdWith3Vector.hh
"
51
#include "
G4UIcmdWithADoubleAndUnit.hh
"
52
#include "
G4UIcmdWithoutParameter.hh
"
53
#include "HistoManager.hh"
54
55
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
56
57
DetectorMessenger::DetectorMessenger
(
DetectorConstruction
* det)
58
:
G4UImessenger
(),fDetector(det),
59
fAtestemDir(0),
60
fAMaterCmd(0),
61
fALBinCmd(0),
62
fAl1Cmd(0),
63
fAl2Cmd(0),
64
fAl3Cmd(0),
65
fAl4Cmd(0),
66
fAl5Cmd(0),
67
fAl6Cmd(0),
68
fAUpdateCmd(0),
69
fAaccCmd1(0),
70
fAaccCmd2(0),
71
fAaccCmd3(0)
72
{
73
fAtestemDir
=
new
G4UIdirectory
(
"/testem/"
);
74
fAtestemDir
->
SetGuidance
(
" detector control."
);
75
76
fAMaterCmd
=
new
G4UIcmdWithAString
(
"/testem/det/CalMat"
,
this
);
77
fAMaterCmd
->
SetGuidance
(
"Select Material for calorimeter"
);
78
fAMaterCmd
->
SetParameterName
(
"calMaterial"
,
false
);
79
fAMaterCmd
->
AvailableForStates
(
G4State_PreInit
,
G4State_Idle
);
80
81
fALBinCmd
=
new
G4UIcmdWithAString
(
"/testem/det/AbsMat"
,
this
);
82
fALBinCmd
->
SetGuidance
(
"Select Material for absorber"
);
83
fALBinCmd
->
SetParameterName
(
"absMarerial"
,
false
);
84
fALBinCmd
->
AvailableForStates
(
G4State_PreInit
,
G4State_Idle
);
85
86
fAl1Cmd
=
new
G4UIcmdWithADoubleAndUnit
(
"/testem/det/EcalLength"
,
this
);
87
fAl1Cmd
->
SetGuidance
(
"Set length of Ecal"
);
88
fAl1Cmd
->
SetParameterName
(
"lEcal"
,
false
);
89
fAl1Cmd
->
SetUnitCategory
(
"Length"
);
90
fAl1Cmd
->
SetRange
(
"lEcal>0"
);
91
fAl1Cmd
->
AvailableForStates
(
G4State_PreInit
,
G4State_Idle
);
92
93
fAl2Cmd
=
new
G4UIcmdWithADoubleAndUnit
(
"/testem/det/EcalWidth"
,
this
);
94
fAl2Cmd
->
SetGuidance
(
"Set width of Ecal crystal"
);
95
fAl2Cmd
->
SetParameterName
(
"wEcal"
,
false
);
96
fAl2Cmd
->
SetUnitCategory
(
"Length"
);
97
fAl2Cmd
->
AvailableForStates
(
G4State_PreInit
,
G4State_Idle
);
98
99
fAl3Cmd
=
new
G4UIcmdWithADoubleAndUnit
(
"/testem/det/AbsLength"
,
this
);
100
fAl3Cmd
->
SetGuidance
(
"Set length of the absorber"
);
101
fAl3Cmd
->
SetParameterName
(
"lAbs"
,
false
);
102
fAl3Cmd
->
SetUnitCategory
(
"Length"
);
103
fAl3Cmd
->
AvailableForStates
(
G4State_PreInit
,
G4State_Idle
);
104
105
fAl4Cmd
=
new
G4UIcmdWithADoubleAndUnit
(
"/testem/det/VertexLength"
,
this
);
106
fAl4Cmd
->
SetGuidance
(
"Set length of the vertex region"
);
107
fAl4Cmd
->
SetParameterName
(
"lVert"
,
false
);
108
fAl4Cmd
->
SetUnitCategory
(
"Length"
);
109
fAl4Cmd
->
AvailableForStates
(
G4State_PreInit
,
G4State_Idle
);
110
111
fAl5Cmd
=
new
G4UIcmdWithADoubleAndUnit
(
"/testem/det/PadLength"
,
this
);
112
fAl5Cmd
->
SetGuidance
(
"Set length of vertex detector"
);
113
fAl5Cmd
->
SetParameterName
(
"lPad"
,
false
);
114
fAl5Cmd
->
SetUnitCategory
(
"Length"
);
115
fAl5Cmd
->
AvailableForStates
(
G4State_PreInit
,
G4State_Idle
);
116
117
fAl6Cmd
=
new
G4UIcmdWithADoubleAndUnit
(
"/testem/det/PadWidth"
,
this
);
118
fAl6Cmd
->
SetGuidance
(
"Set width of a vertex pad"
);
119
fAl6Cmd
->
SetParameterName
(
"wPad"
,
false
);
120
fAl6Cmd
->
SetUnitCategory
(
"Length"
);
121
fAl6Cmd
->
AvailableForStates
(
G4State_PreInit
,
G4State_Idle
);
122
123
fAUpdateCmd
=
new
G4UIcmdWithoutParameter
(
"/testem/det/update"
,
this
);
124
fAUpdateCmd
->
SetGuidance
(
"Update geometry."
);
125
fAUpdateCmd
->
SetGuidance
(
"This command MUST be applied before \"beamOn\" "
);
126
fAUpdateCmd
->
SetGuidance
(
"if you changed geometrical value(s)"
);
127
fAUpdateCmd
->
AvailableForStates
(
G4State_PreInit
,
G4State_Idle
);
128
129
fAaccCmd1
=
new
G4UIcmdWith3Vector
(
"/testem/det/acceptance1"
,
this
);
130
fAaccCmd1
->
SetGuidance
(
"set Edep and RMS"
);
131
fAaccCmd1
->
SetGuidance
(
"acceptance values for central cell"
);
132
fAaccCmd1
->
SetParameterName
(
"edep"
,
"rms"
,
"limit"
,
true
);
133
fAaccCmd1
->
SetRange
(
"edep>0 && edep<1 && rms>0"
);
134
fAaccCmd1
->
AvailableForStates
(
G4State_PreInit
,
G4State_Idle
);
135
136
fAaccCmd2
=
new
G4UIcmdWith3Vector
(
"/testem/det/acceptance9"
,
this
);
137
fAaccCmd2
->
SetGuidance
(
"set Edep and RMS"
);
138
fAaccCmd2
->
SetGuidance
(
"acceptance values for 3x3 matrix"
);
139
fAaccCmd2
->
SetParameterName
(
"edep"
,
"rms"
,
"limit"
,
true
);
140
fAaccCmd2
->
SetRange
(
"edep>0 && edep<1 && rms>0"
);
141
fAaccCmd2
->
AvailableForStates
(
G4State_PreInit
,
G4State_Idle
);
142
143
fAaccCmd3
=
new
G4UIcmdWith3Vector
(
"/testem/det/acceptance25"
,
this
);
144
fAaccCmd3
->
SetGuidance
(
"set Edep and RMS"
);
145
fAaccCmd3
->
SetGuidance
(
"acceptance values for 5x5 matrix"
);
146
fAaccCmd3
->
SetParameterName
(
"edep"
,
"rms"
,
"limit"
,
true
);
147
fAaccCmd3
->
SetRange
(
"edep>0 && edep<1 && rms>0"
);
148
fAaccCmd3
->
AvailableForStates
(
G4State_PreInit
,
G4State_Idle
);
149
150
}
151
152
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
153
154
DetectorMessenger::~DetectorMessenger
()
155
{
156
delete
fAMaterCmd
;
157
delete
fALBinCmd
;
158
delete
fAl1Cmd
;
159
delete
fAl2Cmd
;
160
delete
fAl3Cmd
;
161
delete
fAl4Cmd
;
162
delete
fAl5Cmd
;
163
delete
fAl6Cmd
;
164
delete
fAUpdateCmd
;
165
delete
fAtestemDir
;
166
delete
fAaccCmd1
;
167
delete
fAaccCmd2
;
168
delete
fAaccCmd3
;
169
}
170
171
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
172
173
void
DetectorMessenger::SetNewValue
(
G4UIcommand
* command,
G4String
newValue)
174
{
175
if
( command ==
fAMaterCmd
)
176
{
fDetector
->
SetEcalMaterial
(newValue);}
177
178
if
( command ==
fALBinCmd
)
179
{
fDetector
->
SetAbsMaterial
(newValue);}
180
181
if
( command ==
fAl1Cmd
)
182
{
fDetector
->
SetEcalLength
(
fAl1Cmd
->
GetNewDoubleValue
(newValue));}
183
184
if
( command ==
fAl2Cmd
)
185
{
fDetector
->
SetEcalWidth
(
fAl2Cmd
->
GetNewDoubleValue
(newValue));}
186
187
if
( command ==
fAl3Cmd
)
188
{
fDetector
->
SetAbsLength
(
fAl3Cmd
->
GetNewDoubleValue
(newValue));}
189
190
if
( command ==
fAl4Cmd
)
191
{
fDetector
->
SetVertexLength
(
fAl4Cmd
->
GetNewDoubleValue
(newValue));}
192
193
if
( command ==
fAl5Cmd
)
194
{
fDetector
->
SetPadLength
(
fAl5Cmd
->
GetNewDoubleValue
(newValue));}
195
196
if
( command ==
fAl6Cmd
)
197
{
fDetector
->
SetPadWidth
(
fAl6Cmd
->
GetNewDoubleValue
(newValue));}
198
199
if
( command ==
fAUpdateCmd
)
200
{
fDetector
->
UpdateGeometry
();}
201
202
HistoManager
* histo =
HistoManager::GetPointer
();
203
if
( command ==
fAaccCmd1
)
204
{ histo->
SetEdepAndRMS
(0,
fAaccCmd1
->
GetNew3VectorValue
(newValue));}
205
206
if
( command ==
fAaccCmd2
)
207
{ histo->
SetEdepAndRMS
(1,
fAaccCmd2
->
GetNew3VectorValue
(newValue));}
208
209
if
( command ==
fAaccCmd3
)
210
{ histo->
SetEdepAndRMS
(2,
fAaccCmd3
->
GetNew3VectorValue
(newValue));}
211
212
213
}
214
215
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
216
geant4
tree
geant4-10.6-release
examples
extended
electromagnetic
TestEm9
src
DetectorMessenger.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:24:50
using
1.8.2 with
ECCE GitHub integration