Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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
 

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::G4ProcessTableMessenger ( G4ProcessTable pTable)

Definition at line 68 of file G4ProcessTableMessenger.cc.

69  :theProcessTable(pTable),
70  currentProcessTypeName("all"),
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");
86  SetNumberOfProcessType();
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);
101  verboseCmd->SetDefaultValue(1);
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);
114  procVerboseCmd->SetParameter(param);
115  param = new G4UIparameter("type",'s',true);
116  param->SetDefaultValue("all");
117  procVerboseCmd->SetParameter(param);
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:240
void SetDefaultValue(const char *defVal)
void SetCandidates(const char *candidateList)
void SetDefaultValue(G4int defVal)
G4ProcessType

Here is the call graph for this function:

Here is the caller graph for this function:

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 }

Member Function Documentation

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
355  return verboseCmd->ConvertToString(theProcessTable->GetVerboseLevel());
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:372
G4int GetVerboseLevel() const

Here is the call graph for this function:

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

Reimplemented from G4UImessenger.

Definition at line 174 of file G4ProcessTableMessenger.cc.

175 {
176  G4ProcessTable::G4ProcNameVector* procNameVector
177  = theProcessTable->GetNameList();
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
226  currentProcessTypeName = G4String(next());
227  if (currentProcessTypeName.isNull()) currentProcessTypeName = "all";
228  G4bool isProcName = false;
229  G4bool isAll = false;
230  type = -1;
231 
232  if (currentProcessTypeName == "all") {
233  isAll = true;
234  } else {
235  type = GetProcessType(currentProcessTypeName);
236  if (type<0) {
237  isProcName = true;
238  currentProcessName = currentProcessTypeName;
239  currentProcessTypeName = "";
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
259  theProcessTable->SetVerboseLevel(verboseCmd->GetNewIntValue(newValue));
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) {
276  type = GetProcessType(currentProcessName);
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 {
293  isParticleFound = G4ParticleTable::GetParticleTable()->contains(currentParticleName);
294  if (isParticleFound) {
295  currentParticle = G4ParticleTable::GetParticleTable()->FindParticle(currentParticleName);
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) {
311  tmpVector = theProcessTable->FindProcesses(currentProcessName);
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 ) {
326  theProcessTable->SetProcessActivation(currentProcessName,
327  fActive);
328  } else {
329  theProcessTable->SetProcessActivation(currentProcessName,
330  currentParticle,
331  fActive);
332  }
333  } else {
334  if ( currentParticle == 0 ) {
335  theProcessTable->SetProcessActivation(G4ProcessType(type),
336  fActive);
337  } else {
338  theProcessTable->SetProcessActivation(G4ProcessType(type),
339  currentParticle,
340  fActive);
341  }
342  }
343  G4UImanager::GetUIpointer()->ApplyCommand("/run/physicsModified");
344  // process/activate , inactivate
345  }
346  }
347 }
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
void DumpInfo(G4VProcess *process, G4ParticleDefinition *particle=0)
static G4int GetNewIntValue(const char *paramString)
const char * p
Definition: xmltok.h:285
G4ProcessType GetProcessType() const
Definition: G4VProcess.hh:414
int G4int
Definition: G4Types.hh:78
void SetProcessActivation(const G4String &processName, G4bool fActive)
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:59
G4GLOB_DLL std::ostream G4cout
void SetVerboseLevel(G4int value)
bool G4bool
Definition: G4Types.hh:79
G4int length() const
const G4String & GetProcessName() const
Definition: G4VProcess.hh:408
G4bool contains(const G4ParticleDefinition *particle) const
G4ProcNameVector * GetNameList()
static G4ParticleTable * GetParticleTable()
std::vector< G4String > G4ProcNameVector
#define G4endl
Definition: G4ios.hh:61
G4ProcessVector * FindProcesses()
G4bool isNull() const
void SetVerboseLevel(G4int value)
Definition: G4VProcess.hh:437
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:447
G4ProcessType

Here is the call graph for this function:


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