Removed the rejection sampling for the

density drawing position distribution
This commit is contained in:
2025-08-20 14:55:36 +02:00
parent abab8810f3
commit cc827f1417
3 changed files with 22 additions and 19 deletions
@@ -44,30 +44,31 @@ class PositionDistributionFromDensity {
// Constructor taking a pointer to a DynamicDensityField object
PositionDistributionFromDensity(std::shared_ptr<DynamicDensityField> density);
// draw a position from the density provided at construction using the rejection method
CylinderCoordinate drawPosition(std::mt19937* engine);
// // draw a position from the density provided at construction using the rejection method
// CylinderCoordinate drawPosition(std::mt19937* engine);
// draw a position uniformly distributed within the bin of the given index
// (note that the r-dependence of the particle number in a uniform density distribution
// is not incorporated)
CylinderCoordinate drawPosition(std::mt19937* engine, int r_idx, int phi_idx,
int z_idx);
// sets the maximum density value needed for the rejection method
// should not be called frequently, since during each call the density field is
// recalculated from scratch by the DynamicDensityField object
void setMaximumDensity();
// // sets the maximum density value needed for the rejection method
// // should not be called frequently, since during each call the density field is
// // recalculated from scratch by the DynamicDensityField object
// void setMaximumDensity();
private:
// variable storing the maximum value of the density
double maximum_density_ = 1.;
// double maximum_density_ = 1.;
std::shared_ptr<DynamicDensityField> density_;
// distributions for the spatial directions and for the density
std::uniform_real_distribution<double> r_values;
std::uniform_real_distribution<double> phi_values;
std::uniform_real_distribution<double> z_values;
std::uniform_real_distribution<double> density_values;
// // distributions for the spatial directions and for the density
// std::uniform_real_distribution<double> r_values;
// std::uniform_real_distribution<double> phi_values;
// std::uniform_real_distribution<double> z_values;
// std::uniform_real_distribution<double> density_values;
std::uniform_real_distribution<double> std_unifrm;
};
#endif /* EVENT_POSITION_DISTRIBUTION_H */