Geant4  10.03
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 100820 2016-11-02 15:18:48Z 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  void Extent(G4ThreeVector& pMin, G4ThreeVector& pMax) const;
81 
82  G4bool CalculateExtent( const EAxis pAxis,
83  const G4VoxelLimits& pVoxelLimit,
84  const G4AffineTransform& pTransform,
85  G4double& pmin, G4double& pmax ) const;
86 
87  EInside Inside( const G4ThreeVector& p ) const;
88 
89  G4ThreeVector SurfaceNormal( const G4ThreeVector& p ) const;
90 
91  G4double DistanceToIn(const G4ThreeVector& p, const G4ThreeVector& v) const;
92  G4double DistanceToIn(const G4ThreeVector& p) const;
94  const G4bool calcNorm=G4bool(false),
95  G4bool *validNorm=0, G4ThreeVector *n=0) const;
96  G4double DistanceToOut(const G4ThreeVector& p) const;
97 
99 
101 
102  G4VSolid* Clone() const;
103 
104  std::ostream& StreamInfo( std::ostream& os ) const;
105 
106  // Visualisation functions
107 
108  void DescribeYourselfTo ( G4VGraphicsScene& scene ) const;
109  G4Polyhedron* CreatePolyhedron () const;
110 
111  public: // without description
112 
113  G4CutTubs(__void__&);
114  //
115  // Fake default constructor for usage restricted to direct object
116  // persistency for clients requiring preallocation of memory for
117  // persistifiable objects.
118 
119  G4CutTubs(const G4CutTubs& rhs);
120  G4CutTubs& operator=(const G4CutTubs& rhs);
121  // Copy constructor and assignment operator.
122 
123  protected:
124 
126  //
127  // Algorithm for SurfaceNormal() following the original
128  // specification for points not on the surface
129 
130  G4bool IsCrossingCutPlanes() const;
131  // Check if the cutted planes are crossing.
132  // If 'true' , solid is ill defined
133 
134  G4double GetCutZ(const G4ThreeVector& p) const;
135  // Get Z value of the point on Cutted Plane
136 
137  void GetMaxMinZ(G4double& zmin,G4double& zmax)const;
138  // Get Max and Min values of Z on Cutted Plane,
139  // Used for Calculate Extent()
140 
141  private:
142 
144  //
145  // Normals of Cut at -/+ Dz
146 
148  //
149  // Flag for identification of section or full tube
150 
152  //
153  // Cached half tolerance values
154 };
155 
156 #include "G4CutTubs.icc"
157 
158 #endif
CLHEP::Hep3Vector G4ThreeVector
G4double GetCubicVolume()
G4ThreeVector GetLowNorm() const
void GetMaxMinZ(G4double &zmin, G4double &zmax) const
Definition: G4CutTubs.cc:1945
G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const
Definition: G4CutTubs.cc:725
EInside Inside(const G4ThreeVector &p) const
Definition: G4CutTubs.cc:373
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:1238
G4CutTubs & operator=(const G4CutTubs &rhs)
Definition: G4CutTubs.cc:180
G4VSolid * Clone() const
Definition: G4CutTubs.cc:1725
bool G4bool
Definition: G4Types.hh:79
G4ThreeVector SurfaceNormal(const G4ThreeVector &p) const
Definition: G4CutTubs.cc:480
std::ostream & StreamInfo(std::ostream &os) const
Definition: G4CutTubs.cc:1734
const G4int n
G4bool fPhiFullCutTube
Definition: G4CutTubs.hh:147
G4double halfRadTolerance
Definition: G4CutTubs.hh:151
G4ThreeVector ApproxSurfaceNormal(const G4ThreeVector &p) const
Definition: G4CutTubs.cc:583
G4bool IsCrossingCutPlanes() const
Definition: G4CutTubs.cc:1898
G4GeometryType GetEntityType() const
Definition: G4CutTubs.cc:1716
G4ThreeVector fLowNorm
Definition: G4CutTubs.hh:143
EInside
Definition: geomdefs.hh:58
void DescribeYourselfTo(G4VGraphicsScene &scene) const
Definition: G4CutTubs.cc:1833
EAxis
Definition: geomdefs.hh:54
G4double halfCarTolerance
Definition: G4CutTubs.hh:151
G4ThreeVector GetHighNorm() const
G4double halfAngTolerance
Definition: G4CutTubs.hh:151
void Extent(G4ThreeVector &pMin, G4ThreeVector &pMax) const
Definition: G4CutTubs.cc:205
G4ThreeVector fHighNorm
Definition: G4CutTubs.hh:143
double G4double
Definition: G4Types.hh:76
G4Polyhedron * CreatePolyhedron() const
Definition: G4CutTubs.cc:1838
G4ThreeVector GetPointOnSurface() const
Definition: G4CutTubs.cc:1759
G4bool CalculateExtent(const EAxis pAxis, const G4VoxelLimits &pVoxelLimit, const G4AffineTransform &pTransform, G4double &pmin, G4double &pmax) const
Definition: G4CutTubs.cc:262
G4CutTubs(const G4String &pName, G4double pRMin, G4double pRMax, G4double pDz, G4double pSPhi, G4double pDPhi, G4ThreeVector pLowNorm, G4ThreeVector pHighNorm)
Definition: G4CutTubs.cc:65
G4double GetCutZ(const G4ThreeVector &p) const
Definition: G4CutTubs.cc:1921