DataFormats
GeometryVector
interface
CoordinateSets.h
Go to the documentation of this file.
1
#ifndef GeometryVector_Geom_CoordinateSets_h
2
#define GeometryVector_Geom_CoordinateSets_h
3
4
#include <cmath>
5
6
namespace
Geom
{
7
13
template
<
typename
T>
14
class
Polar2Cartesian
{
15
public
:
17
Polar2Cartesian
(
const
T
&
r
,
const
T
&
phi
) :
r_
(
r
),
phi_
(
phi
) {}
18
19
const
T
&
r
()
const
{
return
r_
; }
20
const
T
&
phi
()
const
{
return
phi_
; }
21
22
T
x
()
const
{
return
r_
*
cos
(
phi_
); }
23
T
y
()
const
{
return
r_
*
sin
(
phi_
); }
24
25
private
:
26
T
r_
;
27
T
phi_
;
28
};
29
33
template
<
typename
T>
34
class
Cylindrical2Cartesian
{
35
public
:
39
Cylindrical2Cartesian
(
const
T
&
r
,
const
T
&
phi
,
const
T
&
z
) :
r_
(
r
),
phi_
(
phi
),
z_
(
z
) {}
40
41
const
T
&
r
()
const
{
return
r_
; }
42
const
T
&
phi
()
const
{
return
phi_
; }
43
const
T
&
z
()
const
{
return
z_
; }
44
45
T
x
()
const
{
return
r_
*
cos
(
phi_
); }
46
T
y
()
const
{
return
r_
*
sin
(
phi_
); }
47
48
private
:
49
T
r_
;
50
T
phi_
;
51
T
z_
;
52
};
53
57
template
<
typename
T>
58
class
Spherical2Cartesian
{
59
public
:
63
Spherical2Cartesian
(
const
T
&
theta
,
const
T
&
phi
,
const
T
&
mag
)
64
:
theta_
(
theta
),
phi_
(
phi
),
r_
(
mag
),
transv_
(
sin
(
theta
) *
mag
) {}
65
66
const
T
&
theta
()
const
{
return
theta_
; }
67
const
T
&
phi
()
const
{
return
phi_
; }
68
const
T
&
r
()
const
{
return
r_
; }
69
70
T
x
()
const
{
return
transv_
*
cos
(
phi
()); }
71
T
y
()
const
{
return
transv_
*
sin
(
phi
()); }
72
T
z
()
const
{
return
cos
(
theta
()) *
r
(); }
73
74
private
:
75
T
theta_
;
76
T
phi_
;
77
T
r_
;
78
T
transv_
;
79
};
80
84
template
<
typename
T>
85
class
Cartesian2Cartesian3D
{
86
public
:
87
Cartesian2Cartesian3D
(
const
T
&
x
,
const
T
&
y
,
const
T
&
z
) :
x_
(
x
),
y_
(
y
),
z_
(
z
) {}
88
89
const
T
&
x
()
const
{
return
x_
; }
90
const
T
&
y
()
const
{
return
y_
; }
91
const
T
&
z
()
const
{
return
z_
; }
92
93
private
:
94
T
x_
;
95
T
y_
;
96
T
z_
;
97
};
98
}
// namespace Geom
99
100
#endif
Geom::Spherical2Cartesian::r
const T & r() const
Definition:
CoordinateSets.h:68
Geom::Cartesian2Cartesian3D
Definition:
CoordinateSets.h:85
Geom::Spherical2Cartesian::phi
const T & phi() const
Definition:
CoordinateSets.h:67
Geom::Polar2Cartesian::phi_
T phi_
Definition:
CoordinateSets.h:27
Geom::Polar2Cartesian::y
T y() const
Definition:
CoordinateSets.h:23
Geom::Cartesian2Cartesian3D::z_
T z_
Definition:
CoordinateSets.h:96
Geom::Spherical2Cartesian::y
T y() const
Definition:
CoordinateSets.h:71
Geom::Spherical2Cartesian
Definition:
CoordinateSets.h:58
Geom::Spherical2Cartesian::transv_
T transv_
Definition:
CoordinateSets.h:78
Geom::Spherical2Cartesian::x
T x() const
Definition:
CoordinateSets.h:70
funct::sin
Sin< T >::type sin(const T &t)
Definition:
Sin.h:22
Geom::Spherical2Cartesian::Spherical2Cartesian
Spherical2Cartesian(const T &theta, const T &phi, const T &mag)
Definition:
CoordinateSets.h:63
Geom::Spherical2Cartesian::r_
T r_
Definition:
CoordinateSets.h:77
funct::cos
Cos< T >::type cos(const T &t)
Definition:
Cos.h:22
Geom::Polar2Cartesian
Definition:
CoordinateSets.h:14
Geom::Cylindrical2Cartesian::phi
const T & phi() const
Definition:
CoordinateSets.h:42
Geom::Cylindrical2Cartesian::r_
T r_
Definition:
CoordinateSets.h:49
Geom::Cylindrical2Cartesian::z_
T z_
Definition:
CoordinateSets.h:51
Geom::Cylindrical2Cartesian
Definition:
CoordinateSets.h:34
Geom::Cylindrical2Cartesian::y
T y() const
Definition:
CoordinateSets.h:46
Geom::Cartesian2Cartesian3D::Cartesian2Cartesian3D
Cartesian2Cartesian3D(const T &x, const T &y, const T &z)
Definition:
CoordinateSets.h:87
Geom::Spherical2Cartesian::z
T z() const
Definition:
CoordinateSets.h:72
Geom::Spherical2Cartesian::theta
const T & theta() const
Definition:
CoordinateSets.h:66
Geom::Cartesian2Cartesian3D::y_
T y_
Definition:
CoordinateSets.h:95
Geom::Cartesian2Cartesian3D::y
const T & y() const
Definition:
CoordinateSets.h:90
Geom::Polar2Cartesian::r_
T r_
Definition:
CoordinateSets.h:26
Geom::Spherical2Cartesian::phi_
T phi_
Definition:
CoordinateSets.h:76
Geom::Cylindrical2Cartesian::z
const T & z() const
Definition:
CoordinateSets.h:43
Geom::Polar2Cartesian::Polar2Cartesian
Polar2Cartesian(const T &r, const T &phi)
Construct from radius and polar angle.
Definition:
CoordinateSets.h:17
Geom::Cartesian2Cartesian3D::x
const T & x() const
Definition:
CoordinateSets.h:89
Geom
Definition:
CoordinateSets.h:6
mag
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
Definition:
Basic3DVectorLD.h:127
Geom::Cartesian2Cartesian3D::x_
T x_
Definition:
CoordinateSets.h:94
Geom::Cylindrical2Cartesian::r
const T & r() const
Definition:
CoordinateSets.h:41
Geom::Cylindrical2Cartesian::Cylindrical2Cartesian
Cylindrical2Cartesian(const T &r, const T &phi, const T &z)
Definition:
CoordinateSets.h:39
T
long double T
Definition:
Basic3DVectorLD.h:48
Geom::Polar2Cartesian::phi
const T & phi() const
Definition:
CoordinateSets.h:20
Geom::Cylindrical2Cartesian::phi_
T phi_
Definition:
CoordinateSets.h:50
Geom::Polar2Cartesian::x
T x() const
Definition:
CoordinateSets.h:22
Geom::Spherical2Cartesian::theta_
T theta_
Definition:
CoordinateSets.h:75
Geom::Cartesian2Cartesian3D::z
const T & z() const
Definition:
CoordinateSets.h:91
Geom::Cylindrical2Cartesian::x
T x() const
Definition:
CoordinateSets.h:45
Geom::Polar2Cartesian::r
const T & r() const
Definition:
CoordinateSets.h:19
Generated for CMSSW Reference Manual by
1.8.16