CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
BinomialProbability Class Reference

#include <BinomialProbability.h>

Public Member Functions

 BinomialProbability ()
 
 BinomialProbability (int hits, int entries)
 
int entries () const
 
float error () const
 
void hit ()
 
int hits () const
 
void miss ()
 
void update (bool hit)
 
float value () const
 

Private Attributes

int theHits
 
int theTotal
 

Detailed Description

A simple class for accumulating binomial "events", i.e. events that have a yes/no outcome, and for computing the binomial error on the fraction of positive hits.

Definition at line 12 of file BinomialProbability.h.

Constructor & Destructor Documentation

◆ BinomialProbability() [1/2]

BinomialProbability::BinomialProbability ( )
inline

Definition at line 15 of file BinomialProbability.h.

15 : theHits(0), theTotal(0) {}

◆ BinomialProbability() [2/2]

BinomialProbability::BinomialProbability ( int  hits,
int  entries 
)
inline

Definition at line 17 of file BinomialProbability.h.

17  :

Member Function Documentation

◆ entries()

int BinomialProbability::entries ( ) const
inline

Definition at line 29 of file BinomialProbability.h.

29 { return theTotal;}

References theTotal.

◆ error()

float BinomialProbability::error ( ) const
inline

Definition at line 24 of file BinomialProbability.h.

24  {
25  float p = value();
26  return theTotal <= 1 ? 0 : sqrt( p*(1.f - p)/(theTotal-1));
27  }

References f, AlCaHLTBitMon_ParallelJobs::p, mathSSE::sqrt(), theTotal, and value().

Referenced by Page1Parser.Page1Parser::check_for_whole_start_tag().

◆ hit()

void BinomialProbability::hit ( )
inline

Definition at line 33 of file BinomialProbability.h.

33 { theHits++; theTotal++;}

References theHits, and theTotal.

◆ hits()

int BinomialProbability::hits ( ) const
inline

Definition at line 31 of file BinomialProbability.h.

31 { return theHits;}

References theHits.

◆ miss()

void BinomialProbability::miss ( )
inline

Definition at line 35 of file BinomialProbability.h.

35 { theTotal++;}

References theTotal.

◆ update()

void BinomialProbability::update ( bool  hit)
inline

◆ value()

float BinomialProbability::value ( ) const
inline

Member Data Documentation

◆ theHits

int BinomialProbability::theHits
private

Definition at line 44 of file BinomialProbability.h.

Referenced by hit(), hits(), update(), and value().

◆ theTotal

int BinomialProbability::theTotal
private

Definition at line 45 of file BinomialProbability.h.

Referenced by entries(), error(), hit(), miss(), update(), and value().

BinomialProbability::theHits
int theHits
Definition: BinomialProbability.h:44
dqmMemoryStats.float
float
Definition: dqmMemoryStats.py:127
BinomialProbability::entries
int entries() const
Definition: BinomialProbability.h:29
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
BinomialProbability::value
float value() const
Definition: BinomialProbability.h:20
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
BinomialProbability::hits
int hits() const
Definition: BinomialProbability.h:31
AlCaHLTBitMon_ParallelJobs.p
def p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
BinomialProbability::theTotal
int theTotal
Definition: BinomialProbability.h:45
hit
Definition: SiStripHitEffFromCalibTree.cc:88