Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 // G4ScoringMessenger << 26 // 27 // ------------------------------------------- << 27 // --------------------------------------------------------------------- 28 28 29 #include "G4ScoringMessenger.hh" 29 #include "G4ScoringMessenger.hh" 30 #include "G4ScoringManager.hh" 30 #include "G4ScoringManager.hh" 31 #include "G4VScoringMesh.hh" 31 #include "G4VScoringMesh.hh" 32 #include "G4ScoringBox.hh" 32 #include "G4ScoringBox.hh" 33 #include "G4ScoringCylinder.hh" 33 #include "G4ScoringCylinder.hh" 34 #include "G4ScoringRealWorld.hh" 34 #include "G4ScoringRealWorld.hh" 35 #include "G4ScoringProbe.hh" 35 #include "G4ScoringProbe.hh" 36 36 37 #include "G4UIdirectory.hh" 37 #include "G4UIdirectory.hh" 38 #include "G4UIcmdWithoutParameter.hh" 38 #include "G4UIcmdWithoutParameter.hh" 39 #include "G4UIcmdWithAnInteger.hh" 39 #include "G4UIcmdWithAnInteger.hh" 40 #include "G4UIcmdWithAString.hh" 40 #include "G4UIcmdWithAString.hh" 41 #include "G4UIcmdWithABool.hh" 41 #include "G4UIcmdWithABool.hh" 42 #include "G4UIcmdWithADoubleAndUnit.hh" 42 #include "G4UIcmdWithADoubleAndUnit.hh" 43 #include "G4UIcmdWith3VectorAndUnit.hh" 43 #include "G4UIcmdWith3VectorAndUnit.hh" 44 #include "G4UIcommand.hh" 44 #include "G4UIcommand.hh" 45 #include "G4UIparameter.hh" 45 #include "G4UIparameter.hh" 46 #include "G4Tokenizer.hh" 46 #include "G4Tokenizer.hh" 47 #include "G4UnitsTable.hh" 47 #include "G4UnitsTable.hh" 48 #include "G4VScoreColorMap.hh" 48 #include "G4VScoreColorMap.hh" 49 49 50 #include "G4VPrimitivePlotter.hh" << 51 #include "G4VScoreHistFiller.hh" << 52 << 53 G4ScoringMessenger::G4ScoringMessenger(G4Scori 50 G4ScoringMessenger::G4ScoringMessenger(G4ScoringManager* SManager) 54 : fSMan(SManager) << 51 :fSMan(SManager) 55 { 52 { 56 G4UIparameter* param = nullptr; 53 G4UIparameter* param = nullptr; 57 54 58 scoreDir = new G4UIdirectory("/score/"); 55 scoreDir = new G4UIdirectory("/score/"); 59 scoreDir->SetGuidance("Interactive scoring c 56 scoreDir->SetGuidance("Interactive scoring commands."); 60 57 61 listCmd = new G4UIcmdWithoutParameter("/scor << 58 listCmd = new G4UIcmdWithoutParameter("/score/list",this); 62 listCmd->SetGuidance("List scoring worlds.") 59 listCmd->SetGuidance("List scoring worlds."); 63 60 64 dumpCmd = new G4UIcmdWithoutParameter("/scor << 61 dumpCmd = new G4UIcmdWithoutParameter("/score/dump",this); 65 dumpCmd->SetGuidance("Dump results of scorer 62 dumpCmd->SetGuidance("Dump results of scorers."); 66 63 67 verboseCmd = new G4UIcmdWithAnInteger("/scor << 64 verboseCmd = new G4UIcmdWithAnInteger("/score/verbose",this); 68 verboseCmd->SetGuidance("Verbosity."); 65 verboseCmd->SetGuidance("Verbosity."); 69 verboseCmd->SetGuidance(" 0) errors or warn 66 verboseCmd->SetGuidance(" 0) errors or warnings,"); 70 verboseCmd->SetGuidance(" 1) information wi 67 verboseCmd->SetGuidance(" 1) information with 0)"); 71 68 72 meshCreateDir = new G4UIdirectory("/score/cr 69 meshCreateDir = new G4UIdirectory("/score/create/"); 73 meshCreateDir->SetGuidance(" Mesh creation 70 meshCreateDir->SetGuidance(" Mesh creation commands."); 74 // 71 // 75 // Mesh commands 72 // Mesh commands 76 meshBoxCreateCmd = new G4UIcmdWithAString("/ << 73 meshBoxCreateCmd = new G4UIcmdWithAString("/score/create/boxMesh",this); 77 meshBoxCreateCmd->SetGuidance("Create scorin 74 meshBoxCreateCmd->SetGuidance("Create scoring box mesh."); 78 meshBoxCreateCmd->SetParameterName("MeshName << 75 meshBoxCreateCmd->SetParameterName("MeshName",false); 79 // 76 // 80 meshCylinderCreateCmd = << 77 meshCylinderCreateCmd = new G4UIcmdWithAString("/score/create/cylinderMesh",this); 81 new G4UIcmdWithAString("/score/create/cyli << 82 meshCylinderCreateCmd->SetGuidance("Create s 78 meshCylinderCreateCmd->SetGuidance("Create scoring mesh."); 83 meshCylinderCreateCmd->SetParameterName("Mes << 79 meshCylinderCreateCmd->SetParameterName("MeshName",false); 84 << 80 // 85 meshRWLogVolCreateCmd = << 81 // meshSphereCreateCmd = new G4UIcmdWithAString("/score/create/sphereMesh",this); 86 new G4UIcommand("/score/create/realWorldLo << 82 // meshSphereCreateCmd->SetGuidance("Create scoring mesh."); 87 meshRWLogVolCreateCmd->SetGuidance( << 83 // meshSphereCreateCmd->SetParameterName("MeshName",false); 88 "Define scorers to a logical volume define << 84 // 89 meshRWLogVolCreateCmd->SetGuidance( << 85 meshRWLogVolCreateCmd = new G4UIcommand("/score/create/realWorldLogVol",this); 90 " - Name of the specified logical volume << 86 meshRWLogVolCreateCmd->SetGuidance("Define scorers to a logical volume defined in the real world."); 91 meshRWLogVolCreateCmd->SetGuidance( << 87 meshRWLogVolCreateCmd->SetGuidance(" - Name of the specified logical volume is used as the mesh name."); 92 " - /score/mesh commands do not affect fo << 88 meshRWLogVolCreateCmd->SetGuidance(" - /score/mesh commands do not affect for this mesh."); 93 meshRWLogVolCreateCmd->SetGuidance( << 89 meshRWLogVolCreateCmd->SetGuidance(" - If copyNumberLevel is set, the copy number of that-level higher"); 94 " - If copyNumberLevel is set, the copy n << 90 meshRWLogVolCreateCmd->SetGuidance(" in the geometrical hierarchy is used as the index."); 95 meshRWLogVolCreateCmd->SetGuidance( << 91 param = new G4UIparameter("logVol",'s',false); 96 " in the geometrical hierarchy is used << 97 param = new G4UIparameter("logVol", 's', fal << 98 meshRWLogVolCreateCmd->SetParameter(param); 92 meshRWLogVolCreateCmd->SetParameter(param); 99 param = new G4UIparameter("copyNumberLevel", << 93 param = new G4UIparameter("copyNumberLevel",'i',true); 100 param->SetParameterRange("copyNumberLevel>=0 94 param->SetParameterRange("copyNumberLevel>=0"); 101 param->SetDefaultValue(0); 95 param->SetDefaultValue(0); 102 meshRWLogVolCreateCmd->SetParameter(param); 96 meshRWLogVolCreateCmd->SetParameter(param); 103 // 97 // 104 probeCreateCmd = new G4UIcommand("/score/cre << 98 probeCreateCmd = new G4UIcommand("/score/create/probe",this); 105 probeCreateCmd->SetGuidance("Define scoring 99 probeCreateCmd->SetGuidance("Define scoring probe."); 106 probeCreateCmd->SetGuidance( << 100 probeCreateCmd->SetGuidance(" halfSize defines the half-width of the probing cube."); 107 " halfSize defines the half-width of the << 101 param = new G4UIparameter("pname",'s',false); 108 param = new G4UIparameter("pname", 's', fals << 109 probeCreateCmd->SetParameter(param); 102 probeCreateCmd->SetParameter(param); 110 param = new G4UIparameter("halfSize", 'd', f << 103 param = new G4UIparameter("halfSize",'d',false); 111 probeCreateCmd->SetParameter(param); 104 probeCreateCmd->SetParameter(param); 112 param = new G4UIparameter("unit", 's', true) << 105 param = new G4UIparameter("unit",'s',true); 113 param->SetDefaultUnit("mm"); 106 param->SetDefaultUnit("mm"); 114 probeCreateCmd->SetParameter(param); 107 probeCreateCmd->SetParameter(param); 115 param = new G4UIparameter("checkOverlap", 'b << 108 param = new G4UIparameter("checkOverlap",'b',true); 116 param->SetDefaultValue(0); << 109 param->SetDefaultValue(false); 117 probeCreateCmd->SetParameter(param); 110 probeCreateCmd->SetParameter(param); 118 // 111 // 119 meshOpnCmd = new G4UIcmdWithAString("/score/ << 112 meshOpnCmd = new G4UIcmdWithAString("/score/open",this); 120 meshOpnCmd->SetGuidance("Open scoring mesh." 113 meshOpnCmd->SetGuidance("Open scoring mesh."); 121 meshOpnCmd->SetParameterName("MeshName", fal << 114 meshOpnCmd->SetParameterName("MeshName",false); 122 // 115 // 123 meshClsCmd = new G4UIcmdWithoutParameter("/s << 116 meshClsCmd = new G4UIcmdWithoutParameter("/score/close",this); 124 meshClsCmd->SetGuidance("Close scoring mesh. 117 meshClsCmd->SetGuidance("Close scoring mesh."); 125 << 118 // >> 119 // meshActCmd = new G4UIcmdWithABool("/score/mesh/activate",this); >> 120 // meshActCmd->SetGuidance("Activate scoring mesh."); >> 121 // meshActCmd->SetParameterName("MeshName",false); >> 122 // 126 meshDir = new G4UIdirectory("/score/mesh/"); 123 meshDir = new G4UIdirectory("/score/mesh/"); 127 meshDir->SetGuidance(" Mesh processing co 124 meshDir->SetGuidance(" Mesh processing commands."); 128 // 125 // 129 mBoxSizeCmd = new G4UIcmdWith3VectorAndUnit( << 126 mBoxSizeCmd = new G4UIcmdWith3VectorAndUnit("/score/mesh/boxSize",this); 130 mBoxSizeCmd->SetGuidance("Define size of the 127 mBoxSizeCmd->SetGuidance("Define size of the scoring mesh."); 131 mBoxSizeCmd->SetGuidance("Dx Dy Dz unit") 128 mBoxSizeCmd->SetGuidance("Dx Dy Dz unit"); 132 mBoxSizeCmd->SetParameterName("Di", "Dj", "D << 129 mBoxSizeCmd->SetParameterName("Di","Dj","Dk",false,false); 133 mBoxSizeCmd->SetRange("Di>0. && Dj>0. && Dk> 130 mBoxSizeCmd->SetRange("Di>0. && Dj>0. && Dk>0."); 134 mBoxSizeCmd->SetDefaultUnit("mm"); 131 mBoxSizeCmd->SetDefaultUnit("mm"); 135 // 132 // 136 mCylinderSizeCmd = new G4UIcommand("/score/m << 133 mCylinderSizeCmd = new G4UIcommand("/score/mesh/cylinderSize",this); 137 mCylinderSizeCmd->SetGuidance("Define size o 134 mCylinderSizeCmd->SetGuidance("Define size of the scoring mesh."); 138 mCylinderSizeCmd->SetGuidance("R Dz unit" 135 mCylinderSizeCmd->SetGuidance("R Dz unit"); 139 param = new G4UIparameter("R", 'd', false); << 136 param = new G4UIparameter("R",'d',false); 140 param->SetParameterRange("R>0"); 137 param->SetParameterRange("R>0"); 141 mCylinderSizeCmd->SetParameter(param); 138 mCylinderSizeCmd->SetParameter(param); 142 param = new G4UIparameter("Dz", 'd', false); << 139 param = new G4UIparameter("Dz",'d',false); 143 param->SetParameterRange("Dz>0"); 140 param->SetParameterRange("Dz>0"); 144 mCylinderSizeCmd->SetParameter(param); 141 mCylinderSizeCmd->SetParameter(param); 145 param = new G4UIparameter("unit", 's', true) << 142 param = new G4UIparameter("unit",'s',true); 146 param->SetDefaultUnit("mm"); 143 param->SetDefaultUnit("mm"); 147 mCylinderSizeCmd->SetParameter(param); 144 mCylinderSizeCmd->SetParameter(param); 148 // 145 // 149 mCylinderRMinCmd = << 150 new G4UIcmdWithADoubleAndUnit("/score/mesh << 151 mCylinderRMinCmd->SetGuidance("Define the in << 152 mCylinderRMinCmd->SetGuidance("This command << 153 mCylinderRMinCmd->SetParameterName("RMin", f << 154 mCylinderRMinCmd->SetRange("RMin>=0."); << 155 mCylinderRMinCmd->SetDefaultUnit("mm"); << 156 // << 157 mCylinderAngleCmd = new G4UIcommand("/score/ << 158 mCylinderAngleCmd->SetGuidance( << 159 "Define starting angle and span for tube s << 160 mCylinderAngleCmd->SetGuidance( << 161 "This command is not needed for cylinder m << 162 param = new G4UIparameter("startPhi", 'd', f << 163 mCylinderAngleCmd->SetParameter(param); << 164 param = new G4UIparameter("deltaPhi", 'd', f << 165 param->SetParameterRange("deltaPhi>0."); << 166 mCylinderAngleCmd->SetParameter(param); << 167 param = new G4UIparameter("unit", 's', true) << 168 param->SetDefaultUnit("deg"); << 169 mCylinderAngleCmd->SetParameter(param); << 170 // << 171 // Division command 146 // Division command 172 mBinCmd = new G4UIcommand("/score/mesh/nBin" << 147 mBinCmd = new G4UIcommand("/score/mesh/nBin",this); 173 mBinCmd->SetGuidance("Define segments of the 148 mBinCmd->SetGuidance("Define segments of the scoring mesh."); 174 mBinCmd->SetGuidance("[usage] /score/mesh/nB 149 mBinCmd->SetGuidance("[usage] /score/mesh/nBin"); 175 mBinCmd->SetGuidance(" In case of boxMesh, p 150 mBinCmd->SetGuidance(" In case of boxMesh, parameters are given in"); 176 mBinCmd->SetGuidance(" Ni :(int) Number o 151 mBinCmd->SetGuidance(" Ni :(int) Number of bins i (in x-axis) "); 177 mBinCmd->SetGuidance(" Nj :(int) Number o 152 mBinCmd->SetGuidance(" Nj :(int) Number of bins j (in y-axis) "); 178 mBinCmd->SetGuidance(" Nk :(int) Number o 153 mBinCmd->SetGuidance(" Nk :(int) Number of bins k (in z-axis) "); 179 mBinCmd->SetGuidance(" In case of cylinderMe 154 mBinCmd->SetGuidance(" In case of cylinderMesh, parameters are given in"); 180 mBinCmd->SetGuidance(" Nr :(int) Number o 155 mBinCmd->SetGuidance(" Nr :(int) Number of bins in radial axis "); 181 mBinCmd->SetGuidance(" Nz :(int) Number o 156 mBinCmd->SetGuidance(" Nz :(int) Number of bins in z axis "); 182 mBinCmd->SetGuidance(" Nphi:(int) Number o 157 mBinCmd->SetGuidance(" Nphi:(int) Number of bins in phi axis "); 183 << 158 //mBinCmd->SetGuidance(" Axis:(int) Axis of division "); 184 param = new G4UIparameter("Ni", 'i', false); << 159 // mBinCmd->SetGuidance(" P1..Pn-1 :(double) \"paramter from P1 to Pn-1 for division.\""); >> 160 param = new G4UIparameter("Ni",'i',false); 185 param->SetDefaultValue("1"); 161 param->SetDefaultValue("1"); 186 param->SetParameterRange("Ni>0"); 162 param->SetParameterRange("Ni>0"); 187 mBinCmd->SetParameter(param); 163 mBinCmd->SetParameter(param); 188 param = new G4UIparameter("Nj", 'i', false); << 164 param = new G4UIparameter("Nj",'i',false); 189 param->SetDefaultValue("1"); 165 param->SetDefaultValue("1"); 190 param->SetParameterRange("Nj>0"); 166 param->SetParameterRange("Nj>0"); 191 mBinCmd->SetParameter(param); 167 mBinCmd->SetParameter(param); 192 param = new G4UIparameter("Nk", 'i', false); << 168 param = new G4UIparameter("Nk",'i',false); 193 param->SetDefaultValue("1"); 169 param->SetDefaultValue("1"); 194 mBinCmd->SetParameter(param); 170 mBinCmd->SetParameter(param); 195 param->SetParameterRange("Nk>0"); 171 param->SetParameterRange("Nk>0"); 196 << 172 //param = new G4UIparameter("Axis",'i',true); >> 173 //param->SetDefaultValue("3"); >> 174 //mBinCmd->SetParameter(param); >> 175 // 197 // Placement command 176 // Placement command 198 mTransDir = new G4UIdirectory("/score/mesh/t 177 mTransDir = new G4UIdirectory("/score/mesh/translate/"); 199 mTransDir->SetGuidance("Mesh translation com 178 mTransDir->SetGuidance("Mesh translation commands."); 200 // 179 // 201 mTResetCmd = new G4UIcmdWithoutParameter("/s << 180 mTResetCmd = new G4UIcmdWithoutParameter("/score/mesh/translate/reset",this); 202 mTResetCmd->SetGuidance("Reset translated po 181 mTResetCmd->SetGuidance("Reset translated position of the scoring mesh."); 203 // 182 // 204 mTXyzCmd = new G4UIcmdWith3VectorAndUnit("/s << 183 mTXyzCmd = new G4UIcmdWith3VectorAndUnit("/score/mesh/translate/xyz",this); 205 mTXyzCmd->SetGuidance("Translate the scoring 184 mTXyzCmd->SetGuidance("Translate the scoring mesh."); 206 mTXyzCmd->SetParameterName("X", "Y", "Z", fa << 185 mTXyzCmd->SetParameterName("X","Y","Z",false,false); 207 mTXyzCmd->SetDefaultUnit("mm"); 186 mTXyzCmd->SetDefaultUnit("mm"); 208 // 187 // 209 mRotDir = new G4UIdirectory("/score/mesh/rot 188 mRotDir = new G4UIdirectory("/score/mesh/rotate/"); 210 mRotDir->SetGuidance("Mesh rotation commands 189 mRotDir->SetGuidance("Mesh rotation commands."); 211 << 190 // 212 mRotXCmd = new G4UIcmdWithADoubleAndUnit("/s << 191 //mRResetCmd = new G4UIcmdWithoutParameter("/score/mesh/rotate/reset",this); >> 192 //mRResetCmd->SetGuidance("Reset rotation angles of the scoring mesh."); >> 193 // >> 194 mRotXCmd = new G4UIcmdWithADoubleAndUnit("/score/mesh/rotate/rotateX",this); 213 mRotXCmd->SetGuidance("Rotate the scoring me 195 mRotXCmd->SetGuidance("Rotate the scoring mesh in X axis."); 214 mRotXCmd->SetParameterName("Rx", false); << 196 mRotXCmd->SetParameterName("Rx",false); 215 mRotXCmd->SetDefaultUnit("deg"); 197 mRotXCmd->SetDefaultUnit("deg"); 216 // 198 // 217 mRotYCmd = new G4UIcmdWithADoubleAndUnit("/s << 199 mRotYCmd = new G4UIcmdWithADoubleAndUnit("/score/mesh/rotate/rotateY",this); 218 mRotYCmd->SetGuidance("Rotate the scoring me 200 mRotYCmd->SetGuidance("Rotate the scoring mesh in Y axis."); 219 mRotYCmd->SetParameterName("Ry", false); << 201 mRotYCmd->SetParameterName("Ry",false); 220 mRotYCmd->SetDefaultUnit("deg"); 202 mRotYCmd->SetDefaultUnit("deg"); 221 // 203 // 222 mRotZCmd = new G4UIcmdWithADoubleAndUnit("/s << 204 mRotZCmd = new G4UIcmdWithADoubleAndUnit("/score/mesh/rotate/rotateZ",this); 223 mRotZCmd->SetGuidance("Rotate the scoring me 205 mRotZCmd->SetGuidance("Rotate the scoring mesh in Z axis."); 224 mRotZCmd->SetParameterName("Rz", false); << 206 mRotZCmd->SetParameterName("Rz",false); 225 mRotZCmd->SetDefaultUnit("deg"); 207 mRotZCmd->SetDefaultUnit("deg"); 226 // 208 // 227 probeDir = new G4UIdirectory("/score/probe/" 209 probeDir = new G4UIdirectory("/score/probe/"); 228 probeDir->SetGuidance("Probe commands"); 210 probeDir->SetGuidance("Probe commands"); 229 211 230 probeMatCmd = new G4UIcmdWithAString("/score << 212 probeMatCmd = new G4UIcmdWithAString("/score/probe/material",this); 231 probeMatCmd->SetGuidance("Specify a material 213 probeMatCmd->SetGuidance("Specify a material to the probe cube."); 232 probeMatCmd->SetGuidance("Material name has 214 probeMatCmd->SetGuidance("Material name has to be taken from G4NistManager."); 233 probeMatCmd->SetGuidance("Once this command << 215 probeMatCmd->SetGuidance("Once this command is used, the specified material overlays the material in the mass geometry"); 234 "overlays the mater << 216 probeMatCmd->SetGuidance("with \"Layered Mass Geometry\" mechanism so that physics quantities such as energy deposition"); 235 probeMatCmd->SetGuidance("with \"Layered Mas << 236 "physics quantities << 237 probeMatCmd->SetGuidance("or dose will be ca 217 probeMatCmd->SetGuidance("or dose will be calculated with this material."); 238 probeMatCmd->SetGuidance("To switch-off this 218 probeMatCmd->SetGuidance("To switch-off this overlaying, use \"none\"."); 239 probeMatCmd->SetParameterName("matName", tru << 219 probeMatCmd->SetParameterName("matName",true); 240 probeMatCmd->SetDefaultValue("none"); 220 probeMatCmd->SetDefaultValue("none"); 241 221 242 probeLocateCmd = new G4UIcmdWith3VectorAndUn << 222 probeLocateCmd = new G4UIcmdWith3VectorAndUnit("/score/probe/locate",this); 243 probeLocateCmd->SetGuidance( << 223 probeLocateCmd->SetGuidance("Locate a probe in the global coordinate system."); 244 "Locate a probe in the global coordinate s << 224 probeLocateCmd->SetParameterName("x","y","z",false); 245 probeLocateCmd->SetParameterName("x", "y", " << 246 probeLocateCmd->SetDefaultUnit("mm"); 225 probeLocateCmd->SetDefaultUnit("mm"); 247 226 248 // Draw Scoring result 227 // Draw Scoring result 249 drawCmd = new G4UIcommand("/score/drawProjec << 228 drawCmd = new G4UIcommand("/score/drawProjection",this); 250 drawCmd->SetGuidance("Draw projection(s) of 229 drawCmd->SetGuidance("Draw projection(s) of scored quantities."); 251 drawCmd->SetGuidance( << 230 drawCmd->SetGuidance("Parameter <proj> specified which projection(s) to be drawn."); 252 "Parameter <proj> specified which projecti << 231 drawCmd->SetGuidance(" 100 : xy-plane, 010 : yz-plane, 001 : zx-plane -- default 111"); 253 drawCmd->SetGuidance( << 232 drawCmd->SetGuidance(" 100 : N/A, 010 : z_phi-plane, 001 : r_phi-plane -- default 111"); 254 " 100 : xy-plane, 010 : yz-plane, 001 << 233 param = new G4UIparameter("meshName",'s',false); 255 drawCmd->SetGuidance( << 256 " 100 : N/A, 010 : z_phi-plane, 001 << 257 param = new G4UIparameter("meshName", 's', f << 258 drawCmd->SetParameter(param); 234 drawCmd->SetParameter(param); 259 param = new G4UIparameter("psName", 's', fal << 235 param = new G4UIparameter("psName",'s',false); 260 drawCmd->SetParameter(param); 236 drawCmd->SetParameter(param); 261 param = new G4UIparameter("colorMapName", 's << 237 param = new G4UIparameter("colorMapName",'s',true); 262 param->SetDefaultValue("defaultLinearColorMa 238 param->SetDefaultValue("defaultLinearColorMap"); 263 drawCmd->SetParameter(param); 239 drawCmd->SetParameter(param); 264 param = new G4UIparameter("proj", 'i', true) << 240 param = new G4UIparameter("proj",'i',true); 265 param->SetDefaultValue(111); 241 param->SetDefaultValue(111); 266 drawCmd->SetParameter(param); 242 drawCmd->SetParameter(param); 267 drawCmd->SetToBeBroadcasted(false); 243 drawCmd->SetToBeBroadcasted(false); 268 244 269 // Draw column 245 // Draw column 270 drawColumnCmd = new G4UIcommand("/score/draw << 246 drawColumnCmd = new G4UIcommand("/score/drawColumn",this); 271 drawColumnCmd->SetGuidance("Draw a cell colu 247 drawColumnCmd->SetGuidance("Draw a cell column."); 272 drawColumnCmd->SetGuidance(" plane = 0 : x-y 248 drawColumnCmd->SetGuidance(" plane = 0 : x-y, 1: y-z, 2: z-x for box mesh"); 273 drawColumnCmd->SetGuidance( << 249 drawColumnCmd->SetGuidance(" 0 : z-phi, 1: r-phi, 2: r-z for cylinder mesh"); 274 " 0 : z-phi, 1: r-phi, 2: r-z for << 250 param = new G4UIparameter("meshName",'s',false); 275 param = new G4UIparameter("meshName", 's', f << 276 drawColumnCmd->SetParameter(param); 251 drawColumnCmd->SetParameter(param); 277 param = new G4UIparameter("psName", 's', fal << 252 param = new G4UIparameter("psName",'s',false); 278 drawColumnCmd->SetParameter(param); 253 drawColumnCmd->SetParameter(param); 279 param = new G4UIparameter("plane", 'i', fals << 254 param = new G4UIparameter("plane",'i',false); 280 param->SetParameterRange("plane>=0 && plane< 255 param->SetParameterRange("plane>=0 && plane<=2"); 281 drawColumnCmd->SetParameter(param); 256 drawColumnCmd->SetParameter(param); 282 param = new G4UIparameter("column", 'i', fal << 257 param = new G4UIparameter("column",'i',false); 283 drawColumnCmd->SetParameter(param); 258 drawColumnCmd->SetParameter(param); 284 param = new G4UIparameter("colorMapName", 's << 259 param = new G4UIparameter("colorMapName",'s',true); 285 param->SetDefaultValue("defaultLinearColorMa 260 param->SetDefaultValue("defaultLinearColorMap"); 286 drawColumnCmd->SetParameter(param); 261 drawColumnCmd->SetParameter(param); 287 drawColumnCmd->SetToBeBroadcasted(false); 262 drawColumnCmd->SetToBeBroadcasted(false); 288 263 289 colorMapDir = new G4UIdirectory("/score/colo 264 colorMapDir = new G4UIdirectory("/score/colorMap/"); 290 colorMapDir->SetGuidance("Color map commands 265 colorMapDir->SetGuidance("Color map commands."); 291 266 292 listColorMapCmd = << 267 listColorMapCmd = new G4UIcmdWithoutParameter("/score/colorMap/listScoreColorMaps",this); 293 new G4UIcmdWithoutParameter("/score/colorM << 294 listColorMapCmd->SetGuidance("List registere 268 listColorMapCmd->SetGuidance("List registered score color maps."); 295 listColorMapCmd->SetToBeBroadcasted(false); 269 listColorMapCmd->SetToBeBroadcasted(false); 296 270 297 floatMinMaxCmd = new G4UIcmdWithAString("/sc << 271 floatMinMaxCmd = new G4UIcmdWithAString("/score/colorMap/floatMinMax",this); 298 floatMinMaxCmd->SetGuidance( << 272 floatMinMaxCmd->SetGuidance("Min/Max of the color map is calculated according to the actual scores."); 299 "Min/Max of the color map is calculated ac << 273 floatMinMaxCmd->SetParameterName("colorMapName",true,false); 300 floatMinMaxCmd->SetParameterName("colorMapNa << 301 floatMinMaxCmd->SetDefaultValue("defaultLine 274 floatMinMaxCmd->SetDefaultValue("defaultLinearColorMap"); 302 floatMinMaxCmd->SetToBeBroadcasted(false); 275 floatMinMaxCmd->SetToBeBroadcasted(false); 303 276 304 colorMapMinMaxCmd = new G4UIcommand("/score/ << 277 colorMapMinMaxCmd = new G4UIcommand("/score/colorMap/setMinMax",this); 305 colorMapMinMaxCmd->SetGuidance("Define min/m 278 colorMapMinMaxCmd->SetGuidance("Define min/max value of the color map."); 306 param = new G4UIparameter("colorMapMame", 's << 279 param = new G4UIparameter("colorMapMame",'s',true); 307 param->SetDefaultValue("defaultLinearColorMa 280 param->SetDefaultValue("defaultLinearColorMap"); 308 colorMapMinMaxCmd->SetParameter(param); 281 colorMapMinMaxCmd->SetParameter(param); 309 param = new G4UIparameter("minValue", 'd', f << 282 param = new G4UIparameter("minValue",'d',false); 310 colorMapMinMaxCmd->SetParameter(param); 283 colorMapMinMaxCmd->SetParameter(param); 311 param = new G4UIparameter("maxValue", 'd', f << 284 param = new G4UIparameter("maxValue",'d',false); 312 colorMapMinMaxCmd->SetParameter(param); 285 colorMapMinMaxCmd->SetParameter(param); 313 colorMapMinMaxCmd->SetToBeBroadcasted(false) 286 colorMapMinMaxCmd->SetToBeBroadcasted(false); 314 287 315 // Dump a scored quantity << 288 /* >> 289 chartCmd = new G4UIcommand("/score/drawChart",this); >> 290 chartCmd->SetGuidance("Draw color chart on the screen."); >> 291 chartCmd->SetGuidance("[usage] /score/drawChart"); >> 292 chartCmd->SetGuidance(" mesh :(String) Mesh name."); >> 293 chartCmd->SetGuidance(" psname :(String) PS name."); >> 294 chartCmd->SetGuidance(" On/Off :(boolean) On or Off the color chart."); >> 295 chartCmd->SetGuidance(" scale :(String) default=linear, or log "); >> 296 param = new G4UIparameter("meshName",'s',false); >> 297 chartCmd->SetParameter(param); >> 298 param = new G4UIparameter("psName",'s',false); >> 299 chartCmd->SetParameter(param); >> 300 param = new G4UIparameter("On",'s',true); >> 301 param->SetDefaultValue("true"); >> 302 chartCmd->SetParameter(param); >> 303 param = new G4UIparameter("scale",'s',true); >> 304 param->SetDefaultValue("linear"); >> 305 chartCmd->SetParameter(param); >> 306 */ >> 307 >> 308 // Dump a scored quantity 316 dumpQtyToFileCmd = new G4UIcommand("/score/d 309 dumpQtyToFileCmd = new G4UIcommand("/score/dumpQuantityToFile", this); 317 dumpQtyToFileCmd->SetGuidance("Dump one scor 310 dumpQtyToFileCmd->SetGuidance("Dump one scored quantity to file."); 318 param = new G4UIparameter("meshName", 's', f 311 param = new G4UIparameter("meshName", 's', false); 319 dumpQtyToFileCmd->SetParameter(param); 312 dumpQtyToFileCmd->SetParameter(param); 320 param = new G4UIparameter("psName", 's', fal 313 param = new G4UIparameter("psName", 's', false); 321 dumpQtyToFileCmd->SetParameter(param); 314 dumpQtyToFileCmd->SetParameter(param); 322 param = new G4UIparameter("fileName", 's', f 315 param = new G4UIparameter("fileName", 's', false); 323 dumpQtyToFileCmd->SetParameter(param); 316 dumpQtyToFileCmd->SetParameter(param); 324 param = new G4UIparameter("option", 's', tru 317 param = new G4UIparameter("option", 's', true); 325 dumpQtyToFileCmd->SetParameter(param); 318 dumpQtyToFileCmd->SetParameter(param); 326 dumpQtyToFileCmd->SetToBeBroadcasted(false); 319 dumpQtyToFileCmd->SetToBeBroadcasted(false); 327 320 328 dumpQtyWithFactorCmd = new G4UIcommand("/sco 321 dumpQtyWithFactorCmd = new G4UIcommand("/score/dumpQuantityWithFactor", this); 329 dumpQtyWithFactorCmd->SetGuidance("Dump one 322 dumpQtyWithFactorCmd->SetGuidance("Dump one scored quantity to file."); 330 dumpQtyWithFactorCmd->SetGuidance( << 323 dumpQtyWithFactorCmd->SetGuidance("Each value is multiplied by the specified factor."); 331 "Each value is multiplied by the specified << 332 param = new G4UIparameter("meshName", 's', f 324 param = new G4UIparameter("meshName", 's', false); 333 dumpQtyWithFactorCmd->SetParameter(param); 325 dumpQtyWithFactorCmd->SetParameter(param); 334 param = new G4UIparameter("psName", 's', fal 326 param = new G4UIparameter("psName", 's', false); 335 dumpQtyWithFactorCmd->SetParameter(param); 327 dumpQtyWithFactorCmd->SetParameter(param); 336 param = new G4UIparameter("fileName", 's', f 328 param = new G4UIparameter("fileName", 's', false); 337 dumpQtyWithFactorCmd->SetParameter(param); 329 dumpQtyWithFactorCmd->SetParameter(param); 338 param = new G4UIparameter("factor", 'd', fal 330 param = new G4UIparameter("factor", 'd', false); 339 param->SetParameterRange("factor>0."); 331 param->SetParameterRange("factor>0."); 340 dumpQtyWithFactorCmd->SetParameter(param); 332 dumpQtyWithFactorCmd->SetParameter(param); 341 param = new G4UIparameter("option", 's', tru 333 param = new G4UIparameter("option", 's', true); 342 dumpQtyWithFactorCmd->SetParameter(param); 334 dumpQtyWithFactorCmd->SetParameter(param); 343 dumpQtyWithFactorCmd->SetToBeBroadcasted(fal 335 dumpQtyWithFactorCmd->SetToBeBroadcasted(false); 344 336 345 // Dump all scored quantities 337 // Dump all scored quantities 346 dumpAllQtsToFileCmd = new G4UIcommand("/scor 338 dumpAllQtsToFileCmd = new G4UIcommand("/score/dumpAllQuantitiesToFile", this); 347 dumpAllQtsToFileCmd->SetGuidance("Dump all q 339 dumpAllQtsToFileCmd->SetGuidance("Dump all quantities of the mesh to file."); 348 param = new G4UIparameter("meshName", 's', f 340 param = new G4UIparameter("meshName", 's', false); 349 dumpAllQtsToFileCmd->SetParameter(param); 341 dumpAllQtsToFileCmd->SetParameter(param); 350 param = new G4UIparameter("fileName", 's', f 342 param = new G4UIparameter("fileName", 's', false); 351 dumpAllQtsToFileCmd->SetParameter(param); 343 dumpAllQtsToFileCmd->SetParameter(param); 352 param = new G4UIparameter("option", 's', tru 344 param = new G4UIparameter("option", 's', true); 353 dumpAllQtsToFileCmd->SetParameter(param); 345 dumpAllQtsToFileCmd->SetParameter(param); 354 dumpAllQtsToFileCmd->SetToBeBroadcasted(fals 346 dumpAllQtsToFileCmd->SetToBeBroadcasted(false); 355 347 356 dumpAllQtsWithFactorCmd = << 348 dumpAllQtsWithFactorCmd = new G4UIcommand("/score/dumpAllQuantitiesWithFactor", this); 357 new G4UIcommand("/score/dumpAllQuantitiesW << 349 dumpAllQtsWithFactorCmd->SetGuidance("Dump all quantities of the mesh to file."); 358 dumpAllQtsWithFactorCmd->SetGuidance( << 350 dumpAllQtsWithFactorCmd->SetGuidance("Each value is multiplied by the specified factor."); 359 "Dump all quantities of the mesh to file." << 360 dumpAllQtsWithFactorCmd->SetGuidance( << 361 "Each value is multiplied by the specified << 362 param = new G4UIparameter("meshName", 's', f 351 param = new G4UIparameter("meshName", 's', false); 363 dumpAllQtsWithFactorCmd->SetParameter(param) 352 dumpAllQtsWithFactorCmd->SetParameter(param); 364 param = new G4UIparameter("fileName", 's', f 353 param = new G4UIparameter("fileName", 's', false); 365 dumpAllQtsWithFactorCmd->SetParameter(param) 354 dumpAllQtsWithFactorCmd->SetParameter(param); 366 param = new G4UIparameter("factor", 'd', fal 355 param = new G4UIparameter("factor", 'd', false); 367 param->SetParameterRange("factor>0."); 356 param->SetParameterRange("factor>0."); 368 dumpAllQtsWithFactorCmd->SetParameter(param) 357 dumpAllQtsWithFactorCmd->SetParameter(param); 369 param = new G4UIparameter("option", 's', tru 358 param = new G4UIparameter("option", 's', true); 370 dumpAllQtsWithFactorCmd->SetParameter(param) 359 dumpAllQtsWithFactorCmd->SetParameter(param); 371 dumpAllQtsWithFactorCmd->SetToBeBroadcasted( 360 dumpAllQtsWithFactorCmd->SetToBeBroadcasted(false); 372 361 373 fill1DCmd = new G4UIcommand("/score/fill1D", 362 fill1DCmd = new G4UIcommand("/score/fill1D", this); 374 fill1DCmd->SetGuidance("Let a primitive scor 363 fill1DCmd->SetGuidance("Let a primitive scorer fill 1-D histogram"); 375 fill1DCmd->SetGuidance("Before using this co << 364 fill1DCmd->SetGuidance("Before using this command, primitive scorer must be defined and assigned."); 376 "defined and assigned << 365 fill1DCmd->SetGuidance("Also before using this command, a histogram has to be defined by /analysis/h1/create command."); 377 fill1DCmd->SetGuidance("Also before using th << 366 fill1DCmd->SetGuidance("This command is available only for real-world volume or probe."); 378 "be defined by /analy << 367 fill1DCmd->SetGuidance("Please note that this command has to be applied to each copy number of the scoring volume."); 379 fill1DCmd->SetGuidance( << 368 fill1DCmd->SetGuidance("If same histogram ID is used more than once, more than one scorers fill that histogram."); 380 "This command is available only for real-w << 381 fill1DCmd->SetGuidance("Please note that thi << 382 "each copy number of << 383 fill1DCmd->SetGuidance("If same histogram ID << 384 "than one scorers fil << 385 param = new G4UIparameter("histID", 'i', fal 369 param = new G4UIparameter("histID", 'i', false); 386 fill1DCmd->SetParameter(param); 370 fill1DCmd->SetParameter(param); 387 param = new G4UIparameter("meshName", 's', f 371 param = new G4UIparameter("meshName", 's', false); 388 fill1DCmd->SetParameter(param); 372 fill1DCmd->SetParameter(param); 389 param = new G4UIparameter("scorerName", 's', 373 param = new G4UIparameter("scorerName", 's', false); 390 fill1DCmd->SetParameter(param); 374 fill1DCmd->SetParameter(param); 391 param = new G4UIparameter("copyNo", 'i', tru 375 param = new G4UIparameter("copyNo", 'i', true); 392 param->SetDefaultValue(0); 376 param->SetDefaultValue(0); 393 fill1DCmd->SetParameter(param); 377 fill1DCmd->SetParameter(param); >> 378 394 } 379 } 395 380 396 G4ScoringMessenger::~G4ScoringMessenger() 381 G4ScoringMessenger::~G4ScoringMessenger() 397 { 382 { 398 delete listCmd; << 383 delete listCmd; 399 delete verboseCmd; << 384 delete verboseCmd; 400 // << 385 // 401 delete meshBoxCreateCmd; << 386 delete meshBoxCreateCmd; 402 delete meshCylinderCreateCmd; << 387 delete meshCylinderCreateCmd; 403 delete meshRWLogVolCreateCmd; << 388 delete meshRWLogVolCreateCmd; 404 delete probeCreateCmd; << 389 delete probeCreateCmd; 405 delete meshCreateDir; << 390 delete meshCreateDir; 406 // << 391 // delete meshSphereCreateCmd; 407 delete meshOpnCmd; << 392 // 408 // << 393 delete meshOpnCmd; 409 delete meshClsCmd; << 394 // 410 delete meshDir; << 395 delete meshClsCmd; 411 // << 396 // delete meshActCmd; 412 delete mBoxSizeCmd; << 397 delete meshDir; 413 delete mCylinderSizeCmd; << 398 // 414 delete mCylinderRMinCmd; << 399 delete mBoxSizeCmd; 415 delete mCylinderAngleCmd; << 400 delete mCylinderSizeCmd; 416 // << 401 // delete mSphereSizeCmd; 417 delete mBinCmd; << 402 // 418 // << 403 delete mBinCmd; 419 delete mTResetCmd; << 404 // 420 delete mTXyzCmd; << 405 delete mTResetCmd; 421 delete mTransDir; << 406 delete mTXyzCmd; 422 delete mRotXCmd; << 407 delete mTransDir; 423 delete mRotYCmd; << 408 // delete mRResetCmd; 424 delete mRotZCmd; << 409 delete mRotXCmd; 425 delete mRotDir; << 410 delete mRotYCmd; 426 // << 411 delete mRotZCmd; 427 delete probeLocateCmd; << 412 delete mRotDir; 428 delete probeMatCmd; << 413 // 429 delete probeDir; << 414 delete probeLocateCmd; 430 // << 415 delete probeMatCmd; 431 delete dumpCmd; << 416 delete probeDir; 432 delete drawCmd; << 417 // 433 delete drawColumnCmd; << 418 //delete chartCmd; 434 delete listColorMapCmd; << 419 delete dumpCmd; 435 delete floatMinMaxCmd; << 420 delete drawCmd; 436 delete colorMapMinMaxCmd; << 421 delete drawColumnCmd; 437 delete colorMapDir; << 422 delete listColorMapCmd; 438 delete dumpQtyToFileCmd; << 423 delete floatMinMaxCmd; 439 delete dumpQtyWithFactorCmd; << 424 delete colorMapMinMaxCmd; 440 delete dumpAllQtsToFileCmd; << 425 delete colorMapDir; 441 delete dumpAllQtsWithFactorCmd; << 426 delete dumpQtyToFileCmd; 442 delete fill1DCmd; << 427 delete dumpQtyWithFactorCmd; 443 // << 428 delete dumpAllQtsToFileCmd; 444 delete scoreDir; << 429 delete dumpAllQtsWithFactorCmd; >> 430 delete fill1DCmd; >> 431 // >> 432 delete scoreDir; 445 } 433 } 446 434 447 void G4ScoringMessenger::SetNewValue(G4UIcomma << 435 void G4ScoringMessenger::SetNewValue(G4UIcommand * command,G4String newVal) 448 { 436 { 449 using MeshShape = G4VScoringMesh::MeshShape; 437 using MeshShape = G4VScoringMesh::MeshShape; 450 438 451 if(command == listCmd) << 439 if(command==listCmd) { 452 { << 440 fSMan->List(); 453 fSMan->List(); << 441 } else if(command==dumpCmd) { 454 } << 442 fSMan->Dump(); 455 else if(command == dumpCmd) << 443 } else if(command==drawCmd) { 456 { << 444 G4Tokenizer next(newVal); 457 fSMan->Dump(); << 445 G4String meshName = next(); 458 } << 446 G4String psName = next(); 459 else if(command == drawCmd) << 447 G4String colorMapName = next(); 460 { << 448 G4int axflg = StoI(next()); 461 G4Tokenizer next(newVal); << 449 fSMan->DrawMesh(meshName,psName,colorMapName,axflg); 462 G4String meshName = next(); << 450 } else if(command==drawColumnCmd) { 463 G4String psName = next(); << 451 G4Tokenizer next(newVal); 464 G4String colorMapName = next(); << 452 G4String meshName = next(); 465 G4int axflg = StoI(next()); << 453 G4String psName = next(); 466 fSMan->DrawMesh(meshName, psName, colorMap << 454 G4int iPlane = StoI(next()); 467 } << 455 G4int iColumn = StoI(next()); 468 else if(command == drawColumnCmd) << 456 G4String colorMapName = next(); 469 { << 457 fSMan->DrawMesh(meshName,psName,iPlane,iColumn,colorMapName); 470 G4Tokenizer next(newVal); << 458 // } else if(command==chartCmd ){ 471 G4String meshName = next(); << 459 // G4Tokenizer next(newVal); 472 G4String psName = next(); << 460 // G4String meshName = next(); 473 G4int iPlane = StoI(next()); << 461 // G4String psName = next(); 474 G4int iColumn = StoI(next()); << 462 // //G4bool onFlag = StoB(next()); 475 G4String colorMapName = next(); << 463 // G4String scaleOption = next(); 476 fSMan->DrawMesh(meshName, psName, iPlane, << 464 // fSMan->DrawChart(meshName,psName,onFlag,scaleOption); 477 } << 465 478 else if(command == dumpQtyToFileCmd) << 466 } else if(command==dumpQtyToFileCmd) { 479 { << 467 G4Tokenizer next(newVal); 480 G4Tokenizer next(newVal); << 468 G4String meshName = next(); 481 G4String meshName = next(); << 469 G4String psName = next(); 482 G4String psName = next(); << 470 G4String fileName = next(); 483 G4String fileName = next(); << 471 G4String option = next("\n"); 484 G4String option = next("\n"); << 472 auto mesh = fSMan->FindMesh(meshName); 485 auto mesh = fSMan->FindMesh(meshNa << 473 if(!mesh) 486 if(mesh == nullptr) << 487 { << 488 G4ExceptionDescription ed; << 489 ed << "Mesh name <" << meshName << "> is << 490 command->CommandFailed(ed); << 491 return; << 492 } << 493 fSMan->DumpQuantityToFile(meshName, psName << 494 } << 495 else if(command == dumpQtyWithFactorCmd) << 496 { << 497 G4Tokenizer next(newVal); << 498 G4String meshName = next(); << 499 G4String psName = next(); << 500 G4String fileName = next(); << 501 G4double fac = StoD(next()); << 502 G4String option = next("\n"); << 503 auto mesh = fSMan->FindMesh(meshNa << 504 if(mesh == nullptr) << 505 { << 506 G4ExceptionDescription ed; << 507 ed << "Mesh name <" << meshName << "> is << 508 command->CommandFailed(ed); << 509 return; << 510 } << 511 fSMan->SetFactor(fac); << 512 fSMan->DumpQuantityToFile(meshName, psName << 513 fSMan->SetFactor(1.0); << 514 } << 515 else if(command == dumpAllQtsToFileCmd) << 516 { << 517 G4Tokenizer next(newVal); << 518 G4String meshName = next(); << 519 G4String fileName = next(); << 520 G4String option = next("\n"); << 521 auto mesh = fSMan->FindMesh(meshNa << 522 if(mesh == nullptr) << 523 { << 524 G4ExceptionDescription ed; << 525 ed << "Mesh name <" << meshName << "> is << 526 command->CommandFailed(ed); << 527 return; << 528 } << 529 fSMan->DumpAllQuantitiesToFile(meshName, f << 530 } << 531 else if(command == dumpAllQtsWithFactorCmd) << 532 { << 533 G4Tokenizer next(newVal); << 534 G4String meshName = next(); << 535 G4String fileName = next(); << 536 G4double fac = StoD(next()); << 537 G4String option = next("\n"); << 538 auto mesh = fSMan->FindMesh(meshNa << 539 if(mesh == nullptr) << 540 { << 541 G4ExceptionDescription ed; << 542 ed << "Mesh name <" << meshName << "> is << 543 command->CommandFailed(ed); << 544 return; << 545 } << 546 fSMan->SetFactor(fac); << 547 fSMan->DumpAllQuantitiesToFile(meshName, f << 548 fSMan->SetFactor(1.0); << 549 } << 550 else if(command == fill1DCmd) << 551 { << 552 Fill1D(command, newVal); << 553 } << 554 else if(command == verboseCmd) << 555 { << 556 fSMan->SetVerboseLevel(verboseCmd->GetNewI << 557 } << 558 else if(command == meshBoxCreateCmd) << 559 { << 560 G4VScoringMesh* currentmesh = fSMan->GetCu << 561 if(currentmesh != nullptr) << 562 { << 563 G4ExceptionDescription ed; << 564 ed << "ERROR[" << meshBoxCreateCmd->GetC << 565 << currentmesh->GetWorldName() << 566 << "> is still open. Close it first. << 567 command->CommandFailed(ed); << 568 } << 569 else << 570 { << 571 G4VScoringMesh* mesh = fSMan->FindMesh(n << 572 if(mesh == nullptr) << 573 { << 574 mesh = new G4ScoringBox(newVal); << 575 fSMan->RegisterScoringMesh(mesh); << 576 } << 577 else << 578 { 474 { 579 G4ExceptionDescription ed; 475 G4ExceptionDescription ed; 580 ed << "ERROR[" << meshBoxCreateCmd->Ge << 476 ed << "Mesh name <" << meshName << "> is not found. Command ignored."; 581 << "] : Scoring mesh <" << newVal << 582 << "> already exists. Command ignor << 583 command->CommandFailed(ed); 477 command->CommandFailed(ed); >> 478 return; 584 } 479 } 585 } << 480 fSMan->DumpQuantityToFile(meshName, psName, fileName, option); 586 } << 481 } else if(command==dumpQtyWithFactorCmd) { 587 else if(command == meshCylinderCreateCmd) << 482 G4Tokenizer next(newVal); 588 { << 483 G4String meshName = next(); 589 G4VScoringMesh* currentmesh = fSMan->GetCu << 484 G4String psName = next(); 590 if(currentmesh != nullptr) << 485 G4String fileName = next(); 591 { << 486 G4double fac = StoD(next()); 592 G4ExceptionDescription ed; << 487 G4String option = next("\n"); 593 ed << "ERROR[" << meshCylinderCreateCmd- << 488 auto mesh = fSMan->FindMesh(meshName); 594 << currentmesh->GetWorldName() << 489 if(!mesh) 595 << "> is still open. Close it first. << 596 command->CommandFailed(ed); << 597 } << 598 else << 599 { << 600 G4VScoringMesh* mesh = fSMan->FindMesh(n << 601 if(mesh == nullptr) << 602 { << 603 mesh = new G4ScoringCylinder(newVal); << 604 fSMan->RegisterScoringMesh(mesh); << 605 } << 606 else << 607 { 490 { 608 G4ExceptionDescription ed; 491 G4ExceptionDescription ed; 609 ed << "ERROR[" << meshCylinderCreateCm << 492 ed << "Mesh name <" << meshName << "> is not found. Command ignored."; 610 << "] : Scoring mesh <" << newVal << 611 << "> already exists. Command ignor << 612 command->CommandFailed(ed); 493 command->CommandFailed(ed); >> 494 return; 613 } 495 } 614 } << 496 fSMan->SetFactor(fac); 615 } << 497 fSMan->DumpQuantityToFile(meshName, psName, fileName, option); 616 else if(command == meshRWLogVolCreateCmd) << 498 fSMan->SetFactor(1.0); 617 { << 499 } else if(command==dumpAllQtsToFileCmd) { 618 auto mesh = fSMan->GetCurrentMesh(); << 619 if(mesh != nullptr) << 620 { << 621 G4ExceptionDescription ed; << 622 ed << "ERROR[" << meshRWLogVolCreateCmd- << 623 << mesh->GetWorldName() << 624 << "> is still open. Close it first. << 625 command->CommandFailed(ed); << 626 } << 627 else << 628 { << 629 G4Tokenizer next(newVal); 500 G4Tokenizer next(newVal); 630 G4String meshName = next(); 501 G4String meshName = next(); 631 G4int idx = StoI(next()); << 502 G4String fileName = next(); 632 mesh = fSMan->FindMesh(mesh << 503 G4String option = next("\n"); 633 if(mesh == nullptr) << 504 auto mesh = fSMan->FindMesh(meshName); 634 { << 505 if(!mesh) 635 mesh = new G4ScoringRealWorld(meshName << 636 mesh->SetCopyNumberLevel(idx); << 637 fSMan->RegisterScoringMesh(mesh); << 638 } << 639 else << 640 { 506 { 641 G4ExceptionDescription ed; 507 G4ExceptionDescription ed; 642 ed << "ERROR[" << meshRWLogVolCreateCm << 508 ed << "Mesh name <" << meshName << "> is not found. Command ignored."; 643 << "] : Scoring mesh <" << meshName << 644 << "> already exists. Command ignor << 645 command->CommandFailed(ed); 509 command->CommandFailed(ed); >> 510 return; 646 } 511 } 647 } << 512 fSMan->DumpAllQuantitiesToFile(meshName, fileName, option); 648 } << 513 } else if(command==dumpAllQtsWithFactorCmd) { 649 else if(command == probeCreateCmd) << 650 { << 651 auto mesh = fSMan->GetCurrentMesh(); << 652 if(mesh != nullptr) << 653 { << 654 G4ExceptionDescription ed; << 655 ed << "ERROR[" << meshRWLogVolCreateCmd- << 656 << mesh->GetWorldName() << 657 << "> is still open. Close it first. << 658 command->CommandFailed(ed); << 659 } << 660 else << 661 { << 662 G4Tokenizer next(newVal); 514 G4Tokenizer next(newVal); 663 G4String qname = next(); << 515 G4String meshName = next(); 664 G4double halfSize = StoD(next()); << 516 G4String fileName = next(); 665 halfSize *= G4UIcommand::ValueOf(next()) << 517 G4double fac = StoD(next()); 666 G4bool checkOverlap = StoB(next()); << 518 G4String option = next("\n"); 667 mesh = fSMan->FindMesh(qn << 519 auto mesh = fSMan->FindMesh(meshName); 668 if(mesh == nullptr) << 520 if(!mesh) 669 { << 670 mesh = new G4ScoringProbe(qname, halfS << 671 fSMan->RegisterScoringMesh(mesh); << 672 } << 673 else << 674 { 521 { 675 G4ExceptionDescription ed; 522 G4ExceptionDescription ed; 676 ed << "ERROR[" << probeCreateCmd->GetC << 523 ed << "Mesh name <" << meshName << "> is not found. Command ignored."; 677 << qname << "> already exists. Use << 678 command->CommandFailed(ed); 524 command->CommandFailed(ed); >> 525 return; 679 } 526 } 680 } << 527 fSMan->SetFactor(fac); 681 } << 528 fSMan->DumpAllQuantitiesToFile(meshName, fileName, option); 682 else if(command == probeMatCmd || command == << 529 fSMan->SetFactor(1.0); 683 { << 530 } else if(command==fill1DCmd) { 684 auto mesh = fSMan->GetCurrentMesh(); << 531 Fill1D(command,newVal); 685 if(mesh == nullptr) << 532 } else if(command==verboseCmd) { 686 { << 533 fSMan->SetVerboseLevel(verboseCmd->GetNewIntValue(newVal)); 687 G4ExceptionDescription ed; << 534 } else if(command==meshBoxCreateCmd) { 688 ed << "ERROR : No mesh is currently open << 535 G4VScoringMesh* currentmesh = fSMan->GetCurrentMesh(); 689 "Command ignored."; << 536 if ( currentmesh ){ 690 command->CommandFailed(ed); << 537 G4ExceptionDescription ed; 691 return; << 538 ed << "ERROR[" << meshBoxCreateCmd->GetCommandPath() 692 } << 539 << "] : Mesh <" << currentmesh->GetWorldName() 693 if(mesh->GetShape() != MeshShape::probe) << 540 << "> is still open. Close it first. Command ignored."; 694 { << 541 command->CommandFailed(ed); 695 G4ExceptionDescription ed; << 542 } else { 696 ed << "ERROR : Inconsistent mesh type. C << 697 "Scoring Probe."; << 698 command->CommandFailed(ed); << 699 return; << 700 } << 701 543 702 if(command == probeMatCmd) << 544 G4VScoringMesh* mesh = fSMan->FindMesh(newVal); 703 { << 545 if ( !mesh ){ 704 G4bool succ = static_cast<G4ScoringProbe << 546 mesh = new G4ScoringBox(newVal); 705 if(!succ) << 547 fSMan->RegisterScoringMesh(mesh); 706 { << 548 }else{ >> 549 G4ExceptionDescription ed; >> 550 ed << "ERROR[" << meshBoxCreateCmd->GetCommandPath() >> 551 << "] : Scoring mesh <" << newVal >> 552 << "> already exists. Command ignored."; >> 553 command->CommandFailed(ed); >> 554 } >> 555 } >> 556 } else if(command==meshCylinderCreateCmd) { >> 557 G4VScoringMesh* currentmesh = fSMan->GetCurrentMesh(); >> 558 if ( currentmesh ){ 707 G4ExceptionDescription ed; 559 G4ExceptionDescription ed; 708 ed << "Material <" << newVal << 560 ed << "ERROR[" << meshCylinderCreateCmd->GetCommandPath() 709 << "> is not defind in G4NistManage << 561 << "] : Mesh <" << currentmesh->GetWorldName() 710 << "Use /material/nist/listMaterial << 562 << "> is still open. Close it first. Command ignored."; 711 "materials."; << 712 command->CommandFailed(ed); 563 command->CommandFailed(ed); 713 return; << 564 } else { 714 } << 565 715 } << 566 G4VScoringMesh* mesh = fSMan->FindMesh(newVal); 716 else if(command == probeLocateCmd) << 567 if ( !mesh ){ 717 { << 568 mesh = new G4ScoringCylinder(newVal); 718 G4ThreeVector loc = probeLocateCmd->GetN << 569 fSMan->RegisterScoringMesh(mesh); 719 static_cast<G4ScoringProbe*>(mesh)->Loca << 570 }else{ 720 } << 571 G4ExceptionDescription ed; 721 } << 572 ed << "ERROR[" << meshCylinderCreateCmd->GetCommandPath() 722 else if(command == listColorMapCmd) << 573 << "] : Scoring mesh <" << newVal 723 { << 574 << "> already exists. Command ignored."; 724 fSMan->ListScoreColorMaps(); << 575 command->CommandFailed(ed); 725 } << 576 } 726 else if(command == floatMinMaxCmd) << 577 } 727 { << 578 } else if(command==meshRWLogVolCreateCmd) { 728 G4VScoreColorMap* colorMap = fSMan->GetSco << 579 auto mesh = fSMan->GetCurrentMesh(); 729 if(colorMap != nullptr) << 580 if ( mesh ){ 730 { << 731 colorMap->SetFloatingMinMax(true); << 732 } << 733 else << 734 { << 735 G4ExceptionDescription ed; << 736 ed << "ERROR[" << floatMinMaxCmd->GetCom << 737 << newVal << "> is not defined. Comma << 738 command->CommandFailed(ed); << 739 } << 740 } << 741 else if(command == colorMapMinMaxCmd) << 742 { << 743 G4Tokenizer next(newVal); << 744 G4String mapName = next(); << 745 G4double minVal = StoD(next()); << 746 G4double maxVal = StoD(next()); << 747 G4VScoreColorMap* colorMap = fSMan->GetSco << 748 if(colorMap != nullptr) << 749 { << 750 colorMap->SetFloatingMinMax(false); << 751 colorMap->SetMinMax(minVal, maxVal); << 752 } << 753 else << 754 { << 755 G4ExceptionDescription ed; << 756 ed << "ERROR[" << colorMapMinMaxCmd->Get << 757 << newVal << "> is not defined. Comma << 758 command->CommandFailed(ed); << 759 } << 760 } << 761 else if(command == meshOpnCmd) << 762 { << 763 G4VScoringMesh* currentmesh = fSMan->GetCu << 764 if(currentmesh != nullptr) << 765 { << 766 G4ExceptionDescription ed; << 767 ed << "ERROR[" << meshOpnCmd->GetCommand << 768 << currentmesh->GetWorldName() << 769 << "> is still open. Close it first. << 770 command->CommandFailed(ed); << 771 } << 772 else << 773 { << 774 G4VScoringMesh* mesh = fSMan->FindMesh(n << 775 if(mesh == nullptr) << 776 { << 777 G4ExceptionDescription ed; 581 G4ExceptionDescription ed; 778 ed << "ERROR[" << meshOpnCmd->GetComma << 582 ed << "ERROR[" << meshRWLogVolCreateCmd->GetCommandPath() 779 << newVal << "> does not exist. Com << 583 << "] : Mesh <" << mesh->GetWorldName() >> 584 << "> is still open. Close it first. Command ignored."; 780 command->CommandFailed(ed); 585 command->CommandFailed(ed); 781 } 586 } 782 else 587 else 783 { 588 { 784 fSMan->SetCurrentMesh(mesh); << 589 G4Tokenizer next(newVal); >> 590 G4String meshName = next(); >> 591 G4int idx = StoI(next()); >> 592 mesh = fSMan->FindMesh(meshName); >> 593 if ( !mesh ){ >> 594 mesh = new G4ScoringRealWorld(meshName); >> 595 mesh->SetCopyNumberLevel(idx); >> 596 fSMan->RegisterScoringMesh(mesh); >> 597 }else{ >> 598 G4ExceptionDescription ed; >> 599 ed << "ERROR[" << meshRWLogVolCreateCmd->GetCommandPath() >> 600 << "] : Scoring mesh <" << meshName << "> already exists. Command ignored."; >> 601 command->CommandFailed(ed); >> 602 } 785 } 603 } 786 } << 604 } else if(command==probeCreateCmd) { 787 } << 605 auto mesh = fSMan->GetCurrentMesh(); 788 else if(command == meshClsCmd) << 606 if ( mesh ){ 789 { << 790 fSMan->CloseCurrentMesh(); << 791 } << 792 else << 793 { << 794 // << 795 // Get Current Mesh << 796 // << 797 G4VScoringMesh* mesh = fSMan->GetCurrentMe << 798 // << 799 // Commands for Current Mesh << 800 if(mesh != nullptr) << 801 { << 802 MeshShape shape = mesh->GetShape(); << 803 if(shape == MeshShape::realWorldLogVol) << 804 { << 805 G4ExceptionDescription ed; 607 G4ExceptionDescription ed; 806 ed << "ERROR[" << mBinCmd->GetCommandP << 608 ed << "ERROR[" << meshRWLogVolCreateCmd->GetCommandPath() 807 << "] : Number of mesh command cann << 609 << "] : Mesh <" << mesh->GetWorldName() 808 "Command ignored."; << 610 << "> is still open. Close it first. Command ignored."; 809 command->CommandFailed(ed); 611 command->CommandFailed(ed); 810 } 612 } 811 else 613 else 812 { 614 { 813 // Tokens << 615 G4Tokenizer next(newVal); 814 G4TokenVec token; << 616 G4String qname = next(); 815 FillTokenVec(newVal, token); << 617 G4double halfSize = StoD(next()); 816 // << 618 halfSize *= G4UIcommand::ValueOf(next()); 817 // Mesh Geometry << 619 G4bool checkOverlap = StoB(next()); 818 if(command == mBoxSizeCmd) << 620 mesh = fSMan->FindMesh(qname); 819 { << 621 if(!mesh) 820 if(shape == MeshShape::box) << 821 { << 822 G4ThreeVector size = mBoxSizeCmd-> << 823 G4double vsize[3]; << 824 vsize[0] = size.x(); << 825 vsize[1] = size.y(); << 826 vsize[2] = size.z(); << 827 mesh->SetSize(vsize); << 828 } << 829 else << 830 { << 831 G4ExceptionDescription ed; << 832 ed << "ERROR[" << mBoxSizeCmd->Get << 833 << "] : This mesh is not Box. C << 834 command->CommandFailed(ed); << 835 } << 836 } << 837 else if(command == mCylinderSizeCmd || << 838 command == mCylinderAngleCmd) << 839 { << 840 if(shape != MeshShape::cylinder) << 841 { << 842 G4ExceptionDescription ed; << 843 ed << "ERROR[" << command->GetComm << 844 << "] : This mesh is not Cylind << 845 command->CommandFailed(ed); << 846 } << 847 else << 848 { << 849 if(command == mCylinderSizeCmd) << 850 { << 851 G4double vsize[3]; << 852 vsize[0] = (mesh->GetSize()) << 853 vsize[1] = StoD(token[0]); << 854 vsize[2] = StoD(token[1]); << 855 G4double unt = mCylinderSizeCmd- << 856 vsize[1] *= unt; << 857 vsize[2] *= unt; << 858 mesh->SetSize(vsize); << 859 } << 860 else if(command == mCylinderRMinCm << 861 { << 862 G4double vsize[3]; << 863 vsize[0] = mCylinderRMinCmd->Get << 864 vsize[1] = (mesh->GetSize()).y() << 865 vsize[2] = (mesh->GetSize()).z() << 866 mesh->SetSize(vsize); << 867 } << 868 else if(command == mCylinderAngleC << 869 { << 870 G4double stphi = StoD(token[0]); << 871 G4double spphi = StoD(token[1]); << 872 G4double unt = mCylinderAngleC << 873 mesh->SetAngles(stphi * unt, spp << 874 } << 875 } << 876 } << 877 else if(command == mBinCmd) << 878 { << 879 MeshBinCommand(mesh, token); << 880 } << 881 else if(command == mTResetCmd) << 882 { << 883 G4double centerPosition[3] = { 0., 0 << 884 mesh->SetCenterPosition(centerPositi << 885 } << 886 else if(command == mTXyzCmd) << 887 { << 888 G4ThreeVector xyz = mTXyzCmd->GetNew << 889 G4double centerPosition[3]; << 890 centerPosition[0] = xyz.x(); << 891 centerPosition[1] = xyz.y(); << 892 centerPosition[2] = xyz.z(); << 893 mesh->SetCenterPosition(centerPositi << 894 } << 895 else if(command == mRotXCmd) << 896 { 622 { 897 G4double value = mRotXCmd->GetNewDou << 623 mesh = new G4ScoringProbe(qname,halfSize,checkOverlap); 898 mesh->RotateX(value); << 624 fSMan->RegisterScoringMesh(mesh); 899 } 625 } 900 else if(command == mRotYCmd) << 626 else 901 { 627 { 902 G4double value = mRotYCmd->GetNewDou << 628 G4ExceptionDescription ed; 903 mesh->RotateY(value); << 629 ed << "ERROR[" << probeCreateCmd->GetCommandPath() >> 630 << "] : Mesh name <" << qname << "> already exists. Use another name."; >> 631 command->CommandFailed(ed); 904 } 632 } 905 else if(command == mRotZCmd) << 633 } >> 634 } else if(command==probeMatCmd || command==probeLocateCmd) { >> 635 auto mesh = fSMan->GetCurrentMesh(); >> 636 if(!mesh) >> 637 { >> 638 G4ExceptionDescription ed; >> 639 ed << "ERROR : No mesh is currently open. Open/create a mesh first. Command ignored."; >> 640 command->CommandFailed(ed); >> 641 return; >> 642 } >> 643 if(mesh->GetShape() != MeshShape::probe) >> 644 { >> 645 G4ExceptionDescription ed; >> 646 ed << "ERROR : Inconsistent mesh type. Close current mesh and open Scoring Probe."; >> 647 command->CommandFailed(ed); >> 648 return; >> 649 } >> 650 >> 651 if(command==probeMatCmd) >> 652 { >> 653 G4bool succ = static_cast<G4ScoringProbe*>(mesh)->SetMaterial(newVal); >> 654 if(!succ) 906 { 655 { 907 G4double value = mRotZCmd->GetNewDou << 656 G4ExceptionDescription ed; 908 mesh->RotateZ(value); << 657 ed << "Material <" << newVal << "> is not defind in G4NistManager. Command is ignored.\n" >> 658 << "Use /material/nist/listMaterials command to see the available materials."; >> 659 command->CommandFailed(ed); >> 660 return; 909 } 661 } 910 } 662 } 911 } << 663 else if(command==probeLocateCmd) 912 else << 664 { 913 { << 665 G4ThreeVector loc = probeLocateCmd->GetNew3VectorValue(newVal); >> 666 static_cast<G4ScoringProbe*>(mesh)->LocateProbe(loc); >> 667 } >> 668 } else if(command==listColorMapCmd) { >> 669 fSMan->ListScoreColorMaps(); >> 670 } else if(command==floatMinMaxCmd) { >> 671 G4VScoreColorMap* colorMap = fSMan->GetScoreColorMap(newVal); >> 672 if(colorMap) >> 673 { colorMap->SetFloatingMinMax(true); } >> 674 else >> 675 { >> 676 G4ExceptionDescription ed; >> 677 ed << "ERROR[" << floatMinMaxCmd->GetCommandPath() >> 678 << "] : color map <" << newVal << "> is not defined. Command ignored." ; >> 679 command->CommandFailed(ed); >> 680 } >> 681 } else if(command==colorMapMinMaxCmd) { >> 682 G4Tokenizer next(newVal); >> 683 G4String mapName = next(); >> 684 G4double minVal = StoD(next()); >> 685 G4double maxVal = StoD(next()); >> 686 G4VScoreColorMap* colorMap = fSMan->GetScoreColorMap(mapName); >> 687 if(colorMap) >> 688 { colorMap->SetFloatingMinMax(false); >> 689 colorMap->SetMinMax(minVal,maxVal); } >> 690 else >> 691 { >> 692 G4ExceptionDescription ed; >> 693 ed << "ERROR[" << colorMapMinMaxCmd->GetCommandPath() >> 694 << "] : color map <" << newVal << "> is not defined. Command ignored." >> 695 << G4endl; >> 696 command->CommandFailed(ed); >> 697 } >> 698 } else if(command==meshOpnCmd) { >> 699 G4VScoringMesh* currentmesh = fSMan->GetCurrentMesh(); >> 700 if ( currentmesh ){ >> 701 G4ExceptionDescription ed; >> 702 ed << "ERROR[" << meshOpnCmd->GetCommandPath() >> 703 << "] : Mesh <" << currentmesh->GetWorldName() >> 704 << "> is still open. Close it first. Command ignored."; >> 705 command->CommandFailed(ed); >> 706 } else { >> 707 G4VScoringMesh* mesh = fSMan->FindMesh(newVal); >> 708 if ( !mesh ){ >> 709 G4ExceptionDescription ed; >> 710 ed << "ERROR[" << meshOpnCmd->GetCommandPath() >> 711 << "] : Scoring mesh <" << newVal << "> does not exist. Command ignored."; >> 712 command->CommandFailed(ed); >> 713 } else { >> 714 fSMan->SetCurrentMesh(mesh); >> 715 } >> 716 } >> 717 } else if(command==meshClsCmd) { >> 718 fSMan->CloseCurrentMesh(); >> 719 } else { >> 720 // >> 721 // Get Current Mesh >> 722 // >> 723 G4VScoringMesh* mesh = fSMan->GetCurrentMesh(); >> 724 // >> 725 // Commands for Current Mesh >> 726 if ( mesh ){ >> 727 MeshShape shape = mesh->GetShape(); >> 728 if ( shape == MeshShape::realWorldLogVol ) { >> 729 G4ExceptionDescription ed; >> 730 ed << "ERROR[" << mBinCmd->GetCommandPath() >> 731 << "] : Number of mesh command cannot be set for this type of mesh. Command ignored."; >> 732 command->CommandFailed(ed); >> 733 } else { >> 734 >> 735 // Tokens >> 736 G4TokenVec token; >> 737 FillTokenVec(newVal,token); >> 738 // >> 739 // Mesh Geometry >> 740 // >> 741 // if(command==meshActCmd) { >> 742 // mesh->Activate(meshActCmd->GetNewBoolValue(newVal)); >> 743 // } else >> 744 if(command==mBoxSizeCmd) { >> 745 if ( shape == MeshShape::box){ >> 746 G4ThreeVector size = mBoxSizeCmd->GetNew3VectorValue(newVal); >> 747 G4double vsize[3]; >> 748 vsize[0] = size.x(); >> 749 vsize[1] = size.y(); >> 750 vsize[2] = size.z(); >> 751 mesh->SetSize(vsize); >> 752 } else { >> 753 G4ExceptionDescription ed; >> 754 ed << "ERROR[" << mBoxSizeCmd->GetCommandPath() >> 755 << "] : This mesh is not Box. Command ignored."; >> 756 command->CommandFailed(ed); >> 757 } >> 758 }else if(command==mCylinderSizeCmd) { >> 759 if ( shape == MeshShape::cylinder ){ >> 760 G4double vsize[3]; >> 761 vsize[0] = StoD(token[0]); >> 762 vsize[1] = StoD(token[1]); >> 763 G4double unt = mCylinderSizeCmd->ValueOf(token[2]); >> 764 vsize[0] *= unt; >> 765 vsize[1] *= unt; >> 766 vsize[2] = 0.0; >> 767 mesh->SetSize(vsize); >> 768 } else { >> 769 G4ExceptionDescription ed; >> 770 ed << "ERROR[" << mBoxSizeCmd->GetCommandPath() >> 771 << "] : This mesh is not Box. Command ignored."; >> 772 command->CommandFailed(ed); >> 773 } >> 774 } else if(command==mBinCmd) { >> 775 MeshBinCommand(mesh,token); >> 776 } else if(command==mTResetCmd) { >> 777 G4double centerPosition[3] ={ 0., 0., 0.}; >> 778 mesh->SetCenterPosition(centerPosition); >> 779 } else if(command==mTXyzCmd) { >> 780 G4ThreeVector xyz = mTXyzCmd->GetNew3VectorValue(newVal); >> 781 G4double centerPosition[3]; >> 782 centerPosition[0] = xyz.x(); >> 783 centerPosition[1] = xyz.y(); >> 784 centerPosition[2] = xyz.z(); >> 785 mesh->SetCenterPosition(centerPosition); >> 786 // } else if(command==mRResetCmd) { >> 787 } else if(command==mRotXCmd) { >> 788 G4double value = mRotXCmd->GetNewDoubleValue(newVal); >> 789 mesh->RotateX(value); >> 790 } else if(command==mRotYCmd) { >> 791 G4double value = mRotYCmd->GetNewDoubleValue(newVal); >> 792 mesh->RotateY(value); >> 793 } else if(command==mRotZCmd) { >> 794 G4double value = mRotZCmd->GetNewDoubleValue(newVal); >> 795 mesh->RotateZ(value); >> 796 } >> 797 } >> 798 }else{ 914 G4ExceptionDescription ed; 799 G4ExceptionDescription ed; 915 ed << "ERROR: No mesh is currently open. << 800 ed << "ERROR: No mesh is currently open. Open/create a mesh first. Command ignored."; 916 "Command ignored."; << 917 command->CommandFailed(ed); 801 command->CommandFailed(ed); 918 } 802 } 919 } 803 } 920 } 804 } 921 805 922 G4String G4ScoringMessenger::GetCurrentValue(G << 806 G4String G4ScoringMessenger::GetCurrentValue(G4UIcommand * command) 923 { 807 { 924 G4String val; 808 G4String val; 925 if(command == verboseCmd) << 809 if(command==verboseCmd) 926 { << 810 { val = verboseCmd->ConvertToString(fSMan->GetVerboseLevel()); } 927 val = verboseCmd->ConvertToString(fSMan->G << 928 } << 929 811 930 return val; 812 return val; 931 } 813 } 932 814 933 void G4ScoringMessenger::FillTokenVec(const G4 << 815 void G4ScoringMessenger::FillTokenVec(G4String newValues, G4TokenVec& token){ 934 { << 816 935 G4Tokenizer next(newValues); << 817 G4Tokenizer next(newValues); 936 G4String val; << 818 G4String val; 937 while(!(val = next()).empty()) << 819 while ( !(val = next()).isNull() ) { // Loop checking 12.18.2015 M.Asai 938 { // Loop checking 12.18.2015 M.Asai << 820 token.push_back(val); 939 token.push_back(val); << 821 } 940 } << 941 } 822 } 942 823 943 void G4ScoringMessenger::MeshBinCommand(G4VSco << 944 { << 945 G4int Ni = StoI(token[0]); << 946 G4int Nj = StoI(token[1]); << 947 G4int Nk = StoI(token[2]); << 948 G4int nSegment[3]; << 949 824 950 if(dynamic_cast<G4ScoringBox*>(mesh) != null << 825 void G4ScoringMessenger::MeshBinCommand(G4VScoringMesh* mesh,G4TokenVec& token){ 951 { << 826 G4int Ni = StoI(token[0]); 952 G4cout << ".... G4ScoringMessenger::MeshBi << 827 G4int Nj = StoI(token[1]); 953 << G4endl; << 828 G4int Nk = StoI(token[2]); 954 nSegment[0] = Ni; << 829 G4int nSegment[3]; 955 nSegment[1] = Nj; << 830 956 nSegment[2] = Nk; << 831 if(dynamic_cast<G4ScoringBox*>(mesh)) { 957 } << 832 G4cout << ".... G4ScoringMessenger::MeshBinCommand - G4ScoringBox" << G4endl; 958 else if(dynamic_cast<G4ScoringCylinder*>(mes << 833 nSegment[0] = Ni; 959 { << 834 nSegment[1] = Nj; 960 G4cout << ".... G4ScoringMessenger::MeshBi << 835 nSegment[2] = Nk; 961 << G4endl; << 836 } else if(dynamic_cast<G4ScoringCylinder*>(mesh)) { 962 nSegment[0] = Nj; << 837 G4cout << ".... G4ScoringMessenger::MeshBinCommand - G4ScoringCylinder" << G4endl; 963 nSegment[1] = Nk; << 838 nSegment[0] = Nj; 964 nSegment[2] = Ni; << 839 nSegment[1] = Nk; 965 } << 840 nSegment[2] = Ni; 966 else << 841 } else { 967 { << 842 G4Exception("G4ScoringMessenger::MeshBinCommand()", "001", FatalException, "invalid mesh type"); 968 G4Exception("G4ScoringMessenger::MeshBinCo << 843 return; 969 "invalid mesh type"); << 844 } 970 return; << 845 // 971 } << 846 mesh->SetNumberOfSegments(nSegment); 972 // << 973 mesh->SetNumberOfSegments(nSegment); << 974 } 847 } 975 848 976 void G4ScoringMessenger::Fill1D(G4UIcommand* c << 849 #include "G4VPrimitivePlotter.hh" >> 850 #include "G4VScoreHistFiller.hh" >> 851 >> 852 void G4ScoringMessenger::Fill1D(G4UIcommand* cmd, G4String newVal) 977 { 853 { 978 using MeshShape = G4VScoringMesh::MeshShape; 854 using MeshShape = G4VScoringMesh::MeshShape; 979 855 980 G4Tokenizer next(newVal); 856 G4Tokenizer next(newVal); 981 G4int histID = StoI(next()); << 857 G4int histID = StoI(next()); 982 G4String meshName = next(); 858 G4String meshName = next(); 983 G4String primName = next(); 859 G4String primName = next(); 984 G4int copyNo = StoI(next()); << 860 G4int copyNo = StoI(next()); 985 861 986 auto filler = G4VScoreHistFiller::Instance() 862 auto filler = G4VScoreHistFiller::Instance(); 987 if(filler == nullptr) << 863 if(!filler) 988 { 864 { 989 G4ExceptionDescription ed; 865 G4ExceptionDescription ed; 990 ed << "G4TScoreHistFiller is not instantia 866 ed << "G4TScoreHistFiller is not instantiated in this application."; 991 cmd->CommandFailed(ed); 867 cmd->CommandFailed(ed); 992 return; 868 return; 993 } 869 } 994 // 870 // 995 // To do : check the validity of histID 871 // To do : check the validity of histID 996 // 872 // 997 873 998 auto sm = G4ScoringManager::GetScoringMana << 874 auto sm = G4ScoringManager::GetScoringManagerIfExist(); 999 auto mesh = sm->FindMesh(meshName); 875 auto mesh = sm->FindMesh(meshName); 1000 if(mesh == nullptr) << 876 if(mesh==nullptr) 1001 { 877 { 1002 G4ExceptionDescription ed; 878 G4ExceptionDescription ed; 1003 ed << "Mesh name <" << meshName << "> is 879 ed << "Mesh name <" << meshName << "> is not found."; 1004 cmd->CommandFailed(ed); 880 cmd->CommandFailed(ed); 1005 return; 881 return; 1006 } 882 } 1007 auto shape = mesh->GetShape(); 883 auto shape = mesh->GetShape(); 1008 if(shape != MeshShape::realWorldLogVol && s << 884 if(shape!=MeshShape::realWorldLogVol && shape!=MeshShape::probe) 1009 { 885 { 1010 G4ExceptionDescription ed; 886 G4ExceptionDescription ed; 1011 ed << "Mesh <" << meshName << 887 ed << "Mesh <" << meshName << "> is not real-world logical volume or probe."; 1012 << "> is not real-world logical volume << 1013 cmd->CommandFailed(ed); 888 cmd->CommandFailed(ed); 1014 return; 889 return; 1015 } 890 } 1016 891 1017 auto prim = mesh->GetPrimitiveScorer(primNa 892 auto prim = mesh->GetPrimitiveScorer(primName); 1018 if(prim == nullptr) << 893 if(prim==nullptr) 1019 { 894 { 1020 G4ExceptionDescription ed; 895 G4ExceptionDescription ed; 1021 ed << "Primitive scorer name <" << primNa 896 ed << "Primitive scorer name <" << primName << "> is not found."; 1022 cmd->CommandFailed(ed); 897 cmd->CommandFailed(ed); 1023 return; 898 return; 1024 } 899 } 1025 auto pp = dynamic_cast<G4VPrimitivePlotter* 900 auto pp = dynamic_cast<G4VPrimitivePlotter*>(prim); 1026 if(pp == nullptr) << 901 if(pp==nullptr) 1027 { 902 { 1028 G4ExceptionDescription ed; 903 G4ExceptionDescription ed; 1029 ed << "Primitive scorer <" << primName << 904 ed << "Primitive scorer <" << primName << "> does not support direct histogram filling."; 1030 << "> does not support direct histogra << 1031 cmd->CommandFailed(ed); 905 cmd->CommandFailed(ed); 1032 return; 906 return; 1033 } 907 } 1034 908 1035 pp->Plot(copyNo, histID); << 909 pp->Plot(copyNo,histID); 1036 } 910 } >> 911 1037 912