Geant4  10.02.p03
G4RTMessenger Class Reference

#include <G4RTMessenger.hh>

Inheritance diagram for G4RTMessenger:
Collaboration 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 ()
 
G4bool operator== (const G4UImessenger &messenger) const
 
G4bool CommandsShouldBeInMaster () const
 

Static Public Member Functions

static G4RTMessengerGetInstance (G4TheRayTracer *p1)
 

Private Member Functions

 G4RTMessenger (G4TheRayTracer *p1)
 

Private Attributes

G4TheRayTracertheDefaultTracer
 
G4TheRayTracertheTracer
 
G4UIdirectoryrayDirectory
 
G4UIcmdWithAnIntegercolumnCmd
 
G4UIcmdWithAnIntegerrowCmd
 
G4UIcmdWith3VectorAndUnittargetCmd
 
G4UIcmdWith3VectorAndUniteyePosCmd
 
G4UIcmdWith3VectorlightCmd
 
G4UIcmdWithADoubleAndUnitspanXCmd
 
G4UIcmdWithADoubleAndUnitheadCmd
 
G4UIcmdWithADoubleAndUnitattCmd
 
G4UIcmdWithABooldistCmd
 
G4UIcmdWithABooltransCmd
 
G4UIcmdWithAStringfileCmd
 
G4UIcmdWith3VectorbkgColCmd
 

Static Private Attributes

static G4RTMessengerfpInstance = 0
 

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, G4bool commandsToBeBroadcasted=true)
 
template<typename T >
T * CreateCommand (const G4String &cname, const G4String &dsc)
 
- Protected Attributes inherited from G4UImessenger
G4UIdirectorybaseDir
 
G4String baseDirName
 
G4bool commandsShouldBeInMaster
 

Detailed Description

Definition at line 51 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 }
G4UIcmdWithADoubleAndUnit * headCmd
G4UIcmdWithADoubleAndUnit * spanXCmd
G4UIcmdWithABool * transCmd
G4UIcmdWith3VectorAndUnit * targetCmd
G4UIcmdWithAnInteger * columnCmd
G4UIcmdWith3VectorAndUnit * eyePosCmd
G4UIcmdWithAnInteger * rowCmd
G4UIcmdWithABool * distCmd
G4UIcmdWithAString * fileCmd
G4UIcmdWith3Vector * lightCmd
G4UIcmdWith3Vector * bkgColCmd
G4UIcmdWithADoubleAndUnit * attCmd
G4UIdirectory * rayDirectory

◆ G4RTMessenger()

G4RTMessenger::G4RTMessenger ( G4TheRayTracer p1)
private

Definition at line 57 of file G4RTMessenger.cc.

