Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
EventFilter
EcalRawToDigi
src
Majority.h
Go to the documentation of this file.
1
/*
2
* $Id: Majority.h,v 1.1 2009/02/25 14:44:25 pgras Exp $
3
*/
4
5
#ifndef MAJORITY_H
6
#define MAJORITY_H
7
8
#include <map>
9
13
template
<
class
T>
14
class
Majority
{
15
//constructor(s) and destructor(s)
16
public
:
19
Majority
():
n_
(0){}
20
23
virtual
~Majority
(){}
24
28
void
29
add
(
const
T
&
value
){
30
votes_
[
value
] += 1.;
31
n_
+= 1.;
32
}
33
39
T
result
(
double
* proba)
const
{
40
std::pair<T, double>
m
(
T
(), -1.);
41
for
(
typename
std::map<T, double>::const_iterator it =
votes_
.begin();
42
it !=
votes_
.end();
43
++it){
44
if
(it->second > m.second){
45
m = *it;
46
}
47
}
48
if
(proba) *proba =
n_
>0?m.second/
n_
:-1;
49
return
m.first;
50
}
51
52
//method(s)
53
public
:
54
private
:
55
56
//attribute(s)
57
protected
:
58
private
:
59
std::map<T, double>
votes_
;
60
double
n_
;
61
};
62
63
#endif //MAJORITY_H not defined
Majority::votes_
std::map< T, double > votes_
Definition:
Majority.h:50
relativeConstraints.value
tuple value
Definition:
relativeConstraints.py:54
Majority::n_
double n_
Definition:
Majority.h:51
Majority::~Majority
virtual ~Majority()
Definition:
Majority.h:23
Majority::add
void add(const T &value)
Definition:
Majority.h:29
Majority
Definition:
Majority.h:13
m
int m
Definition:
DTDataIntegrityTask.cc:33
Majority::result
T result(double *proba) const
Definition:
Majority.h:39
T
long double T
Definition:
Basic3DVectorLD.h:59
Majority::Majority
Majority()
Definition:
Majority.h:19
Generated for CMSSW Reference Manual by
1.8.5