Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4GeometryTolerance.cc
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//
27// $Id$
28//
29// class G4GeometryTolerance
30//
31// Implementation
32//
33// Author:
34// 30.10.06 - G.Cosmo, first implementation
35// --------------------------------------------------------------------
36
38#include "G4SystemOfUnits.hh"
39#include "globals.hh"
40
41
42// ***************************************************************************
43// Static class data
44// ***************************************************************************
45//
46G4GeometryTolerance* G4GeometryTolerance::fInstance = 0;
47G4bool G4GeometryTolerance::fInitialised = false;
48G4double G4GeometryTolerance::fCarTolerance = 1E-9*mm;
49G4double G4GeometryTolerance::fAngTolerance = 1E-9*rad;
50G4double G4GeometryTolerance::fRadTolerance = 1E-9*mm;
51
52// ***************************************************************************
53// Constructor.
54// ***************************************************************************
55//
57{
58}
59
60// ***************************************************************************
61// Empty destructor.
62// ***************************************************************************
63//
65{
66}
67
68// ***************************************************************************
69// Returns the instance of the singleton.
70// Creates it in case it's called for the first time.
71// ***************************************************************************
72//
74{
75 static G4GeometryTolerance theToleranceManager;
76 if (!fInstance)
77 {
78 fInstance = &theToleranceManager;
79 }
80 return fInstance;
81}
82
83// ***************************************************************************
84// Accessors.
85// ***************************************************************************
86//
88{
89 return fCarTolerance;
90}
91
93{
94 return fAngTolerance;
95}
96
98{
99 return fRadTolerance;
100}
101
102// ***************************************************************************
103// Sets the tolerance to a value computed on the basis of the world volume
104// extent provided as argument. The method can be called only once.
105// ***************************************************************************
106//
108{
109 if (!fInitialised)
110 {
111 fCarTolerance = worldExtent*1E-11;
112 fInitialised = true;
113 }
114 else
115 {
116 G4cout << "WARNING - G4GeometryTolerance::SetSurfaceTolerance()" << G4endl
117 << " Tolerance can only be set once. Currently set to: "
118 << fCarTolerance/mm << " mm." << G4endl;
119 G4Exception("G4GeometryTolerance::SetSurfaceTolerance()",
120 "NotApplicable", JustWarning,
121 "The tolerance has been already set!");
122 }
123}
@ JustWarning
double G4double
Definition: G4Types.hh:64
bool G4bool
Definition: G4Types.hh:67
#define G4endl
Definition: G4ios.hh:52
G4DLLIMPORT std::ostream G4cout
G4double GetSurfaceTolerance() const
G4double GetRadialTolerance() const
static void SetSurfaceTolerance(G4double worldExtent)
static G4GeometryTolerance * GetInstance()
G4double GetAngularTolerance() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41