Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4GeometryMessenger Class Reference

#include <G4GeometryMessenger.hh>

+ Inheritance diagram for G4GeometryMessenger:

Public Member Functions

 G4GeometryMessenger (G4TransportationManager *tman)
 
 ~G4GeometryMessenger ()
 
void SetNewValue (G4UIcommand *command, G4String newValues)
 
G4String GetCurrentValue (G4UIcommand *command)
 
- Public Member Functions inherited from G4UImessenger
 G4UImessenger ()
 
 G4UImessenger (const G4String &path, const G4String &dsc)
 
virtual ~G4UImessenger ()
 
virtual G4String GetCurrentValue (G4UIcommand *command)
 
virtual void SetNewValue (G4UIcommand *command, G4String newValue)
 
G4bool operator== (const G4UImessenger &messenger) const
 

Additional Inherited Members

- Protected Member Functions inherited from G4UImessenger
G4String ItoS (G4int i)
 
G4String DtoS (G4double a)
 
G4String BtoS (G4bool b)
 
G4int StoI (G4String s)
 
G4double StoD (G4String s)
 
G4bool StoB (G4String s)
 
void AddUIcommand (G4UIcommand *newCommand)
 
void CreateDirectory (const G4String &path, const G4String &dsc)
 
template<typename T >
T * CreateCommand (const G4String &cname, const G4String &dsc)
 
- Protected Attributes inherited from G4UImessenger
G4UIdirectorybaseDir
 
G4String baseDirName
 

Detailed Description

Definition at line 61 of file G4GeometryMessenger.hh.

Constructor & Destructor Documentation

◆ G4GeometryMessenger()

G4GeometryMessenger::G4GeometryMessenger ( G4TransportationManager tman)

Definition at line 62 of file G4GeometryMessenger.cc.

