56 scoreDir->
SetGuidance(
"Interactive scoring commands.");
70 meshCreateDir->
SetGuidance(
" Mesh creation commands.");
74 meshBoxCreateCmd->
SetGuidance(
"Create scoring box mesh.");
77 meshCylinderCreateCmd =
79 meshCylinderCreateCmd->
SetGuidance(
"Create scoring mesh.");
82 meshRWLogVolCreateCmd =
83 new G4UIcommand(
"/score/create/realWorldLogVol",
this);
85 "Define scorers to a logical volume defined in the real world.");
87 " - Name of the specified logical volume is used as the mesh name.");
89 " - /score/mesh commands do not affect for this mesh.");
91 " - If copyNumberLevel is set, the copy number of that-level higher");
93 " in the geometrical hierarchy is used as the index.");
101 probeCreateCmd =
new G4UIcommand(
"/score/create/probe",
this);
102 probeCreateCmd->
SetGuidance(
"Define scoring probe.");
104 " halfSize defines the half-width of the probing cube.");
124 meshDir->
SetGuidance(
" Mesh processing commands.");
127 mBoxSizeCmd->
SetGuidance(
"Define size of the scoring mesh.");
130 mBoxSizeCmd->
SetRange(
"Di>0. && Dj>0. && Dk>0.");
133 mCylinderSizeCmd =
new G4UIcommand(
"/score/mesh/cylinderSize",
this);
134 mCylinderSizeCmd->
SetGuidance(
"Define size of the scoring mesh.");
148 mCylinderRMinCmd->
SetGuidance(
"Define the inner radius of the tube mesh.");
149 mCylinderRMinCmd->
SetGuidance(
"This command is not needed for cylinder mesh");
151 mCylinderRMinCmd->
SetRange(
"RMin>=0.");
154 mCylinderAngleCmd =
new G4UIcommand(
"/score/mesh/cylinderAngles",
this);
156 "Define starting angle and span for tube segment mesh.");
158 "This command is not needed for cylinder mesh");
169 mBinCmd =
new G4UIcommand(
"/score/mesh/nBin",
this);
170 mBinCmd->
SetGuidance(
"Define segments of the scoring mesh.");
172 mBinCmd->
SetGuidance(
" In case of boxMesh, parameters are given in");
173 mBinCmd->
SetGuidance(
" Ni :(int) Number of bins i (in x-axis) ");
174 mBinCmd->
SetGuidance(
" Nj :(int) Number of bins j (in y-axis) ");
175 mBinCmd->
SetGuidance(
" Nk :(int) Number of bins k (in z-axis) ");
176 mBinCmd->
SetGuidance(
" In case of cylinderMesh, parameters are given in");
177 mBinCmd->
SetGuidance(
" Nr :(int) Number of bins in radial axis ");
178 mBinCmd->
SetGuidance(
" Nz :(int) Number of bins in z axis ");
179 mBinCmd->
SetGuidance(
" Nphi:(int) Number of bins in phi axis ");
196 mTransDir->
SetGuidance(
"Mesh translation commands.");
199 mTResetCmd->
SetGuidance(
"Reset translated position of the scoring mesh.");
202 mTXyzCmd->
SetGuidance(
"Translate the scoring mesh.");
210 mRotXCmd->
SetGuidance(
"Rotate the scoring mesh in X axis.");
215 mRotYCmd->
SetGuidance(
"Rotate the scoring mesh in Y axis.");
220 mRotZCmd->
SetGuidance(
"Rotate the scoring mesh in Z axis.");
228 probeMatCmd->
SetGuidance(
"Specify a material to the probe cube.");
229 probeMatCmd->
SetGuidance(
"Material name has to be taken from G4NistManager.");
230 probeMatCmd->
SetGuidance(
"Once this command is used, the specified material "
231 "overlays the material in the mass geometry");
232 probeMatCmd->
SetGuidance(
"with \"Layered Mass Geometry\" mechanism so that "
233 "physics quantities such as energy deposition");
234 probeMatCmd->
SetGuidance(
"or dose will be calculated with this material.");
235 probeMatCmd->
SetGuidance(
"To switch-off this overlaying, use \"none\".");
241 "Locate a probe in the global coordinate system.");
246 drawCmd =
new G4UIcommand(
"/score/drawProjection",
this);
247 drawCmd->
SetGuidance(
"Draw projection(s) of scored quantities.");
249 "Parameter <proj> specified which projection(s) to be drawn.");
251 " 100 : xy-plane, 010 : yz-plane, 001 : zx-plane -- default 111");
253 " 100 : N/A, 010 : z_phi-plane, 001 : r_phi-plane -- default 111");
267 drawColumnCmd =
new G4UIcommand(
"/score/drawColumn",
this);
269 drawColumnCmd->
SetGuidance(
" plane = 0 : x-y, 1: y-z, 2: z-x for box mesh");
271 " 0 : z-phi, 1: r-phi, 2: r-z for cylinder mesh");
291 listColorMapCmd->
SetGuidance(
"List registered score color maps.");
296 "Min/Max of the color map is calculated according to the actual scores.");
301 colorMapMinMaxCmd =
new G4UIcommand(
"/score/colorMap/setMinMax",
this);
302 colorMapMinMaxCmd->
SetGuidance(
"Define min/max value of the color map.");
313 dumpQtyToFileCmd =
new G4UIcommand(
"/score/dumpQuantityToFile",
this);
314 dumpQtyToFileCmd->
SetGuidance(
"Dump one scored quantity to file.");
325 dumpQtyWithFactorCmd =
new G4UIcommand(
"/score/dumpQuantityWithFactor",
this);
326 dumpQtyWithFactorCmd->
SetGuidance(
"Dump one scored quantity to file.");
328 "Each value is multiplied by the specified factor.");
343 dumpAllQtsToFileCmd =
new G4UIcommand(
"/score/dumpAllQuantitiesToFile",
this);
344 dumpAllQtsToFileCmd->
SetGuidance(
"Dump all quantities of the mesh to file.");
353 dumpAllQtsWithFactorCmd =
354 new G4UIcommand(
"/score/dumpAllQuantitiesWithFactor",
this);
356 "Dump all quantities of the mesh to file.");
358 "Each value is multiplied by the specified factor.");
370 fill1DCmd =
new G4UIcommand(
"/score/fill1D",
this);
371 fill1DCmd->
SetGuidance(
"Let a primitive scorer fill 1-D histogram");
372 fill1DCmd->
SetGuidance(
"Before using this command, primitive scorer must be "
373 "defined and assigned.");
374 fill1DCmd->
SetGuidance(
"Also before using this command, a histogram has to "
375 "be defined by /analysis/h1/create command.");
377 "This command is available only for real-world volume or probe.");
378 fill1DCmd->
SetGuidance(
"Please note that this command has to be applied to "
379 "each copy number of the scoring volume.");
380 fill1DCmd->
SetGuidance(
"If same histogram ID is used more than once, more "
381 "than one scorers fill that histogram.");
398 delete meshBoxCreateCmd;
399 delete meshCylinderCreateCmd;
400 delete meshRWLogVolCreateCmd;
401 delete probeCreateCmd;
402 delete meshCreateDir;
410 delete mCylinderSizeCmd;
411 delete mCylinderRMinCmd;
412 delete mCylinderAngleCmd;
424 delete probeLocateCmd;
430 delete drawColumnCmd;
431 delete listColorMapCmd;
432 delete floatMinMaxCmd;
433 delete colorMapMinMaxCmd;
435 delete dumpQtyToFileCmd;
436 delete dumpQtyWithFactorCmd;
437 delete dumpAllQtsToFileCmd;
438 delete dumpAllQtsWithFactorCmd;
448 if(command == listCmd)
452 else if(command == dumpCmd)
456 else if(command == drawCmd)
463 fSMan->
DrawMesh(meshName, psName, colorMapName, axflg);
465 else if(command == drawColumnCmd)
473 fSMan->
DrawMesh(meshName, psName, iPlane, iColumn, colorMapName);
475 else if(command == dumpQtyToFileCmd)
482 auto mesh = fSMan->
FindMesh(meshName);
486 ed <<
"Mesh name <" << meshName <<
"> is not found. Command ignored.";
492 else if(command == dumpQtyWithFactorCmd)
500 auto mesh = fSMan->
FindMesh(meshName);
504 ed <<
"Mesh name <" << meshName <<
"> is not found. Command ignored.";
512 else if(command == dumpAllQtsToFileCmd)
518 auto mesh = fSMan->
FindMesh(meshName);
522 ed <<
"Mesh name <" << meshName <<
"> is not found. Command ignored.";
528 else if(command == dumpAllQtsWithFactorCmd)
535 auto mesh = fSMan->
FindMesh(meshName);
539 ed <<
"Mesh name <" << meshName <<
"> is not found. Command ignored.";
547 else if(command == fill1DCmd)
551 else if(command == verboseCmd)
555 else if(command == meshBoxCreateCmd)
558 if(currentmesh !=
nullptr)
561 ed <<
"ERROR[" << meshBoxCreateCmd->
GetCommandPath() <<
"] : Mesh <"
563 <<
"> is still open. Close it first. Command ignored.";
578 <<
"] : Scoring mesh <" << newVal
579 <<
"> already exists. Command ignored.";
584 else if(command == meshCylinderCreateCmd)
587 if(currentmesh !=
nullptr)
590 ed <<
"ERROR[" << meshCylinderCreateCmd->
GetCommandPath() <<
"] : Mesh <"
592 <<
"> is still open. Close it first. Command ignored.";
607 <<
"] : Scoring mesh <" << newVal
608 <<
"> already exists. Command ignored.";
613 else if(command == meshRWLogVolCreateCmd)
619 ed <<
"ERROR[" << meshRWLogVolCreateCmd->
GetCommandPath() <<
"] : Mesh <"
620 << mesh->GetWorldName()
621 <<
"> is still open. Close it first. Command ignored.";
633 mesh->SetCopyNumberLevel(idx);
640 <<
"] : Scoring mesh <" << meshName
641 <<
"> already exists. Command ignored.";
646 else if(command == probeCreateCmd)
652 ed <<
"ERROR[" << meshRWLogVolCreateCmd->
GetCommandPath() <<
"] : Mesh <"
653 << mesh->GetWorldName()
654 <<
"> is still open. Close it first. Command ignored.";
673 ed <<
"ERROR[" << probeCreateCmd->
GetCommandPath() <<
"] : Mesh name <"
674 << qname <<
"> already exists. Use another name.";
679 else if(command == probeMatCmd || command == probeLocateCmd)
685 ed <<
"ERROR : No mesh is currently open. Open/create a mesh first. "
690 if(mesh->GetShape() != MeshShape::probe)
693 ed <<
"ERROR : Inconsistent mesh type. Close current mesh and open "
699 if(command == probeMatCmd)
705 ed <<
"Material <" << newVal
706 <<
"> is not defind in G4NistManager. Command is ignored.\n"
707 <<
"Use /material/nist/listMaterials command to see the available "
713 else if(command == probeLocateCmd)
719 else if(command == listColorMapCmd)
723 else if(command == floatMinMaxCmd)
726 if(colorMap !=
nullptr)
733 ed <<
"ERROR[" << floatMinMaxCmd->
GetCommandPath() <<
"] : color map <"
734 << newVal <<
"> is not defined. Command ignored.";
738 else if(command == colorMapMinMaxCmd)
745 if(colorMap !=
nullptr)
753 ed <<
"ERROR[" << colorMapMinMaxCmd->
GetCommandPath() <<
"] : color map <"
754 << newVal <<
"> is not defined. Command ignored." <<
G4endl;
758 else if(command == meshOpnCmd)
761 if(currentmesh !=
nullptr)
766 <<
"> is still open. Close it first. Command ignored.";
775 ed <<
"ERROR[" << meshOpnCmd->
GetCommandPath() <<
"] : Scoring mesh <"
776 << newVal <<
"> does not exist. Command ignored.";
785 else if(command == meshClsCmd)
800 if(shape == MeshShape::realWorldLogVol)
804 <<
"] : Number of mesh command cannot be set for this type of mesh. "
815 if(command == mBoxSizeCmd)
817 if(shape == MeshShape::box)
830 <<
"] : This mesh is not Box. Command ignored.";
834 else if(command == mCylinderSizeCmd || command == mCylinderRMinCmd ||
835 command == mCylinderAngleCmd)
837 if(shape != MeshShape::cylinder)
841 <<
"] : This mesh is not Cylinder. Command ignored.";
846 if(command == mCylinderSizeCmd)
849 vsize[0] = (mesh->
GetSize()).x();
850 vsize[1] =
StoD(token[0]);
851 vsize[2] =
StoD(token[1]);
857 else if(command == mCylinderRMinCmd)
861 vsize[1] = (mesh->
GetSize()).y();
862 vsize[2] = (mesh->
GetSize()).z();
865 else if(command == mCylinderAngleCmd)
870 mesh->
SetAngles(stphi * unt, spphi * unt);
874 else if(command == mBinCmd)
878 else if(command == mTResetCmd)
880 G4double centerPosition[3] = { 0., 0., 0. };
883 else if(command == mTXyzCmd)
887 centerPosition[0] = xyz.
x();
888 centerPosition[1] = xyz.
y();
889 centerPosition[2] = xyz.
z();
892 else if(command == mRotXCmd)
897 else if(command == mRotYCmd)
902 else if(command == mRotZCmd)
912 ed <<
"ERROR: No mesh is currently open. Open/create a mesh first. "
922 if(command == verboseCmd)
934 while(!(val = next()).empty())
936 token.push_back(val);
949 G4cout <<
".... G4ScoringMessenger::MeshBinCommand - G4ScoringBox"
957 G4cout <<
".... G4ScoringMessenger::MeshBinCommand - G4ScoringCylinder"
966 "invalid mesh type");
987 if(filler ==
nullptr)
990 ed <<
"G4TScoreHistFiller is not instantiated in this application.";
999 auto mesh = sm->FindMesh(meshName);
1003 ed <<
"Mesh name <" << meshName <<
"> is not found.";
1007 auto shape = mesh->GetShape();
1008 if(shape != MeshShape::realWorldLogVol && shape != MeshShape::probe)
1011 ed <<
"Mesh <" << meshName
1012 <<
"> is not real-world logical volume or probe.";
1017 auto prim = mesh->GetPrimitiveScorer(primName);
1021 ed <<
"Primitive scorer name <" << primName <<
"> is not found.";
1029 ed <<
"Primitive scorer <" << primName
1030 <<
"> does not support direct histogram filling.";
1035 pp->Plot(copyNo, histID);
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
std::vector< G4String > G4TokenVec
G4GLOB_DLL std::ostream G4cout
void RegisterScoringMesh(G4VScoringMesh *scm)
G4int GetVerboseLevel() const
void SetVerboseLevel(G4int vl)
G4VScoreColorMap * GetScoreColorMap(const G4String &mapName)
void DumpAllQuantitiesToFile(const G4String &meshName, const G4String &fileName, const G4String &option="")
G4VScoringMesh * FindMesh(G4VHitsCollection *map)
void SetCurrentMesh(G4VScoringMesh *scm)
void DrawMesh(const G4String &meshName, const G4String &psName, const G4String &colorMapName, G4int axflg=111)
void SetFactor(G4double val=1.0)
G4VScoringMesh * GetCurrentMesh() const
void ListScoreColorMaps()
static G4ScoringManager * GetScoringManagerIfExist()
void DumpQuantityToFile(const G4String &meshName, const G4String &psName, const G4String &fileName, const G4String &option="")
void FillTokenVec(G4String newValues, G4TokenVec &token)
void MeshBinCommand(G4VScoringMesh *mesh, G4TokenVec &token)
G4String GetCurrentValue(G4UIcommand *command) override
G4ScoringMessenger(G4ScoringManager *SManager)
~G4ScoringMessenger() override
void Fill1D(G4UIcommand *cmd, G4String newValues)
void SetNewValue(G4UIcommand *command, G4String newValues) override
void SetDefaultUnit(const char *defUnit)
static G4ThreeVector GetNew3VectorValue(const char *paramString)
void SetParameterName(const char *theNameX, const char *theNameY, const char *theNameZ, G4bool omittable, G4bool currentAsDefault=false)
void SetDefaultUnit(const char *defUnit)
static G4double GetNewDoubleValue(const char *paramString)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetDefaultValue(const char *defVal)
static G4int GetNewIntValue(const char *paramString)
void SetToBeBroadcasted(G4bool val)
static G4double ValueOf(const char *unitName)
static G4String ConvertToString(G4bool boolVal)
const G4String & GetCommandPath() const
void SetParameter(G4UIparameter *const newParameter)
void SetGuidance(const char *aGuidance)
void CommandFailed(G4int errCode, G4ExceptionDescription &ed)
void SetRange(const char *rs)
G4double StoD(const G4String &s)
G4int StoI(const G4String &s)
void SetDefaultValue(const char *theDefaultValue)
void SetParameterRange(const char *theRange)
void SetDefaultUnit(const char *theDefaultUnit)
void SetMinMax(G4double minVal, G4double maxVal)
void SetFloatingMinMax(G4bool vl=true)
static G4VScoreHistFiller * Instance()
G4ThreeVector GetSize() const
MeshShape GetShape() const
void RotateY(G4double delta)
void SetAngles(G4double, G4double)
const G4String & GetWorldName() const
void SetNumberOfSegments(G4int nSegment[3])
void SetCenterPosition(G4double centerPosition[3])
void RotateX(G4double delta)
void SetSize(G4double size[3])
void RotateZ(G4double delta)