1 //-------------------------------------------------------------------------
2 // Implementation of the ITSU track class
3 // based on the "cooked covariance" approach
4 //-------------------------------------------------------------------------
5 #include "AliITSUTrackCooked.h"
6 #include "AliCluster.h"
7 #include "AliESDtrack.h"
9 ClassImp(AliITSUTrackCooked)
11 AliITSUTrackCooked::AliITSUTrackCooked():
14 //--------------------------------------------------------------------
15 // This default constructor needs to be provided
16 //--------------------------------------------------------------------
17 for (Int_t i=0; i<2*AliITSUTrackerCooked::kNLayers; i++) {
22 AliITSUTrackCooked::AliITSUTrackCooked(const AliITSUTrackCooked &t):
25 //--------------------------------------------------------------------
27 //--------------------------------------------------------------------
28 for (Int_t i=0; i<2*AliITSUTrackerCooked::kNLayers; i++) {
29 fIndex[i]=t.fIndex[i];
33 AliITSUTrackCooked::AliITSUTrackCooked(const AliESDtrack &t):
36 //--------------------------------------------------------------------
37 // Constructior from an ESD track
38 //--------------------------------------------------------------------
39 Set(t.GetX(), t.GetAlpha(), t.GetParameter(), t.GetCovariance());
40 SetLabel(t.GetITSLabel());
41 SetChi2(t.GetITSchi2());
42 SetNumberOfClusters(t.GetITSclusters(fIndex));
45 AliITSUTrackCooked &AliITSUTrackCooked::operator=(const AliITSUTrackCooked &o){
47 AliKalmanTrack::operator=(o);
48 for (Int_t i=0; i<2*AliITSUTrackerCooked::kNLayers; i++)
49 fIndex[i]=o.fIndex[i];
54 AliITSUTrackCooked::~AliITSUTrackCooked()
56 //--------------------------------------------------------------------
58 //--------------------------------------------------------------------
61 Int_t AliITSUTrackCooked::Compare(const TObject *o) const {
62 //-----------------------------------------------------------------
63 // This function compares tracks according to the their curvature
64 //-----------------------------------------------------------------
65 const AliITSUTrackCooked *t=(const AliITSUTrackCooked*)o;
66 Double_t co=TMath::Abs(t->OneOverPt());
67 Double_t c =TMath::Abs(OneOverPt());
68 //Double_t co=t->GetSigmaY2()*t->GetSigmaZ2();
69 //Double_t c =GetSigmaY2()*GetSigmaZ2();
71 else if (c<co) return -1;
75 void AliITSUTrackCooked::ResetClusters() {
76 //------------------------------------------------------------------
77 // Reset the array of attached clusters.
78 //------------------------------------------------------------------
79 for (Int_t i=0; i<2*AliITSUTrackerCooked::kNLayers; i++) fIndex[i]=-1;
81 SetNumberOfClusters(0);
84 void AliITSUTrackCooked::SetClusterIndex(Int_t l, Int_t i)
86 //--------------------------------------------------------------------
87 // Set the cluster index
88 //--------------------------------------------------------------------
89 Int_t idx = (l<<28) + i;
90 Int_t n=GetNumberOfClusters();
92 SetNumberOfClusters(n+1);
95 Double_t AliITSUTrackCooked::GetPredictedChi2(const AliCluster *c) const {
96 //-----------------------------------------------------------------
97 // This function calculates a predicted chi2 increment.
98 //-----------------------------------------------------------------
99 Double_t p[2]={c->GetY(), c->GetZ()};
100 Double_t cov[3]={c->GetSigmaY2(), 0., c->GetSigmaZ2()};
101 return AliExternalTrackParam::GetPredictedChi2(p,cov);
104 Bool_t AliITSUTrackCooked::PropagateTo(Double_t xk, Double_t t,Double_t x0rho) {
105 //------------------------------------------------------------------
106 // This function propagates a track
107 // t is the material thicknes in units X/X0
108 // x0rho is the material X0*density
109 //------------------------------------------------------------------
110 Double_t xOverX0,xTimesRho;
111 xOverX0 = t; xTimesRho = t*x0rho;
112 if (!CorrectForMeanMaterial(xOverX0,xTimesRho,GetMass(),kTRUE)) return kFALSE;
115 if (!AliExternalTrackParam::PropagateTo(xk,bz)) return kFALSE;
116 //Double_t b[3]; GetBxByBz(b);
117 //if (!AliExternalTrackParam::PropagateToBxByBz(xk,b)) return kFALSE;
122 Bool_t AliITSUTrackCooked::Update(const AliCluster *c, Double_t chi2, Int_t idx)
124 //--------------------------------------------------------------------
125 // Update track params
126 //--------------------------------------------------------------------
127 Double_t p[2]={c->GetY(), c->GetZ()};
128 Double_t cov[3]={c->GetSigmaY2(), c->GetSigmaYZ(), c->GetSigmaZ2()};
130 if (!AliExternalTrackParam::Update(p,cov)) return kFALSE;
132 Int_t n=GetNumberOfClusters();
134 SetNumberOfClusters(n+1);
135 SetChi2(GetChi2()+chi2);
140 Bool_t AliITSUTrackCooked::
141 GetPhiZat(Double_t r, Double_t &phi, Double_t &z) const {
142 //------------------------------------------------------------------
143 // This function returns the global cylindrical (phi,z) of the track
144 // position estimated at the radius r.
145 // The track curvature is neglected.
146 //------------------------------------------------------------------
147 Double_t d=GetD(0., 0., GetBz());
148 if (TMath::Abs(d) > r) {
149 if (r>1e-1) return kFALSE;
153 Double_t rcurr=TMath::Sqrt(GetX()*GetX() + GetY()*GetY());
154 if (TMath::Abs(d) > rcurr) return kFALSE;
155 Double_t globXYZcurr[3]; GetXYZ(globXYZcurr);
156 Double_t phicurr=TMath::ATan2(globXYZcurr[1],globXYZcurr[0]);
159 phi=phicurr+TMath::ASin(d/r)-TMath::ASin(d/rcurr);
161 phi=phicurr+TMath::ASin(d/r)+TMath::ASin(d/rcurr)-TMath::Pi();
164 // return a phi in [0,2pi[
165 if (phi<0.) phi+=2.*TMath::Pi();
166 else if (phi>=2.*TMath::Pi()) phi-=2.*TMath::Pi();
167 z=GetZ()+GetTgl()*(TMath::Sqrt((r-d)*(r+d))-TMath::Sqrt((rcurr-d)*(rcurr+d)));