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
G4GDMLMessenger.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file G4GDMLMessenger.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
//
26
//
27
//
28
//
29
// class G4GDMLMessenger Implementation
30
//
31
// -------------------------------------------------------------------------
32
33
#include "
G4GDMLMessenger.hh
"
34
#include "
G4GDMLParser.hh
"
35
36
#include "
globals.hh
"
37
#include "
G4RunManager.hh
"
38
#include "
G4UIdirectory.hh
"
39
#include "
G4UIcmdWithAString.hh
"
40
#include "
G4UIcmdWithABool.hh
"
41
#include "
G4UIcmdWithoutParameter.hh
"
42
#include "
G4GeometryManager.hh
"
43
#include "
G4LogicalVolumeStore.hh
"
44
#include "
G4PhysicalVolumeStore.hh
"
45
#include "
G4SolidStore.hh
"
46
47
G4GDMLMessenger::G4GDMLMessenger
(
G4GDMLParser
* myPars)
48
: myParser(myPars), topvol(0), pFlag(
true
)
49
{
50
persistencyDir
=
new
G4UIdirectory
(
"/persistency/"
);
51
persistencyDir
->
SetGuidance
(
"UI commands specific to persistency."
);
52
53
gdmlDir
=
new
G4UIdirectory
(
"/persistency/gdml/"
);
54
gdmlDir
->
SetGuidance
(
"GDML parser and writer."
);
55
56
ReaderCmd
=
new
G4UIcmdWithAString
(
"/persistency/gdml/read"
,
this
);
57
ReaderCmd
->
SetGuidance
(
"Read GDML file."
);
58
ReaderCmd
->
SetParameterName
(
"filename"
,
false
);
59
ReaderCmd
->
AvailableForStates
(
G4State_PreInit
,
G4State_Idle
);
60
ReaderCmd
->
SetToBeBroadcasted
(
false
);
61
62
TopVolCmd
=
new
G4UIcmdWithAString
(
"/persistency/gdml/topvol"
,
this
);
63
TopVolCmd
->
SetGuidance
(
"Set the top volume for writing the GDML file."
);
64
TopVolCmd
->
SetParameterName
(
"topvol"
,
false
);
65
TopVolCmd
->
SetToBeBroadcasted
(
false
);
66
67
WriterCmd
=
new
G4UIcmdWithAString
(
"/persistency/gdml/write"
,
this
);
68
WriterCmd
->
SetGuidance
(
"Write GDML file."
);
69
WriterCmd
->
SetParameterName
(
"filename"
,
false
);
70
WriterCmd
->
AvailableForStates
(
G4State_Idle
);
71
WriterCmd
->
SetToBeBroadcasted
(
false
);
72
73
StripCmd
=
new
G4UIcmdWithABool
(
"/persistency/gdml/strip_pointers"
,
this
);
74
StripCmd
->
SetGuidance
(
"Enable/disable stripping of pointers on names"
);
75
StripCmd
->
SetGuidance
(
"when reading a GDML file."
);
76
StripCmd
->
SetParameterName
(
"strip_pointers"
,
true
);
77
StripCmd
->
SetDefaultValue
(
true
);
78
StripCmd
->
AvailableForStates
(
G4State_Idle
);
79
StripCmd
->
SetToBeBroadcasted
(
false
);
80
81
AppendCmd
=
new
G4UIcmdWithABool
(
"/persistency/gdml/add_pointers"
,
this
);
82
AppendCmd
->
SetGuidance
(
"Enable/disable appending of pointers to names"
);
83
AppendCmd
->
SetGuidance
(
"when writing a GDML file."
);
84
AppendCmd
->
SetParameterName
(
"append_pointers"
,
true
);
85
AppendCmd
->
SetDefaultValue
(
true
);
86
AppendCmd
->
AvailableForStates
(
G4State_Idle
);
87
AppendCmd
->
SetToBeBroadcasted
(
false
);
88
89
RegionCmd
=
new
G4UIcmdWithABool
(
"/persistency/gdml/export_regions"
,
this
);
90
RegionCmd
->
SetGuidance
(
"Enable export of geometrical regions"
);
91
RegionCmd
->
SetGuidance
(
"for storing production cuts."
);
92
RegionCmd
->
SetParameterName
(
"export_regions"
,
false
);
93
RegionCmd
->
SetDefaultValue
(
false
);
94
RegionCmd
->
AvailableForStates
(
G4State_Idle
);
95
RegionCmd
->
SetToBeBroadcasted
(
false
);
96
97
EcutsCmd
=
new
G4UIcmdWithABool
(
"/persistency/gdml/export_Ecuts"
,
this
);
98
EcutsCmd
->
SetGuidance
(
"Enable export of energy cuts associated"
);
99
EcutsCmd
->
SetGuidance
(
"to logical volumes."
);
100
EcutsCmd
->
SetGuidance
(
"NOTE: may increase considerably the size of the"
);
101
EcutsCmd
->
SetGuidance
(
" GDML file! Information is anyhow not used"
);
102
EcutsCmd
->
SetGuidance
(
" for import."
);
103
EcutsCmd
->
SetParameterName
(
"export_Ecuts"
,
false
);
104
EcutsCmd
->
SetDefaultValue
(
false
);
105
EcutsCmd
->
AvailableForStates
(
G4State_Idle
);
106
EcutsCmd
->
SetToBeBroadcasted
(
false
);
107
108
SDCmd
=
new
G4UIcmdWithABool
(
"/persistency/gdml/export_SD"
,
this
);
109
SDCmd
->
SetGuidance
(
"Enable export of SD associated"
);
110
SDCmd
->
SetGuidance
(
"to logical volumes."
);
111
SDCmd
->
SetParameterName
(
"export_SD"
,
false
);
112
SDCmd
->
SetDefaultValue
(
false
);
113
SDCmd
->
AvailableForStates
(
G4State_Idle
);
114
SDCmd
->
SetToBeBroadcasted
(
false
);
115
116
ClearCmd
=
new
G4UIcmdWithoutParameter
(
"/persistency/gdml/clear"
,
this
);
117
ClearCmd
->
SetGuidance
(
"Clear geometry (before reading a new one from GDML)."
);
118
ClearCmd
->
AvailableForStates
(
G4State_Idle
);
119
ClearCmd
->
SetToBeBroadcasted
(
false
);
120
}
121
122
G4GDMLMessenger::~G4GDMLMessenger
()
123
{
124
delete
ReaderCmd
;
125
delete
WriterCmd
;
126
delete
ClearCmd
;
127
delete
TopVolCmd
;
128
delete
RegionCmd
;
129
delete
EcutsCmd
;
130
delete
SDCmd
;
131
delete
persistencyDir
;
132
delete
gdmlDir
;
133
delete
StripCmd
;
134
delete
AppendCmd
;
135
}
136
137
void
G4GDMLMessenger::SetNewValue
(
G4UIcommand
* command,
G4String
newValue)
138
{
139
if
( command ==
StripCmd
)
140
{
141
G4bool
mode =
StripCmd
->
GetNewBoolValue
(newValue);
142
myParser
->
SetStripFlag
(mode);
143
}
144
145
if
( command ==
AppendCmd
)
146
{
147
pFlag
=
AppendCmd
->
GetNewBoolValue
(newValue);
148
myParser
->
SetAddPointerToName
(
pFlag
);
149
}
150
151
if
( command ==
ReaderCmd
)
152
{
153
G4GeometryManager::GetInstance
()->
OpenGeometry
();
154
myParser
->
Read
(newValue);
155
G4RunManager::GetRunManager
()->
DefineWorldVolume
(
myParser
->
GetWorldVolume
());
156
G4RunManager::GetRunManager
()->
GeometryDirectlyUpdated
();
157
}
158
159
if
( command ==
RegionCmd
)
160
{
161
G4bool
mode =
RegionCmd
->
GetNewBoolValue
(newValue);
162
myParser
->
SetRegionExport
(mode);
163
}
164
165
if
( command ==
EcutsCmd
)
166
{
167
G4bool
mode =
EcutsCmd
->
GetNewBoolValue
(newValue);
168
myParser
->
SetEnergyCutsExport
(mode);
169
}
170
171
if
( command ==
SDCmd
)
172
{
173
G4bool
mode =
SDCmd
->
GetNewBoolValue
(newValue);
174
myParser
->
SetSDExport
(mode);
175
}
176
177
if
( command ==
TopVolCmd
)
178
{
179
topvol
=
G4LogicalVolumeStore::GetInstance
()->
GetVolume
(newValue);
180
}
181
182
if
( command ==
WriterCmd
)
183
{
184
myParser
->
Write
(newValue,
topvol
,
pFlag
);
185
}
186
187
if
( command ==
ClearCmd
)
188
{
189
myParser
->
Clear
();
190
G4RunManager::GetRunManager
()->
ReinitializeGeometry
(
true
);
191
}
192
}
geant4
tree
geant4-10.6-release
source
persistency
gdml
src
G4GDMLMessenger.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:25:25
using
1.8.2 with
ECCE GitHub integration