Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
G4TheRayTracer.hh
이 파일의 문서화 페이지로 가기
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 //
27 // $Id: G4TheRayTracer.hh 77479 2013-11-25 10:01:22Z gcosmo $
28 //
29 //
30 
31 
32 #ifndef G4TheRayTracer_H
33 #define G4TheRayTracer_H 1
34 
35 // class description:
36 //
37 // G4TheRayTracer
38 // This is a graphics driver of Geant4 which generates a figure file by
39 // ray tracing technique. The format of output figure file can be selected
40 // by assigning a pointer of G4VFigureFileMaker concrete class object.
41 // The main entry of ray tracing is Trace() method, which is available
42 // only at Idle state. G4TheRayTracer shoots rays and controls its own event
43 // loop. It generates G4Event objects used for its own purpose. When ray
44 // tracing is working, all sensitive detectors are inactivated and all
45 // user action classes are swapped out. Still, verbosities set to Geant4
46 // manager classes are concerned. Thus, it is recommended to set verbosities
47 // to minimum (usually zero).
48 // G4TheRayTracer can visualise absolutely all kinds of geometrical shapes
49 // which G4Navigator can deal with. Instead, it can NOT visualise hits
50 // nor trajectories generated by usual simulation.
51 
52 #include "globals.hh"
53 #include "G4ThreeVector.hh"
54 #include "G4Colour.hh"
55 
56 class G4Event;
57 class G4EventManager;
58 class G4UserEventAction;
62 class G4RTTrackingAction;
63 class G4RTSteppingAction;
64 class G4RTMessenger;
65 class G4RayShooter;
66 class G4VFigureFileMaker;
68 class G4VisAttributes;
69 class G4VRTScanner;
70 
71 
73 {
74  public: // with description
75  G4TheRayTracer(G4VFigureFileMaker* figMaker = 0,
76  G4VRTScanner* scanner = 0);
77  // Constructor. The argument is the pointer to G4VFigureFileMaker
78  // concrete class object. If it is not set and
79  // SetFigureFileMaker() method is not invoked before Trace()
80  // command is invoked, then G4RTJpegMaker will be used and JPEG
81  // file will be generated. The second argument is a scanner that
82  // produces a sequence of window coordinates. If it is not set
83  // here or if SetScanner is not invoked before Trace(), a default
84  // G4RTSimpleScanner will be used.
85 
86  public:
87  virtual ~G4TheRayTracer();
88 
89  public: // with description
90  virtual void Trace(const G4String& fileName);
91  // The main entry point which triggers ray tracing. "fileName" is output
92  // file name, and it must contain extention (e.g. myFigure.jpg). This
93  // method is available only if Geant4 is at Idle state.
94 
95  protected:
96  virtual G4bool CreateBitMap();
97  // Event loop
98  void CreateFigureFile(const G4String& fileName);
99  // Create figure file after an event loop
100  G4bool GenerateColour(G4Event* anEvent);
101  // Calcurate RGB for one trajectory
102  virtual void StoreUserActions();
103  virtual void RestoreUserActions();
104  // Store and restore user action classes if defined
105 
108  (const G4Colour& surfCol,const G4Colour& transCol,G4double weight=0.5);
109  G4Colour Attenuate(G4RayTrajectoryPoint* point,const G4Colour& sourceCol);
110  G4bool ValidColour(const G4VisAttributes* visAtt);
111 
112  public: // with description
113  inline void SetFigureFileMaker(G4VFigureFileMaker* figMaker)
114  // Set a concrete class of G4VFigureFileMaker for assigning the format of
115  // output figure file.
116  { theFigMaker = figMaker; }
118  inline void SetScanner(G4VRTScanner* scanner)
119  // Set a concrete class of G4VRTScanner for producing a sequence
120  // of window coordinates.
121  { theScanner = scanner; }
122  inline G4VRTScanner* GetScanner() {return theScanner;}
123 
124  protected:
129 
131 
136 
141 
142  unsigned char* colorR;
143  unsigned char* colorG;
144  unsigned char* colorB;
145 
148 
155  G4double viewSpan; // Angle per 100 pixels
157 
160 
163 
164  public:
165  inline void SetNColumn(G4int val) { nColumn = val; }
166  inline G4int GetNColumn() const { return nColumn; }
167  inline void SetNRow(G4int val) { nRow = val; }
168  inline G4int GetNRow() const { return nRow; }
169  inline void SetEyePosition(const G4ThreeVector& val) { eyePosition = val; }
170  inline G4ThreeVector GetEyePosition() const { return eyePosition; }
171  inline void SetTargetPosition(const G4ThreeVector& val) { targetPosition = val; }
172  inline G4ThreeVector GetTargetPosition() const { return targetPosition; }
173  inline void SetLightDirection(const G4ThreeVector& val) { lightDirection = val.unit(); }
174  inline G4ThreeVector GetLightDirection() const { return lightDirection; }
175  inline void SetUpVector(const G4ThreeVector& val) { up = val; }
176  inline G4ThreeVector GetUpVector() const { return up; }
177  inline void SetHeadAngle(G4double val) { headAngle = val; }
178  inline G4double GetHeadAngle() const { return headAngle; }
179  inline void SetViewSpan(G4double val) { viewSpan = val; }
180  inline G4double GetViewSpan() const { return viewSpan; }
181  inline void SetAttenuationLength(G4double val) { attenuationLength = val; }
183  inline void SetDistortion(G4bool val) { distortionOn = val; }
184  inline G4bool GetDistortion() const { return distortionOn; }
185  inline void SetBackgroundColour(const G4Colour& val) { backgroundColour = val; }
186  inline G4Colour GetBackgroundColour() const { return backgroundColour; }
187 };
188 
189 #endif
G4bool ValidColour(const G4VisAttributes *visAtt)
G4RTSteppingAction * theRayTracerSteppingAction
void SetViewSpan(G4double val)
G4ThreeVector targetPosition
G4ThreeVector eyePosition
G4ThreeVector lightDirection
virtual G4bool CreateBitMap()
G4bool GetDistortion() const
G4Colour GetBackgroundColour() const
void SetTargetPosition(const G4ThreeVector &val)
G4UserStackingAction * theRayTracerStackingAction
void SetEyePosition(const G4ThreeVector &val)
virtual void RestoreUserActions()
G4VFigureFileMaker * theFigMaker
G4Colour GetMixedColour(const G4Colour &surfCol, const G4Colour &transCol, G4double weight=0.5)
G4bool GenerateColour(G4Event *anEvent)
void CreateFigureFile(const G4String &fileName)
G4int GetNColumn() const
void SetAttenuationLength(G4double val)
G4UserSteppingAction * theUserSteppingAction
void SetHeadAngle(G4double val)
G4ThreeVector GetEyePosition() const
virtual void StoreUserActions()
unsigned char * colorG
virtual ~G4TheRayTracer()
G4ThreeVector GetLightDirection() const
unsigned char * colorB
double G4double
Definition: G4Types.hh:76
bool G4bool
Definition: G4Types.hh:79
G4ThreeVector GetTargetPosition() const
virtual void Trace(const G4String &fileName)
G4UserEventAction * theRayTracerEventAction
void SetFigureFileMaker(G4VFigureFileMaker *figMaker)
G4VRTScanner * theScanner
G4Colour backgroundColour
G4double GetViewSpan() const
G4ThreeVector up
void SetBackgroundColour(const G4Colour &val)
G4Colour GetSurfaceColour(G4RayTrajectoryPoint *point)
G4RayShooter * theRayShooter
G4double GetAttenuationLength() const
unsigned char * colorR
G4ThreeVector eyeDirection
G4double attenuationLength
void SetNColumn(G4int val)
void SetDistortion(G4bool val)
Hep3Vector unit() const
G4RTMessenger * theMessenger
G4ThreeVector GetUpVector() const
G4EventManager * theEventManager
G4double GetHeadAngle() const
G4RTTrackingAction * theRayTracerTrackingAction
G4UserTrackingAction * theUserTrackingAction
double weight
Definition: plottest35.C:25
int G4int
Definition: G4Types.hh:78
void SetScanner(G4VRTScanner *scanner)
void SetLightDirection(const G4ThreeVector &val)
G4VFigureFileMaker * GetFigureFileMaker()
G4int GetNRow() const
void SetNRow(G4int val)
G4Colour Attenuate(G4RayTrajectoryPoint *point, const G4Colour &sourceCol)
G4TheRayTracer(G4VFigureFileMaker *figMaker=0, G4VRTScanner *scanner=0)
void SetUpVector(const G4ThreeVector &val)
G4UserStackingAction * theUserStackingAction
G4VRTScanner * GetScanner()
G4UserEventAction * theUserEventAction