Files
karl/include/simulation/position_binning.h

80 lines
2.0 KiB
C++
Executable File

#ifndef POSITION_BINNING_H
#define POSITION_BINNING_H
#include <vector>
#include "blitz/array.h"
class LowerAndUpperBoundBinning {
public:
LowerAndUpperBoundBinning(int num_bins, double maximum);
int bin(double position) const;
double stepsize() const;
int numBins() const;
int binIndexMin() const;
int binIndexMax() const;
std::vector<double> binBorders() const;
private:
int num_bins_;
double stepsize_;
};
class LowerBoundBinningWithOverflow {
public:
LowerBoundBinningWithOverflow(int num_bins_excluding_overflow,
double maximum);
int bin(double position) const;
double stepsize() const;
int numBinsWithOverflow() const;
int numBinsWithoutOverflow() const;
int binIndexMin() const;
int binIndexMax() const;
std::vector<double> binBorders() const;
private:
int num_bins_;
double stepsize_;
};
class BinningWithOverAndUnderflow {
public:
BinningWithOverAndUnderflow(int num_bins_excluding_overunderflow,
double maximum);
int bin(double position) const;
double stepsize() const;
int numBinsWithOverUnderflow() const;
int numBinsWithoutOverUnderflow() const;
int binIndexMin() const;
int binIndexMax() const;
std::vector<double> binBorders() const;
private:
int num_bins_;
double stepsize_;
};
class CylinderBinning {
public:
CylinderBinning(int num_bins_radial,
double radius,
int num_bins_longitudinal,
double height);
blitz::TinyVector<int, 2> bin(
const blitz::TinyVector<double, 3>& cylinder_position) const;
blitz::TinyVector<double, 2> stepsize() const;
blitz::TinyVector<int, 2> numBins() const;
blitz::TinyVector<int, 2> numBinsIncludingOverUnderflow() const;
blitz::TinyVector<int, 2> binIndexMin() const;
blitz::TinyVector<int, 2> binIndexMax() const;
const LowerBoundBinningWithOverflow radial_binning;
const BinningWithOverAndUnderflow longitudinal_binning;
};
#endif /* POSITION_BINNING_H */