CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
BinomialProbability.h
Go to the documentation of this file.
1 #ifndef BinomialProbability_H
2 #define BinomialProbability_H
3 
11 public:
12 
14 
16  theHits(hits), theTotal(entries) {}
17 
18  float value() const {
19  return theTotal == 0 ? 0 :float(theHits) / float(theTotal);
20  }
21 
22  float error() const {
23  float p = value();
24  return theTotal <= 1 ? 0 : sqrt( p*(1.f - p)/(theTotal-1));
25  }
26 
27  int entries() const { return theTotal;}
28 
29  int hits() const { return theHits;}
30 
31  void hit() { theHits++; theTotal++;}
32 
33  void miss() { theTotal++;}
34 
35  void update( bool hit) {
36  if ( hit) theHits++;
37  theTotal++;
38  }
39 
40 private:
41 
42  int theHits;
43  int theTotal;
44 
45 };
46 
47 #endif
T sqrt(T t)
Definition: SSEVec.h:18
double f[11][100]
BinomialProbability(int hits, int entries)