Geant4-11
G4HepRepMessenger.cc
Go to the documentation of this file.
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#include "G4HepRepMessenger.hh"
28
30
32{
33 if(!fpInstance)
35 return fpInstance;
36}
37
39 : fileDir("")
40 , fileName("G4Data")
41 , overwrite(false)
42 , cullInvisibles(false)
43 , cylAsPolygons(false)
44 , scale(1.)
45 , suffix("")
46 , geometry(true)
47 , pointAttributes(false)
48 , solids(true)
49 , invisibles(true)
50{
51 heprepDirectory = new G4UIdirectory("/vis/heprep/");
52 heprepDirectory->SetGuidance("HepRep commands.");
53
54 setFileDirCommand = new G4UIcmdWithAString("/vis/heprep/setFileDir", this);
55 setFileDirCommand->SetGuidance("Set directory for output.");
57 "This command is used by HepRepFile, not by HepRepXML.");
58 setFileDirCommand->SetParameterName("directory", false);
59 if(std::getenv("G4HEPREPFILE_DIR") == NULL)
60 {
62 }
63 else
64 {
65 setFileDirCommand->SetDefaultValue(std::getenv("G4HEPREPFILE_DIR"));
66 fileDir = std::getenv("G4HEPREPFILE_DIR");
67 }
69
70 setFileNameCommand = new G4UIcmdWithAString("/vis/heprep/setFileName", this);
71 setFileNameCommand->SetGuidance("Set file name for output.");
73 "This command is used by HepRepFile, not by HepRepXML.");
74 setFileNameCommand->SetParameterName("directory", false);
75 if(std::getenv("G4HEPREPFILE_NAME") == NULL)
76 {
78 }
79 else
80 {
81 setFileNameCommand->SetDefaultValue(std::getenv("G4HEPREPFILE_NAME"));
82 fileName = std::getenv("G4HEPREPFILE_NAME");
83 }
85
86 setOverwriteCommand = new G4UIcmdWithABool("/vis/heprep/setOverwrite", this);
88 "Set true to write all output to exact same file name.");
90 "Set false to increment the file name for each new output.");
92 "This command is used by HepRepFile, not by HepRepXML.");
94 if(std::getenv("G4HEPREPFILE_OVERWRITE") == NULL)
95 {
97 }
98 else
99 {
100 setOverwriteCommand->SetDefaultValue(std::getenv("G4HEPREPFILE_OVERWRITE"));
101 overwrite =
102 setOverwriteCommand->ConvertToBool(std::getenv("G4HEPREPFILE_OVERWRITE"));
103 }
105
107 new G4UIcmdWithABool("/vis/heprep/setCullInvisibles", this);
109 "Remove invisible objects from output file.");
111 "This command is used by HepRepFile, not by HepRepXML.");
113 if(std::getenv("G4HEPREPFILE_CULL") == NULL)
114 {
116 }
117 else
118 {
119 setCullInvisiblesCommand->SetDefaultValue(std::getenv("G4HEPREPFILE_CULL"));
121 setCullInvisiblesCommand->ConvertToBool(std::getenv("G4HEPREPFILE_CULL"));
122 }
124
126 new G4UIcmdWithABool("/vis/heprep/renderCylAsPolygons", this);
128 "Render cylinders and cones as polygons.");
130 "This command is used by HepRepFile, not by HepRepXML.");
134
135 setScaleCommand = new G4UIcmdWithADouble("/vis/heprep/scale", this);
136 setScaleCommand->SetGuidance("Re-Scale coordinates.");
137 setScaleCommand->SetParameterName("Scale", true);
139 setScaleCommand->SetRange("Scale > 0");
140
141 setCenterCommand = new G4UIcmdWith3VectorAndUnit("/vis/heprep/center", this);
142 setCenterCommand->SetGuidance("Re-Center coordinates.");
143 setCenterCommand->SetParameterName("CenterX", "CenterY", "CenterZ", true);
146
148 new G4UIcmdWithAString("/vis/heprep/setEventNumberSuffix", this);
150 "Write separate event files, appended with given suffix.");
152 "Define the suffix with a pattern such as '-0000'.");
154 "This command is used by HepRepXML, not by HepRepFile.");
158
160 new G4UIcmdWithABool("/vis/heprep/appendGeometry", this);
162 "Appends copy of geometry to every event.");
164 "This command is used by HepRepXML, not by HepRepFile.");
168
170 new G4UIcmdWithABool("/vis/heprep/addPointAttributes", this);
172 "Adds point attributes to the points of trajectories.");
174 "This command is used by HepRepXML, not by HepRepFile.");
178
179 useSolidsCommand = new G4UIcmdWithABool("/vis/heprep/useSolids", this);
181 "Use HepRep Solids, rather than Geant4 Primitives.");
183 "This command is used by HepRepXML, not by HepRepFile..");
184 useSolidsCommand->SetParameterName("flag", false);
187}
188
190{
191 delete setFileDirCommand;
192 delete setFileNameCommand;
193 delete setOverwriteCommand;
196 delete setScaleCommand;
197 delete setCenterCommand;
201 delete useSolidsCommand;
202 delete heprepDirectory;
203}
204
206{
207 if(command == setFileDirCommand)
208 {
209 return fileDir;
210 }
211 else if(command == setFileNameCommand)
212 {
213 return fileName;
214 }
215 else if(command == setOverwriteCommand)
216 {
218 }
219 else if(command == setCullInvisiblesCommand)
220 {
222 }
223 else if(command == renderCylAsPolygonsCommand)
224 {
226 }
227 else if(command == setScaleCommand)
228 {
230 }
231 else if(command == setCenterCommand)
232 {
234 }
235 else if(command == setEventNumberSuffixCommand)
236 {
237 return suffix;
238 }
239 else if(command == appendGeometryCommand)
240 {
242 }
243 else if(command == addPointAttributesCommand)
244 {
246 }
247 else if(command == useSolidsCommand)
248 {
250 }
251 else
252 {
253 return "";
254 }
255}
256
258{
259 if(command == setFileDirCommand)
260 {
261 fileDir = newValue;
262 }
263 else if(command == setFileNameCommand)
264 {
265 fileName = newValue;
266 }
267 else if(command == setOverwriteCommand)
268 {
270 }
271 else if(command == setCullInvisiblesCommand)
272 {
274 }
275 else if(command == renderCylAsPolygonsCommand)
276 {
278 }
279 else if(command == setScaleCommand)
280 {
282 }
283 else if(command == setCenterCommand)
284 {
286 }
287 else if(command == setEventNumberSuffixCommand)
288 {
289 suffix = newValue;
290 }
291 else if(command == appendGeometryCommand)
292 {
294 }
295 else if(command == addPointAttributesCommand)
296 {
298 }
299 else if(command == useSolidsCommand)
300 {
302 }
303}
304
306
308
310
312
314
316
318
320
322
324
326
@ G4State_Idle
CLHEP::Hep3Vector G4ThreeVector
double G4double
Definition: G4Types.hh:83
bool G4bool
Definition: G4Types.hh:86
virtual G4String GetCurrentValue(G4UIcommand *command)
virtual G4bool renderCylAsPolygons()
virtual void SetNewValue(G4UIcommand *command, G4String newValue)
G4UIcmdWithABool * renderCylAsPolygonsCommand
virtual G4String getFileName()
virtual G4bool addPointAttributes()
G4UIcmdWithABool * appendGeometryCommand
G4UIdirectory * heprepDirectory
virtual G4bool writeInvisibles()
G4UIcmdWithABool * useSolidsCommand
G4UIcmdWith3VectorAndUnit * setCenterCommand
virtual G4double getScale()
virtual G4bool useSolids()
G4UIcmdWithAString * setFileNameCommand
G4ThreeVector center
virtual G4String getEventNumberSuffix()
static G4HepRepMessenger * fpInstance
G4UIcmdWithAString * setEventNumberSuffixCommand
G4UIcmdWithADouble * setScaleCommand
virtual G4String getFileDir()
virtual G4bool getCullInvisibles()
virtual G4bool appendGeometry()
G4UIcmdWithAString * setFileDirCommand
virtual G4bool getOverwrite()
static G4HepRepMessenger * GetInstance()
G4UIcmdWithABool * setCullInvisiblesCommand
G4UIcmdWithABool * addPointAttributesCommand
virtual G4ThreeVector getCenter()
G4UIcmdWithABool * setOverwriteCommand
void SetDefaultUnit(const char *defUnit)
static G4ThreeVector GetNew3VectorValue(const char *paramString)
void SetParameterName(const char *theNameX, const char *theNameY, const char *theNameZ, G4bool omittable, G4bool currentAsDefault=false)
void SetDefaultValue(G4ThreeVector defVal)
static G4bool GetNewBoolValue(const char *paramString)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetDefaultValue(G4bool defVal)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
static G4double GetNewDoubleValue(const char *paramString)
void SetDefaultValue(G4double defVal)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetDefaultValue(const char *defVal)
static G4String ConvertToString(G4bool boolVal)
Definition: G4UIcommand.cc:445
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:156
static G4bool ConvertToBool(const char *st)
Definition: G4UIcommand.cc:545
void SetRange(const char *rs)
Definition: G4UIcommand.hh:120
void AvailableForStates(G4ApplicationState s1)
Definition: G4UIcommand.cc:288