src
DataFormats
Math
interface
angle.h
Go to the documentation of this file.
1
#ifndef Math_angle_h
2
#define Math_angle_h
3
/* function to compute 3D angle
4
*
5
* Ported from original code in RecoJets
6
* by Fedor Ratnikov, FNAL
7
*/
8
#include <cmath>
9
10
template
<
class
T>
11
T
angle
(
T
x1
,
T
y1
,
T
z1,
T
x2
,
T
y2
,
T
z2
) {
12
return
std::acos((
x1
*
x2
+
y1
*
y2
+ z1 *
z2
) /
13
std::sqrt
((
x1
*
x1
+
y1
*
y1
+ z1 * z1) * (
x2
*
x2
+
y2
*
y2
+
z2
*
z2
)));
14
}
15
16
template
<
typename
T1,
typename
T2>
17
double
angle
(
const
T1&
t1
,
const
T2&
t2
) {
18
return
angle
(
t1
.x(),
t1
.y(),
t1
.z(),
t2
.x(),
t2
.y(),
t2
.z());
19
}
20
21
#endif
testProducerWithPsetDescEmpty_cfi.z2
z2
Definition:
testProducerWithPsetDescEmpty_cfi.py:41
testProducerWithPsetDescEmpty_cfi.y2
y2
Definition:
testProducerWithPsetDescEmpty_cfi.py:30
RandomServiceHelper.t1
t1
Definition:
RandomServiceHelper.py:256
testProducerWithPsetDescEmpty_cfi.x2
x2
Definition:
testProducerWithPsetDescEmpty_cfi.py:28
mathSSE::sqrt
T sqrt(T t)
Definition:
SSEVec.h:23
testProducerWithPsetDescEmpty_cfi.y1
y1
Definition:
testProducerWithPsetDescEmpty_cfi.py:29
T
long double T
Definition:
Basic3DVectorLD.h:48
testProducerWithPsetDescEmpty_cfi.x1
x1
Definition:
testProducerWithPsetDescEmpty_cfi.py:33
RandomServiceHelper.t2
t2
Definition:
RandomServiceHelper.py:257
angle
T angle(T x1, T y1, T z1, T x2, T y2, T z2)
Definition:
angle.h:11
Generated for CMSSW Reference Manual by
1.8.14