Main Page
+
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
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
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
+
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
_
a
c
d
e
f
l
m
o
p
s
t
u
v
+
Related 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
Package Documentation
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Modules
Pages
src
DataFormats
Math
interface
Rounding.h
Go to the documentation of this file.
1
#ifndef DataFormats_Math_Rounding_h
2
#define DataFormats_Math_Rounding_h
3
4
// This file provides utilities for comparing and rounding floating point numbers
5
6
#include <cmath>
7
8
namespace
cms_rounding
{
9
10
template
<
class
valType>
11
inline
constexpr valType
roundIfNear0
(valType
value
,
double
tolerance
= 1.
e
-7) {
12
if
(
std::abs
(
value
) <
tolerance
)
13
return
(0.0);
14
return
(
value
);
15
}
16
17
template
<
class
valType>
18
inline
constexpr valType
roundVecIfNear0
(valType
value
,
double
tolerance
= 1.
e
-7) {
19
auto
xVal{
roundIfNear0
(
value
.x(),
tolerance
)};
20
auto
yVal{
roundIfNear0
(
value
.y(),
tolerance
)};
21
auto
zVal{
roundIfNear0
(
value
.z(),
tolerance
)};
22
return
(valType{xVal, yVal, zVal});
23
}
24
25
}
// namespace cms_rounding
26
27
#endif
cms_rounding::roundVecIfNear0
constexpr valType roundVecIfNear0(valType value, double tolerance=1.e-7)
Definition:
Rounding.h:18
tolerance
const double tolerance
Definition:
HGCalGeomParameters.cc:29
cms_rounding
Definition:
Rounding.h:8
MillePedeFileConverter_cfg.e
e
Definition:
MillePedeFileConverter_cfg.py:37
funct::abs
Abs< T >::type abs(const T &t)
Definition:
Abs.h:22
value
Definition:
value.py:1
cms_rounding::roundIfNear0
constexpr valType roundIfNear0(valType value, double tolerance=1.e-7)
Definition:
Rounding.h:11
Generated for CMSSW Reference Manual by
1.8.14