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