#ifndef EVENT_POSITION_DISTRIBUTION_H #define EVENT_POSITION_DISTRIBUTION_H #include #include #include "simulation/coordinates.h" #include "simulation/scalar_field.h" // structure for storing a minimum and maximum value struct Limit { Limit() : min(0), max(0){}; Limit(double min, double max) : min(min), max(max){}; double min; double max; }; // class for drawing positions class EventPositionDistribution { public: // Constructor: takes a shared_ptr to a ScalarField used as the distribution to be drawn from // a Limit density containing the maximum value of the mother_density within the position limits (used for rejection method) // a Limit r_position defining the region in r-direction, where positions are drawn from // a Limit z_position defining the region in z-direction, where positions are drawn from // a Limit phi_position defining the region in phi-direction, where positions are drawn from EventPositionDistribution(std::shared_ptr mother_density, Limit density, Limit r_position, Limit phi_position, Limit z_position); // draw a position from the ScalarField using the given mt19937 engine pointer as a CylinderCoordinate // using the rejection method CylinderCoordinate rollPosition(std::mt19937* engine); private: // ScalarField defining the distribution std::shared_ptr mother_density_; // distribution functions drawn to be drawn from in the rejection method std::uniform_real_distribution r_values; std::uniform_real_distribution z_values; std::uniform_real_distribution phi_values; std::uniform_real_distribution density_values; }; #endif /* EVENT_POSITION_DISTRIBUTION_H */