Geant4  10.03
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 99509 2016-09-26 07:48:56Z 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 #if defined(G4GEOM_USE_USOLIDS)
61 #define G4GEOM_USE_UTRD 1
62 #endif
63 
64 #if defined(G4GEOM_USE_UTRD)
65  #define G4UTrd G4Trd
66  #include "G4UTrd.hh"
67 #else
68 
69 #include "G4CSGSolid.hh"
70 #include "G4Polyhedron.hh"
71 
72 class G4Trd : public G4CSGSolid
73 {
74  public: // with description
75 
76  G4Trd( const G4String& pName,
77  G4double pdx1, G4double pdx2,
78  G4double pdy1, G4double pdy2,
79  G4double pdz );
80  //
81  // Constructs a trapezoid with name, and half lengths
82 
83  ~G4Trd();
84  //
85  // Destructor
86 
87  // Accessors
88 
89  inline G4double GetXHalfLength1() const;
90  inline G4double GetXHalfLength2() const;
91  inline G4double GetYHalfLength1() const;
92  inline G4double GetYHalfLength2() const;
93  inline G4double GetZHalfLength() const;
94 
95  // Modifiers
96 
97  inline void SetXHalfLength1(G4double val);
98  inline void SetXHalfLength2(G4double val);
99  inline void SetYHalfLength1(G4double val);
100  inline void SetYHalfLength2(G4double val);
101  inline void SetZHalfLength(G4double val);
102 
103  // Methods of solid
104 
105  inline G4double GetCubicVolume();
106  inline G4double GetSurfaceArea();
107 
109  const G4int n,
110  const G4VPhysicalVolume* pRep );
111 
112  void Extent(G4ThreeVector& pMin, G4ThreeVector& pMax) const;
113 
114  G4bool CalculateExtent( const EAxis pAxis,
115  const G4VoxelLimits& pVoxelLimit,
116  const G4AffineTransform& pTransform,
117  G4double& pMin, G4double& pMax ) const;
118 
119  EInside Inside( const G4ThreeVector& p ) const;
120 
121  G4ThreeVector SurfaceNormal( const G4ThreeVector& p ) const;
122 
124  const G4ThreeVector& v ) const;
125 
126  G4double DistanceToIn( const G4ThreeVector& p ) const;
127 
129  const G4ThreeVector& v,
130  const G4bool calcNorm=false,
131  G4bool *validNorm=0,
132  G4ThreeVector *n=0 ) const;
133 
134  G4double DistanceToOut( const G4ThreeVector& p ) const;
135 
136  void CheckAndSetAllParameters ( G4double pdx1, G4double pdx2,
137  G4double pdy1, G4double pdy2,
138  G4double pdz );
139 
140  void SetAllParameters ( G4double pdx1, G4double pdx2,
141  G4double pdy1, G4double pdy2,
142  G4double pdz );
143 
145 
147 
148  G4VSolid* Clone() const;
149 
150  std::ostream& StreamInfo( std::ostream& os ) const;
151 
152  // Visualisation functions
153 
154  void DescribeYourselfTo (G4VGraphicsScene& scene) const;
155  G4Polyhedron* CreatePolyhedron () const;
156 
157  public: // without description
158 
160  // Codes for faces (kPX=plus x face,kMY= minus y face etc)
161 
162  G4Trd(__void__&);
163  // Fake default constructor for usage restricted to direct object
164  // persistency for clients requiring preallocation of memory for
165  // persistifiable objects.
166 
167  G4Trd(const G4Trd& rhs);
168  G4Trd& operator=(const G4Trd& rhs);
169  // Copy constructor and assignment operator.
170 
172  // Algorithm for SurfaceNormal() following the original
173  // specification for points not on the surface
174 
175  private:
176 
178 };
179 
180 #include "G4Trd.icc"
181 
182 #endif
183 
184 #endif
void DescribeYourselfTo(G4VGraphicsScene &scene) const
Definition: G4Trd.cc:1328
void SetAllParameters(G4double pdx1, G4double pdx2, G4double pdy1, G4double pdy2, G4double pdz)
Definition: G4Trd.cc:173
G4double fDy2
Definition: G4Trd.hh:177
~G4Trd()
Definition: G4Trd.cc:132
ESide
Definition: G4Trd.hh:159
G4double GetYHalfLength1() const
CLHEP::Hep3Vector G4ThreeVector
void SetXHalfLength2(G4double val)
std::ostream & StreamInfo(std::ostream &os) const
Definition: G4Trd.cc:1238
G4GeometryType GetEntityType() const
Definition: G4Trd.cc:1220
Definition: G4Trd.hh:72
void SetZHalfLength(G4double val)
G4double GetZHalfLength() const
int G4int
Definition: G4Types.hh:78
G4VSolid * Clone() const
Definition: G4Trd.cc:1229
G4ThreeVector GetPointOnSurface() const
Definition: G4Trd.cc:1265
G4ThreeVector ApproxSurfaceNormal(const G4ThreeVector &p) const
Definition: G4Trd.cc:410
G4double GetXHalfLength2() const
G4double fDy1
Definition: G4Trd.hh:177
void SetYHalfLength1(G4double val)
void Extent(G4ThreeVector &pMin, G4ThreeVector &pMax) const
Definition: G4Trd.cc:196
G4Polyhedron * CreatePolyhedron() const
Definition: G4Trd.cc:1333
G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const
Definition: G4Trd.cc:503
G4double GetCubicVolume()
bool G4bool
Definition: G4Types.hh:79
EInside Inside(const G4ThreeVector &p) const
Definition: G4Trd.cc:278
G4double GetYHalfLength2() const
const G4int n
G4double fDx2
Definition: G4Trd.hh:177
EInside
Definition: geomdefs.hh:58
EAxis
Definition: geomdefs.hh:54
G4double DistanceToOut(const G4ThreeVector &p, const G4ThreeVector &v, const G4bool calcNorm=false, G4bool *validNorm=0, G4ThreeVector *n=0) const
Definition: G4Trd.cc:776
void CheckAndSetAllParameters(G4double pdx1, G4double pdx2, G4double pdy1, G4double pdy2, G4double pdz)
Definition: G4Trd.cc:77
G4Trd & operator=(const G4Trd &rhs)
Definition: G4Trd.cc:150
void ComputeDimensions(G4VPVParameterisation *p, const G4int n, const G4VPhysicalVolume *pRep)
Definition: G4Trd.cc:185
G4ThreeVector SurfaceNormal(const G4ThreeVector &p) const
Definition: G4Trd.cc:341
G4double GetXHalfLength1() const
void SetXHalfLength1(G4double val)
G4Trd(const G4String &pName, G4double pdx1, G4double pdx2, G4double pdy1, G4double pdy2, G4double pdz)
Definition: G4Trd.cc:64
void SetYHalfLength2(G4double val)
G4bool CalculateExtent(const EAxis pAxis, const G4VoxelLimits &pVoxelLimit, const G4AffineTransform &pTransform, G4double &pMin, G4double &pMax) const
Definition: G4Trd.cc:227
double G4double
Definition: G4Types.hh:76
G4double fDz
Definition: G4Trd.hh:177
G4double fDx1
Definition: G4Trd.hh:177
G4double GetSurfaceArea()