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
//
31
//
32
// DetectorMessenger
33
//
34
// Created: 31.01.03 V.Ivanchenko
35
//
36
// Modified:
37
// 04.06.2006 Adoptation of Hadr01 (V.Ivanchenko)
38
// 16.11.2006 Add beamCmd (V.Ivanchenko)
39
//
41
//
42
43
#include "DetectorMessenger.hh"
44
45
#include "DetectorConstruction.hh"
46
#include "
G4UIdirectory.hh
"
47
#include "
G4UIcmdWithABool.hh
"
48
#include "
G4UIcmdWithAString.hh
"
49
#include "
G4UIcmdWithAnInteger.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
fTestDir(0),
60
fMatCmd(0),
61
fMat1Cmd(0),
62
fRCmd(0),
63
fLCmd(0),
64
fEdepCmd(0),
65
fBinCmd(0),
66
fNOfAbsCmd(0),
67
fVerbCmd(0),
68
fBeamCmd(0)
69
{
70
fTestDir
=
new
G4UIdirectory
(
"/testhadr/"
);
71
fTestDir
->
SetGuidance
(
" Hadronic Extended Example."
);
72
73
fMatCmd
=
new
G4UIcmdWithAString
(
"/testhadr/TargetMat"
,
this
);
74
fMatCmd
->
SetGuidance
(
"Select Material for the target"
);
75
fMatCmd
->
SetParameterName
(
"tMaterial"
,
false
);
76
fMatCmd
->
AvailableForStates
(
G4State_PreInit
,
G4State_Idle
);
77
78
fMat1Cmd
=
new
G4UIcmdWithAString
(
"/testhadr/WorldMat"
,
this
);
79
fMat1Cmd
->
SetGuidance
(
"Select Material for world"
);
80
fMat1Cmd
->
SetParameterName
(
"wMaterial"
,
false
);
81
fMat1Cmd
->
AvailableForStates
(
G4State_PreInit
,
G4State_Idle
);
82
83
fRCmd
=
new
G4UIcmdWithADoubleAndUnit
(
"/testhadr/TargetRadius"
,
this
);
84
fRCmd
->
SetGuidance
(
"Set radius of the target"
);
85
fRCmd
->
SetParameterName
(
"radius"
,
false
);
86
fRCmd
->
SetUnitCategory
(
"Length"
);
87
fRCmd
->
SetRange
(
"radius>0"
);
88
fRCmd
->
AvailableForStates
(
G4State_PreInit
,
G4State_Idle
);
89
90
fLCmd
=
new
G4UIcmdWithADoubleAndUnit
(
"/testhadr/TargetLength"
,
this
);
91
fLCmd
->
SetGuidance
(
"Set length of the target"
);
92
fLCmd
->
SetParameterName
(
"length"
,
false
);
93
fLCmd
->
SetUnitCategory
(
"Length"
);
94
fLCmd
->
SetRange
(
"length>0"
);
95
fLCmd
->
AvailableForStates
(
G4State_PreInit
);
96
97
fBinCmd
=
new
G4UIcmdWithAnInteger
(
"/testhadr/NumberOfBinsE"
,
this
);
98
fBinCmd
->
SetGuidance
(
"Set number of bins for Energy"
);
99
fBinCmd
->
SetParameterName
(
"NEbins"
,
false
);
100
fBinCmd
->
AvailableForStates
(
G4State_PreInit
);
101
102
fNOfAbsCmd
=
new
G4UIcmdWithAnInteger
(
"/testhadr/NumberDivZ"
,
this
);
103
fNOfAbsCmd
->
SetGuidance
(
"Set number of slices"
);
104
fNOfAbsCmd
->
SetParameterName
(
"NZ"
,
false
);
105
fNOfAbsCmd
->
AvailableForStates
(
G4State_PreInit
);
106
107
fEdepCmd
=
new
G4UIcmdWithADoubleAndUnit
(
"/testhadr/MaxEdep"
,
this
);
108
fEdepCmd
->
SetGuidance
(
"Set max energy in histogram"
);
109
fEdepCmd
->
SetParameterName
(
"edep"
,
false
);
110
fEdepCmd
->
SetUnitCategory
(
"Energy"
);
111
fEdepCmd
->
SetRange
(
"edep>0"
);
112
fEdepCmd
->
AvailableForStates
(
G4State_PreInit
,
G4State_Idle
);
113
114
fBeamCmd
=
new
G4UIcmdWithABool
(
"/testhadr/DefaultBeamPosition"
,
this
);
115
fBeamCmd
->
SetGuidance
(
"Use default beam position"
);
116
fBeamCmd
->
AvailableForStates
(
G4State_PreInit
,
G4State_Idle
);
117
118
fVerbCmd
=
new
G4UIcmdWithAnInteger
(
"/testhadr/Verbose"
,
this
);
119
fVerbCmd
->
SetGuidance
(
"Set verbose for "
);
120
fVerbCmd
->
SetParameterName
(
"verb"
,
false
);
121
fVerbCmd
->
AvailableForStates
(
G4State_PreInit
,
G4State_Idle
);
122
}
123
124
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
125
126
DetectorMessenger::~DetectorMessenger
()
127
{
128
delete
fMatCmd
;
129
delete
fMat1Cmd
;
130
delete
fRCmd
;
131
delete
fLCmd
;
132
delete
fBinCmd
;
133
delete
fNOfAbsCmd
;
134
delete
fTestDir
;
135
delete
fBeamCmd
;
136
delete
fVerbCmd
;
137
delete
fEdepCmd
;
138
}
139
140
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
141
142
void
DetectorMessenger::SetNewValue
(
G4UIcommand
* command,
G4String
newValue)
143
{
144
HistoManager
*
h
=
HistoManager::GetPointer
();
145
if
( command ==
fMatCmd
) {
146
fDetector
->
SetTargetMaterial
(newValue);
147
}
else
if
( command ==
fMat1Cmd
) {
148
fDetector
->
SetWorldMaterial
(newValue);
149
}
else
if
( command ==
fRCmd
) {
150
fDetector
->
SetTargetRadius
(
fRCmd
->
GetNewDoubleValue
(newValue));
151
}
else
if
( command ==
fLCmd
) {
152
h->
SetTargetLength
(
fLCmd
->
GetNewDoubleValue
(newValue));
153
}
else
if
( command ==
fNOfAbsCmd
) {
154
h->
SetNumberOfSlices
(
fNOfAbsCmd
->
GetNewIntValue
(newValue));
155
}
else
if
( command ==
fBinCmd
) {
156
h->
SetNumberOfBinsE
(
fBinCmd
->
GetNewIntValue
(newValue));
157
}
else
if
( command ==
fVerbCmd
) {
158
h->
SetVerbose
(
fVerbCmd
->
GetNewIntValue
(newValue));
159
}
else
if
(command ==
fBeamCmd
) {
160
h->
SetDefaultBeamPositionFlag
(
fBeamCmd
->
GetNewBoolValue
(newValue));
161
}
else
if
(command ==
fEdepCmd
) {
162
h->
SetMaxEnergyDeposit
(
fEdepCmd
->
GetNewDoubleValue
(newValue));
163
}
164
}
165
166
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
167
geant4
tree
geant4-10.6-release
examples
extended
hadronic
Hadr01
src
DetectorMessenger.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:24:50
using
1.8.2 with
ECCE GitHub integration