Geant4  10.02.p03
G4ProcessTableMessenger Class Reference

#include <G4ProcessTableMessenger.hh>

Inheritance diagram for G4ProcessTableMessenger:
Collaboration diagram for G4ProcessTableMessenger:

Public Member Functions

 G4ProcessTableMessenger (G4ProcessTable *pTable)
 
virtual ~G4ProcessTableMessenger ()
 
virtual void SetNewValue (G4UIcommand *command, G4String newValues)
 
virtual G4String GetCurrentValue (G4UIcommand *command)
 
- Public Member Functions inherited from G4UImessenger
 G4UImessenger ()
 
 G4UImessenger (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
 
virtual ~G4UImessenger ()
 
G4bool operator== (const G4UImessenger &messenger) const
 
G4bool CommandsShouldBeInMaster () const
 

Private Member Functions

G4String GetProcessTypeName (G4ProcessType aType) const
 
G4int GetProcessType (const G4String &aTypeName) const
 
void SetNumberOfProcessType ()
 
 G4ProcessTableMessenger (const G4ProcessTableMessenger &)
 
 G4ProcessTableMessenger ()
 

Private Attributes

G4ProcessTabletheProcessTable
 
G4UIdirectorythisDirectory
 
G4UIcmdWithAnIntegerverboseCmd
 
G4UIcmdWithAStringlistCmd
 
G4UIcommanddumpCmd
 
G4UIcommandactivateCmd
 
G4UIcommandinactivateCmd
 
G4UIcommandprocVerboseCmd
 
G4String currentProcessTypeName
 
G4String currentProcessName
 
G4String currentParticleName
 

Static Private Attributes

static G4ThreadLocal G4int NumberOfProcessType = 10
 

Additional Inherited Members

- Protected Member Functions inherited from G4UImessenger
G4String ItoS (G4int i)
 
G4String DtoS (G4double a)
 
G4String BtoS (G4bool b)
 
G4int StoI (G4String s)
 
G4double StoD (G4String s)
 
G4bool StoB (G4String s)
 
void AddUIcommand (G4UIcommand *newCommand)
 
void CreateDirectory (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
 
template<typename T >
T * CreateCommand (const G4String &cname, const G4String &dsc)
 
- Protected Attributes inherited from G4UImessenger
G4UIdirectorybaseDir
 
G4String baseDirName
 
G4bool commandsShouldBeInMaster
 

Detailed Description

Definition at line 65 of file G4ProcessTableMessenger.hh.

Constructor & Destructor Documentation

◆ G4ProcessTableMessenger() [1/3]

G4ProcessTableMessenger::G4ProcessTableMessenger ( G4ProcessTable pTable)

Definition at line 68 of file G4ProcessTableMessenger.cc.

69  :theProcessTable(pTable),
71  currentProcessName("all"),
72  currentParticleName("all")
73 {
74  //Commnad /particle/process
75  thisDirectory = new G4UIdirectory("/process/");
76  thisDirectory->SetGuidance("Process Table control commands.");
77 
78 
79  //Commnad /particle/process/list
80  listCmd = new G4UIcmdWithAString("/process/list",this);
81  listCmd->SetGuidance("List up process names");
82  listCmd->SetGuidance(" list [type] ");
83  listCmd->SetGuidance(" type: process type [all:for all proceeses]");
84  listCmd->SetParameterName("type", true);
85  listCmd->SetDefaultValue("all");
87 
88  G4String candidates("all");
89  for (G4int idx = 0; idx < NumberOfProcessType ; idx ++ ) {
90  candidates += " " +
92  }
93  listCmd->SetCandidates((const char*)(candidates));
94 
95  //Commnad /particle/process/verbose
96  verboseCmd = new G4UIcmdWithAnInteger("/process/verbose",this);
97  verboseCmd->SetGuidance("Set Verbose Level for Process Table");
98  verboseCmd->SetGuidance(" verbose [level]");
99  verboseCmd->SetGuidance(" level: verbose level");
100  verboseCmd->SetParameterName("verbose", true);
102  verboseCmd->SetRange("verbose >=0");
104 
105  //Commnad /particle/process/setVerbose
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 ");
113  G4UIparameter* param = new G4UIparameter("verbose",'i',false);
115  param = new G4UIparameter("type",'s',true);
116  param->SetDefaultValue("all");
119 
120  //Commnad /particle/process/dump
121  dumpCmd = new G4UIcommand("/process/dump",this);
122  dumpCmd->SetGuidance("Dump process information");
123  dumpCmd->SetGuidance(" dump name [particle]");
124  dumpCmd->SetGuidance(" name: process name or type name");
125  dumpCmd->SetGuidance(" particle: particle name [all: for all particles]");
126  param = new G4UIparameter("procName",'s',false);
127  dumpCmd->SetParameter(param);
128  param = new G4UIparameter("particle",'s',true);
129  param->SetDefaultValue("all");
130  dumpCmd->SetParameter(param);
132 
133  //Commnad /particle/process/activate
134  activateCmd = new G4UIcommand("/process/activate",this);
135  activateCmd->SetGuidance("Activate processes ");
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]");
139  param = new G4UIparameter("procName",'s',false);
140  activateCmd->SetParameter(param);
141  param = new G4UIparameter("particle",'s',true);
142  param->SetDefaultValue("all");
143  activateCmd->SetParameter(param);
145 
146  //Commnad /particle/process/inactivate
147  inactivateCmd = new G4UIcommand("/process/inactivate",this);
148  inactivateCmd->SetGuidance("Inactivate process ");
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]");
153  param = new G4UIparameter("procName",'s',false);
154  inactivateCmd->SetParameter(param);
155  param = new G4UIparameter("particle",'s',true);
156  param->SetDefaultValue("all");
157  inactivateCmd->SetParameter(param);
159 }
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetParameter(G4UIparameter *const newParameter)
Definition: G4UIcommand.hh:152
static const G4String & GetProcessTypeName(G4ProcessType)
Definition: G4VProcess.cc:141
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetDefaultValue(const char *theDefaultValue)
int G4int
Definition: G4Types.hh:78
void SetRange(const char *rs)
Definition: G4UIcommand.hh:125
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:161
void AvailableForStates(G4ApplicationState s1)
Definition: G4UIcommand.cc:239
void SetDefaultValue(const char *defVal)
static G4ThreadLocal G4int NumberOfProcessType
void SetCandidates(const char *candidateList)
void SetDefaultValue(G4int defVal)
G4UIcmdWithAnInteger * verboseCmd
G4ProcessType
Here is the call graph for this function:

