| 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: G4GeomTestVolume.hh,v 1.3 2006/06/29 18:35:57 gunter Exp $
|
|---|
| 28 | // GEANT4 tag $Name: HEAD $
|
|---|
| 29 | //
|
|---|
| 30 | // --------------------------------------------------------------------
|
|---|
| 31 | // GEANT 4 class header file
|
|---|
| 32 | //
|
|---|
| 33 | // G4GeomTestVolume
|
|---|
| 34 | //
|
|---|
| 35 | // Class description:
|
|---|
| 36 | //
|
|---|
| 37 | // Checks for inconsistencies in the geometric boundaries of a physical
|
|---|
| 38 | // volume and the boundaries of all its immediate daughters.
|
|---|
| 39 |
|
|---|
| 40 | // Author: D.C.Williams, UCSC (davidw@scipp.ucsc.edu)
|
|---|
| 41 | // --------------------------------------------------------------------
|
|---|
| 42 | #ifndef G4GeomTestVolume_hh
|
|---|
| 43 | #define G4GeomTestVolume_hh
|
|---|
| 44 |
|
|---|
| 45 | #include "G4ThreeVector.hh"
|
|---|
| 46 | #include "G4VisExtent.hh"
|
|---|
| 47 | #include "G4GeomTestOverlapList.hh"
|
|---|
| 48 | #include "G4GeomTestOvershootList.hh"
|
|---|
| 49 |
|
|---|
| 50 | #include <map>
|
|---|
| 51 |
|
|---|
| 52 | class G4VPhysicalVolume;
|
|---|
| 53 | class G4GeomTestLogger;
|
|---|
| 54 |
|
|---|
| 55 | class G4GeomTestVolume
|
|---|
| 56 | {
|
|---|
| 57 | public: // with description
|
|---|
| 58 |
|
|---|
| 59 | G4GeomTestVolume( const G4VPhysicalVolume *theTarget,
|
|---|
| 60 | G4GeomTestLogger *theLogger,
|
|---|
| 61 | G4double theTolerance=1E-4*mm );
|
|---|
| 62 | ~G4GeomTestVolume();
|
|---|
| 63 | // Constructor and destructor
|
|---|
| 64 |
|
|---|
| 65 | G4double GetTolerance() const;
|
|---|
| 66 | void SetTolerance(G4double tolerance);
|
|---|
| 67 | // Get/Set error tolerance (default set to 1E-4*mm)
|
|---|
| 68 |
|
|---|
| 69 | void TestCartGridXYZ( G4int nx=100, G4int ny=100, G4int nz=100 );
|
|---|
| 70 | void TestCartGridX( G4int ny=100, G4int nz=100 );
|
|---|
| 71 | void TestCartGridY( G4int nz=100, G4int nx=100 );
|
|---|
| 72 | void TestCartGridZ( G4int nx=100, G4int ny=100 );
|
|---|
| 73 | // Test using a grid of lines parallel to a cartesian axis
|
|---|
| 74 |
|
|---|
| 75 | void TestCartGrid( const G4ThreeVector &g1,
|
|---|
| 76 | const G4ThreeVector &g2,
|
|---|
| 77 | const G4ThreeVector &v,
|
|---|
| 78 | G4int n1,
|
|---|
| 79 | G4int n2 );
|
|---|
| 80 | // Test using a grid of parallel lines
|
|---|
| 81 | // g1 = First grid axis
|
|---|
| 82 | // g2 = Second grid axis
|
|---|
| 83 | // v = Direction of lines
|
|---|
| 84 | // n1 = Number of grid points along g1
|
|---|
| 85 | // n2 = Number of grid points along g2
|
|---|
| 86 | // The spread of the grid points are automatically calculated
|
|---|
| 87 | // based on the extent of the solid
|
|---|
| 88 |
|
|---|
| 89 | void TestRecursiveCartGrid( G4int nx=100, G4int ny=100, G4int nz=100,
|
|---|
| 90 | G4int sLevel=0, G4int depth=-1 );
|
|---|
| 91 | // Test using a grid, propagating recursively to the daughters, with
|
|---|
| 92 | // possibility of specifying the initial level in the volume tree and
|
|---|
| 93 | // the depth (default is the whole tree).
|
|---|
| 94 | // Be careful: depending on the complexity of the geometry, this
|
|---|
| 95 | // could require long computational time
|
|---|
| 96 |
|
|---|
| 97 | void TestCylinder( G4int nPhi=90, G4int nZ=50, G4int nRho=50,
|
|---|
| 98 | G4double fracZ=0.8, G4double fracRho=0.8,
|
|---|
| 99 | G4bool usePhi=false );
|
|---|
| 100 | // Test using a set of lines in a cylindrical
|
|---|
| 101 | // pattern of gradually increasing mesh size
|
|---|
| 102 | // nPhi = Number lines per phi
|
|---|
| 103 | // nZ = Number of z points
|
|---|
| 104 | // nRho = Number of rho points
|
|---|
| 105 | // fracZ = Fraction scale for points along z
|
|---|
| 106 | // fracRho = Fraction scale for points along rho
|
|---|
| 107 | // usePhi = Include phi set of lines
|
|---|
| 108 | // Define a set of rho values such that:
|
|---|
| 109 | // rho0 = Size of volume
|
|---|
| 110 | // rho1 = frac*rho0
|
|---|
| 111 | // rho2 = frac*rho1
|
|---|
| 112 | // ... etc
|
|---|
| 113 | // And define a set of z values
|
|---|
| 114 | // z0 = z size of volume
|
|---|
| 115 | // z1 = fracZ*z0
|
|---|
| 116 | // z2 = fracZ*z1
|
|---|
| 117 | // .... etc
|
|---|
| 118 | // And define a set of nPhi phi values, evenly
|
|---|
| 119 | // distributed in phi
|
|---|
| 120 | //
|
|---|
| 121 | // Three sets of lines are tested:
|
|---|
| 122 | // * Imagine the set of lines parallel to the z axis
|
|---|
| 123 | // through each rho point, at a phi angle taken the
|
|---|
| 124 | // set of phi angles
|
|---|
| 125 | // * Imagine the set of lines running perpendicular
|
|---|
| 126 | // to the z axis and through a point on the z axis
|
|---|
| 127 | // at +/- each z point and at an angle taken from the
|
|---|
| 128 | // set of phi values
|
|---|
| 129 | // * If usePhi==true, now take each pair of lines from the
|
|---|
| 130 | // above two sets and imagine the line through the
|
|---|
| 131 | // intersection and perpendicular to both
|
|---|
| 132 |
|
|---|
| 133 | void TestRecursiveCylinder( G4int nPhi=90, G4int nZ=50, G4int nRho=50,
|
|---|
| 134 | G4double fracZ=0.8, G4double fracRho=0.8,
|
|---|
| 135 | G4bool usePhi=false,
|
|---|
| 136 | G4int sLevel=0, G4int depth=-1 );
|
|---|
| 137 | // Test using a set of lines in a cylindrical pattern of gradually
|
|---|
| 138 | // increasing mesh size, propagating recursively to the daughters, with
|
|---|
| 139 | // possibility of specifying the initial level in the volume tree and
|
|---|
| 140 | // the depth (default is the whole tree).
|
|---|
| 141 | // Be careful: depending on the complexity of the geometry, this
|
|---|
| 142 | // could require long computational time
|
|---|
| 143 |
|
|---|
| 144 | void TestOneLine( const G4ThreeVector &p, const G4ThreeVector &v );
|
|---|
| 145 | // Test using a single line, specified by a point and direction,
|
|---|
| 146 | // in the coordinate system of the target volume
|
|---|
| 147 |
|
|---|
| 148 | void TestRecursiveLine( const G4ThreeVector &p, const G4ThreeVector &v,
|
|---|
| 149 | G4int sLevel=0, G4int depth=-1 );
|
|---|
| 150 | // Test using a single line, specified by a point and direction,
|
|---|
| 151 | // propagating recursively to the daughters, with possibility of
|
|---|
| 152 | // specifying the initial level in the volume tree and
|
|---|
| 153 | // the depth (default is the whole tree).
|
|---|
| 154 |
|
|---|
| 155 | void ReportErrors();
|
|---|
| 156 | // Tabulate and report all errors so far encountered
|
|---|
| 157 |
|
|---|
| 158 | void ClearErrors();
|
|---|
| 159 | // Clear list of errors
|
|---|
| 160 |
|
|---|
| 161 | protected:
|
|---|
| 162 |
|
|---|
| 163 | const G4VPhysicalVolume *target; // Target volume
|
|---|
| 164 | G4GeomTestLogger *logger; // Error logger
|
|---|
| 165 | G4double tolerance; // Error tolerance
|
|---|
| 166 | G4VisExtent extent; // Geometric extent of volume
|
|---|
| 167 |
|
|---|
| 168 | std::map<G4long,G4GeomTestOverlapList> overlaps;
|
|---|
| 169 | // A list of overlap errors, keyed by the
|
|---|
| 170 | // daughter1*numDaughter+daughter2, where daughter1
|
|---|
| 171 | // is the smaller of the two daughter indices
|
|---|
| 172 |
|
|---|
| 173 | std::map<G4long,G4GeomTestOvershootList> overshoots;
|
|---|
| 174 | // A list of overshoot errors, keyed by the
|
|---|
| 175 | // daughter number
|
|---|
| 176 | };
|
|---|
| 177 |
|
|---|
| 178 | #endif
|
|---|