14 #include "G4UIcommand.hh"
15 #include "G4UIparameter.hh"
16 #include "G4UIdirectory.hh"
17 #include "G4UIcmdWithAString.hh"
18 #include "G4UIcmdWithAnInteger.hh"
19 #include "G4UIcmdWithoutParameter.hh"
24 G4UIparameter* para =
nullptr;
26 geomDir =
new G4UIdirectory(
"/eAST/geometry/");
27 geomDir->SetGuidance(
"eAST geometry commands");
29 listSolidCmd =
new G4UIcmdWithAnInteger(
"/eAST/geometry/listSolids",
this);
30 listSolidCmd->SetGuidance(
"List all the registered solids");
34 listSolidCmd->AvailableForStates(G4State_Init,G4State_Idle);
37 listLogVolCmd =
new G4UIcmdWithAnInteger(
"/eAST/geometry/listLogicalVolumes",
this);
38 listLogVolCmd->SetGuidance(
"List all the registered logical volumes");
45 listPhysVolCmd =
new G4UIcmdWithAnInteger(
"/eAST/geometry/listPhysicalVolumes",
this);
46 listPhysVolCmd->SetGuidance(
"List all the registered physical volumes");
53 listRegionCmd =
new G4UIcmdWithAnInteger(
"/eAST/geometry/listRegions",
this);
54 listRegionCmd->SetGuidance(
"List all the registered regions");
63 checkOverlapCmd->SetGuidance(
"Check volume overlap with existing volumes");
64 checkOverlapCmd->SetGuidance(
" i.e. with mother volume for protrusion and with other siblings for overlap.");
65 checkOverlapCmd->SetGuidance(
" - This command is valid only for placement and parameterized volumes. If this command is");
66 checkOverlapCmd->SetGuidance(
" used for other physical volume type, e.g. replica, command will be simply ignored.");
67 checkOverlapCmd->SetGuidance(
" If \"**ALL**\" is used as the volume name, all physical volumes are examined (SLOW!!).");
68 checkOverlapCmd->SetGuidance(
" - nSpots specifies number of spots on the surface of the volume to be examined.");
69 checkOverlapCmd->SetGuidance(
" The more spots used, the more chances to detect overlaps, but the more time it takes.");
70 checkOverlapCmd->SetGuidance(
" - maxErr specifies maximum number of errors to be generated (default 1) before quiting.");
71 para =
new G4UIparameter(
"physVol",
's',
true);
72 para->SetDefaultValue(
"**ALL**");
74 para =
new G4UIparameter(
"nSpots",
'i',
true);
75 para->SetDefaultValue(1000);
76 para->SetGuidance(
"Number of trial spots on the volume surface");
78 para =
new G4UIparameter(
"maxErr",
'i',
true);
79 para->SetDefaultValue(1);
80 para->SetParameterRange(
"maxErr > 0");
81 para->SetGuidance(
"Maxinum number of report to be generated");
83 para =
new G4UIparameter(
"tolerance",
'd',
true);
84 para->SetDefaultValue(0.);
85 para->SetParameterRange(
"tolerance >= 0.");
86 para->SetGuidance(
"Tolerance (default 0.)");
88 para =
new G4UIparameter(
"unit",
's',
true);
89 para->SetDefaultUnit(
"mm");
97 listMatCmd =
new G4UIcmdWithAString(
"/eAST/material/list",
this);
98 listMatCmd->SetGuidance(
"List material property");
99 listMatCmd->SetGuidance(
" If material name is not specified, this command list all registered materials");
102 listMatCmd->AvailableForStates(G4State_Init,G4State_Idle);
105 dumpMatCmd =
new G4UIcmdWithoutParameter(
"/eAST/material/dumpNistMaterials",
this);
106 dumpMatCmd->SetGuidance(
"List all pre-defined material names in G4NistManager.");
107 dumpMatCmd->SetGuidance(
" Note : a material has to be instantiated with /eAST/material/create before setting it to a logical volume");
108 dumpMatCmd->AvailableForStates(G4State_Init,G4State_Idle);
111 createMatCmd =
new G4UIcmdWithAString(
"/eAST/material/create",
this);
112 createMatCmd->SetGuidance(
"Instantiate a material defined in G4NistManager");
113 createMatCmd->SetGuidance(
" If the material has already existed, this command does nothing.");
115 createMatCmd->AvailableForStates(G4State_Init,G4State_Idle);
118 getMatCmd =
new G4UIcmdWithAString(
"/eAST/material/show",
this);
119 getMatCmd->SetGuidance(
"Show the current material of the specified logical volume");
120 getMatCmd->SetParameterName(
"logVol",
false);
121 getMatCmd->AvailableForStates(G4State_Init,G4State_Idle);
124 setMatCmd =
new G4UIcommand(
"/eAST/material/set",
this);
125 setMatCmd->SetGuidance(
"Set the material to the logical volume. The material has to be instantiated in advance.");
126 setMatCmd->SetGuidance(
" [usage] /eAST/material/set logicalVolumeName materialName");
127 para =
new G4UIparameter(
"logVol",
's',
false);
129 para =
new G4UIparameter(
"matName",
's',
false);
131 setMatCmd->AvailableForStates(G4State_Init,G4State_Idle);
152 #include "G4Tokenizer.hh"
166 G4Tokenizer next(val);
167 G4String physVolName = next();
168 G4int nSpots = StoI(next());
169 G4int maxErr = StoI(next());
170 G4String tolStr = next();
171 G4double tol = StoD(tolStr);
181 G4ExceptionDescription ed;
182 ed <<
"Physical volume <" << physVolName <<
"> is not defined. Command ignored.";
183 cmd->CommandFailed(ed);
196 G4ExceptionDescription ed;
197 ed <<
"<" << val <<
"> is not defined. If necessary, create it with /eAST/material/create command.";
198 cmd->CommandFailed(ed);
209 G4ExceptionDescription ed;
210 ed <<
"The material name <" << val <<
"> is not defined in G4NistManager.";
211 cmd->CommandFailed(ed);
219 G4ExceptionDescription ed;
220 ed <<
"<" << val <<
"> is not a name of registered logical volume.\n"
221 <<
"Check existing logical volumes with /eAST/geometry/listLogicalVolumes command.";
222 cmd->CommandFailed(ed);
227 G4Tokenizer next(val);
228 G4String logVolName = next();
229 G4String matName = next();
233 G4ExceptionDescription ed;
236 ed <<
"<" << logVolName <<
"> is not a name of registered logical volume.\n"
237 <<
"Check existing logical volumes with /eAST/geometry/listLogicalVolumes command.\n";
241 ed <<
"<" << matName <<
"> is not defined. If necessary, create it with /eAST/material/create command.";
243 cmd->CommandFailed(ed);