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10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /visualization/RayTracer/include/private/G4TheRayTracer.hh (Version 11.3.0) and /visualization/RayTracer/include/private/G4TheRayTracer.hh (Version 11.2.2)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                         3 // * License and Disclaimer                                           *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th      5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided      6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License      7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/      8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.           9 // * include a list of copyright holders.                             *
 10 // *                                               10 // *                                                                  *
 11 // * Neither the authors of this software syst     11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file      15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitatio     16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                               17 // *                                                                  *
 18 // * This  code  implementation is the result      18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboratio     19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distri     20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  ag     21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publicati     22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Sof     23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // *******************************************     24 // ********************************************************************
 25 //                                                 25 //
 26 //                                                 26 //
 27 //                                                 27 //
 28 //                                                 28 //
 29                                                    29 
 30                                                    30 
 31 #ifndef G4TheRayTracer_H                           31 #ifndef G4TheRayTracer_H
 32 #define G4TheRayTracer_H 1                         32 #define G4TheRayTracer_H 1
 33                                                    33 
 34 // class description:                              34 // class description:
 35 //                                                 35 //
 36 // G4TheRayTracer                                  36 // G4TheRayTracer
 37 //   This is a graphics driver of Geant4 which     37 //   This is a graphics driver of Geant4 which generates a figure file by
 38 // ray tracing technique. The format of output     38 // ray tracing technique. The format of output figure file can be selected
 39 // by assigning a pointer of G4VFigureFileMake     39 // by assigning a pointer of G4VFigureFileMaker concrete class object.
 40 //   The main entry of ray tracing is Trace()      40 //   The main entry of ray tracing is Trace() method, which is available
 41 // only at Idle state. G4TheRayTracer shoots r     41 // only at Idle state. G4TheRayTracer shoots rays and controls its own event
 42 // loop. It generates G4Event objects used for     42 // loop. It generates G4Event objects used for its own purpose. When ray
 43 // tracing is working, all sensitive detectors     43 // tracing is working, all sensitive detectors are inactivated and all
 44 // user action classes are swapped out. Still,     44 // user action classes are swapped out. Still, verbosities set to Geant4
 45 // manager classes are concerned. Thus, it is      45 // manager classes are concerned. Thus, it is recommended to set verbosities
 46 // to minimum (usually zero).                      46 // to minimum (usually zero).
 47 //   G4TheRayTracer can visualise absolutely a     47 //   G4TheRayTracer can visualise absolutely all kinds of geometrical shapes
 48 // which G4Navigator can deal with. Instead, i     48 // which G4Navigator can deal with. Instead, it can NOT visualise hits
 49 // nor trajectories generated by usual simulat     49 // nor trajectories generated by usual simulation.
 50                                                    50 
 51 #include "globals.hh"                              51 #include "globals.hh"
 52 #include "G4ThreeVector.hh"                        52 #include "G4ThreeVector.hh"
 53 #include "G4Colour.hh"                             53 #include "G4Colour.hh"
 54                                                    54 
 55 class G4Event;                                     55 class G4Event;
 56 class G4EventManager;                              56 class G4EventManager;
 57 class G4UserEventAction;                           57 class G4UserEventAction;
 58 class G4UserStackingAction;                        58 class G4UserStackingAction;
 59 class G4UserTrackingAction;                        59 class G4UserTrackingAction;
 60 class G4UserSteppingAction;                        60 class G4UserSteppingAction;
 61 class G4RTTrackingAction;                          61 class G4RTTrackingAction;
 62 class G4RTSteppingAction;                          62 class G4RTSteppingAction;
 63 class G4RTMessenger;                               63 class G4RTMessenger;
 64 class G4RayShooter;                                64 class G4RayShooter;
 65 class G4VFigureFileMaker;                          65 class G4VFigureFileMaker;
 66 class G4RayTrajectoryPoint;                        66 class G4RayTrajectoryPoint;
 67 class G4VisAttributes;                             67 class G4VisAttributes;
 68 class G4VRTScanner;                                68 class G4VRTScanner;
 69                                                    69 
 70                                                    70 
 71 class G4TheRayTracer                               71 class G4TheRayTracer
 72 {                                                  72 {
 73   public: // with description                      73   public: // with description
 74     G4TheRayTracer(G4VFigureFileMaker* figMake     74     G4TheRayTracer(G4VFigureFileMaker* figMaker = 0,
 75        G4VRTScanner* scanner = 0);                 75        G4VRTScanner* scanner = 0);
 76     // Constructor. The argument is the pointe     76     // Constructor. The argument is the pointer to G4VFigureFileMaker
 77     // concrete class object. If it is not set     77     // concrete class object. If it is not set and
 78     // SetFigureFileMaker() method is not invo     78     // SetFigureFileMaker() method is not invoked before Trace()
 79     // command is invoked, then G4RTJpegMaker      79     // command is invoked, then G4RTJpegMaker will be used and JPEG
 80     // file will be generated.  The second arg     80     // file will be generated.  The second argument is a scanner that
 81     // produces a sequence of window coordinat     81     // produces a sequence of window coordinates.  If it is not set
 82     // here or if SetScanner is not invoked be     82     // here or if SetScanner is not invoked before Trace(), a default
 83     // G4RTSimpleScanner will be used.             83     // G4RTSimpleScanner will be used.
 84                                                    84 
 85   public:                                          85   public:
 86     virtual ~G4TheRayTracer();                     86     virtual ~G4TheRayTracer();
 87                                                    87 
 88   public: // with description                      88   public: // with description
 89     virtual void Trace(const G4String& fileNam     89     virtual void Trace(const G4String& fileName);
 90     // The main entry point which triggers ray     90     // The main entry point which triggers ray tracing. "fileName" is output
 91     // file name, and it must contain extentio     91     // file name, and it must contain extention (e.g. myFigure.jpg). This
 92     // method is available only if Geant4 is a     92     // method is available only if Geant4 is at Idle state.
 93                                                    93 
 94   protected:                                       94   protected:
 95     virtual G4bool CreateBitMap();                 95     virtual G4bool CreateBitMap();
 96     // Event loop                                  96     // Event loop
 97     void CreateFigureFile(const G4String& file     97     void CreateFigureFile(const G4String& fileName);
 98     // Create figure file after an event loop      98     // Create figure file after an event loop
 99     G4bool GenerateColour(G4Event* anEvent);       99     G4bool GenerateColour(G4Event* anEvent);
100     // Calcurate RGB for one trajectory           100     // Calcurate RGB for one trajectory
101     virtual void StoreUserActions();              101     virtual void StoreUserActions();
102     virtual void RestoreUserActions();            102     virtual void RestoreUserActions();
103     // Store and restore user action classes i    103     // Store and restore user action classes if defined
104                                                   104 
105     G4Colour GetSurfaceColour(G4RayTrajectoryP    105     G4Colour GetSurfaceColour(G4RayTrajectoryPoint* point);
106     G4Colour GetMixedColour                       106     G4Colour GetMixedColour
107     (const G4Colour& surfCol,const G4Colour& t    107     (const G4Colour& surfCol,const G4Colour& transCol,G4double weight=0.5);
108     G4Colour Attenuate(G4RayTrajectoryPoint* p    108     G4Colour Attenuate(G4RayTrajectoryPoint* point,const G4Colour& sourceCol);
109     G4bool ValidColour(const G4VisAttributes*     109     G4bool ValidColour(const G4VisAttributes* visAtt);
110                                                   110 
111   public: // with description                     111   public: // with description
112     inline void SetFigureFileMaker(G4VFigureFi    112     inline void SetFigureFileMaker(G4VFigureFileMaker* figMaker)
113     // Set a concrete class of G4VFigureFileMa    113     // Set a concrete class of G4VFigureFileMaker for assigning the format of
114     // output figure file.                        114     // output figure file.
115     { theFigMaker = figMaker; }                   115     { theFigMaker = figMaker; }
116     inline G4VFigureFileMaker* GetFigureFileMa    116     inline G4VFigureFileMaker* GetFigureFileMaker() {return theFigMaker;}
117     inline void SetScanner(G4VRTScanner* scann    117     inline void SetScanner(G4VRTScanner* scanner)
118     // Set a concrete class of G4VRTScanner fo    118     // Set a concrete class of G4VRTScanner for producing a sequence
119     // of window coordinates.                     119     // of window coordinates.
120     { theScanner = scanner; }                     120     { theScanner = scanner; }
121     inline G4VRTScanner* GetScanner() {return     121     inline G4VRTScanner* GetScanner() {return theScanner;}
122                                                   122 
123   protected:                                      123   protected:
124     G4RayShooter * theRayShooter;                 124     G4RayShooter * theRayShooter;
125     static G4VFigureFileMaker * theFigMaker;      125     static G4VFigureFileMaker * theFigMaker;
126     G4RTMessenger * theMessenger;                 126     G4RTMessenger * theMessenger;
127     static G4VRTScanner * theScanner;             127     static G4VRTScanner * theScanner;
128                                                   128 
129     G4EventManager * theEventManager;             129     G4EventManager * theEventManager;
130                                                   130 
131     G4UserEventAction * theUserEventAction;       131     G4UserEventAction * theUserEventAction;
132     G4UserStackingAction * theUserStackingActi    132     G4UserStackingAction * theUserStackingAction;
133     G4UserTrackingAction * theUserTrackingActi    133     G4UserTrackingAction * theUserTrackingAction;
134     G4UserSteppingAction * theUserSteppingActi    134     G4UserSteppingAction * theUserSteppingAction;
135                                                   135 
136     G4UserEventAction * theRayTracerEventActio    136     G4UserEventAction * theRayTracerEventAction;
137     G4UserStackingAction * theRayTracerStackin    137     G4UserStackingAction * theRayTracerStackingAction;
138     G4RTTrackingAction * theRayTracerTrackingA    138     G4RTTrackingAction * theRayTracerTrackingAction;
139     G4RTSteppingAction * theRayTracerSteppingA    139     G4RTSteppingAction * theRayTracerSteppingAction;
140                                                   140 
141     unsigned char* colorR;                        141     unsigned char* colorR;
142     unsigned char* colorG;                        142     unsigned char* colorG;
143     unsigned char* colorB;                        143     unsigned char* colorB;
144                                                   144 
145     G4int nColumn;                                145     G4int nColumn;
146     G4int nRow;                                   146     G4int nRow;
147                                                   147 
148     G4ThreeVector eyePosition;                    148     G4ThreeVector eyePosition;
149     G4ThreeVector targetPosition;                 149     G4ThreeVector targetPosition;
150     G4ThreeVector eyeDirection;                   150     G4ThreeVector eyeDirection;
151     G4ThreeVector lightDirection;                 151     G4ThreeVector lightDirection;
152     G4ThreeVector up;                             152     G4ThreeVector up;
153     G4double headAngle;                           153     G4double headAngle;
154     G4double viewSpan; // Angle per 100 pixels    154     G4double viewSpan; // Angle per 100 pixels
155     G4double attenuationLength;                   155     G4double attenuationLength;
156                                                   156 
157     G4bool distortionOn;                          157     G4bool distortionOn;
158     G4bool antialiasingOn;                        158     G4bool antialiasingOn;
159                                                   159 
160     G4Colour rayColour;                           160     G4Colour rayColour;
161     G4Colour backgroundColour;                    161     G4Colour backgroundColour;
162                                                   162 
163   public:                                         163   public:
164     inline void SetNColumn(G4int val) { nColum    164     inline void SetNColumn(G4int val) { nColumn = val; }
165     inline G4int GetNColumn() const { return n    165     inline G4int GetNColumn() const { return nColumn; }
166     inline void SetNRow(G4int val) { nRow = va    166     inline void SetNRow(G4int val) { nRow = val; }
167     inline G4int GetNRow() const { return nRow    167     inline G4int GetNRow() const { return nRow; }
168     inline void SetEyePosition(const G4ThreeVe    168     inline void SetEyePosition(const G4ThreeVector& val) { eyePosition = val; }
169     inline G4ThreeVector GetEyePosition() cons    169     inline G4ThreeVector GetEyePosition() const { return eyePosition; }
170     inline void SetTargetPosition(const G4Thre    170     inline void SetTargetPosition(const G4ThreeVector& val) { targetPosition = val; }
171     inline G4ThreeVector GetTargetPosition() c    171     inline G4ThreeVector GetTargetPosition() const { return targetPosition; }
172     inline void SetLightDirection(const G4Thre    172     inline void SetLightDirection(const G4ThreeVector& val) { lightDirection = val.unit(); }
173     inline G4ThreeVector GetLightDirection() c    173     inline G4ThreeVector GetLightDirection() const { return lightDirection; }
174     inline void SetUpVector(const G4ThreeVecto    174     inline void SetUpVector(const G4ThreeVector& val) { up = val; }
175     inline G4ThreeVector GetUpVector() const {    175     inline G4ThreeVector GetUpVector() const { return up; }
176     inline void SetHeadAngle(G4double val) { h    176     inline void SetHeadAngle(G4double val) { headAngle = val; }
177     inline G4double GetHeadAngle() const { ret    177     inline G4double GetHeadAngle() const { return headAngle; }
178     inline void SetViewSpan(G4double val) { vi    178     inline void SetViewSpan(G4double val) { viewSpan = val; }
179     inline G4double GetViewSpan() const { retu    179     inline G4double GetViewSpan() const { return viewSpan; }
180     inline void SetAttenuationLength(G4double     180     inline void SetAttenuationLength(G4double val) { attenuationLength = val; }
181     inline G4double GetAttenuationLength() con    181     inline G4double GetAttenuationLength() const { return attenuationLength; }
182     inline void SetDistortion(G4bool val) { di    182     inline void SetDistortion(G4bool val) { distortionOn = val; }
183     inline G4bool GetDistortion() const { retu    183     inline G4bool GetDistortion() const { return distortionOn; }
184     inline void SetBackgroundColour(const G4Co    184     inline void SetBackgroundColour(const G4Colour& val) { backgroundColour = val; }
185     inline G4Colour GetBackgroundColour() cons    185     inline G4Colour GetBackgroundColour() const { return backgroundColour; }
186 };                                                186 };
187                                                   187 
188 #endif                                            188 #endif
189                                                   189