58 geodir->SetGuidance(
"Geometry control commands." );
64 navdir->SetGuidance(
"Geometry navigator control setup." );
67 resCmd->SetGuidance(
"Reset navigator and navigation history." );
68 resCmd->SetGuidance(
"NOTE: must be called only after kernel has been" );
69 resCmd->SetGuidance(
" initialized once through the run manager!" );
73 verbCmd->SetGuidance(
"Set run-time verbosity for the navigator." );
74 verbCmd->SetGuidance(
" 0 : Silent (default)");
75 verbCmd->SetGuidance(
" 1 : Display volume positioning and step lengths");
76 verbCmd->SetGuidance(
" 2 : Display step/safety info on point location");
77 verbCmd->SetGuidance(
" 3 : Display minimal state at -every- step");
78 verbCmd->SetGuidance(
" 4 : Maximum verbosity (very detailed!)");
79 verbCmd->SetGuidance(
"NOTE: this command has effect -only- if Geant4 has" );
80 verbCmd->SetGuidance(
" been installed with the G4VERBOSE flag set!" );
81 verbCmd->SetParameterName(
"level",
true);
82 verbCmd->SetDefaultValue(0);
83 verbCmd->SetRange(
"level >=0 && level <=4");
86 chkCmd->SetGuidance(
"Set navigator in -check_mode- state." );
87 chkCmd->SetGuidance(
"This will cause extra checks to be applied during" );
88 chkCmd->SetGuidance(
"navigation. More strict and less tolerant conditions" );
89 chkCmd->SetGuidance(
"are applied. A run-time performance penalty may be" );
90 chkCmd->SetGuidance(
"observed when the -check_mode- state is activated." );
91 chkCmd->SetGuidance(
"NOTE: this command has effect -only- if Geant4 has" );
92 chkCmd->SetGuidance(
" been installed with the G4VERBOSE flag set!" );
93 chkCmd->SetParameterName(
"checkFlag",
true);
94 chkCmd->SetDefaultValue(
false);
98 pchkCmd->SetGuidance(
"Set navigator verbosity push notifications." );
99 pchkCmd->SetGuidance(
"This allows one to disable/re-enable verbosity in" );
100 pchkCmd->SetGuidance(
"navigation, when tracks may get stuck and require" );
101 pchkCmd->SetGuidance(
"one artificial push along the direction by the" );
102 pchkCmd->SetGuidance(
"navigator. Notification is active by default." );
103 pchkCmd->SetGuidance(
"NOTE: this command has effect -only- if Geant4 has" );
104 pchkCmd->SetGuidance(
" been installed with the G4VERBOSE flag set!" );
105 pchkCmd->SetParameterName(
"pushFlag",
true);
106 pchkCmd->SetDefaultValue(
true);
113 testdir->SetGuidance(
"Geometry verification control setup." );
114 testdir->SetGuidance(
"Helps in detecting possible overlapping regions." );
117 tolCmd->SetGuidance(
"Define tolerance (in mm) by which overlaps reports" );
118 tolCmd->SetGuidance(
"should be reported. By default, all overlaps are" );
119 tolCmd->SetGuidance(
"reported, i.e. tolerance is set to: 0*mm." );
120 tolCmd->SetParameterName(
"Tolerance",
true,
true );
121 tolCmd->SetDefaultValue( 0 );
122 tolCmd->SetDefaultUnit(
"mm" );
123 tolCmd->SetUnitCategory(
"Length" );
126 verCmd->SetGuidance(
"Specify if running in verbosity mode or not." );
127 verCmd->SetGuidance(
"By default verbosity is set to ON (TRUE)." );
128 verCmd->SetParameterName(
"verbosity",
true);
129 verCmd->SetDefaultValue(
true);
133 rslCmd->SetGuidance(
"Set the number of points on surface to be generated for" );
134 rslCmd->SetGuidance(
"checking overlaps." );
135 rslCmd->SetParameterName(
"resolution",
true);
136 rslCmd->SetDefaultValue(10000);
139 rcsCmd->SetGuidance(
"Set the initial level in the geometry tree for recursion." );
140 rcsCmd->SetGuidance(
"recursive_test will then start from the specified level." );
141 rcsCmd->SetParameterName(
"initial_level",
true);
142 rcsCmd->SetDefaultValue(0);
145 rcdCmd->SetGuidance(
"Set the depth in the geometry tree for recursion." );
146 rcdCmd->SetGuidance(
"recursive_test will then stop after reached the specified depth." );
147 rcdCmd->SetGuidance(
"By default, recursion will proceed for the whole depth." );
148 rcdCmd->SetParameterName(
"recursion_depth",
true);
149 rcdCmd->SetDefaultValue(-1);
152 errCmd->SetGuidance(
"Set the maximum number of overlap errors to report" );
153 errCmd->SetGuidance(
"for each single volume being checked." );
154 errCmd->SetGuidance(
"Once reached the maximum number specified, overlaps" );
155 errCmd->SetGuidance(
"affecting that volume further than that are simply ignored." );
156 errCmd->SetParameterName(
"maximum_errors",
true);
157 errCmd->SetDefaultValue(1);
160 parCmd->SetGuidance(
"Check for overlaps in parallel worlds." );
161 parCmd->SetGuidance(
"By default, overlaps are only checked in the mass world (FALSE)." );
162 parCmd->SetParameterName(
"check_parallel",
true);
163 parCmd->SetDefaultValue(
true);
166 recCmd->SetGuidance(
"Start running the recursive overlap check." );
167 recCmd->SetGuidance(
"Volumes are recursively asked to verify for overlaps" );
168 recCmd->SetGuidance(
"for points generated on the surface against their" );
169 recCmd->SetGuidance(
"respective mother volume and sisters at the same" );
170 recCmd->SetGuidance(
"level, performing for all daughters and daughters of" );
171 recCmd->SetGuidance(
"daughters, etc." );
172 recCmd->SetGuidance(
"NOTE: it may take a very long time," );
173 recCmd->SetGuidance(
" depending on the geometry complexity !");
174 recCmd->SetGuidance(
"Specify the overlap check mode.");
175 recCmd->SetGuidance(
" placed: Check overlaps in all placed volumes (default)");
176 recCmd->SetGuidance(
" This includes every instance of repeated placements");
177 recCmd->SetGuidance(
" logical: Check overlaps only among daughters of each logical volume.");
178 recCmd->SetGuidance(
" This avoids duplicate reports and improves performance.");
179 recCmd->SetParameterName(
"check_mode",
true);
181 const std::string candidates_list = OverlapMode::placed
182 +
" " + OverlapMode::logical;
184 recCmd->SetCandidates(candidates_list.c_str());
185 recCmd->SetDefaultValue(OverlapMode::placed.c_str());
194 delete verCmd;
delete recCmd;
delete rslCmd;
195 delete resCmd;
delete rcsCmd;
delete rcdCmd;
196 delete errCmd;
delete parCmd;
delete tolCmd;
197 delete verbCmd;
delete pchkCmd;
delete chkCmd;
198 delete geodir;
delete navdir;
delete testdir;
199 for (
const auto* tvolume: tvolumes) {
delete tvolume; }
206G4GeometryMessenger::Init()
210 if (tvolumes.empty())
217 for( std::size_t i=0; i<noWorlds; ++i)
232 if (command == resCmd) {
235 else if (command == verbCmd) {
236 SetVerbosity( newValues );
238 else if (command == chkCmd) {
239 SetCheckMode( newValues );
241 else if (command == pchkCmd) {
242 SetPushFlag( newValues );
244 else if (command == tolCmd) {
246 tol = tolCmd->GetNewDoubleValue( newValues )
247 * tolCmd->GetNewUnitValue( newValues );
248 for(
auto* tvolume: tvolumes)
250 tvolume->SetTolerance(tol);
253 else if (command == verCmd) {
255 for(
auto* tvolume: tvolumes)
257 tvolume->SetVerbosity(verCmd->GetNewBoolValue( newValues ));
260 else if (command == rslCmd) {
262 for(
auto* tvolume: tvolumes)
264 tvolume->SetResolution(rslCmd->GetNewIntValue( newValues ));
267 else if (command == rcsCmd) {
268 recLevel = rcsCmd->GetNewIntValue( newValues );
270 else if (command == rcdCmd) {
271 recDepth = rcdCmd->GetNewIntValue( newValues );
273 else if (command == parCmd) {
274 checkParallelWorlds = parCmd->GetNewBoolValue( newValues );
276 else if (command == errCmd) {
278 for(
auto* tvolume: tvolumes)
280 tvolume->SetErrorsThreshold(errCmd->GetNewIntValue( newValues ));
283 else if (command == recCmd) {
285 G4cout <<
"Running geometry overlaps check..." <<
G4endl;
286 if( OverlapMode::placed == newValues ) {
287 RecursiveOverlapTest();
289 else if( OverlapMode::logical == newValues ) {
292 G4cout <<
"Geometry overlaps check completed !" <<
G4endl;
303 if (command == tolCmd)
305 cv = tolCmd->ConvertToString( tol,
"mm" );
314G4GeometryMessenger::CheckGeometry()
330G4GeometryMessenger::ResetNavigator()
339 G4Navigator* navigator = tmanager->GetNavigatorForTracking();
347G4GeometryMessenger::SetVerbosity(
const G4String& input)
349 G4int level = verbCmd->GetNewIntValue(input);
350 G4Navigator* navigator = tmanager->GetNavigatorForTracking();
358G4GeometryMessenger::SetCheckMode(
const G4String& input)
360 G4bool mode = chkCmd->GetNewBoolValue(input);
361 G4Navigator* navigator = tmanager->GetNavigatorForTracking();
363 G4PropagatorInField* pField = tmanager->GetPropagatorInField();
364 if (pField !=
nullptr) { pField->
CheckMode(mode); }
371G4GeometryMessenger::SetPushFlag(
const G4String& input)
373 G4bool mode = pchkCmd->GetNewBoolValue(input);
374 G4Navigator* navigator = tmanager->GetNavigatorForTracking();
382G4GeometryMessenger::RecursiveOverlapTest()
390 if (checkParallelWorlds)
392 for(
auto* tvolume: tvolumes)
394 tvolume->TestRecursiveOverlap( recLevel, recDepth );
399 tvolumes.front()->TestRecursiveOverlap( recLevel, recDepth );
407G4GeometryMessenger::TreeOverlapTest()
415 if (checkParallelWorlds)
417 for(
const auto* tvolume: tvolumes)
419 tvolume->TestOverlapInTree();
424 tvolumes.front()->TestOverlapInTree();
CLHEP::Hep3Vector G4ThreeVector
G4GLOB_DLL std::ostream G4cout
G4GeomTestVolume allows to check for inconsistencies in the geometric boundaries of a physical volume...
G4GeometryManager is a singleton class responsible for high level geometrical functions,...
G4bool IsGeometryClosed()
static G4GeometryManager * GetInstance()
G4bool CloseGeometry(G4bool pOptimise=true, G4bool verbose=false, G4VPhysicalVolume *vol=nullptr)
void OpenGeometry(G4VPhysicalVolume *vol=nullptr)
G4GeometryMessenger(G4TransportationManager *tman)
void SetNewValue(G4UIcommand *command, G4String newValues) override
~G4GeometryMessenger() override
G4String GetCurrentValue(G4UIcommand *command) override
void SetVerboseLevel(G4int level)
void SetPushVerbosity(G4bool mode)
void CheckMode(G4bool mode)
virtual G4VPhysicalVolume * LocateGlobalPointAndSetup(const G4ThreeVector &point, const G4ThreeVector *direction=nullptr, const G4bool pRelativeSearch=true, const G4bool ignoreDirection=true)
void CheckMode(G4bool mode)
G4TransportationManager is a singleton class which stores the navigator used by the transportation pr...
std::vector< G4VPhysicalVolume * >::iterator GetWorldsIterator()
std::size_t GetNoWorlds() const