Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions
G4ProcessManagerMessenger Class Reference

#include <G4ProcessManagerMessenger.hh>

Inheritance diagram for G4ProcessManagerMessenger:
G4UImessenger

Public Member Functions

 G4ProcessManagerMessenger (G4ParticleTable *pTable=0)
 
virtual ~G4ProcessManagerMessenger ()
 
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
 

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
 

Detailed Description

Definition at line 69 of file G4ProcessManagerMessenger.hh.

Constructor & Destructor Documentation

G4ProcessManagerMessenger::G4ProcessManagerMessenger ( G4ParticleTable pTable = 0)

Definition at line 62 of file G4ProcessManagerMessenger.cc.

References G4UIcommand::AvailableForStates(), G4State_EventProc, G4State_GeomClosed, G4State_Idle, G4State_Init, G4State_PreInit, G4ParticleTable::GetParticleTable(), G4UIcmdWithAnInteger::SetDefaultValue(), G4UIparameter::SetDefaultValue(), G4UIcommand::SetGuidance(), G4UIcommand::SetParameter(), G4UIcmdWithAnInteger::SetParameterName(), and G4UIcommand::SetRange().

63  :theParticleTable(pTable),
64  currentParticle(0),
65  currentProcess(0),
66  theManager(0),
67  theProcessList(0)
68 {
69  if ( theParticleTable == 0) theParticleTable = G4ParticleTable::GetParticleTable();
70 
71  //Commnad /particle/process
72  thisDirectory = new G4UIdirectory("/particle/process/");
73  thisDirectory->SetGuidance("Process Manager control commands.");
74 
75  //Commnad /particle/process/dump
76  dumpCmd = new G4UIcmdWithAnInteger("/particle/process/dump",this);
77  dumpCmd->SetGuidance("dump process manager or process information");
78  dumpCmd->SetGuidance(" dump [process index]");
79  dumpCmd->SetGuidance(" process index: -1 for process manager");
80  dumpCmd->SetParameterName("index", true);
81  dumpCmd->SetDefaultValue(-1);
82 
83  //Commnad /particle/process/Verbose
84  verboseCmd = new G4UIcommand("/particle/process/verbose",this);
85  verboseCmd->SetGuidance("Set Verbose Level for Process or Process Manager");
86  verboseCmd->SetGuidance(" Verbose [Verbose] [process index]");
87  verboseCmd->SetGuidance(" process index: -1 for process manager");
88  G4UIparameter* param = new G4UIparameter("Verbose",'i',true);
89  param->SetDefaultValue(1);
90  verboseCmd->SetParameter(param);
91  param = new G4UIparameter("index",'i',true);
92  param->SetDefaultValue(-1);
93  verboseCmd->SetParameter(param);
95 
96  //Commnad /particle/process/Activate
97  activateCmd = new G4UIcmdWithAnInteger("/particle/process/activate",this);
98  activateCmd->SetGuidance("Activate process ");
99  activateCmd->SetGuidance(" Activate [process index]");
100  activateCmd->SetParameterName("index", false);
101  activateCmd->SetDefaultValue(0);
102  activateCmd->SetRange("index >=0");
104 
105  //Commnad /particle/process/inactivate
106  inactivateCmd = new G4UIcmdWithAnInteger("/particle/process/inactivate",this);
107  inactivateCmd->SetGuidance("Inactivate process ");
108  inactivateCmd->SetGuidance(" inactivate [process index]");
109  inactivateCmd->SetParameterName("index", false);
110  inactivateCmd->SetDefaultValue(0);
111  inactivateCmd->SetRange("index >=0");
113 
114 }
void SetParameter(G4UIparameter *const newParameter)
Definition: G4UIcommand.hh:152
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetDefaultValue(const char *theDefaultValue)
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:225
static G4ParticleTable * GetParticleTable()
void SetDefaultValue(G4int defVal)
G4ProcessManagerMessenger::~G4ProcessManagerMessenger ( )
virtual

Definition at line 116 of file G4ProcessManagerMessenger.cc.

