]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliKink.cxx
Coverity 16571
[u/mrichter/AliRoot.git] / STEER / AliKink.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 //-------------------------------------------------------------------------
17 //    Origin: Marian Ivanov marian.ivanov@cern.ch
18 //-------------------------------------------------------------------------
19
20 #include <TMath.h>
21 #include "AliKink.h"
22 #include "AliHelix.h"
23
24
25 ClassImp(AliKink)
26
27 void  AliKink::Update()
28 {
29   //
30   // updates Kink Info
31   //
32   Float_t distance2=1000;
33   //
34   AliHelix dhelix1(fParamDaughter);
35   AliHelix mhelix(fParamMother);    
36   //
37   //find intersection linear
38   //
39   Double_t phase[2][2]={{0}},radius[2]={0};
40   Double_t delta1=10000,delta2=10000;  
41   Int_t points=0;
42   /*
43     Float_t distance1=0;
44   Int_t  points = dhelix1.GetRPHIintersections(mhelix, phase, radius,200);
45   
46   if (points>0){
47     dhelix1.LinearDCA(mhelix,phase[0][0],phase[0][1],radius[0],delta1);
48   }
49   if (points==2){    
50     dhelix1.LinearDCA(mhelix,phase[1][0],phase[1][1],radius[1],delta2);
51   }
52   distance1 = TMath::Min(delta1,delta2);
53   */
54   //
55   //find intersection parabolic
56   //
57   points = dhelix1.GetRPHIintersections(mhelix, phase, radius,7);
58
59   delta1=10000,delta2=10000;  
60   Double_t d1=1000.,d2=10000.;
61   if (points>0){
62     dhelix1.ParabolicDCA(mhelix,phase[0][0],phase[0][1],radius[0],delta1,6);
63     //    dhelix1.ParabolicDCA(mhelix,phase[0][0],phase[0][1],radius[0],delta1);
64     Double_t xd[3],xm[3];
65     dhelix1.Evaluate(phase[0][0],xd);
66     mhelix.Evaluate(phase[0][1],xm);
67     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]);
68   }
69   if (points==2){    
70     dhelix1.ParabolicDCA(mhelix,phase[1][0],phase[1][1],radius[1],delta2,6);
71     //dhelix1.ParabolicDCA(mhelix,phase[1][0],phase[1][1],radius[1],delta2);
72     Double_t xd[3],xm[3];
73     dhelix1.Evaluate(phase[1][0],xd);
74     mhelix.Evaluate(phase[1][1],xm);
75     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]);
76   }
77   //
78   distance2 = TMath::Min(delta1,delta2);
79   if (delta1<delta2){
80     //get V0 info
81     //    dhelix1.Evaluate(phase[0][0],fXr);
82     Double_t xd[3],xm[3];
83     dhelix1.Evaluate(phase[0][0],xd);
84     mhelix.Evaluate(phase[0][1], xm);
85     fXr[0] = 0.5*(xd[0]+xm[0]);
86     fXr[1] = 0.5*(xd[1]+xm[1]);
87     fXr[2] = 0.5*(xd[2]+xm[2]);
88     //
89     dhelix1.GetMomentum(phase[0][0],fPdr);
90     mhelix.GetMomentum(phase[0][1],fPm);
91     dhelix1.GetAngle(phase[0][0],mhelix,phase[0][1],fAngle);
92     //fRr = TMath::Sqrt(radius[0]);
93     fRr = TMath::Sqrt(fXr[0]*fXr[0]+fXr[1]*fXr[1]);
94   }
95   else{
96     //dhelix1.Evaluate(phase[1][0],fXr);
97     Double_t xd[3],xm[3];
98     dhelix1.Evaluate(phase[1][0],xd);
99     mhelix.Evaluate(phase[1][1], xm);
100     fXr[0] = 0.5*(xd[0]+xm[0]);
101     fXr[1] = 0.5*(xd[1]+xm[1]);
102     fXr[2] = 0.5*(xd[2]+xm[2]);
103     //
104     dhelix1.GetMomentum(phase[1][0], fPdr);
105     mhelix.GetMomentum(phase[1][1], fPm);
106     dhelix1.GetAngle(phase[1][0],mhelix,phase[1][1],fAngle);
107     //    fRr = TMath::Sqrt(radius[1]); 
108     fRr = TMath::Sqrt(fXr[0]*fXr[0]+fXr[1]*fXr[1]);
109   }
110   fDist1 = TMath::Sqrt(TMath::Min(d1,d2));
111   fDist2 = TMath::Sqrt(distance2);      
112   //            
113   //
114
115 }
116