1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
16 //-------------------------------------------------------------------------
17 // Implementation of the HLT ITS track class
19 // Origin: Cvetan Cheshkov, CERN, Cvetan.Cheshkov@cern.ch
20 //-------------------------------------------------------------------------
24 #include "AliL3StandardIncludes.h"
26 #include "AliESDHLTtrack.h"
27 #include "AliL3ITStrack.h"
29 ClassImp(AliL3ITStrack)
31 //____________________________________________________________________________
32 AliL3ITStrack::AliL3ITStrack()
33 :AliITStrackV2(),fESDHLTtrack(0)
35 //------------------------------------------------------------------
37 //------------------------------------------------------------------
40 //____________________________________________________________________________
41 AliL3ITStrack::AliL3ITStrack(const AliL3ITStrack& t)
42 : AliITStrackV2(t), fESDHLTtrack(0)
44 //------------------------------------------------------------------
46 //------------------------------------------------------------------
47 fESDHLTtrack=t.fESDHLTtrack;
50 //____________________________________________________________________________
51 AliL3ITStrack::AliL3ITStrack(AliESDHLTtrack& t, Double_t zvertex) throw (const Char_t *)
52 : AliITStrackV2(), fESDHLTtrack(0)
54 // The method constructs an AliL3ITStrack object from an ESD HLT track
60 //____________________________________________________________________________
61 AliL3ITStrack::AliL3ITStrack(const AliESDHLTtrack& t, Double_t zvertex) throw (const Char_t *)
62 : AliITStrackV2(), fESDHLTtrack(0)
64 // The method constructs an AliL3ITStrack object from an ESD HLT track
68 //____________________________________________________________________________
69 void AliL3ITStrack::Set(const AliESDHLTtrack& t, Double_t zvertex) throw (const Char_t *) {
70 // The method constructs an AliL3ITStrack object from an ESD HLT track
74 SetNumberOfClusters(0);
76 SetNumberOfClusters(t.GetNHits());
77 SetLabel(t.GetMCid());
81 fAlpha = fmod((t.GetSector()+0.5)*(2*TMath::Pi()/18),2*TMath::Pi());
82 if (fAlpha < -TMath::Pi()) fAlpha += 2*TMath::Pi();
83 else if (fAlpha >= TMath::Pi()) fAlpha -= 2*TMath::Pi();
85 //First the emiision angle
86 Double_t psi = t.GetPsi()-(t.GetSector()+0.5)*(2*TMath::Pi()/18);
88 //Then local x,y coordinates
89 Double_t radius = t.GetPt()*GetConvConst();
90 Double_t xhit = 82.97; //Position at first TPC padrow
91 Double_t trackphi0 = psi + (-t.GetCharge())*TMath::Pi()/2;
92 Double_t x0 = t.GetFirstPointX()*TMath::Cos(fAlpha) + t.GetFirstPointY()*TMath::Sin(fAlpha);
93 Double_t y0 = t.GetFirstPointY()*TMath::Cos(fAlpha) - t.GetFirstPointX()*TMath::Sin(fAlpha);
94 Double_t centerx = radius * cos(trackphi0) + x0;
95 Double_t centery = radius * sin(trackphi0) + y0;
96 Double_t aa = (xhit - centerx)*(xhit - centerx);
97 Double_t r2 = radius*radius;
98 if(aa > r2) throw "AliITStrackV2: conversion failed !\n";
99 Double_t aa2 = sqrt(r2 - aa);
100 Double_t y1 = centery + aa2;
101 Double_t y2 = centery - aa2;
103 if(fabs(y2) < fabs(y1)) yhit = y2;
106 Double_t angle1 = atan2((yhit - centery),(xhit - centerx));
107 if(angle1 < 0) angle1 += 2.*TMath::Pi();
108 Double_t angle2 = atan2((x0-centery),(y0-centerx));
109 if(angle2 < 0) angle2 += 2.*TMath::Pi();
110 Double_t diffangle = angle1 - angle2;
111 diffangle = fmod(diffangle,2.*TMath::Pi());
112 if(((-t.GetCharge())*diffangle) < 0) diffangle = diffangle - (-t.GetCharge())*2.*TMath::Pi();
113 Double_t stot = fabs(diffangle)*radius;
116 zhit = zvertex + stot*t.GetTgl();
118 zhit = t.GetFirstPointZ() + stot*t.GetTgl();
120 //Local sine of track azimuthal angle
121 if((-t.GetCharge())<0)
123 Double_t sinbeta = -1.*(centerx - xhit)/radius;
125 //Filling of the track paramaters
133 //and covariance matrix
136 fC00=fC22*82.97*82.97;
137 fC11=fC33*82.97*82.97;
138 // fC44=(0.005+0.025*t.GetPt())*(0.005+0.025*t.GetPt())*fP4*fP4;
139 // fC44=(0.01+0.01*t.GetPt())*(0.01+0.01*t.GetPt())*fP4*fP4;
140 fC44=0.01*0.01*fP4*fP4;
144 fC30=0; fC31=0; fC32=0;
145 fC40=0; fC41=0; fC42=0; fC43=0;
152 //_____________________________________________________________________________
153 Int_t AliL3ITStrack::Compare(const TObject *o) const {
154 //-----------------------------------------------------------------
155 // This function compares tracks according to the their curvature
156 //-----------------------------------------------------------------
157 AliL3ITStrack *t=(AliL3ITStrack*)o;
158 Double_t co=TMath::Abs(t->Get1Pt());
159 Double_t c =TMath::Abs(Get1Pt());
160 // Double_t co=t->GetSigmaY2()*t->GetSigmaZ2();
161 // Double_t c =GetSigmaY2()*GetSigmaZ2();
163 else if (c<co) return -1;
167 Bool_t AliL3ITStrack::GetPxPyPzAt(Double_t x,Double_t *p) const {
168 //---------------------------------------------------------------------
169 // This function returns the global track momentum components
170 // at the position "x" using the helix track approximation
171 //---------------------------------------------------------------------
173 p[1]=fP2+(x-fX)*fP4/AliKalmanTrack::GetConvConst();
176 if (TMath::Abs(p[0])<=0) return kFALSE;
177 if (TMath::Abs(p[1])> 0.999999) return kFALSE;
179 Double_t pt=1./TMath::Abs(p[0]);
180 Double_t cs=TMath::Cos(fAlpha), sn=TMath::Sin(fAlpha);
181 Double_t r=TMath::Sqrt(1 - p[1]*p[1]);
182 p[0]=pt*(r*cs - p[1]*sn); p[1]=pt*(p[1]*cs + r*sn); p[2]=pt*p[2];