◆ ~G4ProcessTableMessenger()

G4ProcessTableMessenger::~G4ProcessTableMessenger ( )
virtual

Definition at line 162 of file G4ProcessTableMessenger.cc.

163 {
164  delete activateCmd;
165  delete inactivateCmd;
166  delete verboseCmd;
167  delete dumpCmd;
168  delete listCmd;
169  delete procVerboseCmd;
170  delete thisDirectory;
171 }
G4UIcmdWithAnInteger * verboseCmd

◆ G4ProcessTableMessenger() [2/3]

G4ProcessTableMessenger::G4ProcessTableMessenger ( const G4ProcessTableMessenger )
inlineprivate

Definition at line 82 of file G4ProcessTableMessenger.hh.

83  : G4UImessenger() {};

◆ G4ProcessTableMessenger() [3/3]

G4ProcessTableMessenger::G4ProcessTableMessenger ( )
inlineprivate

Definition at line 84 of file G4ProcessTableMessenger.hh.

84 {};

Member Function Documentation

◆ GetCurrentValue()

G4String G4ProcessTableMessenger::GetCurrentValue ( G4UIcommand command)
virtual

Reimplemented from G4UImessenger.

Definition at line 351 of file G4ProcessTableMessenger.cc.

352 {
353  if( command==verboseCmd ){
354  //Commnad /process/verbose
356 
357  } else if ( command==listCmd ){
358  //Commnad /process/list
359  return currentProcessTypeName;
360 
361  } else {
362  //Commnad /process/dump, activate, inactivate
363  return (currentProcessName + " " + currentParticleName);
364 
365  }
366 
367  return "";
368 }
static G4String ConvertToString(G4bool boolVal)
Definition: G4UIcommand.cc:371
G4int GetVerboseLevel() const
G4UIcmdWithAnInteger * verboseCmd
Here is the call graph for this function:

◆ GetProcessType()

G4int G4ProcessTableMessenger::GetProcessType ( const G4String aTypeName) const
private

Definition at line 377 of file G4ProcessTableMessenger.cc.

378 {
379  G4int type = -1;
380  for (G4int idx = 0; idx < NumberOfProcessType ; idx ++ ) {
381  if (aTypeName == G4VProcess::GetProcessTypeName(G4ProcessType(idx)) ) {
382  type = idx;
383  break;
384  }
385  }
386  return type;
387 }
static const G4String & GetProcessTypeName(G4ProcessType)
Definition: G4VProcess.cc:141
int G4int
Definition: G4Types.hh:78
static G4ThreadLocal G4int NumberOfProcessType
G4ProcessType
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetProcessTypeName()

G4String G4ProcessTableMessenger::GetProcessTypeName ( G4ProcessType  aType) const
private

