]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliESDv0.cxx
Corrected initialization of static variables, removed warnings (Sun, HP)
[u/mrichter/AliRoot.git] / STEER / AliESDv0.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 ESD 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 "AliESDv0.h"
26
27 ClassImp(AliESDv0)
28
29 AliESDv0::AliESDv0() : TObject() {
30   //--------------------------------------------------------------------
31   // Default constructor  (K0s)
32   //--------------------------------------------------------------------
33   fPdgCode=kK0Short;
34   fEffMass=0.497672;
35   fChi2=1.e+33;
36   fPos[0]=fPos[1]=fPos[2]=0.;
37   fPosCov[0]=fPosCov[1]=fPosCov[2]=fPosCov[3]=fPosCov[4]=fPosCov[5]=0.;
38 }
39
40 Double_t AliESDv0::ChangeMassHypothesis(Int_t code) {
41   //--------------------------------------------------------------------
42   // This function changes the mass hypothesis for this V0
43   // and returns the "kinematical quality" of this hypothesis 
44   //--------------------------------------------------------------------
45   Double_t nmass=0.13957, pmass=0.13957, mass=0.49767, ps=0.206;
46
47   fPdgCode=code;
48
49   switch (code) {
50   case kLambda0:
51     nmass=0.13957; pmass=0.93827; mass=1.1157; ps=0.101; break;
52   case kLambda0Bar:
53     pmass=0.13957; nmass=0.93827; mass=1.1157; ps=0.101; break;
54   case kK0Short: 
55     break;
56   default:
57     cerr<<"AliV0vertex::ChangeMassHypothesis: ";
58     cerr<<"invalide PDG code ! Assuming K0s...\n";
59     fPdgCode=kK0Short;
60     break;
61   }
62
63   Double_t pxn=fNmom[0], pyn=fNmom[1], pzn=fNmom[2]; 
64   Double_t pxp=fPmom[0], pyp=fPmom[1], pzp=fPmom[2];
65
66   Double_t en=TMath::Sqrt(nmass*nmass + pxn*pxn + pyn*pyn + pzn*pzn);
67   Double_t ep=TMath::Sqrt(pmass*pmass + pxp*pxp + pyp*pyp + pzp*pzp);
68   Double_t pxl=pxn+pxp, pyl=pyn+pyp, pzl=pzn+pzp;
69   Double_t pl=TMath::Sqrt(pxl*pxl + pyl*pyl + pzl*pzl);
70
71   fEffMass=TMath::Sqrt((en+ep)*(en+ep)-pl*pl);
72
73   Double_t beta=pl/(en+ep);
74   Double_t pln=(pxn*pxl + pyn*pyl + pzn*pzl)/pl;
75   Double_t plp=(pxp*pxl + pyp*pyl + pzp*pzl)/pl;
76
77   Double_t pt2=pxp*pxp + pyp*pyp + pzp*pzp - plp*plp;
78
79   Double_t a=(plp-pln)/(plp+pln);
80   a -= (pmass*pmass-nmass*nmass)/(mass*mass);
81   a = 0.25*beta*beta*mass*mass*a*a + pt2;
82
83   return (a - ps*ps);
84   
85 }
86
87 void AliESDv0::GetPxPyPz(Double_t &px, Double_t &py, Double_t &pz) const {
88   //--------------------------------------------------------------------
89   // This function returns V0's momentum (global)
90   //--------------------------------------------------------------------
91   px=fNmom[0]+fPmom[0]; 
92   py=fNmom[1]+fPmom[1]; 
93   pz=fNmom[2]+fPmom[2]; 
94 }
95
96 void AliESDv0::GetXYZ(Double_t &x, Double_t &y, Double_t &z) const {
97   //--------------------------------------------------------------------
98   // This function returns V0's position (global)
99   //--------------------------------------------------------------------
100   x=fPos[0]; 
101   y=fPos[1]; 
102   z=fPos[2]; 
103 }
104
105 Double_t AliESDv0::GetD(Double_t x0, Double_t y0, Double_t z0) const {
106   //--------------------------------------------------------------------
107   // This function returns V0's impact parameter
108   //--------------------------------------------------------------------
109   Double_t x=fPos[0],y=fPos[1],z=fPos[2];
110   Double_t px=fNmom[0]+fPmom[0];
111   Double_t py=fNmom[1]+fPmom[1];
112   Double_t pz=fNmom[2]+fPmom[2];
113
114   Double_t dx=(y0-y)*pz - (z0-z)*py; 
115   Double_t dy=(x0-x)*pz - (z0-z)*px;
116   Double_t dz=(x0-x)*py - (y0-y)*px;
117   Double_t d=TMath::Sqrt((dx*dx+dy*dy+dz*dz)/(px*px+py*py+pz*pz));
118   return d;
119 }