ECCE @ EIC Software
Reference for
ECCE @ EIC
simulation and reconstruction software on GitHub
Home page
Related Pages
Modules
Namespaces
Classes
Files
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
G4TwistTrapAlphaSide.hh
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file G4TwistTrapAlphaSide.hh
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
// G4TwistTrapAlphaSide
27
//
28
// Class description:
29
//
30
// Class describing a twisted boundary surface for a trapezoid.
31
32
// Author: 27-Oct-2004 - O.Link (Oliver.Link@cern.ch)
33
// --------------------------------------------------------------------
34
#ifndef G4TWISTTRAPALPHASIDE_HH
35
#define G4TWISTTRAPALPHASIDE_HH
36
37
#include "
G4VTwistSurface.hh
"
38
39
#include <vector>
40
41
class
G4TwistTrapAlphaSide
:
public
G4VTwistSurface
42
{
43
public
:
// with description
44
45
G4TwistTrapAlphaSide
(
const
G4String
&
name
,
46
G4double
PhiTwist,
// twist angle
47
G4double
pDz,
// half z lenght
48
G4double
pTheta,
// direction between end planes
49
G4double
pPhi,
// by polar and azimutal angles
50
G4double
pDy1,
// half y length at -pDz
51
G4double
pDx1,
// half x length at -pDz,-pDy
52
G4double
pDx2,
// half x length at -pDz,+pDy
53
G4double
pDy2,
// half y length at +pDz
54
G4double
pDx3,
// half x length at +pDz,-pDy
55
G4double
pDx4,
// half x length at +pDz,+pDy
56
G4double
pAlph,
// tilt angle at +pDz
57
G4double
AngleSide
// parity
58
);
59
60
virtual
~G4TwistTrapAlphaSide
();
61
62
virtual
G4ThreeVector
GetNormal
(
const
G4ThreeVector
&
xx
,
63
G4bool
isGlobal =
false
) ;
64
65
virtual
G4int
DistanceToSurface
(
const
G4ThreeVector
& gp,
66
const
G4ThreeVector
& gv,
67
G4ThreeVector
gxx[],
68
G4double
distance[],
69
G4int
areacode[],
70
G4bool
isvalid[],
71
EValidate
validate =
kValidateWithTol
);
72
73
virtual
G4int
DistanceToSurface
(
const
G4ThreeVector
& gp,
74
G4ThreeVector
gxx[],
75
G4double
distance[],
76
G4int
areacode[]);
77
78
79
public
:
// without description
80
81
G4TwistTrapAlphaSide
(__void__&);
82
// Fake default constructor for usage restricted to direct object
83
// persistency for clients requiring preallocation of memory for
84
// persistifiable objects.
85
86
private
:
87
88
virtual
G4int
GetAreaCode
(
const
G4ThreeVector
& xx,
89
G4bool
withTol =
true
);
90
virtual
void
SetCorners
();
91
virtual
void
SetBoundaries
();
92
93
void
GetPhiUAtX
(
G4ThreeVector
p
,
G4double
&
phi
,
G4double
&
u
);
94
G4ThreeVector
ProjectPoint
(
const
G4ThreeVector
& p,
95
G4bool
isglobal =
false
);
96
97
virtual
G4ThreeVector
SurfacePoint
(
G4double
phi,
G4double
u,
98
G4bool
isGlobal =
false
);
99
virtual
G4double
GetBoundaryMin
(
G4double
phi);
100
virtual
G4double
GetBoundaryMax
(
G4double
phi);
101
virtual
G4double
GetSurfaceArea
();
102
virtual
void
GetFacets
(
G4int
m
,
G4int
n
,
G4double
xyz[][3],
103
G4int
faces[][4],
G4int
iside );
104
105
inline
G4ThreeVector
NormAng
(
G4double
phi,
G4double
u);
106
inline
G4double
GetValueA
(
G4double
phi);
107
inline
G4double
GetValueB
(
G4double
phi);
108
inline
G4double
GetValueD
(
G4double
phi);
109
inline
G4double
Xcoef
(
G4double
u,
G4double
phi);
110
// To calculate the w(u) function
111
112
private
:
113
114
G4double
fTheta
;
115
G4double
fPhi
;
116
117
G4double
fDy1
;
118
G4double
fDx1
;
119
G4double
fDx2
;
120
121
G4double
fDy2
;
122
G4double
fDx3
;
123
G4double
fDx4
;
124
125
G4double
fDz
;
// Half-length along the z axis
126
127
G4double
fAlph
;
128
G4double
fTAlph
;
// std::tan(fAlph)
129
130
G4double
fPhiTwist
;
// twist angle (dphi in surface equation)
131
132
G4double
fAngleSide
;
133
134
G4double
fDx4plus2
;
// fDx4 + fDx2 == a2/2 + a1/2
135
G4double
fDx4minus2
;
// fDx4 - fDx2 -
136
G4double
fDx3plus1
;
// fDx3 + fDx1 == d2/2 + d1/2
137
G4double
fDx3minus1
;
// fDx3 - fDx1 -
138
G4double
fDy2plus1
;
// fDy2 + fDy1 == b2/2 + b1/2
139
G4double
fDy2minus1
;
// fDy2 - fDy1 -
140
G4double
fa1md1
;
// 2 fDx2 - 2 fDx1 == a1 - d1
141
G4double
fa2md2
;
// 2 fDx4 - 2 fDx3
142
143
G4double
fdeltaX
;
144
G4double
fdeltaY
;
145
};
146
147
//========================================================
148
// inline functions
149
//========================================================
150
151
inline
152
G4double
G4TwistTrapAlphaSide::GetValueA
(
G4double
phi
)
153
{
154
return
(
fDx4plus2
+
fDx4minus2
* ( 2 * phi ) /
fPhiTwist
) ;
155
}
156
157
inline
158
G4double
G4TwistTrapAlphaSide::GetValueD
(
G4double
phi
)
159
{
160
return
(
fDx3plus1
+
fDx3minus1
* ( 2 * phi) /
fPhiTwist
) ;
161
}
162
163
inline
164
G4double
G4TwistTrapAlphaSide::GetValueB
(
G4double
phi
)
165
{
166
return
(
fDy2plus1
+
fDy2minus1
* ( 2 * phi ) /
fPhiTwist
) ;
167
}
168
169
170
inline
171
G4double
G4TwistTrapAlphaSide::Xcoef
(
G4double
u
,
G4double
phi
)
172
{
173
174
return
GetValueA
(phi)/2. + (
GetValueD
(phi)-
GetValueA
(phi))/4.
175
- u*( (
GetValueD
(phi)-
GetValueA
(phi) )/( 2 *
GetValueB
(phi) ) -
fTAlph
);
176
177
}
178
179
inline
G4ThreeVector
180
G4TwistTrapAlphaSide::SurfacePoint
(
G4double
phi
,
G4double
u
,
G4bool
isGlobal)
181
{
182
// function to calculate a point on the surface, given by parameters phi,u
183
184
G4ThreeVector
SurfPoint (
Xcoef
(u,phi) * std::cos(phi)
185
- u * std::sin(phi) +
fdeltaX
*phi/
fPhiTwist
,
186
Xcoef
(u,phi) * std::sin(phi)
187
+ u * std::cos(phi) +
fdeltaY
*phi/
fPhiTwist
,
188
2*
fDz
*phi/
fPhiTwist
);
189
if
(isGlobal) {
return
(
fRot
* SurfPoint +
fTrans
); }
190
return
SurfPoint;
191
}
192
193
inline
194
G4double
G4TwistTrapAlphaSide::GetBoundaryMin
(
G4double
phi
)
195
{
196
return
-0.5*
GetValueB
(phi) ;
197
}
198
199
inline
200
G4double
G4TwistTrapAlphaSide::GetBoundaryMax
(
G4double
phi
)
201
{
202
return
0.5*
GetValueB
(phi) ;
203
}
204
205
inline
206
G4double
G4TwistTrapAlphaSide::GetSurfaceArea
()
207
{
208
return
(
fDz
*(std::sqrt(16*
fDy1
*
fDy1
209
+ (
fa1md1
+ 4*
fDy1
*
fTAlph
)*(
fa1md1
+ 4*
fDy1
*fTAlph))
210
+ std::sqrt(16*
fDy2
*
fDy2
+ (
fa2md2
+ 4*
fDy2
*fTAlph)
211
* (
fa2md2
+ 4*
fDy2
*fTAlph))))/2. ;
212
}
213
214
inline
215
G4ThreeVector
G4TwistTrapAlphaSide::NormAng
(
G4double
phi
,
G4double
u
)
216
{
217
// function to calculate the norm at a given point on the surface
218
// replace a1-d1
219
220
G4ThreeVector
nvec (
fDy1
*
fDz
*(4*
fDy1
*std::cos(phi)
221
+ (
fa1md1
+ 4*
fDy1
*
fTAlph
)*std::sin(phi)),
222
-(
fDy1
*
fDz
*((
fa1md1
+ 4*
fDy1
*fTAlph)*std::cos(phi)
223
- 4*
fDy1
*std::sin(phi))),
224
(
fDy1
*(-8*(
fDx3minus1
+
fDx4minus2
)*
fDy1
225
+
fa1md1
*(
fDx2
+
fDx3plus1
+
fDx4
)*
fPhiTwist
226
+ 4*(
fDx2
+
fDx3plus1
+
fDx4
)*
fDy1
*
fPhiTwist
227
*fTAlph + 2*(
fDx3minus1
+
fDx4minus2
)
228
*(
fa1md1
+ 4*
fDy1
*fTAlph)*phi)
229
+
fPhiTwist
*(16*
fDy1
*
fDy1
230
+ (
fa1md1
+ 4*
fDy1
*fTAlph)
231
*(
fa1md1
+ 4*
fDy1
*fTAlph))*u
232
+ 4*
fDy1
*(
fa1md1
*
fdeltaY
- 4*
fdeltaX
*
fDy1
233
+ 4*
fdeltaY
*
fDy1
*fTAlph)* std::cos(phi)
234
- 4*
fDy1
*(
fa1md1
*
fdeltaX
+ 4*
fDy1
*(
fdeltaY
235
+
fdeltaX
*fTAlph))*std::sin(phi))/ 8. ) ;
236
return
nvec.
unit
();
237
}
238
239
#endif
geant4
tree
geant4-10.6-release
source
geometry
solids
specific
include
G4TwistTrapAlphaSide.hh
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:25:19
using
1.8.2 with
ECCE GitHub integration