Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4Trd.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: G4Trd.hh 69788 2013-05-15 12:06:57Z gcosmo $
28 //
29 //
30 // --------------------------------------------------------------------
31 // GEANT 4 class header file
32 //
33 //
34 // G4Trd
35 //
36 // Class description:
37 //
38 // A G4Trd is a trapezoid with the x and y dimensions varying along z
39 // functions:
40 //
41 // Member Data:
42 //
43 // fDx1 Half-length along x at the surface positioned at -dz
44 // fDx2 Half-length along x at the surface positioned at +dz
45 // fDy1 Half-length along y at the surface positioned at -dz
46 // fDy2 Half-length along y at the surface positioned at +dz
47 // fDz Half-length along z axis
48 
49 // History:
50 // 12.01.95 P.Kent: Old prototype code converted to thick geometry
51 // 17.02.95 P.Kent: Exiting normal return
52 // 19.08.96 P.Kent, V.Grichine: Fs in accordance with G4Box
53 // 21.04.97 J.Apostolakis: Added Set Methods
54 // 19.11.99 V.Grichine: kUndefined was added to Eside enum
55 // --------------------------------------------------------------------
56 
57 #ifndef G4TRD_HH
58 #define G4TRD_HH
59 
60 #include "G4CSGSolid.hh"
61 
62 class G4Trd : public G4CSGSolid
63 {
64  public: // with description
65 
66  G4Trd( const G4String& pName,
67  G4double pdx1, G4double pdx2,
68  G4double pdy1, G4double pdy2,
69  G4double pdz );
70  //
71  // Constructs a trapezoid with name, and half lengths
72 
73  ~G4Trd();
74  //
75  // Destructor
76 
77  // Accessors
78 
79  inline G4double GetXHalfLength1() const;
80  inline G4double GetXHalfLength2() const;
81  inline G4double GetYHalfLength1() const;
82  inline G4double GetYHalfLength2() const;
83  inline G4double GetZHalfLength() const;
84 
85  // Modifiers
86 
87  inline void SetXHalfLength1(G4double val);
88  inline void SetXHalfLength2(G4double val);
89  inline void SetYHalfLength1(G4double val);
90  inline void SetYHalfLength2(G4double val);
91  inline void SetZHalfLength(G4double val);
92 
93  // Methods of solid
94 
95  inline G4double GetCubicVolume();
96  inline G4double GetSurfaceArea();
97 
99  const G4int n,
100  const G4VPhysicalVolume* pRep );
101 
102  G4bool CalculateExtent( const EAxis pAxis,
103  const G4VoxelLimits& pVoxelLimit,
104  const G4AffineTransform& pTransform,
105  G4double& pMin, G4double& pMax ) const;
106 
107  EInside Inside( const G4ThreeVector& p ) const;
108 
109  G4ThreeVector SurfaceNormal( const G4ThreeVector& p ) const;
110 
112  const G4ThreeVector& v ) const;
113 
114  G4double DistanceToIn( const G4ThreeVector& p ) const;
115 
117  const G4ThreeVector& v,
118  const G4bool calcNorm=false,
119  G4bool *validNorm=0,
120  G4ThreeVector *n=0 ) const;
121 
122  G4double DistanceToOut( const G4ThreeVector& p ) const;
123 
124  void CheckAndSetAllParameters ( G4double pdx1, G4double pdx2,
125  G4double pdy1, G4double pdy2,
126  G4double pdz );
127 
128  void SetAllParameters ( G4double pdx1, G4double pdx2,
129  G4double pdy1, G4double pdy2,
130  G4double pdz );
131 
133 
135 
136  G4VSolid* Clone() const;
137 
138  std::ostream& StreamInfo( std::ostream& os ) const;
139 
140  // Visualisation functions
141 
142  void DescribeYourselfTo (G4VGraphicsScene& scene) const;
143  G4Polyhedron* CreatePolyhedron () const;
144  G4NURBS* CreateNURBS () const;
145 
146  public: // without description
147 
149  // Codes for faces (kPX=plus x face,kMY= minus y face etc)
150 
151  G4Trd(__void__&);
152  // Fake default constructor for usage restricted to direct object
153  // persistency for clients requiring preallocation of memory for
154  // persistifiable objects.
155 
156  G4Trd(const G4Trd& rhs);
157  G4Trd& operator=(const G4Trd& rhs);
158  // Copy constructor and assignment operator.
159 
161  CreateRotatedVertices( const G4AffineTransform& pTransform ) const;
162  //
163  // Creates the List of transformed vertices in the format required
164  // for G4CSGSolid:: ClipCrossSection and ClipBetweenSections
165 
167  // Algorithm for SurfaceNormal() following the original
168  // specification for points not on the surface
169 
170  private:
171 
172  G4double fDx1,fDx2,fDy1,fDy2,fDz;
173 };
174 
175 #include "G4Trd.icc"
176 
177 #endif