Geant4  10.01.p03
G4UTrap.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:$
28 //
29 // --------------------------------------------------------------------
30 // GEANT 4 class header file
31 //
32 //
33 // G4UTrap
34 //
35 // Class description:
36 //
37 // Wrapper class for UTrap to make use of UTrap from USolids module.
38 
39 // History:
40 // 13.09.13 G.Cosmo, CERN/PH
41 // --------------------------------------------------------------------
42 #ifndef G4UTrap_HH
43 #define G4UTrap_HH
44 
45 #include "G4USolid.hh"
46 #include "UTrap.hh"
47 
48 class G4Polyhedron;
49 
50 class G4UTrap : public G4USolid
51 {
52  public: // with description
53 
54  G4UTrap( const G4String& pName,
55  G4double pDz,
56  G4double pTheta, G4double pPhi,
57  G4double pDy1, G4double pDx1, G4double pDx2,
58  G4double pAlp1,
59  G4double pDy2, G4double pDx3, G4double pDx4,
60  G4double pAlp2 );
61  //
62  // The most general constructor for G4Trap which prepares plane
63  // equations and corner coordinates from parameters
64 
65  G4UTrap( const G4String& pName,
66  const G4ThreeVector pt[8] ) ;
67  //
68  // Prepares plane equations and parameters from corner coordinates
69 
70  G4UTrap( const G4String& pName,
71  G4double pZ,
72  G4double pY,
73  G4double pX, G4double pLTX );
74  //
75  // Constructor for Right Angular Wedge from STEP (assumes pLTX<=pX)
76 
77  G4UTrap( const G4String& pName,
78  G4double pDx1, G4double pDx2,
79  G4double pDy1, G4double pDy2,
80  G4double pDz );
81  //
82  // Constructor for G4Trd
83 
84  G4UTrap(const G4String& pName,
85  G4double pDx, G4double pDy, G4double pDz,
86  G4double pAlpha, G4double pTheta, G4double pPhi );
87  //
88  // Constructor for G4Para
89 
90  G4UTrap( const G4String& pName );
91  //
92  // Constructor for "nominal" G4Trap whose parameters are to be set
93  // by a G4VPVParamaterisation later
94 
95  ~G4UTrap();
96 
98  const G4int n,
99  const G4VPhysicalVolume* pRep);
100 
101  G4VSolid* Clone() const;
102 
103  inline UTrap* GetShape() const;
104 
105  inline G4double GetZHalfLength() const;
106  inline G4double GetYHalfLength1() const;
107  inline G4double GetXHalfLength1() const;
108  inline G4double GetXHalfLength2() const;
109  inline G4double GetTanAlpha1() const;
110  inline G4double GetYHalfLength2() const;
111  inline G4double GetXHalfLength3() const;
112  inline G4double GetXHalfLength4() const;
113  inline G4double GetTanAlpha2() const;
114  inline TrapSidePlane GetSidePlane(G4int n) const;
115  inline G4ThreeVector GetSymAxis() const;
116 
117  inline void SetAllParameters(G4double pDz, G4double pTheta, G4double pPhi,
118  G4double pDy1, G4double pDx1, G4double pDx2,
119  G4double pAlp1,
120  G4double pDy2, G4double pDx3, G4double pDx4,
121  G4double pAlp2);
122  inline void SetPlanes(const G4ThreeVector pt[8]);
123 
124  public: // without description
125 
126  G4UTrap(__void__&);
127  // Fake default constructor for usage restricted to direct object
128  // persistency for clients requiring preallocation of memory for
129  // persistifiable objects.
130 
131  G4UTrap(const G4UTrap& rhs);
132  G4UTrap& operator=(const G4UTrap& rhs);
133  // Copy constructor and assignment operator.
134 
135  G4Polyhedron* CreatePolyhedron () const;
136 };
137 
138 // --------------------------------------------------------------------
139 // Inline methods
140 // --------------------------------------------------------------------
141 
142 inline UTrap* G4UTrap::GetShape() const
143 {
144  return (UTrap*) fShape;
145 }
146 
148 {
149  return GetShape()->GetZHalfLength();
150 }
152 {
153  return GetShape()->GetYHalfLength1();
154 }
156 {
157  return GetShape()->GetXHalfLength1();
158 }
160 {
161  return GetShape()->GetXHalfLength2();
162 }
164 {
165  return GetShape()->GetTanAlpha1();
166 }
168 {
169  return GetShape()->GetYHalfLength2();
170 }
172 {
173  return GetShape()->GetXHalfLength3();
174 }
176 {
177  return GetShape()->GetXHalfLength4();
178 }
180 {
181  return GetShape()->GetTanAlpha2();
182 }
184 {
185  UTrapSidePlane iplane = GetShape()->GetSidePlane(n);
186  TrapSidePlane oplane = {iplane.a, iplane.b, iplane.c, iplane.d };
187  return oplane;
188 }
190 {
191  UVector3 axis = GetShape()->GetSymAxis();
192  return G4ThreeVector(axis.x(), axis.y(), axis.z());
193 }
194 
195 inline
197  G4double pDy1, G4double pDx1, G4double pDx2,
198  G4double pAlp1,
199  G4double pDy2, G4double pDx3, G4double pDx4,
200  G4double pAlp2)
201 {
202  GetShape()->SetAllParameters(pDz, pTheta, pPhi,
203  pDy1, pDx1, pDx2, pAlp1,
204  pDy2, pDx3, pDx4, pAlp2);
205  fRebuildPolyhedron = true;
206 }
207 
208 inline void G4UTrap::SetPlanes(const G4ThreeVector pt[8])
209 {
210  UVector3 upt[8];
211  for (unsigned int i=0; i<8; ++i)
212  {
213  upt[i] = UVector3(pt[i].x(), pt[i].y(), pt[i].z());
214  }
215  GetShape()->SetPlanes(upt);
216  fRebuildPolyhedron = true;
217 }
218 
219 #endif
double & z()
Definition: UVector3.hh:352
double d
Definition: UTrap.hh:76
double & y()
Definition: UVector3.hh:348
void SetAllParameters(double pDz, double pTheta, double pPhi, double pDy1, double pDx1, double pDx2, double pAlp1, double pDy2, double pDx3, double pDx4, double pAlp2)
Definition: UTrap.cc:492
CLHEP::Hep3Vector G4ThreeVector
G4double z
Definition: TRTMaterials.hh:39
G4double GetXHalfLength1() const
Definition: G4UTrap.hh:155
G4double GetYHalfLength2() const
Definition: G4UTrap.hh:167
Definition: UTrap.hh:80
G4ThreeVector GetSymAxis() const
Definition: G4UTrap.hh:189
UTrap * GetShape() const
Definition: G4UTrap.hh:142
G4double GetYHalfLength1() const
Definition: G4UTrap.hh:151
void ComputeDimensions(G4VPVParameterisation *p, const G4int n, const G4VPhysicalVolume *pRep)
Definition: G4UTrap.cc:138
G4double GetXHalfLength3() const
Definition: G4UTrap.hh:171
int G4int
Definition: G4Types.hh:78
double GetYHalfLength2() const
G4VSolid * Clone() const
Definition: G4UTrap.cc:149
G4double GetTanAlpha2() const
Definition: G4UTrap.hh:179
double GetXHalfLength2() const
G4double GetXHalfLength4() const
Definition: G4UTrap.hh:175
G4double GetZHalfLength() const
Definition: G4UTrap.hh:147
double GetXHalfLength4() const
G4UTrap & operator=(const G4UTrap &rhs)
Definition: G4UTrap.cc:120
TrapSidePlane GetSidePlane(G4int n) const
Definition: G4UTrap.hh:183
VUSolid * fShape
Definition: G4USolid.hh:182
double GetTanAlpha2() const
UTrapSidePlane GetSidePlane(int n) const
UVector3 GetSymAxis() const
double & x()
Definition: UVector3.hh:344
G4double GetXHalfLength2() const
Definition: G4UTrap.hh:159
G4bool fRebuildPolyhedron
Definition: G4USolid.hh:183
~G4UTrap()
Definition: G4UTrap.cc:103
const G4int n
G4Polyhedron * CreatePolyhedron() const
Definition: G4UTrap.cc:158
G4UTrap(const G4String &pName, G4double pDz, G4double pTheta, G4double pPhi, G4double pDy1, G4double pDx1, G4double pDx2, G4double pAlp1, G4double pDy2, G4double pDx3, G4double pDx4, G4double pAlp2)
Definition: G4UTrap.cc:42
G4double GetTanAlpha1() const
Definition: G4UTrap.hh:163
double GetXHalfLength1() const
void SetPlanes(const UVector3 pt[8])
Definition: UTrap.cc:534
double c
Definition: UTrap.hh:76
void SetPlanes(const G4ThreeVector pt[8])
Definition: G4UTrap.hh:208
double GetYHalfLength1() const
double b
Definition: UTrap.hh:76
void SetAllParameters(G4double pDz, G4double pTheta, G4double pPhi, G4double pDy1, G4double pDx1, G4double pDx2, G4double pAlp1, G4double pDy2, G4double pDx3, G4double pDx4, G4double pAlp2)
Definition: G4UTrap.hh:196
double GetXHalfLength3() const
double G4double
Definition: G4Types.hh:76
double a
Definition: UTrap.hh:76
double GetTanAlpha1() const
double GetZHalfLength() const