Geant4 10.7.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, 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
 

Static Public Member Functions

static G4RTMessengerGetInstance (G4TheRayTracer *p1)
 

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

Constructor & Destructor Documentation

◆ ~G4RTMessenger()

G4RTMessenger::~G4RTMessenger ( )
virtual

Definition at line 139 of file G4RTMessenger.cc.

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

Member Function Documentation

◆ GetCurrentValue()

G4String G4RTMessenger::GetCurrentValue ( G4UIcommand command)
virtual

Reimplemented from G4UImessenger.

Definition at line 156 of file G4RTMessenger.cc.

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

◆ GetInstance()

G4RTMessenger * G4RTMessenger::GetInstance ( G4TheRayTracer p1)
static

Definition at line 49 of file G4RTMessenger.cc.

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

Referenced by G4TheRayTracer::G4TheRayTracer().

◆ SetNewValue()

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

Reimplemented from G4UImessenger.

Definition at line 184 of file G4RTMessenger.cc.

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

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