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