Main Page
Namespaces
Classes
Package Documentation
EventFilter
EcalRawToDigi
src
Majority.h
Go to the documentation of this file.
1
/*
2
*/
3
4
#ifndef MAJORITY_H
5
#define MAJORITY_H
6
7
#include <map>
8
12
template
<
class
T>
13
class
Majority
{
14
//constructor(s) and destructor(s)
15
public
:
18
Majority
():
n_
(0){}
19
22
virtual
~Majority
(){}
23
27
void
28
add
(
const
T
&
value
){
29
votes_
[
value
] += 1.;
30
n_
+= 1.;
31
}
32
38
T
result
(
double
* proba)
const
{
39
std::pair<T, double>
m
(
T
(), -1.);
40
for
(
typename
std::map<T, double>::const_iterator it =
votes_
.begin();
41
it !=
votes_
.end();
42
++it){
43
if
(it->second > m.second){
44
m = *it;
45
}
46
}
47
if
(proba) *proba =
n_
>0?m.second/
n_
:-1;
48
return
m.first;
49
}
50
51
//method(s)
52
public
:
53
private
:
54
55
//attribute(s)
56
protected
:
57
private
:
58
std::map<T, double>
votes_
;
59
double
n_
;
60
};
61
62
#endif //MAJORITY_H not defined
Majority::votes_
std::map< T, double > votes_
Definition:
Majority.h:46
Majority::n_
double n_
Definition:
Majority.h:47
Majority::~Majority
virtual ~Majority()
Definition:
Majority.h:22
Majority::add
void add(const T &value)
Definition:
Majority.h:28
Majority
Definition:
Majority.h:12
value
Definition:
value.py:1
relativeConstraints.value
value
Definition:
relativeConstraints.py:53
funct::m
m
Definition:
Factorize.h:56
Majority::result
T result(double *proba) const
Definition:
Majority.h:38
T
long double T
Definition:
Basic3DVectorLD.h:66
Majority::Majority
Majority()
Definition:
Majority.h:18
Generated for CMSSW Reference Manual by
1.8.11