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