Geant4  10.01
G4CutTubs.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: G4CutTubs.hh 76263 2013-11-08 11:41:52Z gcosmo $
28 //
29 //
30 // --------------------------------------------------------------------
31 // GEANT 4 class header file
32 //
33 //
34 // G4CutTubs is a tube with possible cuts in +-Z.
35 // Implementation adapted from G4Tubs (subclass of G4Tubs) and
36 // from TGEo Ctube implementation (by A.Gheata, CERN)
37 //
38 // G4CutTubs(pName,pRMin,pRMax,pDZ,pSPhi,pEPhi,pLowNorm,pHighNorm)
39 // pName,pRMin,pRMax,pDZ,pSPhi,pEPhi are the same as for G4Tubs,
40 // pLowNorm=Outside Normal at -Z
41 // pHighNorm=Outsie Normal at +Z.
42 
43 // Author: Tatiana Nikitina, CERN
44 // --------------------------------------------------------------------
45 
46 #ifndef G4CUTTUBS_HH
47 #define G4CUTTUBS_HH
48 
49 #include "G4OTubs.hh"
50 
51 class G4CutTubs : public G4OTubs
52 {
53  public: // with description
54 
55  G4CutTubs( const G4String& pName,
56  G4double pRMin,
57  G4double pRMax,
58  G4double pDz,
59  G4double pSPhi,
60  G4double pDPhi,
61  G4ThreeVector pLowNorm,
62  G4ThreeVector pHighNorm );
63  //
64  // Constructs a tubs with the given name and dimensions
65 
66  ~G4CutTubs();
67  //
68  // Destructor
69 
70  // Accessors
71 
72  inline G4ThreeVector GetLowNorm () const;
73  inline G4ThreeVector GetHighNorm () const;
74 
75  // Methods for solid
76 
77  inline G4double GetCubicVolume();
78  inline G4double GetSurfaceArea();
79 
80  G4bool CalculateExtent( const EAxis pAxis,
81  const G4VoxelLimits& pVoxelLimit,
82  const G4AffineTransform& pTransform,
83  G4double& pmin, G4double& pmax ) const;
84 
85  EInside Inside( const G4ThreeVector& p ) const;
86 
87  G4ThreeVector SurfaceNormal( const G4ThreeVector& p ) const;
88 
89  G4double DistanceToIn(const G4ThreeVector& p, const G4ThreeVector& v) const;
90  G4double DistanceToIn(const G4ThreeVector& p) const;
92  const G4bool calcNorm=G4bool(false),
93  G4bool *validNorm=0, G4ThreeVector *n=0) const;
94  G4double DistanceToOut(const G4ThreeVector& p) const;
95 
97 
99 
100  G4VSolid* Clone() const;
101 
102  std::ostream& StreamInfo( std::ostream& os ) const;
103 
104  // Visualisation functions
105 
106  void DescribeYourselfTo ( G4VGraphicsScene& scene ) const;
107  G4Polyhedron* CreatePolyhedron () const;
108 
109  public: // without description
110 
111  G4CutTubs(__void__&);
112  //
113  // Fake default constructor for usage restricted to direct object
114  // persistency for clients requiring preallocation of memory for
115  // persistifiable objects.
116 
117  G4CutTubs(const G4CutTubs& rhs);
118  G4CutTubs& operator=(const G4CutTubs& rhs);
119  // Copy constructor and assignment operator.
120 
121  protected:
122 
124  CreateRotatedVertices( const G4AffineTransform& pTransform ) const;
125  //
126  // Creates the List of transformed vertices in the format required
127  // for G4VSolid:: ClipCrossSection and ClipBetweenSections
128 
130  //
131  // Algorithm for SurfaceNormal() following the original
132  // specification for points not on the surface
133 
134  G4bool IsCrossingCutPlanes() const;
135  // Check if the cutted planes are crossing.
136  // If 'true' , solid is ill defined
137 
138  G4double GetCutZ(const G4ThreeVector& p) const;
139  // Get Z value of the point on Cutted Plane
140 
141  void GetMaxMinZ(G4double& zmin,G4double& zmax)const;
142  // Get Max and Min values of Z on Cutted Plane,
143  // Used for Calculate Extent()
144 
145  private:
146 
148  //
149  // Normals of Cut at -/+ Dz
150 
152  //
153  // Flag for identification of section or full tube
154 
156  //
157  // Cached half tolerance values
158 };
159 
160 #include "G4CutTubs.icc"
161 
162 #endif
G4ThreeVectorList * CreateRotatedVertices(const G4AffineTransform &pTransform) const
Definition: G4CutTubs.cc:1760
CLHEP::Hep3Vector G4ThreeVector
G4double GetCubicVolume()
G4ThreeVector GetLowNorm() const
void GetMaxMinZ(G4double &zmin, G4double &zmax) const
Definition: G4CutTubs.cc:2075
G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const
Definition: G4CutTubs.cc:763
EInside Inside(const G4ThreeVector &p) const
Definition: G4CutTubs.cc:411
G4double GetSurfaceArea()
G4double DistanceToOut(const G4ThreeVector &p, const G4ThreeVector &v, const G4bool calcNorm=G4bool(false), G4bool *validNorm=0, G4ThreeVector *n=0) const
Definition: G4CutTubs.cc:1276
G4CutTubs & operator=(const G4CutTubs &rhs)
Definition: G4CutTubs.cc:173
G4VSolid * Clone() const
Definition: G4CutTubs.cc:1855
bool G4bool
Definition: G4Types.hh:79
G4ThreeVector SurfaceNormal(const G4ThreeVector &p) const
Definition: G4CutTubs.cc:518
std::ostream & StreamInfo(std::ostream &os) const
Definition: G4CutTubs.cc:1864
std::vector< G4ThreeVector > G4ThreeVectorList
Definition: G4VSolid.hh:79
const G4int n
G4bool fPhiFullCutTube
Definition: G4CutTubs.hh:151
G4double halfRadTolerance
Definition: G4CutTubs.hh:155
G4ThreeVector ApproxSurfaceNormal(const G4ThreeVector &p) const
Definition: G4CutTubs.cc:621
G4bool IsCrossingCutPlanes() const
Definition: G4CutTubs.cc:2028
G4GeometryType GetEntityType() const
Definition: G4CutTubs.cc:1846
G4ThreeVector fLowNorm
Definition: G4CutTubs.hh:147
EInside
Definition: geomdefs.hh:58
void DescribeYourselfTo(G4VGraphicsScene &scene) const
Definition: G4CutTubs.cc:1963
EAxis
Definition: geomdefs.hh:54
G4double halfCarTolerance
Definition: G4CutTubs.hh:155
G4ThreeVector GetHighNorm() const
G4double halfAngTolerance
Definition: G4CutTubs.hh:155
G4ThreeVector fHighNorm
Definition: G4CutTubs.hh:147
double G4double
Definition: G4Types.hh:76
G4Polyhedron * CreatePolyhedron() const
Definition: G4CutTubs.cc:1968
G4ThreeVector GetPointOnSurface() const
Definition: G4CutTubs.cc:1889
G4bool CalculateExtent(const EAxis pAxis, const G4VoxelLimits &pVoxelLimit, const G4AffineTransform &pTransform, G4double &pmin, G4double &pmax) const
Definition: G4CutTubs.cc:198
G4CutTubs(const G4String &pName, G4double pRMin, G4double pRMax, G4double pDz, G4double pSPhi, G4double pDPhi, G4ThreeVector pLowNorm, G4ThreeVector pHighNorm)
Definition: G4CutTubs.cc:61
G4double GetCutZ(const G4ThreeVector &p) const
Definition: G4CutTubs.cc:2051