]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/ITS/AliL3ITStrack.cxx
Introduction of a fast version of the AliITSVertexerZ for HLT
[u/mrichter/AliRoot.git] / HLT / ITS / AliL3ITStrack.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 //                Implementation of the HLT ITS track class
18 //
19 //          Origin: Cvetan Cheshkov, CERN, Cvetan.Cheshkov@cern.ch
20 //-------------------------------------------------------------------------
21
22 #include <TMath.h>
23
24 #include "AliL3StandardIncludes.h"
25
26 #include "AliESDHLTtrack.h"
27 #include "AliL3ITStrack.h"
28
29 ClassImp(AliL3ITStrack)
30
31 //____________________________________________________________________________
32 AliL3ITStrack::AliL3ITStrack():AliITStrackV2(),
33   fESDHLTtrack(0)
34 {
35   //------------------------------------------------------------------
36   //Constructor
37   //------------------------------------------------------------------
38 }
39
40 //____________________________________________________________________________
41 AliL3ITStrack::AliL3ITStrack(const AliL3ITStrack& t) : AliITStrackV2(t) {
42   //------------------------------------------------------------------
43   //Copy constructor
44   //------------------------------------------------------------------
45   fESDHLTtrack=t.fESDHLTtrack;
46 }
47
48 //____________________________________________________________________________
49 AliL3ITStrack::AliL3ITStrack(AliESDHLTtrack& t, Double_t zvertex) throw (const Char_t *) {
50   // The method constructs an AliL3ITStrack object from an ESD HLT track
51  
52   SetChi2(0.);
53   if(t.GetNHits()==1)
54     SetNumberOfClusters(0);
55   else
56     SetNumberOfClusters(t.GetNHits());
57   SetLabel(t.GetMCid());
58   SetMass(0.13957);
59
60   fdEdx=0;
61   fAlpha = fmod((t.GetSector()+0.5)*(2*TMath::Pi()/18),2*TMath::Pi());
62   if      (fAlpha < -TMath::Pi()) fAlpha += 2*TMath::Pi();
63   else if (fAlpha >= TMath::Pi()) fAlpha -= 2*TMath::Pi();
64
65   //First the emiision angle
66   Double_t psi = t.GetPsi()-(t.GetSector()+0.5)*(2*TMath::Pi()/18);
67
68   //Then local x,y coordinates
69   Double_t radius = t.GetPt()*GetConvConst();
70   Double_t xhit = 82.97; //Position at first TPC padrow
71   Double_t trackphi0 = psi + (-t.GetCharge())*TMath::Pi()/2;
72   Double_t x0 = t.GetFirstPointX()*TMath::Cos(fAlpha) + t.GetFirstPointY()*TMath::Sin(fAlpha);
73   Double_t y0 = t.GetFirstPointY()*TMath::Cos(fAlpha) - t.GetFirstPointX()*TMath::Sin(fAlpha);
74   Double_t centerx = radius *  cos(trackphi0) + x0;
75   Double_t centery = radius *  sin(trackphi0) + y0;
76   Double_t aa = (xhit - centerx)*(xhit - centerx);
77   Double_t r2 = radius*radius;
78   if(aa > r2) throw "AliITStrackV2: conversion failed !\n";
79   Double_t aa2 = sqrt(r2 - aa);
80   Double_t y1 = centery + aa2;
81   Double_t y2 = centery - aa2;
82   Double_t yhit = y1;
83   if(fabs(y2) < fabs(y1)) yhit = y2;
84
85   //Local z coordinate
86   Double_t angle1 = atan2((yhit - centery),(xhit - centerx));
87   if(angle1 < 0) angle1 += 2.*TMath::Pi();
88   Double_t angle2 = atan2((x0-centery),(y0-centerx));
89   if(angle2 < 0) angle2 += 2.*TMath::Pi();
90   Double_t diffangle = angle1 - angle2;
91   diffangle = fmod(diffangle,2.*TMath::Pi());
92   if(((-t.GetCharge())*diffangle) < 0) diffangle = diffangle - (-t.GetCharge())*2.*TMath::Pi();
93   Double_t stot = fabs(diffangle)*radius;
94   Double_t zhit;
95   if(t.GetNHits()==1)
96     zhit = zvertex + stot*t.GetTgl();
97   else
98     zhit = t.GetFirstPointZ() + stot*t.GetTgl();
99
100   //Local sine of track azimuthal angle
101   if((-t.GetCharge())<0)
102     radius = -radius;
103   Double_t sinbeta = -1.*(centerx - xhit)/radius;
104
105   //Filling of the track paramaters
106   fX=xhit;
107   fP0=yhit;
108   fP1=zhit;
109   fP2=sinbeta;
110   fP3=t.GetTgl();
111   fP4=1./radius;
112
113   //and covariance matrix
114   fC22=0.005*0.005;
115   fC33=0.005*0.005;
116   fC00=fC22*82.97*82.97;
117   fC11=fC33*82.97*82.97;
118   //  fC44=(0.005+0.025*t.GetPt())*(0.005+0.025*t.GetPt())*fP4*fP4;
119   //  fC44=(0.01+0.01*t.GetPt())*(0.01+0.01*t.GetPt())*fP4*fP4;
120   fC44=0.01*0.01*fP4*fP4;
121
122   fC10=0;
123   fC20=0;   fC21=0;
124   fC30=0;   fC31=0;   fC32=0;
125   fC40=0;   fC41=0;   fC42=0;   fC43=0;
126
127   fESDHLTtrack=&t;
128   fESDtrack=0;
129
130   SetFakeRatio(0.);
131
132 }
133
134 //_____________________________________________________________________________
135 Int_t AliL3ITStrack::Compare(const TObject *o) const {
136   //-----------------------------------------------------------------
137   // This function compares tracks according to the their curvature
138   //-----------------------------------------------------------------
139   AliL3ITStrack *t=(AliL3ITStrack*)o;
140   Double_t co=TMath::Abs(t->Get1Pt());
141   Double_t c =TMath::Abs(Get1Pt());
142   //  Double_t co=t->GetSigmaY2()*t->GetSigmaZ2();
143   //  Double_t c =GetSigmaY2()*GetSigmaZ2();
144   if (c>co) return 1;
145   else if (c<co) return -1;
146   return 0;
147 }