]>
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 | ||
e58b7f7e | 45 | AliITSUTrackCooked &AliITSUTrackCooked::operator=(const AliITSUTrackCooked &o){ |
46 | if (this != &o) { | |
47 | AliKalmanTrack::operator=(o); | |
48 | for (Int_t i=0; i<2*AliITSUTrackerCooked::kNLayers; i++) | |
49 | fIndex[i]=o.fIndex[i]; | |
50 | } | |
51 | return *this; | |
52 | } | |
53 | ||
4fb1e9d1 | 54 | AliITSUTrackCooked::~AliITSUTrackCooked() |
55 | { | |
56 | //-------------------------------------------------------------------- | |
57 | // Virtual destructor | |
58 | //-------------------------------------------------------------------- | |
59 | } | |
60 | ||
d5a6c710 | 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(); | |
70 | if (c>co) return 1; | |
71 | else if (c<co) return -1; | |
72 | return 0; | |
73 | } | |
74 | ||
ae63ad3b | 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; | |
80 | SetChi2(0.); | |
81 | SetNumberOfClusters(0); | |
82 | } | |
83 | ||
4fb1e9d1 | 84 | void AliITSUTrackCooked::SetClusterIndex(Int_t l, Int_t i) |
85 | { | |
86 | //-------------------------------------------------------------------- | |
87 | // Set the cluster index | |
88 | //-------------------------------------------------------------------- | |
89 | Int_t idx = (l<<28) + i; | |
90 | Int_t n=GetNumberOfClusters(); | |
91 | fIndex[n]=idx; | |
92 | SetNumberOfClusters(n+1); | |
93 | } | |
94 | ||
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); | |
102 | } | |
103 | ||
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; | |
113 | ||
114 | Double_t bz=GetBz(); | |
115 | if (!AliExternalTrackParam::PropagateTo(xk,bz)) return kFALSE; | |
116 | //Double_t b[3]; GetBxByBz(b); | |
117 | //if (!AliExternalTrackParam::PropagateToBxByBz(xk,b)) return kFALSE; | |
118 | ||
119 | return kTRUE; | |
120 | } | |
121 | ||
4fb1e9d1 | 122 | Bool_t AliITSUTrackCooked::Update(const AliCluster *c, Double_t chi2, Int_t idx) |
123 | { | |
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()}; | |
129 | ||
130 | if (!AliExternalTrackParam::Update(p,cov)) return kFALSE; | |
131 | ||
132 | Int_t n=GetNumberOfClusters(); | |
133 | fIndex[n]=idx; | |
134 | SetNumberOfClusters(n+1); | |
135 | SetChi2(GetChi2()+chi2); | |
136 | ||
137 | return kTRUE; | |
138 | } | |
66be9a4e | 139 | |
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; | |
150 | r = TMath::Abs(d); | |
151 | } | |
152 | ||
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]); | |
157 | ||
158 | if (GetX()>=0.) { | |
159 | phi=phicurr+TMath::ASin(d/r)-TMath::ASin(d/rcurr); | |
160 | } else { | |
161 | phi=phicurr+TMath::ASin(d/r)+TMath::ASin(d/rcurr)-TMath::Pi(); | |
162 | } | |
163 | ||
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))); | |
168 | ||
169 | return kTRUE; | |
170 | } |