#include <G4GeometryMessenger.hh>
Inheritance diagram for G4GeometryMessenger:
Public Member Functions | |
G4GeometryMessenger (G4TransportationManager *tman) | |
~G4GeometryMessenger () | |
void | SetNewValue (G4UIcommand *command, G4String newValues) |
G4String | GetCurrentValue (G4UIcommand *command) |
Definition at line 61 of file G4GeometryMessenger.hh.
G4GeometryMessenger::G4GeometryMessenger | ( | G4TransportationManager * | tman | ) |
Definition at line 62 of file G4GeometryMessenger.cc.
References G4UIcommand::AvailableForStates(), G4State_Idle, G4UIcmdWith3VectorAndUnit::SetDefaultUnit(), G4UIcmdWithADoubleAndUnit::SetDefaultUnit(), G4UIcmdWithADouble::SetDefaultValue(), G4UIcmdWith3Vector::SetDefaultValue(), G4UIcmdWithADoubleAndUnit::SetDefaultValue(), G4UIcmdWithABool::SetDefaultValue(), G4UIcmdWithAnInteger::SetDefaultValue(), G4UIcommand::SetGuidance(), G4UIcmdWithADouble::SetParameterName(), G4UIcmdWith3Vector::SetParameterName(), G4UIcmdWith3VectorAndUnit::SetParameterName(), G4UIcmdWithADoubleAndUnit::SetParameterName(), G4UIcmdWithABool::SetParameterName(), G4UIcmdWithAnInteger::SetParameterName(), G4UIcommand::SetRange(), and G4UIcmdWithADoubleAndUnit::SetUnitCategory().
00063 : x(0,0,0), p(0,0,1), grdRes(100,100,100), cylRes(90,50,50), 00064 cylfZ(0.8), cylfR(0.8), newtol(false), tol(1E-4), // mm 00065 recLevel(0), recDepth(-1), tmanager(tman), tlogger(0), tvolume(0) 00066 { 00067 geodir = new G4UIdirectory( "/geometry/" ); 00068 geodir->SetGuidance( "Geometry control commands." ); 00069 00070 // 00071 // Geometry navigator commands 00072 // 00073 navdir = new G4UIdirectory( "/geometry/navigator/" ); 00074 navdir->SetGuidance( "Geometry navigator control setup." ); 00075 00076 resCmd = new G4UIcmdWithoutParameter( "/geometry/navigator/reset", this ); 00077 resCmd->SetGuidance( "Reset navigator and navigation history." ); 00078 resCmd->SetGuidance( "NOTE: must be called only after kernel has been" ); 00079 resCmd->SetGuidance( " initialized once through the run manager!" ); 00080 resCmd->AvailableForStates(G4State_Idle); 00081 00082 verbCmd = new G4UIcmdWithAnInteger( "/geometry/navigator/verbose", this ); 00083 verbCmd->SetGuidance( "Set run-time verbosity for the navigator." ); 00084 verbCmd->SetGuidance(" 0 : Silent (default)"); 00085 verbCmd->SetGuidance(" 1 : Display volume positioning and step lengths"); 00086 verbCmd->SetGuidance(" 2 : Display step/safety info on point location"); 00087 verbCmd->SetGuidance(" 3 : Display minimal state at -every- step"); 00088 verbCmd->SetGuidance(" 4 : Maximum verbosity (very detailed!)"); 00089 verbCmd->SetGuidance( "NOTE: this command has effect -only- if Geant4 has" ); 00090 verbCmd->SetGuidance( " been installed with the G4VERBOSE flag set!" ); 00091 verbCmd->SetParameterName("level",true); 00092 verbCmd->SetDefaultValue(0); 00093 verbCmd->SetRange("level >=0 && level <=4"); 00094 00095 chkCmd = new G4UIcmdWithABool( "/geometry/navigator/check_mode", this ); 00096 chkCmd->SetGuidance( "Set navigator in -check_mode- state." ); 00097 chkCmd->SetGuidance( "This will cause extra checks to be applied during" ); 00098 chkCmd->SetGuidance( "navigation. More strict and less tolerant conditions" ); 00099 chkCmd->SetGuidance( "are applied. A run-time performance penalty may be" ); 00100 chkCmd->SetGuidance( "observed when the -check_mode- state is activated." ); 00101 chkCmd->SetGuidance( "NOTE: this command has effect -only- if Geant4 has" ); 00102 chkCmd->SetGuidance( " been installed with the G4VERBOSE flag set!" ); 00103 chkCmd->SetParameterName("checkFlag",true); 00104 chkCmd->SetDefaultValue(false); 00105 chkCmd->AvailableForStates(G4State_Idle); 00106 00107 pchkCmd = new G4UIcmdWithABool( "/geometry/navigator/push_notify", this ); 00108 pchkCmd->SetGuidance( "Set navigator verbosity push notifications." ); 00109 pchkCmd->SetGuidance( "This allows to disable/re-enable verbosity in" ); 00110 pchkCmd->SetGuidance( "navigation, when tracks may get stuck and require" ); 00111 pchkCmd->SetGuidance( "one artificial push along the direction by the" ); 00112 pchkCmd->SetGuidance( "navigator. Notification is active by default." ); 00113 pchkCmd->SetGuidance( "NOTE: this command has effect -only- if Geant4 has" ); 00114 pchkCmd->SetGuidance( " been installed with the G4VERBOSE flag set!" ); 00115 pchkCmd->SetParameterName("pushFlag",true); 00116 pchkCmd->SetDefaultValue(true); 00117 pchkCmd->AvailableForStates(G4State_Idle); 00118 00119 // 00120 // Geometry verification test commands 00121 // 00122 testdir = new G4UIdirectory( "/geometry/test/" ); 00123 testdir->SetGuidance( "Geometry verification control setup." ); 00124 testdir->SetGuidance( "Helps in detecting possible overlapping regions." ); 00125 00126 tolCmd = new G4UIcmdWithADoubleAndUnit( "/geometry/test/tolerance",this ); 00127 tolCmd->SetGuidance( "Set error tolerance value." ); 00128 tolCmd->SetGuidance( "Initial default value: 1E-4*mm." ); 00129 tolCmd->SetParameterName( "Tolerance", true, true ); 00130 tolCmd->SetDefaultValue( 1E-4 ); 00131 tolCmd->SetDefaultUnit( "mm" ); 00132 tolCmd->SetUnitCategory( "Length" ); 00133 00134 posCmd = new G4UIcmdWith3VectorAndUnit( "/geometry/test/position", this ); 00135 posCmd->SetGuidance( "Set starting position for the line_test." ); 00136 posCmd->SetParameterName( "X", "Y", "Z", true, true ); 00137 posCmd->SetDefaultUnit( "cm" ); 00138 00139 dirCmd = new G4UIcmdWith3VectorAndUnit( "/geometry/test/direction", this ); 00140 dirCmd->SetGuidance( "Set momentum direction for the line_test." ); 00141 dirCmd->SetGuidance( "Direction needs not to be a unit vector." ); 00142 dirCmd->SetParameterName( "Px", "Py", "Pz", true, true ); 00143 dirCmd->SetRange( "Px != 0 || Py != 0 || Pz != 0" ); 00144 00145 linCmd = new G4UIcmdWithABool( "/geometry/test/line_test", this ); 00146 linCmd->SetGuidance( "Performs test along a single specified direction/position." ); 00147 linCmd->SetGuidance( "Use position and direction commands to change default." ); 00148 linCmd->SetGuidance( "Initial default: position(0,0,0), direction(0,0,1)." ); 00149 linCmd->SetGuidance( "If recursion flag is set to TRUE, the intersection checks" ); 00150 linCmd->SetGuidance( "will be performed recursively in the geometry tree." ); 00151 linCmd->SetParameterName("recursionFlag",true); 00152 linCmd->SetDefaultValue(false); 00153 linCmd->AvailableForStates(G4State_Idle); 00154 00155 grzCmd = new G4UIcmdWith3Vector( "/geometry/test/grid_cells", this ); 00156 grzCmd->SetGuidance( "Define resolution of grid geometry as number of cells," ); 00157 grzCmd->SetGuidance( "specifying them for each dimension, X, Y and Z." ); 00158 grzCmd->SetGuidance( "Will be applied to grid_test and recursive_test commands." ); 00159 grzCmd->SetGuidance( "Initial default values: X=100, Y=100, Z=100." ); 00160 grzCmd->SetParameterName( "X", "Y", "Z", true, true ); 00161 grzCmd->SetDefaultValue( G4ThreeVector(100, 100, 100) ); 00162 00163 grdCmd = new G4UIcmdWithABool( "/geometry/test/grid_test", this ); 00164 grdCmd->SetGuidance( "Start running the default grid test." ); 00165 grdCmd->SetGuidance( "A grid of lines parallel to a cartesian axis is used;" ); 00166 grdCmd->SetGuidance( "By default, only direct daughters of the mother volumes are checked." ); 00167 grdCmd->SetGuidance( "If recursion flag is set to TRUE, the intersection checks" ); 00168 grdCmd->SetGuidance( "will be performed recursively in the geometry tree." ); 00169 grdCmd->SetGuidance( "NOTE: the recursion may take a very long time," ); 00170 grdCmd->SetGuidance( " depending on the geometry complexity !"); 00171 grdCmd->SetParameterName("recursionFlag",true); 00172 grdCmd->SetDefaultValue(false); 00173 grdCmd->AvailableForStates(G4State_Idle); 00174 00175 cyzCmd = new G4UIcmdWith3Vector( "/geometry/test/cylinder_geometry", this ); 00176 cyzCmd->SetGuidance( "Define details of the cylinder geometry, specifying:" ); 00177 cyzCmd->SetGuidance( " nPhi - number of lines per Phi" ); 00178 cyzCmd->SetGuidance( " nZ - number of Z points" ); 00179 cyzCmd->SetGuidance( " nRho - number of Rho points" ); 00180 cyzCmd->SetGuidance( "Will be applied to the cylinder_test command." ); 00181 cyzCmd->SetGuidance( "Initial default values: nPhi=90, nZ=50, nRho=50." ); 00182 cyzCmd->SetParameterName( "nPhi", "nZ", "nRho", true, true ); 00183 cyzCmd->SetDefaultValue( G4ThreeVector(90, 50, 50) ); 00184 00185 cfzCmd = new G4UIcmdWithADouble( "/geometry/test/cylinder_scaleZ", this ); 00186 cfzCmd->SetGuidance( "Define the resolution of the cylinder geometry, specifying" ); 00187 cfzCmd->SetGuidance( "the fraction scale for points along Z." ); 00188 cfzCmd->SetGuidance( "Initial default values: fracZ=0.8" ); 00189 cfzCmd->SetParameterName("fracZ",true); 00190 cfzCmd->SetDefaultValue(0.8); 00191 00192 cfrCmd = new G4UIcmdWithADouble( "/geometry/test/cylinder_scaleRho", this ); 00193 cfrCmd->SetGuidance( "Define the resolution of the cylinder geometry, specifying" ); 00194 cfrCmd->SetGuidance( "the fraction scale for points along Rho." ); 00195 cfrCmd->SetGuidance( "Initial default values: fracRho=0.8" ); 00196 cfrCmd->SetParameterName("fracRho",true); 00197 cfrCmd->SetDefaultValue(0.8); 00198 00199 cylCmd = new G4UIcmdWithABool( "/geometry/test/cylinder_test", this ); 00200 cylCmd->SetGuidance( "Start running the cylinder test." ); 00201 cylCmd->SetGuidance( "A set of lines in a cylindrical pattern of gradually" ); 00202 cylCmd->SetGuidance( "increasing mesh size." ); 00203 cylCmd->SetGuidance( "By default, only direct daughters of the mother volumes are checked." ); 00204 cylCmd->SetGuidance( "If recursion flag is set to TRUE, the intersection checks" ); 00205 cylCmd->SetGuidance( "will be performed recursively in the geometry tree." ); 00206 cylCmd->SetGuidance( "NOTE: the recursion may take a very long time," ); 00207 cylCmd->SetGuidance( " depending on the geometry complexity !"); 00208 cylCmd->SetParameterName("recursionFlag",true); 00209 cylCmd->SetDefaultValue(false); 00210 cylCmd->AvailableForStates(G4State_Idle); 00211 00212 rcsCmd = new G4UIcmdWithAnInteger( "/geometry/test/recursion_start", this ); 00213 rcsCmd->SetGuidance( "Set the initial level in the geometry tree for recursion." ); 00214 rcsCmd->SetGuidance( "recursive_test will then start from the specified level." ); 00215 rcsCmd->SetParameterName("initial_level",true); 00216 rcsCmd->SetDefaultValue(0); 00217 00218 rcdCmd = new G4UIcmdWithAnInteger( "/geometry/test/recursion_depth", this ); 00219 rcdCmd->SetGuidance( "Set the depth in the geometry tree for recursion." ); 00220 rcdCmd->SetGuidance( "recursive_test will then stop after reached the specified depth." ); 00221 rcdCmd->SetGuidance( "By default, recursion will proceed for the whole depth." ); 00222 rcdCmd->SetParameterName("recursion_depth",true); 00223 rcdCmd->SetDefaultValue(-1); 00224 00225 // Obsolete verification commands ... 00226 00227 runCmd = new G4UIcmdWithABool( "/geometry/test/run", this ); 00228 runCmd->SetGuidance( "Start running the default grid test." ); 00229 runCmd->SetGuidance( "Same as the grid_test command." ); 00230 runCmd->SetGuidance( "If recursion flag is set to TRUE, the intersection checks" ); 00231 runCmd->SetGuidance( "will be performed recursively in the geometry tree." ); 00232 runCmd->SetGuidance( "NOTE: the recursion may take a very long time," ); 00233 runCmd->SetGuidance( " depending on the geometry complexity !"); 00234 runCmd->SetParameterName("recursionFlag",true); 00235 runCmd->SetDefaultValue(false); 00236 runCmd->AvailableForStates(G4State_Idle); 00237 00238 recCmd = new G4UIcmdWithoutParameter( "/geometry/test/recursive_test", this ); 00239 recCmd->SetGuidance( "Start running the recursive grid test." ); 00240 recCmd->SetGuidance( "A grid of lines along a cartesian axis is recursively" ); 00241 recCmd->SetGuidance( "to all daughters and daughters of daughters, etc." ); 00242 recCmd->SetGuidance( "NOTE: it may take a very long time," ); 00243 recCmd->SetGuidance( " depending on the geometry complexity !"); 00244 recCmd->AvailableForStates(G4State_Idle); 00245 }
G4GeometryMessenger::~G4GeometryMessenger | ( | ) |
Definition at line 250 of file G4GeometryMessenger.cc.
00251 { 00252 delete linCmd; delete posCmd; delete dirCmd; 00253 delete grzCmd; delete grdCmd; delete recCmd; delete runCmd; 00254 delete rcsCmd; delete rcdCmd; 00255 delete cyzCmd; delete cfzCmd; delete cfrCmd; delete cylCmd; 00256 delete tolCmd; 00257 delete resCmd; delete verbCmd; delete pchkCmd; delete chkCmd; 00258 delete geodir; delete navdir; delete testdir; 00259 delete tvolume; delete tlogger; 00260 }
G4String G4GeometryMessenger::GetCurrentValue | ( | G4UIcommand * | command | ) | [virtual] |
Reimplemented from G4UImessenger.
Definition at line 369 of file G4GeometryMessenger.cc.
References G4UIcommand::ConvertToString().
00370 { 00371 G4String cv = ""; 00372 if (command == posCmd) { 00373 cv = posCmd->ConvertToString( x, "cm" ); 00374 } 00375 else if (command == tolCmd) { 00376 cv = tolCmd->ConvertToString( tol, "mm" ); 00377 } 00378 else if (command == dirCmd) { 00379 cv = dirCmd->ConvertToString( p, "GeV" ); 00380 } 00381 return cv; 00382 }
void G4GeometryMessenger::SetNewValue | ( | G4UIcommand * | command, | |
G4String | newValues | |||
) | [virtual] |
Reimplemented from G4UImessenger.
Definition at line 291 of file G4GeometryMessenger.cc.
References DBL_MIN, G4cerr, G4endl, G4UIcmdWith3Vector::GetNew3VectorValue(), G4UIcmdWith3VectorAndUnit::GetNew3VectorValue(), G4UIcmdWithABool::GetNewBoolValue(), G4UIcmdWithADouble::GetNewDoubleValue(), G4UIcmdWithADoubleAndUnit::GetNewDoubleValue(), and G4UIcmdWithAnInteger::GetNewIntValue().
00292 { 00293 if (command == resCmd) { 00294 ResetNavigator(); 00295 } 00296 else if (command == verbCmd) { 00297 SetVerbosity( newValues ); 00298 } 00299 else if (command == chkCmd) { 00300 SetCheckMode( newValues ); 00301 } 00302 else if (command == posCmd) { 00303 x = posCmd->GetNew3VectorValue( newValues ); 00304 } 00305 else if (command == dirCmd) { 00306 p = dirCmd->GetNew3VectorValue( newValues ); 00307 if (p.mag() < DBL_MIN) { 00308 G4cerr << "Please specify non-zero momentum!" << G4endl; 00309 p = G4ThreeVector(0,0,1); 00310 } 00311 } 00312 else if (command == tolCmd) { 00313 tol = tolCmd->GetNewDoubleValue( newValues ); 00314 newtol = true; 00315 } 00316 else if (command == linCmd) { 00317 Init(); 00318 if (linCmd->GetNewBoolValue( newValues )) 00319 RecursiveLineTest(); 00320 else 00321 LineTest(); 00322 } 00323 else if ((command == grdCmd) || (command == runCmd)){ 00324 Init(); 00325 if (grdCmd->GetNewBoolValue( newValues ) || runCmd->GetNewBoolValue( newValues )) 00326 RecursiveGridTest(); 00327 else 00328 GridTest(); 00329 } 00330 else if (command == grzCmd) { 00331 grdRes = grzCmd->GetNew3VectorValue( newValues ); 00332 if (grdRes.mag() < DBL_MIN) { 00333 G4cerr << "Please specify non-zero resolution!" << G4endl; 00334 grdRes = G4ThreeVector(100,100,100); 00335 } 00336 } 00337 else if (command == cyzCmd) { 00338 cylRes = cyzCmd->GetNew3VectorValue( newValues ); 00339 } 00340 else if (command == cfzCmd) { 00341 cylfZ = cfzCmd->GetNewDoubleValue( newValues ); 00342 } 00343 else if (command == cfrCmd) { 00344 cylfR = cfrCmd->GetNewDoubleValue( newValues ); 00345 } 00346 else if (command == rcsCmd) { 00347 recLevel = rcsCmd->GetNewIntValue( newValues ); 00348 } 00349 else if (command == rcdCmd) { 00350 recDepth = rcdCmd->GetNewIntValue( newValues ); 00351 } 00352 else if (command == recCmd) { 00353 Init(); 00354 RecursiveGridTest(); 00355 } 00356 else if (command == cylCmd) { 00357 Init(); 00358 if (cylCmd->GetNewBoolValue( newValues )) 00359 RecursiveCylinderTest(); 00360 else 00361 CylinderTest(); 00362 } 00363 }