117 {
118  delete activateCmd;
119  delete inactivateCmd;
120  delete verboseCmd;
121  delete dumpCmd;
122  delete thisDirectory;
123 }

Member Function Documentation

G4String G4ProcessManagerMessenger::GetCurrentValue ( G4UIcommand command)
virtual

Reimplemented from G4UImessenger.

Definition at line 203 of file G4ProcessManagerMessenger.cc.

References G4ProcessManager::GetVerboseLevel().

204 {
205  G4String returnValue('\0');
206  if(SetCurrentParticle() == 0) {
207  // no particle is selected. return null strings
208  return returnValue;
209  }
210 
211  std::ostringstream os;
212 
213  if( command==verboseCmd ){
214  //Commnad /particle/process/Verbose
215  os << theManager->GetVerboseLevel();
216  returnValue = os.str();
217  }
218  return returnValue;
219 }
G4int GetVerboseLevel() const
void G4ProcessManagerMessenger::SetNewValue ( G4UIcommand command,
G4String  newValues 
)
virtual

Reimplemented from G4UImessenger.

Definition at line 143 of file G4ProcessManagerMessenger.cc.

References G4UImanager::ApplyCommand(), G4ProcessManager::DumpInfo(), G4VProcess::DumpInfo(), G4cout, G4endl, G4UIcmdWithAnInteger::GetNewIntValue(), G4UImanager::GetUIpointer(), G4ProcessManager::SetProcessActivation(), G4ProcessManager::SetVerboseLevel(), and G4VProcess::SetVerboseLevel().

144 {
145  if (SetCurrentParticle()==0) {
146  G4cout << "Particle is not selected yet !! Command ignored." << G4endl;
147  return;
148  }
149  if( command == dumpCmd ){
150  //Commnad /particle/process/dump
151  G4int index = dumpCmd->GetNewIntValue(newValue);
152  if (index <0) {
153  theManager->DumpInfo();
154  } else if ( index < theManager->GetProcessListLength()){
155  currentProcess = (*theProcessList)(index);
156  if (currentProcess == 0) {
157  G4cout << " no process at index of " << index;
158  G4cout << "in the Process Vector" << G4endl;
159  } else {
160  currentProcess->DumpInfo();
161  }
162  } else {
163  G4cout << " illegal index !!! " << G4endl;
164  currentProcess = 0;
165  }
166 
167  } else if( command==activateCmd ) {
168  //Commnad /particle/process/activate
169  theManager->SetProcessActivation(activateCmd->GetNewIntValue(newValue), true);
170  G4UImanager::GetUIpointer()->ApplyCommand("/run/physicsModified");
171 
172  } else if( command==inactivateCmd ) {
173  //Commnad /particle/process/inactivate
174  theManager->SetProcessActivation(inactivateCmd->GetNewIntValue(newValue), false);
175  G4UImanager::GetUIpointer()->ApplyCommand("/run/physicsModified");
176 
177  } else if( command==verboseCmd ) {
178  //Commnad /particle/process/Verbose
179  // inputstream for newValues
180  const char* temp = (const char*)(newValue);
181  std::istringstream is((char*)temp);
182  G4int Verbose, index;
183  is >>Verbose >>index;
184  if (index <0) {
185  theManager->SetVerboseLevel(Verbose);
186 
187  } else if ( index < theManager->GetProcessListLength()){
188  currentProcess = (*theProcessList)(index);
189  if (currentProcess == 0) {
190  G4cout << " no process at index of " << index;
191  G4cout << "in the Process Vector" << G4endl;
192  } else {
193  currentProcess->SetVerboseLevel(Verbose);
194  }
195  } else {
196  G4cout << " illegal index !!! " << G4endl;
197  currentProcess = 0;
198  }
199  }
200 }
static G4int GetNewIntValue(const char *paramString)
void SetVerboseLevel(G4int value)
int G4int
Definition: G4Types.hh:78
G4VProcess * SetProcessActivation(G4VProcess *aProcess, G4bool fActive)
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:58
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
virtual void DumpInfo() const
Definition: G4VProcess.cc:178
void SetVerboseLevel(G4int value)
Definition: G4VProcess.hh:437
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:419

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