Geant4  10.02.p03
G4GeometryMessenger Class Reference

#include <G4GeometryMessenger.hh>

Inheritance diagram for G4GeometryMessenger:
Collaboration 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 ()
 
G4bool operator== (const G4UImessenger &messenger) const
 
G4bool CommandsShouldBeInMaster () const
 

Private Member Functions

void Init ()
 
void CheckGeometry ()
 
void ResetNavigator ()
 
void SetVerbosity (G4String newValue)
 
void SetCheckMode (G4String newValue)
 
void SetPushFlag (G4String newValue)
 
void RecursiveOverlapTest ()
 

Private Attributes

G4UIdirectorygeodir
 
G4UIdirectorynavdir
 
G4UIdirectorytestdir
 
G4UIcmdWithABoolchkCmd
 
G4UIcmdWithABoolpchkCmd
 
G4UIcmdWithABoolverCmd
 
G4UIcmdWithoutParameterrecCmd
 
G4UIcmdWithoutParameterresCmd
 
G4UIcmdWithADoubleAndUnittolCmd
 
G4UIcmdWithAnIntegerverbCmd
 
G4UIcmdWithAnIntegerrslCmd
 
G4UIcmdWithAnIntegerrcsCmd
 
G4UIcmdWithAnIntegerrcdCmd
 
G4UIcmdWithAnIntegererrCmd
 
G4double tol
 
G4int recLevel
 
G4int recDepth
 
G4TransportationManagertmanager
 
G4GeomTestVolumetvolume
 

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, G4bool commandsToBeBroadcasted=true)
 
template<typename T >
T * CreateCommand (const G4String &cname, const G4String &dsc)
 
- Protected Attributes inherited from G4UImessenger
G4UIdirectorybaseDir
 
G4String baseDirName
 
G4bool commandsShouldBeInMaster
 

Detailed Description

Definition at line 57 of file G4GeometryMessenger.hh.

Constructor & Destructor Documentation

◆ G4GeometryMessenger()

G4GeometryMessenger::G4GeometryMessenger ( G4TransportationManager tman)

Definition at line 59 of file G4GeometryMessenger.cc.

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

◆ ~G4GeometryMessenger()

G4GeometryMessenger::~G4GeometryMessenger ( )

Definition at line 179 of file G4GeometryMessenger.cc.

180 {
181  delete verCmd; delete recCmd; delete rslCmd;
182  delete resCmd; delete rcsCmd; delete rcdCmd; delete errCmd;
183  delete tolCmd;
184  delete verbCmd; delete pchkCmd; delete chkCmd;
185  delete geodir; delete navdir; delete testdir;
186  delete tvolume;
187 }
G4UIcmdWithAnInteger * errCmd
G4UIcmdWithADoubleAndUnit * tolCmd
G4UIcmdWithAnInteger * verbCmd
G4UIcmdWithAnInteger * rcsCmd
G4UIcmdWithoutParameter * resCmd
G4UIcmdWithABool * verCmd
G4UIcmdWithABool * pchkCmd
G4UIcmdWithAnInteger * rcdCmd
G4UIcmdWithoutParameter * recCmd
G4UIcmdWithAnInteger * rslCmd
G4GeomTestVolume * tvolume
G4UIcmdWithABool * chkCmd

Member Function Documentation

◆ CheckGeometry()

void G4GeometryMessenger::CheckGeometry ( )
private

Definition at line 274 of file G4GeometryMessenger.cc.

275 {
276  // Verify that the geometry is closed
277  //
279  if (!geomManager->IsGeometryClosed()) {
280  geomManager->OpenGeometry();
281  geomManager->CloseGeometry(true);
282  }
283 }
static G4GeometryManager * GetInstance()
void OpenGeometry(G4VPhysicalVolume *vol=0)
G4bool CloseGeometry(G4bool pOptimise=true, G4bool verbose=false, G4VPhysicalVolume *vol=0)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetCurrentValue()

G4String G4GeometryMessenger::GetCurrentValue ( G4UIcommand command)
virtual

Reimplemented from G4UImessenger.

Definition at line 261 of file G4GeometryMessenger.cc.

262 {
263  G4String cv = "";
264  if (command == tolCmd) {
265  cv = tolCmd->ConvertToString( tol, "mm" );
266  }
267  return cv;
268 }
G4UIcmdWithADoubleAndUnit * tolCmd
static G4String ConvertToString(G4bool boolVal)
Definition: G4UIcommand.cc:371
Here is the call graph for this function:

◆ Init()

void G4GeometryMessenger::Init ( )
private

Definition at line 193 of file G4GeometryMessenger.cc.

