Geant4_10
G4VoxelSafety.hh
Go to the documentation of this file.
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 // $Id: G4VoxelSafety.hh 66356 2012-12-18 09:02:32Z gcosmo $
27 //
28 // class G4VoxelSafety
29 //
30 // Class description:
31 //
32 // Utility for isotropic safety in volumes containing only G4PVPlacement
33 // daughter volumes for which voxels have been constructed.
34 
35 // History:
36 // - Created. John Apostolakis, 30 April 2010
37 // --------------------------------------------------------------------
38 #ifndef G4VOXELSAFETY_HH
39 #define G4VOXELSAFETY_HH
40 
41 #include "geomdefs.hh"
42 #include "G4NavigationHistory.hh"
43 #include "G4AffineTransform.hh"
44 #include "G4VPhysicalVolume.hh"
45 #include "G4LogicalVolume.hh"
46 #include "G4VSolid.hh"
47 #include "G4ThreeVector.hh"
48 
49 #include "G4BlockingList.hh"
50 
51 #include <vector> // Required for voxel handling & voxel stack
52 
53 class G4SmartVoxelNode;
54 class G4SmartVoxelHeader;
55 
57 {
58  public: // with description
59 
60  G4VoxelSafety();
62 
64  const G4ThreeVector& localPoint );
65 
66  G4double ComputeSafety( const G4ThreeVector& localPoint,
67  const G4VPhysicalVolume& currentPhysical,
68  G4double maxLength=DBL_MAX );
69 
70  inline G4int GetVerboseLevel() const { return fVerbose; }
71  inline void SetVerboseLevel(G4int level) { fVerbose= level; }
72  //
73  // If level>0 && G4VERBOSE, printout can occur
74 
75  protected:
76 
78  const G4ThreeVector& localPoint,
79  G4double maxLength,
80  const G4VPhysicalVolume& currentPhysical,
81  G4double distUpperDepth = 0.0,
82  G4double previousMinSafety= DBL_MAX
83  );
84 
85  G4double SafetyForVoxelNode( const G4SmartVoxelNode *curVoxelNode,
86  const G4ThreeVector& localPoint );
87 
89  const G4ThreeVector& localPoint ) const;
90  private:
91 
92  // BEGIN State - values used during computation of Safety
93  //
94  G4BlockingList fBlockList;
95  // Blocked volumes
96 
97  G4LogicalVolume* fpMotherLogical;
98 
99  // BEGIN Voxel Stack information
100  //
101  G4int fVoxelDepth;
102  // Note: fVoxelDepth==0+ => fVoxelAxisStack(0+) contains axes of voxel
103  // fVoxelDepth==-1 -> not in voxel
104 
105  std::vector<EAxis> fVoxelAxisStack;
106  // Voxel axes
107 
108  std::vector<G4int> fVoxelNoSlicesStack;
109  // No slices per voxel at each level
110 
111  std::vector<G4double> fVoxelSliceWidthStack;
112  // Width of voxels at each level
113 
114  std::vector<G4int> fVoxelNodeNoStack;
115  // Node no point is inside at each level
116 
117  std::vector<const G4SmartVoxelHeader*> fVoxelHeaderStack;
118  // Voxel headers at each level
119 
120  G4SmartVoxelNode* fVoxelNode;
121  // Node containing last located point
122 
123  //
124  // END Voxel Stack information
125 
126  G4bool fCheck;
127  G4int fVerbose;
128  G4double kCarTolerance;
129 };
130 
131 #endif
G4SmartVoxelNode * VoxelLocate(G4SmartVoxelHeader *pHead, const G4ThreeVector &localPoint)
G4double SafetyForVoxelNode(const G4SmartVoxelNode *curVoxelNode, const G4ThreeVector &localPoint)
G4double SafetyForVoxelHeader(const G4SmartVoxelHeader *pHead, const G4ThreeVector &localPoint, G4double maxLength, const G4VPhysicalVolume &currentPhysical, G4double distUpperDepth=0.0, G4double previousMinSafety=DBL_MAX)
G4int GetVerboseLevel() const
G4double ComputeSafety(const G4ThreeVector &localPoint, const G4VPhysicalVolume &currentPhysical, G4double maxLength=DBL_MAX)
G4SmartVoxelNode * VoxelLocateLight(G4SmartVoxelHeader *pHead, const G4ThreeVector &localPoint) const
int G4int
Definition: G4Types.hh:78
bool G4bool
Definition: G4Types.hh:79
void SetVerboseLevel(G4int level)
double G4double
Definition: G4Types.hh:76
#define DBL_MAX
Definition: templates.hh:83