]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/AliESDv0.cxx
Update of material budget and positions
[u/mrichter/AliRoot.git] / STEER / AliESDv0.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 ESD V0 vertex class
4f679a16 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
e23730c7 23// Origin: Iouri Belikov, IReS, Strasbourg, Jouri.Belikov@cern.ch
24//-------------------------------------------------------------------------
4f679a16 25
e23730c7 26#include <Riostream.h>
27#include <TMath.h>
90e48c0c 28#include <TDatabasePDG.h>
e23730c7 29#include <TPDGCode.h>
90e48c0c 30#include <TParticlePDG.h>
e23730c7 31
5f7789fc 32#include "AliLog.h"
e23730c7 33#include "AliESDv0.h"
c7bafca9 34#include "AliExternalTrackParam.h"
e23730c7 35
36ClassImp(AliESDv0)
37
90e48c0c 38AliESDv0::AliESDv0() :
39 TObject(),
40 fPdgCode(kK0Short),
41 fEffMass(TDatabasePDG::Instance()->GetParticle(kK0Short)->Mass()),
17f7744d 42 fDcaDaughters(0),
90e48c0c 43 fChi2(1.e+33),
44 fNidx(0),
45 fPidx(0)
46{
e23730c7 47 //--------------------------------------------------------------------
48 // Default constructor (K0s)
49 //--------------------------------------------------------------------
6605de26 50
51 for (Int_t i=0; i<3; i++) {
52 fPos[i] = 0.;
53 fNmom[i] = 0.;
54 fPmom[i] = 0.;
55 }
56
57 for (Int_t i=0; i<6; i++) {
58 fPosCov[i]= 0.;
59 fNmomCov[i] = 0.;
60 fPmomCov[i] = 0.;
61 }
e23730c7 62}
63
c7bafca9 64AliESDv0::AliESDv0(const AliExternalTrackParam &t1, Int_t i1,
65 const AliExternalTrackParam &t2, Int_t i2) :
66 TObject(),
67 fPdgCode(kK0Short),
68 fEffMass(TDatabasePDG::Instance()->GetParticle(kK0Short)->Mass()),
69 fDcaDaughters(0),
70 fChi2(1.e+33),
71 fNidx(i1),
72 fPidx(i2)
73{
74 //--------------------------------------------------------------------
75 // Main constructor (K0s)
76 //--------------------------------------------------------------------
77
78 for (Int_t i=0; i<6; i++) {
79 fPosCov[i]= 0.;
80 fNmomCov[i] = 0.;
81 fPmomCov[i] = 0.;
82 }
83
84 //Trivial estimation of the vertex parameters
85 Double_t x=t1.GetX(), alpha=t1.GetAlpha();
86 const Double_t *par=t1.GetParameter();
87 Double_t pt=1./TMath::Abs(par[4]),
88 phi=TMath::ASin(par[2]) + alpha,
89 cs=TMath::Cos(alpha), sn=TMath::Sin(alpha);
90
91 Double_t px1=pt*TMath::Cos(phi), py1=pt*TMath::Sin(phi), pz1=pt*par[3];
92 Double_t x1=x*cs - par[0]*sn;
93 Double_t y1=x*sn + par[0]*cs;
94 Double_t z1=par[1];
37919f0b 95 const Double_t ss=0.0005*0.0005;//a kind of a residual misalignment precision
96 Double_t sx1=sn*sn*t1.GetSigmaY2()+ss, sy1=cs*cs*t1.GetSigmaY2()+ss;
c7bafca9 97
98
99
100 x=t2.GetX(); alpha=t2.GetAlpha(); par=t2.GetParameter();
101 pt=1./TMath::Abs(par[4]);
102 phi=TMath::ASin(par[2]) + alpha;
103 cs=TMath::Cos(alpha); sn=TMath::Sin(alpha);
104
105 Double_t px2=pt*TMath::Cos(phi), py2=pt*TMath::Sin(phi), pz2=pt*par[3];
106 Double_t x2=x*cs - par[0]*sn;
107 Double_t y2=x*sn + par[0]*cs;
108 Double_t z2=par[1];
37919f0b 109 Double_t sx2=sn*sn*t2.GetSigmaY2()+ss, sy2=cs*cs*t2.GetSigmaY2()+ss;
c7bafca9 110
111 Double_t sz1=t1.GetSigmaZ2(), sz2=t2.GetSigmaZ2();
37919f0b 112 Double_t wx1=sx2/(sx1+sx2), wx2=1.- wx1;
113 Double_t wy1=sy2/(sy1+sy2), wy2=1.- wy1;
c7bafca9 114 Double_t wz1=sz2/(sz1+sz2), wz2=1.- wz1;
115 fPos[0]=wx1*x1 + wx2*x2; fPos[1]=wy1*y1 + wy2*y2; fPos[2]=wz1*z1 + wz2*z2;
116
117 //fPos[0]=0.5*(x1+x2); fPos[1]=0.5*(y1+y2); fPos[2]=0.5*(z1+z2);
118 fNmom[0]=px1; fNmom[1]=py1; fNmom[2]=pz1;
119 fPmom[0]=px2; fPmom[1]=py2; fPmom[2]=pz2;
120
121 Double_t e1=TMath::Sqrt(0.13957*0.13957 + px1*px1 + py1*py1 + pz1*pz1);
122 Double_t e2=TMath::Sqrt(0.13957*0.13957 + px2*px2 + py2*py2 + pz2*pz2);
123 fEffMass=TMath::Sqrt((e1+e2)*(e1+e2)-
124 (px1+px2)*(px1+px2)-(py1+py2)*(py1+py2)-(pz1+pz2)*(pz1+pz2));
125
126 fChi2=7.;
127
128}
129
e23730c7 130Double_t AliESDv0::ChangeMassHypothesis(Int_t code) {
131 //--------------------------------------------------------------------
132 // This function changes the mass hypothesis for this V0
133 // and returns the "kinematical quality" of this hypothesis
134 //--------------------------------------------------------------------
135 Double_t nmass=0.13957, pmass=0.13957, mass=0.49767, ps=0.206;
136
137 fPdgCode=code;
138
139 switch (code) {
140 case kLambda0:
141 nmass=0.13957; pmass=0.93827; mass=1.1157; ps=0.101; break;
142 case kLambda0Bar:
143 pmass=0.13957; nmass=0.93827; mass=1.1157; ps=0.101; break;
144 case kK0Short:
145 break;
146 default:
5f7789fc 147 AliError("invalide PDG code ! Assuming K0s...");
e23730c7 148 fPdgCode=kK0Short;
149 break;
150 }
151
152 Double_t pxn=fNmom[0], pyn=fNmom[1], pzn=fNmom[2];
153 Double_t pxp=fPmom[0], pyp=fPmom[1], pzp=fPmom[2];
154
155 Double_t en=TMath::Sqrt(nmass*nmass + pxn*pxn + pyn*pyn + pzn*pzn);
156 Double_t ep=TMath::Sqrt(pmass*pmass + pxp*pxp + pyp*pyp + pzp*pzp);
157 Double_t pxl=pxn+pxp, pyl=pyn+pyp, pzl=pzn+pzp;
158 Double_t pl=TMath::Sqrt(pxl*pxl + pyl*pyl + pzl*pzl);
159
160 fEffMass=TMath::Sqrt((en+ep)*(en+ep)-pl*pl);
161
162 Double_t beta=pl/(en+ep);
163 Double_t pln=(pxn*pxl + pyn*pyl + pzn*pzl)/pl;
164 Double_t plp=(pxp*pxl + pyp*pyl + pzp*pzl)/pl;
165
166 Double_t pt2=pxp*pxp + pyp*pyp + pzp*pzp - plp*plp;
167
168 Double_t a=(plp-pln)/(plp+pln);
169 a -= (pmass*pmass-nmass*nmass)/(mass*mass);
170 a = 0.25*beta*beta*mass*mass*a*a + pt2;
171
172 return (a - ps*ps);
173
174}
175
176void AliESDv0::GetPxPyPz(Double_t &px, Double_t &py, Double_t &pz) const {
177 //--------------------------------------------------------------------
178 // This function returns V0's momentum (global)
179 //--------------------------------------------------------------------
180 px=fNmom[0]+fPmom[0];
181 py=fNmom[1]+fPmom[1];
182 pz=fNmom[2]+fPmom[2];
183}
184
185void AliESDv0::GetXYZ(Double_t &x, Double_t &y, Double_t &z) const {
186 //--------------------------------------------------------------------
187 // This function returns V0's position (global)
188 //--------------------------------------------------------------------
189 x=fPos[0];
190 y=fPos[1];
191 z=fPos[2];
192}
193
194Double_t AliESDv0::GetD(Double_t x0, Double_t y0, Double_t z0) const {
195 //--------------------------------------------------------------------
196 // This function returns V0's impact parameter
197 //--------------------------------------------------------------------
198 Double_t x=fPos[0],y=fPos[1],z=fPos[2];
199 Double_t px=fNmom[0]+fPmom[0];
200 Double_t py=fNmom[1]+fPmom[1];
201 Double_t pz=fNmom[2]+fPmom[2];
202
203 Double_t dx=(y0-y)*pz - (z0-z)*py;
204 Double_t dy=(x0-x)*pz - (z0-z)*px;
205 Double_t dz=(x0-x)*py - (y0-y)*px;
206 Double_t d=TMath::Sqrt((dx*dx+dy*dy+dz*dz)/(px*px+py*py+pz*pz));
207 return d;
208}