herwig is hosted by Hepforge, IPPP Durham
Herwig 7.3.0
FlatInvertiblePhasespace.h
1// -*- C++ -*-
2//
3// FlatInvertiblePhasespace.h is a part of Herwig - A multi-purpose Monte Carlo event generator
4// Copyright (C) 2002-2019 The Herwig Collaboration
5//
6// Herwig is licenced under version 3 of the GPL, see COPYING for details.
7// Please respect the MCnet academic guidelines, see GUIDELINES for details.
8//
9#ifndef Herwig_FlatInvertiblePhasespace_H
10#define Herwig_FlatInvertiblePhasespace_H
11//
12// This is the declaration of the FlatInvertiblePhasespace class.
13//
14
15#include "Herwig/MatrixElement/Matchbox/Phasespace/MatchboxPhasespace.h"
16
17namespace Herwig {
18
19using namespace ThePEG;
20
29
30public:
31
35 virtual double generateTwoToNKinematics(const double*,
36 vector<Lorentz5Momentum>& momenta);
37
42 virtual int nDimPhasespace(int nFinal) const {
43 if ( nFinal == 1 )
44 return 1;
45 return 3*nFinal - 4;
46 }
47
48public:
49
53 virtual bool isInvertible() const { return true; }
54
59 virtual double invertTwoToNKinematics(const vector<Lorentz5Momentum>& momenta,
60 double* r) const {
61 return invertKinematics(momenta,(momenta[0]+momenta[1]).m(),r);
62 }
63
64private:
65
69 double bisect(double v, double n,
70 double target = -16., double maxLevel = 80.) const;
71
75 double rho(Energy M, Energy N, Energy m) const {
76 return sqrt((sqr(M)-sqr(N+m))*(sqr(M)-sqr(N-m)))/(8.*sqr(M));
77 }
78
82 double generateIntermediates(vector<Energy>& K,
83 const double* r) const;
84
88 double invertIntermediates(const vector<Energy>& K,
89 double* r) const;
90
94 double generateIntermediates(vector<Energy>& M,
95 const vector<Energy>& m,
96 const double* r) const;
97
101 double invertIntermediates(const vector<Energy>& M,
102 const vector<Energy>& m,
103 double* r) const;
104
108 double generateKinematics(vector<Lorentz5Momentum>& P,
109 Energy Ecm,
110 const double* r) const;
111
115 double invertKinematics(const vector<Lorentz5Momentum>& P,
116 Energy Ecm,
117 double* r) const;
118
127 long double flatWeights(int n) const;
128
129public:
130
138
144 void persistentInput(PersistentIStream & is, int version);
146
153 static void Init();
154
155protected:
156
163 virtual IBPtr clone() const;
164
169 virtual IBPtr fullclone() const;
171
172
173// If needed, insert declarations of virtual function defined in the
174// InterfacedBase class here (using ThePEG-interfaced-decl in Emacs).
175
176
177private:
178
184
185};
186
187}
188
189#endif /* Herwig_FlatInvertiblePhasespace_H */
FlatInvertiblePhasespace implements flat, invertible phase space generation.
virtual IBPtr clone() const
Make a simple clone of this object.
double bisect(double v, double n, double target=-16., double maxLevel=80.) const
Solve v = (n+2) * u^(n+1) - (n+1) * u^(n+2) for u.
long double flatWeights(int n) const
Return the appropriate phase space weight, Eq.
void persistentOutput(PersistentOStream &os) const
Function used to write out object persistently.
virtual double invertTwoToNKinematics(const vector< Lorentz5Momentum > &momenta, double *r) const
Invert the given phase space point to the random numbers which would have generated it.
double invertIntermediates(const vector< Energy > &K, double *r) const
Invert intermediate masses for a massless final state.
double invertIntermediates(const vector< Energy > &M, const vector< Energy > &m, double *r) const
Invert intermediate masses for a massive final state.
FlatInvertiblePhasespace & operator=(const FlatInvertiblePhasespace &)=delete
The assignment operator is private and must never be called.
double generateIntermediates(vector< Energy > &M, const vector< Energy > &m, const double *r) const
Generate intermediate masses for a massive final state.
double generateIntermediates(vector< Energy > &K, const double *r) const
Generate intermediate masses for a massless final state.
static void Init()
The standard Init function used to initialize the interfaces.
double invertKinematics(const vector< Lorentz5Momentum > &P, Energy Ecm, double *r) const
Invert momenta in the CMS.
double rho(Energy M, Energy N, Energy m) const
Return rho.
virtual int nDimPhasespace(int nFinal) const
Return the number of random numbers required to produce a given multiplicity final state.
double generateKinematics(vector< Lorentz5Momentum > &P, Energy Ecm, const double *r) const
Generate momenta in the CMS.
virtual bool isInvertible() const
Return true, if this phase space generator is invertible.
void persistentInput(PersistentIStream &is, int version)
Function used to read in object persistently.
virtual double generateTwoToNKinematics(const double *, vector< Lorentz5Momentum > &momenta)
Generate a phase space point and return its weight.
virtual IBPtr fullclone() const
Make a clone of this object, possibly modifying the cloned object to make it sane.
MatchboxPhasespace defines an abstract interface to a phase space generator.
-*- C++ -*-
double sqrt(int x)
ThePEG::Ptr< InterfacedBase >::pointer IBPtr
constexpr auto sqr(const T &x) -> decltype(x *x)