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