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

#include <G4RayTracerViewer.hh>

+ Inheritance diagram for G4RayTracerViewer:

Public Member Functions

 G4RayTracerViewer (G4VSceneHandler &, const G4String &name, G4TheRayTracer *=0)
 
virtual ~G4RayTracerViewer ()
 
void Initialise ()
 
void SetView ()
 
void ClearView ()
 
void DrawView ()
 
G4TheRayTracerGetTracer ()
 
- Public Member Functions inherited from G4VViewer
 G4VViewer (G4VSceneHandler &, G4int id, const G4String &name="")
 
virtual ~G4VViewer ()
 
virtual void ResetView ()
 
void RefreshView ()
 
virtual void ShowView ()
 
virtual void FinishView ()
 
std::vector< G4ThreeVectorComputeFlyThrough (G4Vector3D *)
 
SceneTreeSceneAccessSceneTreeScene ()
 
G4SceneTreeItemAccessSceneTree ()
 
void UpdateGUISceneTree ()
 
const G4StringGetName () const
 
const G4StringGetShortName () const
 
void SetName (const G4String &)
 
G4int GetViewId () const
 
G4VSceneHandlerGetSceneHandler () const
 
const G4ViewParametersGetViewParameters () const
 
const G4ViewParametersGetDefaultViewParameters () const
 
G4double GetKernelVisitElapsedTimeSeconds () const
 
virtual const std::vector< G4ModelingParameters::VisAttributesModifier > * GetPrivateVisAttributesModifiers () const
 
void SetViewParameters (const G4ViewParameters &vp)
 
void SetDefaultViewParameters (const G4ViewParameters &vp)
 
const G4VisAttributesGetApplicableVisAttributes (const G4VisAttributes *) const
 
void SetNeedKernelVisit (G4bool need)
 
void NeedKernelVisit ()
 
void ProcessView ()
 

Protected Attributes

G4int fFileCount
 
G4TheRayTracertheTracer
 
- Protected Attributes inherited from G4VViewer
G4VSceneHandlerfSceneHandler
 
G4int fViewId
 
G4String fName
 
G4String fShortName
 
G4ViewParameters fVP
 
G4ViewParameters fDefaultVP
 
G4double fKernelVisitElapsedTimeSeconds = 999.
 
SceneTreeScene fSceneTreeScene
 
G4SceneTreeItem fSceneTree
 
G4bool fNeedKernelVisit
 

Additional Inherited Members

- Protected Member Functions inherited from G4VViewer
void SetTouchable (const std::vector< G4PhysicalVolumeModel::G4PhysicalVolumeNodeID > &fullPath)
 
void TouchableSetVisibility (const std::vector< G4PhysicalVolumeModel::G4PhysicalVolumeNodeID > &fullPath, G4bool visibility)
 
void TouchableSetColour (const std::vector< G4PhysicalVolumeModel::G4PhysicalVolumeNodeID > &fullPath, const G4Colour &)
 

Detailed Description

Definition at line 37 of file G4RayTracerViewer.hh.

Constructor & Destructor Documentation

◆ G4RayTracerViewer()

G4RayTracerViewer::G4RayTracerViewer ( G4VSceneHandler & sceneHandler,
const G4String & name,
G4TheRayTracer * aTracer = 0 )

Definition at line 49 of file G4RayTracerViewer.cc.

53: G4VViewer(sceneHandler, sceneHandler.IncrementViewCount(), name)
54, fFileCount(0)
55#ifdef G4MULTITHREADED
56#include "G4TheMTRayTracer.hh"
58#else
59, theTracer(aTracer? aTracer: new G4TheRayTracer(new G4RTJpegMaker, new G4RTSimpleScanner))
60#endif
61{
62 if (!theTracer) {
63 G4warn << "G4RayTracerViewer::Initialise: No tracer" << G4endl;
64 fViewId = -1; // This flags an error.
65 return;
66 }
67}
#define G4warn
Definition G4Scene.cc:41
#define G4endl
Definition G4ios.hh:67
G4TheRayTracer * theTracer
static G4TheMTRayTracer * Instance()
G4int IncrementViewCount()
G4int fViewId
Definition G4VViewer.hh:254
G4VViewer(G4VSceneHandler &, G4int id, const G4String &name="")
Definition G4VViewer.cc:49

◆ ~G4RayTracerViewer()

G4RayTracerViewer::~G4RayTracerViewer ( )
virtual

Definition at line 69 of file G4RayTracerViewer.cc.

69{}

Member Function Documentation

◆ ClearView()

void G4RayTracerViewer::ClearView ( void )
virtual

Implements G4VViewer.

Definition at line 107 of file G4RayTracerViewer.cc.

107{}

◆ DrawView()

void G4RayTracerViewer::DrawView ( )
virtual

Implements G4VViewer.

Definition at line 109 of file G4RayTracerViewer.cc.

