53 : theProcessTable(pTable)
57 thisDirectory->
SetGuidance(
"Process Table control commands.");
63 listCmd->
SetGuidance(
" type: process type [all:for all processes]");
66 SetNumberOfProcessType();
69 for (
G4int idx = 0; idx < NumberOfProcessType ; ++idx )
77 verboseCmd->
SetGuidance(
"Set Verbose Level for Process Table");
86 procVerboseCmd =
new G4UIcommand(
"/process/setVerbose",
this);
87 procVerboseCmd->
SetGuidance(
"Set verbose level for processes");
88 procVerboseCmd->
SetGuidance(
" setVerbose level [type or name] ");
89 procVerboseCmd->
SetGuidance(
" level: verbose level ");
90 procVerboseCmd->
SetGuidance(
" name : process name ");
91 procVerboseCmd->
SetGuidance(
" type : process type ");
92 procVerboseCmd->
SetGuidance(
" [all] for all processes ");
104 dumpCmd->
SetGuidance(
" name: process name or type name");
105 dumpCmd->
SetGuidance(
" particle: particle name [all: for all particles]");
114 activateCmd =
new G4UIcommand(
"/process/activate",
this);
116 activateCmd->
SetGuidance(
" Activate name [particle]");
117 activateCmd->
SetGuidance(
" name: process name or type name");
118 activateCmd->
SetGuidance(
" particle: particle name [all: for all particles]");
127 inactivateCmd =
new G4UIcommand(
"/process/inactivate",
this);
129 inactivateCmd->
SetGuidance(
"Inactivate processes ");
130 inactivateCmd->
SetGuidance(
" Inactivate name [particle]");
131 inactivateCmd->
SetGuidance(
" name: process name or type name");
132 inactivateCmd->
SetGuidance(
" particle: particle name [all: for all particles]");
145 delete inactivateCmd;
149 delete procVerboseCmd;
150 delete thisDirectory;
163 if( command == listCmd )
167 if (newValue ==
"all")
169 currentProcessTypeName = newValue;
173 type = GetProcessType(newValue);
180 currentProcessTypeName = newValue;
185 for (
auto itr=procNameVector->cbegin(); itr!=procNameVector->cend(); ++itr)
189 if ( (type <0) || ( ((*tmpVector)(0)->GetProcessType()) == type) )
191 if ( counter%4 != 0)
G4cout <<
",";
192 G4cout << std::setw(19) << *itr;
193 if ((counter++)%4 == 3)
202 else if( command==procVerboseCmd )
210 const char* temp = (
const char*)(tmpS);
211 std::istringstream is((
char*)temp);
216 currentProcessTypeName =
G4String(next());
217 if (currentProcessTypeName.
isNull()) currentProcessTypeName =
"all";
218 G4bool isProcName =
false;
222 if (currentProcessTypeName ==
"all")
228 type = GetProcessType(currentProcessTypeName);
232 currentProcessName = currentProcessTypeName;
233 currentProcessTypeName =
"";
237 for (
auto itr=procNameVector->cbegin(); itr!=procNameVector->cend(); ++itr)
251 else if( command==verboseCmd )
261 currentProcessName =
G4String(next());
262 G4bool isProcName =
false;
263 for (
auto itr=procNameVector->cbegin(); itr!=procNameVector->cend(); ++itr)
265 if ( (*itr) == currentProcessName )
273 type = GetProcessType(currentProcessName);
277 ed <<
" illegal process (or type) name ["
278 << currentProcessName <<
"]";
280 currentProcessName =
"";
286 currentParticleName =
G4String(next());
287 G4bool isParticleFound =
false;
289 if ( currentParticleName ==
"all" )
291 isParticleFound =
true;
304 if ( !isParticleFound )
307 ed <<
" illegal particle name [" << currentParticleName <<
"]";
309 currentParticleName =
"";
313 if( command==dumpCmd )
319 tmpVector = theProcessTable->
FindProcesses(currentProcessName);
325 for (std::size_t i=0; i<tmpVector->
length(); ++i)
327 theProcessTable->
DumpInfo( (*tmpVector)(i), currentParticle );
331 else if ( (command==activateCmd) || (command==inactivateCmd))
334 G4bool fActive = (command==activateCmd);
337 if ( currentParticle ==
nullptr )
351 if ( currentParticle ==
nullptr )
371 if( command==verboseCmd )
376 else if ( command==listCmd )
379 return currentProcessTypeName;
384 return (currentProcessName +
" " + currentParticleName);
397G4int G4ProcessTableMessenger::GetProcessType(
const G4String& aTypeName)
const
400 for (
G4int idx = 0; idx < NumberOfProcessType ; ++idx )
412void G4ProcessTableMessenger::SetNumberOfProcessType()
414 G4bool isFoundEndMark =
false;
416 for (idx = 0; idx < 1000 ; ++idx )
419 isFoundEndMark = typeName.
contains(
"---");
420 if ( isFoundEndMark )
break;
422 if ( isFoundEndMark )
424 NumberOfProcessType = idx;
428 G4Exception(
"G4ProcessTableMessenger::SetNumberOfProcessType()",
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
G4GLOB_DLL std::ostream G4cout
G4bool contains(const G4ParticleDefinition *particle) const
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
static G4ParticleTable * GetParticleTable()
virtual ~G4ProcessTableMessenger()
G4ProcessTableMessenger(G4ProcessTable *pTable)
virtual void SetNewValue(G4UIcommand *command, G4String newValues)
virtual G4String GetCurrentValue(G4UIcommand *command)
void DumpInfo(G4VProcess *process, const G4ParticleDefinition *particle=nullptr)
G4ProcNameVector * GetNameList()
G4int GetVerboseLevel() const
void SetProcessActivation(const G4String &processName, G4bool fActive)
G4ProcessVector * FindProcesses()
void SetVerboseLevel(G4int value)
std::vector< G4String > G4ProcNameVector
std::size_t length() const
G4bool contains(const std::string &) const
void SetCandidates(const char *candidateList)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetDefaultValue(const char *defVal)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
static G4int GetNewIntValue(const char *paramString)
void SetDefaultValue(G4int defVal)
static G4String ConvertToString(G4bool boolVal)
void SetParameter(G4UIparameter *const newParameter)
void SetGuidance(const char *aGuidance)
void CommandFailed(G4int errCode, G4ExceptionDescription &ed)
void SetRange(const char *rs)
void AvailableForStates(G4ApplicationState s1)
G4int ApplyCommand(const char *aCommand)
static G4UImanager * GetUIpointer()
void SetDefaultValue(const char *theDefaultValue)
static const G4String & GetProcessTypeName(G4ProcessType)
void SetVerboseLevel(G4int value)
G4ProcessType GetProcessType() const
const G4String & GetProcessName() const