63 : x(0,0,0), p(0,0,1), grdRes(100,100,100), cylRes(90,50,50),
64 cylfZ(0.8), cylfR(0.8), newtol(false), tol(1E-4), // mm
65 recLevel(0), recDepth(-1), tmanager(tman), tlogger(0), tvolume(0)
66{
67 geodir = new G4UIdirectory( "/geometry/" );
68 geodir->SetGuidance( "Geometry control commands." );
69
70 //
71 // Geometry navigator commands
72 //
73 navdir = new G4UIdirectory( "/geometry/navigator/" );
74 navdir->SetGuidance( "Geometry navigator control setup." );
75
76 resCmd = new G4UIcmdWithoutParameter( "/geometry/navigator/reset", this );
77 resCmd->SetGuidance( "Reset navigator and navigation history." );
78 resCmd->SetGuidance( "NOTE: must be called only after kernel has been" );
79 resCmd->SetGuidance( " initialized once through the run manager!" );
81
82 verbCmd = new G4UIcmdWithAnInteger( "/geometry/navigator/verbose", this );
83 verbCmd->SetGuidance( "Set run-time verbosity for the navigator." );
84 verbCmd->SetGuidance(" 0 : Silent (default)");
85 verbCmd->SetGuidance(" 1 : Display volume positioning and step lengths");
86 verbCmd->SetGuidance(" 2 : Display step/safety info on point location");
87 verbCmd->SetGuidance(" 3 : Display minimal state at -every- step");
88 verbCmd->SetGuidance(" 4 : Maximum verbosity (very detailed!)");
89 verbCmd->SetGuidance( "NOTE: this command has effect -only- if Geant4 has" );
90 verbCmd->SetGuidance( " been installed with the G4VERBOSE flag set!" );
91 verbCmd->SetParameterName("level",true);
92 verbCmd->SetDefaultValue(0);
93 verbCmd->SetRange("level >=0 && level <=4");
94
95 chkCmd = new G4UIcmdWithABool( "/geometry/navigator/check_mode", this );
96 chkCmd->SetGuidance( "Set navigator in -check_mode- state." );
97 chkCmd->SetGuidance( "This will cause extra checks to be applied during" );
98 chkCmd->SetGuidance( "navigation. More strict and less tolerant conditions" );
99 chkCmd->SetGuidance( "are applied. A run-time performance penalty may be" );
100 chkCmd->SetGuidance( "observed when the -check_mode- state is activated." );
101 chkCmd->SetGuidance( "NOTE: this command has effect -only- if Geant4 has" );
102 chkCmd->SetGuidance( " been installed with the G4VERBOSE flag set!" );
103 chkCmd->SetParameterName("checkFlag",true);
104 chkCmd->SetDefaultValue(false);
106
107 pchkCmd = new G4UIcmdWithABool( "/geometry/navigator/push_notify", this );
108 pchkCmd->SetGuidance( "Set navigator verbosity push notifications." );
109 pchkCmd->SetGuidance( "This allows to disable/re-enable verbosity in" );
110 pchkCmd->SetGuidance( "navigation, when tracks may get stuck and require" );
111 pchkCmd->SetGuidance( "one artificial push along the direction by the" );
112 pchkCmd->SetGuidance( "navigator. Notification is active by default." );
113 pchkCmd->SetGuidance( "NOTE: this command has effect -only- if Geant4 has" );
114 pchkCmd->SetGuidance( " been installed with the G4VERBOSE flag set!" );
115 pchkCmd->SetParameterName("pushFlag",true);
116 pchkCmd->SetDefaultValue(true);
118
119 //
120 // Geometry verification test commands
121 //
122 testdir = new G4UIdirectory( "/geometry/test/" );
123 testdir->SetGuidance( "Geometry verification control setup." );
124 testdir->SetGuidance( "Helps in detecting possible overlapping regions." );
125
126 tolCmd = new G4UIcmdWithADoubleAndUnit( "/geometry/test/tolerance",this );
127 tolCmd->SetGuidance( "Set error tolerance value." );
128 tolCmd->SetGuidance( "Initial default value: 1E-4*mm." );
129 tolCmd->SetParameterName( "Tolerance", true, true );
130 tolCmd->SetDefaultValue( 1E-4 );
131 tolCmd->SetDefaultUnit( "mm" );
132 tolCmd->SetUnitCategory( "Length" );
133
134 posCmd = new G4UIcmdWith3VectorAndUnit( "/geometry/test/position", this );
135 posCmd->SetGuidance( "Set starting position for the line_test." );
136 posCmd->SetParameterName( "X", "Y", "Z", true, true );
137 posCmd->SetDefaultUnit( "cm" );
138
139 dirCmd = new G4UIcmdWith3VectorAndUnit( "/geometry/test/direction", this );
140 dirCmd->SetGuidance( "Set momentum direction for the line_test." );
141 dirCmd->SetGuidance( "Direction needs not to be a unit vector." );
142 dirCmd->SetParameterName( "Px", "Py", "Pz", true, true );
143 dirCmd->SetRange( "Px != 0 || Py != 0 || Pz != 0" );
144
145 linCmd = new G4UIcmdWithABool( "/geometry/test/line_test", this );
146 linCmd->SetGuidance( "Performs test along a single specified direction/position." );
147 linCmd->SetGuidance( "Use position and direction commands to change default." );
148 linCmd->SetGuidance( "Initial default: position(0,0,0), direction(0,0,1)." );
149 linCmd->SetGuidance( "If recursion flag is set to TRUE, the intersection checks" );
150 linCmd->SetGuidance( "will be performed recursively in the geometry tree." );
151 linCmd->SetParameterName("recursionFlag",true);
152 linCmd->SetDefaultValue(false);
154
155 grzCmd = new G4UIcmdWith3Vector( "/geometry/test/grid_cells", this );
156 grzCmd->SetGuidance( "Define resolution of grid geometry as number of cells," );
157 grzCmd->SetGuidance( "specifying them for each dimension, X, Y and Z." );
158 grzCmd->SetGuidance( "Will be applied to grid_test and recursive_test commands." );
159 grzCmd->SetGuidance( "Initial default values: X=100, Y=100, Z=100." );
160 grzCmd->SetParameterName( "X", "Y", "Z", true, true );
161 grzCmd->SetDefaultValue( G4ThreeVector(100, 100, 100) );
162
163 grdCmd = new G4UIcmdWithABool( "/geometry/test/grid_test", this );
164 grdCmd->SetGuidance( "Start running the default grid test." );
165 grdCmd->SetGuidance( "A grid of lines parallel to a cartesian axis is used;" );
166 grdCmd->SetGuidance( "By default, only direct daughters of the mother volumes are checked." );
167 grdCmd->SetGuidance( "If recursion flag is set to TRUE, the intersection checks" );
168 grdCmd->SetGuidance( "will be performed recursively in the geometry tree." );
169 grdCmd->SetGuidance( "NOTE: the recursion may take a very long time," );
170 grdCmd->SetGuidance( " depending on the geometry complexity !");
171 grdCmd->SetParameterName("recursionFlag",true);
172 grdCmd->SetDefaultValue(false);
174
175 cyzCmd = new G4UIcmdWith3Vector( "/geometry/test/cylinder_geometry", this );
176 cyzCmd->SetGuidance( "Define details of the cylinder geometry, specifying:" );
177 cyzCmd->SetGuidance( " nPhi - number of lines per Phi" );
178 cyzCmd->SetGuidance( " nZ - number of Z points" );
179 cyzCmd->SetGuidance( " nRho - number of Rho points" );
180 cyzCmd->SetGuidance( "Will be applied to the cylinder_test command." );
181 cyzCmd->SetGuidance( "Initial default values: nPhi=90, nZ=50, nRho=50." );
182 cyzCmd->SetParameterName( "nPhi", "nZ", "nRho", true, true );
183 cyzCmd->SetDefaultValue( G4ThreeVector(90, 50, 50) );
184
185 cfzCmd = new G4UIcmdWithADouble( "/geometry/test/cylinder_scaleZ", this );
186 cfzCmd->SetGuidance( "Define the resolution of the cylinder geometry, specifying" );
187 cfzCmd->SetGuidance( "the fraction scale for points along Z." );
188 cfzCmd->SetGuidance( "Initial default values: fracZ=0.8" );
189 cfzCmd->SetParameterName("fracZ",true);
190 cfzCmd->SetDefaultValue(0.8);
191
192 cfrCmd = new G4UIcmdWithADouble( "/geometry/test/cylinder_scaleRho", this );
193 cfrCmd->SetGuidance( "Define the resolution of the cylinder geometry, specifying" );
194 cfrCmd->SetGuidance( "the fraction scale for points along Rho." );
195 cfrCmd->SetGuidance( "Initial default values: fracRho=0.8" );
196 cfrCmd->SetParameterName("fracRho",true);
197 cfrCmd->SetDefaultValue(0.8);
198
199 cylCmd = new G4UIcmdWithABool( "/geometry/test/cylinder_test", this );
200 cylCmd->SetGuidance( "Start running the cylinder test." );
201 cylCmd->SetGuidance( "A set of lines in a cylindrical pattern of gradually" );
202 cylCmd->SetGuidance( "increasing mesh size." );
203 cylCmd->SetGuidance( "By default, only direct daughters of the mother volumes are checked." );
204 cylCmd->SetGuidance( "If recursion flag is set to TRUE, the intersection checks" );
205 cylCmd->SetGuidance( "will be performed recursively in the geometry tree." );
206 cylCmd->SetGuidance( "NOTE: the recursion may take a very long time," );
207 cylCmd->SetGuidance( " depending on the geometry complexity !");
208 cylCmd->SetParameterName("recursionFlag",true);
209 cylCmd->SetDefaultValue(false);
211
212 rcsCmd = new G4UIcmdWithAnInteger( "/geometry/test/recursion_start", this );
213 rcsCmd->SetGuidance( "Set the initial level in the geometry tree for recursion." );
214 rcsCmd->SetGuidance( "recursive_test will then start from the specified level." );
215 rcsCmd->SetParameterName("initial_level",true);
216 rcsCmd->SetDefaultValue(0);
217
218 rcdCmd = new G4UIcmdWithAnInteger( "/geometry/test/recursion_depth", this );
219 rcdCmd->SetGuidance( "Set the depth in the geometry tree for recursion." );
220 rcdCmd->SetGuidance( "recursive_test will then stop after reached the specified depth." );
221 rcdCmd->SetGuidance( "By default, recursion will proceed for the whole depth." );
222 rcdCmd->SetParameterName("recursion_depth",true);
223 rcdCmd->SetDefaultValue(-1);
224
225 // Obsolete verification commands ...
226
227 runCmd = new G4UIcmdWithABool( "/geometry/test/run", this );
228 runCmd->SetGuidance( "Start running the default grid test." );
229 runCmd->SetGuidance( "Same as the grid_test command." );
230 runCmd->SetGuidance( "If recursion flag is set to TRUE, the intersection checks" );
231 runCmd->SetGuidance( "will be performed recursively in the geometry tree." );
232 runCmd->SetGuidance( "NOTE: the recursion may take a very long time," );
233 runCmd->SetGuidance( " depending on the geometry complexity !");
234 runCmd->SetParameterName("recursionFlag",true);
235 runCmd->SetDefaultValue(false);
237
238 recCmd = new G4UIcmdWithoutParameter( "/geometry/test/recursive_test", this );
239 recCmd->SetGuidance( "Start running the recursive grid test." );
240 recCmd->SetGuidance( "A grid of lines along a cartesian axis is recursively" );
241 recCmd->SetGuidance( "to all daughters and daughters of daughters, etc." );
242 recCmd->SetGuidance( "NOTE: it may take a very long time," );
243 recCmd->SetGuidance( " depending on the geometry complexity !");
245}
@ G4State_Idle
CLHEP::Hep3Vector G4ThreeVector
void SetDefaultUnit(const char *defUnit)
void SetParameterName(const char *theNameX, const char *theNameY, const char *theNameZ, G4bool omittable, G4bool currentAsDefault=false)
void SetParameterName(const char *theNameX, const char *theNameY, const char *theNameZ, G4bool omittable, G4bool currentAsDefault=false)
void SetDefaultValue(G4ThreeVector defVal)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetDefaultValue(G4bool defVal)
void SetUnitCategory(const char *unitCategory)
void SetDefaultUnit(const char *defUnit)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetDefaultValue(G4double defVal)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetDefaultValue(G4int defVal)
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:156
void SetRange(const char *rs)
Definition: G4UIcommand.hh:120
void AvailableForStates(G4ApplicationState s1)
Definition: G4UIcommand.cc:219

