|
|
|||
Warning, file /include/Geant4/G4SafetyCalculator.hh was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 // 0002 // ******************************************************************** 0003 // * License and Disclaimer * 0004 // * * 0005 // * The Geant4 software is copyright of the Copyright Holders of * 0006 // * the Geant4 Collaboration. It is provided under the terms and * 0007 // * conditions of the Geant4 Software License, included in the file * 0008 // * LICENSE and available at http://cern.ch/geant4/license . These * 0009 // * include a list of copyright holders. * 0010 // * * 0011 // * Neither the authors of this software system, nor their employing * 0012 // * institutes,nor the agencies providing financial support for this * 0013 // * work make any representation or warranty, express or implied, * 0014 // * regarding this software system or assume any liability for its * 0015 // * use. Please see the license in the file LICENSE and URL above * 0016 // * for the full disclaimer and the limitation of liability. * 0017 // * * 0018 // * This code implementation is the result of the scientific and * 0019 // * technical work of the GEANT4 collaboration. * 0020 // * By using, copying, modifying or distributing the software (or * 0021 // * any work based on the software) you agree to acknowledge its * 0022 // * use in resulting scientific publications, and indicate your * 0023 // * acceptance of all terms of the Geant4 Software license. * 0024 // ******************************************************************** 0025 // 0026 // G4SafetyCalculator 0027 // 0028 // Class description: 0029 // 0030 // A class that provides an estimate of the isotropic safety, the minimum 0031 // distance from a global point to the nearest boundary of the current volume 0032 // or the nearest daughter volumes. 0033 // This estimate can be an underestimate, either because a solid provides an 0034 // underestimate (for speed) or in order to avoid substantial additional 0035 // computations. 0036 // Obtains from the navigator the current transformation history. 0037 0038 // Author: John Apostolakis (CERN), February 2023 0039 // -------------------------------------------------------------------- 0040 #ifndef G4SafetyCalculator_HH 0041 #define G4SafetyCalculator_HH 1 0042 0043 #include "geomdefs.hh" 0044 0045 #include "G4ThreeVector.hh" 0046 #include "G4AffineTransform.hh" 0047 #include "G4RotationMatrix.hh" 0048 0049 #include "G4LogicalVolume.hh" // Used in inline methods 0050 #include "G4TouchableHistoryHandle.hh" 0051 0052 #include "G4NavigationHistory.hh" 0053 #include "G4NormalNavigation.hh" 0054 #include "G4VoxelNavigation.hh" 0055 #include "G4ParameterisedNavigation.hh" 0056 #include "G4ReplicaNavigation.hh" 0057 #include "G4RegularNavigation.hh" 0058 #include "G4VExternalNavigation.hh" 0059 0060 #include "G4VoxelSafety.hh" 0061 0062 #include <iostream> 0063 0064 class G4VPhysicalVolume; 0065 0066 /** 0067 * @brief G4SafetyCalculator is a class that provides an estimate of the 0068 * isotropic safety (the minimum distance from a global point to the nearest 0069 * boundary of the current volume or the nearest daughter volumes). 0070 */ 0071 0072 class G4SafetyCalculator 0073 { 0074 public: 0075 0076 /** 0077 * Constructor, initialisers and setup. 0078 */ 0079 G4SafetyCalculator( const G4Navigator& navigator, 0080 const G4NavigationHistory& navHistory ); 0081 0082 /** 0083 * Copy constructor & assignment operator not allowed. 0084 */ 0085 G4SafetyCalculator(const G4SafetyCalculator&) = delete; 0086 G4SafetyCalculator& operator=(const G4SafetyCalculator&) = delete; 0087 0088 /** 0089 * Destructor. No actions. 0090 */ 0091 ~G4SafetyCalculator() = default; 0092 0093 /** 0094 * Calculates the isotropic distance to the nearest boundary from the 0095 * specified point in the global coordinate system. 0096 * @param[in] globalPoint The point in global coordinates; it *must* be 0097 * located exactly within the current volume (it also must 0098 * *not* be in a daughter volume. 0099 * @param[in] physicalVolume Current volume. 0100 * @param[in] pProposedMaxLength The calculation will not look beyond 0101 * the proposed maximum length to avoid extra volume safety 0102 * calculations. 0103 * @param[in] verbose Flag to enable verbosity (default is false). 0104 * @returns An underestimate of the safety distance (and typically will be 0105 * if complex volumes are involved. 0106 */ 0107 G4double SafetyInCurrentVolume(const G4ThreeVector& globalpoint, 0108 G4VPhysicalVolume* physicalVolume, 0109 const G4double pProposedMaxLength = DBL_MAX, 0110 G4bool verbose = false ); 0111 0112 /** 0113 * Accessor & modifier for custom external navigation. 0114 */ 0115 G4VExternalNavigation* GetExternalNavigation() const; 0116 void SetExternalNavigation(G4VExternalNavigation* externalNav); 0117 0118 /** 0119 * Compares estimates of the safety, and reports if found difference(s). 0120 */ 0121 void CompareSafetyValues( G4double oldSafety, 0122 G4double newValue, 0123 G4VPhysicalVolume* motherPhysical, 0124 const G4ThreeVector &globalPoint, 0125 G4bool keepState, 0126 G4double maxLength, 0127 G4bool enteredVolume, 0128 G4bool exitedVolume ); 0129 0130 protected: 0131 0132 /** 0133 * Prepare state of sub-navigators by informing them of current point. 0134 * @param[in] pointLocal Point in local coordinates. 0135 * @param[in] motherPhysical Pointer to current volume where to relocate 0136 * in case an external custom navigator is used. 0137 */ 0138 void QuickLocateWithinVolume(const G4ThreeVector& pointLocal, 0139 G4VPhysicalVolume* motherPhysical); 0140 0141 /** 0142 * Computes point in local coordinates system, given a position 0143 * vector in world coordinate system. 0144 * @param[in] rGlobPoint Point in global coordinates. 0145 * @returns The point in local coordinates system. 0146 */ 0147 inline G4ThreeVector ComputeLocalPoint(const G4ThreeVector& rGlobPoint) const; 0148 0149 /** 0150 * Computes the local direction of the specified vector in the reference 0151 * system of the volume that was found by LocateGlobalPointAndSetup(). 0152 * @param[in] pVec Vector in global coordinates. 0153 * @returns The local direction of the specified vector in global 0154 * coordinates. 0155 */ 0156 inline G4ThreeVector ComputeLocalAxis(const G4ThreeVector& pVec) const; 0157 0158 /** 0159 * Characterises the daughter of logical volume. 0160 */ 0161 inline EVolume CharacteriseDaughters(const G4LogicalVolume* pLog) const; 0162 0163 /** 0164 * Gets regular structure ID of first daughter. 0165 */ 0166 inline G4int GetDaughtersRegularStructureId(const G4LogicalVolume* pLv) const; 0167 0168 private: 0169 0170 // BEGIN -- Tracking Invariants part 1 ------------------------------------ 0171 0172 /** Associated navigator. Needed for optimisation. */ 0173 const G4Navigator& fNavigator; 0174 0175 /** Associated navigator's navigation history. Transformation and history 0176 of the current path through the geometrical hierarchy. */ 0177 const G4NavigationHistory& fNavHistory; 0178 0179 // END -- Tracking Invariants part 1 ------------------------------------ 0180 0181 /** Cached tolerance. */ 0182 G4double fkCarTolerance; 0183 0184 // BEGIN State information ------------------------------------------------ 0185 0186 /** Previous safety origin. */ 0187 G4ThreeVector fPreviousSftOrigin; 0188 0189 /** Memory of last safety origin & value. Used in ComputeStep() to ensure 0190 that origin of current Step is in the same volume as the point of the 0191 last relocation. */ 0192 G4double fPreviousSafety = 0.0; 0193 0194 /** Helpers/Utility classes - their state can change. */ 0195 G4NormalNavigation fnormalNav; 0196 G4VoxelNavigation fvoxelNav; 0197 G4ParameterisedNavigation fparamNav; 0198 G4ReplicaNavigation freplicaNav; 0199 G4RegularNavigation fregularNav; 0200 G4VExternalNavigation* fpExternalNav = nullptr; 0201 G4VoxelSafety fVoxelSafety; 0202 }; 0203 0204 // Auxiliary inline methods -- copied from G4Navigator 0205 // 0206 #include "G4SafetyCalculator.icc" 0207 0208 #endif
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|