Geant4  10.03
G4Polycone.hh
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: G4Polycone.hh 100819 2016-11-02 15:17:36Z gcosmo $
28 //
29 //
30 // --------------------------------------------------------------------
31 // GEANT 4 class header file
32 //
33 //
34 // G4Polycone
35 //
36 // Class description:
37 //
38 // Class implementing a CSG-like type "PCON" Geant 3.21 volume,
39 // inherited from class G4VCSGfaceted:
40 //
41 // G4Polycone( const G4String& name,
42 // G4double phiStart, // initial phi starting angle
43 // G4double phiTotal, // total phi angle
44 // G4int numZPlanes, // number of z planes
45 // const G4double zPlane[], // position of z planes
46 // const G4double rInner[], // tangent distance to inner surface
47 // const G4double rOuter[]) // tangent distance to outer surface
48 //
49 // Alternative constructor, but limited to increasing-only Z sections:
50 //
51 // G4Polycone( const G4String& name,
52 // G4double phiStart, // initial phi starting angle
53 // G4double phiTotal, // total phi angle
54 // G4int numRZ, // number corners in r,z space
55 // const G4double r[], // r coordinate of these corners
56 // const G4double z[]) // z coordinate of these corners
57 
58 // Author:
59 // David C. Williams (davidw@scipp.ucsc.edu)
60 // --------------------------------------------------------------------
61 #ifndef G4Polycone_hh
62 #define G4Polycone_hh
63 
64 #if defined(G4GEOM_USE_USOLIDS)
65 #define G4GEOM_USE_UPOLYCONE 1
66 #endif
67 
68 #if defined(G4GEOM_USE_UPOLYCONE)
69  #define G4UPolycone G4Polycone
70  #include "G4UPolycone.hh"
71 #else
72 
73 #include "G4VCSGfaceted.hh"
74 #include "G4PolyconeSide.hh"
75 #include "G4PolyconeHistorical.hh"
76 #include "G4Polyhedron.hh"
77 
79 class G4ReduciblePolygon;
80 class G4VCSGface;
81 
82 class G4Polycone : public G4VCSGfaceted
83 {
84 
85  public: // with description
86 
87  G4Polycone( const G4String& name,
88  G4double phiStart, // initial phi starting angle
89  G4double phiTotal, // total phi angle
90  G4int numZPlanes, // number of z planes
91  const G4double zPlane[], // position of z planes
92  const G4double rInner[], // tangent distance to inner surface
93  const G4double rOuter[] ); // tangent distance to outer surface
94 
95  G4Polycone( const G4String& name,
96  G4double phiStart, // initial phi starting angle
97  G4double phiTotal, // total phi angle
98  G4int numRZ, // number corners in r,z space
99  const G4double r[], // r coordinate of these corners
100  const G4double z[] ); // z coordinate of these corners
101 
102  virtual ~G4Polycone();
103 
104  // Methods for solid
105 
106  EInside Inside( const G4ThreeVector &p ) const;
107  G4double DistanceToIn( const G4ThreeVector &p, const G4ThreeVector &v ) const;
108  G4double DistanceToIn( const G4ThreeVector &p ) const;
109 
110  void Extent(G4ThreeVector& pMin, G4ThreeVector& pMax) const;
111  G4bool CalculateExtent(const EAxis pAxis,
112  const G4VoxelLimits& pVoxelLimit,
113  const G4AffineTransform& pTransform,
114  G4double& pmin, G4double& pmax) const;
115 
117 
119  const G4int n,
120  const G4VPhysicalVolume* pRep );
121 
123 
124  G4VSolid* Clone() const;
125 
126  std::ostream& StreamInfo(std::ostream& os) const;
127 
129 
130  G4bool Reset();
131 
132  // Accessors
133 
134  inline G4double GetStartPhi() const;
135  inline G4double GetEndPhi() const;
136  inline G4double GetSinStartPhi() const;
137  inline G4double GetCosStartPhi() const;
138  inline G4double GetSinEndPhi() const;
139  inline G4double GetCosEndPhi() const;
140  inline G4bool IsOpen() const;
141  inline G4int GetNumRZCorner() const;
142  inline G4PolyconeSideRZ GetCorner(G4int index) const;
144  inline void SetOriginalParameters(G4PolyconeHistorical* pars);
145 
146  public: // without description
147 
148  G4Polycone(__void__&);
149  // Fake default constructor for usage restricted to direct object
150  // persistency for clients requiring preallocation of memory for
151  // persistifiable objects.
152 
153  G4Polycone( const G4Polycone &source );
154  G4Polycone &operator=( const G4Polycone &source );
155  // Copy constructor and assignment operator.
156 
157  protected: // without description
158 
159  // Generic initializer, called by all constructors
160 
162 
163  void Create( G4double phiStart, // initial phi starting angle
164  G4double phiTotal, // total phi angle
165  G4ReduciblePolygon *rz ); // r/z coordinate of these corners
166 
167  void CopyStuff( const G4Polycone &source );
168 
169  // Methods for random point generation
170 
172  G4double fRmin2, G4double fRmax2,
173  G4double zOne, G4double zTwo,
174  G4double& totArea) const;
175 
177  G4double zOne, G4double zTwo,
178  G4double& totArea) const;
179 
181  G4double fRMin2, G4double fRMax2,
182  G4double zOne, G4double zTwo,
183  G4double& totArea) const;
184 
186  G4double fRMin2, G4double fRMax2,
187  G4double zOne) const;
188 
189  protected: // without description
190 
191  // Here are our parameters
192 
193  G4double startPhi; // Starting phi value (0 < phiStart < 2pi)
194  G4double endPhi; // end phi value (0 < endPhi-phiStart < 2pi)
195  G4bool phiIsOpen; // true if there is a phi segment
196  G4int numCorner; // number RZ points
197  G4PolyconeSideRZ *corners; // corner r,z points
198  G4PolyconeHistorical *original_parameters; // original input parameters
199 
200  // Our quick test
201 
203 
204 };
205 
206 #include "G4Polycone.icc"
207 
208 #endif
209 
210 #endif
G4Polyhedron * CreatePolyhedron() const
Definition: G4Polycone.cc:1086
void ComputeDimensions(G4VPVParameterisation *p, const G4int n, const G4VPhysicalVolume *pRep)
Definition: G4Polycone.cc:704
CLHEP::Hep3Vector G4ThreeVector
G4bool IsOpen() const
G4ThreeVector GetPointOnSurface() const
Definition: G4Polycone.cc:998
G4double endPhi
Definition: G4Polycone.hh:194
G4ThreeVector GetPointOnRing(G4double fRMin, G4double fRMax, G4double fRMin2, G4double fRMax2, G4double zOne) const
Definition: G4Polycone.cc:936
G4int GetNumRZCorner() const
G4double GetSinStartPhi() const
G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const
Definition: G4Polycone.cc:498
const char * name(G4int ptype)
G4PolyconeSideRZ * corners
Definition: G4Polycone.hh:197
G4double GetEndPhi() const
int G4int
Definition: G4Types.hh:78
std::ostream & StreamInfo(std::ostream &os) const
Definition: G4Polycone.cc:730
G4ThreeVector GetPointOnCone(G4double fRmin1, G4double fRmax1, G4double fRmin2, G4double fRmax2, G4double zOne, G4double zTwo, G4double &totArea) const
Definition: G4Polycone.cc:782
G4GeometryType GetEntityType() const
Definition: G4Polycone.cc:714
G4ThreeVector GetPointOnCut(G4double fRMin1, G4double fRMax1, G4double fRMin2, G4double fRMax2, G4double zOne, G4double zTwo, G4double &totArea) const
Definition: G4Polycone.cc:979
G4Polycone & operator=(const G4Polycone &source)
Definition: G4Polycone.cc:383
G4bool CalculateExtent(const EAxis pAxis, const G4VoxelLimits &pVoxelLimit, const G4AffineTransform &pTransform, G4double &pmin, G4double &pmax) const
Definition: G4Polycone.cc:574
G4double startPhi
Definition: G4Polycone.hh:193
bool G4bool
Definition: G4Types.hh:79
virtual ~G4Polycone()
Definition: G4Polycone.cc:362
void SetOriginalParameters(G4PolyconeHistorical *pars)
void Extent(G4ThreeVector &pMin, G4ThreeVector &pMax) const
Definition: G4Polycone.cc:526
EInside Inside(const G4ThreeVector &p) const
Definition: G4Polycone.cc:478
const G4int n
G4double GetCosStartPhi() const
G4PolyconeHistorical * GetOriginalParameters() const
G4double GetStartPhi() const
G4bool Reset()
Definition: G4Polycone.cc:447
G4double GetCosEndPhi() const
G4VSolid * Clone() const
Definition: G4Polycone.cc:722
void CopyStuff(const G4Polycone &source)
Definition: G4Polycone.cc:403
EInside
Definition: geomdefs.hh:58
G4EnclosingCylinder * enclosingCylinder
Definition: G4Polycone.hh:202
EAxis
Definition: geomdefs.hh:54
G4double GetSinEndPhi() const
G4ThreeVector GetPointOnTubs(G4double fRMin, G4double fRMax, G4double zOne, G4double zTwo, G4double &totArea) const
Definition: G4Polycone.cc:877
G4Polycone(const G4String &name, G4double phiStart, G4double phiTotal, G4int numZPlanes, const G4double zPlane[], const G4double rInner[], const G4double rOuter[])
Definition: G4Polycone.cc:63
G4bool phiIsOpen
Definition: G4Polycone.hh:195
G4int numCorner
Definition: G4Polycone.hh:196
void Create(G4double phiStart, G4double phiTotal, G4ReduciblePolygon *rz)
Definition: G4Polycone.cc:181
double G4double
Definition: G4Types.hh:76
G4PolyconeHistorical * original_parameters
Definition: G4Polycone.hh:198
G4PolyconeSideRZ GetCorner(G4int index) const