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