]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliESDcascade.cxx
Coding conventions
[u/mrichter/AliRoot.git] / STEER / AliESDcascade.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15
16 /* $Id$ */
17
18 //-------------------------------------------------------------------------
19 //               Implementation of the cascade vertex class
20 //              This is part of the Event Summary Data 
21 //              which contains the result of the reconstruction
22 //              and is the main set of classes for analaysis
23 //    Origin: Christian Kuhn, IReS, Strasbourg, christian.kuhn@ires.in2p3.fr
24 //-------------------------------------------------------------------------
25
26 #include <TDatabasePDG.h>
27 #include <TMath.h>
28
29 #include "AliLog.h"
30 #include "AliExternalTrackParam.h"
31 #include "AliESDv0.h"
32 #include "AliESDcascade.h"
33
34 ClassImp(AliESDcascade)
35
36 AliESDcascade::AliESDcascade() : 
37   TObject(),
38   fPdgCode(kXiMinus),
39   fEffMass(TDatabasePDG::Instance()->GetParticle(kXiMinus)->Mass()),
40   fChi2(1.e+33),
41   fBachIdx(-1)
42 {
43   //--------------------------------------------------------------------
44   // Default constructor  (Xi-)
45   //--------------------------------------------------------------------
46   for (Int_t j=0; j<3; j++) {
47     fPos[j]=0.;
48     fBachMom[j]=0.;
49   }
50
51   for (Int_t i=0; i<2; i++)
52     for (Int_t j=0; j<3; j++)
53       fV0mom[i][j]=0.;
54
55   fV0idx[0]=fV0idx[1]=-1;
56
57   fPosCov[0]=1e10;
58   fPosCov[1]=fPosCov[2]=0.;
59   fPosCov[3]=1e10;
60   fPosCov[4]=0.;
61   fPosCov[5]=1e10;
62
63   fV0momCov[0]=1e10;
64   fV0momCov[1]=fV0momCov[2]=0.;
65   fV0momCov[3]=1e10;
66   fV0momCov[4]=0.;
67   fV0momCov[5]=1e10;
68
69   fBachMomCov[0]=1e10;
70   fBachMomCov[1]=fBachMomCov[2]=0.;
71   fBachMomCov[3]=1e10;
72   fBachMomCov[4]=0.;
73   fBachMomCov[5]=1e10;
74 }
75
76 AliESDcascade::AliESDcascade(const AliESDv0 &v,
77                              const AliExternalTrackParam &t, Int_t i) : 
78   TObject(),
79   fPdgCode(kXiMinus),
80   fEffMass(TDatabasePDG::Instance()->GetParticle(kXiMinus)->Mass()),
81   fChi2(1.e+33),
82   fBachIdx(i)
83 {
84   //--------------------------------------------------------------------
85   // Main constructor  (Xi-)
86   //--------------------------------------------------------------------
87
88   fV0idx[0]=v.GetNindex(); fV0idx[1]=v.GetPindex();
89
90   Double_t r[3]; t.GetXYZ(r);
91   Double_t x1=r[0], y1=r[1], z1=r[2]; // position of the bachelor
92   Double_t p[3]; t.GetPxPyPz(p);
93   Double_t px1=p[0], py1=p[1], pz1=p[2];// momentum of the bachelor track
94
95   Double_t x2,y2,z2;          // position of the V0 
96   v.GetXYZ(x2,y2,z2);    
97   Double_t px2,py2,pz2;       // momentum of V0
98   v.GetPxPyPz(px2,py2,pz2);
99
100   Double_t a2=((x1-x2)*px2+(y1-y2)*py2+(z1-z2)*pz2)/(px2*px2+py2*py2+pz2*pz2);
101
102   Double_t xm=x2+a2*px2;
103   Double_t ym=y2+a2*py2;
104   Double_t zm=z2+a2*pz2;
105
106   // position of the cascade decay
107   
108   fPos[0]=0.5*(x1+xm); fPos[1]=0.5*(y1+ym); fPos[2]=0.5*(z1+zm);
109     
110
111   // invariant mass of the cascade (default is Ximinus)
112   
113   Double_t e1=TMath::Sqrt(0.13957*0.13957 + px1*px1 + py1*py1 + pz1*pz1);
114   Double_t e2=TMath::Sqrt(1.11568*1.11568 + px2*px2 + py2*py2 + pz2*pz2);
115   
116   fEffMass=TMath::Sqrt((e1+e2)*(e1+e2)-
117     (px1+px2)*(px1+px2)-(py1+py2)*(py1+py2)-(pz1+pz2)*(pz1+pz2));
118
119
120   // momenta of the bachelor and the V0
121   
122   fBachMom[0]=px1; fBachMom[1]=py1; fBachMom[2]=pz1; 
123   v.GetNPxPyPz(px2,py2,pz2);
124   fV0mom[0][0]=px2; fV0mom[0][1]=py2; fV0mom[0][2]=pz2;
125   v.GetPPxPyPz(px2,py2,pz2);
126   fV0mom[1][0]=px2; fV0mom[1][1]=py2; fV0mom[1][2]=pz2;
127
128   //PH Covariance matrices: to be calculated correctly in the future
129   fPosCov[0]=1e10;
130   fPosCov[1]=fPosCov[2]=0.;
131   fPosCov[3]=1e10;
132   fPosCov[4]=0.;
133   fPosCov[5]=1e10;
134
135   fV0momCov[0]=1e10;
136   fV0momCov[1]=fV0momCov[2]=0.;
137   fV0momCov[3]=1e10;
138   fV0momCov[4]=0.;
139   fV0momCov[5]=1e10;
140
141   fBachMomCov[0]=1e10;
142   fBachMomCov[1]=fBachMomCov[2]=0.;
143   fBachMomCov[3]=1e10;
144   fBachMomCov[4]=0.;
145   fBachMomCov[5]=1e10;
146
147   fChi2=7.;   
148
149 }
150
151 Double_t AliESDcascade::ChangeMassHypothesis(Double_t &v0q, Int_t code) {
152   //--------------------------------------------------------------------
153   // This function changes the mass hypothesis for this cascade
154   // and returns the "kinematical quality" of this hypothesis
155   // together with the "quality" of associated V0 (argument v0q) 
156   //--------------------------------------------------------------------
157   Double_t nmass=0.13957, pmass=0.93827, ps0=0.101; 
158   Double_t bmass=0.13957, mass =1.3213,  ps =0.139;
159
160   fPdgCode=code;
161
162   switch (code) {
163   case 213: 
164        bmass=0.93827; 
165        break;
166   case kXiMinus:
167        break;
168   case kXiPlusBar:
169        nmass=0.93827; pmass=0.13957; 
170        break;
171   case kOmegaMinus: 
172        bmass=0.49368; mass=1.67245; ps=0.211;
173        break;
174   case kOmegaPlusBar: 
175        nmass=0.93827; pmass=0.13957; 
176        bmass=0.49368; mass=1.67245; ps=0.211;
177        break;
178   default:
179        AliError("Invalide PDG code !  Assuming XiMinus's...");
180        fPdgCode=kXiMinus;
181     break;
182   }
183
184   Double_t pxn=fV0mom[0][0], pyn=fV0mom[0][1], pzn=fV0mom[0][2];
185   Double_t pxp=fV0mom[1][0], pyp=fV0mom[1][1], pzp=fV0mom[1][2];
186   Double_t px0=pxn+pxp, py0=pyn+pyp, pz0=pzn+pzp;
187   Double_t p0=TMath::Sqrt(px0*px0 + py0*py0 + pz0*pz0);
188
189   Double_t e0=TMath::Sqrt(1.11568*1.11568 + p0*p0);
190   Double_t beta0=p0/e0;
191   Double_t pln=(pxn*px0 + pyn*py0 + pzn*pz0)/p0;
192   Double_t plp=(pxp*px0 + pyp*py0 + pzp*pz0)/p0;
193   Double_t pt2=pxp*pxp + pyp*pyp + pzp*pzp - plp*plp;
194
195   Double_t a=(plp-pln)/(plp+pln);
196   a -= (pmass*pmass-nmass*nmass)/(1.11568*1.11568);
197   a = 0.25*beta0*beta0*1.11568*1.11568*a*a + pt2;
198
199
200   v0q=a - ps0*ps0;
201
202
203   Double_t pxb=fBachMom[0], pyb=fBachMom[1], pzb=fBachMom[2]; 
204
205   Double_t eb=TMath::Sqrt(bmass*bmass + pxb*pxb + pyb*pyb + pzb*pzb);
206   Double_t pxl=px0+pxb, pyl=py0+pyb, pzl=pz0+pzb;
207   Double_t pl=TMath::Sqrt(pxl*pxl + pyl*pyl + pzl*pzl);
208   
209   fEffMass=TMath::Sqrt((e0+eb)*(e0+eb) - pl*pl);
210
211   Double_t beta=pl/(e0+eb);
212   Double_t pl0=(px0*pxl + py0*pyl + pz0*pzl)/pl;
213   Double_t plb=(pxb*pxl + pyb*pyl + pzb*pzl)/pl;
214   pt2=p0*p0 - pl0*pl0;
215
216   a=(pl0-plb)/(pl0+plb);
217   a -= (1.11568*1.11568-bmass*bmass)/(mass*mass);
218   a = 0.25*beta*beta*mass*mass*a*a + pt2;
219
220   return (a - ps*ps);
221 }
222
223 void 
224 AliESDcascade::GetPxPyPz(Double_t &px, Double_t &py, Double_t &pz) const {
225   //--------------------------------------------------------------------
226   // This function returns the cascade momentum (global)
227   //--------------------------------------------------------------------
228   px=fV0mom[0][0]+fV0mom[1][0]+fBachMom[0]; 
229   py=fV0mom[0][1]+fV0mom[1][1]+fBachMom[1]; 
230   pz=fV0mom[0][2]+fV0mom[1][2]+fBachMom[2]; 
231 }
232
233 void AliESDcascade::GetXYZ(Double_t &x, Double_t &y, Double_t &z) const {
234   //--------------------------------------------------------------------
235   // This function returns cascade position (global)
236   //--------------------------------------------------------------------
237   x=fPos[0]; 
238   y=fPos[1]; 
239   z=fPos[2]; 
240 }
241
242 Double_t AliESDcascade::GetD(Double_t x0, Double_t y0, Double_t z0) const {
243   //--------------------------------------------------------------------
244   // This function returns the cascade impact parameter
245   //--------------------------------------------------------------------
246
247   Double_t x=fPos[0],y=fPos[1],z=fPos[2];
248   Double_t px=fV0mom[0][0]+fV0mom[1][0]+fBachMom[0];
249   Double_t py=fV0mom[0][1]+fV0mom[1][1]+fBachMom[1];
250   Double_t pz=fV0mom[0][2]+fV0mom[1][2]+fBachMom[2];
251
252   Double_t dx=(y0-y)*pz - (z0-z)*py; 
253   Double_t dy=(x0-x)*pz - (z0-z)*px;
254   Double_t dz=(x0-x)*py - (y0-y)*px;
255   Double_t d=TMath::Sqrt((dx*dx+dy*dy+dz*dz)/(px*px+py*py+pz*pz));
256
257   return d;
258 }
259