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