194 {
195  // Create checker...
196  //
197  if (!tvolume)
198  {
199  // Get the world volume
200  //
201  G4VPhysicalVolume* world =
203 
204  // Test the actual detector...
205  //
206  tvolume = new G4GeomTestVolume(world);
207  }
208 }
G4TransportationManager * tmanager
G4Navigator * GetNavigatorForTracking() const
G4VPhysicalVolume * GetWorldVolume() const
G4GeomTestVolume * tvolume
Here is the call graph for this function:
Here is the caller graph for this function:

◆ RecursiveOverlapTest()

void G4GeometryMessenger::RecursiveOverlapTest ( )
private

Definition at line 339 of file G4GeometryMessenger.cc.

340 {
341  // Close geometry if necessary
342  //
343  CheckGeometry();
344 
345  // Make test on single line supplied by user recursively
346  //
348 }
void TestRecursiveOverlap(G4int sLevel=0, G4int depth=-1)
G4GeomTestVolume * tvolume
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ResetNavigator()

void G4GeometryMessenger::ResetNavigator ( )
private

Definition at line 289 of file G4GeometryMessenger.cc.

290 {
291  // Close geometry and reset optimisation if necessary
292  //
293  CheckGeometry();
294 
295  // Reset navigator's state
296  //
297  G4ThreeVector pt(0,0,0);
299  navigator->LocateGlobalPointAndSetup(pt,0,false);
300 }
G4TransportationManager * tmanager
G4Navigator * GetNavigatorForTracking() const
TMarker * pt
Definition: egs.C:25
virtual G4VPhysicalVolume * LocateGlobalPointAndSetup(const G4ThreeVector &point, const G4ThreeVector *direction=0, const G4bool pRelativeSearch=true, const G4bool ignoreDirection=true)
Definition: G4Navigator.cc:125
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetCheckMode()

void G4GeometryMessenger::SetCheckMode ( G4String  newValue)
private

Definition at line 317 of file G4GeometryMessenger.cc.

318 {
319  G4bool mode = chkCmd->GetNewBoolValue(input);
321  navigator->CheckMode(mode);
322 }
static G4bool GetNewBoolValue(const char *paramString)
bool G4bool
Definition: G4Types.hh:79
G4TransportationManager * tmanager
G4Navigator * GetNavigatorForTracking() const
void CheckMode(G4bool mode)
G4UIcmdWithABool * chkCmd
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetNewValue()

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

Reimplemented from G4UImessenger.

Definition at line 214 of file G4GeometryMessenger.cc.

215 {
216  if (command == resCmd) {
217  ResetNavigator();
218  }
219  else if (command == verbCmd) {
220  SetVerbosity( newValues );
221  }
222  else if (command == chkCmd) {
223  SetCheckMode( newValues );
224  }
225  else if (command == tolCmd) {
226  Init();
227  tol = tolCmd->GetNewDoubleValue( newValues )
228  * tolCmd->GetNewUnitValue( newValues );
230  }
231  else if (command == verCmd) {
232  Init();
233  tvolume->SetVerbosity(verCmd->GetNewBoolValue( newValues ));
234  }
235  else if (command == rslCmd) {
236  Init();
237  tvolume->SetResolution(rslCmd->GetNewIntValue( newValues ));
238  }
239  else if (command == rcsCmd) {
240  recLevel = rcsCmd->GetNewIntValue( newValues );
241  }
242  else if (command == rcdCmd) {
243  recDepth = rcdCmd->GetNewIntValue( newValues );
244  }
245  else if (command == errCmd) {
246  Init();
248  }
249  else if (command == recCmd) {
250  Init();
251  G4cout << "Running geometry overlaps check..." << G4endl;
253  G4cout << "Geometry overlaps check completed !" << G4endl;
254  }
255 }
void SetCheckMode(G4String newValue)
void SetVerbosity(G4String newValue)
G4UIcmdWithAnInteger * errCmd
G4UIcmdWithADoubleAndUnit * tolCmd
void SetResolution(G4int points)
void SetVerbosity(G4bool verbosity)
static G4int GetNewIntValue(const char *paramString)
G4UIcmdWithAnInteger * verbCmd
void SetTolerance(G4double tolerance)
static G4double GetNewDoubleValue(const char *paramString)
static G4bool GetNewBoolValue(const char *paramString)
G4UIcmdWithAnInteger * rcsCmd
G4GLOB_DLL std::ostream G4cout
G4UIcmdWithoutParameter * resCmd
G4UIcmdWithABool * verCmd
G4UIcmdWithAnInteger * rcdCmd
G4UIcmdWithoutParameter * recCmd
#define G4endl
Definition: G4ios.hh:61
void SetErrorsThreshold(G4int max)
G4UIcmdWithAnInteger * rslCmd
static G4double GetNewUnitValue(const char *paramString)
G4GeomTestVolume * tvolume
G4UIcmdWithABool * chkCmd
Here is the call graph for this function:

