Geant4 9.6.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 ()
 
 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
 

Static Public Member Functions

static G4RTMessengerGetInstance (G4TheRayTracer *p1, G4RTSteppingAction *p2)
 

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 52 of file G4RTMessenger.hh.

Constructor & Destructor Documentation

◆ ~G4RTMessenger()

G4RTMessenger::~G4RTMessenger ( )
virtual

Definition at line 140 of file G4RTMessenger.cc.

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

Member Function Documentation

◆ GetCurrentValue()

G4String G4RTMessenger::GetCurrentValue ( G4UIcommand command)
virtual

Reimplemented from G4UImessenger.

Definition at line 157 of file G4RTMessenger.cc.

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

◆ GetInstance()

G4RTMessenger * G4RTMessenger::GetInstance ( G4TheRayTracer p1,
G4RTSteppingAction p2 
)
static

Definition at line 50 of file G4RTMessenger.cc.

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

Referenced by G4TheRayTracer::G4TheRayTracer().

◆ SetNewValue()

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

Reimplemented from G4UImessenger.

Definition at line 185 of file G4RTMessenger.cc.

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

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