| 1 | //
|
|---|
| 2 | // ********************************************************************
|
|---|
| 3 | // * License and Disclaimer *
|
|---|
| 4 | // * *
|
|---|
| 5 | // * The Geant4 software is copyright of the Copyright Holders of *
|
|---|
| 6 | // * the Geant4 Collaboration. It is provided under the terms and *
|
|---|
| 7 | // * conditions of the Geant4 Software License, included in the file *
|
|---|
| 8 | // * LICENSE and available at http://cern.ch/geant4/license . These *
|
|---|
| 9 | // * include a list of copyright holders. *
|
|---|
| 10 | // * *
|
|---|
| 11 | // * Neither the authors of this software system, nor their employing *
|
|---|
| 12 | // * institutes,nor the agencies providing financial support for this *
|
|---|
| 13 | // * work make any representation or warranty, express or implied, *
|
|---|
| 14 | // * regarding this software system or assume any liability for its *
|
|---|
| 15 | // * use. Please see the license in the file LICENSE and URL above *
|
|---|
| 16 | // * for the full disclaimer and the limitation of liability. *
|
|---|
| 17 | // * *
|
|---|
| 18 | // * This code implementation is the result of the scientific and *
|
|---|
| 19 | // * technical work of the GEANT4 collaboration. *
|
|---|
| 20 | // * By using, copying, modifying or distributing the software (or *
|
|---|
| 21 | // * any work based on the software) you agree to acknowledge its *
|
|---|
| 22 | // * use in resulting scientific publications, and indicate your *
|
|---|
| 23 | // * acceptance of all terms of the Geant4 Software license. *
|
|---|
| 24 | // ********************************************************************
|
|---|
| 25 | //
|
|---|
| 26 | //
|
|---|
| 27 | // $Id: G4VoxelNavigation.hh,v 1.5 2007/05/11 13:43:59 gcosmo Exp $
|
|---|
| 28 | // GEANT4 tag $Name: geant4-09-03 $
|
|---|
| 29 | //
|
|---|
| 30 | //
|
|---|
| 31 | // class G4VoxelNavigation
|
|---|
| 32 | //
|
|---|
| 33 | // Class description:
|
|---|
| 34 | //
|
|---|
| 35 | // Utility for navigation in volumes containing only G4PVPlacement
|
|---|
| 36 | // daughter volumes for which voxels have been constructed.
|
|---|
| 37 |
|
|---|
| 38 | // History:
|
|---|
| 39 | // - Created. Paul Kent, Aug 96
|
|---|
| 40 | // --------------------------------------------------------------------
|
|---|
| 41 | #ifndef G4VOXELNAVIGATION_HH
|
|---|
| 42 | #define G4VOXELNAVIGATION_HH
|
|---|
| 43 |
|
|---|
| 44 | #include "geomdefs.hh"
|
|---|
| 45 | #include "G4NavigationHistory.hh"
|
|---|
| 46 | #include "G4AffineTransform.hh"
|
|---|
| 47 | #include "G4VPhysicalVolume.hh"
|
|---|
| 48 | #include "G4LogicalVolume.hh"
|
|---|
| 49 | #include "G4VSolid.hh"
|
|---|
| 50 | #include "G4ThreeVector.hh"
|
|---|
| 51 |
|
|---|
| 52 | #include "G4BlockingList.hh"
|
|---|
| 53 |
|
|---|
| 54 | // Required for inline implementation
|
|---|
| 55 | //
|
|---|
| 56 | #include "G4AuxiliaryNavServices.hh"
|
|---|
| 57 |
|
|---|
| 58 | // Required for voxel handling & voxel stack
|
|---|
| 59 | //
|
|---|
| 60 | #include <vector>
|
|---|
| 61 | #include "G4SmartVoxelProxy.hh"
|
|---|
| 62 | #include "G4SmartVoxelNode.hh"
|
|---|
| 63 | #include "G4SmartVoxelHeader.hh"
|
|---|
| 64 |
|
|---|
| 65 | class G4VoxelNavigation
|
|---|
| 66 | {
|
|---|
| 67 | public: // with description
|
|---|
| 68 |
|
|---|
| 69 | G4VoxelNavigation();
|
|---|
| 70 | virtual ~G4VoxelNavigation();
|
|---|
| 71 |
|
|---|
| 72 | G4SmartVoxelNode* VoxelLocate( G4SmartVoxelHeader* pHead,
|
|---|
| 73 | const G4ThreeVector& localPoint );
|
|---|
| 74 |
|
|---|
| 75 | virtual G4bool LevelLocate( G4NavigationHistory& history,
|
|---|
| 76 | const G4VPhysicalVolume* blockedVol,
|
|---|
| 77 | const G4int blockedNum,
|
|---|
| 78 | const G4ThreeVector& globalPoint,
|
|---|
| 79 | const G4ThreeVector* globalDirection,
|
|---|
| 80 | const G4bool pLocatedOnEdge,
|
|---|
| 81 | G4ThreeVector& localPoint );
|
|---|
| 82 |
|
|---|
| 83 | virtual G4double ComputeStep( const G4ThreeVector& globalPoint,
|
|---|
| 84 | const G4ThreeVector& globalDirection,
|
|---|
| 85 | const G4double currentProposedStepLength,
|
|---|
| 86 | G4double& newSafety,
|
|---|
| 87 | G4NavigationHistory& history,
|
|---|
| 88 | G4bool& validExitNormal,
|
|---|
| 89 | G4ThreeVector& exitNormal,
|
|---|
| 90 | G4bool& exiting,
|
|---|
| 91 | G4bool& entering,
|
|---|
| 92 | G4VPhysicalVolume *(*pBlockedPhysical),
|
|---|
| 93 | G4int& blockedReplicaNo );
|
|---|
| 94 |
|
|---|
| 95 | virtual G4double ComputeSafety( const G4ThreeVector& globalpoint,
|
|---|
| 96 | const G4NavigationHistory& history,
|
|---|
| 97 | const G4double pMaxLength=DBL_MAX );
|
|---|
| 98 |
|
|---|
| 99 | inline G4int GetVerboseLevel() const;
|
|---|
| 100 | inline void SetVerboseLevel(G4int level);
|
|---|
| 101 | // Get/Set Verbose(ness) level.
|
|---|
| 102 | // [if level>0 && G4VERBOSE, printout can occur]
|
|---|
| 103 |
|
|---|
| 104 | inline void CheckMode(G4bool mode);
|
|---|
| 105 | // Run navigation in "check-mode", therefore using additional
|
|---|
| 106 | // verifications and more strict correctness conditions.
|
|---|
| 107 | // Is effective only with G4VERBOSE set.
|
|---|
| 108 |
|
|---|
| 109 | protected:
|
|---|
| 110 |
|
|---|
| 111 | G4double ComputeVoxelSafety( const G4ThreeVector& localPoint ) const;
|
|---|
| 112 | G4bool LocateNextVoxel( const G4ThreeVector& localPoint,
|
|---|
| 113 | const G4ThreeVector& localDirection,
|
|---|
| 114 | const G4double currentStep );
|
|---|
| 115 |
|
|---|
| 116 | G4BlockingList fBList;
|
|---|
| 117 | // Blocked volumes
|
|---|
| 118 |
|
|---|
| 119 | //
|
|---|
| 120 | // BEGIN Voxel Stack information
|
|---|
| 121 | //
|
|---|
| 122 |
|
|---|
| 123 | G4int fVoxelDepth;
|
|---|
| 124 | // Note: fVoxelDepth==0+ => fVoxelAxisStack(0+) contains axes of voxel
|
|---|
| 125 | // fVoxelDepth==-1 -> not in voxel
|
|---|
| 126 |
|
|---|
| 127 | std::vector<EAxis> fVoxelAxisStack;
|
|---|
| 128 | // Voxel axes
|
|---|
| 129 |
|
|---|
| 130 | std::vector<G4int> fVoxelNoSlicesStack;
|
|---|
| 131 | // No slices per voxel at each level
|
|---|
| 132 |
|
|---|
| 133 | std::vector<G4double> fVoxelSliceWidthStack;
|
|---|
| 134 | // Width of voxels at each level
|
|---|
| 135 |
|
|---|
| 136 | std::vector<G4int> fVoxelNodeNoStack;
|
|---|
| 137 | // Node no point is inside at each level
|
|---|
| 138 |
|
|---|
| 139 | std::vector<G4SmartVoxelHeader*> fVoxelHeaderStack;
|
|---|
| 140 | // Voxel headers at each level
|
|---|
| 141 |
|
|---|
| 142 | G4SmartVoxelNode* fVoxelNode;
|
|---|
| 143 | // Node containing last located point
|
|---|
| 144 |
|
|---|
| 145 | //
|
|---|
| 146 | // END Voxel Stack information
|
|---|
| 147 | //
|
|---|
| 148 |
|
|---|
| 149 | G4bool fCheck;
|
|---|
| 150 | G4int fVerbose;
|
|---|
| 151 | G4double kCarTolerance;
|
|---|
| 152 | };
|
|---|
| 153 |
|
|---|
| 154 | #include "G4VoxelNavigation.icc"
|
|---|
| 155 |
|
|---|
| 156 | #endif
|
|---|