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.
EvtRaritaSchwinger.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/EvtPatches.hh"
24 using std::endl;
25 using std::ostream;
26 
28  double beta, double gamma )
29 {
30  EvtRaritaSchwinger tmp( rs );
31  tmp.applyRotateEuler( alpha, beta, gamma );
32  return tmp;
33 }
34 
36 {
37  EvtRaritaSchwinger tmp( rs );
38  tmp.applyBoostTo( p4 );
39  return tmp;
40 }
41 
43 {
44  EvtRaritaSchwinger tmp( rs );
45  tmp.applyBoostTo( boost );
46  return tmp;
47 }
48 
49 void EvtRaritaSchwinger::set( int i, int j, const EvtComplex& sp )
50 {
51  _rs[i][j] = sp;
52 }
53 
54 EvtComplex EvtRaritaSchwinger::get( int i, int j ) const
55 {
56  return _rs[i][j];
57 }
58 
59 void EvtRaritaSchwinger::applyRotateEuler( double alpha, double beta,
60  double gamma )
61 {
62  //inefficient but simple to code...
63  EvtVector4C v0 = getVector( 0 );
64  EvtVector4C v1 = getVector( 1 );
65  EvtVector4C v2 = getVector( 2 );
66  EvtVector4C v3 = getVector( 3 );
67  v0.applyRotateEuler( alpha, beta, gamma );
68  v1.applyRotateEuler( alpha, beta, gamma );
69  v2.applyRotateEuler( alpha, beta, gamma );
70  v3.applyRotateEuler( alpha, beta, gamma );
71  setVector( 0, v0 );
72  setVector( 1, v1 );
73  setVector( 2, v2 );
74  setVector( 3, v3 );
75  EvtDiracSpinor sp0 = getSpinor( 0 );
76  EvtDiracSpinor sp1 = getSpinor( 1 );
77  EvtDiracSpinor sp2 = getSpinor( 2 );
78  EvtDiracSpinor sp3 = getSpinor( 3 );
79  sp0.applyRotateEuler( alpha, beta, gamma );
80  sp1.applyRotateEuler( alpha, beta, gamma );
81  sp2.applyRotateEuler( alpha, beta, gamma );
82  sp3.applyRotateEuler( alpha, beta, gamma );
83  setSpinor( 0, sp0 );
84  setSpinor( 1, sp1 );
85  setSpinor( 2, sp2 );
86  setSpinor( 3, sp3 );
87 }
88 
90 {
91  double e = p4.get( 0 );
92 
93  EvtVector3R boost( p4.get( 1 ) / e, p4.get( 2 ) / e, p4.get( 3 ) / e );
94 
95  applyBoostTo( boost );
96 
97  return;
98 }
99 
101 {
102  //inefficient but simple to code...
103  EvtVector4C v0 = getVector( 0 );
104  EvtVector4C v1 = getVector( 1 );
105  EvtVector4C v2 = getVector( 2 );
106  EvtVector4C v3 = getVector( 3 );
107  v0.applyBoostTo( boost );
108  v1.applyBoostTo( boost );
109  v2.applyBoostTo( boost );
110  v3.applyBoostTo( boost );
111  setVector( 0, v0 );
112  setVector( 1, v1 );
113  setVector( 2, v2 );
114  setVector( 3, v3 );
115  EvtDiracSpinor sp0 = getSpinor( 0 );
116  EvtDiracSpinor sp1 = getSpinor( 1 );
117  EvtDiracSpinor sp2 = getSpinor( 2 );
118  EvtDiracSpinor sp3 = getSpinor( 3 );
119  sp0.applyBoostTo( boost );
120  sp1.applyBoostTo( boost );
121  sp2.applyBoostTo( boost );
122  sp3.applyBoostTo( boost );
123  setSpinor( 0, sp0 );
124  setSpinor( 1, sp1 );
125  setSpinor( 2, sp2 );
126  setSpinor( 3, sp3 );
127 }
128 
129 ostream& operator<<( ostream& s, const EvtRaritaSchwinger& rs )
130 {
131  int i, j;
132  s << endl;
133  for ( i = 0; i < 4; i++ ) {
134  for ( j = 0; j < 4; j++ ) {
135  s << rs._rs[i][j];
136  }
137  s << endl;
138  }
139  return s;
140 }
141 
143 {
144  EvtVector4C tmp( _rs[i][0], _rs[i][1], _rs[i][2], _rs[i][3] );
145  return tmp;
146 }
147 
149 {
150  EvtDiracSpinor tmp;
151  tmp.set( _rs[0][i], _rs[1][i], _rs[2][i], _rs[3][i] );
152  return tmp;
153 }
154 
156 {
157  _rs[i][0] = v.get( 0 );
158  _rs[i][1] = v.get( 1 );
159  _rs[i][2] = v.get( 2 );
160  _rs[i][3] = v.get( 3 );
161 }
162 
164 {
165  _rs[0][i] = sp.get_spinor( 0 );
166  _rs[1][i] = sp.get_spinor( 1 );
167  _rs[2][i] = sp.get_spinor( 2 );
168  _rs[3][i] = sp.get_spinor( 3 );
169 }
170 
172 {
173  int i, j;
174 
175  EvtRaritaSchwinger tmp;
176 
177  for ( i = 0; i < 4; i++ ) {
178  for ( j = 0; j < 4; j++ ) {
179  tmp._rs[i][j] = u.get_spinor( i ) * v.get( j );
180  }
181  }
182 
183  return tmp;
184 }
185 
187 {
188  int i, j;
189 
190  EvtRaritaSchwinger tmp;
191 
192  for ( i = 0; i < 4; i++ ) {
193  for ( j = 0; j < 4; j++ ) {
194  tmp._rs[i][j] = u.get_spinor( i ) * v.get( j );
195  }
196  }
197 
198  return tmp;
199 }
200 
202 {
203  int i, j;
204  EvtComplex tmp = 0.0;
205 
206  for ( i = 0; i < 4; i++ ) {
207  for ( j = 0; j < 4; j++ ) {
208  tmp += conj( u1._rs[i][j] ) * u2._rs[i][j];
209  }
210  }
211 
212  return tmp;
213 }
214 
216 {
217  int i, j;
218 
219  for ( i = 0; i < 4; i++ ) {
220  for ( j = 0; j < 4; j++ ) {
221  _rs[i][j] += u2._rs[i][j];
222  }
223  }
224 
225  return *this;
226 }
227 
229  const EvtRaritaSchwinger& u2 )
230 {
231  return EvtRaritaSchwinger( u1 ) += u2;
232 }
233 
235 {
236  int i, j;
237 
238  for ( i = 0; i < 4; i++ ) {
239  for ( j = 0; j < 4; j++ ) {
240  _rs[i][j] += u2._rs[i][j];
241  }
242  }
243 
244  return *this;
245 }
246 
248  const EvtRaritaSchwinger& u2 )
249 {
250  return EvtRaritaSchwinger( u1 ) -= u2;
251 }
EvtRaritaSchwinger dirProd(EvtVector4R v, EvtDiracSpinor u)
EvtComplex _rs[4][4]
void set(int i, int j, const EvtComplex &sp)
EvtRaritaSchwinger rotateEuler(const EvtRaritaSchwinger &rs, double alpha, double beta, double gamma)
void applyRotateEuler(double alpha, double beta, double gamma)
EvtRaritaSchwinger operator+(const EvtRaritaSchwinger &u1, const EvtRaritaSchwinger &u2)
void applyRotateEuler(double alpha, double beta, double gamma)
void setSpinor(int i, const EvtDiracSpinor &sp)
Evt3Rank3C conj(const Evt3Rank3C &t2)
Definition: Evt3Rank3C.cpp:172
EvtComplex get(int i, int j) const
EvtRaritaSchwinger operator-(const EvtRaritaSchwinger &u1, const EvtRaritaSchwinger &u2)
double get(int i) const
Definition: EvtVector4R.hh:162
void setVector(int i, const EvtVector4C &v)
EvtRaritaSchwinger boostTo(const EvtRaritaSchwinger &rs, const EvtVector4R p4)
EvtRaritaSchwinger & operator-=(const EvtRaritaSchwinger &u2)
EvtRaritaSchwinger & operator+=(const EvtRaritaSchwinger &u2)
void set(const EvtComplex &sp0, const EvtComplex &sp1, const EvtComplex &sp2, const EvtComplex &sp3)
ostream & operator<<(ostream &s, const EvtRaritaSchwinger &rs)
const EvtComplex & get(int) const
Definition: EvtVector4C.hh:125
EvtVector4C getVector(int i) const
void applyBoostTo(const EvtVector4R &p4)
const EvtComplex & get_spinor(int i) const
EvtDiracSpinor getSpinor(int i) const
EvtComplex operator *(const EvtRaritaSchwinger &u1, const EvtRaritaSchwinger &u2)
void applyBoostTo(const EvtVector4R p4)
void applyRotateEuler(double alpha, double beta, double gamma)
void applyBoostTo(const EvtVector4R &p4)
Definition: EvtVector4C.cpp:70