Definition at line 371 of file G4ProcessTableMessenger.cc.

372 {
373  return G4VProcess::GetProcessTypeName(aType);
374 }
static const G4String & GetProcessTypeName(G4ProcessType)
Definition: G4VProcess.cc:141
Here is the call graph for this function:

◆ SetNewValue()

void G4ProcessTableMessenger::SetNewValue ( G4UIcommand command,
G4String  newValues 
)
virtual

Reimplemented from G4UImessenger.

Definition at line 174 of file G4ProcessTableMessenger.cc.

175 {
176  G4ProcessTable::G4ProcNameVector* procNameVector
178  G4int idx;
179 
180  G4int type = -1;
181 
182  if( command == listCmd ){
183  //Commnad /process/list
184  type = -1;
185  if (newValue == "all") {
186  currentProcessTypeName = newValue;
187  } else {
188  type = GetProcessType(newValue);
189  if (type <0) {
190  G4cout << " illegal type !!! " << G4endl;
191  } else {
192  currentProcessTypeName = newValue;
193  }
194  }
195  G4int counter = 0;
196  idx =0;
197  G4ProcessTable::G4ProcNameVector::iterator itr;
198  for (itr=procNameVector->begin(); itr!=procNameVector->end(); ++itr) {
199  idx +=1;
200  G4ProcessVector* tmpVector = theProcessTable->FindProcesses(*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) {
205  G4cout << G4endl;
206  }
207  }
208  delete tmpVector;
209  }
210  G4cout << G4endl;
211  //Commnad /process/list
212 
213  } else if( command==procVerboseCmd ) {
214  //Commnad /process/setVerbose
215  G4Tokenizer next( newValue );
216 
217  // check 1st argument
218  G4String tmpS = G4String(next());
219  // inputstream for newValues
220  const char* temp = (const char*)(tmpS);
221  std::istringstream is((char*)temp);
222  G4int level;
223  is >>level;
224 
225  // check 2nd argument
228  G4bool isProcName = false;
229  G4bool isAll = false;
230  type = -1;
231 
232  if (currentProcessTypeName == "all") {
233  isAll = true;
234  } else {
236  if (type<0) {
237  isProcName = true;
240  }
241  }
242  idx =0;
243  G4ProcessTable::G4ProcNameVector::iterator itr;
244  for (itr=procNameVector->begin(); itr!=procNameVector->end(); ++itr) {
245  idx +=1;
246  G4ProcessVector* tmpVector = theProcessTable->FindProcesses(*itr);
247  G4VProcess* p = (*tmpVector)(0);
248  if ( isAll ||
249  (!isProcName && ( p->GetProcessType() == type) ) ||
250  ( isProcName && ( p->GetProcessName()== currentProcessName) ) ){
251  p->SetVerboseLevel(level);
252  }
253  delete tmpVector;
254  }
255  //Commnad /process/setVerbose
256 
257  } else if( command==verboseCmd ) {
258  //Commnad /process/verbose
260  //Commnad /process/verbose
261 
262  } else {
263  G4Tokenizer next( newValue );
264 
265  // check 1st argument
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 ) {
271  isProcName = true;
272  break;
273  }
274  }
275  if (!isProcName) {
277  if (type <0 ) {
278  // no processes with specifed name
279  G4cout << " illegal process (or type) name " << G4endl;
280  currentProcessName = "";
281  return;
282  }
283  }
284 
285  // check 2nd argument
286  currentParticleName = G4String(next());
287  G4bool isParticleFound = false;
288  G4ParticleDefinition* currentParticle = 0;
289  if ( currentParticleName == "all" ) {
290  isParticleFound = true;
291 
292  } else {
294  if (isParticleFound) {
296  }
297 
298  }
299 
300  if ( !isParticleFound ) {
301  // no particle with specifed name
302  G4cout << " illegal particle name " << G4endl;
303  currentParticleName = "";
304  return;
305  }
306 
307  if( command==dumpCmd ) {
308  // process/dump
309  G4ProcessVector* tmpVector;
310  if (isProcName) {
312  } else {
313  tmpVector = theProcessTable->FindProcesses(G4ProcessType(type));
314  }
315  for (G4int i=0; i<tmpVector->length(); i++) {
316  theProcessTable->DumpInfo( (*tmpVector)(i), currentParticle );
317  }
318  delete tmpVector;
319  // process/dump
320 
321  } else if ( (command==activateCmd) || (command==inactivateCmd)) {
322  // process/activate , inactivate
323  G4bool fActive = (command==activateCmd);
324  if (isProcName) {
325  if ( currentParticle == 0 ) {
327  fActive);
328  } else {
330  currentParticle,
331  fActive);
332  }
333  } else {
334  if ( currentParticle == 0 ) {
336  fActive);
337  } else {
339  currentParticle,
340  fActive);
341  }
342  }
343  G4UImanager::GetUIpointer()->ApplyCommand("/run/physicsModified");
344  // process/activate , inactivate
345  }
346  }
347 }
G4bool contains(const G4ParticleDefinition *particle) const
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
G4int GetProcessType(const G4String &aTypeName) const
void DumpInfo(G4VProcess *process, G4ParticleDefinition *particle=0)
static G4int GetNewIntValue(const char *paramString)
int G4int
Definition: G4Types.hh:78
void SetProcessActivation(const G4String &processName, G4bool fActive)
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:58
const G4String & GetProcessName() const
Definition: G4VProcess.hh:408
G4GLOB_DLL std::ostream G4cout
void SetVerboseLevel(G4int value)
bool G4bool
Definition: G4Types.hh:79
G4ProcNameVector * GetNameList()
static G4ParticleTable * GetParticleTable()
std::vector< G4String > G4ProcNameVector
#define G4endl
Definition: G4ios.hh:61
G4ProcessType GetProcessType() const
Definition: G4VProcess.hh:414
G4UIcmdWithAnInteger * verboseCmd
G4ProcessVector * FindProcesses()
G4int length() const
void SetVerboseLevel(G4int value)
Definition: G4VProcess.hh:437
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:446
G4bool isNull() const
G4ProcessType
Here is the call graph for this function:

