Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:58:43

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