◆ ~G4GeometryMessenger()

G4GeometryMessenger::~G4GeometryMessenger ( )

Definition at line 250 of file G4GeometryMessenger.cc.

251{
252 delete linCmd; delete posCmd; delete dirCmd;
253 delete grzCmd; delete grdCmd; delete recCmd; delete runCmd;
254 delete rcsCmd; delete rcdCmd;
255 delete cyzCmd; delete cfzCmd; delete cfrCmd; delete cylCmd;
256 delete tolCmd;
257 delete resCmd; delete verbCmd; delete pchkCmd; delete chkCmd;
258 delete geodir; delete navdir; delete testdir;
259 delete tvolume; delete tlogger;
260}

Member Function Documentation

◆ GetCurrentValue()

G4String G4GeometryMessenger::GetCurrentValue ( G4UIcommand command)
virtual

Reimplemented from G4UImessenger.

Definition at line 369 of file G4GeometryMessenger.cc.

370{
371 G4String cv = "";
372 if (command == posCmd) {
373 cv = posCmd->ConvertToString( x, "cm" );
374 }
375 else if (command == tolCmd) {
376 cv = tolCmd->ConvertToString( tol, "mm" );
377 }
378 else if (command == dirCmd) {
379 cv = dirCmd->ConvertToString( p, "GeV" );
380 }
381 return cv;
382}
static G4String ConvertToString(G4bool boolVal)
Definition: G4UIcommand.cc:349

