]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG1/AliESDRecKinkInfo.cxx
Proof-enabled version of the TPC comparison (Andrei Zalite)
[u/mrichter/AliRoot.git] / PWG1 / AliESDRecKinkInfo.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 ///////////////////////////////////////////////////////////////////////////////
18 //                                                                           //
19 //  Time Projection Chamber                                                  //
20 //  Comparison macro for reconstructed tracks - ESDs V0s                                     //
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"
46 #include "AliTRDtrack.h"
47 #include "AliHelix.h"
48 #include "AliESDVertex.h"
49 #include "AliExternalTrackParam.h"
50 #include "AliESDkink.h"
51 #include "AliESDv0.h"
52 #include "AliV0.h"
53 //
54 #include "AliTreeDraw.h"
55 #include "AliMCInfo.h"
56 #include "AliGenKinkInfo.h"
57 #include "AliGenV0Info.h"
58 #include "AliESDRecKinkInfo.h"
59
60
61
62 ClassImp(AliESDRecKinkInfo)
63
64
65
66 AliESDRecKinkInfo::AliESDRecKinkInfo():
67   fT1(),      //track1
68   fT2(),      //track2  
69   fKink(),    //kink
70   fDist1(0),    //info about closest distance according closest MC - linear DCA
71   fDist2(0),    //info about closest distance parabolic DCA
72   fInvMass(0),  //reconstructed invariant mass -
73   //
74   fRr(0),       // rec position of the vertex 
75   fMinR(0),     // minimum radius in rphi intersection
76   fDistMinR(0), // distance at minimal radius
77   fPointAngleFi(0), //point angle fi
78   fPointAngleTh(0), //point angle theta
79   fPointAngle(0),   //point angle full
80   fStatus(0),       //status -tracks 
81   fRecStatus(0),    //kink -status- 0 - not found  1-good -  fake
82   fMultiple(0),     // how many times was kink reconstructed
83   fKinkMultiple(0) // how many times was kink reconstructed
84 {
85   //
86   // Default constructor
87   //
88 }
89
90 ////
91 void  AliESDRecKinkInfo::Update()
92 {
93
94   if ( (fT1.fTPCOn)&& (fT2.fTPCOn)){
95     //
96     // IF BOTH RECONSTRUCTED
97     Float_t distance1,distance2;
98     Double_t xx[3],pp[3];
99     //
100     Double_t xd[3],pd[3],signd;
101     Double_t xm[3],pm[3],signm;
102     for (Int_t i=0;i<3;i++){
103       xd[i] = fT2.fTPCinR1[i];
104       pd[i] = fT2.fTPCinP1[i];
105       xm[i] = fT1.fTPCinR1[i];
106       pm[i] = fT1.fTPCinP1[i];
107     }
108     signd =  fT2.fSign<0 ? -1:1;
109     signm =  fT1.fSign<0 ? -1:1;
110
111     AliHelix dhelix1(xd,pd,signd);
112     dhelix1.GetMomentum(0,pp,0);
113     dhelix1.Evaluate(0,xx);      
114     // 
115     //  Double_t x2[3],p2[3];
116     //            
117     AliHelix mhelix(xm,pm,signm);    
118     //
119     //find intersection linear
120     //
121     Double_t phase[2][2],radius[2];
122     Int_t  points = dhelix1.GetRPHIintersections(mhelix, phase, radius,200);
123     Double_t delta1=10000,delta2=10000;  
124
125     if (points==1){
126       fMinR = TMath::Sqrt(radius[0]);
127     }
128     if (points==2){
129       fMinR =TMath::Min(TMath::Sqrt(radius[0]),TMath::Sqrt(radius[1]));
130     }
131     
132     if (points>0){
133       dhelix1.LinearDCA(mhelix,phase[0][0],phase[0][1],radius[0],delta1);
134       dhelix1.LinearDCA(mhelix,phase[0][0],phase[0][1],radius[0],delta1);
135       dhelix1.LinearDCA(mhelix,phase[0][0],phase[0][1],radius[0],delta1);
136     }
137     if (points==2){    
138       dhelix1.LinearDCA(mhelix,phase[1][0],phase[1][1],radius[1],delta2);
139       dhelix1.LinearDCA(mhelix,phase[1][0],phase[1][1],radius[1],delta2);
140       dhelix1.LinearDCA(mhelix,phase[1][0],phase[1][1],radius[1],delta2);
141     }
142     if (points==1){
143       fMinR = TMath::Sqrt(radius[0]);
144       fDistMinR = delta1;
145     }
146     if (points==2){
147       if (radius[0]<radius[1]){
148         fMinR = TMath::Sqrt(radius[0]);
149         fDistMinR = delta1;
150       }
151       else{
152         fMinR = TMath::Sqrt(radius[1]);
153         fDistMinR = delta2;
154       }
155     }
156     //
157     //
158     distance1 = TMath::Min(delta1,delta2);
159     //
160     //find intersection parabolic
161     //
162     points = dhelix1.GetRPHIintersections(mhelix, phase, radius);
163     delta1=10000,delta2=10000;  
164     
165     if (points>0){
166       dhelix1.ParabolicDCA(mhelix,phase[0][0],phase[0][1],radius[0],delta1);
167     }
168     if (points==2){    
169       dhelix1.ParabolicDCA(mhelix,phase[1][0],phase[1][1],radius[1],delta2);
170     }
171     
172     distance2 = TMath::Min(delta1,delta2);
173     if (delta1<delta2){
174       //get V0 info
175       dhelix1.Evaluate(phase[0][0],fXr);
176       dhelix1.GetMomentum(phase[0][0],fPdr);
177       mhelix.GetMomentum(phase[0][1],fPm);
178       dhelix1.GetAngle(phase[0][0],mhelix,phase[0][1],fAngle);
179       fRr = TMath::Sqrt(radius[0]);
180     }
181     else{
182       dhelix1.Evaluate(phase[1][0],fXr);
183       dhelix1.GetMomentum(phase[1][0], fPdr);
184       mhelix.GetMomentum(phase[1][1], fPm);
185       dhelix1.GetAngle(phase[1][0],mhelix,phase[1][1],fAngle);
186       fRr = TMath::Sqrt(radius[1]);
187     }
188     fDist1 = TMath::Sqrt(distance1);
189     fDist2 = TMath::Sqrt(distance2);      
190     
191     if (fDist2<10.5){
192       Double_t x,alpha,param[5],cov[15];
193       //
194       fT1.GetESDtrack()->GetInnerExternalParameters(alpha,x,param);
195       fT1.GetESDtrack()->GetInnerExternalCovariance(cov);
196       AliExternalTrackParam paramm(x,alpha,param,cov);
197       //
198       fT2.GetESDtrack()->GetInnerExternalParameters(alpha,x,param);
199       fT2.GetESDtrack()->GetInnerExternalCovariance(cov);
200       AliExternalTrackParam paramd(x,alpha,param,cov);
201       /*
202       AliESDkink kink;
203       kink.Update(&paramm,&paramd);
204       //      kink.Dump();
205       Double_t diff  = kink.fRr-fRr;
206       Double_t diff2 = kink.fDist2-fDist2;
207       printf("Diff\t%f\t%f\n",diff,diff2);
208       */
209     }
210     
211     //            
212     //
213   }
214
215 }
216