]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/AliESDcascade.cxx
datamember added in AliGeomManager with number of alignable volumes per subdetector...
[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
3e27a419 24// Modified by: Antonin Maire,IPHC, Antonin.Maire@ires.in2p3.fr
25// and Boris Hippolyte,IPHC, hippolyt@in2p3.fr
e23730c7 26//-------------------------------------------------------------------------
4f679a16 27
90e48c0c 28#include <TDatabasePDG.h>
e23730c7 29#include <TMath.h>
3e27a419 30#include <TVector3.h>
e23730c7 31
5f7789fc 32#include "AliLog.h"
c7bafca9 33#include "AliExternalTrackParam.h"
34#include "AliESDv0.h"
e23730c7 35#include "AliESDcascade.h"
e23730c7 36
37ClassImp(AliESDcascade)
38
90e48c0c 39AliESDcascade::AliESDcascade() :
c028b974 40 AliESDv0(),
8668c148 41 fEffMassXi(TDatabasePDG::Instance()->GetParticle(kXiMinus)->Mass()),
562dd0b4 42 fChi2Xi(1024),
43 fDcaXiDaughters(1024),
44 fPdgCodeXi(kXiMinus),
bfb36bff 45 fBachIdx(-1)
90e48c0c 46{
e23730c7 47 //--------------------------------------------------------------------
48 // Default constructor (Xi-)
49 //--------------------------------------------------------------------
bfb36bff 50 for (Int_t j=0; j<3; j++) {
c028b974 51 fPosXi[j]=0.;
bfb36bff 52 fBachMom[j]=0.;
53 }
54
562dd0b4 55 fPosCovXi[0]=1024;
c028b974 56 fPosCovXi[1]=fPosCovXi[2]=0.;
562dd0b4 57 fPosCovXi[3]=1024;
c028b974 58 fPosCovXi[4]=0.;
562dd0b4 59 fPosCovXi[5]=1024;
bfb36bff 60
562dd0b4 61 fBachMomCov[0]=1024;
bfb36bff 62 fBachMomCov[1]=fBachMomCov[2]=0.;
562dd0b4 63 fBachMomCov[3]=1024;
bfb36bff 64 fBachMomCov[4]=0.;
562dd0b4 65 fBachMomCov[5]=1024;
e23730c7 66}
67
3e27a419 68AliESDcascade::AliESDcascade(const AliESDcascade& cas) :
69 AliESDv0(cas),
70 fEffMassXi(cas.fEffMassXi),
71 fChi2Xi(cas.fChi2Xi),
72 fDcaXiDaughters(cas.fDcaXiDaughters),
73 fPdgCodeXi(cas.fPdgCodeXi),
74 fBachIdx(cas.fBachIdx)
75{
76 //--------------------------------------------------------------------
77 // The copy constructor
78 //--------------------------------------------------------------------
79 for (int i=0; i<3; i++) {
80 fPosXi[i] = cas.fPosXi[i];
81 fBachMom[i] = cas.fBachMom[i];
82 }
83 for (int i=0; i<6; i++) {
84 fPosCovXi[i] = cas.fPosCovXi[i];
85 fBachMomCov[i] = cas.fBachMomCov[i];
86 }
c028b974 87}
88
c7bafca9 89AliESDcascade::AliESDcascade(const AliESDv0 &v,
90 const AliExternalTrackParam &t, Int_t i) :
c028b974 91 AliESDv0(v),
562dd0b4 92 fEffMassXi(TDatabasePDG::Instance()->GetParticle(kXiMinus)->Mass()),
93 fChi2Xi(1024),
94 fDcaXiDaughters(1024),
8668c148 95 fPdgCodeXi(kXiMinus),
c7bafca9 96 fBachIdx(i)
97{
3e27a419 98 //--------------------------------------------------------------------
c7bafca9 99 // Main constructor (Xi-)
3e27a419 100 //--------------------------------------------------------------------
c7bafca9 101
102 Double_t r[3]; t.GetXYZ(r);
103 Double_t x1=r[0], y1=r[1], z1=r[2]; // position of the bachelor
104 Double_t p[3]; t.GetPxPyPz(p);
105 Double_t px1=p[0], py1=p[1], pz1=p[2];// momentum of the bachelor track
106
107 Double_t x2,y2,z2; // position of the V0
108 v.GetXYZ(x2,y2,z2);
109 Double_t px2,py2,pz2; // momentum of V0
110 v.GetPxPyPz(px2,py2,pz2);
111
112 Double_t a2=((x1-x2)*px2+(y1-y2)*py2+(z1-z2)*pz2)/(px2*px2+py2*py2+pz2*pz2);
113
114 Double_t xm=x2+a2*px2;
115 Double_t ym=y2+a2*py2;
116 Double_t zm=z2+a2*pz2;
117
118 // position of the cascade decay
119
c028b974 120 fPosXi[0]=0.5*(x1+xm); fPosXi[1]=0.5*(y1+ym); fPosXi[2]=0.5*(z1+zm);
c7bafca9 121
122
123 // invariant mass of the cascade (default is Ximinus)
124
125 Double_t e1=TMath::Sqrt(0.13957*0.13957 + px1*px1 + py1*py1 + pz1*pz1);
126 Double_t e2=TMath::Sqrt(1.11568*1.11568 + px2*px2 + py2*py2 + pz2*pz2);
127
8668c148 128 fEffMassXi=TMath::Sqrt((e1+e2)*(e1+e2)-
c7bafca9 129 (px1+px2)*(px1+px2)-(py1+py2)*(py1+py2)-(pz1+pz2)*(pz1+pz2));
130
131
132 // momenta of the bachelor and the V0
133
134 fBachMom[0]=px1; fBachMom[1]=py1; fBachMom[2]=pz1;
c7bafca9 135
bfb36bff 136 //PH Covariance matrices: to be calculated correctly in the future
562dd0b4 137 fPosCovXi[0]=1024;
c028b974 138 fPosCovXi[1]=fPosCovXi[2]=0.;
562dd0b4 139 fPosCovXi[3]=1024;
c028b974 140 fPosCovXi[4]=0.;
562dd0b4 141 fPosCovXi[5]=1024;
bfb36bff 142
562dd0b4 143 fBachMomCov[0]=1024;
bfb36bff 144 fBachMomCov[1]=fBachMomCov[2]=0.;
562dd0b4 145 fBachMomCov[3]=1024;
bfb36bff 146 fBachMomCov[4]=0.;
562dd0b4 147 fBachMomCov[5]=1024;
c7bafca9 148
562dd0b4 149 fChi2Xi=1024.;
c7bafca9 150
151}
152
3e27a419 153AliESDcascade& AliESDcascade::operator=(const AliESDcascade& cas)
c028b974 154{
3e27a419 155 //--------------------------------------------------------------------
156 // The assignment operator
157 //--------------------------------------------------------------------
732a24fe 158
159 if(this==&cas) return *this;
160 AliESDv0::operator=(cas);
161
162 fEffMassXi = cas.fEffMassXi;
163 fChi2Xi = cas.fChi2Xi;
164 fDcaXiDaughters = cas.fDcaXiDaughters;
165 fPdgCodeXi = cas.fPdgCodeXi;
166 fBachIdx = cas.fBachIdx;
167 for (int i=0; i<3; i++) {
168 fPosXi[i] = cas.fPosXi[i];
169 fBachMom[i] = cas.fBachMom[i];
170 }
171 for (int i=0; i<6; i++) {
172 fPosCovXi[i] = cas.fPosCovXi[i];
173 fBachMomCov[i] = cas.fBachMomCov[i];
174 }
175 return *this;
176}
177
178void AliESDcascade::Copy(TObject &obj) const {
179
180 // this overwrites the virtual TOBject::Copy()
181 // to allow run time copying without casting
182 // in AliESDEvent
183
184 if(this==&obj)return;
185 AliESDcascade *robj = dynamic_cast<AliESDcascade*>(&obj);
186 if(!robj)return; // not an AliESDcascade
187 *robj = *this;
3e27a419 188}
732a24fe 189
3e27a419 190AliESDcascade::~AliESDcascade() {
191 //--------------------------------------------------------------------
192 // Empty destructor
193 //--------------------------------------------------------------------
732a24fe 194}
195
646c9704 196// Start with AliVParticle functions
197Double_t AliESDcascade::E() const {
198 //--------------------------------------------------------------------
199 // This gives the energy assuming the ChangeMassHypothesis was called
200 //--------------------------------------------------------------------
3e27a419 201 return E(fPdgCodeXi);
202}
203
204Double_t AliESDcascade::Y() const {
205 //--------------------------------------------------------------------
206 // This gives the energy assuming the ChangeMassHypothesis was called
207 //--------------------------------------------------------------------
208 return Y(fPdgCodeXi);
209}
210
211// Then extend AliVParticle functions
212Double_t AliESDcascade::E(Int_t pdg) const {
213 //--------------------------------------------------------------------
214 // This gives the energy with the particle hypothesis as argument
215 //--------------------------------------------------------------------
216 Double_t mass = TDatabasePDG::Instance()->GetParticle(pdg)->Mass();
646c9704 217 return TMath::Sqrt(mass*mass+P()*P());
218}
219
3e27a419 220Double_t AliESDcascade::Y(Int_t pdg) const {
221 //--------------------------------------------------------------------
222 // This gives the rapidity with the particle hypothesis as argument
223 //--------------------------------------------------------------------
224 return 0.5*TMath::Log((E(pdg)+Pz())/(E(pdg)-Pz()+1.e-13));
225}
226
227// Now the functions for analysis consistency
228Double_t AliESDcascade::RapXi() const {
229 //--------------------------------------------------------------------
230 // This gives the pseudorapidity assuming a (Anti) Xi particle
231 //--------------------------------------------------------------------
232 return Y(kXiMinus);
233}
234
235Double_t AliESDcascade::RapOmega() const {
236 //--------------------------------------------------------------------
237 // This gives the pseudorapidity assuming a (Anti) Omega particle
238 //--------------------------------------------------------------------
239 return Y(kOmegaMinus);
240}
241
242Double_t AliESDcascade::AlphaXi() const {
243 //--------------------------------------------------------------------
244 // This gives the Armenteros-Podolanski alpha
245 //--------------------------------------------------------------------
246 TVector3 momBach(fBachMom[0],fBachMom[1],fBachMom[2]);
247 TVector3 momV0(fNmom[0]+fPmom[0],fNmom[1]+fPmom[1],fNmom[2]+fPmom[2]);
248 TVector3 momTot(Px(),Py(),Pz());
249
250 Double_t QlBach = momBach.Dot(momTot)/momTot.Mag();
251 Double_t QlV0 = momV0.Dot(momTot)/momTot.Mag();
252
253 return 1.-2./(1.+QlBach/QlV0);
254}
255
256Double_t AliESDcascade::PtArmXi() const {
257 //--------------------------------------------------------------------
258 // This gives the Armenteros-Podolanski ptarm
259 //--------------------------------------------------------------------
260 TVector3 momBach(fBachMom[0],fBachMom[1],fBachMom[2]);
261 TVector3 momTot(Px(),Py(),Pz());
262
263 return momBach.Perp(momTot);
264}
265
646c9704 266// Then the older functions
e23730c7 267Double_t AliESDcascade::ChangeMassHypothesis(Double_t &v0q, Int_t code) {
268 //--------------------------------------------------------------------
269 // This function changes the mass hypothesis for this cascade
270 // and returns the "kinematical quality" of this hypothesis
271 // together with the "quality" of associated V0 (argument v0q)
272 //--------------------------------------------------------------------
273 Double_t nmass=0.13957, pmass=0.93827, ps0=0.101;
274 Double_t bmass=0.13957, mass =1.3213, ps =0.139;
275
8668c148 276 fPdgCodeXi=code;
e23730c7 277
278 switch (code) {
279 case 213:
280 bmass=0.93827;
281 break;
282 case kXiMinus:
283 break;
284 case kXiPlusBar:
285 nmass=0.93827; pmass=0.13957;
286 break;
287 case kOmegaMinus:
288 bmass=0.49368; mass=1.67245; ps=0.211;
289 break;
290 case kOmegaPlusBar:
291 nmass=0.93827; pmass=0.13957;
292 bmass=0.49368; mass=1.67245; ps=0.211;
293 break;
294 default:
5f7789fc 295 AliError("Invalide PDG code ! Assuming XiMinus's...");
8668c148 296 fPdgCodeXi=kXiMinus;
e23730c7 297 break;
298 }
299
c028b974 300 Double_t pxn=fNmom[0], pyn=fNmom[1], pzn=fNmom[2];
301 Double_t pxp=fPmom[0], pyp=fPmom[1], pzp=fPmom[2];
8668c148 302
e23730c7 303 Double_t px0=pxn+pxp, py0=pyn+pyp, pz0=pzn+pzp;
304 Double_t p0=TMath::Sqrt(px0*px0 + py0*py0 + pz0*pz0);
305
306 Double_t e0=TMath::Sqrt(1.11568*1.11568 + p0*p0);
307 Double_t beta0=p0/e0;
308 Double_t pln=(pxn*px0 + pyn*py0 + pzn*pz0)/p0;
309 Double_t plp=(pxp*px0 + pyp*py0 + pzp*pz0)/p0;
310 Double_t pt2=pxp*pxp + pyp*pyp + pzp*pzp - plp*plp;
311
312 Double_t a=(plp-pln)/(plp+pln);
313 a -= (pmass*pmass-nmass*nmass)/(1.11568*1.11568);
314 a = 0.25*beta0*beta0*1.11568*1.11568*a*a + pt2;
315
316
317 v0q=a - ps0*ps0;
318
319
320 Double_t pxb=fBachMom[0], pyb=fBachMom[1], pzb=fBachMom[2];
321
322 Double_t eb=TMath::Sqrt(bmass*bmass + pxb*pxb + pyb*pyb + pzb*pzb);
323 Double_t pxl=px0+pxb, pyl=py0+pyb, pzl=pz0+pzb;
324 Double_t pl=TMath::Sqrt(pxl*pxl + pyl*pyl + pzl*pzl);
325
8668c148 326 fEffMassXi=TMath::Sqrt((e0+eb)*(e0+eb) - pl*pl);
e23730c7 327
328 Double_t beta=pl/(e0+eb);
329 Double_t pl0=(px0*pxl + py0*pyl + pz0*pzl)/pl;
330 Double_t plb=(pxb*pxl + pyb*pyl + pzb*pzl)/pl;
331 pt2=p0*p0 - pl0*pl0;
332
333 a=(pl0-plb)/(pl0+plb);
334 a -= (1.11568*1.11568-bmass*bmass)/(mass*mass);
335 a = 0.25*beta*beta*mass*mass*a*a + pt2;
336
337 return (a - ps*ps);
338}
339
340void
341AliESDcascade::GetPxPyPz(Double_t &px, Double_t &py, Double_t &pz) const {
342 //--------------------------------------------------------------------
343 // This function returns the cascade momentum (global)
344 //--------------------------------------------------------------------
8668c148 345 px=fNmom[0]+fPmom[0]+fBachMom[0];
c028b974 346 py=fNmom[1]+fPmom[1]+fBachMom[1];
347 pz=fNmom[2]+fPmom[2]+fBachMom[2];
e23730c7 348}
349
c028b974 350void AliESDcascade::GetXYZcascade(Double_t &x, Double_t &y, Double_t &z) const {
e23730c7 351 //--------------------------------------------------------------------
352 // This function returns cascade position (global)
353 //--------------------------------------------------------------------
c028b974 354 x=fPosXi[0];
355 y=fPosXi[1];
356 z=fPosXi[2];
e23730c7 357}
358
c028b974 359Double_t AliESDcascade::GetDcascade(Double_t x0, Double_t y0, Double_t z0) const {
e23730c7 360 //--------------------------------------------------------------------
361 // This function returns the cascade impact parameter
362 //--------------------------------------------------------------------
363
c028b974 364 Double_t x=fPosXi[0],y=fPosXi[1],z=fPosXi[2];
365 Double_t px=fNmom[0]+fPmom[0]+fBachMom[0];
366 Double_t py=fNmom[1]+fPmom[1]+fBachMom[1];
367 Double_t pz=fNmom[2]+fPmom[2]+fBachMom[2];
e23730c7 368
369 Double_t dx=(y0-y)*pz - (z0-z)*py;
370 Double_t dy=(x0-x)*pz - (z0-z)*px;
371 Double_t dz=(x0-x)*py - (y0-y)*px;
372 Double_t d=TMath::Sqrt((dx*dx+dy*dy+dz*dz)/(px*px+py*py+pz*pz));
373
374 return d;
375}
376
c028b974 377Double_t AliESDcascade::GetCascadeCosineOfPointingAngle(Double_t& refPointX, Double_t& refPointY, Double_t& refPointZ) const {
378 // calculates the pointing angle of the cascade wrt a reference point
379
380 Double_t momCas[3]; //momentum of the cascade
381 GetPxPyPz(momCas[0],momCas[1],momCas[2]);
382
383 Double_t deltaPos[3]; //vector between the reference point and the cascade vertex
384 deltaPos[0] = fPosXi[0] - refPointX;
385 deltaPos[1] = fPosXi[1] - refPointY;
386 deltaPos[2] = fPosXi[2] - refPointZ;
387
388 Double_t momCas2 = momCas[0]*momCas[0] + momCas[1]*momCas[1] + momCas[2]*momCas[2];
389 Double_t deltaPos2 = deltaPos[0]*deltaPos[0] + deltaPos[1]*deltaPos[1] + deltaPos[2]*deltaPos[2];
390
391 Double_t cosinePointingAngle = (deltaPos[0]*momCas[0] +
392 deltaPos[1]*momCas[1] +
393 deltaPos[2]*momCas[2] ) /
394 TMath::Sqrt(momCas2 * deltaPos2);
395
396 return cosinePointingAngle;
397}
074f017b 398
399void AliESDcascade::GetPosCovXi(Double_t cov[6]) const {
400
401 for (Int_t i=0; i<6; ++i) cov[i] = fPosCovXi[i];
402}