evtgen is hosted by Hepforge, IPPP Durham
EvtGen  2.0.0
Monte Carlo generator of particle decays, in particular the weak decays of heavy flavour particles such as B mesons.
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 
23 #include "EvtGenBase/EvtConst.hh"
24 #include "EvtGenBase/EvtPatches.hh"
25 #include "EvtGenBase/EvtReport.hh"
30 
31 #include <cmath>
32 
33 double EvtDecayAngle( const EvtVector4R& p, const EvtVector4R& q,
34  const EvtVector4R& d )
35 {
36  double pd = p * d;
37  double pq = p * q;
38  double qd = q * d;
39  double mp2 = p.mass2();
40  double mq2 = q.mass2();
41  double md2 = d.mass2();
42 
43  double cost = ( pd * mq2 - pq * qd ) /
44  std::sqrt( ( pq * pq - mq2 * mp2 ) * ( qd * qd - mq2 * md2 ) );
45 
46  return cost;
47 }
48 
49 double EvtDecayAngleChi( const EvtVector4R& p4_p, const EvtVector4R& p4_d1,
50  const EvtVector4R& p4_d2, const EvtVector4R& p4_h1,
51  const EvtVector4R& p4_h2 )
52 {
53  EvtVector4R p4_d1p, p4_h1p, p4_h2p, p4_d2p;
54 
55  // boost all vectors parent restframe
56  // This does not boost particle to parent rest frame !!!
57  // It goes from parents rest frame to frame where parent has given momentum.
58  p4_d1p = boostTo( p4_d1, p4_p, true );
59  p4_d2p = boostTo( p4_d2, p4_p, true );
60  p4_h1p = boostTo( p4_h1, p4_p, true );
61  p4_h2p = boostTo( p4_h2, p4_p, true );
62 
63  EvtVector4R d1_perp, d1_prime, h1_perp;
64  EvtVector4R D;
65 
66  D = p4_d1p + p4_d2p;
67 
68  d1_perp = p4_d1p - ( D.dot( p4_d1p ) / D.dot( D ) ) * D;
69  h1_perp = p4_h1p - ( D.dot( p4_h1p ) / D.dot( D ) ) * D;
70 
71  // orthogonal to both D and d1_perp
72 
73  d1_prime = D.cross( d1_perp );
74 
75  d1_perp = d1_perp / d1_perp.d3mag();
76  d1_prime = d1_prime / d1_prime.d3mag();
77 
78  double x, y;
79 
80  x = d1_perp.dot( h1_perp );
81  y = d1_prime.dot( h1_perp );
82 
83  double chi = std::atan2( y, x );
84 
85  if ( chi < 0.0 )
86  chi += EvtConst::twoPi;
87 
88  return chi;
89 }
90 
92  const EvtVector4R& d1, const EvtVector4R& d2 )
93 {
94  EvtVector4C lc = dual( EvtGenFunctions::directProd( d1, d2 ) ).cont2( q );
95 
96  EvtVector4R l( real( lc.get( 0 ) ), real( lc.get( 1 ) ),
97  real( lc.get( 2 ) ), real( lc.get( 3 ) ) );
98 
99  double pq = p * q;
100 
101  return q.mass() * ( p * l ) /
102  std::sqrt( -( pq * pq - p.mass2() * q.mass2() ) * l.mass2() );
103 }
104 
105 // Calculate phi using the given 4 vectors (all in the same frame)
106 double EvtDecayAnglePhi( const EvtVector4R& z, const EvtVector4R& p,
107  const EvtVector4R& q, const EvtVector4R& d )
108 {
109  double eq = ( p * q ) / p.mass();
110  double ed = ( p * d ) / p.mass();
111  double mq = q.mass();
112  double q2 = p.mag2r3( q );
113  double qd = p.dotr3( q, d );
114  double zq = p.dotr3( z, q );
115  double zd = p.dotr3( z, d );
116  double alpha = ( eq - mq ) / ( q2 * mq ) * qd - ed / mq;
117 
118  double y = p.scalartripler3( z, q, d ) + alpha * p.scalartripler3( z, q, q );
119  double x = ( zq * ( qd + alpha * q2 ) - q2 * ( zd + alpha * zq ) ) /
120  std::sqrt( q2 );
121 
122  double phi = std::atan2( y, x );
123 
124  return phi < 0 ? ( phi + EvtConst::twoPi ) : phi;
125 }
126 
127 EvtComplex wignerD( int j, int m1, int m2, double phi, double theta, double gamma )
128 {
129  EvtComplex gp( 0.0, -phi * m1 );
130  EvtComplex gm( 0.0, -gamma * m2 );
131 
132  return exp( gp ) * EvtdFunction::d( j, m1, m2, theta ) * exp( gm );
133 }
134 
135 double twoBodyMomentum( const double M, const double m1, const double m2 )
136 {
137  const double MSq = M * M;
138  const double mSum = m1 + m2;
139  const double mDiff = m1 - m2;
140  double result = ( MSq - mDiff * mDiff ) * ( MSq - mSum * mSum );
141  if ( result < 0 ) {
142  return 0;
143  }
144  return std::sqrt( result ) / ( 2 * M );
145 }
EvtTensor3C directProd(const EvtVector3C &c1, const EvtVector3C &c2)
double dotr3(const EvtVector4R &p1, const EvtVector4R &p2) const
EvtTensor4C dual(const EvtTensor4C &t2)
EvtVector4R cross(const EvtVector4R &v2)
double mass() const
Definition: EvtVector4R.cpp:49
EvtVector4C cont2(const EvtVector4C &v4) const
static const double twoPi
Definition: EvtConst.hh:27
EvtComplex wignerD(int j, int m1, int m2, double phi, double theta, double gamma)
Definition: EvtKine.cpp:127
double mag2r3(const EvtVector4R &p1) const
EvtRaritaSchwinger boostTo(const EvtRaritaSchwinger &rs, const EvtVector4R p4)
double mass2() const
Definition: EvtVector4R.hh:100
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:49
double d3mag() const
EvtComplex exp(const EvtComplex &c)
Definition: EvtComplex.hh:240
double twoBodyMomentum(const double M, const double m1, const double m2)
Definition: EvtKine.cpp:135
const EvtComplex & get(int) const
Definition: EvtVector4C.hh:125
double EvtDecayAnglePhi(const EvtVector4R &z, const EvtVector4R &p, const EvtVector4R &q, const EvtVector4R &d)
Definition: EvtKine.cpp:106
static double d(int j, int m1, int m2, double theta)
double scalartripler3(const EvtVector4R &p1, const EvtVector4R &p2, const EvtVector4R &p3) const
double EvtDecayPlaneNormalAngle(const EvtVector4R &p, const EvtVector4R &q, const EvtVector4R &d1, const EvtVector4R &d2)
Definition: EvtKine.cpp:91
double real(const EvtComplex &c)
Definition: EvtComplex.hh:230
double EvtDecayAngle(const EvtVector4R &p, const EvtVector4R &q, const EvtVector4R &d)
Definition: EvtKine.cpp:33
double dot(const EvtVector4R &v2) const