110{
111 // Trap recursive call
112 static G4bool called = false;
113 if (called) return;
114 called = true;
115
116 if (fVP.GetFieldHalfAngle() == 0.) { // Orthogonal (parallel) projection.
117 G4double fieldHalfAngle = perMillion;
118 fVP.SetFieldHalfAngle(fieldHalfAngle);
119 G4warn <<
120 "WARNING: G4RayTracerViewer::DrawView: true orthogonal projection"
121 "\n not yet implemented. Doing a \"long shot\", i.e., a perspective"
122 "\n projection with a half field angle of "
123 << fieldHalfAngle <<
124 " radians."
125 << G4endl;
126 SetView(); // With this fieldHalfAngle
127 ProcessView();
129 }
130 else {
131 ProcessView();
132 }
133 std::ostringstream filename;
134 filename << "g4RayTracer." << fShortName << '_'
135 << std::setw(4) << std::setfill('0') << fFileCount++ << ".jpeg";
136 theTracer->Trace(filename.str());
137
138 // Reset call flag
139 called = false;
140}
double G4double
Definition G4Types.hh:83
bool G4bool
Definition G4Types.hh:86
virtual void Trace(const G4String &fileName)
void ProcessView()
Definition G4VViewer.cc:108
G4String fShortName
Definition G4VViewer.hh:256
G4ViewParameters fVP
Definition G4VViewer.hh:257
void SetFieldHalfAngle(G4double fieldHalfAngle)
G4double GetFieldHalfAngle() const

◆ GetTracer()

G4TheRayTracer * G4RayTracerViewer::GetTracer ( )
inline

Definition at line 47 of file G4RayTracerViewer.hh.

47{return theTracer;}

Referenced by G4RTMessenger::SetNewValue().

◆ Initialise()

void G4RayTracerViewer::Initialise ( )
virtual

Reimplemented from G4VViewer.

Reimplemented in G4RayTracerXViewer.

Definition at line 71 of file G4RayTracerViewer.cc.

72{
75}
void SetNRow(G4int val)
void SetNColumn(G4int val)
unsigned int GetWindowSizeHintX() const
unsigned int GetWindowSizeHintY() const

Referenced by G4RayTracerXViewer::Initialise().

◆ SetView()

void G4RayTracerViewer::SetView ( )
virtual

Implements G4VViewer.

Definition at line 77 of file G4RayTracerViewer.cc.

78{
79 // Get radius of scene, etc. (See G4OpenGLViewer::SetView().)
80 // Note that this procedure properly takes into account zoom, dolly and pan.
81 const G4Point3D& targetPoint
84 G4double radius = // See G4ViewParameters for following procedure.
86 if(radius<=0.) radius = 1.;
87 const G4double cameraDistance = fVP.GetCameraDistance(radius);
88 const G4Point3D cameraPosition =
89 targetPoint + cameraDistance * fVP.GetViewpointDirection().unit();
90 const G4double nearDistance = fVP.GetNearDistance(cameraDistance,radius);
91 const G4double frontHalfHeight = fVP.GetFrontHalfHeight(nearDistance,radius);
92 const G4double frontHalfAngle = std::atan(frontHalfHeight / nearDistance);
93
94 // Calculate and set ray tracer parameters.
95 theTracer->
96 SetViewSpan(200. * frontHalfAngle / theTracer->GetNColumn());
97 theTracer->SetTargetPosition(targetPoint);
98 theTracer->SetEyePosition(cameraPosition);
100 const G4Vector3D
101 actualLightpointDirection(-fVP.GetActualLightpointDirection());
102 theTracer->SetLightDirection(actualLightpointDirection);
104}
const G4VisExtent & GetExtent() const
const G4Point3D & GetStandardTargetPoint() const
void SetTargetPosition(const G4ThreeVector &val)
void SetUpVector(const G4ThreeVector &val)
G4int GetNColumn() const
void SetLightDirection(const G4ThreeVector &val)
void SetBackgroundColour(const G4Colour &val)
void SetEyePosition(const G4ThreeVector &val)
G4Scene * GetScene() const
G4VSceneHandler & fSceneHandler
Definition G4VViewer.hh:253
G4double GetCameraDistance(G4double radius) const
G4Vector3D & GetActualLightpointDirection()
const G4Colour & GetBackgroundColour() const
const G4Vector3D & GetViewpointDirection() const
const G4Point3D & GetCurrentTargetPoint() const
G4double GetFrontHalfHeight(G4double nearDistance, G4double radius) const
const G4Vector3D & GetUpVector() const
G4double GetNearDistance(G4double cameraDistance, G4double radius) const
G4double GetExtentRadius() const
BasicVector3D< T > unit() const

Referenced by DrawView().

Member Data Documentation

◆ fFileCount

G4int G4RayTracerViewer::fFileCount
protected

Definition at line 49 of file G4RayTracerViewer.hh.

Referenced by DrawView().

◆ theTracer

G4TheRayTracer* G4RayTracerViewer::theTracer
protected

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