Geant4  10.02
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 79491 2014-03-05 15:24:29Z 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  G4bool CalculateExtent( const EAxis pAxis,
113  const G4VoxelLimits& pVoxelLimit,
114  const G4AffineTransform& pTransform,
115  G4double& pMin, G4double& pMax ) const;
116 
117  EInside Inside( const G4ThreeVector& p ) const;
118 
119  G4ThreeVector SurfaceNormal( const G4ThreeVector& p ) const;
120 
122  const G4ThreeVector& v ) const;
123 
124  G4double DistanceToIn( const G4ThreeVector& p ) const;
125 
127  const G4ThreeVector& v,
128  const G4bool calcNorm=false,
129  G4bool *validNorm=0,
130  G4ThreeVector *n=0 ) const;
131 
132  G4double DistanceToOut( const G4ThreeVector& p ) const;
133 
134  void CheckAndSetAllParameters ( G4double pdx1, G4double pdx2,
135  G4double pdy1, G4double pdy2,
136  G4double pdz );
137 
138  void SetAllParameters ( G4double pdx1, G4double pdx2,
139  G4double pdy1, G4double pdy2,
140  G4double pdz );
141 
143 
145 
146  G4VSolid* Clone() const;
147 
148  std::ostream& StreamInfo( std::ostream& os ) const;
149 
150  // Visualisation functions
151 
152  void DescribeYourselfTo (G4VGraphicsScene& scene) const;
153  G4Polyhedron* CreatePolyhedron () const;
154 
155  public: // without description
156 
158  // Codes for faces (kPX=plus x face,kMY= minus y face etc)
159 
160  G4Trd(__void__&);
161  // Fake default constructor for usage restricted to direct object
162  // persistency for clients requiring preallocation of memory for
163  // persistifiable objects.
164 
165  G4Trd(const G4Trd& rhs);
166  G4Trd& operator=(const G4Trd& rhs);
167  // Copy constructor and assignment operator.
168 
170  CreateRotatedVertices( const G4AffineTransform& pTransform ) const;
171  //
172  // Creates the List of transformed vertices in the format required
173  // for G4CSGSolid:: ClipCrossSection and ClipBetweenSections
174 
176  // Algorithm for SurfaceNormal() following the original
177  // specification for points not on the surface
178 
179  private:
180 
182 };
183 
184 #include "G4Trd.icc"
185 
186 #endif
187 
188 #endif
void DescribeYourselfTo(G4VGraphicsScene &scene) const
Definition: G4Trd.cc:1465
void SetAllParameters(G4double pdx1, G4double pdx2, G4double pdy1, G4double pdy2, G4double pdz)
Definition: G4Trd.cc:168
G4ThreeVectorList * CreateRotatedVertices(const G4AffineTransform &pTransform) const
Definition: G4Trd.cc:1318
G4double fDy2
Definition: G4Trd.hh:181
~G4Trd()
Definition: G4Trd.cc:127
ESide
Definition: G4Trd.hh:157
G4double GetYHalfLength1() const
CLHEP::Hep3Vector G4ThreeVector
void SetXHalfLength2(G4double val)
std::ostream & StreamInfo(std::ostream &os) const
Definition: G4Trd.cc:1375
G4GeometryType GetEntityType() const
Definition: G4Trd.cc:1357
Definition: G4Trd.hh:72
void SetZHalfLength(G4double val)
G4double GetZHalfLength() const
int G4int
Definition: G4Types.hh:78
G4VSolid * Clone() const
Definition: G4Trd.cc:1366
G4ThreeVector GetPointOnSurface() const
Definition: G4Trd.cc:1402
G4ThreeVector ApproxSurfaceNormal(const G4ThreeVector &p) const
Definition: G4Trd.cc:502
G4double GetXHalfLength2() const
G4double fDy1
Definition: G4Trd.hh:181
void SetYHalfLength1(G4double val)
G4Polyhedron * CreatePolyhedron() const
Definition: G4Trd.cc:1470
G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const
Definition: G4Trd.cc:595
G4double GetCubicVolume()
bool G4bool
Definition: G4Types.hh:79
std::vector< G4ThreeVector > G4ThreeVectorList
Definition: G4VSolid.hh:79
EInside Inside(const G4ThreeVector &p) const
Definition: G4Trd.cc:370
G4double GetYHalfLength2() const
const G4int n
G4double fDx2
Definition: G4Trd.hh:181
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:868
void CheckAndSetAllParameters(G4double pdx1, G4double pdx2, G4double pdy1, G4double pdy2, G4double pdz)
Definition: G4Trd.cc:72
G4Trd & operator=(const G4Trd &rhs)
Definition: G4Trd.cc:145
void ComputeDimensions(G4VPVParameterisation *p, const G4int n, const G4VPhysicalVolume *pRep)
Definition: G4Trd.cc:180
G4ThreeVector SurfaceNormal(const G4ThreeVector &p) const
Definition: G4Trd.cc:433
G4double GetXHalfLength1() const
void SetXHalfLength1(G4double val)
G4Trd(const G4String &pName, G4double pdx1, G4double pdx2, G4double pdy1, G4double pdy2, G4double pdz)
Definition: G4Trd.cc:59
void SetYHalfLength2(G4double val)
G4bool CalculateExtent(const EAxis pAxis, const G4VoxelLimits &pVoxelLimit, const G4AffineTransform &pTransform, G4double &pMin, G4double &pMax) const
Definition: G4Trd.cc:192
double G4double
Definition: G4Types.hh:76
G4double fDz
Definition: G4Trd.hh:181
G4double fDx1
Definition: G4Trd.hh:181
G4double GetSurfaceArea()