|
||||
File indexing completed on 2025-01-18 09:58:33
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 // 0027 // Original author: Paul Kent, July 95/96 0028 // 0029 /// \brief { Class description: 0030 /// 0031 /// G4ITNavigator is a duplicate version of G4Navigator started from Geant4.9.5 0032 /// initially written by Paul Kent and colleagues. 0033 /// The only difference resides in the way the information is saved and managed 0034 /// 0035 /// A class for use by the tracking management, able to obtain/calculate 0036 /// dynamic tracking time information such as the distance to the next volume, 0037 /// or to find the physical volume containing a given point in the world 0038 /// reference system. The navigator maintains a transformation history and 0039 /// other information to optimise the tracking time performance.} 0040 // 0041 // Contact : Mathieu Karamitros (kara (AT) cenbg . in2p3 . fr) 0042 // 0043 // WARNING : This class is released as a prototype. 0044 // It might strongly evolve or even disappear in the next releases. 0045 // 0046 // We would be very happy hearing from you, send us your feedback! :) 0047 // 0048 // History: 0049 // - Created. Paul Kent, Jul 95/96 0050 // - Zero step protections J.A. / G.C., Nov 2004 0051 // - Added check mode G. Cosmo, Mar 2004 0052 // - Made Navigator Abstract G. Cosmo, Nov 2003 0053 // - G4ITNavigator created M.K., Nov 2012 0054 // ********************************************************************* 0055 0056 #ifndef G4ITNAVIGATOR_HH 0057 #define G4ITNAVIGATOR_HH 0058 0059 #include "geomdefs.hh" 0060 0061 #include "G4ThreeVector.hh" 0062 #include "G4AffineTransform.hh" 0063 #include "G4RotationMatrix.hh" 0064 0065 #include "G4LogicalVolume.hh" // Used in inline methods 0066 #include "G4TouchableHandle.hh" // " " 0067 0068 #include "G4NavigationHistory.hh" 0069 #include "G4NormalNavigation.hh" 0070 #include "G4VoxelNavigation.hh" 0071 #include "G4ParameterisedNavigation.hh" 0072 #include "G4ReplicaNavigation.hh" 0073 #include "G4RegularNavigation.hh" 0074 0075 #include <iostream> 0076 #include "G4TrackState.hh" 0077 #include <memory> 0078 0079 class G4VPhysicalVolume; 0080 0081 struct G4ITNavigatorState_Lock2 0082 { 0083 virtual ~G4ITNavigatorState_Lock2() = default; 0084 protected: 0085 G4ITNavigatorState_Lock2() = default; 0086 }; 0087 0088 class G4ITNavigator2 0089 { 0090 public: 0091 static const G4int fMaxNav = 8; // rename to kMaxNoNav ?? 0092 0093 public: 0094 // with description 0095 0096 friend std::ostream& operator <<(std::ostream &os, const G4ITNavigator2 &n); 0097 0098 G4ITNavigator2(); 0099 // Constructor - initialisers and setup. 0100 0101 virtual ~G4ITNavigator2(); 0102 // Destructor. No actions. 0103 0104 G4ITNavigator2(const G4ITNavigator2&) = delete; 0105 G4ITNavigator2& operator=(const G4ITNavigator2&) = delete; 0106 0107 // !> 0108 G4ITNavigatorState_Lock2* GetNavigatorState(); 0109 void SetNavigatorState(G4ITNavigatorState_Lock2*); 0110 void NewNavigatorState(); 0111 void NewNavigatorState(const G4TouchableHistory &h); 0112 void ResetNavigatorState(); 0113 G4VPhysicalVolume* NewNavigatorStateAndLocate(const G4ThreeVector &p, 0114 const G4ThreeVector &direction); 0115 void CheckNavigatorState() const; 0116 0117 inline std::shared_ptr<G4ITNavigatorState_Lock2> GetSnapshotOfState(); 0118 inline void ResetFromSnapshot(std::shared_ptr<G4ITNavigatorState_Lock2>); 0119 // <! 0120 0121 virtual G4double ComputeStep(const G4ThreeVector &pGlobalPoint, 0122 const G4ThreeVector &pDirection, 0123 const G4double pCurrentProposedStepLength, 0124 G4double &pNewSafety); 0125 // Calculate the distance to the next boundary intersected 0126 // along the specified NORMALISED vector direction and 0127 // from the specified point in the global coordinate 0128 // system. LocateGlobalPointAndSetup or LocateGlobalPointWithinVolume 0129 // must have been called with the same global point prior to this call. 0130 // The isotropic distance to the nearest boundary is also 0131 // calculated (usually an underestimate). The current 0132 // proposed Step length is used to avoid intersection 0133 // calculations: if it can be determined that the nearest 0134 // boundary is >pCurrentProposedStepLength away, kInfinity 0135 // is returned together with the computed isotropic safety 0136 // distance. Geometry must be closed. 0137 0138 G4double CheckNextStep(const G4ThreeVector &pGlobalPoint, 0139 const G4ThreeVector &pDirection, 0140 const G4double pCurrentProposedStepLength, 0141 G4double &pNewSafety); 0142 // Same as above, but do not disturb the state of the Navigator. 0143 0144 virtual G4VPhysicalVolume* ResetHierarchyAndLocate(const G4ThreeVector &point, 0145 const G4ThreeVector &direction, 0146 const G4TouchableHistory &h); 0147 0148 // Resets the geometrical hierarchy and search for the volumes deepest 0149 // in the hierarchy containing the point in the global coordinate space. 0150 // The direction is used to check if a volume is entered. 0151 // The search begin is the geometrical hierarchy at the location of the 0152 // last located point, or the endpoint of the previous Step if 0153 // SetGeometricallyLimitedStep() has been called immediately before. 0154 // 0155 // Important Note: In order to call this the geometry MUST be closed. 0156 0157 virtual 0158 G4VPhysicalVolume* LocateGlobalPointAndSetup(const G4ThreeVector& point, 0159 const G4ThreeVector* direction=nullptr, 0160 const G4bool pRelativeSearch=true, 0161 const G4bool ignoreDirection=true); 0162 // Search the geometrical hierarchy for the volumes deepest in the hierarchy 0163 // containing the point in the global coordinate space. Two main cases are: 0164 // i) If pRelativeSearch=false it makes use of no previous/state 0165 // information. Returns the physical volume containing the point, 0166 // with all previous mothers correctly set up. 0167 // ii) If pRelativeSearch is set to true, the search begin is the 0168 // geometrical hierarchy at the location of the last located point, 0169 // or the endpoint of the previous Step if SetGeometricallyLimitedStep() 0170 // has been called immediately before. 0171 // The direction is used (to check if a volume is entered) if either 0172 // - the argument ignoreDirection is false, or 0173 // - the Navigator has determined that it is on an edge shared by two or 0174 // more volumes. (This is state information.) 0175 // 0176 // Important Note: In order to call this the geometry MUST be closed. 0177 0178 //---------------------------------------------------------------------------- 0179 EInside InsideCurrentVolume(const G4ThreeVector& globalPoint) const; 0180 0181 void GetRandomInCurrentVolume(G4ThreeVector& rndmPoint) const; 0182 //---------------------------------------------------------------------------- 0183 0184 virtual 0185 void LocateGlobalPointWithinVolume(const G4ThreeVector& position); 0186 // Notify the Navigator that a track has moved to the new Global point 0187 // 'position', that is known to be within the current safety. 0188 // No check is performed to ensure that it is within the volume. 0189 // This method can be called instead of LocateGlobalPointAndSetup ONLY if 0190 // the caller is certain that the new global point (position) is inside the 0191 // same volume as the previous position. Usually this can be guaranteed 0192 // only if the point is within safety. 0193 0194 inline void LocateGlobalPointAndUpdateTouchableHandle( 0195 const G4ThreeVector& position, 0196 const G4ThreeVector& direction, 0197 G4TouchableHandle& oldTouchableToUpdate, 0198 const G4bool RelativeSearch = true); 0199 // First, search the geometrical hierarchy like the above method 0200 // LocateGlobalPointAndSetup(). Then use the volume found and its 0201 // navigation history to update the touchable. 0202 0203 inline void LocateGlobalPointAndUpdateTouchable( 0204 const G4ThreeVector& position, 0205 const G4ThreeVector& direction, 0206 G4VTouchable* touchableToUpdate, 0207 const G4bool RelativeSearch = true); 0208 // First, search the geometrical hierarchy like the above method 0209 // LocateGlobalPointAndSetup(). Then use the volume found and its 0210 // navigation history to update the touchable. 0211 0212 inline void LocateGlobalPointAndUpdateTouchable( 0213 const G4ThreeVector& position, 0214 G4VTouchable* touchableToUpdate, 0215 const G4bool RelativeSearch = true); 0216 // Same as the method above but missing direction. 0217 0218 inline void SetGeometricallyLimitedStep(); 0219 // Inform the navigator that the previous Step calculated 0220 // by the geometry was taken in its entirety. 0221 0222 virtual G4double ComputeSafety(const G4ThreeVector &globalpoint, 0223 const G4double pProposedMaxLength = DBL_MAX, 0224 const G4bool keepState = true); 0225 // Calculate the isotropic distance to the nearest boundary from the 0226 // specified point in the global coordinate system. 0227 // The globalpoint utilised must be within the current volume. 0228 // The value returned is usually an underestimate. 0229 // The proposed maximum length is used to avoid volume safety 0230 // calculations. The geometry must be closed. 0231 // To ensure minimum side effects from the call, keepState 0232 // must be true. 0233 0234 virtual G4bool RecheckDistanceToCurrentBoundary( 0235 const G4ThreeVector &pGlobalPoint, 0236 const G4ThreeVector &pDirection, 0237 const G4double CurrentProposedStepLength, 0238 G4double *prDistance, 0239 G4double *prNewSafety=nullptr) const; 0240 // Trial method for checking potential displacement for MS 0241 // Check new Globalpoint, to see whether it is in current volume 0242 // (mother) and not in potential entering daughter. 0243 // If in mother, check distance to boundary along pDirection. 0244 // If in entering daughter, check distance back to boundary. 0245 // NOTE: 0246 // Can be called only after ComputeStep is called - before ReLocation 0247 // Deals only with current volume (and potentially entered) 0248 0249 inline G4VPhysicalVolume* GetWorldVolume() const; 0250 // Return the current world (`topmost') volume. 0251 0252 inline void SetWorldVolume(G4VPhysicalVolume* pWorld); 0253 // Set the world (`topmost') volume. This must be positioned at 0254 // origin (0,0,0) and unrotated. 0255 0256 inline G4TouchableHistory* CreateTouchableHistory() const; 0257 inline G4TouchableHistory* CreateTouchableHistory(const G4NavigationHistory*) const; 0258 // `Touchable' creation methods: caller has deletion responsibility. 0259 0260 virtual G4TouchableHandle CreateTouchableHistoryHandle() const; 0261 // Returns a reference counted handle to a touchable history. 0262 0263 virtual G4ThreeVector GetLocalExitNormal(G4bool* valid); 0264 virtual G4ThreeVector GetLocalExitNormalAndCheck(const G4ThreeVector& point, 0265 G4bool* valid); 0266 virtual G4ThreeVector GetGlobalExitNormal(const G4ThreeVector& point, 0267 G4bool* valid); 0268 // Return Exit Surface Normal and validity too. 0269 // Can only be called if the Navigator's last Step has crossed a 0270 // volume geometrical boundary. 0271 // It returns the Normal to the surface pointing out of the volume that 0272 // was left behind and/or into the volume that was entered. 0273 // Convention: 0274 // The *local* normal is in the coordinate system of the *final* volume. 0275 // Restriction: 0276 // Normals are not available for replica volumes (returns valid= false) 0277 // These methods takes full care about how to calculate this normal, 0278 // but if the surfaces are not convex it will return valid=false. 0279 0280 inline G4int GetVerboseLevel() const; 0281 inline void SetVerboseLevel(G4int level); 0282 // Get/Set Verbose(ness) level. 0283 // [if level>0 && G4VERBOSE, printout can occur] 0284 0285 inline G4bool IsActive() const; 0286 // Verify if the navigator is active. 0287 inline void Activate(G4bool flag); 0288 // Activate/inactivate the navigator. 0289 0290 inline G4bool EnteredDaughterVolume() const; 0291 // The purpose of this function is to inform the caller if the track is 0292 // entering a daughter volume while exiting from the current volume. 0293 // This method returns 0294 // - True only in case 1) above, that is when the Step has caused 0295 // the track to arrive at a boundary of a daughter. 0296 // - False in cases 2), 3) and 4), i.e. in all other cases. 0297 // This function is not guaranteed to work if SetGeometricallyLimitedStep() 0298 // was not called when it should have been called. 0299 inline G4bool ExitedMotherVolume() const; 0300 // Verify if the step has exited the mother volume. 0301 0302 inline void CheckMode(G4bool mode); 0303 // Run navigation in "check-mode", therefore using additional 0304 // verifications and more strict correctness conditions. 0305 // Is effective only with G4VERBOSE set. 0306 inline G4bool IsCheckModeActive() const; 0307 inline void SetPushVerbosity(G4bool mode); 0308 // Set/unset verbosity for pushed tracks (default is true). 0309 0310 void PrintState() const; 0311 // Print the internal state of the Navigator (for debugging). 0312 // The level of detail is according to the verbosity. 0313 0314 inline const G4AffineTransform& GetGlobalToLocalTransform() const; 0315 inline const G4AffineTransform GetLocalToGlobalTransform() const; 0316 // Obtain the transformations Global/Local (and inverse). 0317 // Clients of these methods must copy the data if they need to keep it. 0318 0319 G4AffineTransform GetMotherToDaughterTransform(G4VPhysicalVolume* dVolume, 0320 G4int dReplicaNo, 0321 EVolume dVolumeType ); 0322 // Obtain mother to daughter transformation 0323 0324 inline void ResetStackAndState(); 0325 // Reset stack and minimum or navigator state machine necessary for reset 0326 // as needed by LocalGlobalPointAndSetup. 0327 // [Does not perform clears, resizes, or reset fLastLocatedPointLocal] 0328 0329 inline G4int SeverityOfZeroStepping( G4int* noZeroSteps ) const; 0330 // Report on severity of error and number of zero steps, 0331 // in case Navigator is stuck and is returning zero steps. 0332 // Values: 1 (small problem), 5 (correcting), 0333 // 9 (ready to abandon), 10 (abandoned) 0334 0335 /* 0336 void SetSavedState(); 0337 // ( fValidExitNormal, fExitNormal, fExiting, fEntering, 0338 // fBlockedPhysicalVolume, fBlockedReplicaNo, fLastStepWasZero); 0339 void RestoreSavedState(); 0340 // Copy aspects of the state, to enable a non-state changing 0341 // call to ComputeStep 0342 */ 0343 inline G4ThreeVector GetCurrentLocalCoordinate() const; 0344 // Return the local coordinate of the point in the reference system 0345 // of its containing volume that was found by LocalGlobalPointAndSetup. 0346 // The local coordinate of the last located track. 0347 0348 inline G4ThreeVector NetTranslation() const; 0349 inline G4RotationMatrix NetRotation() const; 0350 // Compute+return the local->global translation/rotation of current volume. 0351 0352 inline void EnableBestSafety( G4bool value= false ); 0353 // Enable best-possible evaluation of isotropic safety 0354 0355 protected:// with description 0356 0357 inline G4ThreeVector ComputeLocalPoint(const G4ThreeVector& rGlobPoint) const; 0358 // Return position vector in local coordinate system, given a position 0359 // vector in world coordinate system. 0360 0361 inline G4ThreeVector ComputeLocalAxis(const G4ThreeVector& pVec) const; 0362 // Return the local direction of the specified vector in the reference 0363 // system of the volume that was found by LocalGlobalPointAndSetup. 0364 // The Local Coordinates of point in world coordinate system. 0365 0366 virtual void ResetState(); 0367 // Utility method to reset the navigator state machine. 0368 0369 inline EVolume VolumeType(const G4VPhysicalVolume *pVol) const; 0370 // Characterise `type' of volume - normal/replicated/parameterised. 0371 0372 inline EVolume CharacteriseDaughters(const G4LogicalVolume *pLog) const; 0373 // Characterise daughter of logical volume. 0374 0375 inline G4int GetDaughtersRegularStructureId(const G4LogicalVolume *pLog) const; 0376 // Get regular structure ID of first daughter 0377 0378 virtual void SetupHierarchy(); 0379 // Renavigate & reset hierarchy described by current history 0380 // o Reset volumes 0381 // o Recompute transforms and/or solids of replicated/parameterised 0382 // volumes. 0383 0384 private: 0385 0386 void ComputeStepLog(const G4ThreeVector& pGlobalpoint, 0387 G4double moveLenSq) const; 0388 // Log and checks for steps larger than the tolerance 0389 0390 protected:// without description 0391 0392 G4double kCarTolerance; 0393 // Geometrical tolerance for surface thickness of shapes. 0394 0395 G4int fVerbose{0}; 0396 // Verbose(ness) level [if > 0, printout can occur]. 0397 0398 private: 0399 0400 G4bool fActive; 0401 // States if the navigator is activated or not. 0402 0403 G4int fActionThreshold_NoZeroSteps; 0404 // After this many failed/zero steps, act (push etc) 0405 G4int fAbandonThreshold_NoZeroSteps; 0406 // After this many failed/zero steps, abandon track 0407 0408 protected: 0409 public: 0410 struct G4SaveNavigatorState; 0411 0412 // 0413 // BEGIN State information 0414 // 0415 struct G4NavigatorState : public G4ITNavigatorState_Lock2 0416 { 0417 G4NavigatorState(); 0418 G4NavigatorState(const G4NavigatorState&); 0419 ~G4NavigatorState() override 0420 { ;} 0421 0422 G4NavigatorState& operator=(const G4NavigatorState& ); 0423 G4NavigatorState& operator=(const G4SaveNavigatorState& ); 0424 0425 void ResetState(); 0426 void ResetStack(); 0427 void ResetStackAndState(); 0428 0429 G4NavigationHistory fHistory; 0430 // Transformation and history of the current path 0431 // through the geometrical hierarchy. 0432 0433 G4bool fEnteredDaughter; 0434 // A memory of whether in this Step a daughter volume is entered 0435 // (set in Compute & Locate). 0436 // After Compute: it expects to enter a daughter 0437 // After Locate: it has entered a daughter 0438 0439 G4bool fExitedMother; 0440 // A similar memory whether the Step exited current "mother" volume 0441 // completely, not entering daughter. 0442 0443 G4bool fWasLimitedByGeometry; 0444 // Set true if last Step was limited by geometry. 0445 0446 G4ThreeVector fStepEndPoint; 0447 // Endpoint of last ComputeStep 0448 // can be used for optimisation (e.g. when computing safety). 0449 G4ThreeVector fLastStepEndPointLocal; 0450 // Position of the end-point of the last call to ComputeStep 0451 // in last Local coordinates. 0452 0453 G4bool fPushed; 0454 // Push flags [if true, means a stuck particle has been pushed]. 0455 0456 private: 0457 friend class G4ITNavigator2; 0458 // The friend class would allow G4Navigator to access the private members 0459 // of G4NavigatorState but not the classes inheriting from G4Navigator 0460 0461 friend struct G4SaveNavigatorState; 0462 friend std::ostream& operator << (std::ostream &os,const G4ITNavigator2 &n); 0463 0464 G4bool fLastTriedStepComputation; 0465 // Whether ComputeStep was called since the last call to a Locate method 0466 // Uses: - distinguish parts of state which differ before/after calls 0467 // to ComputeStep or one of the Locate methods; 0468 // - avoid two consecutive calls to compute-step (illegal). 0469 0470 G4bool fEntering,fExiting; 0471 // Entering/Exiting volumes blocking/setup 0472 // o If exiting 0473 // volume ptr & replica number (set & used by Locate..()) 0474 // used for blocking on redescent of geometry 0475 // o If entering 0476 // volume ptr & replica number (set by ComputeStep(),used by 0477 // Locate..()) of volume for `automatic' entry 0478 0479 G4VPhysicalVolume *fBlockedPhysicalVolume; 0480 G4int fBlockedReplicaNo; 0481 0482 G4ThreeVector fLastLocatedPointLocal; 0483 // Position of the last located point relative to its containing volume. 0484 G4bool fLocatedOutsideWorld; 0485 // Whether the last call to Locate methods left the world 0486 0487 G4bool fValidExitNormal;// Set true if have leaving volume normal 0488 G4ThreeVector fExitNormal;// Leaving volume normal, in the 0489 // volume containing the exited 0490 // volume's coordinate system 0491 G4ThreeVector fGrandMotherExitNormal;// Leaving volume normal, in its 0492 // own coordinate system 0493 G4bool fChangedGrandMotherRefFrame;// Whether frame is changed 0494 0495 G4ThreeVector fExitNormalGlobalFrame;// Leaving volume normal, in the 0496 // global coordinate system 0497 G4bool fCalculatedExitNormal;// Has it been computed since 0498 // the last call to ComputeStep 0499 // Covers both Global and GrandMother 0500 0501 // Count zero steps - as one or two can occur due to changing momentum at 0502 // a boundary or at an edge common between volumes 0503 // - several are likely a problem in the geometry 0504 // description or in the navigation 0505 // 0506 G4bool fLastStepWasZero; 0507 // Whether the last ComputeStep moved Zero. Used to check for edges. 0508 0509 G4bool fLocatedOnEdge; 0510 // Whether the Navigator has detected an edge 0511 G4int fNumberZeroSteps; 0512 // Number of preceding moves that were Zero. Reset to 0 after finite step 0513 0514 G4ThreeVector fPreviousSftOrigin; 0515 G4double fPreviousSafety; 0516 // Memory of last safety origin & value. Used in ComputeStep to ensure 0517 // that origin of current Step is in the same volume as the point of the 0518 // last relocation 0519 0520 // 0521 // END State information 0522 // 0523 }; 0524 0525 G4NavigatorState* fpNavigatorState; 0526 0527 // Save key state information (NOT the navigation history stack) 0528 // 0529 struct G4SaveNavigatorState 0530 { 0531 G4SaveNavigatorState(); 0532 G4SaveNavigatorState(G4NavigatorState*); 0533 virtual ~G4SaveNavigatorState() 0534 { ;} 0535 G4ThreeVector sExitNormal; 0536 G4bool sValidExitNormal; 0537 G4bool sEntering, sExiting; 0538 G4VPhysicalVolume* spBlockedPhysicalVolume; 0539 G4int sBlockedReplicaNo; 0540 G4int sLastStepWasZero; 0541 0542 // !> 0543 // G4bool sLocatedOnEdge; 0544 // G4bool sPushed; 0545 // G4int sNumberZeroSteps; 0546 // <! 0547 0548 // Potentially relevant 0549 // 0550 G4bool sLocatedOutsideWorld; 0551 G4ThreeVector sLastLocatedPointLocal; 0552 G4bool sEnteredDaughter, sExitedMother; 0553 G4bool sWasLimitedByGeometry; 0554 0555 G4ThreeVector sPreviousSftOrigin; 0556 G4double sPreviousSafety; 0557 }; 0558 0559 // G4SaveNavigatorState* fpSaveState; 0560 0561 // Tracking Invariants 0562 // 0563 G4VPhysicalVolume *fTopPhysical{nullptr}; 0564 // A link to the topmost physical volume in the detector. 0565 // Must be positioned at the origin and unrotated. 0566 0567 // Utility information 0568 // 0569 G4bool fCheck{false}; 0570 // Check-mode flag [if true, more strict checks are performed]. 0571 0572 G4bool fWarnPush{true}; 0573 // Push flag [for verbose]. 0574 0575 // Helpers/Utility classes 0576 // 0577 G4NormalNavigation fnormalNav; 0578 G4VoxelNavigation fvoxelNav; 0579 G4ParameterisedNavigation fparamNav; 0580 G4ReplicaNavigation freplicaNav; 0581 G4RegularNavigation fregularNav; 0582 G4VoxelSafety *fpVoxelSafety; 0583 }; 0584 0585 RegisterTrackState(G4ITNavigator2, G4NavigatorState) 0586 0587 #define CheckNavigatorStateIsValid() \ 0588 if(fpNavigatorState == 0) \ 0589 { \ 0590 G4ExceptionDescription exceptionDescription; \ 0591 exceptionDescription << "The navigator state is NULL. "; \ 0592 exceptionDescription << "Either NewNavigatorStateAndLocate was not called "; \ 0593 exceptionDescription << "or the provided navigator state was already NULL."; \ 0594 G4Exception((G4String("G4Navigator")+G4String(__FUNCTION__)).c_str(),\ 0595 "NavigatorStateNotValid",FatalException,exceptionDescription); \ 0596 } 0597 0598 #include "G4ITNavigator2.icc" 0599 0600 #endif 0601 0602 // NOTES: 0603 // 0604 // The following methods provide detailed information when a Step has 0605 // arrived at a geometrical boundary. They distinguish between the different 0606 // causes that can result in the track leaving its current volume. 0607 // 0608 // Four cases are possible: 0609 // 0610 // 1) The particle has reached a boundary of a daughter of the current volume: 0611 // (this could cause the relocation to enter the daughter itself 0612 // or a potential granddaughter or further descendant) 0613 // 0614 // 2) The particle has reached a boundary of the current 0615 // volume, exiting into a mother (regardless the level 0616 // at which it is located in the tree): 0617 // 0618 // 3) The particle has reached a boundary of the current 0619 // volume, exiting into a volume which is not in its 0620 // parental hierarchy: 0621 // 0622 // 4) The particle is not on a boundary between volumes: 0623 // the function returns an exception, and the caller is 0624 // reccomended to compare the G4touchables associated 0625 // to the preStepPoint and postStepPoint to handle this case. 0626 // 0627 // G4bool EnteredDaughterVolume() 0628 // G4bool IsExitNormalValid() 0629 // G4ThreeVector GetLocalExitNormal() 0630 // 0631 // The expected usefulness of these methods is to allow the caller to 0632 // determine how to compute the surface normal at the volume boundary. The two 0633 // possibilities are to obtain the normal from: 0634 // 0635 // i) the solid associated with the volume of the initial point of the Step. 0636 // This is valid for cases 2 and 3. 0637 // (Note that the initial point is generally the PreStepPoint of a Step). 0638 // or 0639 // 0640 // ii) the solid of the final point, ie of the volume after the relocation. 0641 // This is valid for case 1. 0642 // (Note that the final point is generally the PreStepPoint of a Step). 0643 // 0644 // This way the caller can always get a valid normal, pointing outside 0645 // the solid for which it is computed, that can be used at his own 0646 // discretion.
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |