]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/AliESDkink.cxx
Stricter check of map boundary. Caused index out of range before.
[u/mrichter/AliRoot.git] / STEER / AliESDkink.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>
24#include <TPDGCode.h>
25#include "AliESDkink.h"
26#include "AliHelix.h"
27
28
29ClassImp(AliESDkink)
30
31AliESDkink::AliESDkink(){
32 //
33 //Dafault constructor
34 //
35 fDist1 =-1;
36 fDist2 =-1;
37 fRr =-1;
38 fStatus = 0;
39 fRow0 =-1;
40 fTPCdensity2[0][0]=-1;
41 fTPCdensity2[0][1]=-1;
42
43}
44
45void AliESDkink::SetMother(const AliExternalTrackParam & pmother) {
46 //
47 // set mother
48 //
49 fParamMother = pmother;
50}
51
52void AliESDkink::SetDaughter(const AliExternalTrackParam & pdaughter){
53 //
54 //set daughter
55 //
56 fParamDaughter = pdaughter;
57
58}
59
60void AliESDkink::Update()
61{
62 //
63 // updates Kink Info
64 //
65 Float_t distance1,distance2;
66 //
67 AliHelix dhelix1(fParamDaughter);
68 AliHelix mhelix(fParamMother);
69 //
70 //find intersection linear
71 //
72 Double_t phase[2][2],radius[2];
73 Int_t points = dhelix1.GetRPHIintersections(mhelix, phase, radius,200);
74 Double_t delta1=10000,delta2=10000;
75
76 if (points>0){
77 dhelix1.LinearDCA(mhelix,phase[0][0],phase[0][1],radius[0],delta1);
78 dhelix1.LinearDCA(mhelix,phase[0][0],phase[0][1],radius[0],delta1);
79 dhelix1.LinearDCA(mhelix,phase[0][0],phase[0][1],radius[0],delta1);
80 }
81 if (points==2){
82 dhelix1.LinearDCA(mhelix,phase[1][0],phase[1][1],radius[1],delta2);
83 dhelix1.LinearDCA(mhelix,phase[1][0],phase[1][1],radius[1],delta2);
84 dhelix1.LinearDCA(mhelix,phase[1][0],phase[1][1],radius[1],delta2);
85 }
86 distance1 = TMath::Min(delta1,delta2);
87 //
88 //find intersection parabolic
89 //
90 points = dhelix1.GetRPHIintersections(mhelix, phase, radius);
91 delta1=10000,delta2=10000;
92 Double_t d1=1000.,d2=10000.;
93 if (points>0){
94 dhelix1.ParabolicDCA(mhelix,phase[0][0],phase[0][1],radius[0],delta1);
95 dhelix1.ParabolicDCA(mhelix,phase[0][0],phase[0][1],radius[0],delta1);
96 Double_t xd[3],xm[3];
97 dhelix1.Evaluate(phase[0][0],xd);
98 mhelix.Evaluate(phase[0][1],xm);
99 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]);
100 }
101 if (points==2){
102 dhelix1.ParabolicDCA(mhelix,phase[1][0],phase[1][1],radius[1],delta2);
103 dhelix1.ParabolicDCA(mhelix,phase[1][0],phase[1][1],radius[1],delta2);
104 Double_t xd[3],xm[3];
105 dhelix1.Evaluate(phase[1][0],xd);
106 mhelix.Evaluate(phase[1][1],xm);
107 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]);
108 }
109 //
110 distance2 = TMath::Min(delta1,delta2);
111 if (delta1<delta2){
112 //get V0 info
113 // dhelix1.Evaluate(phase[0][0],fXr);
114 Double_t xd[3],xm[3];
115 dhelix1.Evaluate(phase[0][0],xd);
116 mhelix.Evaluate(phase[0][1], xm);
117 fXr[0] = 0.5*(xd[0]+xm[0]);
118 fXr[1] = 0.5*(xd[1]+xm[1]);
119 fXr[2] = 0.5*(xd[2]+xm[2]);
120 //
121 dhelix1.GetMomentum(phase[0][0],fPdr);
122 mhelix.GetMomentum(phase[0][1],fPm);
123 dhelix1.GetAngle(phase[0][0],mhelix,phase[0][1],fAngle);
124 //fRr = TMath::Sqrt(radius[0]);
125 fRr = TMath::Sqrt(fXr[0]*fXr[0]+fXr[1]*fXr[1]);
126 }
127 else{
128 //dhelix1.Evaluate(phase[1][0],fXr);
129 Double_t xd[3],xm[3];
130 dhelix1.Evaluate(phase[1][0],xd);
131 mhelix.Evaluate(phase[1][1], xm);
132 fXr[0] = 0.5*(xd[0]+xm[0]);
133 fXr[1] = 0.5*(xd[1]+xm[1]);
134 fXr[2] = 0.5*(xd[2]+xm[2]);
135 //
136 dhelix1.GetMomentum(phase[1][0], fPdr);
137 mhelix.GetMomentum(phase[1][1], fPm);
138 dhelix1.GetAngle(phase[1][0],mhelix,phase[1][1],fAngle);
139 // fRr = TMath::Sqrt(radius[1]);
140 fRr = TMath::Sqrt(fXr[0]*fXr[0]+fXr[1]*fXr[1]);
141 }
142 fDist1 = TMath::Sqrt(TMath::Min(d1,d2));
143 fDist2 = TMath::Sqrt(distance2);
144 //
145 //
146
147}
148
149
150Float_t AliESDkink::GetTPCDensityFactor() const
151{
152 //
153 //
154 return fTPCdensity[0][0]+fTPCdensity[1][1]-TMath::Max(fTPCdensity[0][1],Float_t(0.0))-TMath::Max(fTPCdensity[1][0],Float_t(0.0));
155}
156
157Float_t AliESDkink::GetQt() const
158{
159 Float_t dmomentum = TMath::Sqrt(fPdr[0]*fPdr[0]+fPdr[1]*fPdr[1]+fPdr[2]*fPdr[2]);
160 return TMath::Sin(fAngle[2])*dmomentum;
161}