Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:59:25

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