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 // class G4MultiNavigator 27 // 28 // Class description: 29 // 30 // Utility class for polling the navigators of 31 // identify the next boundary. 32 33 // History: 34 // - Created. John Apostolakis, November 2006 35 // ------------------------------------------- 36 #ifndef G4MULTINAVIGATOR_HH 37 #define G4MULTINAVIGATOR_HH 38 39 #include <iostream> 40 41 #include "geomdefs.hh" 42 #include "G4ThreeVector.hh" 43 #include "G4Navigator.hh" 44 45 #include "G4TouchableHandle.hh" 46 47 #include "G4NavigationHistory.hh" 48 49 enum ELimited { kDoNot,kUnique,kSharedTranspo 50 51 class G4TransportationManager; 52 class G4VPhysicalVolume; 53 54 class G4MultiNavigator : public G4Navigator 55 { 56 public: // with description 57 58 friend std::ostream& operator << (std::ostre 59 60 G4MultiNavigator(); 61 // Constructor - initialisers and setup. 62 63 ~G4MultiNavigator() override; 64 // Destructor. No actions. 65 66 G4double ComputeStep( const G4ThreeVector& p 67 const G4ThreeVector& p 68 const G4double p 69 G4double& p 70 // Return the distance to the next boundar 71 72 G4double ObtainFinalStep( G4int navig 73 G4double& pNewS 74 G4double& minSt 75 ELimited& limit 76 // Get values for a single geometry 77 78 void PrepareNavigators(); 79 // Find which geometries are registered fo 80 void PrepareNewTrack( const G4ThreeVector& p 81 const G4ThreeVector di 82 // Prepare Navigators and locate 83 84 G4VPhysicalVolume* ResetHierarchyAndLocate( 85 const G4Thr 86 const G4Tou 87 // Reset the geometrical hierarchy for all 88 // Use the touchable history for the first 89 // Return the volume in the first (mass) g 90 // 91 // Important Note: In order to call this t 92 93 G4VPhysicalVolume* LocateGlobalPointAndSetup 94 const G4Thr 95 const G4boo 96 const G4boo 97 // Locate in all geometries. 98 // Return the volume in the first (mass) g 99 // Maintain vector of other volumes, to 100 // 101 // Important Note: In order to call this t 102 103 void LocateGlobalPointWithinVolume( const G4 104 // Relocate in all geometries for point th 105 // (ie is within safety in all geometries 106 // along the direction of a computed step. 107 108 G4double ComputeSafety( const G4ThreeVector& 109 const G4double pProp 110 const G4bool keepSta 111 // Calculate the isotropic distance to the 112 // in any geometry from the specified poin 113 // system. The geometry must be closed. 114 115 G4TouchableHandle CreateTouchableHistoryHand 116 // Returns a reference counted handle to a 117 118 G4ThreeVector GetLocalExitNormal( G4bool* ob 119 G4ThreeVector GetLocalExitNormalAndCheck( co 120 G4 121 G4ThreeVector GetGlobalExitNormal( const G4T 122 G4b 123 // Return Exit Surface Normal and validity 124 // Can only be called if the Navigator's l 125 // - has just crossed a volume geometrica 126 // - has arrived at a boundary in a Compu 127 // It returns the Normal to the surface po 128 // was left behind and/or into the volum 129 // Convention:x 130 // The *local* normal is in the coordina 131 // Restriction: 132 // Normals are not available for replica 133 134 public: // without description 135 136 inline G4Navigator* GetNavigator( G4int n ) 137 { 138 if( (n>fNoActiveNavigators) || (n<0) ) { n 139 return fpNavigator[n]; 140 } 141 142 protected: // with description 143 144 void ResetState() override; 145 // Utility method to reset the navigator s 146 147 void SetupHierarchy() override; 148 // Renavigate & reset hierarchy described 149 // o Reset volumes 150 // o Recompute transforms and/or solids of 151 // volumes. 152 153 void WhichLimited(); // Flag which processes 154 void PrintLimited(); // Auxiliary, debugging 155 void CheckMassWorld(); 156 157 private: 158 159 // STATE Information 160 161 G4int fNoActiveNavigators = 0; 162 static const G4int fMaxNav = 16; 163 G4VPhysicalVolume* fLastMassWorld = nullptr 164 165 G4Navigator* fpNavigator[fMaxNav]; 166 // Global state (retained during stepping 167 168 // State after a step computation 169 // 170 ELimited fLimitedStep[fMaxNav]; 171 G4bool fLimitTruth[fMaxNav]; 172 G4double fCurrentStepSize[fMaxNav]; 173 G4double fNewSafety[ fMaxNav ]; // Saf 174 G4int fNoLimitingStep = -1; // How 175 G4int fIdNavLimiting = -1; // Id 176 177 // Lowest values - determine step length, a 178 // 179 G4double fMinStep = -kInfinity; // As 180 G4double fMinSafety = -kInfinity; 181 G4double fTrueMinStep = -kInfinity; // 182 183 // State after calling 'locate' 184 // 185 G4VPhysicalVolume* fLocatedVolume[fMaxNav]; 186 G4ThreeVector fLastLocatedPosition; 187 188 // Cache of safety information 189 // 190 G4ThreeVector fSafetyLocation; 191 // point where ComputeSafety is called 192 G4double fMinSafety_atSafLocation = -1 193 // - corresponding value of safety 194 G4ThreeVector fPreStepLocation; 195 // point where last ComputeStep called 196 G4double fMinSafety_PreStepPt = -1.0; 197 // - corresponding value of safety 198 199 G4TransportationManager* pTransportManager; 200 }; 201 202 #endif 203