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
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
31
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
32
33
#include "DetectorMessenger.hh"
34
35
#include "DetectorConstruction.hh"
36
#include "
G4UIdirectory.hh
"
37
#include "
G4UIcmdWithAString.hh
"
38
#include "
G4UIcmdWithAnInteger.hh
"
39
#include "
G4UIcmdWithADoubleAndUnit.hh
"
40
#include "
G4UIcmdWithoutParameter.hh
"
41
42
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
43
44
DetectorMessenger::DetectorMessenger
(
DetectorConstruction
* Det)
45
:
G4UImessenger
(),fDetector(Det),
46
fTestemDir(0),
47
fDetDir(0),
48
fAbsMaterCmd(0),
49
fAbsThickCmd(0),
50
fAbsSizYZCmd(0),
51
fAbsXposCmd(0),
52
fWorldMaterCmd(0),
53
fWorldXCmd(0),
54
fWorldYZCmd(0)
55
{
56
fTestemDir
=
new
G4UIdirectory
(
"/testem/"
);
57
fTestemDir
->
SetGuidance
(
"UI commands specific to this example."
);
58
59
fDetDir
=
new
G4UIdirectory
(
"/testem/det/"
);
60
fDetDir
->
SetGuidance
(
"detector construction commands"
);
61
62
fAbsMaterCmd
=
new
G4UIcmdWithAString
(
"/testem/det/setAbsMat"
,
this
);
63
fAbsMaterCmd
->
SetGuidance
(
"Select Material of the Absorber."
);
64
fAbsMaterCmd
->
SetParameterName
(
"choice"
,
false
);
65
fAbsMaterCmd
->
AvailableForStates
(
G4State_PreInit
,
G4State_Idle
);
66
fAbsMaterCmd
->
SetToBeBroadcasted
(
false
);
67
68
fWorldMaterCmd
=
new
G4UIcmdWithAString
(
"/testem/det/setWorldMat"
,
this
);
69
fWorldMaterCmd
->
SetGuidance
(
"Select Material of the World."
);
70
fWorldMaterCmd
->
SetParameterName
(
"wchoice"
,
false
);
71
fWorldMaterCmd
->
AvailableForStates
(
G4State_PreInit
,
G4State_Idle
);
72
fWorldMaterCmd
->
SetToBeBroadcasted
(
false
);
73
74
fAbsThickCmd
=
new
G4UIcmdWithADoubleAndUnit
(
"/testem/det/setAbsThick"
,
this
);
75
fAbsThickCmd
->
SetGuidance
(
"Set Thickness of the Absorber"
);
76
fAbsThickCmd
->
SetParameterName
(
"SizeZ"
,
false
);
77
fAbsThickCmd
->
SetRange
(
"SizeZ>0."
);
78
fAbsThickCmd
->
SetUnitCategory
(
"Length"
);
79
fAbsThickCmd
->
AvailableForStates
(
G4State_PreInit
,
G4State_Idle
);
80
fAbsThickCmd
->
SetToBeBroadcasted
(
false
);
81
82
fAbsSizYZCmd
=
new
G4UIcmdWithADoubleAndUnit
(
"/testem/det/setAbsYZ"
,
this
);
83
fAbsSizYZCmd
->
SetGuidance
(
"Set sizeYZ of the Absorber"
);
84
fAbsSizYZCmd
->
SetParameterName
(
"SizeYZ"
,
false
);
85
fAbsSizYZCmd
->
SetRange
(
"SizeYZ>0."
);
86
fAbsSizYZCmd
->
SetUnitCategory
(
"Length"
);
87
fAbsSizYZCmd
->
AvailableForStates
(
G4State_PreInit
,
G4State_Idle
);
88
fAbsSizYZCmd
->
SetToBeBroadcasted
(
false
);
89
90
fAbsXposCmd
=
new
G4UIcmdWithADoubleAndUnit
(
"/testem/det/setAbsXpos"
,
this
);
91
fAbsXposCmd
->
SetGuidance
(
"Set X pos. of the Absorber"
);
92
fAbsXposCmd
->
SetParameterName
(
"Xpos"
,
false
);
93
fAbsXposCmd
->
SetUnitCategory
(
"Length"
);
94
fAbsXposCmd
->
AvailableForStates
(
G4State_PreInit
);
95
fAbsXposCmd
->
SetToBeBroadcasted
(
false
);
96
97
fWorldXCmd
=
new
G4UIcmdWithADoubleAndUnit
(
"/testem/det/setWorldX"
,
this
);
98
fWorldXCmd
->
SetGuidance
(
"Set X size of the World"
);
99
fWorldXCmd
->
SetParameterName
(
"WSizeX"
,
false
);
100
fWorldXCmd
->
SetRange
(
"WSizeX>0."
);
101
fWorldXCmd
->
SetUnitCategory
(
"Length"
);
102
fWorldXCmd
->
AvailableForStates
(
G4State_PreInit
,
G4State_Idle
);
103
fWorldXCmd
->
SetToBeBroadcasted
(
false
);
104
105
fWorldYZCmd
=
new
G4UIcmdWithADoubleAndUnit
(
"/testem/det/setWorldYZ"
,
this
);
106
fWorldYZCmd
->
SetGuidance
(
"Set sizeYZ of the World"
);
107
fWorldYZCmd
->
SetParameterName
(
"WSizeYZ"
,
false
);
108
fWorldYZCmd
->
SetRange
(
"WSizeYZ>0."
);
109
fWorldYZCmd
->
SetUnitCategory
(
"Length"
);
110
fWorldYZCmd
->
AvailableForStates
(
G4State_PreInit
,
G4State_Idle
);
111
fWorldYZCmd
->
SetToBeBroadcasted
(
false
);
112
113
}
114
115
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
116
117
DetectorMessenger::~DetectorMessenger
()
118
{
119
delete
fAbsMaterCmd
;
120
delete
fAbsThickCmd
;
121
delete
fAbsSizYZCmd
;
122
delete
fAbsXposCmd
;
123
delete
fWorldMaterCmd
;
124
delete
fWorldXCmd
;
125
delete
fWorldYZCmd
;
126
delete
fDetDir
;
127
delete
fTestemDir
;
128
}
129
130
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
131
132
void
DetectorMessenger::SetNewValue
(
G4UIcommand
* command,
G4String
newValue)
133
{
134
if
( command ==
fAbsMaterCmd
)
135
{
fDetector
->
SetAbsorberMaterial
(newValue);}
136
137
if
( command ==
fWorldMaterCmd
)
138
{
fDetector
->
SetWorldMaterial
(newValue);}
139
140
if
( command ==
fAbsThickCmd
)
141
{
fDetector
->
SetAbsorberThickness
(
fAbsThickCmd
->
GetNewDoubleValue
(newValue));}
142
143
if
( command ==
fAbsSizYZCmd
)
144
{
fDetector
->
SetAbsorberSizeYZ
(
fAbsSizYZCmd
->
GetNewDoubleValue
(newValue));}
145
146
if
( command ==
fAbsXposCmd
)
147
{
fDetector
->
SetAbsorberXpos
(
fAbsXposCmd
->
GetNewDoubleValue
(newValue));}
148
149
if
( command ==
fWorldXCmd
)
150
{
fDetector
->
SetWorldSizeX
(
fWorldXCmd
->
GetNewDoubleValue
(newValue));}
151
152
if
( command ==
fWorldYZCmd
)
153
{
fDetector
->
SetWorldSizeYZ
(
fWorldYZCmd
->
GetNewDoubleValue
(newValue));}
154
155
}
156
157
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
geant4
tree
geant4-10.6-release
examples
extended
electromagnetic
TestEm5
src
DetectorMessenger.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:24:50
using
1.8.2 with
ECCE GitHub integration