Updated code for tracking V2 (from Y. Belikov)
[u/mrichter/AliRoot.git] / ITS / AliCascadeVertex.cxx
CommitLineData
a9a2d814 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 cascade vertex class
18//
19// Origin: Christian Kuhn, IReS, Strasbourg, christian.kuhn@ires.in2p3.fr
20//-------------------------------------------------------------------------
21#include <iostream.h>
22#include <TMath.h>
23
24#include "AliCascadeVertex.h"
25#include "AliV0vertex.h"
26#include "AliITStrackV2.h"
27
28ClassImp(AliCascadeVertex)
29
30AliCascadeVertex::AliCascadeVertex() : TObject() {
31 //--------------------------------------------------------------------
32 // Default constructor (Xi-)
33 //--------------------------------------------------------------------
34 fPdgCode=kXiMinus;
35 fEffMass=1.32131;
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
42
43inline Double_t det(Double_t a00, Double_t a01, Double_t a10, Double_t a11){
44 // determinant 2x2
45 return a00*a11 - a01*a10;
46}
47
48inline Double_t det (Double_t a00,Double_t a01,Double_t a02,
49 Double_t a10,Double_t a11,Double_t a12,
50 Double_t a20,Double_t a21,Double_t a22) {
51 // determinant 3x3
52 return
53 a00*det(a11,a12,a21,a22)-a01*det(a10,a12,a20,a22)+a02*det(a10,a11,a20,a21);
54}
55
56
57
58AliCascadeVertex::AliCascadeVertex(const AliV0vertex &v,const AliITStrackV2 &t) {
59 //--------------------------------------------------------------------
60 // Main constructor
61 //--------------------------------------------------------------------
62 fPdgCode=kXiMinus;
63
64 fV0lab[0]=v.GetNlabel(); fV0lab[1]=v.GetPlabel();
65 fBachLab=t.GetLabel();
66
67 //Trivial estimation of the vertex parameters
68 Double_t pt, phi, x, par[5];
69 Double_t alpha, cs, sn;
70
71 t.GetExternalParameters(x,par); alpha=t.GetAlpha();
72 pt=1./TMath::Abs(par[4]);
73 phi=TMath::ASin(par[2]) + alpha;
74
75 // momentum of the bachelor track
76
77 Double_t px1=pt*TMath::Cos(phi), py1=pt*TMath::Sin(phi), pz1=pt*par[3];
78
79 cs=TMath::Cos(alpha); sn=TMath::Sin(alpha);
80
81 Double_t x1=x*cs - par[0]*sn; // position of the bachelor at dca (bachelor,V0)
82 Double_t y1=x*sn + par[0]*cs;
83 Double_t z1=par[1];
84
85 Double_t x2,y2,z2; // position of the V0
86 v.GetXYZ(x2,y2,z2);
87
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
97 // position of the cascade decay
98
99 fPos[0]=0.5*(x1+xm); fPos[1]=0.5*(y1+ym); fPos[2]=0.5*(z1+zm);
100
101
102 // momenta of the bachelor and the V0
103
104 fBachMom[0]=px1; fBachMom[1]=py1; fBachMom[2]=pz1;
105 fV0mom[0]=px2; fV0mom[1]=py2; fV0mom[2]=pz2;
106
107 // invariant mass of the cascade (default is Ximinus)
108
109 Double_t e1=TMath::Sqrt(0.13957*0.13957 + px1*px1 + py1*py1 + pz1*pz1);
110 Double_t e2=TMath::Sqrt(1.11568*1.11568 + px2*px2 + py2*py2 + pz2*pz2);
111
112 fEffMass=TMath::Sqrt((e1+e2)*(e1+e2)-
113 (px1+px2)*(px1+px2)-(py1+py2)*(py1+py2)-(pz1+pz2)*(pz1+pz2));
114
115 fChi2=7.;
116
117}
118
119void AliCascadeVertex::ChangeMassHypothesis(Int_t code) {
120 //--------------------------------------------------------------------
121 // This function changes the mass hypothesis for this cascade
122 //--------------------------------------------------------------------
123
124 // HOW TO DISTINGUISH BETWEEN A XIMINUS AND A XIPLUS ??????????
125 // SAME QUESTION FOR (ANTI-)OMEGA'S (here) ... AND FOR (ANTI-)LAMBDAS (in AliV0vertex) ??
126 // -> NEED ADDITIONAL CONDITION ON BACHELOR AND V0 PDGCODE !!!! BUT in the ANALYSIS MACROS !!!
127
128 Double_t massBach, massV0;
129
130 switch (code) {
131
132 case kXiMinus:
133 massBach=0.13957; massV0=1.11568; break;
134 case kXiPlusBar:
135 massBach=0.13957; massV0=1.11568; break;
136 case kOmegaMinus:
137 massBach=0.49368; massV0=1.11568; break;
138 case kOmegaPlusBar:
139 massBach=0.49368; massV0=1.11568; break;
140
141 default:
142 cerr<<"AliCascadeVertex::ChangeMassHypothesis: ";
143 cerr<<"invalide PDG code ! Assuming XiMinus's...\n";
144 massBach=0.13957; massV0=1.11568; break;
145 }
146
147 Double_t px1=fBachMom[0], py1=fBachMom[1], pz1=fBachMom[2];
148 Double_t px2=fV0mom[0], py2=fV0mom[1], pz2=fV0mom[2];
149
150 Double_t e1=TMath::Sqrt(massBach*massBach + px1*px1 + py1*py1 + pz1*pz1);
151 Double_t e2=TMath::Sqrt(massV0*massV0 + px2*px2 + py2*py2 + pz2*pz2);
152 fEffMass=TMath::Sqrt((e1+e2)*(e1+e2)-
153 (px1+px2)*(px1+px2)-(py1+py2)*(py1+py2)-(pz1+pz2)*(pz1+pz2));
154
155 fPdgCode=code;
156}
157
158void
159AliCascadeVertex::GetPxPyPz(Double_t &px, Double_t &py, Double_t &pz) const {
160 //--------------------------------------------------------------------
161 // This function returns the cascade momentum (global)
162 //--------------------------------------------------------------------
163 px=fV0mom[0]+fBachMom[0];
164 py=fV0mom[1]+fBachMom[1];
165 pz=fV0mom[2]+fBachMom[2];
166}
167
168void AliCascadeVertex::GetXYZ(Double_t &x, Double_t &y, Double_t &z) const {
169 //--------------------------------------------------------------------
170 // This function returns cascade position (global)
171 //--------------------------------------------------------------------
172 x=fPos[0];
173 y=fPos[1];
174 z=fPos[2];
175}
176
177Double_t AliCascadeVertex::GetD(Double_t x0, Double_t y0, Double_t z0) const {
178 //--------------------------------------------------------------------
179 // This function returns the cascade impact parameter
180 //--------------------------------------------------------------------
181
182 Double_t x=fPos[0],y=fPos[1],z=fPos[2];
183 Double_t px=fV0mom[0]+fBachMom[0];
184 Double_t py=fV0mom[1]+fBachMom[1];
185 Double_t pz=fV0mom[2]+fBachMom[2];
186
187 Double_t dx=(y0-y)*pz - (z0-z)*py;
188 Double_t dy=(x0-x)*pz - (z0-z)*px;
189 Double_t dz=(x0-x)*py - (y0-y)*px;
190 Double_t d=TMath::Sqrt((dx*dx+dy*dy+dz*dz)/(px*px+py*py+pz*pz));
191
192 return d;
193}