38 lines
1.6 KiB
C++
Executable File
38 lines
1.6 KiB
C++
Executable File
#ifndef ENERGY_BINNING_H
|
|
#define ENERGY_BINNING_H
|
|
|
|
#include <vector>
|
|
|
|
// class defining the grid for the energy-direction (includes an over- and underflow bin)
|
|
class EnergyBinning {
|
|
public:
|
|
// Constructor: create the EnergyBinning by using the minimal_energy (has to be positive and in eV units)
|
|
// as the lower boundary and the maximal_energy (in eV) as the upper boundary with num_bins bins
|
|
// the bin borders are created using a log10-spacing
|
|
EnergyBinning(double minimal_energy, double maximal_energy, int num_bins);
|
|
// Constructor: create an EnergyBinning with the bin borders being defined in the
|
|
// vector energy_bin_borders (has to contain the values of the edges of the energy-bins;
|
|
// for the lowest energy bin the left boundary has to be given as well, similar for the
|
|
// highest energy bin the upper boundary value has to be given as well)
|
|
EnergyBinning(std::vector<double> energy_bin_borders);
|
|
|
|
// return the index of the energy bin that contains the given energy_eV (in eV)
|
|
// if energy_eV < minimal_energy then -1 is returned (underflow bin)
|
|
// if energy_eV > maximal_energy then numBins is returned (overflow bin)
|
|
int bin(double energy_eV) const;
|
|
// returns the number of bins (not the number of bin borders!)
|
|
int numBins() const;
|
|
// returns the vector containing the energy bin borders
|
|
std::vector<double> binBorders() const;
|
|
// return the index of the underflow bin
|
|
int binIndexMin() const;
|
|
// return the index of the overflow bin
|
|
int binIndexMax() const;
|
|
|
|
private:
|
|
// vector containing the values of the bin edges
|
|
const std::vector<double> energy_bin_borders_;
|
|
};
|
|
|
|
#endif /* ENERGY_BINNING_H */
|