]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG1/TPC/AliESDRecV0Info.cxx
Fix for coverity
[u/mrichter/AliRoot.git] / PWG1 / TPC / AliESDRecV0Info.cxx
CommitLineData
7cc34f08 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///////////////////////////////////////////////////////////////////////////////
18// //
19// //
20// Comparison class for V0 information //
21// responsible:
22// marian.ivanov@cern.ch //
23//
24//
25
26
27
28
29
30#include <stdio.h>
31#include <string.h>
32//ROOT includes
33#include "Rtypes.h"
34//
35//ALIROOT includes
36//
37#include "AliESDtrack.h"
38#include "AliTPCParam.h"
39#include "AliTrackReference.h"
40#include "AliTPCParamSR.h"
41#include "AliESD.h"
42#include "AliESDfriend.h"
43#include "AliESDtrack.h"
44#include "AliTPCseed.h"
45#include "AliITStrackMI.h"
7cc34f08 46#include "AliHelix.h"
47#include "AliESDVertex.h"
48#include "AliExternalTrackParam.h"
49#include "AliESDkink.h"
50#include "AliESDv0.h"
51#include "AliV0.h"
52#include "AliKFParticle.h"
53#include "AliKFVertex.h"
54//
55#include "AliTreeDraw.h"
56#include "AliMCInfo.h"
57#include "AliGenKinkInfo.h"
58#include "AliGenV0Info.h"
59
60
61#include "AliESDRecV0Info.h"
62
63
64
65ClassImp(AliESDRecV0Info)
66
67
68AliESDRecV0Info:: AliESDRecV0Info():
69 TObject(),
70 fT1(), //track1
71 fT2(), //track2
72 fDist1(0), //info about closest distance according closest MC - linear DCA
73 fDist2(0), //info about closest distance parabolic DCA
74 fInvMass(0), //reconstructed invariant mass -
75 //
76 fDistMinR(0), // distance at minimal radius
77 fRr(0), // rec position of the vertex
78 fPointAngleFi(0), //point angle fi
79 fPointAngleTh(0), //point angle theta
80 fPointAngle(0), //point angle full
81 fV0Status(0), // status of the kink
82 fV0tpc(0), // Vo information from reconsturction according TPC
83 fV0its(0), // Vo information from reconsturction according ITS
84 fV0rec(0), // V0 information form the reconstruction
85 fV0recOff(0), // V0 information form the reconstruction - OFFLINE
86 fMultiple(0), // how man times V0 was recostructed
87 fRecStatus(0), // status form the reconstuction
88 fV0MultipleOn(0), // how man times was V0 reconstucted
89 fV0MultipleOff(0), // how man times was V0 reconstucted
90 //
91 fKFrecChi2NC(0), // ONLINE V0 finder non constrained chi2
92 fKFrecChi2C(0), // ONLINE V0 finder constrained chi2 - prim vertex
93 fKFrecChi2CM(0), // ONLINE V0 finder constrained chi2 - prim vertex+mass
94 fKFRecNC(0), // non constrained
95 fKFRecC(0), // constrained vertex
96 fKFRecCM(0), // constrained vertex+mass
97 fKFrecOffChi2NC(0), // OFFLINE V0 finder - non constrained chi2
98 fKFrecOffChi2C(0), // OFFLINE V0 finder - constrained chi2 - prim vertex
99 fKFrecOffChi2CM(0), // OFFLINE V0 finder - constrained chi2 - prim vertex+mass
100 fKFOffRecNC(0), // non constrained
101 fKFOffRecC(0), // constrained vertex
102 fKFOffRecCM(0) // constrained vertex+mass
103{
104 //
105 // default constructor
106 //
107 fV0tpc = new AliV0();
108 fV0its = new AliV0();
109 fV0rec = new AliV0();
110 fV0recOff = new AliV0();
111}
112
113
114void AliESDRecV0Info::Update(Float_t vertex[3])
115{
116
117 if ( (fT1.fStatus[1]>0)&& (fT2.fStatus[1]>0)){
118 Float_t distance1,distance2;
119 Double_t xx[3],pp[3];
120 //
121 Double_t xd[3],pd[3],signd;
122 Double_t xm[3],pm[3],signm;
123 //
124 //
125 if (fT1.fITSOn&&fT2.fITSOn){
126 for (Int_t i=0;i<3;i++){
127 xd[i] = fT2.fITSinR1[i];
128 pd[i] = fT2.fITSinP1[i];
129 xm[i] = fT1.fITSinR1[i];
130 pm[i] = fT1.fITSinP1[i];
131 }
132 }
133 else{
134
135 for (Int_t i=0;i<3;i++){
136 xd[i] = fT2.fTPCinR1[i];
137 pd[i] = fT2.fTPCinP1[i];
138 xm[i] = fT1.fTPCinR1[i];
139 pm[i] = fT1.fTPCinP1[i];
140 }
141 }
142 //
143 //
144 signd = fT2.fSign<0 ? -1:1;
145 signm = fT1.fSign<0 ? -1:1;
146
147 AliHelix dhelix1(xd,pd,signd);
148 dhelix1.GetMomentum(0,pp,0);
149 dhelix1.Evaluate(0,xx);
150 //
151 // Double_t x2[3],p2[3];
152 //
153 AliHelix mhelix(xm,pm,signm);
154 //
155 //find intersection linear
156 //
157 Double_t phase[2][2],radius[2];
158 Int_t points = dhelix1.GetRPHIintersections(mhelix, phase, radius,200);
159 Double_t delta1=10000,delta2=10000;
160
161 if (points==1){
162 fRs[0] = TMath::Sqrt(radius[0]);
163 fRs[1] = TMath::Sqrt(radius[0]);
164 }
165 if (points==2){
166 fRs[0] =TMath::Min(TMath::Sqrt(radius[0]),TMath::Sqrt(radius[1]));
167 fRs[1] =TMath::Max(TMath::Sqrt(radius[0]),TMath::Sqrt(radius[1]));
168 }
169
170 if (points>0){
171 dhelix1.LinearDCA(mhelix,phase[0][0],phase[0][1],radius[0],delta1);
172 dhelix1.LinearDCA(mhelix,phase[0][0],phase[0][1],radius[0],delta1);
173 dhelix1.LinearDCA(mhelix,phase[0][0],phase[0][1],radius[0],delta1);
174 }
175 if (points==2){
176 dhelix1.LinearDCA(mhelix,phase[1][0],phase[1][1],radius[1],delta2);
177 dhelix1.LinearDCA(mhelix,phase[1][0],phase[1][1],radius[1],delta2);
178 dhelix1.LinearDCA(mhelix,phase[1][0],phase[1][1],radius[1],delta2);
179 }
180 if (points==1){
181 fRs[0] = TMath::Sqrt(radius[0]);
182 fRs[1] = TMath::Sqrt(radius[0]);
183 fDistMinR = delta1;
184 }
185 if (points==2){
186 if (radius[0]<radius[1]){
187 fRs[0] = TMath::Sqrt(radius[0]);
188 fRs[1] = TMath::Sqrt(radius[1]);
189 fDistMinR = delta1;
190 }
191 else{
192 fRs[0] = TMath::Sqrt(radius[1]);
193 fRs[1] = TMath::Sqrt(radius[0]);
194 fDistMinR = delta2;
195 }
196 }
197 //
198 //
199 distance1 = TMath::Min(delta1,delta2);
200 //
201 //find intersection parabolic
202 //
203 points = dhelix1.GetRPHIintersections(mhelix, phase, radius);
204 delta1=10000,delta2=10000;
205
206 if (points>0){
207 dhelix1.ParabolicDCA(mhelix,phase[0][0],phase[0][1],radius[0],delta1);
208 }
209 if (points==2){
210 dhelix1.ParabolicDCA(mhelix,phase[1][0],phase[1][1],radius[1],delta2);
211 }
212
213 distance2 = TMath::Min(delta1,delta2);
214 if (distance2>100) fDist2 =100;
215 return;
216 if (delta1<delta2){
217 //get V0 info
218 dhelix1.Evaluate(phase[0][0],fXr);
219 dhelix1.GetMomentum(phase[0][0],fPdr);
220 mhelix.GetMomentum(phase[0][1],fPm);
221 dhelix1.GetAngle(phase[0][0],mhelix,phase[0][1],fAngle);
222 fRr = TMath::Sqrt(radius[0]);
223 }
224 else{
225 dhelix1.Evaluate(phase[1][0],fXr);
226 dhelix1.GetMomentum(phase[1][0], fPdr);
227 mhelix.GetMomentum(phase[1][1], fPm);
228 dhelix1.GetAngle(phase[1][0],mhelix,phase[1][1],fAngle);
229 fRr = TMath::Sqrt(radius[1]);
230 }
231 fDist1 = TMath::Sqrt(distance1);
232 fDist2 = TMath::Sqrt(distance2);
233
234 if (fDist2<10.5){
235 Double_t x,alpha,param[5],cov[15];
236 //
237 fT1.GetESDtrack()->GetInnerExternalParameters(alpha,x,param);
238 fT1.GetESDtrack()->GetInnerExternalCovariance(cov);
239 AliExternalTrackParam paramm(x,alpha,param,cov);
240 //
241 fT2.GetESDtrack()->GetInnerExternalParameters(alpha,x,param);
242 fT2.GetESDtrack()->GetInnerExternalCovariance(cov);
243 AliExternalTrackParam paramd(x,alpha,param,cov);
244 }
245 //
246 //
247
248 Float_t v[3] = {fXr[0]-vertex[0],fXr[1]-vertex[1],fXr[2]-vertex[2]};
249 Float_t p[3] = {fPdr[0]+fPm[0], fPdr[1]+fPm[1],fPdr[2]+fPm[2]};
250
251 Float_t vnorm2 = v[0]*v[0]+v[1]*v[1];
252 Float_t vnorm3 = TMath::Sqrt(v[2]*v[2]+vnorm2);
253 vnorm2 = TMath::Sqrt(vnorm2);
254 Float_t pnorm2 = p[0]*p[0]+p[1]*p[1];
255 Float_t pnorm3 = TMath::Sqrt(p[2]*p[2]+pnorm2);
256 pnorm2 = TMath::Sqrt(pnorm2);
257
258 fPointAngleFi = (v[0]*p[0]+v[1]*p[1])/(vnorm2*pnorm2);
259 fPointAngleTh = (v[2]*p[2]+vnorm2*pnorm2)/(vnorm3*pnorm3);
260 fPointAngle = (v[0]*p[0]+v[1]*p[1]+v[2]*p[2])/(vnorm3*pnorm3);
261 }
262}
263
264void AliESDRecV0Info::Reset(){
265 //
266 // Reset status and all counters
267 //
268 fDist1=-1; //info about closest distance according closest MC - linear DCA
269 fDist2=-1; //info about closest distance parabolic DCA
270 fInvMass=-1; //reconstructed invariant mass -
271 //
272 fDistMinR=-1; // distance at minimal radius
273 fRr=-1; // rec position of the vertex
274 fLab[0]=-20; //MC label of the partecle
275 fLab[1]=-10; //MC label of the partecle
276 fPointAngleFi=0; //point angle fi
277 fPointAngleTh=0; //point angle theta
278 fPointAngle=0; //point angle full
279 //
280 fV0Status= -100; // status of the V0
281 fMultiple=0; // how man times V0 was recostructed
282 fRecStatus=0; // status form the reconstuction - 1 reconstructed - -1 fake
283 fV0MultipleOn=0; // how man times was V0 reconstucted - onfly
284 fV0MultipleOff=0; // how man times was V0 reconstucted - offline
285 //
286 // AliKF variables - variables to make a selection + resoluton study
287 //
288 fKFrecChi2NC=0; // ONLINE V0 finder non constrained chi2
289 fKFrecChi2C=0; // ONLINE V0 finder constrained chi2 - prim vertex
290 fKFrecChi2CM=0; // ONLINE V0 finder constrained chi2 - prim vertex+mass
291 //
292 fKFrecOffChi2NC=0; // OFFLINE V0 finder - non constrained chi2
293 fKFrecOffChi2C=0; // OFFLINE V0 finder - constrained chi2 - prim vertex
294 fKFrecOffChi2CM=0; // OFFLINE V0 finder - constrained chi2 - prim vertex+mass
295}
296
297
298
299void AliESDRecV0Info::UpdateKF(const AliESDVertex &vertex, Int_t pdg0, Int_t pdg1, Float_t mass){
300 //
301 // Calculate properties of V0 vertex using different type of constraints
302 //
303 fKFrecChi2NC=0; // ONLINE V0 finder non constrained chi2
304 fKFrecChi2C=0; // ONLINE V0 finder constrained chi2 - prim vertex
305 fKFrecChi2CM=0; // ONLINE V0 finder constrained chi2 - prim vertex+mass
306 if (fKFRecNC) {delete fKFRecNC; fKFRecNC=0;}
307 if (fKFRecC) {delete fKFRecC; fKFRecC=0;}
308 if (fKFRecCM) {delete fKFRecCM; fKFRecCM=0;}
309 //
310 fKFrecOffChi2NC=0; // OFFLINE V0 finder - non constrained chi2
311 fKFrecOffChi2C=0; // OFFLINE V0 finder - constrained chi2 - prim vertex
312 fKFrecOffChi2CM=0; // OFFLINE V0 finder - constrained chi2 - prim vertex+mass
313 if (fKFOffRecNC) {delete fKFOffRecNC; fKFOffRecNC=0;}
314 if (fKFOffRecC) {delete fKFOffRecC; fKFOffRecC=0;}
315 if (fKFOffRecCM) {delete fKFOffRecCM; fKFOffRecCM=0;}
316 if (fV0Status==0) return; //
317 //
318 AliKFVertex primVtx(vertex);
319 //
320 if (fV0rec &&
321 TMath::Abs(fV0rec->GetParamN()->GetSigmaY2())>0.000000001&&
322 TMath::Abs(fV0rec->GetParamP()->GetSigmaY2())>0.000000001
323 ){
324 //
325 Double_t x, y, z;
326 AliKFParticle p1( *(fV0rec->GetParamN()), pdg0 );
327 AliKFParticle p2( *(fV0rec->GetParamP()), pdg1 );
328 //
329 fKFRecNC = new AliKFParticle;
330 fV0rec->GetXYZ(x,y,z);
331 fKFRecNC->SetVtxGuess(x,y,z);
332 *(fKFRecNC)+=p1;
333 *(fKFRecNC)+=p2;
334 fKFrecChi2NC =fKFRecNC->GetChi2() ;
335 //
336 fKFRecC = new AliKFParticle;
337 fV0rec->GetXYZ(x,y,z);
338 fKFRecC->SetVtxGuess(x,y,z);
339 *(fKFRecC)+=p1;
340 *(fKFRecC)+=p2;
341 fKFRecC->SetProductionVertex(primVtx);
342 fKFrecChi2C =fKFRecC->GetChi2();
343 //
344 fKFRecCM = new AliKFParticle;
345 fV0rec->GetXYZ(x,y,z);
346 fKFRecCM->SetVtxGuess(x,y,z);
347 *(fKFRecCM)+=p1;
348 *(fKFRecCM)+=p2;
349 fKFRecCM->SetProductionVertex(primVtx);
350 fKFRecCM->SetMassConstraint(mass);
351 fKFrecChi2CM =fKFRecCM->GetChi2();
352 }
353
354 if (fV0recOff &&
355 TMath::Abs(fV0recOff->GetParamN()->GetSigmaY2())>0.000000001&&
356 TMath::Abs(fV0recOff->GetParamP()->GetSigmaY2())>0.000000001
357 ){
358 //
359 Double_t x, y, z;
360 AliKFParticle p1( *(fV0recOff->GetParamN()), pdg0 );
361 AliKFParticle p2( *(fV0recOff->GetParamP()), pdg1 );
362 //
363 fKFOffRecNC = new AliKFParticle;
364 fV0recOff->GetXYZ(x,y,z);
365 fKFOffRecNC->SetVtxGuess(x,y,z);
366 *(fKFOffRecNC)+=p1;
367 *(fKFOffRecNC)+=p2;
368 fKFrecOffChi2NC =fKFOffRecNC->GetChi2() ;
369 //
370 fKFOffRecC = new AliKFParticle;
371 fV0recOff->GetXYZ(x,y,z);
372 fKFOffRecC->SetVtxGuess(x,y,z);
373 *(fKFOffRecC)+=p1;
374 *(fKFOffRecC)+=p2;
375 fKFOffRecC->SetProductionVertex(primVtx);
376 fKFrecOffChi2C =fKFOffRecC->GetChi2();
377 //
378 fKFOffRecCM = new AliKFParticle;
379 fV0recOff->GetXYZ(x,y,z);
380 fKFOffRecCM->SetVtxGuess(x,y,z);
381 *(fKFOffRecCM)+=p1;
382 *(fKFOffRecCM)+=p2;
383 fKFOffRecCM->SetProductionVertex(primVtx);
384 fKFOffRecCM->SetMassConstraint(mass);
385 fKFrecOffChi2CM =fKFOffRecCM->GetChi2();
386 }
387
388
389}
390
391