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 // G4ProcessTableMessenger class implementatio << 27 // 26 // 28 // Author: H.Kurashige, 15 August 1998 << 27 // $Id: G4ProcessTableMessenger.cc,v 1.18 2008/03/14 02:55:04 kurasige Exp $ 29 // ------------------------------------------- << 28 // GEANT4 tag $Name: geant4-09-02 $ >> 29 // >> 30 // >> 31 //--------------------------------------------------------------- >> 32 // >> 33 // G4ProcessTableMessenger.cc >> 34 // >> 35 // Description: >> 36 // This is a messenger class to interface to exchange information >> 37 // between ProcessTable and UI. >> 38 // >> 39 // >> 40 // History: >> 41 // 15 Aug. 1998, H. Kurashige >> 42 // Use STL vector instead of RW vector 1. Mar 00 H.Kurashige >> 43 // 02 June 2006, add physicsModified in activate/inactivate (mma) >> 44 // >> 45 //--------------------------------------------------------------- 30 46 31 #include "G4ProcessTableMessenger.hh" 47 #include "G4ProcessTableMessenger.hh" 32 48 33 #include "G4UImanager.hh" 49 #include "G4UImanager.hh" 34 #include "G4UIdirectory.hh" 50 #include "G4UIdirectory.hh" 35 #include "G4UIcmdWithoutParameter.hh" 51 #include "G4UIcmdWithoutParameter.hh" 36 #include "G4UIcmdWithAnInteger.hh" 52 #include "G4UIcmdWithAnInteger.hh" 37 #include "G4UIcmdWithAString.hh" 53 #include "G4UIcmdWithAString.hh" 38 54 39 #include "G4VProcess.hh" 55 #include "G4VProcess.hh" 40 #include "G4ProcessManager.hh" 56 #include "G4ProcessManager.hh" 41 #include "G4ProcessTable.hh" 57 #include "G4ProcessTable.hh" 42 #include "G4ParticleTable.hh" 58 #include "G4ParticleTable.hh" 43 59 44 #include "G4ios.hh" 60 #include "G4ios.hh" 45 #include "G4Tokenizer.hh" 61 #include "G4Tokenizer.hh" 46 #include <iomanip> 62 #include <iomanip> 47 #include <sstream> 63 #include <sstream> 48 64 49 G4ThreadLocal G4int G4ProcessTableMessenger::N << 65 ///////////////////////////////////////// >> 66 G4int G4ProcessTableMessenger::NumberOfProcessType = 10; 50 67 51 // ------------------------------------------- << 68 ////////////////////////// 52 G4ProcessTableMessenger::G4ProcessTableMesseng 69 G4ProcessTableMessenger::G4ProcessTableMessenger(G4ProcessTable* pTable) 53 : theProcessTable(pTable) << 70 :theProcessTable(pTable), >> 71 currentProcessTypeName("all"), >> 72 currentProcessName("all"), >> 73 currentParticleName("all") 54 { 74 { 55 // Command /particle/process << 75 //Commnad /particle/process 56 thisDirectory = new G4UIdirectory("/process/ 76 thisDirectory = new G4UIdirectory("/process/"); 57 thisDirectory->SetGuidance("Process Table co 77 thisDirectory->SetGuidance("Process Table control commands."); 58 78 59 // Command /particle/process/list << 79 >> 80 //Commnad /particle/process/list 60 listCmd = new G4UIcmdWithAString("/process/l 81 listCmd = new G4UIcmdWithAString("/process/list",this); 61 listCmd->SetGuidance("List up process names" 82 listCmd->SetGuidance("List up process names"); 62 listCmd->SetGuidance(" list [type] "); 83 listCmd->SetGuidance(" list [type] "); 63 listCmd->SetGuidance(" type: process type << 84 listCmd->SetGuidance(" type: process type [all:for all proceeses]"); 64 listCmd->SetParameterName("type", true); 85 listCmd->SetParameterName("type", true); 65 listCmd->SetDefaultValue("all"); 86 listCmd->SetDefaultValue("all"); 66 SetNumberOfProcessType(); 87 SetNumberOfProcessType(); 67 88 68 G4String candidates("all"); 89 G4String candidates("all"); 69 for (G4int idx = 0; idx < NumberOfProcessTyp << 90 for (G4int idx = 0; idx < NumberOfProcessType ; idx ++ ) { 70 { << 91 candidates += " " + 71 candidates += " " + G4VProcess::GetProcess << 92 G4VProcess::GetProcessTypeName(G4ProcessType(idx)); 72 } 93 } 73 listCmd->SetCandidates((const char*)(candida 94 listCmd->SetCandidates((const char*)(candidates)); 74 95 75 // Command /particle/process/verbose << 96 //Commnad /particle/process/Verbose 76 verboseCmd = new G4UIcmdWithAnInteger("/proc 97 verboseCmd = new G4UIcmdWithAnInteger("/process/verbose",this); 77 verboseCmd->SetGuidance("Set Verbose Level f 98 verboseCmd->SetGuidance("Set Verbose Level for Process Table"); 78 verboseCmd->SetGuidance(" verbose [level]") 99 verboseCmd->SetGuidance(" verbose [level]"); 79 verboseCmd->SetGuidance(" level: verbose l 100 verboseCmd->SetGuidance(" level: verbose level"); 80 verboseCmd->SetParameterName("verbose", true 101 verboseCmd->SetParameterName("verbose", true); 81 verboseCmd->SetDefaultValue(1); 102 verboseCmd->SetDefaultValue(1); 82 verboseCmd->SetRange("verbose >=0"); 103 verboseCmd->SetRange("verbose >=0"); 83 verboseCmd->AvailableForStates(G4State_PreIn 104 verboseCmd->AvailableForStates(G4State_PreInit,G4State_Init,G4State_Idle,G4State_GeomClosed,G4State_EventProc); 84 105 85 // Command /particle/process/setVerbose << 106 //Commnad /particle/process/setVerbose 86 procVerboseCmd = new G4UIcommand("/process/s 107 procVerboseCmd = new G4UIcommand("/process/setVerbose",this); 87 procVerboseCmd->SetGuidance("Set verbose lev 108 procVerboseCmd->SetGuidance("Set verbose level for processes"); 88 procVerboseCmd->SetGuidance(" setVerbose le 109 procVerboseCmd->SetGuidance(" setVerbose level [type or name] "); 89 procVerboseCmd->SetGuidance(" level: verb 110 procVerboseCmd->SetGuidance(" level: verbose level "); 90 procVerboseCmd->SetGuidance(" name : proc 111 procVerboseCmd->SetGuidance(" name : process name "); 91 procVerboseCmd->SetGuidance(" type : proc 112 procVerboseCmd->SetGuidance(" type : process type "); 92 procVerboseCmd->SetGuidance(" [all] fo << 113 procVerboseCmd->SetGuidance(" [all] for all proceeses "); 93 G4UIparameter* param = new G4UIparameter("ve 114 G4UIparameter* param = new G4UIparameter("verbose",'i',false); 94 procVerboseCmd->SetParameter(param); 115 procVerboseCmd->SetParameter(param); 95 param = new G4UIparameter("type",'s',true); 116 param = new G4UIparameter("type",'s',true); 96 param->SetDefaultValue("all"); 117 param->SetDefaultValue("all"); 97 procVerboseCmd->SetParameter(param); 118 procVerboseCmd->SetParameter(param); 98 procVerboseCmd->AvailableForStates(G4State_I 119 procVerboseCmd->AvailableForStates(G4State_Idle,G4State_GeomClosed,G4State_EventProc); 99 120 100 // Command /particle/process/dump << 121 //Commnad /particle/process/dump 101 dumpCmd = new G4UIcommand("/process/dump",th 122 dumpCmd = new G4UIcommand("/process/dump",this); 102 dumpCmd->SetGuidance("Dump process informati 123 dumpCmd->SetGuidance("Dump process information"); 103 dumpCmd->SetGuidance(" dump name [particle]" 124 dumpCmd->SetGuidance(" dump name [particle]"); 104 dumpCmd->SetGuidance(" name: process n 125 dumpCmd->SetGuidance(" name: process name or type name"); 105 dumpCmd->SetGuidance(" particle: particle 126 dumpCmd->SetGuidance(" particle: particle name [all: for all particles]"); 106 param = new G4UIparameter("procName",'s',fal 127 param = new G4UIparameter("procName",'s',false); 107 dumpCmd->SetParameter(param); 128 dumpCmd->SetParameter(param); 108 param = new G4UIparameter("particle",'s',tru 129 param = new G4UIparameter("particle",'s',true); 109 param->SetDefaultValue("all"); 130 param->SetDefaultValue("all"); 110 dumpCmd->SetParameter(param); 131 dumpCmd->SetParameter(param); 111 dumpCmd->AvailableForStates(G4State_Init,G4S 132 dumpCmd->AvailableForStates(G4State_Init,G4State_Idle,G4State_GeomClosed,G4State_EventProc); 112 133 113 // Command /process/activate << 134 //Commnad /particle/process/activate 114 activateCmd = new G4UIcommand("/process/acti 135 activateCmd = new G4UIcommand("/process/activate",this); 115 activateCmd->SetGuidance("Activate processes 136 activateCmd->SetGuidance("Activate processes "); 116 activateCmd->SetGuidance(" Activate name [p 137 activateCmd->SetGuidance(" Activate name [particle]"); 117 activateCmd->SetGuidance(" name: proce 138 activateCmd->SetGuidance(" name: process name or type name"); 118 activateCmd->SetGuidance(" particle: parti 139 activateCmd->SetGuidance(" particle: particle name [all: for all particles]"); 119 param = new G4UIparameter("procName",'s',fal 140 param = new G4UIparameter("procName",'s',false); 120 activateCmd->SetParameter(param); 141 activateCmd->SetParameter(param); 121 param = new G4UIparameter("particle",'s',tru 142 param = new G4UIparameter("particle",'s',true); 122 param->SetDefaultValue("all"); 143 param->SetDefaultValue("all"); 123 activateCmd->SetParameter(param); 144 activateCmd->SetParameter(param); 124 activateCmd->AvailableForStates(G4State_Idle << 145 activateCmd->AvailableForStates(G4State_Idle,G4State_GeomClosed,G4State_EventProc); 125 146 126 // Command /process/inactivate << 147 //Commnad /particle/process/inactivate 127 inactivateCmd = new G4UIcommand("/process/in 148 inactivateCmd = new G4UIcommand("/process/inactivate",this); 128 inactivateCmd->SetGuidance("Inactivate proce 149 inactivateCmd->SetGuidance("Inactivate process "); 129 inactivateCmd->SetGuidance("Inactivate proce 150 inactivateCmd->SetGuidance("Inactivate processes "); 130 inactivateCmd->SetGuidance(" Inactivate nam 151 inactivateCmd->SetGuidance(" Inactivate name [particle]"); 131 inactivateCmd->SetGuidance(" name: pro 152 inactivateCmd->SetGuidance(" name: process name or type name"); 132 inactivateCmd->SetGuidance(" particle: par 153 inactivateCmd->SetGuidance(" particle: particle name [all: for all particles]"); 133 param = new G4UIparameter("procName",'s',fal 154 param = new G4UIparameter("procName",'s',false); 134 inactivateCmd->SetParameter(param); 155 inactivateCmd->SetParameter(param); 135 param = new G4UIparameter("particle",'s',tru 156 param = new G4UIparameter("particle",'s',true); 136 param->SetDefaultValue("all"); 157 param->SetDefaultValue("all"); 137 inactivateCmd->SetParameter(param); 158 inactivateCmd->SetParameter(param); 138 inactivateCmd->AvailableForStates(G4State_Id << 159 inactivateCmd->AvailableForStates(G4State_Idle,G4State_GeomClosed,G4State_EventProc); 139 } 160 } 140 161 141 // ------------------------------------------- << 162 ////////////////// 142 G4ProcessTableMessenger::~G4ProcessTableMessen 163 G4ProcessTableMessenger::~G4ProcessTableMessenger() 143 { 164 { 144 delete activateCmd; 165 delete activateCmd; 145 delete inactivateCmd; 166 delete inactivateCmd; 146 delete verboseCmd; 167 delete verboseCmd; 147 delete dumpCmd; 168 delete dumpCmd; 148 delete listCmd; 169 delete listCmd; 149 delete procVerboseCmd; 170 delete procVerboseCmd; 150 delete thisDirectory; 171 delete thisDirectory; 151 } 172 } 152 173 153 // ------------------------------------------- << 174 /////////////// 154 void << 175 void G4ProcessTableMessenger::SetNewValue(G4UIcommand * command,G4String newValue) 155 G4ProcessTableMessenger::SetNewValue(G4UIcomma << 156 { 176 { 157 G4ProcessTable::G4ProcNameVector* procNameVe 177 G4ProcessTable::G4ProcNameVector* procNameVector 158 = theProcessTable->Ge 178 = theProcessTable->GetNameList(); >> 179 G4int idx; >> 180 >> 181 G4ProcessVector* tmpVector=0; 159 G4int type = -1; 182 G4int type = -1; 160 G4ExceptionDescription ed; << 161 183 162 if( command == listCmd ) << 184 if( command == listCmd ){ 163 { << 185 //Commnad /process/list 164 // Command /process/list << 165 type = -1; 186 type = -1; 166 if (newValue == "all") << 187 if (newValue == "all") { 167 { << 188 currentProcessTypeName = newValue; 168 currentProcessTypeName = std::move(newVa << 189 } else { 169 } << 170 else << 171 { << 172 type = GetProcessType(newValue); 190 type = GetProcessType(newValue); 173 if (type <0) << 191 if (type <0) { 174 { << 192 G4cout << " illegal type !!! " << G4endl; 175 G4cout << " illegal type !!! " << G4en << 193 } else { 176 } << 194 currentProcessTypeName = newValue; 177 else << 178 { << 179 currentProcessTypeName = std::move(new << 180 } 195 } 181 } 196 } 182 G4int counter = 0; 197 G4int counter = 0; 183 for (auto itr=procNameVector->cbegin(); it << 198 idx =0; 184 { << 199 G4ProcessTable::G4ProcNameVector::iterator itr; 185 G4ProcessVector* tmpVector = theProcessT << 200 for (itr=procNameVector->begin(); itr!=procNameVector->end(); ++itr) { 186 if ( (type <0) || ( ((*tmpVector)(0)->Ge << 201 idx +=1; 187 { << 202 tmpVector = theProcessTable->FindProcesses(*itr); >> 203 if ( (type <0) || ( ((*tmpVector)(0)->GetProcessType()) == type) ) { 188 if ( counter%4 != 0) G4cout << ","; 204 if ( counter%4 != 0) G4cout << ","; 189 G4cout << std::setw(19) << *itr; << 205 G4cout << std::setw(19) <<*itr; 190 if ((counter++)%4 == 3) << 206 if ((counter++)%4 == 3) { 191 { << 192 G4cout << G4endl; 207 G4cout << G4endl; 193 } 208 } 194 } 209 } 195 delete tmpVector; << 196 } 210 } 197 G4cout << G4endl; 211 G4cout << G4endl; 198 } << 212 delete tmpVector; 199 else if( command==procVerboseCmd ) << 213 //Commnad /process/list 200 { << 214 201 // Command /process/setVerbose << 215 } else if( command==procVerboseCmd ) { >> 216 //Commnad /process/setVerbose 202 G4Tokenizer next( newValue ); 217 G4Tokenizer next( newValue ); 203 218 204 // check 1st argument 219 // check 1st argument 205 G4String tmpS = G4String(next()); 220 G4String tmpS = G4String(next()); 206 // inputstream for newValues 221 // inputstream for newValues 207 const char* temp = (const char*)(tmpS); 222 const char* temp = (const char*)(tmpS); 208 std::istringstream is((char*)temp); 223 std::istringstream is((char*)temp); 209 G4int level; 224 G4int level; 210 is >>level; 225 is >>level; 211 226 212 // check 2nd argument 227 // check 2nd argument 213 currentProcessTypeName = G4String(next()); 228 currentProcessTypeName = G4String(next()); 214 if (currentProcessTypeName.empty()) curren << 229 if (currentProcessTypeName.isNull()) currentProcessTypeName = "all"; 215 G4bool isProcName = false; 230 G4bool isProcName = false; 216 G4bool isAll = false; 231 G4bool isAll = false; 217 type = -1; 232 type = -1; 218 233 219 if (currentProcessTypeName == "all") << 234 if (currentProcessTypeName == "all") { 220 { << 221 isAll = true; 235 isAll = true; 222 } << 236 } else { 223 else << 224 { << 225 type = GetProcessType(currentProcessTyp 237 type = GetProcessType(currentProcessTypeName); 226 if (type<0) << 238 if (type<0) { 227 { << 239 isProcName = true; 228 isProcName = true; << 240 currentProcessName = currentProcessTypeName; 229 currentProcessName = currentProcessTyp << 241 currentProcessTypeName = ""; 230 currentProcessTypeName = ""; << 231 } 242 } 232 } 243 } 233 for (auto itr=procNameVector->cbegin(); it << 244 idx =0; 234 { << 245 G4ProcessTable::G4ProcNameVector::iterator itr; 235 G4ProcessVector* tmpVector = theProcessT << 246 for (itr=procNameVector->begin(); itr!=procNameVector->end(); ++itr) { >> 247 idx +=1; >> 248 tmpVector = theProcessTable->FindProcesses(*itr); 236 G4VProcess* p = (*tmpVector)(0); 249 G4VProcess* p = (*tmpVector)(0); 237 if ( isAll || 250 if ( isAll || 238 (!isProcName && ( p->GetProcessType << 251 (!isProcName && ( p->GetProcessType() == type) ) || 239 ( isProcName && ( p->GetProcessName << 252 ( isProcName && ( p->GetProcessName()== currentProcessName) ) ){ 240 { << 253 p->SetVerboseLevel(level); 241 p->SetVerboseLevel(level); << 242 } 254 } 243 delete tmpVector; << 244 } 255 } 245 } << 256 delete tmpVector; 246 else if( command==verboseCmd ) << 257 //Commnad /process/setVerbose 247 { << 258 248 // Command /process/verbose << 259 } else if( command==verboseCmd ) { 249 theProcessTable->SetVerboseLevel(verboseCm << 260 //Commnad /process/verbose 250 } << 261 theProcessTable->SetVerboseLevel(verboseCmd->GetNewIntValue(newValue)); 251 else << 262 //Commnad /process/verbose 252 { << 263 >> 264 } else { 253 G4Tokenizer next( newValue ); 265 G4Tokenizer next( newValue ); 254 266 255 // check 1st argument 267 // check 1st argument 256 currentProcessName = G4String(next()); 268 currentProcessName = G4String(next()); >> 269 G4bool isNameFound = false; 257 G4bool isProcName = false; 270 G4bool isProcName = false; 258 for (auto itr=procNameVector->cbegin(); it << 271 G4ProcessTable::G4ProcNameVector::iterator itr; 259 { << 272 for (itr=procNameVector->begin(); itr!=procNameVector->end(); ++itr) { 260 if ( (*itr) == currentProcessName ) << 273 if ( (*itr) == currentProcessName ) { 261 { << 274 isNameFound = true; 262 isProcName = true; << 275 isProcName = true; 263 break; << 276 break; 264 } 277 } 265 } 278 } 266 if (!isProcName) << 279 if (!isProcName) { 267 { << 268 type = GetProcessType(currentProcessNam 280 type = GetProcessType(currentProcessName); 269 if (type <0 ) << 281 if (type >=0) { 270 { << 282 isNameFound = true; 271 // no processes with specified name << 283 } else { 272 ed << " illegal process (or type) name << 284 // no processes with specifed name 273 << currentProcessName << "]"; << 285 G4cout << " illegal process (or type) name " << G4endl; 274 command->CommandFailed(ed); << 286 currentProcessName = ""; 275 currentProcessName = ""; << 287 return; 276 return; << 277 } 288 } 278 } 289 } 279 290 280 // check 2nd argument 291 // check 2nd argument 281 currentParticleName = G4String(next()); 292 currentParticleName = G4String(next()); 282 G4bool isParticleFound = false; 293 G4bool isParticleFound = false; 283 G4ParticleDefinition* currentParticle = nu << 294 G4ParticleDefinition* currentParticle = 0; 284 if ( currentParticleName == "all" ) << 295 if ( currentParticleName == "all" ) { 285 { << 286 isParticleFound = true; 296 isParticleFound = true; 287 } << 297 288 else << 298 } else { 289 { << 299 isParticleFound = G4ParticleTable::GetParticleTable()->contains(currentParticleName); 290 isParticleFound = G4ParticleTable::GetPa << 300 if (isParticleFound) { 291 ->contains(currentPartic << 301 currentParticle = G4ParticleTable::GetParticleTable()->FindParticle(currentParticleName); 292 if (isParticleFound) << 293 { << 294 currentParticle = G4ParticleTable::Get << 295 ->FindParticle(current << 296 } 302 } >> 303 297 } 304 } 298 305 299 if ( !isParticleFound ) << 306 if ( !isParticleFound ) { 300 { << 307 // no particle with specifed name 301 // no particle with specified name << 308 G4cout << " illegal particle name " << G4endl; 302 ed << " illegal particle name [" << curr << 303 command->CommandFailed(ed); << 304 currentParticleName = ""; 309 currentParticleName = ""; 305 return; 310 return; 306 } 311 } 307 312 308 if( command==dumpCmd ) << 313 if( command==dumpCmd ) { 309 { << 310 // process/dump 314 // process/dump 311 G4ProcessVector* tmpVector; << 315 if (isProcName) { 312 if (isProcName) << 316 tmpVector = theProcessTable->FindProcesses(currentProcessName); 313 { << 317 } else { 314 tmpVector = theProcessTable->FindProce << 318 tmpVector = theProcessTable->FindProcesses(G4ProcessType(type)); 315 } << 316 else << 317 { << 318 tmpVector = theProcessTable->FindProce << 319 } 319 } 320 for (G4int i=0; i<(G4int)tmpVector->leng << 320 for (G4int i=0; i<tmpVector->length(); i++) { 321 { << 321 theProcessTable->DumpInfo( (*tmpVector)(i), currentParticle ); 322 theProcessTable->DumpInfo( (*tmpVector << 323 } 322 } 324 delete tmpVector; 323 delete tmpVector; 325 } << 324 // process/dump 326 else if ( (command==activateCmd) || (comma << 325 327 { << 326 } else if ( (command==activateCmd) || (command==inactivateCmd)) { 328 // process/activate , inactivate 327 // process/activate , inactivate 329 G4bool fActive = (command==activateCmd); 328 G4bool fActive = (command==activateCmd); 330 if (isProcName) << 329 if (isProcName) { 331 { << 330 if ( currentParticle == 0 ) { 332 if ( currentParticle == nullptr ) << 331 theProcessTable->SetProcessActivation(currentProcessName, 333 { << 332 fActive); 334 theProcessTable->SetProcessActivatio << 333 } else { 335 << 334 theProcessTable->SetProcessActivation(currentProcessName, 336 } << 335 currentParticle, 337 else << 336 fActive); 338 { << 337 } 339 theProcessTable->SetProcessActivatio << 338 } else { 340 << 339 if ( currentParticle == 0 ) { 341 << 340 theProcessTable->SetProcessActivation(G4ProcessType(type), 342 } << 341 fActive); 343 } << 342 } else { 344 else << 343 theProcessTable->SetProcessActivation(G4ProcessType(type), 345 { << 344 currentParticle, 346 if ( currentParticle == nullptr ) << 345 fActive); 347 { << 346 } 348 theProcessTable->SetProcessActivatio << 349 << 350 } << 351 else << 352 { << 353 theProcessTable->SetProcessActivatio << 354 << 355 << 356 } << 357 } 347 } 358 G4UImanager::GetUIpointer()->ApplyComman 348 G4UImanager::GetUIpointer()->ApplyCommand("/run/physicsModified"); >> 349 // process/activate , inactivate 359 } 350 } 360 } 351 } 361 } 352 } 362 353 363 // ------------------------------------------- << 354 364 G4String G4ProcessTableMessenger::GetCurrentVa << 355 ////////////////// >> 356 G4String G4ProcessTableMessenger::GetCurrentValue(G4UIcommand * command) 365 { 357 { 366 if( command==verboseCmd ) << 358 G4ProcessTable::G4ProcNameVector* procNameVector 367 { << 359 = theProcessTable->GetNameList(); 368 // Command /process/verbose << 360 369 return verboseCmd->ConvertToString(theProc << 361 G4String candidates; 370 } << 362 G4String returnValue('\0'); 371 else if ( command==listCmd ) << 363 372 { << 364 std::ostringstream os; 373 // Command /process/list << 365 G4UIparameter * param; 374 return currentProcessTypeName; << 366 375 } << 367 G4int idx; 376 else << 368 377 { << 369 if( command==verboseCmd ){ 378 // Command /process/dump, activate, inac << 370 //Commnad /process/verbose 379 return (currentProcessName + " " + curre << 371 os << theProcessTable->GetVerboseLevel(); >> 372 returnValue = os.str(); >> 373 >> 374 } else if ( command==listCmd ){ >> 375 //Commnad /process/list >> 376 candidates = "all"; >> 377 for (idx = 0; idx < NumberOfProcessType ; idx ++ ) { >> 378 candidates += " " + >> 379 G4VProcess::GetProcessTypeName(G4ProcessType(idx)); >> 380 } >> 381 listCmd->SetCandidates((const char*)(candidates)); >> 382 returnValue = currentProcessTypeName; >> 383 >> 384 } else { >> 385 //Commnad /process/dump, activate, inactivate >> 386 // process name >> 387 param = command->GetParameter(0); >> 388 candidates = ""; >> 389 G4ProcessTable::G4ProcNameVector::iterator itr; >> 390 for (itr=procNameVector->begin(); itr!=procNameVector->end(); ++itr) { >> 391 candidates += " " + (*itr); >> 392 } >> 393 param->SetParameterCandidates((const char*)(candidates)); >> 394 // particle name >> 395 param = command->GetParameter(1); >> 396 candidates = "all"; >> 397 G4ParticleTable::G4PTblDicIterator *piter >> 398 = G4ParticleTable::GetParticleTable()->GetIterator(); >> 399 piter -> reset(); >> 400 while( (*piter)() ){ >> 401 G4ParticleDefinition *particle = piter->value(); >> 402 candidates += " " + particle->GetParticleName(); >> 403 } >> 404 param->SetParameterCandidates((const char*)(candidates)); >> 405 >> 406 returnValue = currentProcessName + " " + currentParticleName; >> 407 380 } 408 } 381 409 382 return ""; << 410 return returnValue; 383 } 411 } 384 412 385 // ------------------------------------------- << 413 ///////////////// 386 G4String G4ProcessTableMessenger::GetProcessTy 414 G4String G4ProcessTableMessenger::GetProcessTypeName(G4ProcessType aType) const 387 { 415 { 388 return G4VProcess::GetProcessTypeName(aType) 416 return G4VProcess::GetProcessTypeName(aType); 389 } 417 } 390 418 391 // ------------------------------------------- << 419 ///////////////// 392 G4int G4ProcessTableMessenger::GetProcessType( 420 G4int G4ProcessTableMessenger::GetProcessType(const G4String& aTypeName) const 393 { 421 { 394 G4int type = -1; 422 G4int type = -1; 395 for (G4int idx = 0; idx < NumberOfProcessTyp << 423 for (G4int idx = 0; idx < NumberOfProcessType ; idx ++ ) { 396 { << 424 if (aTypeName == G4VProcess::GetProcessTypeName(G4ProcessType(idx)) ) { 397 if (aTypeName == G4VProcess::GetProcessTyp << 398 { << 399 type = idx; 425 type = idx; 400 break; 426 break; 401 } 427 } 402 } 428 } 403 return type; 429 return type; 404 } 430 } 405 431 406 // ------------------------------------------- << 432 >> 433 ///////////////// 407 void G4ProcessTableMessenger::SetNumberOfProce 434 void G4ProcessTableMessenger::SetNumberOfProcessType() 408 { 435 { 409 G4bool isFoundEndMark = false; 436 G4bool isFoundEndMark = false; 410 G4int idx; 437 G4int idx; 411 for (idx = 0; idx < 1000 ; ++idx ) << 438 for (idx = 0; idx < 1000 ; idx ++ ) { 412 { << 413 G4String typeName = G4VProcess::GetProcess 439 G4String typeName = G4VProcess::GetProcessTypeName(G4ProcessType(idx)); 414 isFoundEndMark = G4StrUtil::contains(typeN << 440 isFoundEndMark = typeName.contains("---"); 415 if ( isFoundEndMark ) break; 441 if ( isFoundEndMark ) break; 416 } 442 } 417 if ( isFoundEndMark ) << 443 if ( isFoundEndMark ) { 418 { << 419 NumberOfProcessType = idx; 444 NumberOfProcessType = idx; 420 } << 445 } else { 421 else << 446 G4Exception("G4ProcessTableMessenger::SetNumberOfProcessType()","No End Mark", 422 { << 447 FatalException,""); 423 G4Exception("G4ProcessTableMessenger::SetN << 424 "ProcMan014", FatalException, << 425 } 448 } 426 } 449 } >> 450 >> 451 >> 452 >> 453 427 454