69 #ifndef NBODYPHASESPACEGEN_H
70 #define NBODYPHASESPACEGEN_H
76 #include "reportingUtils.h"
77 #include "lorentzvector.h"
78 #include "randomgenerator.h"
79 #include "starlightconstants.h"
86 factorial(
const unsigned int n)
89 for (
unsigned int i = 1; i <= n; ++i)
98 breakupMomentum(
const double M,
104 return sqrt((M - m1 - m2) * (M + m1 + m2) * (M - m1 + m2) * (M + m1 - m2)) / (2 * M);
117 bool setDecay(
const std::vector<double>& daughterMasses);
119 const double* daughterMasses);
122 void setSeed(
const unsigned int seed) { _rnd.SetSeed(seed); }
123 double random () {
return _rnd.Rndom(); }
142 const unsigned int nmbOfIterations = 10000);
152 const std::vector<lorentzVector>&
daughters ()
const {
return _daughters; }
156 double breakupMom (
const int index)
const {
return _breakupMom[index]; }
157 double cosTheta (
const int index)
const {
return _cosTheta[index]; }
158 double phi (
const int index)
const {
return _phi[index]; }
161 std::ostream&
print(std::ostream& out = std::cout)
const;
162 friend std::ostream& operator << (std::ostream& out,
164 {
return gen.
print(out); }
171 void pickMasses(
const double nBodyMass);
178 inline void pickAngles();
185 std::vector<double> _m;
189 std::vector<double> _M;
190 std::vector<double> _cosTheta;
191 std::vector<double> _phi;
192 std::vector<double> _mSum;
193 std::vector<double> _breakupMom;
194 std::vector<lorentzVector> _daughters;
197 double _maxWeightObserved;
207 nBodyPhaseSpaceGen::pickAngles()
209 for (
unsigned int i = 1; i < _n; ++i) {
210 _cosTheta[i] = 2 *
random() - 1;
211 _phi[i] = starlightConstants::twoPi *
random();
220 const double max = (maxWeight <= 0) ? _maxWeight : maxWeight;
222 printWarn <<
"maximum weight = " << max <<
" does not make sense. rejecting event." << std::endl;
225 if ((_weight / max) >
random())
231 #endif // NBODYPHASESPACEGEN_H
const std::vector< lorentzVector > & daughters() const
returns Lorentz vectors of all daughters
unsigned int nmbOfDaughters() const
returns number of daughters
void resetMaxWeightObserved()
sets maximum observed weight back to zero
void setMaxWeight(const double maxWeight)
sets maximum weight used for hit-miss MC
const lorentzVector & daughter(const int index) const
returns Lorentz vector of daughter at index
bool generateDecayAccepted(const lorentzVector &nBody, const double maxWeight=0)
generates full event with certain n-body mass and momentum only when event is accepted (return value ...
double maxWeight() const
returns maximum weight used for hit-miss MC
double normalization() const
returns normalization used in weight calculation
double breakupMom(const int index) const
returns breakup momentum in (index + 1)-body RF
double random()
returns number from internal random generator
bool eventAccepted(const double maxWeight=0)
applies event weight in form of hit-miss MC assumes that event weight has been already calculated by ...
double eventWeight() const
returns weight of generated event
double intermediateMass(const int index) const
returns intermediate mass of (index + 1)-body system
std::ostream & print(std::ostream &out=std::cout) const
prints generator status
double phi(const int index) const
returns azimuth in (index + 1)-body RF
double maxWeightObserved() const
returns maximum observed weight since instantiation
double cosTheta(const int index) const
returns polar angle in (index + 1)-body RF
double daughterMass(const int index) const
returns invariant mass of daughter at index
double generateDecay(const lorentzVector &nBody)
generates full event with certain n-body mass and momentum and returns event weight ...
void setSeed(const unsigned int seed)
sets seed of random number generator
double estimateMaxWeight(const double nBodyMass, const unsigned int nmbOfIterations=10000)
estimates maximum weight for given n-body mass
bool setDecay(const std::vector< double > &daughterMasses)
sets decay constants and prepares internal variables