Geant4 10.7.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=nullptr)
 
virtual ~G4ProcessManagerMessenger ()
 
 G4ProcessManagerMessenger (const G4ProcessManagerMessenger &)=delete
 
G4ProcessManagerMessengeroperator= (const G4ProcessManagerMessenger &)=delete
 
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 ()
 
virtual G4String GetCurrentValue (G4UIcommand *command)
 
virtual void SetNewValue (G4UIcommand *command, G4String newValue)
 
G4bool operator== (const G4UImessenger &messenger) const
 
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)
 
G4long StoL (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 = nullptr
 
G4String baseDirName = ""
 
G4bool commandsShouldBeInMaster = false
 

Detailed Description

Definition at line 59 of file G4ProcessManagerMessenger.hh.

Constructor & Destructor Documentation

◆ G4ProcessManagerMessenger() [1/2]

G4ProcessManagerMessenger::G4ProcessManagerMessenger ( G4ParticleTable pTable = nullptr)

Definition at line 50 of file G4ProcessManagerMessenger.cc.

51 : theParticleTable(pTable)
52{
53 if ( theParticleTable == nullptr)
54 theParticleTable = G4ParticleTable::GetParticleTable();
55
56 // Command /particle/process
57 thisDirectory = new G4UIdirectory("/particle/process/");
58 thisDirectory->SetGuidance("Process Manager control commands.");
59
60 // Command /particle/process/dump
61 dumpCmd = new G4UIcmdWithAnInteger("/particle/process/dump",this);
62 dumpCmd->SetGuidance("dump process manager or process information");
63 dumpCmd->SetGuidance(" dump [process index]");
64 dumpCmd->SetGuidance(" process index: -1 for process manager");
65 dumpCmd->SetParameterName("index", true);
66 dumpCmd->SetDefaultValue(-1);
67
68 // Command /particle/process/verbose
69 verboseCmd = new G4UIcommand("/particle/process/verbose",this);
70 verboseCmd->SetGuidance("Set Verbose Level for Process or Process Manager");
71 verboseCmd->SetGuidance(" Verbose [Verbose] [process index]");
72 verboseCmd->SetGuidance(" process index: -1 for process manager");
73 G4UIparameter* param = new G4UIparameter("Verbose",'i',true);
74 param->SetDefaultValue(1);
75 verboseCmd->SetParameter(param);
76 param = new G4UIparameter("index",'i',true);
77 param->SetDefaultValue(-1);
78 verboseCmd->SetParameter(param);
80
81 // Command /particle/process/activate
82 activateCmd = new G4UIcmdWithAnInteger("/particle/process/activate",this);
83 activateCmd->SetGuidance("Activate process ");
84 activateCmd->SetGuidance(" Activate [process index]");
85 activateCmd->SetParameterName("index", false);
86 activateCmd->SetDefaultValue(0);
87 activateCmd->SetRange("index >=0");
88 activateCmd->AvailableForStates(G4State_Idle);
89
90 // Command /particle/process/inactivate
91 inactivateCmd = new G4UIcmdWithAnInteger("/particle/process/inactivate",this);
92 inactivateCmd->SetGuidance("Inactivate process ");
93 inactivateCmd->SetGuidance(" inactivate [process index]");
94 inactivateCmd->SetParameterName("index", false);
95 inactivateCmd->SetDefaultValue(0);
96 inactivateCmd->SetRange("index >=0");
97 inactivateCmd->AvailableForStates(G4State_Idle);
98}
@ 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:146
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:273
void SetDefaultValue(const char *theDefaultValue)

◆ ~G4ProcessManagerMessenger()

G4ProcessManagerMessenger::~G4ProcessManagerMessenger ( )
virtual

Definition at line 101 of file G4ProcessManagerMessenger.cc.

102{
103 delete activateCmd;
104 delete inactivateCmd;
105 delete verboseCmd;
106 delete dumpCmd;
107 delete thisDirectory;
108}

◆ G4ProcessManagerMessenger() [2/2]

G4ProcessManagerMessenger::G4ProcessManagerMessenger ( const G4ProcessManagerMessenger )
delete

Member Function Documentation

◆ GetCurrentValue()

G4String G4ProcessManagerMessenger::GetCurrentValue ( G4UIcommand command)
virtual

Reimplemented from G4UImessenger.

Definition at line 219 of file G4ProcessManagerMessenger.cc.

220{
221 if(SetCurrentParticle() == nullptr) return "";
222
223 if( command==verboseCmd )
224 {
225 // Command /particle/process/Verbose
226 return verboseCmd->ConvertToString(theManager->GetVerboseLevel());
227 }
228 else
229 {
230 return "";
231 }
232}
G4int GetVerboseLevel() const
static G4String ConvertToString(G4bool boolVal)
Definition: G4UIcommand.cc:430

◆ operator=()

G4ProcessManagerMessenger & G4ProcessManagerMessenger::operator= ( const G4ProcessManagerMessenger )
delete

◆ SetNewValue()

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

Reimplemented from G4UImessenger.

Definition at line 129 of file G4ProcessManagerMessenger.cc.

130{
132 if (SetCurrentParticle() == nullptr)
133 {
134 ed << "Particle is not selected yet !! Command ignored.";
135 command->CommandFailed(ed);
136 return;
137 }
138 if( command == dumpCmd )
139 {
140 // Command /particle/process/dump
141 G4int index = dumpCmd->GetNewIntValue(newValue);
142 if (index <0)
143 {
144 theManager->DumpInfo();
145 }
146 else if ( index < theManager->GetProcessListLength())
147 {
148 currentProcess = (*theProcessList)(index);
149 if (currentProcess == nullptr)
150 {
151 ed << " no process at index of " << index
152 << " in the Process Vector";
153 command->CommandFailed(ed);
154 }
155 else
156 {
157 currentProcess->DumpInfo();
158 }
159 }
160 else
161 {
162 ed << " illegal index !!! ";
163 command->CommandFailed(ed);
164 currentProcess = nullptr;
165 }
166
167 }
168 else if( command==activateCmd )
169 {
170 // Command /particle/process/activate
171 theManager->SetProcessActivation(activateCmd->GetNewIntValue(newValue), true);
172 G4UImanager::GetUIpointer()->ApplyCommand("/run/physicsModified");
173
174 }
175 else if( command==inactivateCmd )
176 {
177 // Command /particle/process/inactivate
178 theManager->SetProcessActivation(inactivateCmd->GetNewIntValue(newValue), false);
179 G4UImanager::GetUIpointer()->ApplyCommand("/run/physicsModified");
180
181 }
182 else if( command==verboseCmd )
183 {
184 // Command /particle/process/Verbose
185 // inputstream for newValues
186 const char* temp = (const char*)(newValue);
187 std::istringstream is((char*)temp);
188 G4int Verbose, index;
189 is >>Verbose >>index;
190 if (index <0)
191 {
192 theManager->SetVerboseLevel(Verbose);
193
194 }
195 else if ( index < theManager->GetProcessListLength())
196 {
197 currentProcess = (*theProcessList)(index);
198 if (currentProcess == nullptr)
199 {
200 ed << " no process at index of " << index
201 << " in the Process Vector";
202 command->CommandFailed(ed);
203 }
204 else
205 {
206 currentProcess->SetVerboseLevel(Verbose);
207 }
208 }
209 else
210 {
211 ed << " illegal index !!! ";
212 command->CommandFailed(ed);
213 currentProcess = nullptr;
214 }
215 }
216}
std::ostringstream G4ExceptionDescription
Definition: G4Exception.hh:40
int G4int
Definition: G4Types.hh:85
G4VProcess * SetProcessActivation(G4VProcess *aProcess, G4bool fActive)
void SetVerboseLevel(G4int value)
static G4int GetNewIntValue(const char *paramString)
void CommandFailed(G4int errCode, G4ExceptionDescription &ed)
Definition: G4UIcommand.hh:179
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:485
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:77
void SetVerboseLevel(G4int value)
Definition: G4VProcess.hh:412
virtual void DumpInfo() const
Definition: G4VProcess.cc:167

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