Fix for definitions for CINT
[u/mrichter/AliRoot.git] / TEvtGen / EvtGen / EvtGenBase / EvtTensorParticle.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: EvtTensorParticle.cc
12 //
13 // Description: Class to describe spin 2 particles.
14 //
15 // Modification history:
16 //
17 //    DJL/RYD   September 25,1996           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/EvtVector4R.hh"
27 #include "EvtGenBase/EvtTensor4C.hh"
28 #include "EvtGenBase/EvtVector4C.hh"
29 #include "EvtGenBase/EvtTensorParticle.hh"
30 #include "EvtGenBase/EvtReport.hh"
31
32 EvtTensorParticle::~EvtTensorParticle(){}
33
34 void EvtTensorParticle::init(EvtId part_n,const EvtVector4R& p4){
35  
36   init(part_n,p4.get(0),p4.get(1)
37        ,p4.get(2),p4.get(3));
38
39   setLifetime();
40
41   
42 }
43
44 void EvtTensorParticle::init(EvtId part_n,double e,double px,double py,double pz){
45
46   _validP4=true;
47   setp(e,px,py,pz);
48   setpart_num(part_n);
49   
50   eps[0].setdiag(0.0,-1.0/sqrt(6.0),-1.0/sqrt(6.0),
51                2.0/sqrt(6.0));
52   eps[1].setdiag(0.0,1.0/sqrt(2.0),-1.0/sqrt(2.0),0.0);
53   eps[2].setdiag(0.0,0.0,0.0,0.0);
54   eps[3].setdiag(0.0,0.0,0.0,0.0);
55   eps[4].setdiag(0.0,0.0,0.0,0.0);
56
57   eps[2].set(1,2,EvtComplex(1.0/sqrt(2.0),0.0));
58   eps[2].set(2,1,EvtComplex(1.0/sqrt(2.0),0.0));
59   eps[3].set(1,3,EvtComplex(1.0/sqrt(2.0),0.0));
60   eps[3].set(3,1,EvtComplex(1.0/sqrt(2.0),0.0));
61   eps[4].set(2,3,EvtComplex(1.0/sqrt(2.0),0.0));
62   eps[4].set(3,2,EvtComplex(1.0/sqrt(2.0),0.0));
63
64   setLifetime();
65   
66 }
67
68
69 void EvtTensorParticle::init(EvtId part_n,const EvtVector4R& p4,
70                              const EvtTensor4C& epsin1, 
71                              const EvtTensor4C& epsin2,
72                              const EvtTensor4C& epsin3, 
73                              const EvtTensor4C& epsin4,
74                              const EvtTensor4C& epsin5){
75  
76   _validP4=true;
77   setp(p4);
78   setpart_num(part_n);
79
80   eps[0]=epsin1;
81   eps[1]=epsin2;
82   eps[2]=epsin3;
83   eps[3]=epsin4;
84   eps[4]=epsin5;
85
86   setLifetime();
87   
88 }
89
90
91
92 EvtTensor4C EvtTensorParticle::epsTensorParent(int i) const {
93
94   EvtTensor4C temp=eps[i];
95
96   temp.applyBoostTo(this->getP4());
97   return temp;
98   
99 } //epsParent
100
101
102 EvtTensor4C EvtTensorParticle::epsTensor(int i) const {
103    
104   return eps[i];
105
106 } //eps
107
108
109
110 EvtSpinDensity EvtTensorParticle::rotateToHelicityBasis() const{
111
112
113   static EvtVector4C eplus(0.0,-1.0/sqrt(2.0),EvtComplex(0.0,-1.0/sqrt(2.0)),0.0);
114   static EvtVector4C ezero(0.0,0.0,0.0,1.0);
115   static EvtVector4C eminus(0.0,1.0/sqrt(2.0),EvtComplex(0.0,-1.0/sqrt(2.0)),0.0);
116   
117   static EvtTensor4C dPpp(EvtGenFunctions::directProd(eplus,eplus));
118   static EvtTensor4C dPp0(EvtGenFunctions::directProd(eplus,ezero));
119   static EvtTensor4C dP0p(EvtGenFunctions::directProd(ezero,eplus));
120   static EvtTensor4C dPpm(EvtGenFunctions::directProd(eplus,eminus));
121   static EvtTensor4C dP00(EvtGenFunctions::directProd(ezero,ezero));
122   static EvtTensor4C dPmp(EvtGenFunctions::directProd(eminus,eplus));
123   static EvtTensor4C dPmm(EvtGenFunctions::directProd(eminus,eminus));
124   static EvtTensor4C dPm0(EvtGenFunctions::directProd(eminus,ezero));
125   static EvtTensor4C dP0m(EvtGenFunctions::directProd(ezero,eminus));
126
127   static EvtTensor4C es0(conj(dPpp));
128   static EvtTensor4C es1(conj((1/sqrt(2.0))*dPp0 +(1/sqrt(2.0))*dP0p));
129   static EvtTensor4C es2(conj((1/sqrt(6.0))*dPpm +(2/sqrt(6.0))*dP00 +(1/sqrt(6.0))*dPmp));
130   static EvtTensor4C es3(conj((1/sqrt(2.0))*dPm0  +(1/sqrt(2.0))*dP0m));
131   static EvtTensor4C es4(conj(dPmm));
132
133
134   EvtSpinDensity R;
135   R.setDim(5);
136
137   for (int j=0; j<5; j++) {
138     R.set(0,j,cont(es0,eps[j]));
139     R.set(1,j,cont(es1,eps[j]));
140     R.set(2,j,cont(es2,eps[j]));
141     R.set(3,j,cont(es3,eps[j]));
142     R.set(4,j,cont(es4,eps[j]));
143   }
144   return R;
145
146 }
147
148
149 EvtSpinDensity EvtTensorParticle::rotateToHelicityBasis(double alpha,
150                                                         double beta,
151                                                         double gamma) const{
152
153   EvtTensor4C es[5];
154
155   static EvtVector4C eplus(0.0,-1.0/sqrt(2.0),EvtComplex(0.0,-1.0/sqrt(2.0)),0.0);
156   static EvtVector4C ezero(0.0,0.0,0.0,1.0);
157   static EvtVector4C eminus(0.0,1.0/sqrt(2.0),EvtComplex(0.0,-1.0/sqrt(2.0)),0.0);
158
159   eplus.applyRotateEuler(alpha,beta,gamma);
160   ezero.applyRotateEuler(alpha,beta,gamma);
161   eminus.applyRotateEuler(alpha,beta,gamma);
162
163   for (int i=0; i<5; i++) es[i].zero();    
164   
165   es[0]=EvtGenFunctions::directProd(eplus,eplus);
166   es[1] =(1/sqrt(2.0))*EvtGenFunctions::directProd(eplus,ezero)
167     +(1/sqrt(2.0))*EvtGenFunctions::directProd(ezero,eplus);
168   es[2] =(1/sqrt(6.0))*EvtGenFunctions::directProd(eplus,eminus)
169     +(2/sqrt(6.0))*EvtGenFunctions::directProd(ezero,ezero)
170     +(1/sqrt(6.0))*EvtGenFunctions::directProd(eminus,eplus);
171   es[3] =(1/sqrt(2.0))*EvtGenFunctions::directProd(eminus,ezero)
172     +(1/sqrt(2.0))*EvtGenFunctions::directProd(ezero,eminus);
173   es[4]=EvtGenFunctions::directProd(eminus,eminus);
174
175   for (int i=0; i<5; i++) es[i]=conj(es[i]);    
176
177   EvtSpinDensity R;
178   R.setDim(5);
179
180   for (int i=0; i<5; i++)
181     for (int j=0; j<5; j++)
182         R.set(i,j,cont(es[i],eps[j]));
183
184   return R;
185
186 }
187
188   
189
190
191
192
193
194