58 {
59  theDefaultTracer = p1;
61 
62  rayDirectory = new G4UIdirectory("/vis/rayTracer/");
63  rayDirectory->SetGuidance("RayTracer commands.");
64 
65  fileCmd = new G4UIcmdWithAString("/vis/rayTracer/trace",this);
66  fileCmd->SetGuidance("Start the ray tracing.");
67  fileCmd->SetGuidance("Define the name of output JPEG file.");
68  fileCmd->SetParameterName("fileName",true);
69  fileCmd->SetDefaultValue("g4RayTracer.jpeg");
71 
72  columnCmd = new G4UIcmdWithAnInteger("/vis/rayTracer/column",this);
73  columnCmd->SetGuidance("Define the number of horizontal pixels.");
74  columnCmd->SetParameterName("nPixel",false);
75  columnCmd->SetRange("nPixel > 0");
76 
77  rowCmd = new G4UIcmdWithAnInteger("/vis/rayTracer/row",this);
78  rowCmd->SetGuidance("Define the number of virtical pixels.");
79  rowCmd->SetParameterName("nPixel",false);
80  rowCmd->SetRange("nPixel > 0");
81 
82  targetCmd = new G4UIcmdWith3VectorAndUnit("/vis/rayTracer/target",this);
83  targetCmd->SetGuidance("Define the center position of the target.");
84  targetCmd->SetParameterName("X","Y","Z",true);
87 
88  eyePosCmd = new G4UIcmdWith3VectorAndUnit("/vis/rayTracer/eyePosition",this);
89  eyePosCmd->SetGuidance("Define the eye position.");
90  eyePosCmd->SetGuidance("Eye direction is calsurated from (target - eyePosition).");
91  eyePosCmd->SetParameterName("X","Y","Z",true);
94 
95  lightCmd = new G4UIcmdWith3Vector("/vis/rayTracer/lightDirection",this);
96  lightCmd->SetGuidance("Define the direction of illumination light.");
97  lightCmd->SetGuidance("The vector needs not to be a unit vector, but it must not be a zero vector.");
98  lightCmd->SetParameterName("Px","Py","Pz",true);
99  lightCmd->SetDefaultValue(G4ThreeVector(0.1,0.2,0.3));
100  lightCmd->SetRange("Px != 0 || Py != 0 || Pz != 0");
101 
102  spanXCmd = new G4UIcmdWithADoubleAndUnit("/vis/rayTracer/span",this);
103  spanXCmd->SetGuidance("Define the angle per 100 pixels.");
104  spanXCmd->SetParameterName("span",true);
106  spanXCmd->SetDefaultUnit("deg");
107  spanXCmd->SetRange("span>0.");
108 
109  headCmd = new G4UIcmdWithADoubleAndUnit("/vis/rayTracer/headAngle",this);
110  headCmd->SetGuidance("Define the head direction.");
111  headCmd->SetParameterName("headAngle",true);
112  headCmd->SetDefaultValue(270.);
113  headCmd->SetDefaultUnit("deg");
114  headCmd->SetRange("headAngle>=0. && headAngle<360.");
115 
116  attCmd = new G4UIcmdWithADoubleAndUnit("/vis/rayTracer/attenuation",this);
117  attCmd->SetGuidance("Define the attenuation length for transparent material.");
118  attCmd->SetGuidance("Note that this value is independent to the attenuation length for the optical photon processes.");
119  attCmd->SetParameterName("Length",true);
120  attCmd->SetDefaultValue(1.0);
121  attCmd->SetDefaultUnit("m");
122  attCmd->SetRange("Length > 0.");
123 
124  distCmd = new G4UIcmdWithABool("/vis/rayTracer/distortion",this);
125  distCmd->SetGuidance("Distortion effect of the fish eye lens.");
126  distCmd->SetParameterName("flag",true);
127  distCmd->SetDefaultValue(false);
128 
129  transCmd = new G4UIcmdWithABool("/vis/rayTracer/ignoreTransparency",this);
130  transCmd->SetGuidance("Ignore transparency even if the alpha of G4Colour < 1.");
131  transCmd->SetParameterName("flag",true);
132  transCmd->SetDefaultValue(false);
133 
134  bkgColCmd = new G4UIcmdWith3Vector("/vis/rayTracer/backgroundColour",this);
135  bkgColCmd->SetGuidance("Command has been deprecated. Use /vis/viewer/set/background instead.");
136  bkgColCmd->SetParameterName("red","green","blue",true);
138 }
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
G4UIcmdWithADoubleAndUnit * headCmd
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
G4UIcmdWithADoubleAndUnit * spanXCmd
CLHEP::Hep3Vector G4ThreeVector
G4UIcmdWithABool * transCmd
void SetDefaultUnit(const char *defUnit)
G4UIcmdWith3VectorAndUnit * targetCmd
void SetParameterName(const char *theNameX, const char *theNameY, const char *theNameZ, G4bool omittable, G4bool currentAsDefault=false)
G4UIcmdWithAnInteger * columnCmd
G4UIcmdWith3VectorAndUnit * eyePosCmd
G4UIcmdWithAnInteger * rowCmd
void SetParameterName(const char *theNameX, const char *theNameY, const char *theNameZ, G4bool omittable, G4bool currentAsDefault=false)
G4TheRayTracer * theDefaultTracer
void SetDefaultValue(G4bool defVal)
G4UIcmdWithABool * distCmd
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetRange(const char *rs)
Definition: G4UIcommand.hh:125
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:161
G4UIcmdWithAString * fileCmd
void AvailableForStates(G4ApplicationState s1)
Definition: G4UIcommand.cc:239
G4UIcmdWith3Vector * lightCmd
void SetDefaultValue(G4ThreeVector defVal)
void SetDefaultValue(const char *defVal)
G4UIcmdWith3Vector * bkgColCmd
void SetDefaultUnit(const char *defUnit)
G4UIcmdWithADoubleAndUnit * attCmd
G4TheRayTracer * theTracer
void SetDefaultValue(G4ThreeVector defVal)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
G4UIdirectory * rayDirectory
Here is the call graph for this function:

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)
180  else if(command==bkgColCmd)
181  { currentValue = bkgColCmd->ConvertToString(theTracer->GetBackgroundColour()); }
182  return currentValue;
183 }
G4bool GetDistortion() const
static G4bool GetIgnoreTransparency()
G4UIcmdWithADoubleAndUnit * headCmd
G4UIcmdWithADoubleAndUnit * spanXCmd
G4UIcmdWithABool * transCmd
G4UIcmdWith3VectorAndUnit * targetCmd
G4ThreeVector GetLightDirection() const
G4UIcmdWithAnInteger * columnCmd
G4int GetNColumn() const
G4UIcmdWith3VectorAndUnit * eyePosCmd
static G4String ConvertToString(G4bool boolVal)
Definition: G4UIcommand.cc:371
G4UIcmdWithAnInteger * rowCmd
G4int GetNRow() const
G4UIcmdWithABool * distCmd
G4double GetAttenuationLength() const
G4ThreeVector GetEyePosition() const
G4UIcmdWith3Vector * lightCmd
G4UIcmdWith3Vector * bkgColCmd
G4UIcmdWithADoubleAndUnit * attCmd
G4ThreeVector GetTargetPosition() const
G4Colour GetBackgroundColour() const
G4TheRayTracer * theTracer
G4double GetViewSpan() const
G4double GetHeadAngle() const
Here is the call graph for this function:

◆ GetInstance()

