G4GeomTestVolume.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 // GEANT 4 class header file
00031 //
00032 // G4GeomTestVolume
00033 //
00034 // Class description:
00035 //
00036 // Checks for inconsistencies in the geometric boundaries of a physical
00037 // volume and the boundaries of all its immediate daughters.
00038 
00039 // Author: D.C.Williams, UCSC (davidw@scipp.ucsc.edu)
00040 // --------------------------------------------------------------------
00041 #ifndef G4GeomTestVolume_hh
00042 #define G4GeomTestVolume_hh
00043 
00044 #include "G4ThreeVector.hh"
00045 #include "G4VisExtent.hh"
00046 #include "G4GeomTestOverlapList.hh"
00047 #include "G4GeomTestOvershootList.hh"
00048 
00049 #include <map>
00050 
00051 class G4VPhysicalVolume;
00052 class G4GeomTestLogger;
00053 
00054 class G4GeomTestVolume
00055 {
00056   public:  // with description
00057 
00058     G4GeomTestVolume( const G4VPhysicalVolume *theTarget,
00059                             G4GeomTestLogger *theLogger,
00060                             G4double theTolerance=1E-4 );  // mm
00061     ~G4GeomTestVolume();
00062       // Constructor and destructor
00063 
00064     G4double GetTolerance() const;
00065     void SetTolerance(G4double tolerance);
00066       // Get/Set error tolerance (default set to 1E-4*mm)
00067 
00068     void TestCartGridXYZ( G4int nx=100, G4int ny=100, G4int nz=100 );
00069     void TestCartGridX( G4int ny=100, G4int nz=100 );
00070     void TestCartGridY( G4int nz=100, G4int nx=100 );
00071     void TestCartGridZ( G4int nx=100, G4int ny=100 );
00072       // Test using a grid of lines parallel to a cartesian axis
00073   
00074     void TestCartGrid( const G4ThreeVector &g1,
00075                        const G4ThreeVector &g2,
00076                        const G4ThreeVector &v,
00077                              G4int n1, 
00078                              G4int n2 );
00079       // Test using a grid of parallel lines
00080       //  g1 = First grid axis
00081       //  g2 = Second grid axis
00082       //  v  = Direction of lines
00083       //  n1 = Number of grid points along g1
00084       //  n2 = Number of grid points along g2
00085       // The spread of the grid points are automatically calculated
00086       // based on the extent of the solid
00087 
00088     void TestRecursiveCartGrid( G4int nx=100, G4int ny=100, G4int nz=100,
00089                                 G4int sLevel=0, G4int depth=-1 );
00090       // Test using a grid, propagating recursively to the daughters, with
00091       // possibility of specifying the initial level in the volume tree and
00092       // the depth (default is the whole tree).
00093       // Be careful: depending on the complexity of the geometry, this
00094       // could require long computational time
00095 
00096     void TestCylinder( G4int nPhi=90, G4int nZ=50, G4int nRho=50,
00097                        G4double fracZ=0.8,  G4double fracRho=0.8,
00098                        G4bool usePhi=false    );
00099       // Test using a set of lines in a cylindrical
00100       // pattern of gradually increasing mesh size
00101       //       nPhi    = Number lines per phi
00102       //       nZ      = Number of z points
00103       //       nRho    = Number of rho points
00104       //       fracZ   = Fraction scale for points along z
00105       //       fracRho = Fraction scale for points along rho
00106       //       usePhi  = Include phi set of lines
00107       // Define a set of rho values such that:
00108       //       rho0 = Size of volume
00109       //       rho1 = frac*rho0
00110       //       rho2 = frac*rho1
00111       //       ... etc
00112       // And define a set of z values
00113       //       z0   = z size of volume
00114       //       z1   = fracZ*z0
00115       //       z2   = fracZ*z1
00116       //       .... etc
00117       // And define a set of nPhi phi values, evenly
00118       // distributed in phi
00119       //
00120       // Three sets of lines are tested:
00121       //   * Imagine the set of lines parallel to the z axis
00122       //     through each rho point, at a phi angle taken the
00123       //     set of phi angles
00124       //   * Imagine the set of lines running perpendicular
00125       //     to the z axis and through a point on the z axis
00126       //     at +/- each z point and at an angle taken from the
00127       //     set of phi values
00128       //   * If usePhi==true, now take each pair of lines from the 
00129       //     above two sets and imagine the line through the
00130       //     intersection and perpendicular to both
00131 
00132     void TestRecursiveCylinder( G4int nPhi=90, G4int nZ=50, G4int nRho=50,
00133                                 G4double fracZ=0.8,  G4double fracRho=0.8,
00134                                 G4bool usePhi=false,
00135                                 G4int sLevel=0, G4int depth=-1 );
00136       // Test using a set of lines in a cylindrical pattern of gradually
00137       // increasing mesh size, propagating recursively to the daughters, with
00138       // possibility of specifying the initial level in the volume tree and
00139       // the depth (default is the whole tree).
00140       // Be careful: depending on the complexity of the geometry, this
00141       // could require long computational time
00142 
00143     void TestOneLine( const G4ThreeVector &p, const G4ThreeVector &v );
00144       // Test using a single line, specified by a point and direction,
00145       // in the coordinate system of the target volume
00146 
00147     void TestRecursiveLine( const G4ThreeVector &p, const G4ThreeVector &v,
00148                             G4int sLevel=0, G4int depth=-1 );
00149       // Test using a single line, specified by a point and direction,
00150       // propagating recursively to the daughters, with possibility of
00151       // specifying the initial level in the volume tree and
00152       // the depth (default is the whole tree).
00153 
00154     void ReportErrors();
00155       // Tabulate and report all errors so far encountered
00156 
00157     void ClearErrors();
00158       // Clear list of errors
00159   
00160   protected:
00161 
00162     const G4VPhysicalVolume *target;  // Target volume
00163     G4GeomTestLogger *logger;         // Error logger
00164     G4double tolerance;               // Error tolerance
00165     G4VisExtent extent;               // Geometric extent of volume
00166   
00167     std::map<G4long,G4GeomTestOverlapList> overlaps;
00168       // A list of overlap errors, keyed by the
00169       // daughter1*numDaughter+daughter2, where daughter1
00170       // is the smaller of the two daughter indices
00171 
00172     std::map<G4long,G4GeomTestOvershootList> overshoots;
00173       // A list of overshoot errors, keyed by the
00174       // daughter number
00175 };
00176 
00177 #endif

Generated on Mon May 27 17:48:22 2013 for Geant4 by  doxygen 1.4.7