]>
Commit | Line | Data |
---|---|---|
4fb1e9d1 | 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" | |
8 | ||
9 | ClassImp(AliITSUTrackCooked) | |
10 | ||
11 | AliITSUTrackCooked::AliITSUTrackCooked(): | |
12 | AliKalmanTrack() | |
13 | { | |
14 | //-------------------------------------------------------------------- | |
15 | // This default constructor needs to be provided | |
16 | //-------------------------------------------------------------------- | |
17 | for (Int_t i=0; i<2*AliITSUTrackerCooked::kNLayers; i++) { | |
18 | fIndex[i]=0; | |
19 | } | |
20 | } | |
21 | ||
66be9a4e | 22 | AliITSUTrackCooked::AliITSUTrackCooked(const AliITSUTrackCooked &t): |
23 | AliKalmanTrack(t) | |
24 | { | |
25 | //-------------------------------------------------------------------- | |
26 | // Copy constructor | |
27 | //-------------------------------------------------------------------- | |
28 | for (Int_t i=0; i<2*AliITSUTrackerCooked::kNLayers; i++) { | |
29 | fIndex[i]=t.fIndex[i]; | |
30 | } | |
31 | } | |
32 | ||
4fb1e9d1 | 33 | AliITSUTrackCooked::AliITSUTrackCooked(const AliESDtrack &t): |
34 | AliKalmanTrack() | |
35 | { | |
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)); | |
43 | } | |
44 | ||
45 | AliITSUTrackCooked::~AliITSUTrackCooked() | |
46 | { | |
47 | //-------------------------------------------------------------------- | |
48 | // Virtual destructor | |
49 | //-------------------------------------------------------------------- | |
50 | } | |
51 | ||
d5a6c710 | 52 | Int_t AliITSUTrackCooked::Compare(const TObject *o) const { |
53 | //----------------------------------------------------------------- | |
54 | // This function compares tracks according to the their curvature | |
55 | //----------------------------------------------------------------- | |
56 | const AliITSUTrackCooked *t=(const AliITSUTrackCooked*)o; | |
57 | Double_t co=TMath::Abs(t->OneOverPt()); | |
58 | Double_t c =TMath::Abs(OneOverPt()); | |
59 | //Double_t co=t->GetSigmaY2()*t->GetSigmaZ2(); | |
60 | //Double_t c =GetSigmaY2()*GetSigmaZ2(); | |
61 | if (c>co) return 1; | |
62 | else if (c<co) return -1; | |
63 | return 0; | |
64 | } | |
65 | ||
ae63ad3b | 66 | void AliITSUTrackCooked::ResetClusters() { |
67 | //------------------------------------------------------------------ | |
68 | // Reset the array of attached clusters. | |
69 | //------------------------------------------------------------------ | |
70 | for (Int_t i=0; i<2*AliITSUTrackerCooked::kNLayers; i++) fIndex[i]=-1; | |
71 | SetChi2(0.); | |
72 | SetNumberOfClusters(0); | |
73 | } | |
74 | ||
4fb1e9d1 | 75 | void AliITSUTrackCooked::SetClusterIndex(Int_t l, Int_t i) |
76 | { | |
77 | //-------------------------------------------------------------------- | |
78 | // Set the cluster index | |
79 | //-------------------------------------------------------------------- | |
80 | Int_t idx = (l<<28) + i; | |
81 | Int_t n=GetNumberOfClusters(); | |
82 | fIndex[n]=idx; | |
83 | SetNumberOfClusters(n+1); | |
84 | } | |
85 | ||
86 | Double_t AliITSUTrackCooked::GetPredictedChi2(const AliCluster *c) const { | |
87 | //----------------------------------------------------------------- | |
88 | // This function calculates a predicted chi2 increment. | |
89 | //----------------------------------------------------------------- | |
90 | Double_t p[2]={c->GetY(), c->GetZ()}; | |
91 | Double_t cov[3]={c->GetSigmaY2(), 0., c->GetSigmaZ2()}; | |
92 | return AliExternalTrackParam::GetPredictedChi2(p,cov); | |
93 | } | |
94 | ||
95 | Bool_t AliITSUTrackCooked::PropagateTo(Double_t xk, Double_t t,Double_t x0rho) { | |
96 | //------------------------------------------------------------------ | |
97 | // This function propagates a track | |
98 | // t is the material thicknes in units X/X0 | |
99 | // x0rho is the material X0*density | |
100 | //------------------------------------------------------------------ | |
101 | Double_t xOverX0,xTimesRho; | |
102 | xOverX0 = t; xTimesRho = t*x0rho; | |
103 | if (!CorrectForMeanMaterial(xOverX0,xTimesRho,GetMass(),kTRUE)) return kFALSE; | |
104 | ||
105 | Double_t bz=GetBz(); | |
106 | if (!AliExternalTrackParam::PropagateTo(xk,bz)) return kFALSE; | |
107 | //Double_t b[3]; GetBxByBz(b); | |
108 | //if (!AliExternalTrackParam::PropagateToBxByBz(xk,b)) return kFALSE; | |
109 | ||
110 | return kTRUE; | |
111 | } | |
112 | ||
4fb1e9d1 | 113 | Bool_t AliITSUTrackCooked::Update(const AliCluster *c, Double_t chi2, Int_t idx) |
114 | { | |
115 | //-------------------------------------------------------------------- | |
116 | // Update track params | |
117 | //-------------------------------------------------------------------- | |
118 | Double_t p[2]={c->GetY(), c->GetZ()}; | |
119 | Double_t cov[3]={c->GetSigmaY2(), c->GetSigmaYZ(), c->GetSigmaZ2()}; | |
120 | ||
121 | if (!AliExternalTrackParam::Update(p,cov)) return kFALSE; | |
122 | ||
123 | Int_t n=GetNumberOfClusters(); | |
124 | fIndex[n]=idx; | |
125 | SetNumberOfClusters(n+1); | |
126 | SetChi2(GetChi2()+chi2); | |
127 | ||
128 | return kTRUE; | |
129 | } | |
66be9a4e | 130 | |
131 | Bool_t AliITSUTrackCooked:: | |
132 | GetPhiZat(Double_t r, Double_t &phi, Double_t &z) const { | |
133 | //------------------------------------------------------------------ | |
134 | // This function returns the global cylindrical (phi,z) of the track | |
135 | // position estimated at the radius r. | |
136 | // The track curvature is neglected. | |
137 | //------------------------------------------------------------------ | |
138 | Double_t d=GetD(0., 0., GetBz()); | |
139 | if (TMath::Abs(d) > r) { | |
140 | if (r>1e-1) return kFALSE; | |
141 | r = TMath::Abs(d); | |
142 | } | |
143 | ||
144 | Double_t rcurr=TMath::Sqrt(GetX()*GetX() + GetY()*GetY()); | |
145 | if (TMath::Abs(d) > rcurr) return kFALSE; | |
146 | Double_t globXYZcurr[3]; GetXYZ(globXYZcurr); | |
147 | Double_t phicurr=TMath::ATan2(globXYZcurr[1],globXYZcurr[0]); | |
148 | ||
149 | if (GetX()>=0.) { | |
150 | phi=phicurr+TMath::ASin(d/r)-TMath::ASin(d/rcurr); | |
151 | } else { | |
152 | phi=phicurr+TMath::ASin(d/r)+TMath::ASin(d/rcurr)-TMath::Pi(); | |
153 | } | |
154 | ||
155 | // return a phi in [0,2pi[ | |
156 | if (phi<0.) phi+=2.*TMath::Pi(); | |
157 | else if (phi>=2.*TMath::Pi()) phi-=2.*TMath::Pi(); | |
158 | z=GetZ()+GetTgl()*(TMath::Sqrt((r-d)*(r+d))-TMath::Sqrt((rcurr-d)*(rcurr+d))); | |
159 | ||
160 | return kTRUE; | |
161 | } |