◆ SetNumberOfProcessType()

void G4ProcessTableMessenger::SetNumberOfProcessType ( )
private

Definition at line 391 of file G4ProcessTableMessenger.cc.

392 {
393  G4bool isFoundEndMark = false;
394  G4int idx;
395  for (idx = 0; idx < 1000 ; idx ++ ) {
397  isFoundEndMark = typeName.contains("---");
398  if ( isFoundEndMark ) break;
399  }
400  if ( isFoundEndMark ) {
401  NumberOfProcessType = idx;
402  } else {
403  G4Exception("G4ProcessTableMessenger::SetNumberOfProcessType()","ProcMan014",
404  FatalException,"No End Mark");
405  }
406 }
static const G4String & GetProcessTypeName(G4ProcessType)
Definition: G4VProcess.cc:141
G4bool contains(const std::string &) const
int G4int
Definition: G4Types.hh:78
bool G4bool
Definition: G4Types.hh:79
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
static G4ThreadLocal G4int NumberOfProcessType
G4ProcessType
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ activateCmd

G4UIcommand* G4ProcessTableMessenger::activateCmd
private

Definition at line 93 of file G4ProcessTableMessenger.hh.

◆ currentParticleName

G4String G4ProcessTableMessenger::currentParticleName
private

Definition at line 99 of file G4ProcessTableMessenger.hh.

◆ currentProcessName

G4String G4ProcessTableMessenger::currentProcessName
private

Definition at line 98 of file G4ProcessTableMessenger.hh.

◆ currentProcessTypeName

G4String G4ProcessTableMessenger::currentProcessTypeName
private

Definition at line 97 of file G4ProcessTableMessenger.hh.

◆ dumpCmd

G4UIcommand* G4ProcessTableMessenger::dumpCmd
private

Definition at line 92 of file G4ProcessTableMessenger.hh.

◆ inactivateCmd

G4UIcommand* G4ProcessTableMessenger::inactivateCmd
private

Definition at line 94 of file G4ProcessTableMessenger.hh.

◆ listCmd

G4UIcmdWithAString* G4ProcessTableMessenger::listCmd
private

Definition at line 91 of file G4ProcessTableMessenger.hh.

◆ NumberOfProcessType

G4ThreadLocal G4int G4ProcessTableMessenger::NumberOfProcessType = 10
staticprivate

Definition at line 78 of file G4ProcessTableMessenger.hh.

◆ procVerboseCmd

G4UIcommand* G4ProcessTableMessenger::procVerboseCmd
private

Definition at line 95 of file G4ProcessTableMessenger.hh.

◆ theProcessTable

G4ProcessTable* G4ProcessTableMessenger::theProcessTable
private

Definition at line 84 of file G4ProcessTableMessenger.hh.

◆ thisDirectory

G4UIdirectory* G4ProcessTableMessenger::thisDirectory
private

Definition at line 89 of file G4ProcessTableMessenger.hh.

◆ verboseCmd

G4UIcmdWithAnInteger* G4ProcessTableMessenger::verboseCmd
private

Definition at line 90 of file G4ProcessTableMessenger.hh.


The documentation for this class was generated from the following files: