Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
G4HepRepMessenger.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 // $Id: G4HepRepMessenger.cc 106384 2017-10-09 09:34:51Z gcosmo $
27 //
28 #include "G4HepRepMessenger.hh"
29 
32 
35 {
37  return fpInstance;
38 }
39 
41  fileDir(""),
42  fileName("G4Data"),
43  overwrite(false),
44  cullInvisibles(false),
45  cylAsPolygons(false),
46  scale(1.),
47  suffix (""),
48  geometry(true),
49  pointAttributes(false),
50  solids(true),
51  invisibles(true) {
52 
53  heprepDirectory = new G4UIdirectory("/vis/heprep/");
54  heprepDirectory->SetGuidance("HepRep commands.");
55 
56  setFileDirCommand = new G4UIcmdWithAString("/vis/heprep/setFileDir", this);
57  setFileDirCommand->SetGuidance("Set directory for output.");
58  setFileDirCommand->SetGuidance("This command is used by HepRepFile, not by HepRepXML.");
59  setFileDirCommand->SetParameterName("directory",false);
60  if ( getenv( "G4HEPREPFILE_DIR" ) == NULL ) {
62  } else {
63  setFileDirCommand->SetDefaultValue(getenv("G4HEPREPFILE_DIR"));
64  fileDir = getenv("G4HEPREPFILE_DIR");
65  }
67 
68  setFileNameCommand = new G4UIcmdWithAString("/vis/heprep/setFileName", this);
69  setFileNameCommand->SetGuidance("Set file name for output.");
70  setFileNameCommand->SetGuidance("This command is used by HepRepFile, not by HepRepXML.");
71  setFileNameCommand->SetParameterName("directory",false);
72  if ( getenv( "G4HEPREPFILE_NAME" ) == NULL ) {
74  } else {
75  setFileNameCommand->SetDefaultValue(getenv("G4HEPREPFILE_NAME"));
76  fileName = getenv("G4HEPREPFILE_NAME");
77  }
79 
80  setOverwriteCommand = new G4UIcmdWithABool("/vis/heprep/setOverwrite", this);
81  setOverwriteCommand->SetGuidance("Set true to write all output to exact same file name.");
82  setOverwriteCommand->SetGuidance("Set false to increment the file name for each new output.");
83  setOverwriteCommand->SetGuidance("This command is used by HepRepFile, not by HepRepXML.");
85  if ( getenv( "G4HEPREPFILE_OVERWRITE" ) == NULL ) {
87  } else {
88  setOverwriteCommand->SetDefaultValue(getenv("G4HEPREPFILE_OVERWRITE"));
89  overwrite = setOverwriteCommand->ConvertToBool(getenv("G4HEPREPFILE_OVERWRITE"));
90  }
92 
93  setCullInvisiblesCommand = new G4UIcmdWithABool("/vis/heprep/setCullInvisibles", this);
94  setCullInvisiblesCommand->SetGuidance("Remove invisible objects from output file.");
95  setCullInvisiblesCommand->SetGuidance("This command is used by HepRepFile, not by HepRepXML.");
97  if ( getenv( "G4HEPREPFILE_CULL" ) == NULL ) {
99  } else {
100  setCullInvisiblesCommand->SetDefaultValue(getenv("G4HEPREPFILE_CULL"));
101  cullInvisibles = setCullInvisiblesCommand->ConvertToBool(getenv("G4HEPREPFILE_CULL"));
102  }
104 
105  renderCylAsPolygonsCommand = new G4UIcmdWithABool("/vis/heprep/renderCylAsPolygons", this);
106  renderCylAsPolygonsCommand->SetGuidance("Render cylinders and cones as polygons.");
107  renderCylAsPolygonsCommand->SetGuidance("This command is used by HepRepFile, not by HepRepXML.");
111 
112  setScaleCommand = new G4UIcmdWithADouble("/vis/heprep/scale",this);
113  setScaleCommand->SetGuidance("Re-Scale coordinates.");
114  setScaleCommand->SetParameterName("Scale",true);
116  setScaleCommand->SetRange("Scale > 0");
117 
118  setCenterCommand = new G4UIcmdWith3VectorAndUnit("/vis/heprep/center",this);
119  setCenterCommand->SetGuidance("Re-Center coordinates.");
120  setCenterCommand->SetParameterName("CenterX","CenterY","CenterZ",true);
123 
124  setEventNumberSuffixCommand = new G4UIcmdWithAString("/vis/heprep/setEventNumberSuffix", this);
125  setEventNumberSuffixCommand->SetGuidance("Write separate event files, appended with given suffix.");
126  setEventNumberSuffixCommand->SetGuidance("Define the suffix with a pattern such as '-0000'.");
127  setEventNumberSuffixCommand->SetGuidance("This command is used by HepRepXML, not by HepRepFile.");
131 
132  appendGeometryCommand = new G4UIcmdWithABool("/vis/heprep/appendGeometry", this);
133  appendGeometryCommand->SetGuidance("Appends copy of geometry to every event.");
134  appendGeometryCommand->SetGuidance("This command is used by HepRepXML, not by HepRepFile.");
138 
139  addPointAttributesCommand = new G4UIcmdWithABool("/vis/heprep/addPointAttributes", this);
140  addPointAttributesCommand->SetGuidance("Adds point attributes to the points of trajectories.");
141  addPointAttributesCommand->SetGuidance("This command is used by HepRepXML, not by HepRepFile.");
145 
146  useSolidsCommand = new G4UIcmdWithABool("/vis/heprep/useSolids", this);
147  useSolidsCommand->SetGuidance("Use HepRep Solids, rather than Geant4 Primitives.");
148  useSolidsCommand->SetGuidance("This command is used by HepRepXML, not by HepRepFile..");
149  useSolidsCommand->SetParameterName("flag",false);
152 }
153 
155  delete setFileDirCommand;
156  delete setFileNameCommand;
157  delete setOverwriteCommand;
160  delete setScaleCommand;
161  delete setCenterCommand;
163  delete appendGeometryCommand;
165  delete useSolidsCommand;
166  delete heprepDirectory;
167 }
168 
170  if (command==setFileDirCommand) {
171  return fileDir;
172  } else if (command==setFileNameCommand) {
173  return fileName;
174  } else if (command==setOverwriteCommand) {
175  return overwrite;
176  } else if (command==setCullInvisiblesCommand) {
177  return cullInvisibles;
178  } else if (command==renderCylAsPolygonsCommand) {
180  } else if (command==setScaleCommand) {
182  } else if (command==setCenterCommand) {
184  } else if (command==setEventNumberSuffixCommand) {
185  return suffix;
186  } else if (command==appendGeometryCommand) {
188  } else if (command==addPointAttributesCommand) {
190  } else if (command==useSolidsCommand) {
192  } else {
193  return "";
194  }
195 }
196 
198  if (command==setFileDirCommand) {
199  fileDir = newValue;
200  } else if (command==setFileNameCommand) {
201  fileName = newValue;
202  } else if (command==setOverwriteCommand) {
204  } else if (command==setCullInvisiblesCommand) {
206  } else if (command==renderCylAsPolygonsCommand) {
208  } else if (command==setScaleCommand) {
210  } else if (command==setCenterCommand) {
212  } else if (command==setEventNumberSuffixCommand) {
213  suffix = newValue;
214  } else if (command==appendGeometryCommand) {
216  } else if (command==addPointAttributesCommand) {
218  } else if (command==useSolidsCommand) {
220  }
221 }
222 
224  return fileDir;
225 }
226 
228  return fileName;
229 }
230 
232  return overwrite;
233 }
234 
236  return cullInvisibles;
237 }
238 
240  return cylAsPolygons;
241 }
242 
244  return scale;
245 }
246 
248  return center;
249 }
250 
252  return suffix;
253 }
254 
256  return geometry;
257 }
258 
260  return pointAttributes;
261 }
262 
264  return solids;
265 }
266 
268  return invisibles;
269 }
270 
virtual G4double getScale()
virtual G4bool renderCylAsPolygons()
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:161
G4UIcmdWithABool * useSolidsCommand
void SetDefaultValue(G4ThreeVector defVal)
CLHEP::Hep3Vector G4ThreeVector
G4UIcmdWithABool * setCullInvisiblesCommand
G4ThreeVector center
virtual G4bool getCullInvisibles()
G4UIdirectory * heprepDirectory
G4UIcmdWithAString * setFileDirCommand
void SetDefaultValue(G4bool defVal)
G4UIcmdWithADouble * setScaleCommand
static G4bool ConvertToBool(const char *st)
Definition: G4UIcommand.cc:439
G4UIcmdWithAString * setFileNameCommand
void SetRange(const char *rs)
Definition: G4UIcommand.hh:125
static G4double GetNewDoubleValue(const char *paramString)
void SetDefaultValue(const char *defVal)
virtual G4ThreeVector getCenter()
static G4bool GetNewBoolValue(const char *paramString)
virtual G4bool writeInvisibles()
static G4HepRepMessenger * fpInstance
double G4double
Definition: G4Types.hh:76
bool G4bool
Definition: G4Types.hh:79
Double_t scale
G4UIcmdWithABool * renderCylAsPolygonsCommand
virtual G4bool useSolids()
G4UIcmdWithAString * setEventNumberSuffixCommand
virtual G4String getEventNumberSuffix()
virtual void SetNewValue(G4UIcommand *command, G4String newValue)
virtual G4bool appendGeometry()
virtual G4bool addPointAttributes()
static G4String ConvertToString(G4bool boolVal)
Definition: G4UIcommand.cc:374
static G4HepRepMessenger * GetInstance()
void SetDefaultValue(G4double defVal)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
virtual G4bool getOverwrite()
virtual G4String GetCurrentValue(G4UIcommand *command)
G4UIcmdWith3VectorAndUnit * setCenterCommand
G4UIcmdWithABool * addPointAttributesCommand
G4UIcmdWithABool * setOverwriteCommand
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetDefaultUnit(const char *defUnit)
static G4ThreeVector GetNew3VectorValue(const char *paramString)
virtual G4String getFileName()
void SetParameterName(const char *theNameX, const char *theNameY, const char *theNameZ, G4bool omittable, G4bool currentAsDefault=false)
void AvailableForStates(G4ApplicationState s1)
Definition: G4UIcommand.cc:242
G4UIcmdWithABool * appendGeometryCommand
virtual G4String getFileDir()