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 "
G4UIcmdWithADoubleAndUnit.hh
"
39
40
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
41
42
DetectorMessenger::DetectorMessenger
(
DetectorConstruction
* Det)
43
:
G4UImessenger
(),
44
fDetector(Det), fRdecayDir(0), fDetDir(0),
45
fTargMatCmd(0), fDetectMatCmd(0), fTargRadiusCmd(0),
46
fDetectThicknessCmd(0), fTargLengthCmd(0), fDetectLengthCmd(0)
47
{
48
fRdecayDir
=
new
G4UIdirectory
(
"/rdecay02/"
);
49
fRdecayDir
->
SetGuidance
(
"commands specific to this example"
);
50
51
G4bool
broadcast =
false
;
52
fDetDir
=
new
G4UIdirectory
(
"/rdecay02/det/"
,broadcast);
53
fDetDir
->
SetGuidance
(
"detector construction commands"
);
54
55
fTargMatCmd
=
new
G4UIcmdWithAString
(
"/rdecay02/det/setTargetMate"
,
this
);
56
fTargMatCmd
->
SetGuidance
(
"Select material of the target"
);
57
fTargMatCmd
->
SetParameterName
(
"choice"
,
false
);
58
fTargMatCmd
->
AvailableForStates
(
G4State_PreInit
,
G4State_Idle
);
59
60
fTargRadiusCmd
=
61
new
G4UIcmdWithADoubleAndUnit
(
"/rdecay02/det/setTargetRadius"
,
this
);
62
fTargRadiusCmd
->
SetGuidance
(
"Set the Target Radius."
);
63
fTargRadiusCmd
->
SetUnitCategory
(
"Length"
);
64
fTargRadiusCmd
->
SetParameterName
(
"choice"
,
false
);
65
fTargRadiusCmd
->
AvailableForStates
(
G4State_PreInit
);
66
67
68
fTargLengthCmd
=
69
new
G4UIcmdWithADoubleAndUnit
(
"/rdecay02/det/setTargetLength"
,
this
);
70
fTargLengthCmd
->
SetGuidance
(
"Set the Target Length."
);
71
fTargLengthCmd
->
SetUnitCategory
(
"Length"
);
72
fTargLengthCmd
->
SetParameterName
(
"choice"
,
false
);
73
fTargLengthCmd
->
AvailableForStates
(
G4State_PreInit
);
74
75
76
fDetectMatCmd
=
new
G4UIcmdWithAString
(
"/rdecay02/det/setDetectorMate"
,
this
);
77
fDetectMatCmd
->
SetGuidance
(
"Select Material of the Detector."
);
78
fDetectMatCmd
->
SetParameterName
(
"choice"
,
false
);
79
fDetectMatCmd
->
AvailableForStates
(
G4State_PreInit
,
G4State_Idle
);
80
81
fDetectThicknessCmd
=
82
new
G4UIcmdWithADoubleAndUnit
(
"/rdecay02/det/setDetectorThickness"
,
this
);
83
fDetectThicknessCmd
->
SetGuidance
(
"Set the Detector Thickness."
);
84
fDetectThicknessCmd
->
SetUnitCategory
(
"Length"
);
85
fDetectThicknessCmd
->
SetParameterName
(
"choice"
,
false
);
86
fDetectThicknessCmd
->
AvailableForStates
(
G4State_PreInit
);
87
88
fDetectLengthCmd
=
89
new
G4UIcmdWithADoubleAndUnit
(
"/rdecay02/det/setDetectorLength"
,
this
);
90
fDetectLengthCmd
->
SetGuidance
(
"Set the Detector Length."
);
91
fDetectLengthCmd
->
SetUnitCategory
(
"Length"
);
92
fDetectLengthCmd
->
SetParameterName
(
"choice"
,
false
);
93
fDetectLengthCmd
->
AvailableForStates
(
G4State_PreInit
);
94
}
95
96
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
97
98
DetectorMessenger::~DetectorMessenger
()
99
{
100
delete
fTargMatCmd
;
101
delete
fDetectMatCmd
;
102
delete
fTargRadiusCmd
;
103
delete
fDetectThicknessCmd
;
104
delete
fTargLengthCmd
;
105
delete
fDetectLengthCmd
;
106
delete
fDetDir
;
107
delete
fRdecayDir
;
108
}
109
110
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
111
112
void
DetectorMessenger::SetNewValue
(
G4UIcommand
* command,
G4String
newValue)
113
{
114
if
(command ==
fTargMatCmd
)
115
{
fDetector
->
SetTargetMaterial
(newValue);}
116
117
if
(command ==
fTargLengthCmd
)
118
{
fDetector
->
SetTargetLength
(
fTargLengthCmd
->
GetNewDoubleValue
(newValue));}
119
120
if
(command ==
fTargRadiusCmd
)
121
{
fDetector
->
SetTargetRadius
(
fTargLengthCmd
->
GetNewDoubleValue
(newValue));}
122
123
if
(command ==
fDetectMatCmd
)
124
{
fDetector
->
SetDetectorMaterial
(newValue);}
125
126
if
(command ==
fDetectLengthCmd
)
127
{
fDetector
->
SetDetectorLength
(
128
fDetectLengthCmd
->
GetNewDoubleValue
(newValue));}
129
130
if
(command ==
fDetectThicknessCmd
)
131
{
fDetector
->
SetDetectorThickness
(
132
fDetectThicknessCmd
->
GetNewDoubleValue
(newValue));}
133
}
134
135
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
geant4
tree
geant4-10.6-release
examples
extended
radioactivedecay
rdecay02
src
DetectorMessenger.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:24:50
using
1.8.2 with
ECCE GitHub integration