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