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
//
31
//
32
33
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
34
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
35
36
#include "DetectorMessenger.hh"
37
38
#include "DetectorConstruction.hh"
39
#include "
G4UIdirectory.hh
"
40
#include "
G4UIcmdWithAString.hh
"
41
#include "
G4UIcmdWithAnInteger.hh
"
42
#include "
G4UIcmdWithADoubleAndUnit.hh
"
43
#include "
G4UIcmdWithoutParameter.hh
"
44
45
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
46
47
DetectorMessenger::DetectorMessenger
(
DetectorConstruction
* Det)
48
:
G4UImessenger
(),
49
fDetector(Det),
50
fDetDir(0),
51
fAbsMaterCmd(0),
52
fGapMaterCmd(0),
53
fAbsThickCmd(0),
54
fGapThickCmd(0),
55
fSizeYZCmd(0),
56
fNbLayersCmd(0)
57
{
58
G4bool
broadcast =
false
;
59
fDetDir
=
new
G4UIdirectory
(
"/det/"
,broadcast);
60
fDetDir
->
SetGuidance
(
"Detector control"
);
61
62
fAbsMaterCmd
=
new
G4UIcmdWithAString
(
"/det/setAbsMat"
,
this
);
63
fAbsMaterCmd
->
SetGuidance
(
"Select Material of the Absorber."
);
64
fAbsMaterCmd
->
SetParameterName
(
"choice"
,
false
);
65
fAbsMaterCmd
->
AvailableForStates
(
G4State_PreInit
,
G4State_Idle
);
66
67
fGapMaterCmd
=
new
G4UIcmdWithAString
(
"/det/setGapMat"
,
this
);
68
fGapMaterCmd
->
SetGuidance
(
"Select Material of the Gap."
);
69
fGapMaterCmd
->
SetParameterName
(
"choice"
,
false
);
70
fGapMaterCmd
->
AvailableForStates
(
G4State_PreInit
,
G4State_Idle
);
71
72
fAbsThickCmd
=
new
G4UIcmdWithADoubleAndUnit
(
"/det/setAbsThick"
,
this
);
73
fAbsThickCmd
->
SetGuidance
(
"Set Thickness of the Absorber"
);
74
fAbsThickCmd
->
SetParameterName
(
"Size"
,
false
);
75
fAbsThickCmd
->
SetRange
(
"Size>=0."
);
76
fAbsThickCmd
->
SetUnitCategory
(
"Length"
);
77
fAbsThickCmd
->
AvailableForStates
(
G4State_PreInit
,
G4State_Idle
);
78
79
fGapThickCmd
=
new
G4UIcmdWithADoubleAndUnit
(
"/det/setGapThick"
,
this
);
80
fGapThickCmd
->
SetGuidance
(
"Set Thickness of the Gap"
);
81
fGapThickCmd
->
SetParameterName
(
"Size"
,
false
);
82
fGapThickCmd
->
SetRange
(
"Size>=0."
);
83
fGapThickCmd
->
SetUnitCategory
(
"Length"
);
84
fGapThickCmd
->
AvailableForStates
(
G4State_PreInit
,
G4State_Idle
);
85
86
fSizeYZCmd
=
new
G4UIcmdWithADoubleAndUnit
(
"/det/setSizeYZ"
,
this
);
87
fSizeYZCmd
->
SetGuidance
(
"Set tranverse size of the calorimeter"
);
88
fSizeYZCmd
->
SetParameterName
(
"Size"
,
false
);
89
fSizeYZCmd
->
SetRange
(
"Size>0."
);
90
fSizeYZCmd
->
SetUnitCategory
(
"Length"
);
91
fSizeYZCmd
->
AvailableForStates
(
G4State_PreInit
,
G4State_Idle
);
92
93
fNbLayersCmd
=
new
G4UIcmdWithAnInteger
(
"/det/setNbOfLayers"
,
this
);
94
fNbLayersCmd
->
SetGuidance
(
"Set number of layers."
);
95
fNbLayersCmd
->
SetParameterName
(
"NbLayers"
,
false
);
96
fNbLayersCmd
->
SetRange
(
"NbLayers>0 && NbLayers<500"
);
97
fNbLayersCmd
->
AvailableForStates
(
G4State_PreInit
,
G4State_Idle
);
98
99
}
100
101
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
102
103
DetectorMessenger::~DetectorMessenger
()
104
{
105
delete
fNbLayersCmd
;
106
delete
fAbsMaterCmd
;
delete
fGapMaterCmd
;
107
delete
fAbsThickCmd
;
delete
fGapThickCmd
;
108
delete
fSizeYZCmd
;
109
delete
fDetDir
;
110
}
111
112
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
113
114
void
DetectorMessenger::SetNewValue
(
G4UIcommand
* command,
G4String
newValue)
115
{
116
if
( command ==
fAbsMaterCmd
) {
117
fDetector
->
SetAbsorberMaterial
(newValue);
118
}
119
else
if
( command ==
fGapMaterCmd
) {
120
fDetector
->
SetGapMaterial
(newValue);
121
}
122
else
if
( command ==
fAbsThickCmd
) {
123
fDetector
124
->
SetAbsorberThickness
(
fAbsThickCmd
->
GetNewDoubleValue
(newValue));
125
}
126
else
if
( command ==
fGapThickCmd
) {
127
fDetector
->
SetGapThickness
(
fGapThickCmd
->
GetNewDoubleValue
(newValue));
128
}
129
else
if
( command ==
fSizeYZCmd
) {
130
fDetector
->
SetCalorSizeYZ
(
fSizeYZCmd
->
GetNewDoubleValue
(newValue));
131
}
132
else
if
( command ==
fNbLayersCmd
) {
133
fDetector
->
SetNbOfLayers
(
fNbLayersCmd
->
GetNewIntValue
(newValue));
134
}
135
}
136
137
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
geant4
tree
geant4-10.6-release
examples
extended
analysis
shared
src
DetectorMessenger.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:24:50
using
1.8.2 with
ECCE GitHub integration