G4VoxelNavigation.hh

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 //
00027 // $Id$
00028 //
00029 // 
00030 // class G4VoxelNavigation
00031 //
00032 // Class description:
00033 //
00034 // Utility for navigation in volumes containing only G4PVPlacement
00035 // daughter volumes for which voxels have been constructed.
00036 
00037 // History:
00038 // - Created. Paul Kent, Aug 96
00039 // --------------------------------------------------------------------
00040 #ifndef G4VOXELNAVIGATION_HH
00041 #define G4VOXELNAVIGATION_HH
00042 
00043 #include "geomdefs.hh"
00044 #include "G4NavigationHistory.hh"
00045 #include "G4NavigationLogger.hh"
00046 #include "G4AffineTransform.hh"
00047 #include "G4VPhysicalVolume.hh"
00048 #include "G4LogicalVolume.hh"
00049 #include "G4VSolid.hh"
00050 #include "G4ThreeVector.hh"
00051 
00052 #include "G4BlockingList.hh"
00053 
00054 class G4VoxelSafety; 
00055 
00056 // Required for inline implementation
00057 //
00058 #include "G4AuxiliaryNavServices.hh"
00059 
00060 // Required for voxel handling & voxel stack
00061 //
00062 #include <vector>
00063 #include "G4SmartVoxelProxy.hh"
00064 #include "G4SmartVoxelNode.hh"
00065 #include "G4SmartVoxelHeader.hh"
00066 
00067 class G4VoxelNavigation
00068 {
00069   public:  // with description
00070 
00071     G4VoxelNavigation();
00072     virtual ~G4VoxelNavigation();
00073 
00074     G4SmartVoxelNode* VoxelLocate( G4SmartVoxelHeader* pHead,
00075                              const G4ThreeVector& localPoint );
00076 
00077     virtual G4bool LevelLocate( G4NavigationHistory& history,
00078                           const G4VPhysicalVolume* blockedVol,
00079                           const G4int blockedNum,
00080                           const G4ThreeVector& globalPoint,
00081                           const G4ThreeVector* globalDirection,
00082                           const G4bool pLocatedOnEdge, 
00083                                 G4ThreeVector& localPoint );
00084 
00085     virtual G4double ComputeStep( const G4ThreeVector& globalPoint,
00086                                   const G4ThreeVector& globalDirection,
00087                                   const G4double currentProposedStepLength,
00088                                         G4double& newSafety,
00089                                         G4NavigationHistory& history,
00090                                         G4bool& validExitNormal,
00091                                         G4ThreeVector& exitNormal,
00092                                         G4bool& exiting,
00093                                         G4bool& entering,
00094                                         G4VPhysicalVolume *(*pBlockedPhysical),
00095                                         G4int& blockedReplicaNo );
00096 
00097     virtual G4double ComputeSafety( const G4ThreeVector& globalpoint,
00098                                     const G4NavigationHistory& history,
00099                                     const G4double pMaxLength=DBL_MAX );
00100 
00101     inline G4int GetVerboseLevel() const;
00102     void  SetVerboseLevel(G4int level);
00103       // Get/Set Verbose(ness) level.
00104       // [if level>0 && G4VERBOSE, printout can occur]
00105 
00106     inline void  CheckMode(G4bool mode);
00107       // Run navigation in "check-mode", therefore using additional
00108       // verifications and more strict correctness conditions.
00109       // Is effective only with G4VERBOSE set.
00110 
00111     inline void  EnableBestSafety( G4bool flag= false );
00112       // Enable best-possible evaluation of isotropic safety
00113 
00114   protected:
00115 
00116     G4double ComputeVoxelSafety( const G4ThreeVector& localPoint ) const;
00117     G4bool LocateNextVoxel( const G4ThreeVector& localPoint,
00118                             const G4ThreeVector& localDirection,
00119                             const G4double currentStep );
00120 
00121     G4SmartVoxelNode* VoxelLocateLight( G4SmartVoxelHeader* pHead,
00122                                         const G4ThreeVector& localPoint ) const;
00123 
00124   private:  // Logging functions
00125 
00126     void PreComputeStepLog  (const G4VPhysicalVolume* motherPhysical,
00127                                    G4double motherSafety,
00128                              const G4ThreeVector& localPoint);
00129     void AlongComputeStepLog(const G4VSolid* sampleSolid,
00130                              const G4ThreeVector& samplePoint,
00131                              const G4ThreeVector& sampleDirection,
00132                              const G4ThreeVector& localDirection,
00133                                    G4double sampleSafety,
00134                                    G4double sampleStep);
00135     void PostComputeStepLog (const G4VSolid* motherSolid,
00136                              const G4ThreeVector& localPoint,
00137                              const G4ThreeVector& localDirection,
00138                                    G4double motherStep,
00139                                    G4double motherSafety);
00140     void ComputeSafetyLog   (const G4VSolid* solid,
00141                              const G4ThreeVector& point,
00142                                    G4double safety,
00143                                    G4bool banner);
00144     inline void PrintDaughterLog (const G4VSolid* sampleSolid,
00145                                   const G4ThreeVector& samplePoint,
00146                                         G4double sampleSafety,
00147                                         G4double sampleStep);   
00148   protected:
00149 
00150     G4BlockingList fBList;
00151       // Blocked volumes
00152 
00153     //
00154     //  BEGIN Voxel Stack information
00155     //
00156 
00157     G4int fVoxelDepth;
00158       // Note: fVoxelDepth==0+ => fVoxelAxisStack(0+) contains axes of voxel
00159       //       fVoxelDepth==-1 -> not in voxel
00160 
00161     std::vector<EAxis> fVoxelAxisStack;
00162       // Voxel axes
00163 
00164     std::vector<G4int> fVoxelNoSlicesStack;
00165       // No slices per voxel at each level
00166 
00167     std::vector<G4double> fVoxelSliceWidthStack; 
00168       // Width of voxels at each level 
00169 
00170     std::vector<G4int> fVoxelNodeNoStack;    
00171       // Node no point is inside at each level 
00172 
00173     std::vector<G4SmartVoxelHeader*> fVoxelHeaderStack;
00174       // Voxel headers at each level
00175 
00176     G4SmartVoxelNode* fVoxelNode;
00177       // Node containing last located point
00178 
00179     //
00180     //  END Voxel Stack information
00181     //
00182 
00183     G4VoxelSafety  *fpVoxelSafety;
00184     //  Helper object for Voxel Safety
00185 
00186     G4bool fCheck;
00187     G4bool fBestSafety; 
00188 
00189     G4NavigationLogger* fLogger;
00190       // Verbosity logger
00191 };
00192 
00193 #include "G4VoxelNavigation.icc"
00194 
00195 #endif

Generated on Mon May 27 17:50:18 2013 for Geant4 by  doxygen 1.4.7