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
EvtDiracSpinor.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
22
28
29#include <assert.h>
30#include <math.h>
31using std::ostream;
32
34 const EvtComplex& sp2, const EvtComplex& sp3 )
35{
36 set( sp0, sp1, sp2, sp3 );
37}
38
39void EvtDiracSpinor::set( const EvtComplex& sp0, const EvtComplex& sp1,
40 const EvtComplex& sp2, const EvtComplex& sp3 )
41{
42 m_spinor[0] = sp0;
43 m_spinor[1] = sp1;
44 m_spinor[2] = sp2;
45 m_spinor[3] = sp3;
46}
47
48void EvtDiracSpinor::set_spinor( int i, const EvtComplex& sp )
49{
50 m_spinor[i] = sp;
51}
52
53ostream& operator<<( ostream& s, const EvtDiracSpinor& sp )
54{
55 s << "[" << sp.m_spinor[0] << "," << sp.m_spinor[1] << "," << sp.m_spinor[2]
56 << "," << sp.m_spinor[3] << "]";
57 return s;
58}
59
61{
62 return m_spinor[i];
63}
64
65EvtDiracSpinor rotateEuler( const EvtDiracSpinor& sp, double alpha, double beta,
66 double gamma )
67{
68 EvtDiracSpinor tmp( sp );
69 tmp.applyRotateEuler( alpha, beta, gamma );
70 return tmp;
71}
72
74{
75 EvtDiracSpinor tmp( sp );
76 tmp.applyBoostTo( p4 );
77 return tmp;
78}
79
81{
82 EvtDiracSpinor tmp( sp );
83 tmp.applyBoostTo( boost );
84 return tmp;
85}
86
88{
89 double e = p4.get( 0 );
90
91 EvtVector3R boost( p4.get( 1 ) / e, p4.get( 2 ) / e, p4.get( 3 ) / e );
92
93 applyBoostTo( boost );
94
95 return;
96}
97
99{
100 double bx, by, bz, gamma, b2, f1, f2;
101 EvtComplex spinorp[4];
102
103 bx = boost.get( 0 );
104 by = boost.get( 1 );
105 bz = boost.get( 2 );
106 b2 = bx * bx + by * by + bz * bz;
107
108 if ( b2 == 0.0 ) {
109 return;
110 }
111
112 //assert(b2<1.0);
113
114 gamma = 1.0;
115 if ( b2 < 1.0 ) {
116 gamma = 1.0 / sqrt( 1.0 - b2 );
117 }
118
119 f1 = sqrt( ( gamma + 1.0 ) / 2.0 );
120 f2 = f1 * gamma / ( gamma + 1.0 );
121
122 spinorp[0] = f1 * m_spinor[0] + f2 * bz * m_spinor[2] +
123 f2 * EvtComplex( bx, -by ) * m_spinor[3];
124 spinorp[1] = f1 * m_spinor[1] + f2 * EvtComplex( bx, by ) * m_spinor[2] -
125 f2 * bz * m_spinor[3];
126 spinorp[2] = f2 * bz * m_spinor[0] +
127 f2 * EvtComplex( bx, -by ) * m_spinor[1] + f1 * m_spinor[2];
128 spinorp[3] = f2 * EvtComplex( bx, by ) * m_spinor[0] -
129 f2 * bz * m_spinor[1] + f1 * m_spinor[3];
130
131 m_spinor[0] = spinorp[0];
132 m_spinor[1] = spinorp[1];
133 m_spinor[2] = spinorp[2];
134 m_spinor[3] = spinorp[3];
135
136 return;
137}
138
139void EvtDiracSpinor::applyRotateEuler( double alpha, double beta, double gamma )
140{
141 EvtComplex retVal[4];
142
143 double cb2 = cos( 0.5 * beta );
144 double sb2 = sin( 0.5 * beta );
145 double capg2 = cos( 0.5 * ( alpha + gamma ) );
146 double camg2 = cos( 0.5 * ( alpha - gamma ) );
147 double sapg2 = sin( 0.5 * ( alpha + gamma ) );
148 double samg2 = sin( 0.5 * ( alpha - gamma ) );
149
150 EvtComplex m11( cb2 * capg2, -cb2 * sapg2 );
151 EvtComplex m12( -sb2 * camg2, sb2 * samg2 );
152 EvtComplex m21( sb2 * camg2, sb2 * samg2 );
153 EvtComplex m22( cb2 * capg2, cb2 * sapg2 );
154
155 retVal[0] = m11 * m_spinor[0] + m12 * m_spinor[1];
156 retVal[1] = m21 * m_spinor[0] + m22 * m_spinor[1];
157 retVal[2] = m11 * m_spinor[2] + m12 * m_spinor[3];
158 retVal[3] = m21 * m_spinor[2] + m22 * m_spinor[3];
159
160 m_spinor[0] = retVal[0];
161 m_spinor[1] = retVal[1];
162 m_spinor[2] = retVal[2];
163 m_spinor[3] = retVal[3];
164
165 return;
166}
167
169{
171
172 for ( int i = 0; i < 4; i++ )
173 sp.set_spinor( i, ::conj( m_spinor[i] ) );
174
175 return sp;
176}
177
179{
180 //Old code; below is a new specialized code that does it more efficiently.
181 //EvtGammaMatrix mat;
182 //EvtVector4C temp;
183 //mat.va0();
184 //temp.set(0,d*(mat*dp));
185 //mat.va1();
186 //temp.set(1,d*(mat*dp));
187 //mat.va2();
188 //temp.set(2,d*(mat*dp));
189 //mat.va3();
190 //temp.set(3,d*(mat*dp));
191 //return temp;
192
193 EvtComplex u02 = ::conj( d.m_spinor[0] - d.m_spinor[2] );
194 EvtComplex u13 = ::conj( d.m_spinor[1] - d.m_spinor[3] );
195
196 EvtComplex v02 = dp.m_spinor[0] - dp.m_spinor[2];
197 EvtComplex v13 = dp.m_spinor[1] - dp.m_spinor[3];
198
199 EvtComplex a = u02 * v02;
200 EvtComplex b = u13 * v13;
201
202 EvtComplex c = u02 * v13;
203 EvtComplex e = u13 * v02;
204
205 return EvtVector4C( a + b, -( c + e ), EvtComplex( 0, 1 ) * ( c - e ), b - a );
206}
207
209{
210 EvtVector4C temp;
211
212 // no conjugate here; done in the multiplication
213 // yes this is stupid and fooled me to for a long time (ryd)
214
215 temp.set( 0, d * ( EvtGammaMatrix::v0() * dp ) );
216 temp.set( 1, d * ( EvtGammaMatrix::v1() * dp ) );
217 temp.set( 2, d * ( EvtGammaMatrix::v2() * dp ) );
218 temp.set( 3, d * ( EvtGammaMatrix::v3() * dp ) );
219
220 return temp;
221}
222
224{
225 EvtVector4C temp;
226
227 EvtGammaMatrix mat;
228
229 // no conjugate here; done in the multiplication
230 // yes this is stupid and fooled me to for a long time (ryd)
231
233 temp.set( 0, d * ( mat * dp ) );
234
236 temp.set( 1, d * ( mat * dp ) );
237
239 temp.set( 2, d * ( mat * dp ) );
240
242 temp.set( 3, d * ( mat * dp ) );
243
244 return temp;
245}
246
248{
249 EvtComplex temp;
250
251 // no conjugate here; done in the multiplication
252 // yes this is stupid and fooled me to for a long time (ryd)
253
254 temp = d * ( EvtGammaMatrix::g0() * dp );
255
256 return temp;
257}
258
260{
261 EvtComplex temp;
262
263 // no conjugate here; done in the multiplication
264 // yes this is stupid and fooled me to for a long time (ryd)
266 temp = d * ( m * dp );
267
268 return temp;
269}
270
272{
273 EvtTensor4C temp;
274 temp.zero();
275 EvtComplex i2( 0, 0.5 );
276
277 static const EvtGammaMatrix mat01 =
280 static const EvtGammaMatrix mat02 =
283 static const EvtGammaMatrix mat03 =
286 static const EvtGammaMatrix mat12 =
289 static const EvtGammaMatrix mat13 =
292 static const EvtGammaMatrix mat23 =
295
296 temp.set( 0, 1, i2 * ( d * ( mat01 * dp ) ) );
297 temp.set( 1, 0, -temp.get( 0, 1 ) );
298
299 temp.set( 0, 2, i2 * ( d * ( mat02 * dp ) ) );
300 temp.set( 2, 0, -temp.get( 0, 2 ) );
301
302 temp.set( 0, 3, i2 * ( d * ( mat03 * dp ) ) );
303 temp.set( 3, 0, -temp.get( 0, 3 ) );
304
305 temp.set( 1, 2, i2 * ( d * ( mat12 * dp ) ) );
306 temp.set( 2, 1, -temp.get( 1, 2 ) );
307
308 temp.set( 1, 3, i2 * ( d * ( mat13 * dp ) ) );
309 temp.set( 3, 1, -temp.get( 1, 3 ) );
310
311 temp.set( 2, 3, i2 * ( d * ( mat23 * dp ) ) );
312 temp.set( 3, 2, -temp.get( 2, 3 ) );
313
314 return temp;
315}
316
318{
319 EvtDiracSpinor result;
320 result.m_spinor[0] = c * d.m_spinor[0];
321 result.m_spinor[1] = c * d.m_spinor[1];
322 result.m_spinor[2] = c * d.m_spinor[2];
323 result.m_spinor[3] = c * d.m_spinor[3];
324 return result;
325}
326
328{
329 EvtDiracSpinor d = this->conj(); // first conjugate, then multiply with gamma0
331 EvtDiracSpinor result; // automatically initialized to 0
332
333 for ( int i = 0; i < 4; ++i )
334 for ( int j = 0; j < 4; ++j )
335 result.m_spinor[i] += d.m_spinor[j] * g0.m_gamma[i][j];
336
337 return result;
338}
339
341{
342 int i;
343 EvtComplex temp;
344
345 temp = EvtComplex( 0.0, 0.0 );
346
347 for ( i = 0; i < 4; i++ ) {
348 temp += conj( d.get_spinor( i ) ) * dp.get_spinor( i );
349 }
350 return temp;
351}
EvtComplex conj(const EvtComplex &c)
EvtDiracSpinor operator*(const EvtComplex &c, const EvtDiracSpinor &d)
EvtVector4C EvtLeptonVACurrent(const EvtDiracSpinor &d, const EvtDiracSpinor &dp)
EvtTensor4C EvtLeptonTCurrent(const EvtDiracSpinor &d, const EvtDiracSpinor &dp)
EvtVector4C EvtLeptonACurrent(const EvtDiracSpinor &d, const EvtDiracSpinor &dp)
EvtDiracSpinor rotateEuler(const EvtDiracSpinor &sp, double alpha, double beta, double gamma)
EvtComplex EvtLeptonSCurrent(const EvtDiracSpinor &d, const EvtDiracSpinor &dp)
EvtVector4C EvtLeptonVCurrent(const EvtDiracSpinor &d, const EvtDiracSpinor &dp)
ostream & operator<<(ostream &s, const EvtDiracSpinor &sp)
EvtComplex EvtLeptonPCurrent(const EvtDiracSpinor &d, const EvtDiracSpinor &dp)
EvtDiracSpinor boostTo(const EvtDiracSpinor &sp, const EvtVector4R p4)
EvtDiracSpinor conj() const
EvtComplex m_spinor[4]
const EvtComplex & get_spinor(int i) const
void set(const EvtComplex &sp0, const EvtComplex &sp1, const EvtComplex &sp2, const EvtComplex &sp3)
EvtDiracSpinor adjoint() const
void applyRotateEuler(double alpha, double beta, double gamma)
void applyBoostTo(const EvtVector4R &p4)
void set_spinor(int i, const EvtComplex &sp)
EvtComplex m_gamma[4][4]
static const EvtGammaMatrix & va1()
static const EvtGammaMatrix & v0()
static const EvtGammaMatrix & g0()
static const EvtGammaMatrix & g2()
static const EvtGammaMatrix & g1()
static const EvtGammaMatrix & va3()
static const EvtGammaMatrix & g3()
static const EvtGammaMatrix & v2()
static const EvtGammaMatrix & va0()
static const EvtGammaMatrix & va2()
static const EvtGammaMatrix & g5()
static const EvtGammaMatrix & v1()
static const EvtGammaMatrix & v3()
void set(int i, int j, const EvtComplex &c)
const EvtComplex & get(int i, int j) const
double get(int i) const
void set(int, const EvtComplex &)
double get(int i) const