 |
Belle II Software
release-05-01-25
|
13 #include <tracking/trackFindingVXD/sectorMapTools/MinMaxCollector.h>
14 #include <framework/logging/Logger.h>
28 class RawDataCollectedMinMax {
40 std::pair<double, double> quantiles,
41 unsigned maxSizeThreshold = 100000) :
45 m_collector((quantiles.first > (1. - quantiles.second) ? quantiles.first * 2. : (1. - quantiles.second) * 2.))
47 if (
double(expectedSize) / (
double(maxSizeThreshold) * 0.05) >
double(maxSizeThreshold))
48 { B2FATAL(
"RawDataCollectedMinMax: expected data to big, can not execute!"); }
50 if (maxSizeThreshold < expectedSize) {
56 void add(
double newVal)
98 [](
const std::pair<double, double>& a,
const std::pair<double, double>& b) ->
bool { return a.first < b.first; });
102 [](
const std::pair<double, double>& a,
const std::pair<double, double>& b) ->
bool { return a.second < b.second; });
std::pair< DataType, DataType > getMinMax(DataType minQuantile=0., DataType maxQuantile=1.) const
for given pair of quantiles, the according cuts (min, max) will be returned.
RawDataCollectedMinMax(unsigned expectedSize, std::pair< double, double > quantiles, unsigned maxSizeThreshold=100000)
constructor. please use for quantiles [min, max] min ~0 & max ~1 (range 0-1)
unsigned m_currentSize
the current size of the data sample.
unsigned m_fillIntermediateThreshold
an internal threshold taking care of collecting intermediate results during sample collection
std::pair< double, double > getMinMax()
returns current best estimates for min and max cuts.
MinMaxCollector< double > m_collector
collects raw data in an RAM-saving way.
void append(DataType newVal)
append new value
std::vector< std::pair< double, double > > m_intermediateValues
collects intermediate threshold if expected size is too big.
void add(double newVal)
adds value to collector.
Abstract base class for different kinds of events.
bool empty() const
returns if internal containers are empty
std::pair< double, double > m_minMaxQuantiles
the quantiles to be collected in the end (defined in [0;1])
unsigned totalSize() const
returns the combined size of the containers storing the values
unsigned getSampleSize() const
returns current sample size (which is not the actual size of the container).
void clear()
deletes all values collected so far and resets to constructor-settings.