Belle II Software  release-08-01-10
Binning Class Reference

Binning of a data distribution Provides PDF and CDF values of the distribution per bin. More...

#include <Binning.h>

Collaboration diagram for Binning:

Public Member Functions

 Binning (unsigned int nBins=0)
 Creates an empty binning with nBins. More...
 
unsigned int getBin (float datapoint) const
 Gets the bin corresponding to the given datapoint. More...
 
void normalizePDFs ()
 Normalizes the PDF values, so their sum is 1.
 
void calculateCDFsFromPDFs ()
 Calculates the CDF values from the pdf values, which are assumed to be normalized.
 

Static Public Member Functions

static Binning CreateEqualFrequency (const std::vector< float > &data, const std::vector< float > &weights, const std::vector< bool > &isSignal, unsigned int nBins)
 Create an equal frequency (aka equal-statistics) binning. More...
 
static Binning CreateEquidistant (const std::vector< float > &data, const std::vector< float > &weights, const std::vector< bool > &isSignal, unsigned int nBins)
 Create an equidistant binning. More...
 

Public Attributes

double m_signal_yield
 Signal yield in data distribution.
 
double m_bckgrd_yield
 Background yield in data distribution.
 
std::vector< float > m_signal_pdf
 Signal pdf of data distribution per bin.
 
std::vector< float > m_signal_cdf
 Signal cdf of data distribution per bin.
 
std::vector< float > m_bckgrd_pdf
 Background pdf of data distribution per bin.
 
std::vector< float > m_bckgrd_cdf
 Background cdf of data distribution per bin.
 
std::vector< float > m_boundaries
 Boundaries of data distribution, including minimum and maximum value as first and last boundary.
 

Detailed Description

Binning of a data distribution Provides PDF and CDF values of the distribution per bin.

Definition at line 27 of file Binning.h.

Constructor & Destructor Documentation

◆ Binning()

Binning ( unsigned int  nBins = 0)
explicit

Creates an empty binning with nBins.

Parameters
nBinsnumber of bins

Definition at line 21 of file Binning.cc.

22  {
23 
24  m_signal_pdf.resize(nBins, 0.0);
25  m_signal_cdf.resize(nBins, 0.0);
26  m_bckgrd_pdf.resize(nBins, 0.0);
27  m_bckgrd_cdf.resize(nBins, 0.0);
28  m_boundaries.resize(nBins + 1, 0.0);
29 
30  m_signal_yield = 0;
31  m_bckgrd_yield = 0;
32  }
std::vector< float > m_bckgrd_pdf
Background pdf of data distribution per bin.
Definition: Binning.h:58
std::vector< float > m_signal_pdf
Signal pdf of data distribution per bin.
Definition: Binning.h:56
std::vector< float > m_boundaries
Boundaries of data distribution, including minimum and maximum value as first and last boundary.
Definition: Binning.h:61
std::vector< float > m_bckgrd_cdf
Background cdf of data distribution per bin.
Definition: Binning.h:59
double m_bckgrd_yield
Background yield in data distribution.
Definition: Binning.h:54
double m_signal_yield
Signal yield in data distribution.
Definition: Binning.h:53
std::vector< float > m_signal_cdf
Signal cdf of data distribution per bin.
Definition: Binning.h:57

Member Function Documentation

◆ CreateEqualFrequency()

Binning CreateEqualFrequency ( const std::vector< float > &  data,
const std::vector< float > &  weights,
const std::vector< bool > &  isSignal,
unsigned int  nBins 
)
static

Create an equal frequency (aka equal-statistics) binning.

Parameters
datadata-points sampled from the distribution
weightsweights for each data-point
isSignalper data point
nBinsnumber of bins

Definition at line 93 of file Binning.cc.

◆ CreateEquidistant()

Binning CreateEquidistant ( const std::vector< float > &  data,
const std::vector< float > &  weights,
const std::vector< bool > &  isSignal,
unsigned int  nBins 
)
static

Create an equidistant binning.

Parameters
datadata-points sampled from the distribution
weightsweights for each data-point
isSignalper data point
nBinsnumber of bins

Definition at line 139 of file Binning.cc.

◆ getBin()

unsigned int getBin ( float  datapoint) const

Gets the bin corresponding to the given datapoint.

There are no overflow/underflow bins, so data points outside the original range are mapped to the first and last bin.

Parameters
datapointfor which the bin is returned

Definition at line 34 of file Binning.cc.


The documentation for this class was generated from the following files: