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