22 :
BinSize{(upper - lower) / (nvalues - 1)} {
25 double start_value = lower -
BinSize;
27 [&start_value, &bin_size] {
return start_value += bin_size; });
30 std::pair<double, double>
SRange(
double s, std::vector<double> &masses) {
31 std::pair<double, double> s_range = {0., std::sqrt(s)};
33 for (std::size_t i = 0; i < masses.size() - 1; ++i)
34 s_range.first += masses[i];
35 s_range.first *= s_range.first;
37 s_range.second -= masses.back();
38 s_range.second *= s_range.second;
42 std::pair<double, double>
PhspVolume(
double s, std::vector<double> &masses,
43 std::size_t SampleSize) {
44 if (masses.size() == 2)
47 if (masses.size() > 2) {
49 auto s_range =
SRange(s, masses);
55 std::vector<double> previousPhsp(sample.size() - 1);
56 auto masses_new = masses;
57 masses_new.pop_back();
58 double mNsq = masses.back() * masses.back();
59 for (std::size_t i = 1; i < sample.size(); ++i) {
60 previousPhsp[i - 1] = std::sqrt(
KallenFunction(s, sample[i], mNsq));
61 previousPhsp[i - 1] *=
62 PhspVolume(sample[i], masses_new, SampleSize).first;
63 previousPhsp[i - 1] *= sample.BinSize;
67 std::accumulate(previousPhsp.begin(), previousPhsp.end(), 0.) * M_PI /
69 return std::make_pair(volume, 0.);
72 "Cannot compute a phasespace for only one mass in final state");
78 return (2 * M_PI) * std::sqrt(
KallenFunction(s, m1 * m1, m2 * m2)) / s;
82 double result = x * x + y * y + z * z - 2 * x * y - 2 * y * z - 2 * z * x;
double PhspVolumeTwoParticles(double s, double m1, double m2)
Phase space element for a two particle decay.
IntegrationSample(double lower, double upper, std::size_t SampleSize=100)
std::pair< double, double > SRange(double s, std::vector< double > &masses)
double KallenFunction(double x, double y, double z)
Original Källén function, that is, not having square values in its argument.
std::pair< double, double > PhspVolume(double s, std::vector< double > &masses, std::size_t SampleSize)
Compute phasespace volume of momentum space for an arbitrary number of particles in the final state u...
void resize(DataSet &set, size_t size)
Function to calculate the available phase space volume of arbitrary decays.
EventCollection generate(unsigned int NumberOfEvents, const ComPWA::Kinematics &Kinematics, const ComPWA::PhaseSpaceEventGenerator &Generator, ComPWA::Intensity &Intensity, ComPWA::UniformRealNumberGenerator &RandomGenerator)