11 #include <tracking/trackFindingVXD/sectorMapTools/MinMaxCollector.h>
12 #include <framework/logging/Logger.h>
38 std::pair<double, double> quantiles,
39 unsigned maxSizeThreshold = 100000) :
43 m_collector((quantiles.first > (1. - quantiles.second) ? quantiles.first * 2. : (1. - quantiles.second) * 2.))
45 if (
double(expectedSize) / (
double(maxSizeThreshold) * 0.05) >
double(maxSizeThreshold))
46 { B2FATAL(
"RawDataCollectedMinMax: expected data to big, can not execute!"); }
48 if (maxSizeThreshold < expectedSize) {
54 void add(
double newVal)
96 [](
const std::pair<double, double>& a,
const std::pair<double, double>& b) ->
bool { return a.first < b.first; });
100 [](
const std::pair<double, double>& a,
const std::pair<double, double>& b) ->
bool { return a.second < b.second; });
unsigned totalSize() const
returns the combined size of the containers storing the values
void append(DataType newVal)
append new value
bool empty() const
returns if internal containers are empty
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.
void clear()
deletes all values collected so far and resets to constructor-settings.
takes care of collecting raw data and staying below RAM-threshold.
unsigned m_fillIntermediateThreshold
an internal threshold taking care of collecting intermediate results during sample collection
MinMaxCollector< double > m_collector
collects raw data in an RAM-saving way.
unsigned getSampleSize() const
returns current sample size (which is not the actual size of the container).
unsigned m_currentSize
the current size of the data sample.
std::vector< std::pair< double, double > > m_intermediateValues
collects intermediate threshold if expected size is too big.
std::pair< double, double > m_minMaxQuantiles
the quantiles to be collected in the end (defined in [0;1])
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)
std::pair< double, double > getMinMax()
returns current best estimates for min and max cuts.
void add(double newVal)
adds value to collector.
Abstract base class for different kinds of events.