]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/TPCLib/tracking/AliHLTTPCHoughKalmanTrack.cxx
make hough tracking code compiling
[u/mrichter/AliRoot.git] / HLT / TPCLib / tracking / AliHLTTPCHoughKalmanTrack.cxx
1 // @(#) $Id$
2 // origin: hough/AliL3HoughKalmanTrack.cxx,v 1.3 Tue Sep 5 08:45:27 2006 UTC by hristov
3
4 /**************************************************************************
5  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
6  *                                                                        *
7  * Author: The ALICE Off-line Project.                                    *
8  * Contributors are mentioned in the code where appropriate.              *
9  *                                                                        *
10  * Permission to use, copy, modify and distribute this software and its   *
11  * documentation strictly for non-commercial purposes is hereby granted   *
12  * without fee, provided that the above copyright notice appears in all   *
13  * copies and that both the copyright notice and this permission notice   *
14  * appear in the supporting documentation. The authors make no claims     *
15  * about the suitability of this software for any purpose. It is          *
16  * provided "as is" without express or implied warranty.                  *
17  **************************************************************************/
18
19 //-------------------------------------------------------------------------
20 //          Implementation of the HLT TPC Hough Kalman track class
21 //
22 //          Origin: Cvetan Cheshkov, CERN, Cvetan.Cheshkov@cern.ch
23 //-------------------------------------------------------------------------
24
25 #include "AliHLTTPCHoughKalmanTrack.h"
26
27 #include "AliHLTStdIncludes.h"
28 #include "AliHLTTPCHoughTrack.h"
29 #include "AliHLTTPCHoughTransformer.h"
30 #include "AliHLTTPCHoughTransformerRow.h"
31 #include "AliHLTTPCHistogram.h"
32
33 Int_t CalcExternalParams(const AliHLTTPCHoughTrack& t, Double_t deltax, Double_t deltay, Double_t deltaeta, const Double_t zvertex, const Double_t xhit, Double_t xx[5]);
34
35 ClassImp(AliHLTTPCHoughKalmanTrack)
36
37 //____________________________________________________________________________
38 AliHLTTPCHoughKalmanTrack::AliHLTTPCHoughKalmanTrack(const AliHLTTPCHoughTrack& t) throw (const Char_t *) 
39               : AliTPCtrack() 
40 {
41   // The method constructs an AliHLTTPCHoughKalmanTrack object
42   // from an HLT TPC Hough track
43
44   SetChi2(0.);
45   SetNumberOfClusters(t.GetLastRow()-t.GetFirstRow());
46   SetLabel(t.GetMCid());
47   SetFakeRatio(0.);
48   SetMass(0.13957);
49
50   fdEdx=0;
51   Double_t alpha = fmod((t.GetSector()+0.5)*(2*TMath::Pi()/18),2*TMath::Pi());
52   if      (alpha < -TMath::Pi()) alpha += 2*TMath::Pi();
53   else if (alpha >= TMath::Pi()) alpha -= 2*TMath::Pi();
54
55   const Double_t xhit = 82.97;
56   const Double_t zvertex = t.GetFirstPointZ();
57   Double_t par[5];
58   Double_t deltax = t.GetPterr();
59   Double_t deltay = t.GetPsierr();
60   Double_t deltaeta = t.GetTglerr();
61   if(CalcExternalParams(t,0,0,0,zvertex,xhit,par)==0) throw "AliHLTTPCHoughKalmanTrack: conversion failed !\n";
62
63   Double_t cnv=1./(GetBz()*kB2C);
64
65   //and covariance matrix
66   //For the moment estimate the covariance matrix numerically
67   Double_t xx1[5];
68   if(CalcExternalParams(t,deltax,0,0,zvertex,xhit,xx1)==0) throw "AliHLTTPCHoughKalmanTrack: conversion failed !\n";
69   Double_t xx2[5];
70   if(CalcExternalParams(t,0,deltay,0,zvertex,xhit,xx2)==0) throw "AliHLTTPCHoughKalmanTrack: conversion failed !\n";
71   Double_t xx3[5];
72   if(CalcExternalParams(t,0,0,deltaeta,zvertex,xhit,xx3)==0) throw "AliHLTTPCHoughKalmanTrack: conversion failed !\n";
73
74   Double_t dx1[5],dx2[5],dx3[5];
75   for(Int_t i=0;i<5;i++) {
76     dx1[i]=xx1[i]-par[i];
77     dx2[i]=xx2[i]-par[i];
78     dx3[i]=xx3[i]-par[i];
79   }
80
81   Double_t cov[15]={
82     dx1[0]*dx1[0]+dx2[0]*dx2[0],
83     0.,  dx3[1]*dx3[1],
84     0.,  0.,  dx1[2]*dx1[2]+dx2[2]*dx2[2],
85     0.,  dx3[3]*dx3[1],  0.,  dx3[3]*dx3[3],
86     0.,  0.,  0.,  0.,  dx1[4]*dx1[4]+dx2[4]*dx2[4]
87   };
88   /*
89   fC20=dx1[2]*dx1[0]+dx2[2]*dx2[0];
90   fC40=dx1[4]*dx1[0]+dx2[4]*dx2[0];
91   fC42=dx1[4]*dx1[2]+dx2[4]*dx2[2];
92   fC33=dx3[3]*dx3[3];
93   fC11=dx3[1]*dx3[1];
94   fC31=dx3[3]*dx3[1];
95   fC10=fC30=fC21=fC41=fC32=fC43=0;
96   fC20=fC42=fC40=0;
97   */
98   cov[10]*=cnv; cov[11]*=cnv; cov[12]*=cnv; cov[13]*=cnv; cov[14]*=(cnv*cnv); 
99   par[4]*=cnv;
100
101   Set(xhit,alpha,par,cov);
102
103 }
104
105 //____________________________________________________________________________
106 Int_t CalcExternalParams(const AliHLTTPCHoughTrack& t, Double_t deltax, Double_t deltay, Double_t deltaeta, const Double_t zvertex, const Double_t xhit, Double_t xx[5])
107 {
108   // Translate the parameters of the Hough tracks into
109   // AliKalmanTrack paramters
110
111   //First get the emiision angle and track curvature
112   Double_t binx = t.GetBinX()+deltax;
113   Double_t biny = t.GetBinY()+deltay;
114   Double_t psi = atan((binx-biny)/(AliHLTTPCHoughTransformerRow::GetBeta1()-AliHLTTPCHoughTransformerRow::GetBeta2()));
115   Double_t kappa = 2.0*(binx*cos(psi)-AliHLTTPCHoughTransformerRow::GetBeta1()*sin(psi));
116   Double_t radius = 1./kappa;
117
118   //Local y coordinate
119   Double_t centerx = -1.*radius*sin(psi);
120   Double_t centery = radius*cos(psi);
121   Double_t aa = (xhit - centerx)*(xhit - centerx);
122   Double_t r2 = radius*radius;
123   if(aa > r2) return 0;
124   Double_t aa2 = sqrt(r2 - aa);
125   Double_t y1 = centery + aa2;
126   Double_t y2 = centery - aa2;
127   Double_t yhit = y1;
128   if(fabs(y2) < fabs(y1)) yhit = y2;
129
130   //Local z coordinate
131   Double_t stot = sqrt(xhit*xhit+yhit*yhit);
132   Double_t zhit;
133
134   //Lambda
135   Double_t eta=t.GetPseudoRapidity()+deltaeta;
136   Double_t theta = 2*atan(exp(-1.*eta));
137   Double_t tanl = 1./tan(theta);
138   zhit = zvertex + stot*tanl;
139
140   xx[0] = yhit;
141   xx[1] = zhit;
142   xx[2] = (xhit-centerx)/radius;
143   xx[3] = tanl;
144   xx[4] = kappa;
145   return 1;
146 }