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

#include <G4RTMessenger.hh>

+ Inheritance diagram for G4RTMessenger:

Public Member Functions

virtual ~G4RTMessenger ()
 
virtual G4String GetCurrentValue (G4UIcommand *command)
 
virtual void SetNewValue (G4UIcommand *command, G4String newValue)
 
- Public Member Functions inherited from G4UImessenger
 G4UImessenger ()=default
 
 G4UImessenger (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
 
virtual ~G4UImessenger ()
 
G4bool CommandsShouldBeInMaster () const
 

Static Public Member Functions

static G4RTMessengerGetInstance (G4TheRayTracer *p1)
 

Additional Inherited Members

- Protected Member Functions inherited from G4UImessenger
G4String ItoS (G4int i)
 
G4String LtoS (G4long l)
 
G4String DtoS (G4double a)
 
G4String BtoS (G4bool b)
 
G4int StoI (const G4String &s)
 
G4long StoL (const G4String &s)
 
G4double StoD (const G4String &s)
 
G4bool StoB (const 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 50 of file G4RTMessenger.hh.

Constructor & Destructor Documentation

◆ ~G4RTMessenger()

G4RTMessenger::~G4RTMessenger ( )
virtual

Definition at line 141 of file G4RTMessenger.cc.

142{
143 delete columnCmd;
144 delete rowCmd;
145 delete targetCmd;
146 delete eyePosCmd;
147 delete lightCmd;
148 delete spanXCmd;
149 delete headCmd;
150 delete attCmd;
151 delete distCmd;
152 delete transCmd;
153 delete fileCmd;
154 delete bkgColCmd;
155 delete rayDirectory;
156}

Member Function Documentation

◆ GetCurrentValue()

G4String G4RTMessenger::GetCurrentValue ( G4UIcommand * command)
virtual

Reimplemented from G4UImessenger.

Definition at line 158 of file G4RTMessenger.cc.

159{
160 G4String currentValue;
161 if(command==columnCmd)
162 { currentValue = columnCmd->ConvertToString(theTracer->GetNColumn()); }
163 else if(command==rowCmd)
164 { currentValue = rowCmd->ConvertToString(theTracer->GetNRow()); }
165 else if(command==targetCmd)
166 { currentValue = targetCmd->ConvertToString(theTracer->GetTargetPosition(),"m"); }
167 else if(command==eyePosCmd)
168 { currentValue = eyePosCmd->ConvertToString(theTracer->GetEyePosition(),"m"); }
169 else if(command==lightCmd)
170 { currentValue = lightCmd->ConvertToString(theTracer->GetLightDirection()); }
171 else if(command==spanXCmd)
172 { currentValue = spanXCmd->ConvertToString(theTracer->GetViewSpan(),"deg"); }
173 else if(command==headCmd)
174 { currentValue = headCmd->ConvertToString(theTracer->GetHeadAngle(),"deg"); }
175 else if(command==attCmd)
176 { currentValue = attCmd->ConvertToString(theTracer->GetAttenuationLength(),"m");}
177 else if(command==distCmd)
178 { currentValue = distCmd->ConvertToString(theTracer->GetDistortion()); }
179 else if(command==transCmd)
180 { currentValue = transCmd->ConvertToString(G4RTSteppingAction::GetIgnoreTransparency()); }
181 else if(command==bkgColCmd)
182 { currentValue = bkgColCmd->ConvertToString(theTracer->GetBackgroundColour()); }
183 return currentValue;
184}
static G4bool GetIgnoreTransparency()

◆ GetInstance()

G4RTMessenger * G4RTMessenger::GetInstance ( G4TheRayTracer * p1)
static

Definition at line 51 of file G4RTMessenger.cc.

53{
54 if (!fpInstance) fpInstance = new G4RTMessenger(p1);
55 return fpInstance;
56}

Referenced by G4TheRayTracer::G4TheRayTracer().

◆ SetNewValue()

void G4RTMessenger::SetNewValue ( G4UIcommand * command,
G4String newValue )
virtual

Reimplemented from G4UImessenger.

Definition at line 186 of file G4RTMessenger.cc.

187{
188 G4VisManager* pVisManager = G4VisManager::GetInstance();
189
190 theTracer = theDefaultTracer;
191
192 G4VViewer* pVViewer = pVisManager->GetCurrentViewer();
193 if (pVViewer) {
194 G4RayTracerViewer* pViewer = dynamic_cast<G4RayTracerViewer*>(pVViewer);
195 if (pViewer) {
196 theTracer = pViewer->GetTracer();
197 } else {
198 G4warn <<
199 "G4RTMessenger::SetNewValue: Current viewer is not of type RayTracer."
200 "\n Use \"/vis/viewer/select\" or \"/vis/open\"."
201 << G4endl;
202 }
203 }
204
205 if (theTracer == theDefaultTracer) {
206 G4warn <<
207"G4RTMessenger::SetNewValue: No valid current viewer. Using default RayTracer."
208 << G4endl;
209 }
210
211 if(command==columnCmd)
212 { theTracer->SetNColumn(columnCmd->GetNewIntValue(newValue)); }
213 else if(command==rowCmd)
214 { theTracer->SetNRow(rowCmd->GetNewIntValue(newValue)); }
215 else if(command==targetCmd)
216 { theTracer->SetTargetPosition(targetCmd->GetNew3VectorValue(newValue)); }
217 else if(command==eyePosCmd)
218 { theTracer->SetEyePosition(eyePosCmd->GetNew3VectorValue(newValue)); }
219 else if(command==lightCmd)
220 { theTracer->SetLightDirection(lightCmd->GetNew3VectorValue(newValue)); }
221 else if(command==spanXCmd)
222 { theTracer->SetViewSpan(spanXCmd->GetNewDoubleValue(newValue)); }
223 else if(command==headCmd)
224 { theTracer->SetHeadAngle(headCmd->GetNewDoubleValue(newValue)); }
225 else if(command==attCmd)
226 { theTracer->SetAttenuationLength(attCmd->GetNewDoubleValue(newValue)); }
227 else if(command==distCmd)
228 { theTracer->SetDistortion(distCmd->GetNewBoolValue(newValue)); }
229 else if(command==bkgColCmd)
230 {
231 G4warn << "WARNING: /vis/rayTracer/backgroundColour has been deprecated."
232 "\n Use \"/vis/viewer/set/background\" instead."
233 << G4endl;
234 }
235 else if(command==transCmd)
236 { G4RTSteppingAction::SetIgnoreTransparency(transCmd->GetNewBoolValue(newValue)); }
237 else if(command==fileCmd)
238 { theTracer->Trace(newValue); }
239}
#define G4warn
Definition G4Scene.cc:41
#define G4endl
Definition G4ios.hh:67
static void SetIgnoreTransparency(G4bool val)
G4TheRayTracer * GetTracer()
G4VViewer * GetCurrentViewer() const
static G4VisManager * GetInstance()

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