◆ SetNewValue()

void G4GeometryMessenger::SetNewValue ( G4UIcommand command,
G4String  newValues 
)
virtual

Reimplemented from G4UImessenger.

Definition at line 291 of file G4GeometryMessenger.cc.

292{
293 if (command == resCmd) {
294 ResetNavigator();
295 }
296 else if (command == verbCmd) {
297 SetVerbosity( newValues );
298 }
299 else if (command == chkCmd) {
300 SetCheckMode( newValues );
301 }
302 else if (command == posCmd) {
303 x = posCmd->GetNew3VectorValue( newValues );
304 }
305 else if (command == dirCmd) {
306 p = dirCmd->GetNew3VectorValue( newValues );
307 if (p.mag() < DBL_MIN) {
308 G4cerr << "Please specify non-zero momentum!" << G4endl;
309 p = G4ThreeVector(0,0,1);
310 }
311 }
312 else if (command == tolCmd) {
313 tol = tolCmd->GetNewDoubleValue( newValues );
314 newtol = true;
315 }
316 else if (command == linCmd) {
317 Init();
318 if (linCmd->GetNewBoolValue( newValues ))
319 RecursiveLineTest();
320 else
321 LineTest();
322 }
323 else if ((command == grdCmd) || (command == runCmd)){
324 Init();
325 if (grdCmd->GetNewBoolValue( newValues ) || runCmd->GetNewBoolValue( newValues ))
326 RecursiveGridTest();
327 else
328 GridTest();
329 }
330 else if (command == grzCmd) {
331 grdRes = grzCmd->GetNew3VectorValue( newValues );
332 if (grdRes.mag() < DBL_MIN) {
333 G4cerr << "Please specify non-zero resolution!" << G4endl;
334 grdRes = G4ThreeVector(100,100,100);
335 }
336 }
337 else if (command == cyzCmd) {
338 cylRes = cyzCmd->GetNew3VectorValue( newValues );
339 }
340 else if (command == cfzCmd) {
341 cylfZ = cfzCmd->GetNewDoubleValue( newValues );
342 }
343 else if (command == cfrCmd) {
344 cylfR = cfrCmd->GetNewDoubleValue( newValues );
345 }
346 else if (command == rcsCmd) {
347 recLevel = rcsCmd->GetNewIntValue( newValues );
348 }
349 else if (command == rcdCmd) {
350 recDepth = rcdCmd->GetNewIntValue( newValues );
351 }
352 else if (command == recCmd) {
353 Init();
354 RecursiveGridTest();
355 }
356 else if (command == cylCmd) {
357 Init();
358 if (cylCmd->GetNewBoolValue( newValues ))
359 RecursiveCylinderTest();
360 else
361 CylinderTest();
362 }
363}
#define G4endl
Definition: G4ios.hh:52
G4DLLIMPORT std::ostream G4cerr
double mag() const
static G4ThreeVector GetNew3VectorValue(const char *paramString)
static G4ThreeVector GetNew3VectorValue(const char *paramString)
static G4bool GetNewBoolValue(const char *paramString)
static G4double GetNewDoubleValue(const char *paramString)
static G4double GetNewDoubleValue(const char *paramString)
static G4int GetNewIntValue(const char *paramString)
#define DBL_MIN
Definition: templates.hh:75

The documentation for this class was generated from the following files: