1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 //-------------------------------------------------------------------------
19 // Implementation of the ESD V0 vertex class
20 // This class is part of the Event Data Summary
21 // set of classes and contains information about
22 // V0 kind vertexes generated by a neutral particle
23 // Origin: Iouri Belikov, IReS, Strasbourg, Jouri.Belikov@cern.ch
24 //-------------------------------------------------------------------------
26 #include <Riostream.h>
28 #include <TDatabasePDG.h>
30 #include <TParticlePDG.h>
34 #include "AliExternalTrackParam.h"
38 AliESDv0::AliESDv0() :
41 fEffMass(TDatabasePDG::Instance()->GetParticle(kK0Short)->Mass()),
47 //--------------------------------------------------------------------
48 // Default constructor (K0s)
49 //--------------------------------------------------------------------
51 for (Int_t i=0; i<3; i++) {
57 for (Int_t i=0; i<6; i++) {
64 AliESDv0::AliESDv0(const AliESDv0& rAliESDv0) :
67 fPdgCode = rAliESDv0.fPdgCode;
68 fEffMass = rAliESDv0.fEffMass;
69 fDcaV0Daughters = rAliESDv0.fDcaV0Daughters;
70 fChi2V0 = rAliESDv0.fChi2V0;
71 fNidx = rAliESDv0.fNidx;
72 fPidx = rAliESDv0.fPidx;
74 for (int i=0; i<3; i++) {
75 fPos[i] = rAliESDv0.fPos[i];
76 fNmom[i] = rAliESDv0.fNmom[i];
77 fPmom[i] = rAliESDv0.fPmom[i];
79 for (int i=0; i<6; i++) {
80 fPosCov[i] = rAliESDv0.fPosCov[i];
81 fNmomCov[i] = rAliESDv0.fNmomCov[i];
82 fPmomCov[i] = rAliESDv0.fPmomCov[i];
87 AliESDv0& AliESDv0::operator=(const AliESDv0& rAliESDv0)
89 if (this!=&rAliESDv0) {
90 TObject::operator=(rAliESDv0);
91 fPdgCode = rAliESDv0.fPdgCode;
92 fEffMass = rAliESDv0.fEffMass;
93 fDcaV0Daughters = rAliESDv0.fDcaV0Daughters;
94 fChi2V0 = rAliESDv0.fChi2V0;
95 fNidx = rAliESDv0.fNidx;
96 fPidx = rAliESDv0.fPidx;
98 for (int i=0; i<3; i++) {
99 fPos[i] = rAliESDv0.fPos[i];
100 fNmom[i] = rAliESDv0.fNmom[i];
101 fPmom[i] = rAliESDv0.fPmom[i];
103 for (int i=0; i<6; i++) {
104 fPosCov[i] = rAliESDv0.fPosCov[i];
105 fNmomCov[i] = rAliESDv0.fNmomCov[i];
106 fPmomCov[i] = rAliESDv0.fPmomCov[i];
112 AliESDv0::AliESDv0(const AliExternalTrackParam &t1, Int_t i1,
113 const AliExternalTrackParam &t2, Int_t i2) :
116 fEffMass(TDatabasePDG::Instance()->GetParticle(kK0Short)->Mass()),
122 //--------------------------------------------------------------------
123 // Main constructor (K0s)
124 //--------------------------------------------------------------------
126 for (Int_t i=0; i<6; i++) {
132 //Trivial estimation of the vertex parameters
133 Double_t x=t1.GetX(), alpha=t1.GetAlpha();
134 const Double_t *par=t1.GetParameter();
135 Double_t pt=1./TMath::Abs(par[4]),
136 phi=TMath::ASin(par[2]) + alpha,
137 cs=TMath::Cos(alpha), sn=TMath::Sin(alpha);
139 Double_t px1=pt*TMath::Cos(phi), py1=pt*TMath::Sin(phi), pz1=pt*par[3];
140 Double_t x1=x*cs - par[0]*sn;
141 Double_t y1=x*sn + par[0]*cs;
143 const Double_t ss=0.0005*0.0005;//a kind of a residual misalignment precision
144 Double_t sx1=sn*sn*t1.GetSigmaY2()+ss, sy1=cs*cs*t1.GetSigmaY2()+ss;
148 x=t2.GetX(); alpha=t2.GetAlpha(); par=t2.GetParameter();
149 pt=1./TMath::Abs(par[4]);
150 phi=TMath::ASin(par[2]) + alpha;
151 cs=TMath::Cos(alpha); sn=TMath::Sin(alpha);
153 Double_t px2=pt*TMath::Cos(phi), py2=pt*TMath::Sin(phi), pz2=pt*par[3];
154 Double_t x2=x*cs - par[0]*sn;
155 Double_t y2=x*sn + par[0]*cs;
157 Double_t sx2=sn*sn*t2.GetSigmaY2()+ss, sy2=cs*cs*t2.GetSigmaY2()+ss;
159 Double_t sz1=t1.GetSigmaZ2(), sz2=t2.GetSigmaZ2();
160 Double_t wx1=sx2/(sx1+sx2), wx2=1.- wx1;
161 Double_t wy1=sy2/(sy1+sy2), wy2=1.- wy1;
162 Double_t wz1=sz2/(sz1+sz2), wz2=1.- wz1;
163 fPos[0]=wx1*x1 + wx2*x2; fPos[1]=wy1*y1 + wy2*y2; fPos[2]=wz1*z1 + wz2*z2;
165 //fPos[0]=0.5*(x1+x2); fPos[1]=0.5*(y1+y2); fPos[2]=0.5*(z1+z2);
166 fNmom[0]=px1; fNmom[1]=py1; fNmom[2]=pz1;
167 fPmom[0]=px2; fPmom[1]=py2; fPmom[2]=pz2;
169 Double_t e1=TMath::Sqrt(0.13957*0.13957 + px1*px1 + py1*py1 + pz1*pz1);
170 Double_t e2=TMath::Sqrt(0.13957*0.13957 + px2*px2 + py2*py2 + pz2*pz2);
171 fEffMass=TMath::Sqrt((e1+e2)*(e1+e2)-
172 (px1+px2)*(px1+px2)-(py1+py2)*(py1+py2)-(pz1+pz2)*(pz1+pz2));
178 AliESDv0::~AliESDv0(){
179 //--------------------------------------------------------------------
181 //--------------------------------------------------------------------
186 Double_t AliESDv0::ChangeMassHypothesis(Int_t code) {
187 //--------------------------------------------------------------------
188 // This function changes the mass hypothesis for this V0
189 // and returns the "kinematical quality" of this hypothesis
190 //--------------------------------------------------------------------
191 Double_t nmass=0.13957, pmass=0.13957, mass=0.49767, ps=0.206;
197 nmass=0.13957; pmass=0.93827; mass=1.1157; ps=0.101; break;
199 pmass=0.13957; nmass=0.93827; mass=1.1157; ps=0.101; break;
203 AliError("invalide PDG code ! Assuming K0s...");
208 Double_t pxn=fNmom[0], pyn=fNmom[1], pzn=fNmom[2];
209 Double_t pxp=fPmom[0], pyp=fPmom[1], pzp=fPmom[2];
211 Double_t en=TMath::Sqrt(nmass*nmass + pxn*pxn + pyn*pyn + pzn*pzn);
212 Double_t ep=TMath::Sqrt(pmass*pmass + pxp*pxp + pyp*pyp + pzp*pzp);
213 Double_t pxl=pxn+pxp, pyl=pyn+pyp, pzl=pzn+pzp;
214 Double_t pl=TMath::Sqrt(pxl*pxl + pyl*pyl + pzl*pzl);
216 fEffMass=TMath::Sqrt((en+ep)*(en+ep)-pl*pl);
218 Double_t beta=pl/(en+ep);
219 Double_t pln=(pxn*pxl + pyn*pyl + pzn*pzl)/pl;
220 Double_t plp=(pxp*pxl + pyp*pyl + pzp*pzl)/pl;
222 Double_t pt2=pxp*pxp + pyp*pyp + pzp*pzp - plp*plp;
224 Double_t a=(plp-pln)/(plp+pln);
225 a -= (pmass*pmass-nmass*nmass)/(mass*mass);
226 a = 0.25*beta*beta*mass*mass*a*a + pt2;
232 void AliESDv0::GetPxPyPz(Double_t &px, Double_t &py, Double_t &pz) const {
233 //--------------------------------------------------------------------
234 // This function returns V0's momentum (global)
235 //--------------------------------------------------------------------
236 px=fNmom[0]+fPmom[0];
237 py=fNmom[1]+fPmom[1];
238 pz=fNmom[2]+fPmom[2];
241 void AliESDv0::GetXYZ(Double_t &x, Double_t &y, Double_t &z) const {
242 //--------------------------------------------------------------------
243 // This function returns V0's position (global)
244 //--------------------------------------------------------------------
250 Double_t AliESDv0::GetD(Double_t x0, Double_t y0, Double_t z0) const {
251 //--------------------------------------------------------------------
252 // This function returns V0's impact parameter
253 //--------------------------------------------------------------------
254 Double_t x=fPos[0],y=fPos[1],z=fPos[2];
255 Double_t px=fNmom[0]+fPmom[0];
256 Double_t py=fNmom[1]+fPmom[1];
257 Double_t pz=fNmom[2]+fPmom[2];
259 Double_t dx=(y0-y)*pz - (z0-z)*py;
260 Double_t dy=(x0-x)*pz - (z0-z)*px;
261 Double_t dz=(x0-x)*py - (y0-y)*px;
262 Double_t d=TMath::Sqrt((dx*dx+dy*dy+dz*dz)/(px*px+py*py+pz*pz));
267 Double_t AliESDv0::GetV0CosineOfPointingAngle(Double_t& refPointX, Double_t& refPointY, Double_t& refPointZ) const {
268 // calculates the pointing angle of the V0 wrt a reference point
270 Double_t momV0[3]; //momentum of the V0
271 GetPxPyPz(momV0[0],momV0[1],momV0[2]);
273 Double_t deltaPos[3]; //vector between the reference point and the V0 vertex
274 deltaPos[0] = fPos[0] - refPointX;
275 deltaPos[1] = fPos[1] - refPointY;
276 deltaPos[2] = fPos[2] - refPointZ;
278 Double_t momV02 = momV0[0]*momV0[0] + momV0[1]*momV0[1] + momV0[2]*momV0[2];
279 Double_t deltaPos2 = deltaPos[0]*deltaPos[0] + deltaPos[1]*deltaPos[1] + deltaPos[2]*deltaPos[2];
281 Double_t cosinePointingAngle = (deltaPos[0]*momV0[0] +
282 deltaPos[1]*momV0[1] +
283 deltaPos[2]*momV0[2] ) /
284 TMath::Sqrt(momV02 * deltaPos2);
286 return cosinePointingAngle;