Belle II Software light-2406-ragdoll
Binning.h
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#pragma once
10
11#ifndef INCLUDE_GUARD_BELLE2_MVA_BINNING_HEADER
12#define INCLUDE_GUARD_BELLE2_MVA_BINNING_HEADER
13
14#include <vector>
15
16namespace Belle2 {
21 namespace MVA {
22
27 class Binning {
28 public:
33 explicit Binning(unsigned int nBins = 0);
34
41 unsigned int getBin(float datapoint) const;
42
46 void normalizePDFs();
47
52
56 std::vector<float> m_signal_pdf;
57 std::vector<float> m_signal_cdf;
58 std::vector<float> m_bckgrd_pdf;
59 std::vector<float> m_bckgrd_cdf;
60 std::vector<float>
70 static Binning CreateEqualFrequency(const std::vector<float>& data, const std::vector<float>& weights,
71 const std::vector<bool>& isSignal, unsigned int nBins);
72
80 static Binning CreateEquidistant(const std::vector<float>& data, const std::vector<float>& weights,
81 const std::vector<bool>& isSignal, unsigned int nBins);
82
83 };
84
85 }
87}
88
89#endif
Binning of a data distribution Provides PDF and CDF values of the distribution per bin.
Definition: Binning.h:27
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
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.
Definition: Binning.cc:139
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
void calculateCDFsFromPDFs()
Calculates the CDF values from the pdf values, which are assumed to be normalized.
Definition: Binning.cc:73
void normalizePDFs()
Normalizes the PDF values, so their sum is 1.
Definition: Binning.cc:47
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.
Definition: Binning.cc:93
unsigned int getBin(float datapoint) const
Gets the bin corresponding to the given datapoint.
Definition: Binning.cc:34
Abstract base class for different kinds of events.
Definition: ClusterUtils.h:24