◆ SetPushFlag()

void G4GeometryMessenger::SetPushFlag ( G4String  newValue)
private

Definition at line 328 of file G4GeometryMessenger.cc.

329 {
330  G4bool mode = pchkCmd->GetNewBoolValue(input);
332  navigator->SetPushVerbosity(mode);
333 }
static G4bool GetNewBoolValue(const char *paramString)
bool G4bool
Definition: G4Types.hh:79
G4TransportationManager * tmanager
G4Navigator * GetNavigatorForTracking() const
G4UIcmdWithABool * pchkCmd
void SetPushVerbosity(G4bool mode)
Here is the call graph for this function:

◆ SetVerbosity()

void G4GeometryMessenger::SetVerbosity ( G4String  newValue)
private

Definition at line 306 of file G4GeometryMessenger.cc.

307 {
308  G4int level = verbCmd->GetNewIntValue(input);
310  navigator->SetVerboseLevel(level);
311 }
static G4int GetNewIntValue(const char *paramString)
G4UIcmdWithAnInteger * verbCmd
int G4int
Definition: G4Types.hh:78
void SetVerboseLevel(G4int level)
G4TransportationManager * tmanager
G4Navigator * GetNavigatorForTracking() const
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ chkCmd

G4UIcmdWithABool* G4GeometryMessenger::chkCmd
private

Definition at line 79 of file G4GeometryMessenger.hh.

◆ errCmd

G4UIcmdWithAnInteger * G4GeometryMessenger::errCmd
private

Definition at line 82 of file G4GeometryMessenger.hh.

◆ geodir

G4UIdirectory* G4GeometryMessenger::geodir
private

Definition at line 78 of file G4GeometryMessenger.hh.

◆ navdir

G4UIdirectory * G4GeometryMessenger::navdir
private

Definition at line 78 of file G4GeometryMessenger.hh.

◆ pchkCmd

G4UIcmdWithABool * G4GeometryMessenger::pchkCmd
private

Definition at line 79 of file G4GeometryMessenger.hh.

◆ rcdCmd

G4UIcmdWithAnInteger * G4GeometryMessenger::rcdCmd
private

Definition at line 82 of file G4GeometryMessenger.hh.

◆ rcsCmd

G4UIcmdWithAnInteger * G4GeometryMessenger::rcsCmd
private

Definition at line 82 of file G4GeometryMessenger.hh.

◆ recCmd

G4UIcmdWithoutParameter* G4GeometryMessenger::recCmd
private

Definition at line 80 of file G4GeometryMessenger.hh.

◆ recDepth

G4int G4GeometryMessenger::recDepth
private

Definition at line 85 of file G4GeometryMessenger.hh.

◆ recLevel

G4int G4GeometryMessenger::recLevel
private

Definition at line 85 of file G4GeometryMessenger.hh.

◆ resCmd

G4UIcmdWithoutParameter * G4GeometryMessenger::resCmd
private

Definition at line 80 of file G4GeometryMessenger.hh.

◆ rslCmd

G4UIcmdWithAnInteger * G4GeometryMessenger::rslCmd
private

Definition at line 82 of file G4GeometryMessenger.hh.

◆ testdir

G4UIdirectory * G4GeometryMessenger::testdir
private

Definition at line 78 of file G4GeometryMessenger.hh.

◆ tmanager

G4TransportationManager* G4GeometryMessenger::tmanager
private

Definition at line 87 of file G4GeometryMessenger.hh.

◆ tol

G4double G4GeometryMessenger::tol
private

Definition at line 84 of file G4GeometryMessenger.hh.

◆ tolCmd

G4UIcmdWithADoubleAndUnit* G4GeometryMessenger::tolCmd
private

Definition at line 81 of file G4GeometryMessenger.hh.

◆ tvolume

G4GeomTestVolume* G4GeometryMessenger::tvolume
private

Definition at line 88 of file G4GeometryMessenger.hh.

◆ verbCmd

G4UIcmdWithAnInteger* G4GeometryMessenger::verbCmd
private

Definition at line 82 of file G4GeometryMessenger.hh.

◆ verCmd

G4UIcmdWithABool * G4GeometryMessenger::verCmd
private

Definition at line 79 of file G4GeometryMessenger.hh.


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