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 G4VoxelNavigation
0027 //
0028 // Class description:
0029 //
0030 // Utility for navigation in volumes containing only G4PVPlacement
0031 // daughter volumes for which voxels have been constructed.
0032 
0033 // History:
0034 // - Created: Paul Kent, Aug 96
0035 // --------------------------------------------------------------------
0036 #ifndef G4VOXELNAVIGATION_HH
0037 #define G4VOXELNAVIGATION_HH
0038 
0039 #include "geomdefs.hh"
0040 #include "G4VNavigation.hh"
0041 #include "G4NavigationHistory.hh"
0042 #include "G4NavigationLogger.hh"
0043 #include "G4AffineTransform.hh"
0044 #include "G4VPhysicalVolume.hh"
0045 #include "G4LogicalVolume.hh"
0046 #include "G4VSolid.hh"
0047 #include "G4ThreeVector.hh"
0048 
0049 #include "G4BlockingList.hh"
0050 
0051 class G4VoxelSafety; 
0052 
0053 // Required for inline implementation
0054 //
0055 #include "G4AuxiliaryNavServices.hh"
0056 
0057 // Required for voxel handling & voxel stack
0058 //
0059 #include <vector>
0060 #include "G4SmartVoxelProxy.hh"
0061 #include "G4SmartVoxelNode.hh"
0062 #include "G4SmartVoxelHeader.hh"
0063 
0064 class G4VoxelNavigation : public G4VNavigation
0065 {
0066   public:  // with description
0067 
0068     G4VoxelNavigation();
0069     virtual ~G4VoxelNavigation();
0070 
0071     G4SmartVoxelNode* VoxelLocate( G4SmartVoxelHeader* pHead,
0072                              const G4ThreeVector& localPoint );
0073 
0074     virtual G4bool LevelLocate( G4NavigationHistory& history,
0075                           const G4VPhysicalVolume* blockedVol,
0076                           const G4int blockedNum,
0077                           const G4ThreeVector& globalPoint,
0078                           const G4ThreeVector* globalDirection,
0079                           const G4bool pLocatedOnEdge, 
0080                                 G4ThreeVector& localPoint ) override;
0081 
0082     virtual G4double ComputeStep( const G4ThreeVector& globalPoint,
0083                                   const G4ThreeVector& globalDirection,
0084                                   const G4double currentProposedStepLength,
0085                                         G4double& newSafety,
0086                                         G4NavigationHistory& history,
0087                                         G4bool& validExitNormal,
0088                                         G4ThreeVector& exitNormal,
0089                                         G4bool& exiting,
0090                                         G4bool& entering,
0091                                         G4VPhysicalVolume* (*pBlockedPhysical),
0092                                         G4int& blockedReplicaNo ) override;
0093 
0094     virtual G4double ComputeSafety( const G4ThreeVector& globalpoint,
0095                                     const G4NavigationHistory& history,
0096                                     const G4double pMaxLength = DBL_MAX ) override;
0097 
0098     virtual void RelocateWithinVolume( G4VPhysicalVolume*  motherPhysical,
0099                                        const G4ThreeVector& localPoint ) override;
0100 
0101     virtual G4int GetVerboseLevel() const override;
0102     virtual void  SetVerboseLevel(G4int level) override;
0103       // Get/Set Verbose(ness) level.
0104       // [if level>0 && G4VERBOSE, printout can occur]
0105 
0106     inline void EnableBestSafety( G4bool flag = false );
0107       // Enable best-possible evaluation of isotropic safety
0108 
0109   protected:
0110 
0111     G4double ComputeVoxelSafety( const G4ThreeVector& localPoint ) const;
0112     G4bool LocateNextVoxel( const G4ThreeVector& localPoint,
0113                             const G4ThreeVector& localDirection,
0114                             const G4double currentStep );
0115 
0116     G4SmartVoxelNode* VoxelLocateLight( G4SmartVoxelHeader* pHead,
0117                     const G4ThreeVector& localPoint ) const;
0118 
0119   private:  // Logging functions
0120 
0121     void PreComputeStepLog  (const G4VPhysicalVolume* motherPhysical,
0122                                    G4double motherSafety,
0123                              const G4ThreeVector& localPoint);
0124     void AlongComputeStepLog(const G4VSolid* sampleSolid,
0125                              const G4ThreeVector& samplePoint,
0126                              const G4ThreeVector& sampleDirection,
0127                              const G4ThreeVector& localDirection,
0128                                    G4double sampleSafety,
0129                                    G4double sampleStep);
0130     void PostComputeStepLog (const G4VSolid* motherSolid,
0131                              const G4ThreeVector& localPoint,
0132                              const G4ThreeVector& localDirection,
0133                                    G4double motherStep,
0134                                    G4double motherSafety);
0135     void ComputeSafetyLog   (const G4VSolid* solid,
0136                              const G4ThreeVector& point,
0137                                    G4double safety,
0138                                    G4bool banner);
0139     inline void PrintDaughterLog (const G4VSolid* sampleSolid,
0140                                   const G4ThreeVector& samplePoint,
0141                                         G4double sampleSafety,
0142                                         G4double sampleStep);   
0143   protected:
0144 
0145     G4BlockingList fBList;
0146       // Blocked volumes
0147 
0148     //
0149     //  BEGIN Voxel Stack information
0150     //
0151 
0152     G4int fVoxelDepth = -1;
0153       // Note: fVoxelDepth==0+ => fVoxelAxisStack(0+) contains axes of voxel
0154       //       fVoxelDepth==-1 -> not in voxel
0155 
0156     std::vector<EAxis> fVoxelAxisStack;
0157       // Voxel axes
0158 
0159     std::vector<G4int> fVoxelNoSlicesStack;
0160       // No slices per voxel at each level
0161 
0162     std::vector<G4double> fVoxelSliceWidthStack; 
0163       // Width of voxels at each level 
0164 
0165     std::vector<G4int> fVoxelNodeNoStack;    
0166       // Node no point is inside at each level 
0167 
0168     std::vector<G4SmartVoxelHeader*> fVoxelHeaderStack;
0169       // Voxel headers at each level
0170 
0171     G4SmartVoxelNode* fVoxelNode = nullptr;
0172       // Node containing last located point
0173 
0174     //
0175     //  END Voxel Stack information
0176     //
0177 
0178     G4VoxelSafety* fpVoxelSafety = nullptr;
0179       // Helper object for Voxel Safety
0180 
0181     G4double fHalfTolerance;
0182       // Surface tolerance
0183 
0184     G4bool fBestSafety = false; 
0185 
0186     G4NavigationLogger* fLogger;
0187       // Verbosity logger
0188 };
0189 
0190 #include "G4VoxelNavigation.icc"
0191 
0192 #endif