Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
G4CSGSolid.cc
이 파일의 문서화 페이지로 가기
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: G4CSGSolid.cc 105315 2017-07-20 14:35:13Z gcosmo $
28 //
29 // --------------------------------------------------------------------
30 
31 #include <cmath>
32 
33 #include "G4CSGSolid.hh"
34 #include "Randomize.hh"
35 #include "G4RandomTools.hh"
36 #include "G4Polyhedron.hh"
37 
38 #include "G4AutoLock.hh"
39 
40 namespace
41 {
42  G4Mutex polyhedronMutex = G4MUTEX_INITIALIZER;
43 }
44 
46 //
47 // Constructor
48 // - Base class constructor
49 
51  G4VSolid(name), fCubicVolume(0.), fSurfaceArea(0.),
52  fRebuildPolyhedron(false), fpPolyhedron(0)
53 {
54 }
55 
57 //
58 // Fake default constructor - sets only member data and allocates memory
59 // for usage restricted to object persistency.
60 
62  : G4VSolid(a), fCubicVolume(0.), fSurfaceArea(0.),
63  fRebuildPolyhedron(false), fpPolyhedron(0)
64 {
65 }
66 
68 //
69 // Destructor
70 //
71 
73 {
74  delete fpPolyhedron; fpPolyhedron = 0;
75 }
76 
78 //
79 // Copy constructor
80 //
81 
83  : G4VSolid(rhs), fCubicVolume(rhs.fCubicVolume),
84  fSurfaceArea(rhs.fSurfaceArea), fRebuildPolyhedron(false), fpPolyhedron(0)
85 {
86 }
87 
89 //
90 // Assignment operator
91 
93 {
94  // Check assignment to self
95  //
96  if (this == &rhs) { return *this; }
97 
98  // Copy base class data
99  //
100  G4VSolid::operator=(rhs);
101 
102  // Copy data
103  //
106  fRebuildPolyhedron = false;
107  delete fpPolyhedron; fpPolyhedron = 0;
108 
109  return *this;
110 }
111 
113 {
114  return G4RandomRadiusInRing(rmin, rmax);
115 }
116 
117 std::ostream& G4CSGSolid::StreamInfo(std::ostream& os) const
118 {
119  os << "-----------------------------------------------------------\n"
120  << " *** Dump for solid - " << GetName() << " ***\n"
121  << " ===================================================\n"
122  << " Solid type: " << GetEntityType() << "\n"
123  << " Parameters: \n"
124  << " NOT available !\n"
125  << "-----------------------------------------------------------\n";
126 
127  return os;
128 }
129 
131 {
132  if (!fpPolyhedron ||
136  {
137  G4AutoLock l(&polyhedronMutex);
138  delete fpPolyhedron;
140  fRebuildPolyhedron = false;
141  l.unlock();
142  }
143  return fpPolyhedron;
144 }
G4Polyhedron * fpPolyhedron
Definition: G4CSGSolid.hh:81
const XML_Char * name
Definition: expat.h:151
std::vector< ExP01TrackerHit * > a
Definition: ExP01Classes.hh:33
virtual std::ostream & StreamInfo(std::ostream &os) const
Definition: G4CSGSolid.cc:117
G4CSGSolid & operator=(const G4CSGSolid &rhs)
Definition: G4CSGSolid.cc:92
G4double G4RandomRadiusInRing(G4double rmin, G4double rmax)
G4double GetRadiusInRing(G4double rmin, G4double rmax) const
Definition: G4CSGSolid.cc:112
G4VSolid & operator=(const G4VSolid &rhs)
Definition: G4VSolid.cc:110
double G4double
Definition: G4Types.hh:76
#define G4MUTEX_INITIALIZER
Definition: G4Threading.hh:88
static G4int GetNumberOfRotationSteps()
G4int GetNumberOfRotationStepsAtTimeOfCreation() const
G4String GetName() const
virtual G4Polyhedron * GetPolyhedron() const
Definition: G4CSGSolid.cc:130
G4CSGSolid(const G4String &pName)
Definition: G4CSGSolid.cc:50
virtual G4Polyhedron * CreatePolyhedron() const
Definition: G4VSolid.cc:660
virtual ~G4CSGSolid()
Definition: G4CSGSolid.cc:72
virtual G4GeometryType GetEntityType() const =0
G4double fSurfaceArea
Definition: G4CSGSolid.hh:79
G4double fCubicVolume
Definition: G4CSGSolid.hh:78
G4bool fRebuildPolyhedron
Definition: G4CSGSolid.hh:80
std::mutex G4Mutex
Definition: G4Threading.hh:84