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;
162 if( command == listCmd )
166 if (newValue ==
"all")
168 currentProcessTypeName = newValue;
172 type = GetProcessType(newValue);
179 currentProcessTypeName = newValue;
183 for (
auto itr=procNameVector->cbegin(); itr!=procNameVector->cend(); ++itr)
186 if ( (type <0) || ( ((*tmpVector)(0)->GetProcessType()) == type) )
188 if ( counter%4 != 0)
G4cout <<
",";
189 G4cout << std::setw(19) << *itr;
190 if ((counter++)%4 == 3)
199 else if( command==procVerboseCmd )
207 const char* temp = (
const char*)(tmpS);
208 std::istringstream is((
char*)temp);
213 currentProcessTypeName =
G4String(next());
214 if (currentProcessTypeName.empty()) currentProcessTypeName =
"all";
215 G4bool isProcName =
false;
219 if (currentProcessTypeName ==
"all")
225 type = GetProcessType(currentProcessTypeName);
229 currentProcessName = currentProcessTypeName;
230 currentProcessTypeName =
"";
233 for (
auto itr=procNameVector->cbegin(); itr!=procNameVector->cend(); ++itr)
246 else if( command==verboseCmd )
256 currentProcessName =
G4String(next());
257 G4bool isProcName =
false;
258 for (
auto itr=procNameVector->cbegin(); itr!=procNameVector->cend(); ++itr)
260 if ( (*itr) == currentProcessName )
268 type = GetProcessType(currentProcessName);
272 ed <<
" illegal process (or type) name ["
273 << currentProcessName <<
"]";
275 currentProcessName =
"";
281 currentParticleName =
G4String(next());
282 G4bool isParticleFound =
false;
284 if ( currentParticleName ==
"all" )
286 isParticleFound =
true;
299 if ( !isParticleFound )
302 ed <<
" illegal particle name [" << currentParticleName <<
"]";
304 currentParticleName =
"";
308 if( command==dumpCmd )
314 tmpVector = theProcessTable->
FindProcesses(currentProcessName);
322 theProcessTable->
DumpInfo( (*tmpVector)(i), currentParticle );
326 else if ( (command==activateCmd) || (command==inactivateCmd))
329 G4bool fActive = (command==activateCmd);
332 if ( currentParticle ==
nullptr )
346 if ( currentParticle ==
nullptr )
366 if( command==verboseCmd )
371 else if ( command==listCmd )
374 return currentProcessTypeName;
379 return (currentProcessName +
" " + currentParticleName);
392G4int G4ProcessTableMessenger::GetProcessType(
const G4String& aTypeName)
const
395 for (
G4int idx = 0; idx < NumberOfProcessType ; ++idx )
407void G4ProcessTableMessenger::SetNumberOfProcessType()
409 G4bool isFoundEndMark =
false;
411 for (idx = 0; idx < 1000 ; ++idx )
415 if ( isFoundEndMark )
break;
417 if ( isFoundEndMark )
419 NumberOfProcessType = idx;
423 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
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
G4bool contains(const G4String &str, std::string_view ss)
Check if a string contains a given substring.