Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-08-20 09:08:32

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 // G4VNavigation
0027 //
0028 // Class description:
0029 //
0030 // Navigation interface common between all navigator types.
0031 
0032 // Author: Guilherme Amadio (CERN), March 2022
0033 // --------------------------------------------------------------------
0034 #ifndef G4VNAVIGATION_HH
0035 #define G4VNAVIGATION_HH 1
0036 
0037 #include "G4ThreeVector.hh"
0038 
0039 class G4LogicalVolume;
0040 class G4VPhysicalVolume;
0041 class G4NavigationHistory;
0042 
0043 /**
0044  * @brief G4VNavigation class holds the common navigation interface
0045  * for all geometry navigator types.
0046  */
0047 
0048 class G4VNavigation
0049 {
0050   public:
0051 
0052     /**
0053      * Virtual Destructor.
0054      */
0055     virtual ~G4VNavigation() = default;
0056 
0057     /**
0058      * Searches positioned volumes in mother at current top level of @p history
0059      * for volume containing @p globalPoint. Do not test against @p blockedVol.
0060      * If a containing volume is found, push it onto navigation history state.
0061      *  @param[in,out] history Navigation history.
0062      *  @param[in,out] blockedVol Blocked volume to be ignored in queries.
0063      *  @param[in,out] blockedNum Copy number for blocked replica volumes.
0064      *  @param[in,out] globalPoint Point in global coordinates system.
0065      *  @param[in,out] globalDirection Pointer to global direction or null.
0066      *  @param[in,out] localPoint Point in local coordinates system.
0067      *  @returns Whether a containing volume has been found.
0068      */
0069     virtual G4bool LevelLocate(G4NavigationHistory& history,
0070                          const G4VPhysicalVolume* blockedVol,
0071                          const G4int blockedNum,
0072                          const G4ThreeVector& globalPoint,
0073                          const G4ThreeVector* globalDirection,
0074                          const G4bool pLocatedOnEdge,
0075                                G4ThreeVector& localPoint) = 0;
0076 
0077     /**
0078      * Computes the length of a step to the next boundary.
0079      * Do not test against @p pBlockedPhysical. Identify the next candidate
0080      * volume (if a daughter of current volume), and return it in:
0081      * pBlockedPhysical, blockedReplicaNo.
0082      *  @param[in] localPoint Local point.
0083      *  @param[in] localDirection Local vector direction.
0084      *  @param[in] currentProposedStepLength Current proposed step length.
0085      *  @param[in,out] newSafety New safety.
0086      *  @param[in,out] history Navigation history.
0087      *  @param[in,out] validExitNormal Flag to indicate whether exit normal is
0088      *                 valid or not.
0089      *  @param[in,out] exitNormal Exit normal.
0090      *  @param[in,out] entering Flag to indicate whether entering a volume.
0091      *  @param[in,out] exiting Flag to indicate whether exiting a volume.
0092      *  @param[in,out] pBlockedPhysical Blocked physical volume that should be
0093      *                 ignored in queries.
0094      *  @param[in,out] blockedReplicaNo Copy number for blocked replica volumes.
0095      *  @returns Length from current point to next boundary surface along
0096      *           @p localDirection.
0097      */
0098     virtual G4double ComputeStep(const G4ThreeVector& localPoint,
0099                                  const G4ThreeVector& localDirection,
0100                                  const G4double currentProposedStepLength,
0101                                        G4double& newSafety,
0102                                        G4NavigationHistory& history,
0103                                        G4bool& validExitNormal,
0104                                        G4ThreeVector& exitNormal,
0105                                        G4bool& exiting,
0106                                        G4bool& entering,
0107                                        G4VPhysicalVolume*(*pBlockedPhysical),
0108                                        G4int& blockedReplicaNo) = 0;
0109 
0110     /**
0111      * Computes the distance to the closest surface.
0112      *  @param[in] localPoint Local point.
0113      *  @param[in] history Navigation history.
0114      *  @param[in] pMaxLength Maximum step length beyond which volumes
0115      *             need not be checked.
0116      *  @returns Length from current point to closest surface.
0117      */
0118     virtual G4double ComputeSafety(const G4ThreeVector& localpoint,
0119                                    const G4NavigationHistory& history,
0120                                    const G4double pMaxLength = DBL_MAX) = 0;
0121 
0122     /**
0123      * Updates internal navigation state to take into account that location
0124      * has been moved, but remains within the @p motherPhysical volume.
0125      *  @param[in] motherPhysical Current physical volume.
0126      *  @param[in] localPoint Local point.
0127      */
0128     virtual void RelocateWithinVolume(G4VPhysicalVolume* /* motherPhysical */,
0129                                       const G4ThreeVector& /* localPoint */)
0130     {
0131       /* do nothing by default */
0132     }
0133 
0134     /**
0135      * Gets current verbosity level.
0136      */
0137     virtual G4int GetVerboseLevel() const { return fVerbose; }
0138 
0139     /**
0140      * Sets current verbosity level.
0141      */
0142     virtual void SetVerboseLevel(G4int level) { fVerbose = level; }
0143 
0144     /**
0145      * Sets check mode.
0146      * When enabled, forces navigator to run in "check mode", hence using
0147      * additional verifications and stricter condictions for ensuring
0148      * correctness. Effective only when G4VERBOSE is enabled.
0149      */
0150     void CheckMode(G4bool mode) { fCheck = mode; }
0151 
0152   protected:
0153 
0154     G4int fVerbose = 0;
0155     G4bool fCheck = false;
0156 };
0157 
0158 #endif