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 // G4FastTrack.hh 31 // 32 // Description: 33 // Keeps the current track information and 34 // for Parameterised Simulation Models. 35 // 36 // History: 37 // Oct 97: Verderi && MoraDeFreitas - First 38 // 39 //-------------------------------------------- 40 41 #ifndef G4FastTrack_h 42 #define G4FastTrack_h 43 44 #include "G4AffineTransform.hh" 45 #include "G4LogicalVolume.hh" 46 #include "G4Navigator.hh" 47 #include "G4Region.hh" 48 #include "G4Track.hh" 49 #include "G4VSolid.hh" 50 51 //--------------------------- 52 // For possible future needs: 53 //--------------------------- 54 using G4Envelope = G4Region; 55 56 //------------------------------------------- 57 // 58 // G4FastTrack class 59 // 60 //------------------------------------------- 61 62 // Class Description: 63 // The G4FastTrack provides you access to the 64 // gives simple access to envelope related fea 65 // G4LogicalVolume, G4VSolid, G4AffineTransfor 66 // the global and the envelope local coordinat 67 // simple access to the position, momentum exp 68 // envelope coordinate system. Using those qua 69 // G4VSolid methods, you can for example easil 70 // are from the envelope boundary. 71 // 72 73 class G4FastTrack 74 { 75 public: // without description 76 //------------------------ 77 // Constructor/Destructor 78 //------------------------ 79 // Only one Constructor. By default the en 80 // be placed n-Times. If the user is sure 81 // placed just one time, the IsUnique flag 82 // TRUE to avoid the G4AffineTransform re- 83 // time we reach the envelope. 84 G4FastTrack(G4Envelope* anEnvelope, G4bool 85 ~G4FastTrack() = default; 86 87 //---------------------------------------- 88 // The fast simulation manager uses the Se 89 // method to setup the current G4FastTrack 90 //---------------------------------------- 91 void SetCurrentTrack(const G4Track&, const 92 93 //---------------------------------------- 94 // The fast simulation manager uses the On 95 // method to test if the particle is leavi 96 //---------------------------------------- 97 G4bool OnTheBoundaryButExiting() const; 98 99 //---------------------------------- 100 // Informations useful to the user : 101 // General public get functions. 102 //---------------------------------- 103 104 // Returns the current G4Track. 105 const G4Track* GetPrimaryTrack() const; 106 107 // Returns the Envelope G4Region pointer. 108 G4Envelope* GetEnvelope() const; 109 110 // Returns the Envelope G4LogicalVolume po 111 G4LogicalVolume* GetEnvelopeLogicalVolume( 112 113 // Returns the Envelope G4VPhysicalVolume 114 G4VPhysicalVolume* GetEnvelopePhysicalVolu 115 116 // Returns the Envelope G4VSolid pointer. 117 G4VSolid* GetEnvelopeSolid() const; 118 119 //----------------------------------- 120 // Primary track informations in the 121 // Envelope coordinate system. 122 //----------------------------------- 123 124 // Returns the particle position in envelo 125 G4ThreeVector GetPrimaryTrackLocalPosition 126 127 // Returns the particle momentum in envelo 128 G4ThreeVector GetPrimaryTrackLocalMomentum 129 130 // Returns the particle direction in envel 131 G4ThreeVector GetPrimaryTrackLocalDirectio 132 133 // Returns the particle polarization in en 134 G4ThreeVector GetPrimaryTrackLocalPolariza 135 136 //------------------------------------ 137 // 3D transformation of the envelope: 138 //------------------------------------ 139 140 // Returns the envelope Global -> Local G4 141 const G4AffineTransform* GetAffineTransfor 142 143 // Returns the envelope Local -> Global G4 144 const G4AffineTransform* GetInverseAffineT 145 146 private: 147 //----------------- 148 // Private members 149 //----------------- 150 // Current G4Track pointer 151 const G4Track* fTrack{nullptr}; 152 153 //---------------------------------------- 154 // Records the Affine/InverseAffine transf 155 // of the envelope. 156 //---------------------------------------- 157 void FRecordsAffineTransformation(const G4 158 G4bool fAffineTransformationDefined{false} 159 G4Envelope* fEnvelope; 160 G4bool fIsUnique; 161 G4LogicalVolume* fEnvelopeLogicalVolume{nu 162 G4VPhysicalVolume* fEnvelopePhysicalVolume 163 G4VSolid* fEnvelopeSolid{nullptr}; 164 G4ThreeVector fLocalTrackPosition, fLocalT 165 fLocalTrackPolarization; 166 G4AffineTransform fAffineTransformation, f 167 }; 168 169 // ----------------- 170 // -- Inline methods 171 // ----------------- 172 173 inline G4Envelope* G4FastTrack::GetEnvelope() 174 { 175 return fEnvelope; 176 } 177 178 inline G4LogicalVolume* G4FastTrack::GetEnvelo 179 { 180 return fEnvelopeLogicalVolume; 181 } 182 183 inline G4VPhysicalVolume* G4FastTrack::GetEnve 184 { 185 return fEnvelopePhysicalVolume; 186 } 187 188 inline G4VSolid* G4FastTrack::GetEnvelopeSolid 189 { 190 return fEnvelopeSolid; 191 } 192 193 inline const G4Track* G4FastTrack::GetPrimaryT 194 { 195 return fTrack; 196 } 197 198 inline G4ThreeVector G4FastTrack::GetPrimaryTr 199 { 200 return fLocalTrackPosition; 201 } 202 203 inline G4ThreeVector G4FastTrack::GetPrimaryTr 204 { 205 return fLocalTrackMomentum; 206 } 207 208 inline G4ThreeVector G4FastTrack::GetPrimaryTr 209 { 210 return fLocalTrackDirection; 211 } 212 213 inline G4ThreeVector G4FastTrack::GetPrimaryTr 214 { 215 return fLocalTrackPolarization; 216 } 217 218 inline const G4AffineTransform* G4FastTrack::G 219 { 220 return &fAffineTransformation; 221 } 222 223 inline const G4AffineTransform* G4FastTrack::G 224 { 225 return &fInverseAffineTransformation; 226 } 227 228 inline G4bool G4FastTrack::OnTheBoundaryButExi 229 { 230 // tests if particle are on the boundary and 231 return GetEnvelopeSolid()->DistanceToOut(Get 232 Get 233 == 0.; 234 } 235 236 #endif 237