]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliESDkink.cxx
Problem with boundary crossing on common boundaries between mother and daughter volum...
[u/mrichter/AliRoot.git] / STEER / AliESDkink.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 /* $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
29 ClassImp(AliESDkink)
30
31 AliESDkink::AliESDkink(){
32   //
33   //Dafault constructor
34   //
35   fID = -1;
36   fDist1  = -1;
37   fDist2  = -1;
38   fPdr[0] = 0;
39   fPdr[1] = 0;
40   fPdr[2] = 0;
41   fXr[0] = 0;
42   fXr[1] = 0;
43   fXr[2] = 0;
44   fPm[0] = 0;
45   fPm[1] = 0;
46   fPm[2] = 0;
47   fAngle[0] = 0;
48   fAngle[1] = 0;
49   fAngle[2] = 0;
50   fRr     = -1;
51   fLab[0] = -1;
52   fLab[1] = -1;
53   fIndex[0] = -1;
54   fIndex[1] = -1;
55   fStatus = 0;
56   fTPCdensity[0][0]=-1;
57   fTPCdensity[0][1]=-1;
58   fTPCdensity[1][0]=-1;
59   fTPCdensity[1][1]=-1;
60   fTPCdensity2[0][0]=-1;
61   fTPCdensity2[0][1]=-1;
62   fTPCdensity2[1][0]=-1;
63   fTPCdensity2[1][1]=-1;
64   fShapeFactor = 0;
65   fRow0   =-1;
66   fMultiple[0] = 0;
67   fMultiple[1] = 0;
68   fZm[0] = 0;
69   fZm[1] = 0;
70   fFi[0] = 0;
71   fFi[1] = 0;
72 }
73
74 void AliESDkink::SetMother(const AliExternalTrackParam & pmother)  {
75   //
76   // set mother
77   //
78   fParamMother   = pmother;
79 }
80
81 void AliESDkink::SetDaughter(const AliExternalTrackParam & pdaughter){
82   //
83   //set daughter
84   //
85   fParamDaughter = pdaughter;
86
87 }
88   
89 void  AliESDkink::Update()
90 {
91   //
92   // updates Kink Info
93   //
94   Float_t distance1,distance2;
95   //
96   AliHelix dhelix1(fParamDaughter);
97   AliHelix mhelix(fParamMother);    
98   //
99   //find intersection linear
100   //
101   Double_t phase[2][2],radius[2];
102   Int_t  points = dhelix1.GetRPHIintersections(mhelix, phase, radius,200);
103   Double_t delta1=10000,delta2=10000;  
104   
105   if (points>0){
106     dhelix1.LinearDCA(mhelix,phase[0][0],phase[0][1],radius[0],delta1);
107     dhelix1.LinearDCA(mhelix,phase[0][0],phase[0][1],radius[0],delta1);
108     dhelix1.LinearDCA(mhelix,phase[0][0],phase[0][1],radius[0],delta1);
109   }
110   if (points==2){    
111     dhelix1.LinearDCA(mhelix,phase[1][0],phase[1][1],radius[1],delta2);
112     dhelix1.LinearDCA(mhelix,phase[1][0],phase[1][1],radius[1],delta2);
113     dhelix1.LinearDCA(mhelix,phase[1][0],phase[1][1],radius[1],delta2);
114   }
115   distance1 = TMath::Min(delta1,delta2);
116   //
117   //find intersection parabolic
118   //
119   points = dhelix1.GetRPHIintersections(mhelix, phase, radius);
120   delta1=10000,delta2=10000;  
121   Double_t d1=1000.,d2=10000.;
122   if (points>0){
123     dhelix1.ParabolicDCA(mhelix,phase[0][0],phase[0][1],radius[0],delta1);
124     dhelix1.ParabolicDCA(mhelix,phase[0][0],phase[0][1],radius[0],delta1);
125     Double_t xd[3],xm[3];
126     dhelix1.Evaluate(phase[0][0],xd);
127     mhelix.Evaluate(phase[0][1],xm);
128     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]);
129   }
130   if (points==2){    
131     dhelix1.ParabolicDCA(mhelix,phase[1][0],phase[1][1],radius[1],delta2);
132     dhelix1.ParabolicDCA(mhelix,phase[1][0],phase[1][1],radius[1],delta2);
133     Double_t xd[3],xm[3];
134     dhelix1.Evaluate(phase[1][0],xd);
135     mhelix.Evaluate(phase[1][1],xm);
136     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]);
137   }
138   //
139   distance2 = TMath::Min(delta1,delta2);
140   if (delta1<delta2){
141     //get V0 info
142     //    dhelix1.Evaluate(phase[0][0],fXr);
143     Double_t xd[3],xm[3];
144     dhelix1.Evaluate(phase[0][0],xd);
145     mhelix.Evaluate(phase[0][1], xm);
146     fXr[0] = 0.5*(xd[0]+xm[0]);
147     fXr[1] = 0.5*(xd[1]+xm[1]);
148     fXr[2] = 0.5*(xd[2]+xm[2]);
149     //
150     dhelix1.GetMomentum(phase[0][0],fPdr);
151     mhelix.GetMomentum(phase[0][1],fPm);
152     dhelix1.GetAngle(phase[0][0],mhelix,phase[0][1],fAngle);
153     //fRr = TMath::Sqrt(radius[0]);
154     fRr = TMath::Sqrt(fXr[0]*fXr[0]+fXr[1]*fXr[1]);
155   }
156   else{
157     //dhelix1.Evaluate(phase[1][0],fXr);
158     Double_t xd[3],xm[3];
159     dhelix1.Evaluate(phase[1][0],xd);
160     mhelix.Evaluate(phase[1][1], xm);
161     fXr[0] = 0.5*(xd[0]+xm[0]);
162     fXr[1] = 0.5*(xd[1]+xm[1]);
163     fXr[2] = 0.5*(xd[2]+xm[2]);
164     //
165     dhelix1.GetMomentum(phase[1][0], fPdr);
166     mhelix.GetMomentum(phase[1][1], fPm);
167     dhelix1.GetAngle(phase[1][0],mhelix,phase[1][1],fAngle);
168     //    fRr = TMath::Sqrt(radius[1]); 
169     fRr = TMath::Sqrt(fXr[0]*fXr[0]+fXr[1]*fXr[1]);
170   }
171   fDist1 = TMath::Sqrt(TMath::Min(d1,d2));
172   fDist2 = TMath::Sqrt(distance2);      
173   //            
174   //
175
176 }
177
178  
179 Float_t AliESDkink::GetTPCDensityFactor() const
180 {
181   //
182   //
183   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)); 
184 }
185
186 Float_t AliESDkink::GetQt() const
187 {
188   Float_t dmomentum = TMath::Sqrt(fPdr[0]*fPdr[0]+fPdr[1]*fPdr[1]+fPdr[2]*fPdr[2]);
189   return TMath::Sin(fAngle[2])*dmomentum;
190 }