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