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 
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
BinomialProbability::theHits
int theHits
Definition: BinomialProbability.h:44
dqmMemoryStats.float
float
Definition: dqmMemoryStats.py:127
BinomialProbability::error
float error() const
Definition: BinomialProbability.h:24
BinomialProbability::entries
int entries() const
Definition: BinomialProbability.h:29
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
BinomialProbability::miss
void miss()
Definition: BinomialProbability.h:35
BinomialProbability::value
float value() const
Definition: BinomialProbability.h:20
BinomialProbability::BinomialProbability
BinomialProbability(int hits, int entries)
Definition: BinomialProbability.h:17
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
BinomialProbability::hits
int hits() const
Definition: BinomialProbability.h:31
BinomialProbability::update
void update(bool hit)
Definition: BinomialProbability.h:37
BinomialProbability::theTotal
int theTotal
Definition: BinomialProbability.h:45
BinomialProbability::BinomialProbability
BinomialProbability()
Definition: BinomialProbability.h:15
BinomialProbability
Definition: BinomialProbability.h:12
hit
Definition: SiStripHitEffFromCalibTree.cc:88
BinomialProbability::hit
void hit()
Definition: BinomialProbability.h:33