CMS 3D CMS Logo

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