Added methods for finding a given module in the DDL map (F. Prino)
[u/mrichter/AliRoot.git] / STEER / AliESDcascade.cxx
CommitLineData
e23730c7 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
4f679a16 16/* $Id$ */
17
e23730c7 18//-------------------------------------------------------------------------
19// Implementation of the cascade vertex class
4f679a16 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
e23730c7 23// Origin: Christian Kuhn, IReS, Strasbourg, christian.kuhn@ires.in2p3.fr
24//-------------------------------------------------------------------------
4f679a16 25
90e48c0c 26#include <TDatabasePDG.h>
e23730c7 27#include <TMath.h>
28
5f7789fc 29#include "AliLog.h"
c7bafca9 30#include "AliExternalTrackParam.h"
31#include "AliESDv0.h"
e23730c7 32#include "AliESDcascade.h"
e23730c7 33
34ClassImp(AliESDcascade)
35
90e48c0c 36AliESDcascade::AliESDcascade() :
c028b974 37 AliESDv0(),
8668c148 38 fEffMassXi(TDatabasePDG::Instance()->GetParticle(kXiMinus)->Mass()),
562dd0b4 39 fChi2Xi(1024),
40 fDcaXiDaughters(1024),
41 fPdgCodeXi(kXiMinus),
bfb36bff 42 fBachIdx(-1)
90e48c0c 43{
e23730c7 44 //--------------------------------------------------------------------
45 // Default constructor (Xi-)
46 //--------------------------------------------------------------------
bfb36bff 47 for (Int_t j=0; j<3; j++) {
c028b974 48 fPosXi[j]=0.;
bfb36bff 49 fBachMom[j]=0.;
50 }
51
562dd0b4 52 fPosCovXi[0]=1024;
c028b974 53 fPosCovXi[1]=fPosCovXi[2]=0.;
562dd0b4 54 fPosCovXi[3]=1024;
c028b974 55 fPosCovXi[4]=0.;
562dd0b4 56 fPosCovXi[5]=1024;
bfb36bff 57
562dd0b4 58 fBachMomCov[0]=1024;
bfb36bff 59 fBachMomCov[1]=fBachMomCov[2]=0.;
562dd0b4 60 fBachMomCov[3]=1024;
bfb36bff 61 fBachMomCov[4]=0.;
562dd0b4 62 fBachMomCov[5]=1024;
e23730c7 63}
64
c028b974 65AliESDcascade::~AliESDcascade() {
66}
67
c7bafca9 68AliESDcascade::AliESDcascade(const AliESDv0 &v,
69 const AliExternalTrackParam &t, Int_t i) :
c028b974 70 AliESDv0(v),
562dd0b4 71 fEffMassXi(TDatabasePDG::Instance()->GetParticle(kXiMinus)->Mass()),
72 fChi2Xi(1024),
73 fDcaXiDaughters(1024),
8668c148 74 fPdgCodeXi(kXiMinus),
c7bafca9 75 fBachIdx(i)
76{
c028b974 77 //---------------------------------------------------------------------------------------------
c7bafca9 78 // Main constructor (Xi-)
c028b974 79 //---------------------------------------------------------------------------------------------
c7bafca9 80
81 Double_t r[3]; t.GetXYZ(r);
82 Double_t x1=r[0], y1=r[1], z1=r[2]; // position of the bachelor
83 Double_t p[3]; t.GetPxPyPz(p);
84 Double_t px1=p[0], py1=p[1], pz1=p[2];// momentum of the bachelor track
85
86 Double_t x2,y2,z2; // position of the V0
87 v.GetXYZ(x2,y2,z2);
88 Double_t px2,py2,pz2; // momentum of V0
89 v.GetPxPyPz(px2,py2,pz2);
90
91 Double_t a2=((x1-x2)*px2+(y1-y2)*py2+(z1-z2)*pz2)/(px2*px2+py2*py2+pz2*pz2);
92
93 Double_t xm=x2+a2*px2;
94 Double_t ym=y2+a2*py2;
95 Double_t zm=z2+a2*pz2;
96
c028b974 97 //dca between V0 and bachelor
98
99 fDcaXiDaughters = TMath::Sqrt((x1-xm)*(x1-xm) + (y1-ym)*(y1-ym) + (z1-zm)*(z1-zm));
100
c7bafca9 101 // position of the cascade decay
102
c028b974 103 fPosXi[0]=0.5*(x1+xm); fPosXi[1]=0.5*(y1+ym); fPosXi[2]=0.5*(z1+zm);
c7bafca9 104
105
106 // invariant mass of the cascade (default is Ximinus)
107
108 Double_t e1=TMath::Sqrt(0.13957*0.13957 + px1*px1 + py1*py1 + pz1*pz1);
109 Double_t e2=TMath::Sqrt(1.11568*1.11568 + px2*px2 + py2*py2 + pz2*pz2);
110
8668c148 111 fEffMassXi=TMath::Sqrt((e1+e2)*(e1+e2)-
c7bafca9 112 (px1+px2)*(px1+px2)-(py1+py2)*(py1+py2)-(pz1+pz2)*(pz1+pz2));
113
114
115 // momenta of the bachelor and the V0
116
117 fBachMom[0]=px1; fBachMom[1]=py1; fBachMom[2]=pz1;
c7bafca9 118
bfb36bff 119 //PH Covariance matrices: to be calculated correctly in the future
562dd0b4 120 fPosCovXi[0]=1024;
c028b974 121 fPosCovXi[1]=fPosCovXi[2]=0.;
562dd0b4 122 fPosCovXi[3]=1024;
c028b974 123 fPosCovXi[4]=0.;
562dd0b4 124 fPosCovXi[5]=1024;
bfb36bff 125
562dd0b4 126 fBachMomCov[0]=1024;
bfb36bff 127 fBachMomCov[1]=fBachMomCov[2]=0.;
562dd0b4 128 fBachMomCov[3]=1024;
bfb36bff 129 fBachMomCov[4]=0.;
562dd0b4 130 fBachMomCov[5]=1024;
c7bafca9 131
562dd0b4 132 fChi2Xi=1024.;
c7bafca9 133
134}
135
c028b974 136AliESDcascade::AliESDcascade(const AliESDcascade& cas) :
fe12e09c 137 AliESDv0(cas),
8668c148 138 fEffMassXi(cas.fEffMassXi),
fe12e09c 139 fChi2Xi(cas.fChi2Xi),
140 fDcaXiDaughters(cas.fDcaXiDaughters),
0d81136f 141 fPdgCodeXi(cas.fPdgCodeXi),
fe12e09c 142 fBachIdx(cas.fBachIdx)
c028b974 143{
144 //copy constructor
c028b974 145 for (int i=0; i<3; i++) {
146 fPosXi[i] = cas.fPosXi[i];
147 fBachMom[i] = cas.fBachMom[i];
148 }
149 for (int i=0; i<6; i++) {
150 fPosCovXi[i] = cas.fPosCovXi[i];
151 fBachMomCov[i] = cas.fBachMomCov[i];
152 }
153}
154
e23730c7 155Double_t AliESDcascade::ChangeMassHypothesis(Double_t &v0q, Int_t code) {
156 //--------------------------------------------------------------------
157 // This function changes the mass hypothesis for this cascade
158 // and returns the "kinematical quality" of this hypothesis
159 // together with the "quality" of associated V0 (argument v0q)
160 //--------------------------------------------------------------------
161 Double_t nmass=0.13957, pmass=0.93827, ps0=0.101;
162 Double_t bmass=0.13957, mass =1.3213, ps =0.139;
163
8668c148 164 fPdgCodeXi=code;
e23730c7 165
166 switch (code) {
167 case 213:
168 bmass=0.93827;
169 break;
170 case kXiMinus:
171 break;
172 case kXiPlusBar:
173 nmass=0.93827; pmass=0.13957;
174 break;
175 case kOmegaMinus:
176 bmass=0.49368; mass=1.67245; ps=0.211;
177 break;
178 case kOmegaPlusBar:
179 nmass=0.93827; pmass=0.13957;
180 bmass=0.49368; mass=1.67245; ps=0.211;
181 break;
182 default:
5f7789fc 183 AliError("Invalide PDG code ! Assuming XiMinus's...");
8668c148 184 fPdgCodeXi=kXiMinus;
e23730c7 185 break;
186 }
187
c028b974 188 Double_t pxn=fNmom[0], pyn=fNmom[1], pzn=fNmom[2];
189 Double_t pxp=fPmom[0], pyp=fPmom[1], pzp=fPmom[2];
8668c148 190
e23730c7 191 Double_t px0=pxn+pxp, py0=pyn+pyp, pz0=pzn+pzp;
192 Double_t p0=TMath::Sqrt(px0*px0 + py0*py0 + pz0*pz0);
193
194 Double_t e0=TMath::Sqrt(1.11568*1.11568 + p0*p0);
195 Double_t beta0=p0/e0;
196 Double_t pln=(pxn*px0 + pyn*py0 + pzn*pz0)/p0;
197 Double_t plp=(pxp*px0 + pyp*py0 + pzp*pz0)/p0;
198 Double_t pt2=pxp*pxp + pyp*pyp + pzp*pzp - plp*plp;
199
200 Double_t a=(plp-pln)/(plp+pln);
201 a -= (pmass*pmass-nmass*nmass)/(1.11568*1.11568);
202 a = 0.25*beta0*beta0*1.11568*1.11568*a*a + pt2;
203
204
205 v0q=a - ps0*ps0;
206
207
208 Double_t pxb=fBachMom[0], pyb=fBachMom[1], pzb=fBachMom[2];
209
210 Double_t eb=TMath::Sqrt(bmass*bmass + pxb*pxb + pyb*pyb + pzb*pzb);
211 Double_t pxl=px0+pxb, pyl=py0+pyb, pzl=pz0+pzb;
212 Double_t pl=TMath::Sqrt(pxl*pxl + pyl*pyl + pzl*pzl);
213
8668c148 214 fEffMassXi=TMath::Sqrt((e0+eb)*(e0+eb) - pl*pl);
e23730c7 215
216 Double_t beta=pl/(e0+eb);
217 Double_t pl0=(px0*pxl + py0*pyl + pz0*pzl)/pl;
218 Double_t plb=(pxb*pxl + pyb*pyl + pzb*pzl)/pl;
219 pt2=p0*p0 - pl0*pl0;
220
221 a=(pl0-plb)/(pl0+plb);
222 a -= (1.11568*1.11568-bmass*bmass)/(mass*mass);
223 a = 0.25*beta*beta*mass*mass*a*a + pt2;
224
225 return (a - ps*ps);
226}
227
228void
229AliESDcascade::GetPxPyPz(Double_t &px, Double_t &py, Double_t &pz) const {
230 //--------------------------------------------------------------------
231 // This function returns the cascade momentum (global)
232 //--------------------------------------------------------------------
8668c148 233 px=fNmom[0]+fPmom[0]+fBachMom[0];
c028b974 234 py=fNmom[1]+fPmom[1]+fBachMom[1];
235 pz=fNmom[2]+fPmom[2]+fBachMom[2];
e23730c7 236}
237
c028b974 238void AliESDcascade::GetXYZcascade(Double_t &x, Double_t &y, Double_t &z) const {
e23730c7 239 //--------------------------------------------------------------------
240 // This function returns cascade position (global)
241 //--------------------------------------------------------------------
c028b974 242 x=fPosXi[0];
243 y=fPosXi[1];
244 z=fPosXi[2];
e23730c7 245}
246
c028b974 247Double_t AliESDcascade::GetDcascade(Double_t x0, Double_t y0, Double_t z0) const {
e23730c7 248 //--------------------------------------------------------------------
249 // This function returns the cascade impact parameter
250 //--------------------------------------------------------------------
251
c028b974 252 Double_t x=fPosXi[0],y=fPosXi[1],z=fPosXi[2];
253 Double_t px=fNmom[0]+fPmom[0]+fBachMom[0];
254 Double_t py=fNmom[1]+fPmom[1]+fBachMom[1];
255 Double_t pz=fNmom[2]+fPmom[2]+fBachMom[2];
e23730c7 256
257 Double_t dx=(y0-y)*pz - (z0-z)*py;
258 Double_t dy=(x0-x)*pz - (z0-z)*px;
259 Double_t dz=(x0-x)*py - (y0-y)*px;
260 Double_t d=TMath::Sqrt((dx*dx+dy*dy+dz*dz)/(px*px+py*py+pz*pz));
261
262 return d;
263}
264
c028b974 265Double_t AliESDcascade::GetCascadeCosineOfPointingAngle(Double_t& refPointX, Double_t& refPointY, Double_t& refPointZ) const {
266 // calculates the pointing angle of the cascade wrt a reference point
267
268 Double_t momCas[3]; //momentum of the cascade
269 GetPxPyPz(momCas[0],momCas[1],momCas[2]);
270
271 Double_t deltaPos[3]; //vector between the reference point and the cascade vertex
272 deltaPos[0] = fPosXi[0] - refPointX;
273 deltaPos[1] = fPosXi[1] - refPointY;
274 deltaPos[2] = fPosXi[2] - refPointZ;
275
276 Double_t momCas2 = momCas[0]*momCas[0] + momCas[1]*momCas[1] + momCas[2]*momCas[2];
277 Double_t deltaPos2 = deltaPos[0]*deltaPos[0] + deltaPos[1]*deltaPos[1] + deltaPos[2]*deltaPos[2];
278
279 Double_t cosinePointingAngle = (deltaPos[0]*momCas[0] +
280 deltaPos[1]*momCas[1] +
281 deltaPos[2]*momCas[2] ) /
282 TMath::Sqrt(momCas2 * deltaPos2);
283
284 return cosinePointingAngle;
285}
074f017b 286
287void AliESDcascade::GetPosCovXi(Double_t cov[6]) const {
288
289 for (Int_t i=0; i<6; ++i) cov[i] = fPosCovXi[i];
290}