00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include "EvtGenBase/EvtPatches.hh"
00021
00022
00023 #include "EvtGenBase/EvtRaritaSchwinger.hh"
00024 using std::endl;
00025 using std::ostream;
00026
00027 EvtRaritaSchwinger::~EvtRaritaSchwinger(){
00028 }
00029
00030
00031 EvtRaritaSchwinger rotateEuler(const EvtRaritaSchwinger& rs,
00032 double alpha,double beta,double gamma){
00033
00034 EvtRaritaSchwinger tmp(rs);
00035 tmp.applyRotateEuler(alpha,beta,gamma);
00036 return tmp;
00037
00038 }
00039
00040 EvtRaritaSchwinger boostTo(const EvtRaritaSchwinger& rs,
00041 const EvtVector4R p4){
00042
00043 EvtRaritaSchwinger tmp(rs);
00044 tmp.applyBoostTo(p4);
00045 return tmp;
00046
00047 }
00048
00049 EvtRaritaSchwinger boostTo(const EvtRaritaSchwinger& rs,
00050 const EvtVector3R boost){
00051
00052 EvtRaritaSchwinger tmp(rs);
00053 tmp.applyBoostTo(boost);
00054 return tmp;
00055
00056 }
00057
00058
00059 void EvtRaritaSchwinger::set(int i,int j,const EvtComplex& sp){_rs[i][j]=sp;}
00060
00061 EvtComplex EvtRaritaSchwinger::get(int i,int j) const {return _rs[i][j];}
00062
00063 void EvtRaritaSchwinger::applyRotateEuler(double alpha,double beta,
00064 double gamma){
00065
00066
00067 EvtVector4C v0=getVector(0);
00068 EvtVector4C v1=getVector(1);
00069 EvtVector4C v2=getVector(2);
00070 EvtVector4C v3=getVector(3);
00071 v0.applyRotateEuler(alpha,beta,gamma);
00072 v1.applyRotateEuler(alpha,beta,gamma);
00073 v2.applyRotateEuler(alpha,beta,gamma);
00074 v3.applyRotateEuler(alpha,beta,gamma);
00075 setVector(0,v0);
00076 setVector(1,v1);
00077 setVector(2,v2);
00078 setVector(3,v3);
00079 EvtDiracSpinor sp0=getSpinor(0);
00080 EvtDiracSpinor sp1=getSpinor(1);
00081 EvtDiracSpinor sp2=getSpinor(2);
00082 EvtDiracSpinor sp3=getSpinor(3);
00083 sp0.applyRotateEuler(alpha,beta,gamma);
00084 sp1.applyRotateEuler(alpha,beta,gamma);
00085 sp2.applyRotateEuler(alpha,beta,gamma);
00086 sp3.applyRotateEuler(alpha,beta,gamma);
00087 setSpinor(0,sp0);
00088 setSpinor(1,sp1);
00089 setSpinor(2,sp2);
00090 setSpinor(3,sp3);
00091
00092 }
00093
00094
00095 void EvtRaritaSchwinger::applyBoostTo(const EvtVector4R p4){
00096
00097 double e=p4.get(0);
00098
00099 EvtVector3R boost(p4.get(1)/e,p4.get(2)/e,p4.get(3)/e);
00100
00101 applyBoostTo(boost);
00102
00103 return;
00104
00105 }
00106
00107
00108 void EvtRaritaSchwinger::applyBoostTo(const EvtVector3R boost){
00109
00110
00111 EvtVector4C v0=getVector(0);
00112 EvtVector4C v1=getVector(1);
00113 EvtVector4C v2=getVector(2);
00114 EvtVector4C v3=getVector(3);
00115 v0.applyBoostTo(boost);
00116 v1.applyBoostTo(boost);
00117 v2.applyBoostTo(boost);
00118 v3.applyBoostTo(boost);
00119 setVector(0,v0);
00120 setVector(1,v1);
00121 setVector(2,v2);
00122 setVector(3,v3);
00123 EvtDiracSpinor sp0=getSpinor(0);
00124 EvtDiracSpinor sp1=getSpinor(1);
00125 EvtDiracSpinor sp2=getSpinor(2);
00126 EvtDiracSpinor sp3=getSpinor(3);
00127 sp0.applyBoostTo(boost);
00128 sp1.applyBoostTo(boost);
00129 sp2.applyBoostTo(boost);
00130 sp3.applyBoostTo(boost);
00131 setSpinor(0,sp0);
00132 setSpinor(1,sp1);
00133 setSpinor(2,sp2);
00134 setSpinor(3,sp3);
00135
00136
00137 }
00138
00139
00140 ostream& operator<<(ostream& s, const EvtRaritaSchwinger& rs){
00141
00142 int i,j;
00143 s<< endl;
00144 for(i=0;i<4;i++){
00145 for(j=0;j<4;j++){
00146 s << rs._rs[i][j];
00147 }
00148 s << endl;
00149 }
00150 return s;
00151
00152 }
00153
00154
00155
00156 EvtVector4C EvtRaritaSchwinger::getVector(int i) const{
00157
00158 EvtVector4C tmp(_rs[i][0],_rs[i][1],_rs[i][2],_rs[i][3]);
00159 return tmp;
00160
00161 }
00162
00163 EvtDiracSpinor EvtRaritaSchwinger::getSpinor(int i) const{
00164
00165 EvtDiracSpinor tmp;
00166 tmp.set(_rs[0][i],_rs[1][i],_rs[2][i],_rs[3][i]);
00167 return tmp;
00168
00169 }
00170
00171 void EvtRaritaSchwinger::setVector(int i,const EvtVector4C& v){
00172
00173 _rs[i][0]=v.get(0);
00174 _rs[i][1]=v.get(1);
00175 _rs[i][2]=v.get(2);
00176 _rs[i][3]=v.get(3);
00177
00178 }
00179
00180 void EvtRaritaSchwinger::setSpinor(int i,const EvtDiracSpinor& sp){
00181
00182 _rs[0][i]=sp.get_spinor(0);
00183 _rs[1][i]=sp.get_spinor(1);
00184 _rs[2][i]=sp.get_spinor(2);
00185 _rs[3][i]=sp.get_spinor(3);
00186
00187 }
00188
00189
00190 EvtRaritaSchwinger dirProd(EvtVector4R v,EvtDiracSpinor u){
00191
00192 int i,j;
00193
00194 EvtRaritaSchwinger tmp;
00195
00196 for(i=0;i<4;i++){
00197 for(j=0;j<4;j++){
00198 tmp._rs[i][j]=u.get_spinor(i)*v.get(j);
00199 }
00200 }
00201
00202 return tmp;
00203
00204 }
00205
00206
00207 EvtRaritaSchwinger dirProd(EvtVector4C v,EvtDiracSpinor u){
00208
00209 int i,j;
00210
00211 EvtRaritaSchwinger tmp;
00212
00213 for(i=0;i<4;i++){
00214 for(j=0;j<4;j++){
00215 tmp._rs[i][j]=u.get_spinor(i)*v.get(j);
00216 }
00217 }
00218
00219 return tmp;
00220
00221 }
00222
00223
00224 EvtComplex operator*(const EvtRaritaSchwinger& u1,
00225 const EvtRaritaSchwinger& u2){
00226
00227 int i,j;
00228 EvtComplex tmp=0.0;
00229
00230 for(i=0;i<4;i++){
00231 for(j=0;j<4;j++){
00232 tmp+=conj(u1._rs[i][j])*u2._rs[i][j];
00233 }
00234 }
00235
00236 return tmp;
00237
00238 }
00239
00240
00241
00242 EvtRaritaSchwinger& EvtRaritaSchwinger::operator+=(const EvtRaritaSchwinger& u2){
00243
00244 int i,j;
00245
00246 for(i=0;i<4;i++){
00247 for(j=0;j<4;j++){
00248 _rs[i][j]+=u2._rs[i][j];
00249 }
00250 }
00251
00252 return *this;
00253 }
00254
00255 EvtRaritaSchwinger operator+(const EvtRaritaSchwinger& u1,
00256 const EvtRaritaSchwinger& u2){
00257
00258 return EvtRaritaSchwinger(u1)+=u2;
00259
00260 }
00261
00262 EvtRaritaSchwinger& EvtRaritaSchwinger::operator-=(const EvtRaritaSchwinger& u2){
00263
00264 int i,j;
00265
00266 for(i=0;i<4;i++){
00267 for(j=0;j<4;j++){
00268 _rs[i][j]+=u2._rs[i][j];
00269 }
00270 }
00271
00272 return *this;
00273 }
00274
00275 EvtRaritaSchwinger operator-(const EvtRaritaSchwinger& u1,
00276 const EvtRaritaSchwinger& u2){
00277
00278 return EvtRaritaSchwinger(u1)-=u2;
00279
00280 }
00281
00282
00283