65G4int G4ProcessTableMessenger::NumberOfProcessType = 10;
69 :theProcessTable(pTable),
70 currentProcessTypeName(
"all"),
71 currentProcessName(
"all"),
72 currentParticleName(
"all")
76 thisDirectory->
SetGuidance(
"Process Table control commands.");
83 listCmd->
SetGuidance(
" type: process type [all:for all proceeses]");
86 SetNumberOfProcessType();
89 for (
G4int idx = 0; idx < NumberOfProcessType ; idx ++ ) {
97 verboseCmd->
SetGuidance(
"Set Verbose Level for Process Table");
102 verboseCmd->
SetRange(
"verbose >=0");
106 procVerboseCmd =
new G4UIcommand(
"/process/setVerbose",
this);
107 procVerboseCmd->
SetGuidance(
"Set verbose level for processes");
108 procVerboseCmd->
SetGuidance(
" setVerbose level [type or name] ");
109 procVerboseCmd->
SetGuidance(
" level: verbose level ");
110 procVerboseCmd->
SetGuidance(
" name : process name ");
111 procVerboseCmd->
SetGuidance(
" type : process type ");
112 procVerboseCmd->
SetGuidance(
" [all] for all proceeses ");
124 dumpCmd->
SetGuidance(
" name: process name or type name");
125 dumpCmd->
SetGuidance(
" particle: particle name [all: for all particles]");
134 activateCmd =
new G4UIcommand(
"/process/activate",
this);
136 activateCmd->
SetGuidance(
" Activate name [particle]");
137 activateCmd->
SetGuidance(
" name: process name or type name");
138 activateCmd->
SetGuidance(
" particle: particle name [all: for all particles]");
147 inactivateCmd =
new G4UIcommand(
"/process/inactivate",
this);
149 inactivateCmd->
SetGuidance(
"Inactivate processes ");
150 inactivateCmd->
SetGuidance(
" Inactivate name [particle]");
151 inactivateCmd->
SetGuidance(
" name: process name or type name");
152 inactivateCmd->
SetGuidance(
" particle: particle name [all: for all particles]");
165 delete inactivateCmd;
169 delete procVerboseCmd;
170 delete thisDirectory;
182 if( command == listCmd ){
185 if (newValue ==
"all") {
186 currentProcessTypeName = newValue;
188 type = GetProcessType(newValue);
192 currentProcessTypeName = newValue;
197 G4ProcessTable::G4ProcNameVector::iterator itr;
198 for (itr=procNameVector->begin(); itr!=procNameVector->end(); ++itr) {
201 if ( (type <0) || ( ((*tmpVector)(0)->GetProcessType()) == type) ) {
202 if ( counter%4 != 0)
G4cout <<
",";
203 G4cout << std::setw(19) <<*itr;
204 if ((counter++)%4 == 3) {
213 }
else if( command==procVerboseCmd ) {
220 const char* temp = (
const char*)(tmpS);
221 std::istringstream is((
char*)temp);
226 currentProcessTypeName =
G4String(next());
227 if (currentProcessTypeName.
isNull()) currentProcessTypeName =
"all";
228 G4bool isProcName =
false;
232 if (currentProcessTypeName ==
"all") {
235 type = GetProcessType(currentProcessTypeName);
238 currentProcessName = currentProcessTypeName;
239 currentProcessTypeName =
"";
243 G4ProcessTable::G4ProcNameVector::iterator itr;
244 for (itr=procNameVector->begin(); itr!=procNameVector->end(); ++itr) {
257 }
else if( command==verboseCmd ) {
266 currentProcessName =
G4String(next());
267 G4bool isProcName =
false;
268 G4ProcessTable::G4ProcNameVector::iterator itr;
269 for (itr=procNameVector->begin(); itr!=procNameVector->end(); ++itr) {
270 if ( (*itr) == currentProcessName ) {
276 type = GetProcessType(currentProcessName);
280 currentProcessName =
"";
286 currentParticleName =
G4String(next());
287 G4bool isParticleFound =
false;
289 if ( currentParticleName ==
"all" ) {
290 isParticleFound =
true;
294 if (isParticleFound) {
300 if ( !isParticleFound ) {
303 currentParticleName =
"";
307 if( command==dumpCmd ) {
311 tmpVector = theProcessTable->
FindProcesses(currentProcessName);
316 theProcessTable->
DumpInfo( (*tmpVector)(i), currentParticle );
321 }
else if ( (command==activateCmd) || (command==inactivateCmd)) {
323 G4bool fActive = (command==activateCmd);
325 if ( currentParticle == 0 ) {
334 if ( currentParticle == 0 ) {
359 std::ostringstream os;
364 if( command==verboseCmd ){
367 returnValue = os.str();
369 }
else if ( command==listCmd ){
372 for (idx = 0; idx < NumberOfProcessType ; idx ++ ) {
377 returnValue = currentProcessTypeName;
384 G4ProcessTable::G4ProcNameVector::iterator itr;
385 for (itr=procNameVector->begin(); itr!=procNameVector->end(); ++itr) {
386 candidates +=
" " + (*itr);
401 returnValue = currentProcessName +
" " + currentParticleName;
415G4int G4ProcessTableMessenger::GetProcessType(
const G4String& aTypeName)
const
418 for (
G4int idx = 0; idx < NumberOfProcessType ; idx ++ ) {
429void G4ProcessTableMessenger::SetNumberOfProcessType()
431 G4bool isFoundEndMark =
false;
433 for (idx = 0; idx < 1000 ; idx ++ ) {
435 isFoundEndMark = typeName.
contains(
"---");
436 if ( isFoundEndMark )
break;
438 if ( isFoundEndMark ) {
439 NumberOfProcessType = idx;
441 G4Exception(
"G4ProcessTableMessenger::SetNumberOfProcessType()",
"ProcMan014",
G4DLLIMPORT std::ostream G4cout
const G4String & GetParticleName() const
G4PTblDicIterator * GetIterator()
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
static G4ParticleTable * GetParticleTable()
G4bool contains(const G4ParticleDefinition *particle)
virtual ~G4ProcessTableMessenger()
G4ProcessTableMessenger(G4ProcessTable *pTable)
virtual void SetNewValue(G4UIcommand *command, G4String newValues)
virtual G4String GetCurrentValue(G4UIcommand *command)
void DumpInfo(G4VProcess *process, G4ParticleDefinition *particle=0)
G4ProcNameVector * GetNameList()
G4int GetVerboseLevel() const
std::vector< G4String > G4ProcNameVector
void SetProcessActivation(const G4String &processName, G4bool fActive)
G4ProcessVector * FindProcesses()
void SetVerboseLevel(G4int value)
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)
G4UIparameter * GetParameter(G4int i) const
void SetParameter(G4UIparameter *const newParameter)
void SetGuidance(const char *aGuidance)
void SetRange(const char *rs)
void AvailableForStates(G4ApplicationState s1)
G4int ApplyCommand(const char *aCommand)
static G4UImanager * GetUIpointer()
void SetDefaultValue(const char *theDefaultValue)
void SetParameterCandidates(const char *theString)
static const G4String & GetProcessTypeName(G4ProcessType)
void SetVerboseLevel(G4int value)
G4ProcessType GetProcessType() const
const G4String & GetProcessName() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)