12#ifndef FRAMEWORK_BINNINGPOLICY_H
13#define FRAMEWORK_BINNINGPOLICY_H
26namespace binning_helpers
31 int nBins =
static_cast<int>(
bins[0]);
33 expanded.resize(nBins + 2);
35 for (
int i = 0;
i <= nBins;
i++) {
42template <std::
size_t N>
46 static_assert(N <= 3,
"No default binning for more than 3 columns, you need to implement a binning class yourself");
47 for (
int i = 0;
i < N;
i++) {
52 template <
typename...
Ts>
55 static_assert(
sizeof...(Ts) == N,
"There must be the same number of binning axes and data values/columns");
57 unsigned int i = 2,
j = 2, k = 2;
60 if (std::get<0>(
data) < this->
mBins[0][1]) {
63 if constexpr (N > 1) {
64 if (std::get<1>(
data) < this->
mBins[1][1]) {
68 if constexpr (N > 2) {
69 if (std::get<2>(
data) < this->
mBins[2][1]) {
79 for (;
i < this->
mBins[0].size(); i++) {
82 if constexpr (N > 1) {
83 for (;
j < this->
mBins[1].size();
j++) {
86 if constexpr (N > 2) {
87 for (; k < this->
mBins[2].size(); k++) {
88 if (std::get<2>(
data) < this->
mBins[2][k]) {
89 return getBinAt(
i,
j, k);
98 return getBinAt(
i,
j, k);
107 if constexpr (N > 2) {
108 for (k = 2; k < this->
mBins[2].size(); k++) {
109 if (std::get<2>(
data) < this->
mBins[2][k]) {
110 return getBinAt(
i,
j, k);
117 return getBinAt(
i,
j, k);
127 if constexpr (N > 1) {
128 for (
j = 2;
j < this->
mBins[1].size();
j++) {
131 if constexpr (N > 2) {
132 for (k = 2; k < this->
mBins[2].size(); k++) {
133 if (std::get<2>(
data) < this->
mBins[2][k]) {
134 return getBinAt(
i,
j, k);
140 return getBinAt(
i,
j, k);
146 if constexpr (N > 2) {
147 for (k = 2; k < this->
mBins[2].size(); k++) {
148 if (std::get<2>(
data) < this->
mBins[2][k]) {
149 return getBinAt(
i,
j, k);
155 return getBinAt(
i,
j, k);
161 return getBinsCount(
mBins[0]);
167 if constexpr (N == 1) {
170 return getBinsCount(
mBins[1]);
176 if constexpr (N < 3) {
179 return getBinsCount(
mBins[2]);
185 if constexpr (N == 1) {
188 if constexpr (N == 2) {
191 if constexpr (N == 3) {
197 std::array<std::vector<double>, N>
mBins;
204 int getBinAt(
unsigned int iRaw,
unsigned int jRaw,
unsigned int kRaw)
const
206 int shiftBinsWithoutOverflow = getOverflowShift();
207 unsigned int i = iRaw - 1 - shiftBinsWithoutOverflow;
208 unsigned int j = jRaw - 1 - shiftBinsWithoutOverflow;
209 unsigned int k = kRaw - 1 - shiftBinsWithoutOverflow;
211 if constexpr (N == 1) {
213 }
else if constexpr (N == 2) {
214 return i +
j * xBinsCount;
215 }
else if constexpr (N == 3) {
222 int getOverflowShift()
const
228 int getBinsCount(std::vector<double>
const&
bins)
const
230 return bins.size() - 1 - getOverflowShift();
234template <
typename,
typename...>
237template <
typename...
Ts,
typename... Ls>
243 template <
typename T,
typename T2>
246 if (globalIndex != -1) {
247 rowIterator.setCursor(globalIndex);
250 return std::get<T2>(mBinningFunctions)(rowIterator);
252 return soa::row_helpers::getColumnValue<typename T2::type, T, T2>(rowIterator);
256 template <
typename T>
259 return std::make_tuple(getBinningValue<T, Ts>(rowIterator, globalIndex)...);
262 template <
typename T>
265 return getBinningValues(rowIterator, globalIndex);
268 template <
typename... T2s>
277 std::tuple<Ls...> mBinningFunctions;
280template <
typename...
Ts>
286 template <
typename T>
289 if (globalIndex != -1) {
290 rowIterator.setCursor(globalIndex);
292 return std::make_tuple(soa::row_helpers::getColumnValue<typename Ts::type, T, Ts>(rowIterator)...);
295 template <
typename T>
301 int getBin(std::tuple<typename Ts::type...>
const&
data)
const
314 template <
typename T>
317 if (globalIndex != -1) {
318 rowIterator.setCursor(globalIndex);
320 return std::make_tuple(soa::row_helpers::getColumnValue<typename C::type, T, C>(rowIterator));
323 template <
typename T>
331 return std::get<0>(
data);
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from const char Directory with events to Events directory is and not inside events Show standalone event Run event generator maximum time bin of continuous for triggered for automatic continuous for automatic continuous triggered uint64_t
bounded_vector< float > bins
void expandConstantBinning(std::vector< double > const &bins, std::vector< double > &expanded)
Defining ITS Vertex explicitly as messageable.
std::decay_t< decltype(prune_voids_pack(pack<>{}, with_condition_pack< Condition, Types... >{}))> selected_pack
constexpr double VARIABLE_WIDTH
std::conditional_t< is_persistent_column< C >, std::true_type, std::false_type > is_persistent_column_t
int getXBinsCount() const
int getBin(std::tuple< Ts... > const &data) const
int getYBinsCount() const
int getZBinsCount() const
BinningPolicyBase(std::array< std::vector< double >, N > bins, bool ignoreOverflows=true)
int getAllBinsCount() const
std::array< std::vector< double >, N > mBins
framework::selected_pack< o2::soa::is_persistent_column_t, Ts... > persistent_columns_t
auto getBinningValues(typename T::iterator rowIterator, T &table, uint64_t globalIndex=-1) const
ColumnBinningPolicy(std::array< std::vector< double >, sizeof...(Ts)> bins, bool ignoreOverflows=true)
auto getBinningValues(T &rowIterator, uint64_t globalIndex=-1) const
int getBin(std::tuple< typename Ts::type... > const &data) const
auto getBinningValue(T &rowIterator, uint64_t globalIndex=-1) const
auto getBinningValues(T &rowIterator, uint64_t globalIndex=-1) const
framework::selected_pack< o2::soa::is_persistent_column_t, Ts... > persistent_columns_t
auto getBinningValues(typename T::iterator rowIterator, T &table, uint64_t globalIndex=-1) const
FlexibleBinningPolicy(std::tuple< Ls... > const &lambdaPtrs, std::array< std::vector< double >, sizeof...(Ts)> bins, bool ignoreOverflows=true)
int getBin(std::tuple< T2s... > const &data) const
framework::selected_pack< o2::soa::is_persistent_column_t, C > persistent_columns_t
NoBinningPolicy()=default
auto getBinningValues(T &rowIterator, uint64_t globalIndex=-1) const
int getBin(std::tuple< typename C::type > const &data) const
auto getBinningValues(typename T::iterator rowIterator, T &table, uint64_t globalIndex=-1) const