EvtGen 2.2.0
Monte Carlo generator of particle decays, in particular the weak decays of heavy flavour particles such as B mesons.
Loading...
Searching...
No Matches
EvtKine.cpp
Go to the documentation of this file.
1
2/***********************************************************************
3* Copyright 1998-2020 CERN for the benefit of the EvtGen authors *
4* *
5* This file is part of EvtGen. *
6* *
7* EvtGen is free software: you can redistribute it and/or modify *
8* it under the terms of the GNU General Public License as published by *
9* the Free Software Foundation, either version 3 of the License, or *
10* (at your option) any later version. *
11* *
12* EvtGen is distributed in the hope that it will be useful, *
13* but WITHOUT ANY WARRANTY; without even the implied warranty of *
14* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15* GNU General Public License for more details. *
16* *
17* You should have received a copy of the GNU General Public License *
18* along with EvtGen. If not, see <https://www.gnu.org/licenses/>. *
19***********************************************************************/
20
21#include "EvtGenBase/EvtKine.hh"
22
29
30#include <cmath>
31
32double EvtDecayAngle( const EvtVector4R& p, const EvtVector4R& q,
33 const EvtVector4R& d )
34{
35 double pd = p * d;
36 double pq = p * q;
37 double qd = q * d;
38 double mp2 = p.mass2();
39 double mq2 = q.mass2();
40 double md2 = d.mass2();
41
42 double cost = ( pd * mq2 - pq * qd ) /
43 std::sqrt( ( pq * pq - mq2 * mp2 ) * ( qd * qd - mq2 * md2 ) );
44
45 return cost;
46}
47
48double EvtDecayAngleChi( const EvtVector4R& p4_p, const EvtVector4R& p4_d1,
49 const EvtVector4R& p4_d2, const EvtVector4R& p4_h1,
50 const EvtVector4R& p4_h2 )
51{
52 EvtVector4R p4_d1p, p4_h1p, p4_h2p, p4_d2p;
53
54 // boost all vectors parent restframe
55 // This does not boost particle to parent rest frame !!!
56 // It goes from parents rest frame to frame where parent has given momentum.
57 p4_d1p = boostTo( p4_d1, p4_p, true );
58 p4_d2p = boostTo( p4_d2, p4_p, true );
59 p4_h1p = boostTo( p4_h1, p4_p, true );
60 p4_h2p = boostTo( p4_h2, p4_p, true );
61
62 EvtVector4R d1_perp, d1_prime, h1_perp;
64
65 D = p4_d1p + p4_d2p;
66
67 d1_perp = p4_d1p - ( D.dot( p4_d1p ) / D.dot( D ) ) * D;
68 h1_perp = p4_h1p - ( D.dot( p4_h1p ) / D.dot( D ) ) * D;
69
70 // orthogonal to both D and d1_perp
71
72 d1_prime = D.cross( d1_perp );
73
74 d1_perp = d1_perp / d1_perp.d3mag();
75 d1_prime = d1_prime / d1_prime.d3mag();
76
77 double x, y;
78
79 x = d1_perp.dot( h1_perp );
80 y = d1_prime.dot( h1_perp );
81
82 double chi = std::atan2( y, x );
83
84 if ( chi < 0.0 )
85 chi += EvtConst::twoPi;
86
87 return chi;
88}
89
91 const EvtVector4R& d1, const EvtVector4R& d2 )
92{
94
95 EvtVector4R l( real( lc.get( 0 ) ), real( lc.get( 1 ) ),
96 real( lc.get( 2 ) ), real( lc.get( 3 ) ) );
97
98 double pq = p * q;
99
100 return q.mass() * ( p * l ) /
101 std::sqrt( -( pq * pq - p.mass2() * q.mass2() ) * l.mass2() );
102}
103
104// Calculate phi using the given 4 vectors (all in the same frame)
105double EvtDecayAnglePhi( const EvtVector4R& z, const EvtVector4R& p,
106 const EvtVector4R& q, const EvtVector4R& d )
107{
108 double eq = ( p * q ) / p.mass();
109 double ed = ( p * d ) / p.mass();
110 double mq = q.mass();
111 double q2 = p.mag2r3( q );
112 double qd = p.dotr3( q, d );
113 double zq = p.dotr3( z, q );
114 double zd = p.dotr3( z, d );
115 double alpha = ( eq - mq ) / ( q2 * mq ) * qd - ed / mq;
116
117 double y = p.scalartripler3( z, q, d ) + alpha * p.scalartripler3( z, q, q );
118 double x = ( zq * ( qd + alpha * q2 ) - q2 * ( zd + alpha * zq ) ) /
119 std::sqrt( q2 );
120
121 double phi = std::atan2( y, x );
122
123 return phi < 0 ? ( phi + EvtConst::twoPi ) : phi;
124}
125
126EvtComplex wignerD( int j, int m1, int m2, double phi, double theta, double gamma )
127{
128 EvtComplex gp( 0.0, -phi * m1 );
129 EvtComplex gm( 0.0, -gamma * m2 );
130
131 return exp( gp ) * EvtdFunction::d( j, m1, m2, theta ) * exp( gm );
132}
133
134double twoBodyMomentum( const double M, const double m1, const double m2 )
135{
136 const double MSq = M * M;
137 const double mSum = m1 + m2;
138 const double mDiff = m1 - m2;
139 double result = ( MSq - mDiff * mDiff ) * ( MSq - mSum * mSum );
140 if ( result < 0 ) {
141 return 0;
142 }
143 return std::sqrt( result ) / ( 2 * M );
144}
double real(const EvtComplex &c)
EvtComplex exp(const EvtComplex &c)
double EvtDecayPlaneNormalAngle(const EvtVector4R &p, const EvtVector4R &q, const EvtVector4R &d1, const EvtVector4R &d2)
Definition EvtKine.cpp:90
double EvtDecayAnglePhi(const EvtVector4R &z, const EvtVector4R &p, const EvtVector4R &q, const EvtVector4R &d)
Definition EvtKine.cpp:105
double EvtDecayAngle(const EvtVector4R &p, const EvtVector4R &q, const EvtVector4R &d)
Definition EvtKine.cpp:32
EvtComplex wignerD(int j, int m1, int m2, double phi, double theta, double gamma)
Definition EvtKine.cpp:126
double EvtDecayAngleChi(const EvtVector4R &p4_p, const EvtVector4R &p4_d1, const EvtVector4R &p4_d2, const EvtVector4R &p4_h1, const EvtVector4R &p4_h2)
Definition EvtKine.cpp:48
double twoBodyMomentum(const double M, const double m1, const double m2)
Definition EvtKine.cpp:134
EvtRaritaSchwinger boostTo(const EvtRaritaSchwinger &rs, const EvtVector4R p4)
EvtTensor4C dual(const EvtTensor4C &t2)
static const double twoPi
Definition EvtConst.hh:27
EvtVector4C cont2(const EvtVector4C &v4) const
const EvtComplex & get(int) const
double dot(const EvtVector4R &v2) const
double mass() const
double d3mag() const
double dotr3(const EvtVector4R &p1, const EvtVector4R &p2) const
double scalartripler3(const EvtVector4R &p1, const EvtVector4R &p2, const EvtVector4R &p3) const
double mag2r3(const EvtVector4R &p1) const
EvtVector4R cross(const EvtVector4R &v2) const
double mass2() const
static double d(int j, int m1, int m2, double theta)
EvtTensor3C directProd(const EvtVector3C &c1, const EvtVector3C &c2)