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 // G4UserPhysicsListMessenger implementation << 27 // 26 // 28 // Original author: H.Kurashige, 9 January 199 << 27 // $Id: G4UserPhysicsListMessenger.cc 108540 2018-02-16 09:30:43Z gcosmo $ 29 // ------------------------------------------- << 28 // >> 29 // >> 30 //--------------------------------------------------------------- >> 31 // >> 32 // G4UserPhysicsListMessenger.cc >> 33 // ------------------------------------------------------------ >> 34 // History >> 35 // first version 09 Jan. 1998 by H.Kurashige >> 36 // add buildPhysicsTable command 13 Apr. 1999 by H.Kurashige >> 37 // add setStoredInAscii command 12 Mar. 2001 by H.Kurashige >> 38 // add dumpOrderingParam command 3 May. 2011 by H.Kurashige >> 39 // ------------------------------------------------------------ >> 40 >> 41 #include <sstream> 30 42 31 #include "G4UserPhysicsListMessenger.hh" 43 #include "G4UserPhysicsListMessenger.hh" 32 44 33 #include "G4ParticleTable.hh" << 34 #include "G4PhysicsListHelper.hh" << 35 #include "G4SystemOfUnits.hh" 45 #include "G4SystemOfUnits.hh" 36 #include "G4Tokenizer.hh" << 46 #include "G4VUserPhysicsList.hh" >> 47 #include "G4PhysicsListHelper.hh" >> 48 #include "G4UIdirectory.hh" >> 49 #include "G4UIcmdWithoutParameter.hh" >> 50 #include "G4UIcmdWithAnInteger.hh" 37 #include "G4UIcmdWithADoubleAndUnit.hh" 51 #include "G4UIcmdWithADoubleAndUnit.hh" 38 #include "G4UIcmdWithAString.hh" 52 #include "G4UIcmdWithAString.hh" 39 #include "G4UIcmdWithAnInteger.hh" << 53 #include "G4ParticleTable.hh" 40 #include "G4UIcmdWithoutParameter.hh" << 41 #include "G4UIdirectory.hh" << 42 #include "G4UIparameter.hh" << 43 #include "G4VUserPhysicsList.hh" << 44 #include "G4ios.hh" 54 #include "G4ios.hh" >> 55 #include "G4Tokenizer.hh" 45 56 46 #include <sstream> << 57 G4UserPhysicsListMessenger::G4UserPhysicsListMessenger(G4VUserPhysicsList* pParticleList):thePhysicsList(pParticleList) 47 << 48 G4UserPhysicsListMessenger::G4UserPhysicsListM << 49 : thePhysicsList(pParticleList) << 50 { 58 { 51 G4UIparameter* param = nullptr; << 59 G4UIparameter* param = 0; 52 // /run/particle directory 60 // /run/particle directory 53 theDirectory = new G4UIdirectory("/run/parti 61 theDirectory = new G4UIdirectory("/run/particle/"); 54 theDirectory->SetGuidance("Commands for G4VU 62 theDirectory->SetGuidance("Commands for G4VUserPhysicsList."); 55 63 56 // /run/particle/Verbose command 64 // /run/particle/Verbose command 57 verboseCmd = new G4UIcmdWithAnInteger("/run/ << 65 verboseCmd = new G4UIcmdWithAnInteger("/run/particle/verbose",this); 58 verboseCmd->SetGuidance("Set the Verbose lev 66 verboseCmd->SetGuidance("Set the Verbose level of G4VUserPhysicsList."); 59 verboseCmd->SetGuidance(" 0 : Silent (defaul 67 verboseCmd->SetGuidance(" 0 : Silent (default)"); 60 verboseCmd->SetGuidance(" 1 : Display warnin 68 verboseCmd->SetGuidance(" 1 : Display warning messages"); 61 verboseCmd->SetGuidance(" 2 : Display more") 69 verboseCmd->SetGuidance(" 2 : Display more"); 62 verboseCmd->SetParameterName("level", true); << 70 verboseCmd->SetParameterName("level",true); 63 verboseCmd->SetDefaultValue(0); 71 verboseCmd->SetDefaultValue(0); 64 verboseCmd->SetRange("level >=0 && level <=3 72 verboseCmd->SetRange("level >=0 && level <=3"); 65 << 73 66 // /run/setCut command 74 // /run/setCut command 67 setCutCmd = new G4UIcmdWithADoubleAndUnit("/ << 75 setCutCmd = new G4UIcmdWithADoubleAndUnit("/run/setCut",this); 68 setCutCmd->SetGuidance("Set default cut valu 76 setCutCmd->SetGuidance("Set default cut value "); 69 setCutCmd->SetParameterName("cut", false); << 77 setCutCmd->SetParameterName("cut",false); 70 setCutCmd->SetDefaultValue(1.0); 78 setCutCmd->SetDefaultValue(1.0); 71 setCutCmd->SetRange("cut >=0.0"); 79 setCutCmd->SetRange("cut >=0.0"); 72 setCutCmd->SetDefaultUnit("mm"); 80 setCutCmd->SetDefaultUnit("mm"); 73 setCutCmd->AvailableForStates(G4State_PreIni << 81 setCutCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 74 82 75 // /run/setCutForAGivenParticle command 83 // /run/setCutForAGivenParticle command 76 setCutForAGivenParticleCmd = new G4UIcommand << 84 setCutForAGivenParticleCmd = new G4UIcommand("/run/setCutForAGivenParticle",this) ; 77 setCutForAGivenParticleCmd->SetGuidance("Set << 85 setCutForAGivenParticleCmd->SetGuidance("Set a cut value to a specific particle ") ; 78 setCutForAGivenParticleCmd->SetGuidance("Usa << 86 setCutForAGivenParticleCmd->SetGuidance("Usage: /run/setCutForAGivenParticle gamma 1. mm") ; 79 param = new G4UIparameter("particleName", 's << 87 param = new G4UIparameter("particleName",'s',false) ; 80 param->SetParameterCandidates("e- e+ gamma p 88 param->SetParameterCandidates("e- e+ gamma proton"); 81 setCutForAGivenParticleCmd->SetParameter(par << 89 setCutForAGivenParticleCmd->SetParameter(param) ; 82 param = new G4UIparameter("cut", 'd', false) << 90 param = new G4UIparameter("cut",'d',false) ; 83 param->SetDefaultValue("1."); << 91 param->SetDefaultValue("1.") ; 84 param->SetParameterRange("cut>=0.0"); << 92 param->SetParameterRange("cut>=0.0") ; 85 setCutForAGivenParticleCmd->SetParameter(par << 93 setCutForAGivenParticleCmd->SetParameter(param) ; 86 param = new G4UIparameter("unit", 's', false << 94 param = new G4UIparameter("unit",'s',false) ; 87 param->SetDefaultUnit("mm"); << 95 param->SetDefaultValue("mm") ; 88 setCutForAGivenParticleCmd->SetParameter(par << 96 setCutForAGivenParticleCmd->SetParameter(param) ; 89 setCutForAGivenParticleCmd->AvailableForStat << 97 setCutForAGivenParticleCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 90 98 91 // /run/getCutForAGivenParticle command 99 // /run/getCutForAGivenParticle command 92 getCutForAGivenParticleCmd = new G4UIcmdWith << 100 getCutForAGivenParticleCmd = new G4UIcmdWithAString("/run/getCutForAGivenParticle",this) ; 93 getCutForAGivenParticleCmd->SetGuidance("Get << 101 getCutForAGivenParticleCmd->SetGuidance("Get a cut value to a specific particle ") ; 94 getCutForAGivenParticleCmd->SetGuidance("Usa << 102 getCutForAGivenParticleCmd->SetGuidance("Usage: /run/getCutForAGivenParticle gamma ") ; 95 getCutForAGivenParticleCmd->SetParameterName << 103 getCutForAGivenParticleCmd->SetParameterName("particleName",false,false) ; 96 getCutForAGivenParticleCmd->SetCandidates("e 104 getCutForAGivenParticleCmd->SetCandidates("e- e+ gamma proton"); 97 getCutForAGivenParticleCmd->AvailableForStat << 105 getCutForAGivenParticleCmd->AvailableForStates(G4State_PreInit,G4State_Idle,G4State_GeomClosed,G4State_EventProc); 98 << 99 106 100 // /run/setCutForRegion command 107 // /run/setCutForRegion command 101 setCutRCmd = new G4UIcommand("/run/setCutFor << 108 setCutRCmd = new G4UIcommand("/run/setCutForRegion",this); 102 setCutRCmd->SetGuidance("Set cut value for a 109 setCutRCmd->SetGuidance("Set cut value for a region"); 103 param = new G4UIparameter("Region", 's', fal << 110 param = new G4UIparameter("Region",'s',false); 104 setCutRCmd->SetParameter(param); 111 setCutRCmd->SetParameter(param); 105 param = new G4UIparameter("cut", 'd', false) << 112 param = new G4UIparameter("cut",'d',false); 106 param->SetParameterRange("cut >=0.0"); 113 param->SetParameterRange("cut >=0.0"); 107 setCutRCmd->SetParameter(param); 114 setCutRCmd->SetParameter(param); 108 param = new G4UIparameter("Unit", 's', true) << 115 param = new G4UIparameter("Unit",'s',true); 109 param->SetDefaultValue("mm"); 116 param->SetDefaultValue("mm"); 110 param->SetParameterCandidates(setCutRCmd->Un 117 param->SetParameterCandidates(setCutRCmd->UnitsList(setCutRCmd->CategoryOf("mm"))); 111 setCutRCmd->SetParameter(param); 118 setCutRCmd->SetParameter(param); 112 setCutRCmd->AvailableForStates(G4State_Idle) 119 setCutRCmd->AvailableForStates(G4State_Idle); 113 120 114 // /run/particle/DumpList command 121 // /run/particle/DumpList command 115 dumpListCmd = new G4UIcmdWithoutParameter("/ << 122 dumpListCmd = new G4UIcmdWithoutParameter("/run/particle/dumpList",this); 116 dumpListCmd->SetGuidance("Dump List of parti 123 dumpListCmd->SetGuidance("Dump List of particles in G4VUserPhysicsList. "); 117 124 118 // /run/particle/addProcManager command 125 // /run/particle/addProcManager command 119 addProcManCmd = new G4UIcmdWithAString("/run 126 addProcManCmd = new G4UIcmdWithAString("/run/particle/addProcManager", this); 120 addProcManCmd->SetToBeBroadcasted(false); 127 addProcManCmd->SetToBeBroadcasted(false); 121 addProcManCmd->SetGuidance("add process mana 128 addProcManCmd->SetGuidance("add process manager to specified particle type"); 122 addProcManCmd->SetParameterName("particleTyp 129 addProcManCmd->SetParameterName("particleType", true); 123 addProcManCmd->SetDefaultValue(""); 130 addProcManCmd->SetDefaultValue(""); 124 addProcManCmd->AvailableForStates(G4State_Pr << 131 addProcManCmd->AvailableForStates(G4State_PreInit,G4State_Init,G4State_Idle,G4State_GeomClosed,G4State_EventProc); 125 G4State_Ev << 126 132 127 // /run/particle/buildPhysicsTable command 133 // /run/particle/buildPhysicsTable command 128 buildPTCmd = new G4UIcmdWithAString("/run/pa 134 buildPTCmd = new G4UIcmdWithAString("/run/particle/buildPhysicsTable", this); 129 buildPTCmd->SetGuidance("build physics table 135 buildPTCmd->SetGuidance("build physics table of specified particle type"); 130 buildPTCmd->SetParameterName("particleType", 136 buildPTCmd->SetParameterName("particleType", true); 131 buildPTCmd->SetDefaultValue(""); 137 buildPTCmd->SetDefaultValue(""); 132 buildPTCmd->AvailableForStates(G4State_Init, << 138 buildPTCmd->AvailableForStates(G4State_Init,G4State_Idle,G4State_GeomClosed,G4State_EventProc); 133 139 134 // /run/particle/storePhysicsTable command 140 // /run/particle/storePhysicsTable command 135 storeCmd = new G4UIcmdWithAString("/run/part << 141 storeCmd = new G4UIcmdWithAString("/run/particle/storePhysicsTable",this); 136 storeCmd->SetGuidance("Store Physics Table") 142 storeCmd->SetGuidance("Store Physics Table"); 137 storeCmd->SetGuidance(" Enter directory nam 143 storeCmd->SetGuidance(" Enter directory name"); 138 storeCmd->SetParameterName("dirName", true); << 144 storeCmd->SetParameterName("dirName",true); 139 storeCmd->SetDefaultValue(""); 145 storeCmd->SetDefaultValue(""); 140 storeCmd->AvailableForStates(G4State_Idle); 146 storeCmd->AvailableForStates(G4State_Idle); 141 147 142 // /run/particle/retrievePhysicsTable comma 148 // /run/particle/retrievePhysicsTable command 143 retrieveCmd = new G4UIcmdWithAString("/run/p << 149 retrieveCmd = new G4UIcmdWithAString("/run/particle/retrievePhysicsTable",this); 144 retrieveCmd->SetGuidance("Retrieve Physics T 150 retrieveCmd->SetGuidance("Retrieve Physics Table"); 145 retrieveCmd->SetGuidance(" Enter directory 151 retrieveCmd->SetGuidance(" Enter directory name or OFF to switch off"); 146 retrieveCmd->SetParameterName("dirName", tru << 152 retrieveCmd->SetParameterName("dirName",true); 147 retrieveCmd->SetDefaultValue(""); 153 retrieveCmd->SetDefaultValue(""); 148 retrieveCmd->AvailableForStates(G4State_PreI << 154 retrieveCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 149 155 150 // /run/particle/setStoredInAscii command 156 // /run/particle/setStoredInAscii command 151 asciiCmd = new G4UIcmdWithAnInteger("/run/pa << 157 asciiCmd = new G4UIcmdWithAnInteger("/run/particle/setStoredInAscii",this); 152 asciiCmd->SetGuidance("Switch on/off ascii m << 158 asciiCmd->SetGuidance("Switch on/off ascii mode in store/retreive Physics Table"); 153 asciiCmd->SetGuidance(" Enter 0(binary) or 159 asciiCmd->SetGuidance(" Enter 0(binary) or 1(ascii)"); 154 asciiCmd->SetParameterName("ascii", true); << 160 asciiCmd->SetParameterName("ascii",true); 155 asciiCmd->SetDefaultValue(0); 161 asciiCmd->SetDefaultValue(0); 156 asciiCmd->AvailableForStates(G4State_PreInit << 162 asciiCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 157 asciiCmd->SetRange("ascii ==0 || ascii ==1") 163 asciiCmd->SetRange("ascii ==0 || ascii ==1"); 158 164 159 // Commnad /run/particle/applyCuts comman << 165 //Commnad /run/particle/applyCuts command 160 applyCutsCmd = new G4UIcommand("/run/particl << 166 applyCutsCmd = new G4UIcommand("/run/particle/applyCuts",this); 161 applyCutsCmd->SetGuidance("Set applyCuts fla 167 applyCutsCmd->SetGuidance("Set applyCuts flag for a particle."); 162 applyCutsCmd->SetGuidance(" Some EM processe 168 applyCutsCmd->SetGuidance(" Some EM processes which do not have infrared divergence"); 163 applyCutsCmd->SetGuidance("may generate gamm 169 applyCutsCmd->SetGuidance("may generate gamma, e- and/or e+ with kinetic energies"); 164 applyCutsCmd->SetGuidance("below the product 170 applyCutsCmd->SetGuidance("below the production threshold. By setting this flag,"); 165 applyCutsCmd->SetGuidance("such secondaries 171 applyCutsCmd->SetGuidance("such secondaries below threshold are eliminated and"); 166 applyCutsCmd->SetGuidance("kinetic energies 172 applyCutsCmd->SetGuidance("kinetic energies of such secondaries are accumulated"); 167 applyCutsCmd->SetGuidance("to the energy dep 173 applyCutsCmd->SetGuidance("to the energy deposition of their mother."); 168 applyCutsCmd->SetGuidance(" Note that 'apply 174 applyCutsCmd->SetGuidance(" Note that 'applyCuts' makes sense only for gamma,"); 169 applyCutsCmd->SetGuidance("e- and e+. If thi 175 applyCutsCmd->SetGuidance("e- and e+. If this command is issued for other particle,"); 170 applyCutsCmd->SetGuidance("a warning message 176 applyCutsCmd->SetGuidance("a warning message is displayed and the command is"); 171 applyCutsCmd->SetGuidance("ignored."); 177 applyCutsCmd->SetGuidance("ignored."); 172 applyCutsCmd->SetGuidance(" If particle name 178 applyCutsCmd->SetGuidance(" If particle name is 'all', this command affects on"); 173 applyCutsCmd->SetGuidance("gamma, e- and e+. 179 applyCutsCmd->SetGuidance("gamma, e- and e+."); 174 param = new G4UIparameter("Flag", 's', true) << 180 param = new G4UIparameter("Flag",'s',true); 175 param->SetDefaultValue("true"); 181 param->SetDefaultValue("true"); 176 applyCutsCmd->SetParameter(param); 182 applyCutsCmd->SetParameter(param); 177 param = new G4UIparameter("Particle", 's', t << 183 param = new G4UIparameter("Particle",'s',true); 178 param->SetDefaultValue("all"); 184 param->SetDefaultValue("all"); 179 applyCutsCmd->SetParameter(param); 185 applyCutsCmd->SetParameter(param); 180 applyCutsCmd->AvailableForStates(G4State_Pre << 186 applyCutsCmd->AvailableForStates(G4State_PreInit,G4State_Init,G4State_Idle); 181 187 182 // /run/particle/dumpCutValues command 188 // /run/particle/dumpCutValues command 183 dumpCutValuesCmd = new G4UIcmdWithAString("/ << 189 dumpCutValuesCmd = new G4UIcmdWithAString("/run/particle/dumpCutValues",this); 184 dumpCutValuesCmd->SetGuidance("Dump a list o 190 dumpCutValuesCmd->SetGuidance("Dump a list of production threshold values in range and energy"); 185 dumpCutValuesCmd->SetGuidance("for all regis 191 dumpCutValuesCmd->SetGuidance("for all registered material-cuts-couples."); 186 dumpCutValuesCmd->SetGuidance("Dumping a lis 192 dumpCutValuesCmd->SetGuidance("Dumping a list takes place when you issue 'beamOn' and"); 187 dumpCutValuesCmd->SetGuidance("actual conver 193 dumpCutValuesCmd->SetGuidance("actual conversion tables from range to energy are available."); 188 dumpCutValuesCmd->SetGuidance( << 194 dumpCutValuesCmd->SetGuidance("If you want a list 'immediately', use '/run/dumpRegion' for threshold"); 189 "If you want a list 'immediately', use '/r << 195 dumpCutValuesCmd->SetGuidance("list given in gange only. Also, '/run/dumpCouples' gives you the"); 190 dumpCutValuesCmd->SetGuidance("list given in << 196 dumpCutValuesCmd->SetGuidance("current list if you have already issued 'run/beamOn' at least once."); 191 dumpCutValuesCmd->SetGuidance( << 197 dumpCutValuesCmd->SetParameterName("particle",true); 192 "current list if you have already issued ' << 193 dumpCutValuesCmd->SetParameterName("particle << 194 dumpCutValuesCmd->SetDefaultValue("all"); 198 dumpCutValuesCmd->SetDefaultValue("all"); 195 dumpCutValuesCmd->AvailableForStates(G4State 199 dumpCutValuesCmd->AvailableForStates(G4State_Idle); 196 200 197 // /run/particle/dumpCutValues command 201 // /run/particle/dumpCutValues command 198 dumpOrdParamCmd = new G4UIcmdWithAnInteger(" << 202 dumpOrdParamCmd = new G4UIcmdWithAnInteger("/run/particle/dumpOrderingParam",this); 199 dumpOrdParamCmd->SetGuidance("Dump a list of 203 dumpOrdParamCmd->SetGuidance("Dump a list of ordering parameter "); 200 dumpOrdParamCmd->SetParameterName("subtype", << 204 dumpOrdParamCmd->SetParameterName("subtype",true); 201 dumpOrdParamCmd->SetDefaultValue(-1); 205 dumpOrdParamCmd->SetDefaultValue(-1); 202 dumpOrdParamCmd->AvailableForStates(G4State_ << 206 dumpOrdParamCmd->AvailableForStates(G4State_PreInit,G4State_Init,G4State_Idle); 203 } 207 } 204 208 205 // ------------------------------------------- << 206 G4UserPhysicsListMessenger::~G4UserPhysicsList 209 G4UserPhysicsListMessenger::~G4UserPhysicsListMessenger() 207 { 210 { 208 delete setCutCmd; << 211 delete setCutCmd; 209 delete setCutRCmd; 212 delete setCutRCmd; 210 delete setCutForAGivenParticleCmd; 213 delete setCutForAGivenParticleCmd; 211 delete getCutForAGivenParticleCmd; 214 delete getCutForAGivenParticleCmd; 212 delete verboseCmd; 215 delete verboseCmd; 213 delete dumpListCmd; 216 delete dumpListCmd; 214 delete addProcManCmd; 217 delete addProcManCmd; 215 delete buildPTCmd; 218 delete buildPTCmd; 216 delete storeCmd; << 219 delete storeCmd; 217 delete retrieveCmd; 220 delete retrieveCmd; 218 delete asciiCmd; 221 delete asciiCmd; 219 delete applyCutsCmd; 222 delete applyCutsCmd; 220 delete dumpCutValuesCmd; 223 delete dumpCutValuesCmd; 221 delete dumpOrdParamCmd; 224 delete dumpOrdParamCmd; 222 delete theDirectory; 225 delete theDirectory; 223 } 226 } 224 227 225 // ------------------------------------------- << 228 void G4UserPhysicsListMessenger::SetNewValue(G4UIcommand * command,G4String newValue) 226 void G4UserPhysicsListMessenger::SetNewValue(G << 227 { 229 { 228 G4ExceptionDescription ed; 230 G4ExceptionDescription ed; 229 if (command == setCutCmd) { << 231 if( command==setCutCmd ){ 230 G4double newCut = setCutCmd->GetNewDoubleV << 232 G4double newCut = setCutCmd->GetNewDoubleValue(newValue); 231 thePhysicsList->SetDefaultCutValue(newCut) 233 thePhysicsList->SetDefaultCutValue(newCut); 232 thePhysicsList->SetCuts(); 234 thePhysicsList->SetCuts(); 233 } << 235 234 else if (command == setCutForAGivenParticleC << 236 } else if( command==setCutForAGivenParticleCmd ){ 235 G4String particleName, unit; << 237 G4String particleName, unit ; G4double cut ; 236 G4double cut; << 238 std::istringstream str (newValue) ; 237 std::istringstream str(newValue); << 239 str >> particleName >> cut >> unit ; 238 str >> particleName >> cut >> unit; << 240 thePhysicsList->SetCutValue(cut*G4UIcommand::ValueOf(unit), particleName) ; 239 thePhysicsList->SetCutValue(cut * G4UIcomm << 241 240 } << 242 } else if( command==getCutForAGivenParticleCmd ){ 241 else if (command == getCutForAGivenParticleC << 243 G4cout << thePhysicsList->GetCutValue(newValue)/mm <<"[mm]" << G4endl ; 242 G4cout << thePhysicsList->GetCutValue(newV << 244 243 } << 245 } else if( command==setCutRCmd ){ 244 else if (command == setCutRCmd) { << 245 std::istringstream is(newValue); 246 std::istringstream is(newValue); 246 G4String regName; 247 G4String regName; 247 G4String uniName; 248 G4String uniName; 248 G4double cVal = -1.0; 249 G4double cVal = -1.0; 249 is >> regName >> cVal >> uniName; 250 is >> regName >> cVal >> uniName; 250 if (is.fail()) { 251 if (is.fail()) { 251 ed << "illegal arguments : " << newValue 252 ed << "illegal arguments : " << newValue; 252 command->CommandFailed(ed); 253 command->CommandFailed(ed); 253 return; 254 return; 254 } 255 } 255 thePhysicsList->SetCutsForRegion(cVal * (s << 256 thePhysicsList->SetCutsForRegion(cVal*(setCutRCmd->ValueOf(uniName)),regName); 256 } << 257 257 else if (command == verboseCmd) { << 258 } else if( command==verboseCmd ) { 258 thePhysicsList->SetVerboseLevel(verboseCmd << 259 thePhysicsList->SetVerboseLevel(verboseCmd->GetNewIntValue(newValue)); 259 } << 260 260 else if (command == dumpListCmd) { << 261 } else if( command==dumpListCmd ){ 261 thePhysicsList->DumpList(); 262 thePhysicsList->DumpList(); 262 } << 263 263 else if (command == dumpOrdParamCmd) { << 264 } else if( command==dumpOrdParamCmd ){ 264 G4int stype = dumpOrdParamCmd->GetNewIntVa 265 G4int stype = dumpOrdParamCmd->GetNewIntValue(newValue); 265 G4PhysicsListHelper::GetPhysicsListHelper( 266 G4PhysicsListHelper::GetPhysicsListHelper()->DumpOrdingParameterTable(stype); 266 } << 267 267 else if (command == addProcManCmd) { << 268 } else if( command == addProcManCmd ){ 268 G4ParticleDefinition* particle = (G4Partic 269 G4ParticleDefinition* particle = (G4ParticleTable::GetParticleTable())->FindParticle(newValue); 269 if (particle == nullptr) { << 270 if (particle == 0) >> 271 { 270 ed << " Particle is not found : " << new 272 ed << " Particle is not found : " << newValue; 271 command->CommandFailed(ed); 273 command->CommandFailed(ed); 272 return; 274 return; 273 } 275 } 274 if (particle->GetProcessManager() != nullp << 276 else if (particle->GetProcessManager() != 0) >> 277 { 275 ed << " Particle is not initialized : " 278 ed << " Particle is not initialized : " << newValue; 276 command->CommandFailed(ed); 279 command->CommandFailed(ed); 277 return; 280 return; 278 } 281 } 279 thePhysicsList->AddProcessManager(particle 282 thePhysicsList->AddProcessManager(particle); 280 } << 283 281 else if (command == buildPTCmd) { << 284 } else if( command == buildPTCmd ){ 282 G4ParticleDefinition* particle = (G4Partic 285 G4ParticleDefinition* particle = (G4ParticleTable::GetParticleTable())->FindParticle(newValue); 283 if (particle == nullptr) { << 286 if (particle == 0) >> 287 { 284 ed << " Particle is not found : " << new 288 ed << " Particle is not found : " << newValue; 285 command->CommandFailed(ed); 289 command->CommandFailed(ed); 286 return; 290 return; 287 } 291 } 288 thePhysicsList->PreparePhysicsTable(partic 292 thePhysicsList->PreparePhysicsTable(particle); 289 thePhysicsList->BuildPhysicsTable(particle 293 thePhysicsList->BuildPhysicsTable(particle); 290 } << 294 291 else if (command == storeCmd) { << 295 } else if ( command == storeCmd ){ 292 thePhysicsList->StorePhysicsTable(newValue 296 thePhysicsList->StorePhysicsTable(newValue); 293 } << 297 294 else if (command == retrieveCmd) { << 298 } else if( command == retrieveCmd ) { 295 if ((newValue == "OFF") || (newValue == "o << 299 if ((newValue == "OFF") || (newValue == "off") ){ 296 thePhysicsList->ResetPhysicsTableRetriev 300 thePhysicsList->ResetPhysicsTableRetrieved(); 297 } << 301 } else { 298 else { << 299 thePhysicsList->SetPhysicsTableRetrieved 302 thePhysicsList->SetPhysicsTableRetrieved(newValue); 300 } 303 } 301 } << 304 302 else if (command == asciiCmd) { << 305 } else if( command == asciiCmd ) { 303 if (asciiCmd->GetNewIntValue(newValue) == 306 if (asciiCmd->GetNewIntValue(newValue) == 0) { 304 thePhysicsList->ResetStoredInAscii(); 307 thePhysicsList->ResetStoredInAscii(); 305 } << 308 } else { 306 else { << 307 thePhysicsList->SetStoredInAscii(); 309 thePhysicsList->SetStoredInAscii(); 308 } 310 } 309 } << 311 310 else if (command == applyCutsCmd) { << 312 } else if( command == applyCutsCmd ) { 311 G4Tokenizer next(newValue); << 313 G4Tokenizer next( newValue ); 312 314 313 // check 1st argument 315 // check 1st argument 314 G4String temp = G4String(next()); 316 G4String temp = G4String(next()); 315 G4bool flag = (temp == "true" || temp == " << 317 G4bool flag = (temp =="true" || temp=="TRUE"); 316 318 317 // check 2nd argument 319 // check 2nd argument 318 G4String name = G4String(next()); 320 G4String name = G4String(next()); 319 321 320 thePhysicsList->SetApplyCuts(flag, name); 322 thePhysicsList->SetApplyCuts(flag, name); 321 } << 323 322 else if (command == dumpCutValuesCmd) { << 324 } else if( command == dumpCutValuesCmd ) { 323 thePhysicsList->DumpCutValuesTable(1); 325 thePhysicsList->DumpCutValuesTable(1); >> 326 324 } 327 } 325 } << 328 } 326 329 327 // ------------------------------------------- << 330 G4String G4UserPhysicsListMessenger::GetCurrentValue(G4UIcommand * command) 328 G4String G4UserPhysicsListMessenger::GetCurren << 329 { 331 { 330 G4String cv; 332 G4String cv; 331 G4String candidates("none"); 333 G4String candidates("none"); 332 auto piter = G4ParticleTable::GetParticleTab << 334 G4ParticleTable::G4PTblDicIterator *piter = (G4ParticleTable::GetParticleTable())->GetIterator(); 333 << 335 334 if (command == setCutCmd) { << 336 if( command==setCutCmd ) { 335 cv = setCutCmd->ConvertToString(thePhysics << 337 cv = setCutCmd->ConvertToString( thePhysicsList->GetDefaultCutValue(), "mm" ); 336 } << 338 337 else if (command == verboseCmd) { << 339 } else if( command==verboseCmd ){ 338 cv = verboseCmd->ConvertToString(thePhysic 340 cv = verboseCmd->ConvertToString(thePhysicsList->GetVerboseLevel()); 339 } << 341 340 else if (command == addProcManCmd) { << 342 } else if( command== addProcManCmd ){ 341 // set candidate list 343 // set candidate list 342 piter->reset(); << 344 piter -> reset(); 343 while ((*piter)()) { << 345 while( (*piter)() ){ 344 G4ParticleDefinition* particle = piter-> << 346 G4ParticleDefinition *particle = piter->value(); 345 candidates += " " + particle->GetParticl 347 candidates += " " + particle->GetParticleName(); 346 } 348 } 347 addProcManCmd->SetCandidates(candidates); << 349 addProcManCmd->SetCandidates(candidates); 348 cv = ""; 350 cv = ""; 349 } << 351 350 else if (command == buildPTCmd) { << 352 } else if( command== buildPTCmd ){ 351 // set candidate list 353 // set candidate list 352 piter->reset(); << 354 piter -> reset(); 353 while ((*piter)()) { << 355 while( (*piter)() ){ 354 G4ParticleDefinition* particle = piter-> << 356 G4ParticleDefinition *particle = piter->value(); 355 candidates += " " + particle->GetParticl 357 candidates += " " + particle->GetParticleName(); 356 } 358 } 357 addProcManCmd->SetCandidates(candidates); << 359 addProcManCmd->SetCandidates(candidates); 358 cv = ""; 360 cv = ""; 359 } << 361 360 else if (command == storeCmd) { << 362 } else if ( command == storeCmd ){ 361 cv = thePhysicsList->GetPhysicsTableDirect 363 cv = thePhysicsList->GetPhysicsTableDirectory(); 362 } << 364 363 else if (command == retrieveCmd) { << 365 }else if( command == retrieveCmd ) { 364 if (thePhysicsList->IsPhysicsTableRetrieve 366 if (thePhysicsList->IsPhysicsTableRetrieved()) { 365 cv = thePhysicsList->GetPhysicsTableDire 367 cv = thePhysicsList->GetPhysicsTableDirectory(); 366 } << 368 } else { 367 else { << 368 cv = "OFF"; 369 cv = "OFF"; 369 } 370 } 370 } << 371 371 else if (command == asciiCmd) { << 372 } else if( command==asciiCmd ){ 372 if (thePhysicsList->IsStoredInAscii()) { << 373 if (thePhysicsList->IsStoredInAscii()){ 373 cv = "1"; 374 cv = "1"; 374 } << 375 } else { 375 else { << 376 cv = "0"; 376 cv = "0"; 377 } 377 } 378 } << 379 378 >> 379 // } else if( command == applyCutsCmd ) { >> 380 // if (thePhysicsList->GetApplyCuts("gamma")){ >> 381 // cv = "true"; >> 382 // } else { >> 383 // cv = "false"; >> 384 // } >> 385 } >> 386 380 return cv; 387 return cv; 381 } 388 } 382 389