Fix for definitions for CINT
[u/mrichter/AliRoot.git] / TEvtGen / EvtGen / EvtGenBase / EvtRaritaSchwingerParticle.cpp
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) 1998      Caltech, UCSB
10 //
11 // Module: EvtRaritaSchwingerParticle.cc
12 //
13 // Description: Class to describe spin 1/2 particles.
14 //
15 // Modification history:
16 //
17 //   RYD     August 9, 2000         Module created
18 //
19 //------------------------------------------------------------------------
20 // 
21 #include "EvtGenBase/EvtPatches.hh"
22 #include <stdlib.h>
23 #include <iostream>
24 #include <math.h>
25 #include "EvtGenBase/EvtComplex.hh"
26 #include "EvtGenBase/EvtRaritaSchwingerParticle.hh"
27 #include "EvtGenBase/EvtDiracSpinor.hh"
28 #include "EvtGenBase/EvtVector4R.hh"
29 #include "EvtGenBase/EvtPDL.hh"
30 #include "EvtGenBase/EvtReport.hh"
31 using std::endl;
32
33 EvtRaritaSchwingerParticle::~EvtRaritaSchwingerParticle(){}
34
35
36 EvtRaritaSchwingerParticle::EvtRaritaSchwingerParticle(){
37
38   return;
39   
40 }
41
42 void EvtRaritaSchwingerParticle::init(EvtId id,const EvtVector4R& p4){
43
44     _validP4=true;
45     setp(p4);
46     setpart_num(id);
47     
48     if (EvtPDL::getStdHep(id)==0){
49         report(ERROR,"EvtGen") << "Error in EvtRaritaSchwingerParticle::init, part_n="
50                                << id.getId()<<endl;
51         ::abort();
52     }
53   
54   
55   
56     double sqmt2=sqrt(2.0*(this->getP4().mass()));
57   
58     EvtDiracSpinor spplus;
59     EvtDiracSpinor spminus;
60       
61     if (EvtPDL::getStdHep(getId())>0){  
62         spplus.set(sqmt2,0.0,0.0,0.0);
63         spminus.set(0.0,sqmt2,0.0,0.0);
64     } else {
65         spplus.set(0.0,0.0,sqmt2,0.0);
66         spminus.set(0.0,0.0,0.0,sqmt2);
67     }
68
69     static EvtVector4C eplus(0.0,-1.0/sqrt(2.0),EvtComplex(0.0,-1.0/sqrt(2.0)),0.0);
70     static EvtVector4C ezero(0.0,0.0,0.0,1.0);
71     static EvtVector4C eminus(0.0,1.0/sqrt(2.0),EvtComplex(0.0,-1.0/sqrt(2.0)),0.0);
72
73     _spinorRest[0]=dirProd(eplus,spplus);
74     _spinorRest[1]=dirProd(sqrt(2.0/3.0)*ezero,spplus)+
75         dirProd(sqrt(1.0/3.0)*eplus,spminus);
76     _spinorRest[2]=dirProd(sqrt(2.0/3.0)*ezero,spminus)+
77         dirProd(sqrt(1.0/3.0)*eminus,spplus);
78     _spinorRest[3]=dirProd(eminus,spminus);
79     
80     _spinor[0]=boostTo(_spinorRest[0],p4);
81     _spinor[1]=boostTo(_spinorRest[1],p4);
82     _spinor[2]=boostTo(_spinorRest[2],p4);
83     _spinor[3]=boostTo(_spinorRest[3],p4);
84     
85
86     setLifetime();
87 }
88
89
90 void EvtRaritaSchwingerParticle::init(EvtId id,const EvtVector4R& p4,
91                                       const EvtRaritaSchwinger & prod1,
92                                       const EvtRaritaSchwinger & prod2,
93                                       const EvtRaritaSchwinger & prod3,
94                                       const EvtRaritaSchwinger & prod4,
95                                       const EvtRaritaSchwinger & rest1,
96                                       const EvtRaritaSchwinger & rest2,
97                                       const EvtRaritaSchwinger & rest3,
98                                       const EvtRaritaSchwinger & rest4){
99
100   _validP4=true;
101   setp(p4);
102   setpart_num(id);
103
104   if (EvtPDL::getStdHep(id)==0){
105     report(ERROR,"EvtGen") << "Error in EvtRaritaSchwingerParticle::init, part_n="
106                            << id.getId()<<std::endl;
107     ::abort();
108   }
109   _spinorRest[0]=rest1;
110   _spinorRest[1]=rest2;
111   _spinorRest[2]=rest3;
112   _spinorRest[3]=rest4;
113     
114   _spinor[0]=prod1;
115   _spinor[1]=prod2;
116   _spinor[2]=prod3;
117   _spinor[3]=prod4;
118   
119   setLifetime();
120 }
121  
122
123
124 EvtRaritaSchwinger EvtRaritaSchwingerParticle::spRSParent(int i) const {
125
126   return _spinor[i];
127
128 }
129
130 EvtRaritaSchwinger EvtRaritaSchwingerParticle::spRS(int i) const {
131
132   return _spinorRest[i];
133
134 }
135
136
137
138 EvtSpinDensity EvtRaritaSchwingerParticle::rotateToHelicityBasis() const{
139
140   double sqmt2=sqrt(2.0*(this->getP4().mass()));
141   
142   EvtDiracSpinor spplus;
143   EvtDiracSpinor spminus;
144       
145   if (EvtPDL::getStdHep(getId())>0){  
146     spplus.set(1.0,0.0,0.0,0.0);
147     spminus.set(0.0,1.0,0.0,0.0);
148   } else {
149     spplus.set(0.0,0.0,1.0,0.0);
150     spminus.set(0.0,0.0,0.0,1.0);
151   }
152
153   EvtVector4C eplus(0.0,-1.0/sqrt(2.0),EvtComplex(0.0,-1.0/sqrt(2.0)),0.0);
154   EvtVector4C ezero(0.0,0.0,0.0,1.0);
155   EvtVector4C eminus(0.0,1.0/sqrt(2.0),EvtComplex(0.0,-1.0/sqrt(2.0)),0.0);
156
157   EvtRaritaSchwinger sppp=dirProd(eplus,spplus);
158   EvtRaritaSchwinger spp=dirProd(sqrt(2.0/3.0)*ezero,spplus)+
159     dirProd(sqrt(1.0/3.0)*eplus,spminus);
160   EvtRaritaSchwinger spm=dirProd(sqrt(2.0/3.0)*ezero,spminus)+
161     dirProd(sqrt(1.0/3.0)*eminus,spplus);
162   EvtRaritaSchwinger spmm=dirProd(eminus,spminus);
163
164
165   EvtSpinDensity R;
166   R.setDim(4);
167
168
169   for ( int i=0; i<4; i++) {
170     R.set(0,i,(sppp*_spinorRest[i])/sqmt2);
171     R.set(1,i,(spp*_spinorRest[i])/sqmt2);
172     R.set(2,i,(spm*_spinorRest[i])/sqmt2);
173     R.set(3,i,(spmm*_spinorRest[i])/sqmt2);
174   }
175
176   return R;
177
178 }
179
180
181 EvtSpinDensity EvtRaritaSchwingerParticle::rotateToHelicityBasis(double alpha,
182                                                                  double beta,
183                                                                  double gamma) const{
184
185   EvtDiracSpinor spplus;
186   EvtDiracSpinor spminus;
187       
188   if (EvtPDL::getStdHep(getId())>0){  
189     spplus.set(1.0,0.0,0.0,0.0);
190     spminus.set(0.0,1.0,0.0,0.0);
191   } else {
192     spplus.set(0.0,0.0,1.0,0.0);
193     spminus.set(0.0,0.0,0.0,1.0);
194   }
195
196   EvtVector4C eplus(0.0,-1.0/sqrt(2.0),EvtComplex(0.0,-1.0/sqrt(2.0)),0.0);
197   EvtVector4C ezero(0.0,0.0,0.0,1.0);
198   EvtVector4C eminus(0.0,1.0/sqrt(2.0),EvtComplex(0.0,-1.0/sqrt(2.0)),0.0);
199
200   EvtRaritaSchwinger sppp=dirProd(eplus,spplus);
201   EvtRaritaSchwinger spp=dirProd(sqrt(2.0/3.0)*ezero,spplus)+
202     dirProd(sqrt(1.0/3.0)*eplus,spminus);
203   EvtRaritaSchwinger spm=dirProd(sqrt(2.0/3.0)*ezero,spminus)+
204     dirProd(sqrt(1.0/3.0)*eminus,spplus);
205   EvtRaritaSchwinger spmm=dirProd(eminus,spminus);
206
207
208   sppp.applyRotateEuler(alpha,beta,gamma);
209   spp.applyRotateEuler(alpha,beta,gamma);
210   spm.applyRotateEuler(alpha,beta,gamma);
211   spmm.applyRotateEuler(alpha,beta,gamma);
212
213   EvtSpinDensity R;
214   R.setDim(4);
215
216   double sqmt2=sqrt(2.0*(this->getP4().mass()));
217
218   for ( int i=0; i<4; i++) {
219     R.set(0,i,(sppp*_spinorRest[i])/sqmt2);
220     R.set(1,i,(spp*_spinorRest[i])/sqmt2);
221     R.set(2,i,(spm*_spinorRest[i])/sqmt2);
222     R.set(3,i,(spmm*_spinorRest[i])/sqmt2);
223   }
224
225   return R;
226
227 }
228