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 //
0027 // class G4VoxelSafety
0028 //
0029 // Class description:
0030 //
0031 // Utility for isotropic safety in volumes containing only G4PVPlacement
0032 // daughter volumes for which voxels have been constructed.
0033 
0034 // History:
0035 // - Created. John Apostolakis,  30 April 2010
0036 // --------------------------------------------------------------------
0037 #ifndef G4VOXELSAFETY_HH
0038 #define G4VOXELSAFETY_HH
0039 
0040 #include "geomdefs.hh"
0041 #include "G4NavigationHistory.hh"
0042 #include "G4AffineTransform.hh"
0043 #include "G4VPhysicalVolume.hh"
0044 #include "G4LogicalVolume.hh"
0045 #include "G4VSolid.hh"
0046 #include "G4ThreeVector.hh"
0047 
0048 #include "G4BlockingList.hh"
0049 
0050 #include <vector>  // Required for voxel handling & voxel stack
0051 
0052 class G4SmartVoxelNode;
0053 class G4SmartVoxelHeader;
0054 
0055 class G4VoxelSafety
0056 {
0057   public:  // with description
0058 
0059     G4VoxelSafety();
0060     ~G4VoxelSafety();
0061 
0062     G4SmartVoxelNode* VoxelLocate( G4SmartVoxelHeader* pHead,
0063                              const G4ThreeVector& localPoint );
0064 
0065     G4double ComputeSafety( const G4ThreeVector&     localPoint,
0066                             const G4VPhysicalVolume& currentPhysical, 
0067                                   G4double           maxLength = DBL_MAX );
0068 
0069     inline G4int GetVerboseLevel() const { return fVerbose; } 
0070     inline void  SetVerboseLevel(G4int level) { fVerbose = level; } 
0071       //
0072       // If level>0 && G4VERBOSE, printout can occur
0073 
0074   protected:
0075 
0076     G4double  SafetyForVoxelHeader( const G4SmartVoxelHeader* pHead,
0077                                     const G4ThreeVector& localPoint,
0078                                     G4double maxLength,
0079                                     const G4VPhysicalVolume& currentPhysical,
0080                                     G4double distUpperDepth = 0.0,
0081                                     G4double previousMinSafety = DBL_MAX
0082                                    );
0083 
0084     G4double  SafetyForVoxelNode( const G4SmartVoxelNode *curVoxelNode,
0085                                   const G4ThreeVector& localPoint ); 
0086 
0087     G4SmartVoxelNode* VoxelLocateLight( G4SmartVoxelHeader* pHead,
0088                                   const G4ThreeVector& localPoint ) const;
0089   private:
0090 
0091     // BEGIN State - values used during computation of Safety 
0092     // 
0093     G4BlockingList fBlockList;
0094       // Blocked volumes
0095 
0096     G4LogicalVolume* fpMotherLogical = nullptr;
0097 
0098     //  BEGIN Voxel Stack information
0099     //
0100     G4int fVoxelDepth = -1;
0101       // Note: fVoxelDepth==0+ => fVoxelAxisStack(0+) contains axes of voxel
0102       //       fVoxelDepth==-1 -> not in voxel
0103 
0104     std::vector<EAxis> fVoxelAxisStack;
0105       // Voxel axes
0106 
0107     std::vector<G4int> fVoxelNoSlicesStack;
0108       // No slices per voxel at each level
0109 
0110     std::vector<G4double> fVoxelSliceWidthStack; 
0111       // Width of voxels at each level 
0112 
0113     std::vector<G4int> fVoxelNodeNoStack;    
0114       // Node no point is inside at each level 
0115 
0116     std::vector<const G4SmartVoxelHeader*> fVoxelHeaderStack;
0117       // Voxel headers at each level
0118 
0119     G4SmartVoxelNode* fVoxelNode = nullptr;
0120       // Node containing last located point
0121 
0122     //
0123     //  END Voxel Stack information
0124 
0125     G4bool fCheck = false;
0126     G4int fVerbose = 0;
0127     G4double kCarTolerance;
0128 };
0129 
0130 #endif