Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4ProcessManagerMessenger Class Reference

#include <G4ProcessManagerMessenger.hh>

+ Inheritance diagram for G4ProcessManagerMessenger:

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)
 
virtual ~G4UImessenger ()
 
virtual G4String GetCurrentValue (G4UIcommand *command)
 
virtual void SetNewValue (G4UIcommand *command, G4String newValue)
 
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)
 
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::G4ProcessManagerMessenger ( G4ParticleTable pTable = 0)

Definition at line 62 of file G4ProcessManagerMessenger.cc.

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}
@ G4State_EventProc
@ G4State_Init
@ G4State_Idle
@ G4State_GeomClosed
@ G4State_PreInit
static G4ParticleTable * GetParticleTable()
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetDefaultValue(G4int defVal)
void SetParameter(G4UIparameter *const newParameter)
Definition: G4UIcommand.hh:147
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:156
void SetRange(const char *rs)
Definition: G4UIcommand.hh:120
void AvailableForStates(G4ApplicationState s1)
Definition: G4UIcommand.cc:219
void SetDefaultValue(const char *theDefaultValue)

◆ ~G4ProcessManagerMessenger()

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

◆ GetCurrentValue()

G4String G4ProcessManagerMessenger::GetCurrentValue ( G4UIcommand command)
virtual

Reimplemented from G4UImessenger.

Definition at line 203 of file G4ProcessManagerMessenger.cc.

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

◆ SetNewValue()

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

Reimplemented from G4UImessenger.

Definition at line 143 of file G4ProcessManagerMessenger.cc.

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}
int G4int
Definition: G4Types.hh:66
#define G4endl
Definition: G4ios.hh:52
G4DLLIMPORT std::ostream G4cout
G4VProcess * SetProcessActivation(G4VProcess *aProcess, G4bool fActive)
void SetVerboseLevel(G4int value)
static G4int GetNewIntValue(const char *paramString)
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:369
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:51
void SetVerboseLevel(G4int value)
Definition: G4VProcess.hh:408
virtual void DumpInfo() const
Definition: G4VProcess.cc:206

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