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