]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TEvtGen/EvtGen/EvtGenBase/EvtRaritaSchwinger.cpp
Converting TEvtGen to native cmake
[u/mrichter/AliRoot.git] / TEvtGen / EvtGen / EvtGenBase / EvtRaritaSchwinger.cpp
CommitLineData
da0e9ce3 1//--------------------------------------------------------------------------
2//
3// Environment:
4// This software is part of the EvtGen package developed jointly
5// for the BaBar and CLEO collaborations. If you use all or part
6// of it, please give an appropriate acknowledgement.
7//
8// Copyright Information: See EvtGen/COPYRIGHT
9// Copyright (C) 2000 Caltech, UCSB
10//
11// Module: EvtGen/EvtRaritaSchwing.hh
12//
13// Description:Class to handle spin 3/2
14//
15// Modification history:
16//
17// RYD April 23, 2000 Module created
18//
19//------------------------------------------------------------------------
20#include "EvtGenBase/EvtPatches.hh"
21
22
23#include "EvtGenBase/EvtRaritaSchwinger.hh"
24using std::endl;
25using std::ostream;
26
27EvtRaritaSchwinger::~EvtRaritaSchwinger(){}
28
29
30EvtRaritaSchwinger rotateEuler(const EvtRaritaSchwinger& rs,
31 double alpha,double beta,double gamma){
32
33 EvtRaritaSchwinger tmp(rs);
34 tmp.applyRotateEuler(alpha,beta,gamma);
35 return tmp;
36
37}
38
39EvtRaritaSchwinger boostTo(const EvtRaritaSchwinger& rs,
40 const EvtVector4R p4){
41
42 EvtRaritaSchwinger tmp(rs);
43 tmp.applyBoostTo(p4);
44 return tmp;
45
46}
47
48EvtRaritaSchwinger boostTo(const EvtRaritaSchwinger& rs,
49 const EvtVector3R boost){
50
51 EvtRaritaSchwinger tmp(rs);
52 tmp.applyBoostTo(boost);
53 return tmp;
54
55}
56
57
58void EvtRaritaSchwinger::set(int i,int j,const EvtComplex& sp){_rs[i][j]=sp;}
59
60EvtComplex EvtRaritaSchwinger::get(int i,int j) const {return _rs[i][j];}
61
62void EvtRaritaSchwinger::applyRotateEuler(double alpha,double beta,
63 double gamma){
64
65 //inefficient but simple to code...
66 EvtVector4C v0=getVector(0);
67 EvtVector4C v1=getVector(1);
68 EvtVector4C v2=getVector(2);
69 EvtVector4C v3=getVector(3);
70 v0.applyRotateEuler(alpha,beta,gamma);
71 v1.applyRotateEuler(alpha,beta,gamma);
72 v2.applyRotateEuler(alpha,beta,gamma);
73 v3.applyRotateEuler(alpha,beta,gamma);
74 setVector(0,v0);
75 setVector(1,v1);
76 setVector(2,v2);
77 setVector(3,v3);
78 EvtDiracSpinor sp0=getSpinor(0);
79 EvtDiracSpinor sp1=getSpinor(1);
80 EvtDiracSpinor sp2=getSpinor(2);
81 EvtDiracSpinor sp3=getSpinor(3);
82 sp0.applyRotateEuler(alpha,beta,gamma);
83 sp1.applyRotateEuler(alpha,beta,gamma);
84 sp2.applyRotateEuler(alpha,beta,gamma);
85 sp3.applyRotateEuler(alpha,beta,gamma);
86 setSpinor(0,sp0);
87 setSpinor(1,sp1);
88 setSpinor(2,sp2);
89 setSpinor(3,sp3);
90
91}
92
93
94void EvtRaritaSchwinger::applyBoostTo(const EvtVector4R p4){
95
96 double e=p4.get(0);
97
98 EvtVector3R boost(p4.get(1)/e,p4.get(2)/e,p4.get(3)/e);
99
100 applyBoostTo(boost);
101
102 return;
103
104}
105
106
107void EvtRaritaSchwinger::applyBoostTo(const EvtVector3R boost){
108
109 //inefficient but simple to code...
110 EvtVector4C v0=getVector(0);
111 EvtVector4C v1=getVector(1);
112 EvtVector4C v2=getVector(2);
113 EvtVector4C v3=getVector(3);
114 v0.applyBoostTo(boost);
115 v1.applyBoostTo(boost);
116 v2.applyBoostTo(boost);
117 v3.applyBoostTo(boost);
118 setVector(0,v0);
119 setVector(1,v1);
120 setVector(2,v2);
121 setVector(3,v3);
122 EvtDiracSpinor sp0=getSpinor(0);
123 EvtDiracSpinor sp1=getSpinor(1);
124 EvtDiracSpinor sp2=getSpinor(2);
125 EvtDiracSpinor sp3=getSpinor(3);
126 sp0.applyBoostTo(boost);
127 sp1.applyBoostTo(boost);
128 sp2.applyBoostTo(boost);
129 sp3.applyBoostTo(boost);
130 setSpinor(0,sp0);
131 setSpinor(1,sp1);
132 setSpinor(2,sp2);
133 setSpinor(3,sp3);
134
135
136}
137
138
139ostream& operator<<(ostream& s, const EvtRaritaSchwinger& rs){
140
141 int i,j;
142 s<< endl;
143 for(i=0;i<4;i++){
144 for(j=0;j<4;j++){
145 s << rs._rs[i][j];
146 }
147 s << endl;
148 }
149 return s;
150
151}
152
153
154
155EvtVector4C EvtRaritaSchwinger::getVector(int i) const{
156
157 EvtVector4C tmp(_rs[i][0],_rs[i][1],_rs[i][2],_rs[i][3]);
158 return tmp;
159
160}
161
162EvtDiracSpinor EvtRaritaSchwinger::getSpinor(int i) const{
163
164 EvtDiracSpinor tmp;
165 tmp.set(_rs[0][i],_rs[1][i],_rs[2][i],_rs[3][i]);
166 return tmp;
167
168}
169
170void EvtRaritaSchwinger::setVector(int i,const EvtVector4C& v){
171
172 _rs[i][0]=v.get(0);
173 _rs[i][1]=v.get(1);
174 _rs[i][2]=v.get(2);
175 _rs[i][3]=v.get(3);
176
177}
178
179void EvtRaritaSchwinger::setSpinor(int i,const EvtDiracSpinor& sp){
180
181 _rs[0][i]=sp.get_spinor(0);
182 _rs[1][i]=sp.get_spinor(1);
183 _rs[2][i]=sp.get_spinor(2);
184 _rs[3][i]=sp.get_spinor(3);
185
186}
187
188
189EvtRaritaSchwinger dirProd(EvtVector4R v,EvtDiracSpinor u){
190
191 int i,j;
192
193 EvtRaritaSchwinger tmp;
194
195 for(i=0;i<4;i++){
196 for(j=0;j<4;j++){
197 tmp._rs[i][j]=u.get_spinor(i)*v.get(j);
198 }
199 }
200
201 return tmp;
202
203}
204
205
206EvtRaritaSchwinger dirProd(EvtVector4C v,EvtDiracSpinor u){
207
208 int i,j;
209
210 EvtRaritaSchwinger tmp;
211
212 for(i=0;i<4;i++){
213 for(j=0;j<4;j++){
214 tmp._rs[i][j]=u.get_spinor(i)*v.get(j);
215 }
216 }
217
218 return tmp;
219
220}
221
222
223EvtComplex operator*(const EvtRaritaSchwinger& u1,
224 const EvtRaritaSchwinger& u2){
225
226 int i,j;
227 EvtComplex tmp=0.0;
228
229 for(i=0;i<4;i++){
230 for(j=0;j<4;j++){
231 tmp+=conj(u1._rs[i][j])*u2._rs[i][j];
232 }
233 }
234
235 return tmp;
236
237}
238
239
240
241EvtRaritaSchwinger& EvtRaritaSchwinger::operator+=(const EvtRaritaSchwinger& u2){
242
243 int i,j;
244
245 for(i=0;i<4;i++){
246 for(j=0;j<4;j++){
247 _rs[i][j]+=u2._rs[i][j];
248 }
249 }
250
251 return *this;
252}
253
254EvtRaritaSchwinger operator+(const EvtRaritaSchwinger& u1,
255 const EvtRaritaSchwinger& u2){
256
257 return EvtRaritaSchwinger(u1)+=u2;
258
259}
260
261EvtRaritaSchwinger& EvtRaritaSchwinger::operator-=(const EvtRaritaSchwinger& u2){
262
263 int i,j;
264
265 for(i=0;i<4;i++){
266 for(j=0;j<4;j++){
267 _rs[i][j]+=u2._rs[i][j];
268 }
269 }
270
271 return *this;
272}
273
274EvtRaritaSchwinger operator-(const EvtRaritaSchwinger& u1,
275 const EvtRaritaSchwinger& u2){
276
277 return EvtRaritaSchwinger(u1)-=u2;
278
279}
280
281