Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
Main Page
Related Pages
Modules
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Enumerations
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
z
Enumerator
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
:
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Enumerations
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Enumerator
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Properties
Related Functions
:
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
r
s
t
v
w
x
z
Files
File List
File Members
All
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Variables
$
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Enumerations
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
v
x
z
Enumerator
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Macros
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
GitLab
LXR
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Modules
Pages
Control
CxxUtils
CxxUtils
phihelper.h
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3
*/
10
#ifndef CXXUTILS_PHIHELPER_H
11
#define CXXUTILS_PHIHELPER_H
12
13
#include <cmath>
14
#include <type_traits>
15
16
namespace
CxxUtils
{
17
23
template
<
typename
T>
24
inline
T
wrapToPi
(T phi)
25
{
26
static_assert(
std::is_floating_point<T>::value
);
27
28
constexpr
auto
PI
=
static_cast<
T
>
(
M_PI
);
29
// For large values this is faster:
30
if
(phi < -100 || phi > 100) {
31
return
std::remainder
(phi, 2 *
PI
);
32
}
33
while
(phi >
PI
) phi -= 2 *
PI
;
34
while
(phi < -
PI
) phi += 2 *
PI
;
35
return
phi;
36
}
37
41
template
<
typename
T>
42
inline
T
deltaPhi
(T phiA, T phiB)
43
{
44
static_assert(
std::is_floating_point<T>::value
);
45
return
wrapToPi
(phiA - phiB);
46
}
47
59
template
<
typename
T>
60
inline
T
phiMean
(T phiA, T phiB)
61
{
62
static_assert(
std::is_floating_point<T>::value
);
63
const
T
diff
=
wrapToPi
(phiA - phiB);
64
return
wrapToPi
(phiB + 0.5 *
diff
);
65
}
66
76
template
<
typename
T>
77
inline
T
phiBisect
(T phiA, T phiB)
78
{
79
static_assert(
std::is_floating_point<T>::value
);
80
T phi = 0.5 * (phiA + phiB);
81
if
(phiA > phiB) phi +=
M_PI
;
82
return
wrapToPi
(phi);
83
}
84
85
}
// namespace CxxUtils
86
87
#endif
CxxUtils::wrapToPi
T wrapToPi(T phi)
Wrap angle in radians to [-pi, pi].
Definition:
phihelper.h:24
M_PI
#define M_PI
Definition:
ActiveFraction.h:11
mc.diff
diff
Definition:
mc.SFGenPy8_MuMu_DD.py:14
athena.value
value
Definition:
athena.py:124
PI
const float PI
Definition:
test_isolaitonTool.cxx:61
CxxUtils::phiMean
T phiMean(T phiA, T phiB)
Calculate average of two angles.
Definition:
phihelper.h:60
CxxUtils
Definition:
aligned_vector.h:29
CxxUtils::phiBisect
T phiBisect(T phiA, T phiB)
Bisect (average) the angle spanned by phiA and phiB.
Definition:
phihelper.h:77
remainder
std::vector< std::string > remainder(const std::vector< std::string > &v1, const std::vector< std::string > &v2)
Definition:
compareFlatTrees.cxx:44
CxxUtils::deltaPhi
T deltaPhi(T phiA, T phiB)
Return difference phiA - phiB in range [-pi, pi].
Definition:
phihelper.h:42
Generated on Mon Apr 14 2025 21:16:40 for ATLAS Offline Software by
1.8.18