Class to store the N dimensional phasespace binning of the MVA categorical training.
More...
#include <ECLChargedPIDMVAWeights.h>
|
std::vector< std::vector< float > > | m_binEdges |
| Vector of bin edges.
|
|
std::vector< int > | m_nBins |
| Vector of number of bins per dimension.
|
|
Class to store the N dimensional phasespace binning of the MVA categorical training.
For example, 3D in (clusterTheta, p, charge).
Definition at line 39 of file ECLChargedPIDMVAWeights.h.
◆ ECLChargedPIDPhasespaceBinning() [1/2]
◆ ECLChargedPIDPhasespaceBinning() [2/2]
Constructor.
- Parameters
-
binEdges | vector of vectors of bin edges in the N dimensions. |
Definition at line 52 of file ECLChargedPIDMVAWeights.h.
53 {
54 m_binEdges = binEdges;
55 for (auto dimensionBinEdges : binEdges) {
56 m_nBins.push_back(dimensionBinEdges.size() - 1);
57 }
58 }
◆ ~ECLChargedPIDPhasespaceBinning()
◆ getBinIndices()
std::vector< int > getBinIndices |
( |
const std::vector< float > | values | ) |
|
|
inlineprivate |
Maps the vector of input values to their bin index in N dimensions.
If the values lie outside the covered region -1 is returned.
- Parameters
-
values | N dimensional vector of values to be mapped to a global linear bin index. |
Definition at line 91 of file ECLChargedPIDMVAWeights.h.
92 {
93 std::vector<int> binIndices(m_binEdges.size());
94
95 for (unsigned int i = 0; i < m_binEdges.size(); i++) {
96 std::vector<float> dimBinEdges = m_binEdges[i];
97 auto it = std::upper_bound(dimBinEdges.begin(), dimBinEdges.end(), values[i]);
98 if (it == dimBinEdges.end()) {
99 binIndices[i] = -1;
100 } else {
101 int index = std::distance(dimBinEdges.begin(), it) - 1;
102 binIndices[i] = index;
103 }
104 }
105 return binIndices;
106 }
◆ getLinearisedBinIndex()
int getLinearisedBinIndex |
( |
const std::vector< float > | values | ) |
|
|
inline |
Maps the vector of input values to a global bin index.
If any of the values lies outside the binning -1 is returned.
- Parameters
-
values | N dimensional vector of values to be mapped to a global linear bin index. |
Definition at line 69 of file ECLChargedPIDMVAWeights.h.
70 {
71 int globalBin(-1);
72 std::vector<int> binIndices = getBinIndices(values);
73 for (unsigned int i = 0; i < binIndices.size(); i++) {
74 if (binIndices[i] < 0) return -1;
75 if (i == 0) {
76 globalBin = binIndices[i];
77 } else {
78 globalBin = globalBin * m_nBins[i] + binIndices[i];
79 }
80 }
81 return globalBin;
82 }
◆ m_binEdges
std::vector<std::vector<float> > m_binEdges |
|
private |
◆ m_nBins
The documentation for this class was generated from the following file: