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