]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/AliESDV0MI.cxx
Changes suggested by Effective C++ (F.Carminati)
[u/mrichter/AliRoot.git] / STEER / AliESDV0MI.cxx
CommitLineData
51ad6848 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/* $Id$ */
17
18//-------------------------------------------------------------------------
19// Origin: Marian Ivanov marian.ivanov@cern.ch
20//-------------------------------------------------------------------------
21
22#include <Riostream.h>
23#include <TMath.h>
0703142d 24
51ad6848 25#include "AliESDV0MI.h"
26#include "AliHelix.h"
27
28
29ClassImp(AliESDV0MI)
30
90e48c0c 31AliESDV0MI::AliESDV0MI() :
32 AliESDv0(),
33 fParamP(),
34 fParamM(),
35 fID(0),
36 fDist1(-1),
37 fDist2(-1),
38 fRr(-1),
39 fStatus(0),
40 fRow0(-1),
41 fDistNorm(0),
42 fDistSigma(0),
43 fChi2Before(0),
44 fNBefore(0),
45 fChi2After(0),
46 fNAfter(0),
47 fPointAngleFi(0),
48 fPointAngleTh(0),
49 fPointAngle(0)
50{
51ad6848 51 //
52 //Dafault constructor
53 //
51ad6848 54}
55
56void AliESDV0MI::SetP(const AliExternalTrackParam & paramp) {
57 //
58 // set mother
59 //
60 fParamP = paramp;
61}
62
63void AliESDV0MI::SetM(const AliExternalTrackParam & paramm){
64 //
65 //set daughter
66 //
67 fParamM = paramm;
68
69}
70
71void AliESDV0MI::UpdatePID(Double_t pidp[5], Double_t pidm[5])
72{
73 //
74 // set PID hypothesy
75 //
76 // norm PID to 1
77 Float_t sump =0;
78 Float_t summ =0;
79 for (Int_t i=0;i<5;i++){
80 fRP[i]=pidp[i];
81 sump+=fRP[i];
82 fRM[i]=pidm[i];
83 summ+=fRM[i];
84 }
85 for (Int_t i=0;i<5;i++){
86 fRP[i]/=sump;
87 fRM[i]/=summ;
88 }
89}
90
91Float_t AliESDV0MI::GetProb(UInt_t p1, UInt_t p2){
92 //
93 //
94 //
95 //
96 return TMath::Max(fRP[p1]+fRM[p2], fRP[p2]+fRM[p1]);
97}
98
99Float_t AliESDV0MI::GetEffMass(UInt_t p1, UInt_t p2){
100 //
101 // calculate effective mass
102 //
0703142d 103 const Float_t kpmass[5] = {5.10000000000000037e-04,1.05660000000000004e-01,1.39570000000000000e-01,
51ad6848 104 4.93599999999999983e-01, 9.38270000000000048e-01};
105 if (p1>4) return -1;
106 if (p2>4) return -1;
0703142d 107 Float_t mass1 = kpmass[p1];
108 Float_t mass2 = kpmass[p2];
51ad6848 109 Double_t *m1 = fPP;
110 Double_t *m2 = fPM;
111 //
112 if (fRP[p1]+fRM[p2]<fRP[p2]+fRM[p1]){
113 m1 = fPM;
114 m2 = fPP;
115 }
116 //
117 Float_t e1 = TMath::Sqrt(mass1*mass1+
118 m1[0]*m1[0]+
119 m1[1]*m1[1]+
120 m1[2]*m1[2]);
121 Float_t e2 = TMath::Sqrt(mass2*mass2+
122 m2[0]*m2[0]+
123 m2[1]*m2[1]+
124 m2[2]*m2[2]);
125 Float_t mass =
126 (m2[0]+m1[0])*(m2[0]+m1[0])+
127 (m2[1]+m1[1])*(m2[1]+m1[1])+
128 (m2[2]+m1[2])*(m2[2]+m1[2]);
129
130 mass = TMath::Sqrt((e1+e2)*(e1+e2)-mass);
131 return mass;
132}
133
134void AliESDV0MI::Update(Float_t vertex[3])
135{
136 //
137 // updates Kink Info
138 //
139 Float_t distance1,distance2;
140 //
141 AliHelix phelix(fParamP);
142 AliHelix mhelix(fParamM);
143 //
144 //find intersection linear
145 //
146 Double_t phase[2][2],radius[2];
147 Int_t points = phelix.GetRPHIintersections(mhelix, phase, radius,200);
148 Double_t delta1=10000,delta2=10000;
b07a036b 149
150 if (points<=0) return;
51ad6848 151 if (points>0){
152 phelix.LinearDCA(mhelix,phase[0][0],phase[0][1],radius[0],delta1);
153 phelix.LinearDCA(mhelix,phase[0][0],phase[0][1],radius[0],delta1);
154 phelix.LinearDCA(mhelix,phase[0][0],phase[0][1],radius[0],delta1);
155 }
156 if (points==2){
157 phelix.LinearDCA(mhelix,phase[1][0],phase[1][1],radius[1],delta2);
158 phelix.LinearDCA(mhelix,phase[1][0],phase[1][1],radius[1],delta2);
159 phelix.LinearDCA(mhelix,phase[1][0],phase[1][1],radius[1],delta2);
160 }
161 distance1 = TMath::Min(delta1,delta2);
162 //
163 //find intersection parabolic
164 //
165 points = phelix.GetRPHIintersections(mhelix, phase, radius);
166 delta1=10000,delta2=10000;
167 Double_t d1=1000.,d2=10000.;
b07a036b 168 if (points<=0) return;
51ad6848 169 if (points>0){
170 phelix.ParabolicDCA(mhelix,phase[0][0],phase[0][1],radius[0],delta1);
171 phelix.ParabolicDCA(mhelix,phase[0][0],phase[0][1],radius[0],delta1);
172 Double_t xd[3],xm[3];
173 phelix.Evaluate(phase[0][0],xd);
174 mhelix.Evaluate(phase[0][1],xm);
175 d1 = (xd[0]-xm[0])*(xd[0]-xm[0])+(xd[1]-xm[1])*(xd[1]-xm[1])+(xd[2]-xm[2])*(xd[2]-xm[2]);
176 }
177 if (points==2){
178 phelix.ParabolicDCA(mhelix,phase[1][0],phase[1][1],radius[1],delta2);
179 phelix.ParabolicDCA(mhelix,phase[1][0],phase[1][1],radius[1],delta2);
180 Double_t xd[3],xm[3];
181 phelix.Evaluate(phase[1][0],xd);
182 mhelix.Evaluate(phase[1][1],xm);
183 d2 = (xd[0]-xm[0])*(xd[0]-xm[0])+(xd[1]-xm[1])*(xd[1]-xm[1])+(xd[2]-xm[2])*(xd[2]-xm[2]);
184 }
185 //
186 distance2 = TMath::Min(delta1,delta2);
187 if (delta1<delta2){
188 //get V0 info
189 Double_t xd[3],xm[3];
190 phelix.Evaluate(phase[0][0],xd);
191 mhelix.Evaluate(phase[0][1], xm);
192 fXr[0] = 0.5*(xd[0]+xm[0]);
193 fXr[1] = 0.5*(xd[1]+xm[1]);
194 fXr[2] = 0.5*(xd[2]+xm[2]);
195 //
196 phelix.GetMomentum(phase[0][0],fPP);
197 mhelix.GetMomentum(phase[0][1],fPM);
198 phelix.GetAngle(phase[0][0],mhelix,phase[0][1],fAngle);
199 fRr = TMath::Sqrt(fXr[0]*fXr[0]+fXr[1]*fXr[1]);
200 }
201 else{
202 Double_t xd[3],xm[3];
203 phelix.Evaluate(phase[1][0],xd);
204 mhelix.Evaluate(phase[1][1], xm);
205 fXr[0] = 0.5*(xd[0]+xm[0]);
206 fXr[1] = 0.5*(xd[1]+xm[1]);
207 fXr[2] = 0.5*(xd[2]+xm[2]);
208 //
209 phelix.GetMomentum(phase[1][0], fPP);
210 mhelix.GetMomentum(phase[1][1], fPM);
211 phelix.GetAngle(phase[1][0],mhelix,phase[1][1],fAngle);
212 fRr = TMath::Sqrt(fXr[0]*fXr[0]+fXr[1]*fXr[1]);
213 }
214 fDist1 = TMath::Sqrt(TMath::Min(d1,d2));
215 fDist2 = TMath::Sqrt(distance2);
216 //
217 //
218 Float_t v[3] = {fXr[0]-vertex[0],fXr[1]-vertex[1],fXr[2]-vertex[2]};
219 Float_t p[3] = {fPP[0]+fPM[0], fPP[1]+fPM[1],fPP[2]+fPM[2]};
220 Float_t vnorm2 = v[0]*v[0]+v[1]*v[1];
221 Float_t vnorm3 = TMath::Sqrt(v[2]*v[2]+vnorm2);
222 vnorm2 = TMath::Sqrt(vnorm2);
223 Float_t pnorm2 = p[0]*p[0]+p[1]*p[1];
224 Float_t pnorm3 = TMath::Sqrt(p[2]*p[2]+pnorm2);
225 pnorm2 = TMath::Sqrt(pnorm2);
226 fPointAngleFi = (v[0]*p[0]+v[1]*p[1])/(vnorm2*pnorm2);
227 fPointAngleTh = (v[2]*p[2]+vnorm2*pnorm2)/(vnorm3*pnorm3);
228 fPointAngle = (v[0]*p[0]+v[1]*p[1]+v[2]*p[2])/(vnorm3*pnorm3);
229 //
230}
231