Geant4 10.7.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, G4bool commandsToBeBroadcasted=true)
 
virtual ~G4UImessenger ()
 
virtual G4String GetCurrentValue (G4UIcommand *command)
 
virtual void SetNewValue (G4UIcommand *command, G4String newValue)
 
G4bool operator== (const G4UImessenger &messenger) const
 
G4bool operator!= (const G4UImessenger &messenger) const
 
G4bool CommandsShouldBeInMaster () 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)
 
G4long StoL (G4String s)
 
G4double StoD (G4String s)
 
G4bool StoB (G4String s)
 
void AddUIcommand (G4UIcommand *newCommand)
 
void CreateDirectory (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
 
template<typename T >
T * CreateCommand (const G4String &cname, const G4String &dsc)
 
- Protected Attributes inherited from G4UImessenger
G4UIdirectorybaseDir = nullptr
 
G4String baseDirName = ""
 
G4bool commandsShouldBeInMaster = false
 

Detailed Description

Definition at line 51 of file G4GeometryMessenger.hh.

Constructor & Destructor Documentation

◆ G4GeometryMessenger()

G4GeometryMessenger::G4GeometryMessenger ( G4TransportationManager tman)

Definition at line 53 of file G4GeometryMessenger.cc.

54 : tmanager(tman)
55{
56 geodir = new G4UIdirectory( "/geometry/" );
57 geodir->SetGuidance( "Geometry control commands." );
58
59 //
60 // Geometry navigator commands
61 //
62 navdir = new G4UIdirectory( "/geometry/navigator/" );
63 navdir->SetGuidance( "Geometry navigator control setup." );
64
65 resCmd = new G4UIcmdWithoutParameter( "/geometry/navigator/reset", this );
66 resCmd->SetGuidance( "Reset navigator and navigation history." );
67 resCmd->SetGuidance( "NOTE: must be called only after kernel has been" );
68 resCmd->SetGuidance( " initialized once through the run manager!" );
70
71 verbCmd = new G4UIcmdWithAnInteger( "/geometry/navigator/verbose", this );
72 verbCmd->SetGuidance( "Set run-time verbosity for the navigator." );
73 verbCmd->SetGuidance(" 0 : Silent (default)");
74 verbCmd->SetGuidance(" 1 : Display volume positioning and step lengths");
75 verbCmd->SetGuidance(" 2 : Display step/safety info on point location");
76 verbCmd->SetGuidance(" 3 : Display minimal state at -every- step");
77 verbCmd->SetGuidance(" 4 : Maximum verbosity (very detailed!)");
78 verbCmd->SetGuidance( "NOTE: this command has effect -only- if Geant4 has" );
79 verbCmd->SetGuidance( " been installed with the G4VERBOSE flag set!" );
80 verbCmd->SetParameterName("level",true);
81 verbCmd->SetDefaultValue(0);
82 verbCmd->SetRange("level >=0 && level <=4");
83
84 chkCmd = new G4UIcmdWithABool( "/geometry/navigator/check_mode", this );
85 chkCmd->SetGuidance( "Set navigator in -check_mode- state." );
86 chkCmd->SetGuidance( "This will cause extra checks to be applied during" );
87 chkCmd->SetGuidance( "navigation. More strict and less tolerant conditions" );
88 chkCmd->SetGuidance( "are applied. A run-time performance penalty may be" );
89 chkCmd->SetGuidance( "observed when the -check_mode- state is activated." );
90 chkCmd->SetGuidance( "NOTE: this command has effect -only- if Geant4 has" );
91 chkCmd->SetGuidance( " been installed with the G4VERBOSE flag set!" );
92 chkCmd->SetParameterName("checkFlag",true);
93 chkCmd->SetDefaultValue(false);
95
96 pchkCmd = new G4UIcmdWithABool( "/geometry/navigator/push_notify", this );
97 pchkCmd->SetGuidance( "Set navigator verbosity push notifications." );
98 pchkCmd->SetGuidance( "This allows one to disable/re-enable verbosity in" );
99 pchkCmd->SetGuidance( "navigation, when tracks may get stuck and require" );
100 pchkCmd->SetGuidance( "one artificial push along the direction by the" );
101 pchkCmd->SetGuidance( "navigator. Notification is active by default." );
102 pchkCmd->SetGuidance( "NOTE: this command has effect -only- if Geant4 has" );
103 pchkCmd->SetGuidance( " been installed with the G4VERBOSE flag set!" );
104 pchkCmd->SetParameterName("pushFlag",true);
105 pchkCmd->SetDefaultValue(true);
107
108 //
109 // Geometry verification test commands
110 //
111 testdir = new G4UIdirectory( "/geometry/test/" );
112 testdir->SetGuidance( "Geometry verification control setup." );
113 testdir->SetGuidance( "Helps in detecting possible overlapping regions." );
114
115 tolCmd = new G4UIcmdWithADoubleAndUnit( "/geometry/test/tolerance",this );
116 tolCmd->SetGuidance( "Define tolerance (in mm) by which overlaps reports" );
117 tolCmd->SetGuidance( "should be reported. By default, all overlaps are" );
118 tolCmd->SetGuidance( "reported, i.e. tolerance is set to: 0*mm." );
119 tolCmd->SetParameterName( "Tolerance", true, true );
120 tolCmd->SetDefaultValue( 0 );
121 tolCmd->SetDefaultUnit( "mm" );
122 tolCmd->SetUnitCategory( "Length" );
123
124 verCmd = new G4UIcmdWithABool( "/geometry/test/verbosity", this );
125 verCmd->SetGuidance( "Specify if running in verbosity mode or not." );
126 verCmd->SetGuidance( "By default verbosity is set to ON (TRUE)." );
127 verCmd->SetParameterName("verbosity",true);
128 verCmd->SetDefaultValue(true);
130
131 rslCmd = new G4UIcmdWithAnInteger( "/geometry/test/resolution", this );
132 rslCmd->SetGuidance( "Set the number of points on surface to be generated for" );
133 rslCmd->SetGuidance( "checking overlaps." );
134 rslCmd->SetParameterName("resolution",true);
135 rslCmd->SetDefaultValue(10000);
136
137 rcsCmd = new G4UIcmdWithAnInteger( "/geometry/test/recursion_start", this );
138 rcsCmd->SetGuidance( "Set the initial level in the geometry tree for recursion." );
139 rcsCmd->SetGuidance( "recursive_test will then start from the specified level." );
140 rcsCmd->SetParameterName("initial_level",true);
141 rcsCmd->SetDefaultValue(0);
142
143 rcdCmd = new G4UIcmdWithAnInteger( "/geometry/test/recursion_depth", this );
144 rcdCmd->SetGuidance( "Set the depth in the geometry tree for recursion." );
145 rcdCmd->SetGuidance( "recursive_test will then stop after reached the specified depth." );
146 rcdCmd->SetGuidance( "By default, recursion will proceed for the whole depth." );
147 rcdCmd->SetParameterName("recursion_depth",true);
148 rcdCmd->SetDefaultValue(-1);
149
150 errCmd = new G4UIcmdWithAnInteger( "/geometry/test/maximum_errors", this );
151 errCmd->SetGuidance( "Set the maximum number of overlap errors to report" );
152 errCmd->SetGuidance( "for each single volume being checked." );
153 errCmd->SetGuidance( "Once reached the maximum number specified, overlaps" );
154 errCmd->SetGuidance( "affecting that volume further than that are simply ignored." );
155 errCmd->SetParameterName("maximum_errors",true);
156 errCmd->SetDefaultValue(1);
157
158 recCmd = new G4UIcmdWithoutParameter( "/geometry/test/run", this );
159 recCmd->SetGuidance( "Start running the recursive overlap check." );
160 recCmd->SetGuidance( "Volumes are recursively asked to verify for overlaps" );
161 recCmd->SetGuidance( "for points generated on the surface against their" );
162 recCmd->SetGuidance( "respective mother volume and sisters at the same" );
163 recCmd->SetGuidance( "level, performing for all daughters and daughters of" );
164 recCmd->SetGuidance( "daughters, etc." );
165 recCmd->SetGuidance( "NOTE: it may take a very long time," );
166 recCmd->SetGuidance( " depending on the geometry complexity !");
168}
@ G4State_Idle
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(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:273

◆ ~G4GeometryMessenger()

G4GeometryMessenger::~G4GeometryMessenger ( )

Definition at line 173 of file G4GeometryMessenger.cc.

174{
175 delete verCmd; delete recCmd; delete rslCmd;
176 delete resCmd; delete rcsCmd; delete rcdCmd; delete errCmd;
177 delete tolCmd;
178 delete verbCmd; delete pchkCmd; delete chkCmd;
179 delete geodir; delete navdir; delete testdir;
180 delete tvolume;
181}

Member Function Documentation

◆ GetCurrentValue()

G4String G4GeometryMessenger::GetCurrentValue ( G4UIcommand command)
virtual

Reimplemented from G4UImessenger.

Definition at line 258 of file G4GeometryMessenger.cc.

259{
260 G4String cv = "";
261 if (command == tolCmd)
262 {
263 cv = tolCmd->ConvertToString( tol, "mm" );
264 }
265 return cv;
266}
static G4String ConvertToString(G4bool boolVal)
Definition: G4UIcommand.cc:430

◆ SetNewValue()

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

Reimplemented from G4UImessenger.

Definition at line 208 of file G4GeometryMessenger.cc.

209{
210 if (command == resCmd) {
211 ResetNavigator();
212 }
213 else if (command == verbCmd) {
214 SetVerbosity( newValues );
215 }
216 else if (command == chkCmd) {
217 SetCheckMode( newValues );
218 }
219 else if (command == pchkCmd) {
220 SetPushFlag( newValues );
221 }
222 else if (command == tolCmd) {
223 Init();
224 tol = tolCmd->GetNewDoubleValue( newValues )
225 * tolCmd->GetNewUnitValue( newValues );
226 tvolume->SetTolerance(tol);
227 }
228 else if (command == verCmd) {
229 Init();
230 tvolume->SetVerbosity(verCmd->GetNewBoolValue( newValues ));
231 }
232 else if (command == rslCmd) {
233 Init();
234 tvolume->SetResolution(rslCmd->GetNewIntValue( newValues ));
235 }
236 else if (command == rcsCmd) {
237 recLevel = rcsCmd->GetNewIntValue( newValues );
238 }
239 else if (command == rcdCmd) {
240 recDepth = rcdCmd->GetNewIntValue( newValues );
241 }
242 else if (command == errCmd) {
243 Init();
244 tvolume->SetErrorsThreshold(errCmd->GetNewIntValue( newValues ));
245 }
246 else if (command == recCmd) {
247 Init();
248 G4cout << "Running geometry overlaps check..." << G4endl;
249 RecursiveOverlapTest();
250 G4cout << "Geometry overlaps check completed !" << G4endl;
251 }
252}
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
void SetTolerance(G4double tolerance)
void SetVerbosity(G4bool verbosity)
void SetResolution(G4int points)
void SetErrorsThreshold(G4int max)
static G4bool GetNewBoolValue(const char *paramString)
static G4double GetNewUnitValue(const char *paramString)
static G4double GetNewDoubleValue(const char *paramString)
static G4int GetNewIntValue(const char *paramString)

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