Files
karl/include/simulation/scattering_angle_distribution.h

51 lines
1.4 KiB
C++
Executable File

#ifndef SCATTERING_ANGLE_DISTRIBUTION_H
#define SCATTERING_ANGLE_DISTRIBUTION_H
#include <map>
#include <memory>
#include <random>
#include <string>
#include <vector>
#include "simulation/energy_binning.h"
class ScatteringAngleDistribution {
public:
virtual double roll(std::mt19937* engine, double energy_eV) = 0;
};
class IsotropicAngleDistribution : public ScatteringAngleDistribution {
public:
IsotropicAngleDistribution();
double roll(std::mt19937* engine, double energy_eV = 0.);
private:
std::uniform_real_distribution<double> distribution_;
};
class AngleDistributionFromFile : public ScatteringAngleDistribution {
public:
AngleDistributionFromFile(std::string absolute_filepath);
double roll(std::mt19937* engine, double energy_eV);
private:
std::shared_ptr<EnergyBinning> energy_binning_;
std::vector<std::piecewise_linear_distribution<double>> angle_distributions_;
};
class CompositeAngleDistribution : public ScatteringAngleDistribution {
public:
CompositeAngleDistribution(
std::shared_ptr<ScatteringAngleDistribution> lower_distribution,
std::shared_ptr<ScatteringAngleDistribution> higher_distribution,
double decider_energy);
double roll(std::mt19937* engine, double energy_eV);
private:
std::shared_ptr<ScatteringAngleDistribution> lower_distribution_;
std::shared_ptr<ScatteringAngleDistribution> higher_distribution_;
const double decider_energy_;
};
#endif /* SCATTERING_ANGLE_DISTRIBUTION_H */