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
CommonTools
Statistics
interface
lms_1d.h
Go to the documentation of this file.
1
#ifndef CommonTools_Statistics_lms_1d_h
2
#define CommonTools_Statistics_lms_1d_h
3
4
#include "
CommonTools/Statistics/interface/StatisticsException.h
"
5
6
#include <vector>
7
#include <algorithm>
8
#include <cmath>
9
14
template
<
class
T>
15
T
lms_1d
(std::vector<T>
values
) {
16
switch
(
values
.size()) {
17
case
0:
18
throw
StatisticsException
(
"Lms of empty vector undefined"
);
19
case
1:
20
return
(
T
) * (
values
.begin());
21
case
2:
22
return
(
T
)((*(
values
.begin()) + *(
values
.end() - 1)) / 2);
23
};
24
const
int
size
=
values
.size();
25
const
int
half =
size
/ 2;
26
const
int
n_steps = (
size
+ 1) / 2;
27
28
sort
(
values
.begin(),
values
.end());
29
30
T
i_begin = *(
values
.begin());
31
T
i_end = *(
values
.begin() + half);
32
T
div = (
T
)fabs(i_begin - i_end);
33
for
(
typename
std::vector<T>::const_iterator
i
=
values
.begin();
i
!= (
values
.begin() + n_steps); ++
i
) {
34
if
(fabs((*
i
) - (*(
i
+ half))) < div) {
35
i_begin = (*i);
36
i_end = *(
i
+ half);
37
div = (
T
)fabs(i_begin - i_end);
38
}
39
}
40
41
return
(
T
)((i_begin + i_end) / 2);
42
}
43
44
#endif
findQualityFiles.size
size
Write out results.
Definition:
findQualityFiles.py:443
jetUpdater_cfi.sort
sort
Definition:
jetUpdater_cfi.py:30
mps_fire.i
i
Definition:
mps_fire.py:429
StatisticsException.h
StatisticsException
Definition:
StatisticsException.h:10
contentValuesCheck.values
values
Definition:
contentValuesCheck.py:38
lms_1d
T lms_1d(std::vector< T > values)
Definition:
lms_1d.h:15
T
long double T
Definition:
Basic3DVectorLD.h:48
Generated for CMSSW Reference Manual by
1.8.14