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 // Class Description: 00033 // 00034 // A singleton class for computation and storage of the tolerance values 00035 // used by the geometry modeler for precision on boundaries. 00036 // The Cartesian tolerance defines the thickness of the surface of the 00037 // geometrical shapes for their inner funtions and for the tracking. The 00038 // tolerance must be greater than the largest mathematical error from the 00039 // shape distance calculation functions. The tolerance is centred on the 00040 // surface, e.g. the Inside() method of a solid uses a tolerance dx +/- kTol/2. 00041 // The Cartesian tolerance can either be set to a fixed value (1E-9 mm) 00042 // or to a value computed on the basis of the maximum extent of the 00043 // world volume assigned through the G4GeometryManager at the beginning 00044 // of the application -before- any geometrical object is created. 00045 00046 // ---------------- G4GeometryTolerance ---------------- 00047 // 00048 // Author: G.Cosmo (CERN), October 2006 00049 // ------------------------------------------------------------ 00050 00051 #ifndef G4GeometryTolerance_hh 00052 #define G4GeometryTolerance_hh 00053 00054 #include "G4Types.hh" 00055 00056 class G4GeometryTolerance 00057 { 00058 friend class G4GeometryManager; 00059 00060 public: // with description 00061 00062 static G4GeometryTolerance* GetInstance(); 00063 // Get a pointer to the unique G4GeometryTolerance, 00064 // creating it if necessary and setting the tolerances. 00065 G4double GetSurfaceTolerance() const; 00066 // Returns the current Cartesian tolerance of a surface. 00067 G4double GetAngularTolerance() const; 00068 // Returns the current angular tolerance. 00069 G4double GetRadialTolerance() const; 00070 // Returns the current radial tolerance. 00071 00072 protected: 00073 00074 static void SetSurfaceTolerance(G4double worldExtent); 00075 // Sets the Cartesian surface tolerance to a value computed 00076 // from the maximum extent of the world volume. This method 00077 // can be called only once, and is done only through the 00078 // G4GeometryManager class. 00079 00080 G4GeometryTolerance(); 00081 ~G4GeometryTolerance(); 00082 // Protected constructor and destructor. 00083 00084 private: 00085 00086 static G4GeometryTolerance* fInstance; 00087 static G4double fCarTolerance; 00088 static G4double fAngTolerance; 00089 static G4double fRadTolerance; 00090 static G4bool fInitialised; 00091 }; 00092 00093 #endif // G4GeometryTolerance_hh 00094