G4RTMessenger * G4RTMessenger::GetInstance ( G4TheRayTracer p1)
static

Definition at line 51 of file G4RTMessenger.cc.

52 {
53  if (!fpInstance) fpInstance = new G4RTMessenger(p1);
54  return fpInstance;
55 }
G4RTMessenger(G4TheRayTracer *p1)
static G4RTMessenger * fpInstance
Here is the caller graph for this function:

◆ 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 
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)
216  else if(command==eyePosCmd)
218  else if(command==lightCmd)
220  else if(command==spanXCmd)
222  else if(command==headCmd)
224  else if(command==attCmd)
226  else if(command==distCmd)
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)
236  else if(command==fileCmd)
237  { theTracer->Trace(newValue); }
238 }
void SetLightDirection(const G4ThreeVector &val)
void SetHeadAngle(G4double val)
G4VViewer * GetCurrentViewer() const
G4UIcmdWithADoubleAndUnit * headCmd
G4UIcmdWithADoubleAndUnit * spanXCmd
static G4int GetNewIntValue(const char *paramString)
G4UIcmdWithABool * transCmd
G4UIcmdWith3VectorAndUnit * targetCmd
G4UIcmdWithAnInteger * columnCmd
static G4ThreeVector GetNew3VectorValue(const char *paramString)
G4TheRayTracer * GetTracer()
G4UIcmdWith3VectorAndUnit * eyePosCmd
void SetNRow(G4int val)
G4UIcmdWithAnInteger * rowCmd
void SetNColumn(G4int val)
static G4double GetNewDoubleValue(const char *paramString)
static G4bool GetNewBoolValue(const char *paramString)
G4TheRayTracer * theDefaultTracer
G4UIcmdWithABool * distCmd
virtual void Trace(const G4String &fileName)
G4GLOB_DLL std::ostream G4cout
static G4ThreeVector GetNew3VectorValue(const char *paramString)
void SetViewSpan(G4double val)
G4UIcmdWithAString * fileCmd
static G4VisManager * GetInstance()
G4UIcmdWith3Vector * lightCmd
G4UIcmdWith3Vector * bkgColCmd
static void SetIgnoreTransparency(G4bool val)
G4UIcmdWithADoubleAndUnit * attCmd
G4TheRayTracer * theTracer
#define G4endl
Definition: G4ios.hh:61
void SetDistortion(G4bool val)
void SetEyePosition(const G4ThreeVector &val)
void SetAttenuationLength(G4double val)
void SetTargetPosition(const G4ThreeVector &val)
Here is the call graph for this function:

Member Data Documentation

◆ attCmd

G4UIcmdWithADoubleAndUnit* G4RTMessenger::attCmd
private

Definition at line 75 of file G4RTMessenger.hh.

◆ bkgColCmd

G4UIcmdWith3Vector* G4RTMessenger::bkgColCmd
private

Definition at line 79 of file G4RTMessenger.hh.

◆ columnCmd

G4UIcmdWithAnInteger* G4RTMessenger::columnCmd
private

Definition at line 68 of file G4RTMessenger.hh.

◆ distCmd

G4UIcmdWithABool* G4RTMessenger::distCmd
private

Definition at line 76 of file G4RTMessenger.hh.

◆ eyePosCmd

G4UIcmdWith3VectorAndUnit* G4RTMessenger::eyePosCmd
private

Definition at line 71 of file G4RTMessenger.hh.

◆ fileCmd

G4UIcmdWithAString* G4RTMessenger::fileCmd
private

Definition at line 78 of file G4RTMessenger.hh.

◆ fpInstance

G4RTMessenger * G4RTMessenger::fpInstance = 0
staticprivate

Definition at line 62 of file G4RTMessenger.hh.

◆ headCmd

G4UIcmdWithADoubleAndUnit* G4RTMessenger::headCmd
private

Definition at line 74 of file G4RTMessenger.hh.

◆ lightCmd

G4UIcmdWith3Vector* G4RTMessenger::lightCmd
private

Definition at line 72 of file G4RTMessenger.hh.

◆ rayDirectory

G4UIdirectory* G4RTMessenger::rayDirectory
private

Definition at line 67 of file G4RTMessenger.hh.

◆ rowCmd

G4UIcmdWithAnInteger* G4RTMessenger::rowCmd
private

Definition at line 69 of file G4RTMessenger.hh.

◆ spanXCmd

G4UIcmdWithADoubleAndUnit* G4RTMessenger::spanXCmd
private

Definition at line 73 of file G4RTMessenger.hh.

◆ targetCmd

G4UIcmdWith3VectorAndUnit* G4RTMessenger::targetCmd
private

Definition at line 70 of file G4RTMessenger.hh.

◆ theDefaultTracer

G4TheRayTracer* G4RTMessenger::theDefaultTracer
private

Definition at line 63 of file G4RTMessenger.hh.

◆ theTracer

G4TheRayTracer* G4RTMessenger::theTracer
private

Definition at line 65 of file G4RTMessenger.hh.

◆ transCmd

G4UIcmdWithABool* G4RTMessenger::transCmd
private

Definition at line 77 of file G4RTMessenger.hh.


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