herwig is hosted by Hepforge, IPPP Durham
Herwig 7.3.0
Kinematics.h
1// -*- C++ -*-
2//
3// Kinematics.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//
10#ifndef HERWIG_Kinematics_H
11#define HERWIG_Kinematics_H
12
13// This is the declaration of the Kinematics class.
14
17#include "ThePEG/Vectors/LorentzRotation.h"
18#include "ThePEG/Repository/UseRandom.h"
19#include <ThePEG/Vectors/Lorentz5Vector.h>
20
21namespace Herwig {
22
23 using namespace ThePEG;
24
33 namespace Kinematics {
34
46 bool twoBodyDecay(const Lorentz5Momentum & p,
47 const Energy m1, const Energy m2,
48 const Axis & unitDir1,
49 Lorentz5Momentum & p1, Lorentz5Momentum & p2);
50
54 inline Axis unitDirection(const double cosTheta, const double phi) {
55 return ( fabs( cosTheta ) <= 1.0 ?
56 Axis( cos(phi)*sqrt(1.0-cosTheta*cosTheta) ,
57 sin(phi)*sqrt(1.0-cosTheta*cosTheta) , cosTheta) : Axis() );
58 }
59
71 inline bool twoBodyDecay(const Lorentz5Momentum & p,
72 const Energy m1, const Energy m2,
73 const double cosThetaStar1,
74 const double phiStar1,
75 Lorentz5Momentum & p1, Lorentz5Momentum & p2) {
76 return twoBodyDecay(p,m1,m2,unitDirection(cosThetaStar1,phiStar1),p1,p2);
77 }
78
85 bool threeBodyDecay(Lorentz5Momentum p0, Lorentz5Momentum &p1,
86 Lorentz5Momentum &p2, Lorentz5Momentum &p3,
87 double (*fcn)(Energy2,Energy2,Energy2,InvEnergy4) = NULL);
88
93 inline Energy pstarTwoBodyDecay(const Energy M,
94 const Energy m1, const Energy m2) {
95 return ( M > ZERO && m1 >=ZERO && m2 >= ZERO && M > m1+m2 ?
96 Energy(sqrt(( sqr(M) - sqr(m1+m2) )*( sqr(M) - sqr(m1-m2) ))
97 / (2.0*M) ) : ZERO);
98 }
99
103 inline void generateAngles(double & ct, double & az) {
104 ct = UseRandom::rnd()*2.0 - 1.0; // Flat from -1..1
106 }
107 }
108
109}
110
111#endif /* HERWIG_Kinematics_H */
112
static double rnd()
Axis unitDirection(const double cosTheta, const double phi)
It returns the unit 3-vector with the given cosTheta and phi.
Definition: Kinematics.h:54
void generateAngles(double &ct, double &az)
This just generates angles.
Definition: Kinematics.h:103
Energy pstarTwoBodyDecay(const Energy M, const Energy m1, const Energy m2)
For the two body decay M -> m1 + m2 it gives the module of the 3-momentum of the decay product in the...
Definition: Kinematics.h:93
bool twoBodyDecay(const Lorentz5Momentum &p, const Energy m1, const Energy m2, const Axis &unitDir1, Lorentz5Momentum &p1, Lorentz5Momentum &p2)
Calculate the momenta for a two body decay The return value indicates success or failure.
bool threeBodyDecay(Lorentz5Momentum p0, Lorentz5Momentum &p1, Lorentz5Momentum &p2, Lorentz5Momentum &p3, double(*fcn)(Energy2, Energy2, Energy2, InvEnergy4)=NULL)
As the name implies, this takes the momentum p0 and does a flat three body decay into p1....
-*- C++ -*-
constexpr double twopi
double sqrt(int x)
constexpr ZeroUnit ZERO
constexpr auto sqr(const T &x) -> decltype(x *x)