Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-09 09:09:28

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 // G4NormalNavigation
0027 //
0028 // Class description:
0029 //
0030 // Utility for navigation in volumes containing only G4PVPlacement
0031 // daughter volumes.
0032 
0033 // Author: Paul Kent (CERN), August 1996
0034 // --------------------------------------------------------------------
0035 #ifndef G4NORMALNAVIGATION_HH
0036 #define G4NORMALNAVIGATION_HH 1
0037 
0038 #include <iomanip>
0039 
0040 #include "G4VNavigation.hh"
0041 #include "G4NavigationHistory.hh"
0042 
0043 #include "G4VPhysicalVolume.hh"
0044 #include "G4LogicalVolume.hh"
0045 #include "G4VSolid.hh"
0046 #include "G4ThreeVector.hh"
0047 #include "G4AuxiliaryNavServices.hh"
0048 
0049 class G4NavigationLogger;
0050 
0051 /**
0052  * @brief G4NormalNavigation is a concrete utility class for navigation in
0053  * volumes containing only G4PVPlacement daughter volumes.
0054  */
0055 
0056 class G4NormalNavigation : public G4VNavigation
0057 {
0058   public:
0059 
0060     /**
0061      * Constructor and Destructor.
0062      */
0063     G4NormalNavigation();
0064     ~G4NormalNavigation() override;
0065 
0066     /**
0067      * Searches positioned volumes in mother at current top level of history
0068      * for volume containing @p globalPoint. Do not test against @p blockedVol.
0069      * If a containing volume is found, push it onto navigation history state
0070      * and return true, else return false (the point lying in the mother but
0071      * not any of the daughters).
0072      *  @param[in,out] history Navigation history.
0073      *  @param[in,out] blockedVol Blocked volume to be ignored in queries.
0074      *  @param[in,out] blockedNum Copy number for blocked volumes.
0075      *  @param[in,out] globalPoint Point in global coordinates system.
0076      *  @param[in,out] globalDirection Pointer to global direction or null.
0077      *  @param[in] pLocatedOnEdge Flag specifying if point is located on edge.
0078      *  @param[in,out] localPoint Point in local coordinates system.
0079      *  @returns Whether a containing volume has been found.
0080      */
0081     inline G4bool LevelLocate( G4NavigationHistory& history,
0082                   const G4VPhysicalVolume* blockedVol,
0083                   const G4int blockedNum,
0084                   const G4ThreeVector& globalPoint,
0085                   const G4ThreeVector* globalDirection,
0086                   const G4bool pLocatedOnEdge, 
0087                         G4ThreeVector& localPoint) final;
0088 
0089     /**
0090      * Computes the length of a step to the next boundary.
0091      * Does not test against @p pBlockedPhysical. Identifies the next candidate
0092      * volume (if a daughter of the current volume), and returns it in:
0093      * pBlockedPhysical, blockedReplicaNo.
0094      *  @param[in] localPoint Local point.
0095      *  @param[in] localDirection Pointer to local direction or null pointer.
0096      *  @param[in] currentProposedStepLength Current proposed step length.
0097      *  @param[in,out] newSafety New safety.
0098      *  @param[in,out] history Navigation history.
0099      *  @param[in,out] validExitNormal Flag to indicate whether exit normal is
0100      *                 valid or not.
0101      *  @param[in,out] exitNormal Exit normal.
0102      *  @param[in,out] exiting Flag to indicate whether exiting a volume.
0103      *  @param[in,out] entering Flag to indicate whether entering a volume.
0104      *  @param[in,out] pBlockedPhysical Blocked physical volume that should be
0105      *                 ignored in queries.
0106      *  @param[in,out] blockedReplicaNo Copy number for blocked replica volumes.
0107      *  @returns Length from current point to next boundary surface along
0108      *           @p localDirection.
0109      */
0110     G4double ComputeStep( const G4ThreeVector& localPoint,
0111                           const G4ThreeVector& localDirection,
0112                           const G4double currentProposedStepLength,
0113                                 G4double& newSafety,
0114                                 G4NavigationHistory& history,
0115                                 G4bool& validExitNormal,
0116                                 G4ThreeVector& exitNormal,
0117                                 G4bool& exiting,
0118                                 G4bool& entering,
0119                                 G4VPhysicalVolume* (*pBlockedPhysical),
0120                                 G4int& blockedReplicaNo ) final;
0121 
0122     /**
0123      * Calculates the isotropic distance to the nearest boundary from the
0124      * specified point in the local coordinate system. 
0125      * The localpoint utilised must be within the current volume.
0126      *  @param[in] localPoint Local point.
0127      *  @param[in] history Navigation history.
0128      *  @param[in] pMaxLength Maximum step length beyond which volumes
0129      *             need not be checked.
0130      *  @returns Length from current point to closest surface.
0131      */
0132     G4double ComputeSafety( const G4ThreeVector& localpoint,
0133                             const G4NavigationHistory& history,
0134                             const G4double pMaxLength=DBL_MAX ) final;
0135 
0136     /**
0137      * Verbosity control.
0138      *  @note If level>0 && G4VERBOSE, printout can occur.
0139      */
0140     G4int GetVerboseLevel() const final;
0141     void  SetVerboseLevel(G4int level) final;
0142 
0143   private:
0144 
0145     G4NavigationLogger* fLogger;
0146 };
0147 
0148 #include "G4NormalNavigation.icc"
0149 
0150 #endif