ROOT
6.16/01
Reference Guide
graf3d
g3d
src
TTRAP.cxx
Go to the documentation of this file.
1
// @(#)root/g3d:$Id$
2
// Author: Nenad Buncic 19/09/95
3
4
/*************************************************************************
5
* Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6
* All rights reserved. *
7
* *
8
* For the licensing terms see $ROOTSYS/LICENSE. *
9
* For the list of contributors see $ROOTSYS/README/CREDITS. *
10
*************************************************************************/
11
12
#include "
TTRAP.h
"
13
#include "
TNode.h
"
14
#include "
TMath.h
"
15
16
ClassImp
(
TTRAP
);
17
18
/** \class TTRAP
19
\ingroup g3d
20
A general trapezoid.
21
22
\image html g3d_trap.png
23
24
The faces perpendicular to z are trapezia and
25
their centres are not necessarily on a line parallel to the z axis.
26
This shape has 14 parameters.
27
28
- name: name of the shape
29
- title: shape's title
30
- material: (see TMaterial)
31
- dz: half-length along the z axis
32
- theta: polar angle of the line joining the centre of the face
33
at -DZ to the centre of the one at +DZ
34
- phi: azimuthal angle of the line joining the centre of the face
35
at -DZ to the centre of the one at +DZ
36
- h1: half-length along y of the face at -DZ
37
- bl1: half-length along x of the side at -H1 in y of the face
38
at -DZ in z
39
- tl1: half-length along x of the side at +H1 in y of the face
40
at -DZ in z
41
- alpha1: angle with respect to the y axis from the centre of the
42
side at -H1 in y to the centre of the side at +H1 in y
43
of the face at -DZ in z
44
- h2: half-length along y of the face at +DZ
45
- bl2: half-length along x of the side at -H2 in y of the
46
face at +DZ in z
47
- tl2: half-length along x of the side at +H2 in y of the face
48
at +DZ in z
49
- alpha2: angle with respect to the y axis from the centre of the side
50
at -H2 in y to the centre of the side at +H2 in y of the
51
face at +DZ in z
52
*/
53
54
////////////////////////////////////////////////////////////////////////////////
55
/// TRAP shape default constructor
56
57
TTRAP::TTRAP
()
58
{
59
fH1
= 0.;
60
fBl1
= 0.;
61
fTl1
= 0.;
62
fAlpha1
= 0.;
63
fH2
= 0.;
64
fBl2
= 0.;
65
fTl2
= 0.;
66
fAlpha2
= 0.;
67
}
68
69
////////////////////////////////////////////////////////////////////////////////
70
/// TRAP shape normal constructor
71
72
TTRAP::TTRAP
(
const
char
*
name
,
const
char
*title,
const
char
*material,
Float_t
dz,
Float_t
theta,
Float_t
phi,
73
Float_t
h1
,
Float_t
bl1,
Float_t
tl1,
Float_t
alpha1,
Float_t
h2,
74
Float_t
bl2,
Float_t
tl2,
Float_t
alpha2) :
TBRIK
(
name
, title,material,theta,phi,dz)
75
{
76
fH1
=
h1
;
77
fBl1
= bl1;
78
fTl1
= tl1;
79
fAlpha1
= alpha1;
80
fH2
= h2;
81
fBl2
= bl2;
82
fTl2
= tl2;
83
fAlpha2
= alpha2;
84
}
85
86
////////////////////////////////////////////////////////////////////////////////
87
/// TRAP shape default destructor
88
89
TTRAP::~TTRAP
()
90
{
91
}
92
93
////////////////////////////////////////////////////////////////////////////////
94
/// Create TRAP points
95
96
void
TTRAP::SetPoints
(
Double_t
*
points
)
const
97
{
98
const
Float_t
pi
=
Float_t
(
TMath::Pi
());
99
Float_t
alpha1 =
fAlpha1
*
pi
/180.0;
100
Float_t
alpha2 =
fAlpha2
*
pi
/180.0;
101
Float_t
theta =
TBRIK::fDx
*
pi
/180.0;
102
Float_t
phi =
TBRIK::fDy
*
pi
/180.0;
103
Float_t
tth =
TMath::Tan
(theta);
104
Float_t
tx = tth*
TMath::Cos
(phi);
105
Float_t
ty = tth*
TMath::Sin
(phi);
106
Float_t
tth1 =
TMath::Tan
(alpha1);
107
Float_t
tth2 =
TMath::Tan
(alpha2);
108
109
if
(
points
) {
110
points
[ 0] = -
fDz
*tx-tth1*
fH1
-
fBl1
;
points
[ 1] = -
fH1
-
fDz
*ty ;
points
[ 2] = -
fDz
;
111
points
[ 3] = -
fDz
*tx+tth1*
fH1
-
fTl1
;
points
[ 4] =
fH1
-
fDz
*ty ;
points
[ 5] = -
fDz
;
112
points
[ 6] = -
fDz
*tx+tth1*
fH1
+
fTl1
;
points
[ 7] =
fH1
-
fDz
*ty ;
points
[ 8] = -
fDz
;
113
points
[ 9] = -
fDz
*tx-tth1*
fH1
+
fBl1
;
points
[10] = -
fH1
-
fDz
*ty ;
points
[11] = -
fDz
;
114
points
[12] =
fDz
*tx-tth2*
fH2
-
fBl2
;
points
[13] = -
fH2
+
fDz
*ty ;
points
[14] =
fDz
;
115
points
[15] =
fDz
*tx+tth2*
fH2
-
fTl2
;
points
[16] =
fH2
+
fDz
*ty ;
points
[17] =
fDz
;
116
points
[18] =
fDz
*tx+tth2*
fH2
+
fTl2
;
points
[19] =
fH2
+
fDz
*ty ;
points
[20] =
fDz
;
117
points
[21] =
fDz
*tx-tth2*
fH2
+
fBl2
;
points
[22] = -
fH2
+
fDz
*ty ;
points
[23] =
fDz
;
118
}
119
120
}
Double_t
double Double_t
Definition:
RtypesCore.h:55
Float_t
float Float_t
Definition:
RtypesCore.h:53
ClassImp
#define ClassImp(name)
Definition:
Rtypes.h:363
TMath.h
TNode.h
TTRAP.h
points
point * points
Definition:
X3DBuffer.c:22
TBRIK
A box with faces perpendicular to the axes.
Definition:
TBRIK.h:26
TBRIK::fDz
Float_t fDz
Definition:
TBRIK.h:31
TBRIK::fDy
Float_t fDy
Definition:
TBRIK.h:30
TBRIK::fDx
Float_t fDx
Definition:
TBRIK.h:29
TTRAP
A general trapezoid.
Definition:
TTRAP.h:33
TTRAP::fAlpha1
Float_t fAlpha1
Definition:
TTRAP.h:38
TTRAP::fAlpha2
Float_t fAlpha2
Definition:
TTRAP.h:42
TTRAP::~TTRAP
virtual ~TTRAP()
TRAP shape default destructor.
Definition:
TTRAP.cxx:89
TTRAP::fH1
Float_t fH1
Definition:
TTRAP.h:35
TTRAP::fTl1
Float_t fTl1
Definition:
TTRAP.h:37
TTRAP::TTRAP
TTRAP()
TRAP shape default constructor.
Definition:
TTRAP.cxx:57
TTRAP::fBl2
Float_t fBl2
Definition:
TTRAP.h:40
TTRAP::fH2
Float_t fH2
Definition:
TTRAP.h:39
TTRAP::fBl1
Float_t fBl1
Definition:
TTRAP.h:36
TTRAP::fTl2
Float_t fTl2
Definition:
TTRAP.h:41
TTRAP::SetPoints
virtual void SetPoints(Double_t *points) const
Create TRAP points.
Definition:
TTRAP.cxx:96
h1
TH1F * h1
Definition:
legend1.C:5
RegressionKeras.name
name
Definition:
RegressionKeras.py:29
TGeoUnit::pi
static constexpr double pi
Definition:
TGeoSystemOfUnits.h:67
TMath::Cos
Double_t Cos(Double_t)
Definition:
TMath.h:629
TMath::Pi
constexpr Double_t Pi()
Definition:
TMath.h:38
TMath::Sin
Double_t Sin(Double_t)
Definition:
TMath.h:625
TMath::Tan
Double_t Tan(Double_t)
Definition:
TMath.h:633