]>
Commit | Line | Data |
---|---|---|
a9e2aefa | 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 | ||
cc87ebcd | 16 | /* $Id$ */ |
17 | ||
3d1463c8 | 18 | //----------------------------------------------------------------------------- |
7945aae7 | 19 | /// \class AliMUONTrackReconstructor |
20 | /// MUON track reconstructor using the original method | |
21 | /// | |
22 | /// This class contains as data: | |
23 | /// - the parameters for the track reconstruction | |
24 | /// | |
25 | /// It contains as methods, among others: | |
26 | /// - MakeTracks to build the tracks | |
3d1463c8 | 27 | //----------------------------------------------------------------------------- |
a9e2aefa | 28 | |
29f1b13a | 29 | #include "AliMUONTrackReconstructor.h" |
7ec3b9cf | 30 | |
29fc2c86 | 31 | #include "AliMUONConstants.h" |
96ebe67e | 32 | #include "AliMUONVCluster.h" |
1fef78c8 | 33 | #include "AliMUONVClusterServer.h" |
96ebe67e | 34 | #include "AliMUONVClusterStore.h" |
a9e2aefa | 35 | #include "AliMUONTrack.h" |
37827b29 | 36 | #include "AliMUONTrackParam.h" |
37 | #include "AliMUONTrackExtrap.h" | |
5a240757 | 38 | #include "AliMUONRecoParam.h" |
b709ac13 | 39 | |
1fef78c8 | 40 | #include "AliMpArea.h" |
41 | ||
8c343c7c | 42 | #include "AliLog.h" |
af743f54 | 43 | |
208f139e | 44 | #include <TMinuit.h> |
af743f54 | 45 | #include <Riostream.h> |
ea94c18b | 46 | #include <TMath.h> |
af743f54 | 47 | #include <TMatrixD.h> |
ce8cd162 | 48 | #include <TClonesArray.h> |
a9e2aefa | 49 | |
de2cd600 | 50 | // Functions to be minimized with Minuit |
ea94c18b | 51 | void TrackChi2(Int_t &nParam, Double_t *gradient, Double_t &chi2, Double_t *param, Int_t flag); |
de2cd600 | 52 | |
cdd730d0 | 53 | using std::endl; |
54 | using std::cout; | |
7945aae7 | 55 | /// \cond CLASSIMP |
29f1b13a | 56 | ClassImp(AliMUONTrackReconstructor) // Class implementation in ROOT context |
7945aae7 | 57 | /// \endcond |
a9e2aefa | 58 | |
019df241 | 59 | //__________________________________________________________________________ |
a0dc65b4 | 60 | AliMUONTrackReconstructor::AliMUONTrackReconstructor(const AliMUONRecoParam* recoParam, AliMUONVClusterServer* clusterServer) |
61 | : AliMUONVTrackReconstructor(recoParam,clusterServer) | |
a9e2aefa | 62 | { |
96ebe67e | 63 | /// Constructor |
a9e2aefa | 64 | } |
9cbdf048 | 65 | |
019df241 | 66 | //__________________________________________________________________________ |
ea94c18b | 67 | AliMUONTrackReconstructor::~AliMUONTrackReconstructor() |
a9e2aefa | 68 | { |
ea94c18b | 69 | /// Destructor |
70 | } | |
276c44b7 | 71 | |
de2cd600 | 72 | //__________________________________________________________________________ |
89c8d66d | 73 | Bool_t AliMUONTrackReconstructor::MakeTrackCandidates(AliMUONVClusterStore& clusterStore) |
de2cd600 | 74 | { |
019df241 | 75 | /// To make track candidates (assuming linear propagation if the flag fgkMakeTrackCandidatesFast is set to kTRUE): |
208f139e | 76 | /// Start with segments station(1..) 4 or 5 then follow track in station 5 or 4. |
96ebe67e | 77 | /// Good candidates are made of at least three clusters. |
208f139e | 78 | /// Keep only best candidates or all of them according to the flag fgkTrackAllTracks. |
b709ac13 | 79 | |
208f139e | 80 | TClonesArray *segments; |
208f139e | 81 | AliMUONTrack *track; |
208f139e | 82 | Int_t iCandidate = 0; |
96ebe67e | 83 | Bool_t clusterFound; |
208f139e | 84 | |
de2cd600 | 85 | AliDebug(1,"Enter MakeTrackCandidates"); |
de2cd600 | 86 | |
3a7acd03 | 87 | // Unless we're doing combined tracking, we'll clusterize all stations at once |
88 | Int_t firstChamber(0); | |
89 | Int_t lastChamber(9); | |
90 | ||
a0dc65b4 | 91 | if (GetRecoParam()->CombineClusterTrackReco()) { |
3a7acd03 | 92 | // ... Here's the exception : ask the clustering to reconstruct |
93 | // clusters *only* in station 4 and 5 for combined tracking | |
94 | firstChamber = 6; | |
95 | } | |
96 | ||
97 | for (Int_t i = firstChamber; i <= lastChamber; ++i ) | |
98 | { | |
35be7ed7 | 99 | if (fClusterServer && GetRecoParam()->UseChamber(i)) fClusterServer->Clusterize(i, clusterStore, AliMpArea(), GetRecoParam()); |
1fef78c8 | 100 | } |
101 | ||
208f139e | 102 | // Loop over stations(1..) 5 and 4 and make track candidates |
ea94c18b | 103 | for (Int_t istat=4; istat>=3; istat--) { |
104 | ||
208f139e | 105 | // Make segments in the station |
9bf6860b | 106 | segments = MakeSegmentsBetweenChambers(clusterStore, 2*istat, 2*istat+1); |
ea94c18b | 107 | |
208f139e | 108 | // Loop over segments |
7ec3b9cf | 109 | for (Int_t iseg=0; iseg<segments->GetEntriesFast(); iseg++) |
110 | { | |
208f139e | 111 | AliDebug(1,Form("Making primary candidate(1..) %d",++iCandidate)); |
ea94c18b | 112 | |
208f139e | 113 | // Transform segments to tracks and put them at the end of fRecTracksPtr |
a0dc65b4 | 114 | track = new ((*fRecTracksPtr)[fRecTracksPtr->GetLast()+1]) AliMUONTrack((AliMUONObjectPair*)((*segments)[iseg]),GetRecoParam()->GetBendingVertexDispersion()); |
a9e2aefa | 115 | fNRecTracks++; |
ea94c18b | 116 | |
96ebe67e | 117 | // Look for compatible cluster(s) in the other station |
a0dc65b4 | 118 | if (GetRecoParam()->MakeTrackCandidatesFast()) |
96ebe67e | 119 | clusterFound = FollowLinearTrackInStation(*track, clusterStore, 7-istat); |
120 | else clusterFound = FollowTrackInStation(*track, clusterStore, 7-istat); | |
019df241 | 121 | |
89c8d66d | 122 | // Remove track if no cluster found on a requested station |
123 | // or abort tracking if there are too many candidates | |
6b191dea | 124 | if (GetRecoParam()->RequestStation(7-istat)) { |
125 | if (!clusterFound) { | |
126 | fRecTracksPtr->Remove(track); | |
127 | fNRecTracks--; | |
128 | } else if (fNRecTracks > GetRecoParam()->GetMaxTrackCandidates()) { | |
4ea3f013 | 129 | AliError(Form("Too many track candidates (%d tracks). Stop tracking.", fNRecTracks)); |
6b191dea | 130 | return kFALSE; |
131 | } | |
132 | } else { | |
133 | if ((fNRecTracks + segments->GetEntriesFast() - iseg - 1) > GetRecoParam()->GetMaxTrackCandidates()) { | |
4ea3f013 | 134 | AliError(Form("Too many track candidates (%d tracks). Stop tracking.", fNRecTracks + segments->GetEntriesFast() - iseg - 1)); |
6b191dea | 135 | return kFALSE; |
136 | } | |
ea94c18b | 137 | } |
138 | ||
a9e2aefa | 139 | } |
ea94c18b | 140 | |
208f139e | 141 | } |
ea94c18b | 142 | |
208f139e | 143 | // Keep all different tracks or only the best ones as required |
a0dc65b4 | 144 | if (GetRecoParam()->TrackAllTracks()) RemoveIdenticalTracks(); |
208f139e | 145 | else RemoveDoubleTracks(); |
146 | ||
147 | AliDebug(1,Form("Number of good candidates = %d",fNRecTracks)); | |
148 | ||
89c8d66d | 149 | return kTRUE; |
150 | ||
9bf6860b | 151 | } |
152 | ||
153 | //__________________________________________________________________________ | |
89c8d66d | 154 | Bool_t AliMUONTrackReconstructor::MakeMoreTrackCandidates(AliMUONVClusterStore& clusterStore) |
9bf6860b | 155 | { |
156 | /// To make extra track candidates (assuming linear propagation if the flag fgkMakeTrackCandidatesFast is set to kTRUE): | |
157 | /// clustering is supposed to be already done | |
158 | /// Start with segments made of 1 cluster in each of the stations 4 and 5 then follow track in remaining chambers. | |
159 | /// Good candidates are made of at least three clusters if both station are requested (two otherwise). | |
160 | /// Keep only best candidates or all of them according to the flag fgkTrackAllTracks. | |
161 | ||
162 | TClonesArray *segments; | |
89c8d66d | 163 | AliMUONObjectPair *segment; |
9bf6860b | 164 | AliMUONTrack *track; |
165 | Int_t iCandidate = 0, iCurrentTrack, nCurrentTracks; | |
166 | Bool_t clusterFound; | |
167 | ||
168 | AliDebug(1,"Enter MakeMoreTrackCandidates"); | |
169 | ||
170 | // Double loop over chambers in stations(1..) 4 and 5 to make track candidates | |
171 | for (Int_t ich1 = 6; ich1 <= 7; ich1++) { | |
172 | for (Int_t ich2 = 8; ich2 <= 9; ich2++) { | |
173 | ||
174 | // Make segments in the station | |
175 | segments = MakeSegmentsBetweenChambers(clusterStore, ich1, ich2); | |
176 | ||
89c8d66d | 177 | /// Remove segments already attached to a track |
178 | RemoveUsedSegments(*segments); | |
179 | ||
9bf6860b | 180 | // Loop over segments |
89c8d66d | 181 | for (Int_t iSegment=0; iSegment<segments->GetEntriesFast(); iSegment++) |
9bf6860b | 182 | { |
183 | AliDebug(1,Form("Making primary candidate(1..) %d",++iCandidate)); | |
89c8d66d | 184 | segment = (AliMUONObjectPair*) segments->UncheckedAt(iSegment); |
9bf6860b | 185 | |
186 | // Transform segments to tracks and put them at the end of fRecTracksPtr | |
187 | iCurrentTrack = fRecTracksPtr->GetLast()+1; | |
89c8d66d | 188 | track = new ((*fRecTracksPtr)[iCurrentTrack]) AliMUONTrack(segment,GetRecoParam()->GetBendingVertexDispersion()); |
9bf6860b | 189 | fNRecTracks++; |
190 | ||
191 | // Look for compatible cluster(s) in the second chamber of station 5 | |
89c8d66d | 192 | clusterFound = FollowLinearTrackInChamber(*track, clusterStore, 17-ich2); |
9bf6860b | 193 | |
194 | // skip the original track in case it has been removed | |
a0dc65b4 | 195 | if (GetRecoParam()->TrackAllTracks() && clusterFound) iCurrentTrack++; |
9bf6860b | 196 | |
197 | // loop over every new tracks | |
198 | nCurrentTracks = fRecTracksPtr->GetLast()+1; | |
199 | while (iCurrentTrack < nCurrentTracks) { | |
200 | track = (AliMUONTrack*) fRecTracksPtr->UncheckedAt(iCurrentTrack); | |
201 | ||
202 | // Look for compatible cluster(s) in the second chamber of station 4 | |
89c8d66d | 203 | FollowLinearTrackInChamber(*track, clusterStore, 13-ich1); |
9bf6860b | 204 | |
205 | iCurrentTrack++; | |
206 | } | |
207 | ||
89c8d66d | 208 | // abort tracking if there are too many candidates |
6b191dea | 209 | if ((fNRecTracks + segments->GetEntriesFast() - iSegment - 1) > GetRecoParam()->GetMaxTrackCandidates()) { |
4ea3f013 | 210 | AliError(Form("Too many track candidates (%d tracks). Stop tracking.", fNRecTracks + segments->GetEntriesFast() - iSegment - 1)); |
89c8d66d | 211 | return kFALSE; |
212 | } | |
213 | ||
9bf6860b | 214 | } |
215 | ||
9bf6860b | 216 | } |
217 | } | |
218 | ||
89c8d66d | 219 | // Keep only the best tracks if required |
220 | if (!GetRecoParam()->TrackAllTracks()) RemoveDoubleTracks(); | |
221 | else fRecTracksPtr->Compress(); | |
9bf6860b | 222 | |
223 | AliDebug(1,Form("Number of good candidates = %d",fNRecTracks)); | |
224 | ||
89c8d66d | 225 | return kTRUE; |
226 | ||
a9e2aefa | 227 | } |
228 | ||
229 | //__________________________________________________________________________ | |
89c8d66d | 230 | Bool_t AliMUONTrackReconstructor::FollowTracks(AliMUONVClusterStore& clusterStore) |
a9e2aefa | 231 | { |
2457f726 | 232 | /// Follow tracks in stations(1..) 3, 2 and 1 |
208f139e | 233 | AliDebug(1,"Enter FollowTracks"); |
234 | ||
04b5ea16 | 235 | AliMUONTrack *track, *nextTrack; |
b709ac13 | 236 | AliMUONTrackParam *trackParam, *nextTrackParam; |
af743f54 | 237 | Int_t currentNRecTracks; |
208f139e | 238 | |
a0dc65b4 | 239 | Double_t sigmaCut2 = GetRecoParam()->GetSigmaCutForTracking() * |
240 | GetRecoParam()->GetSigmaCutForTracking(); | |
3304fa09 | 241 | |
208f139e | 242 | for (Int_t station = 2; station >= 0; station--) { |
ea94c18b | 243 | |
208f139e | 244 | // Save the actual number of reconstructed track in case of |
245 | // tracks are added or suppressed during the tracking procedure | |
246 | // !! Do not compress fRecTracksPtr until the end of the loop over tracks !! | |
af743f54 | 247 | currentNRecTracks = fNRecTracks; |
ea94c18b | 248 | |
af743f54 | 249 | for (Int_t iRecTrack = 0; iRecTrack <currentNRecTracks; iRecTrack++) { |
208f139e | 250 | AliDebug(1,Form("FollowTracks: track candidate(1..) %d", iRecTrack+1)); |
ea94c18b | 251 | |
208f139e | 252 | track = (AliMUONTrack*) fRecTracksPtr->UncheckedAt(iRecTrack); |
ea94c18b | 253 | |
208f139e | 254 | // Fit the track: |
255 | // Do not take into account the multiple scattering to speed up the fit | |
256 | // Calculate the track parameter covariance matrix | |
9bf6860b | 257 | // If there is no cluster out of station 4 or 5 then use the vertex to better constrain the fit |
258 | if (((AliMUONTrackParam*) track->GetTrackParamAtCluster()->First())->GetClusterPtr()->GetChamberId() > 5) | |
259 | Fit(*track, kFALSE, kTRUE, kTRUE); | |
96ebe67e | 260 | else Fit(*track, kFALSE, kFALSE, kTRUE); |
ea94c18b | 261 | |
6b191dea | 262 | // remove tracks out of limits |
263 | if (!IsAcceptable(*((AliMUONTrackParam*)track->GetTrackParamAtCluster()->First()))) { | |
264 | fRecTracksPtr->Remove(track); | |
265 | fNRecTracks--; | |
266 | continue; | |
89c8d66d | 267 | } |
268 | ||
269 | // remove track if the normalized chi2 is too high | |
270 | if (track->GetNormalizedChi2() > sigmaCut2) { | |
9bf6860b | 271 | fRecTracksPtr->Remove(track); |
89c8d66d | 272 | fNRecTracks--; |
273 | continue; | |
208f139e | 274 | } |
ea94c18b | 275 | |
b709ac13 | 276 | // save parameters from fit into smoothed parameters to complete track afterward |
a0dc65b4 | 277 | if (GetRecoParam()->ComplementTracks()) { |
b709ac13 | 278 | |
279 | if (station==2) { // save track parameters on stations 4 and 5 | |
280 | ||
281 | // extrapolate track parameters and covariances at each cluster | |
4ea3f013 | 282 | // remove the track in case of failure |
283 | if (!track->UpdateCovTrackParamAtCluster()) { | |
284 | fRecTracksPtr->Remove(track); | |
285 | fNRecTracks--; | |
286 | continue; | |
287 | } | |
b709ac13 | 288 | |
289 | // save them | |
96ebe67e | 290 | trackParam = (AliMUONTrackParam*) track->GetTrackParamAtCluster()->First(); |
b709ac13 | 291 | while (trackParam) { |
292 | trackParam->SetSmoothParameters(trackParam->GetParameters()); | |
293 | trackParam->SetSmoothCovariances(trackParam->GetCovariances()); | |
96ebe67e | 294 | trackParam = (AliMUONTrackParam*) track->GetTrackParamAtCluster()->After(trackParam); |
b709ac13 | 295 | } |
296 | ||
297 | } else { // or save track parameters on last station only | |
298 | ||
96ebe67e | 299 | trackParam = (AliMUONTrackParam*) track->GetTrackParamAtCluster()->First(); |
9bf6860b | 300 | if (trackParam->GetClusterPtr()->GetChamberId() < 2*(station+2)) { |
b709ac13 | 301 | |
9bf6860b | 302 | // save parameters from fit |
303 | trackParam->SetSmoothParameters(trackParam->GetParameters()); | |
304 | trackParam->SetSmoothCovariances(trackParam->GetCovariances()); | |
b709ac13 | 305 | |
9bf6860b | 306 | // save parameters extrapolated to the second chamber of the same station if it has been hit |
307 | nextTrackParam = (AliMUONTrackParam*) track->GetTrackParamAtCluster()->After(trackParam); | |
308 | if (nextTrackParam->GetClusterPtr()->GetChamberId() < 2*(station+2)) { | |
309 | ||
310 | // reset parameters and covariances | |
311 | nextTrackParam->SetParameters(trackParam->GetParameters()); | |
312 | nextTrackParam->SetZ(trackParam->GetZ()); | |
313 | nextTrackParam->SetCovariances(trackParam->GetCovariances()); | |
314 | ||
315 | // extrapolate them to the z of the corresponding cluster | |
4ea3f013 | 316 | // remove the track in case of failure |
317 | if (!AliMUONTrackExtrap::ExtrapToZCov(nextTrackParam, nextTrackParam->GetClusterPtr()->GetZ())) { | |
318 | fRecTracksPtr->Remove(track); | |
319 | fNRecTracks--; | |
320 | continue; | |
321 | } | |
9bf6860b | 322 | |
323 | // save them | |
324 | nextTrackParam->SetSmoothParameters(nextTrackParam->GetParameters()); | |
325 | nextTrackParam->SetSmoothCovariances(nextTrackParam->GetCovariances()); | |
326 | ||
327 | } | |
b709ac13 | 328 | |
329 | } | |
330 | ||
331 | } | |
332 | ||
333 | } | |
334 | ||
96ebe67e | 335 | // Look for compatible cluster(s) in station(0..) "station" |
9bf6860b | 336 | if (!FollowTrackInStation(*track, clusterStore, station)) { |
337 | ||
338 | // Try to recover track if required | |
a0dc65b4 | 339 | if (GetRecoParam()->RecoverTracks()) { |
9bf6860b | 340 | |
341 | // work on a copy of the track if this station is not required | |
342 | // to keep the case where no cluster is reconstructed as a possible candidate | |
a0dc65b4 | 343 | if (!GetRecoParam()->RequestStation(station)) { |
9bf6860b | 344 | track = new ((*fRecTracksPtr)[fRecTracksPtr->GetLast()+1]) AliMUONTrack(*track); |
345 | fNRecTracks++; | |
346 | } | |
347 | ||
348 | // try to recover | |
349 | if (!RecoverTrack(*track, clusterStore, station)) { | |
350 | // remove track if no cluster found | |
351 | fRecTracksPtr->Remove(track); | |
352 | fNRecTracks--; | |
353 | } | |
354 | ||
a0dc65b4 | 355 | } else if (GetRecoParam()->RequestStation(station)) { |
9bf6860b | 356 | // remove track if no cluster found |
357 | fRecTracksPtr->Remove(track); | |
358 | fNRecTracks--; | |
359 | } | |
360 | ||
ea94c18b | 361 | } |
362 | ||
89c8d66d | 363 | // abort tracking if there are too many candidates |
364 | if (fNRecTracks > GetRecoParam()->GetMaxTrackCandidates()) { | |
4ea3f013 | 365 | AliError(Form("Too many track candidates (%d tracks). Stop tracking.", fNRecTracks)); |
89c8d66d | 366 | return kFALSE; |
367 | } | |
368 | ||
208f139e | 369 | } |
ea94c18b | 370 | |
208f139e | 371 | // Compress fRecTracksPtr for the next step |
372 | fRecTracksPtr->Compress(); | |
ea94c18b | 373 | |
208f139e | 374 | // Keep only the best tracks if required |
a0dc65b4 | 375 | if (!GetRecoParam()->TrackAllTracks()) RemoveDoubleTracks(); |
ea94c18b | 376 | |
208f139e | 377 | } |
378 | ||
96ebe67e | 379 | // Last fit of track candidates with all stations |
208f139e | 380 | // Take into account the multiple scattering and remove bad tracks |
381 | Int_t trackIndex = -1; | |
04b5ea16 | 382 | track = (AliMUONTrack*) fRecTracksPtr->First(); |
04b5ea16 | 383 | while (track) { |
ea94c18b | 384 | |
04b5ea16 | 385 | trackIndex++; |
386 | nextTrack = (AliMUONTrack*) fRecTracksPtr->After(track); // prepare next track | |
ea94c18b | 387 | |
96ebe67e | 388 | Fit(*track, kTRUE, kFALSE, kTRUE); |
ea94c18b | 389 | |
208f139e | 390 | // Printout for debuging |
391 | if (AliLog::GetGlobalDebugLevel() >= 3) { | |
392 | cout << "FollowTracks: track candidate(0..) " << trackIndex << " after final fit" << endl; | |
a9e2aefa | 393 | track->RecursiveDump(); |
208f139e | 394 | } |
ea94c18b | 395 | |
208f139e | 396 | // Remove the track if the normalized chi2 is too high |
3304fa09 | 397 | if (track->GetNormalizedChi2() > sigmaCut2) { |
208f139e | 398 | fRecTracksPtr->Remove(track); |
399 | fNRecTracks--; | |
6d9a2d45 | 400 | track = nextTrack; |
401 | continue; | |
a9e2aefa | 402 | } |
ea94c18b | 403 | |
b709ac13 | 404 | // save parameters from fit into smoothed parameters to complete track afterward |
a0dc65b4 | 405 | if (GetRecoParam()->ComplementTracks()) { |
b709ac13 | 406 | |
96ebe67e | 407 | trackParam = (AliMUONTrackParam*) track->GetTrackParamAtCluster()->First(); |
9bf6860b | 408 | if (trackParam->GetClusterPtr()->GetChamberId() < 2) { |
b709ac13 | 409 | |
9bf6860b | 410 | // save parameters from fit |
411 | trackParam->SetSmoothParameters(trackParam->GetParameters()); | |
412 | trackParam->SetSmoothCovariances(trackParam->GetCovariances()); | |
b709ac13 | 413 | |
9bf6860b | 414 | // save parameters extrapolated to the second chamber of the same station if it has been hit |
415 | nextTrackParam = (AliMUONTrackParam*) track->GetTrackParamAtCluster()->After(trackParam); | |
416 | if (nextTrackParam->GetClusterPtr()->GetChamberId() < 2) { | |
417 | ||
418 | // reset parameters and covariances | |
419 | nextTrackParam->SetParameters(trackParam->GetParameters()); | |
420 | nextTrackParam->SetZ(trackParam->GetZ()); | |
421 | nextTrackParam->SetCovariances(trackParam->GetCovariances()); | |
422 | ||
423 | // extrapolate them to the z of the corresponding cluster | |
4ea3f013 | 424 | // remove the track in case of failure |
425 | if (!AliMUONTrackExtrap::ExtrapToZCov(nextTrackParam, nextTrackParam->GetClusterPtr()->GetZ())) { | |
426 | fRecTracksPtr->Remove(track); | |
427 | fNRecTracks--; | |
428 | track = nextTrack; | |
429 | continue; | |
430 | } | |
9bf6860b | 431 | |
432 | // save them | |
433 | nextTrackParam->SetSmoothParameters(nextTrackParam->GetParameters()); | |
434 | nextTrackParam->SetSmoothCovariances(nextTrackParam->GetCovariances()); | |
435 | ||
436 | } | |
b709ac13 | 437 | |
438 | } | |
439 | ||
440 | } | |
441 | ||
208f139e | 442 | track = nextTrack; |
ea94c18b | 443 | |
208f139e | 444 | } |
ea94c18b | 445 | |
208f139e | 446 | fRecTracksPtr->Compress(); |
447 | ||
89c8d66d | 448 | return kTRUE; |
449 | ||
9bf6860b | 450 | } |
451 | ||
452 | //__________________________________________________________________________ | |
453 | Bool_t AliMUONTrackReconstructor::FollowTrackInChamber(AliMUONTrack &trackCandidate, AliMUONVClusterStore& clusterStore, Int_t nextChamber) | |
454 | { | |
455 | /// Follow trackCandidate in chamber(0..) nextChamber and search for compatible cluster(s) | |
456 | /// Keep all possibilities or only the best one(s) according to the flag fgkTrackAllTracks: | |
457 | /// kTRUE: duplicate "trackCandidate" if there are several possibilities and add the new tracks at the end of | |
458 | /// fRecTracksPtr to avoid conficts with other track candidates at this current stage of the tracking procedure. | |
459 | /// Remove the obsolete "trackCandidate" at the end. | |
460 | /// kFALSE: add only the best cluster(s) to the "trackCandidate". Try to add a couple of clusters in priority. | |
461 | AliDebug(1,Form("Enter FollowTrackInChamber(1..) %d", nextChamber+1)); | |
462 | ||
4ea3f013 | 463 | Double_t chi2WithOneCluster = AliMUONTrack::MaxChi2(); |
a0dc65b4 | 464 | Double_t maxChi2WithOneCluster = 2. * GetRecoParam()->GetSigmaCutForTracking() * |
465 | GetRecoParam()->GetSigmaCutForTracking(); // 2 because 2 quantities in chi2 | |
9bf6860b | 466 | Double_t bestChi2WithOneCluster = maxChi2WithOneCluster; |
467 | Bool_t foundOneCluster = kFALSE; | |
468 | AliMUONTrack *newTrack = 0x0; | |
469 | AliMUONVCluster *cluster; | |
470 | AliMUONTrackParam extrapTrackParam; | |
471 | AliMUONTrackParam extrapTrackParamAtCh; | |
472 | AliMUONTrackParam extrapTrackParamAtCluster; | |
473 | AliMUONTrackParam bestTrackParamAtCluster; | |
474 | ||
475 | // Get track parameters according to the propagation direction | |
476 | if (nextChamber > 7) extrapTrackParamAtCh = *(AliMUONTrackParam*)trackCandidate.GetTrackParamAtCluster()->Last(); | |
477 | else extrapTrackParamAtCh = *(AliMUONTrackParam*)trackCandidate.GetTrackParamAtCluster()->First(); | |
478 | ||
479 | // Printout for debuging | |
480 | if ((AliLog::GetDebugLevel("MUON","AliMUONTrackReconstructor") >= 2) || (AliLog::GetGlobalDebugLevel() >= 2)) { | |
481 | cout<<endl<<"Track parameters and covariances at first cluster:"<<endl; | |
482 | extrapTrackParamAtCh.GetParameters().Print(); | |
483 | extrapTrackParamAtCh.GetCovariances().Print(); | |
484 | } | |
485 | ||
486 | // Add MCS effect | |
4663da9f | 487 | Int_t currentChamber = extrapTrackParamAtCh.GetClusterPtr()->GetChamberId(); |
488 | AliMUONTrackExtrap::AddMCSEffect(&extrapTrackParamAtCh,AliMUONConstants::ChamberThicknessInX0(currentChamber),-1.); | |
9bf6860b | 489 | |
490 | // Add MCS in the missing chamber(s) if any | |
9bf6860b | 491 | while (currentChamber > nextChamber + 1) { |
492 | // extrapolation to the missing chamber | |
493 | currentChamber--; | |
4ea3f013 | 494 | if (!AliMUONTrackExtrap::ExtrapToZCov(&extrapTrackParamAtCh, AliMUONConstants::DefaultChamberZ(currentChamber))) return kFALSE; |
9bf6860b | 495 | // add MCS effect |
4663da9f | 496 | AliMUONTrackExtrap::AddMCSEffect(&extrapTrackParamAtCh,AliMUONConstants::ChamberThicknessInX0(currentChamber),-1.); |
9bf6860b | 497 | } |
498 | ||
499 | //Extrapolate trackCandidate to chamber | |
4ea3f013 | 500 | if (!AliMUONTrackExtrap::ExtrapToZCov(&extrapTrackParamAtCh, AliMUONConstants::DefaultChamberZ(nextChamber))) return kFALSE; |
9bf6860b | 501 | |
502 | // Printout for debuging | |
503 | if ((AliLog::GetDebugLevel("MUON","AliMUONTrackReconstructor") >= 2) || (AliLog::GetGlobalDebugLevel() >= 2)) { | |
504 | cout<<endl<<"Track parameters and covariances at first cluster extrapolated to z = "<<AliMUONConstants::DefaultChamberZ(nextChamber)<<":"<<endl; | |
505 | extrapTrackParamAtCh.GetParameters().Print(); | |
506 | extrapTrackParamAtCh.GetCovariances().Print(); | |
507 | } | |
508 | ||
509 | // Printout for debuging | |
510 | if ((AliLog::GetDebugLevel("MUON","AliMUONTrackReconstructor") >= 1) || (AliLog::GetGlobalDebugLevel() >= 1)) { | |
511 | cout << "FollowTrackInStation: look for clusters in chamber(1..): " << nextChamber+1 << endl; | |
512 | } | |
513 | ||
514 | // Ask the clustering to reconstruct new clusters around the track position in the current chamber | |
515 | // except for station 4 and 5 that are already entirely clusterized | |
a0dc65b4 | 516 | if (GetRecoParam()->CombineClusterTrackReco()) { |
9bf6860b | 517 | if (nextChamber < 6) AskForNewClustersInChamber(extrapTrackParamAtCh, clusterStore, nextChamber); |
518 | } | |
519 | ||
520 | // Create iterators to loop over clusters in both chambers | |
521 | TIter next(clusterStore.CreateChamberIterator(nextChamber,nextChamber)); | |
522 | ||
523 | // look for cluster in chamber | |
524 | while ( ( cluster = static_cast<AliMUONVCluster*>(next()) ) ) { | |
525 | ||
526 | // try to add the current cluster fast | |
527 | if (!TryOneClusterFast(extrapTrackParamAtCh, cluster)) continue; | |
528 | ||
529 | // try to add the current cluster accuratly | |
530 | chi2WithOneCluster = TryOneCluster(extrapTrackParamAtCh, cluster, extrapTrackParamAtCluster); | |
531 | ||
532 | // if good chi2 then consider to add cluster | |
533 | if (chi2WithOneCluster < maxChi2WithOneCluster) { | |
534 | foundOneCluster = kTRUE; | |
535 | ||
536 | // Printout for debuging | |
537 | if ((AliLog::GetDebugLevel("MUON","AliMUONTrackReconstructor") >= 1) || (AliLog::GetGlobalDebugLevel() >= 1)) { | |
538 | cout << "FollowTrackInStation: found one cluster in chamber(1..): " << nextChamber+1 | |
539 | << " (Chi2 = " << chi2WithOneCluster << ")" << endl; | |
540 | cluster->Print(); | |
541 | } | |
542 | ||
a0dc65b4 | 543 | if (GetRecoParam()->TrackAllTracks()) { |
9bf6860b | 544 | // copy trackCandidate into a new track put at the end of fRecTracksPtr and add the new cluster |
545 | newTrack = new ((*fRecTracksPtr)[fRecTracksPtr->GetLast()+1]) AliMUONTrack(trackCandidate); | |
546 | UpdateTrack(*newTrack,extrapTrackParamAtCluster); | |
547 | fNRecTracks++; | |
548 | ||
549 | // Printout for debuging | |
550 | if ((AliLog::GetDebugLevel("MUON","AliMUONTrackReconstructor") >= 1) || (AliLog::GetGlobalDebugLevel() >= 1)) { | |
551 | cout << "FollowTrackInStation: added one cluster in chamber(1..): " << nextChamber+1 << endl; | |
552 | if (AliLog::GetGlobalDebugLevel() >= 3) newTrack->RecursiveDump(); | |
553 | } | |
554 | ||
555 | } else if (chi2WithOneCluster < bestChi2WithOneCluster) { | |
556 | // keep track of the best single cluster except if a couple of clusters has already been found | |
557 | bestChi2WithOneCluster = chi2WithOneCluster; | |
558 | bestTrackParamAtCluster = extrapTrackParamAtCluster; | |
559 | } | |
560 | ||
561 | } | |
562 | ||
563 | } | |
564 | ||
565 | // fill out the best track if required else clean up the fRecTracksPtr array | |
a0dc65b4 | 566 | if (!GetRecoParam()->TrackAllTracks()) { |
9bf6860b | 567 | if (foundOneCluster) { |
568 | UpdateTrack(trackCandidate,bestTrackParamAtCluster); | |
569 | ||
570 | // Printout for debuging | |
571 | if ((AliLog::GetDebugLevel("MUON","AliMUONTrackReconstructor") >= 1) || (AliLog::GetGlobalDebugLevel() >= 1)) { | |
572 | cout << "FollowTrackInStation: added the best cluster in chamber(1..): " << bestTrackParamAtCluster.GetClusterPtr()->GetChamberId()+1 << endl; | |
573 | if (AliLog::GetGlobalDebugLevel() >= 3) newTrack->RecursiveDump(); | |
574 | } | |
575 | ||
576 | } else return kFALSE; | |
577 | ||
578 | } else if (foundOneCluster) { | |
579 | ||
580 | // remove obsolete track | |
581 | fRecTracksPtr->Remove(&trackCandidate); | |
582 | fNRecTracks--; | |
583 | ||
584 | } else return kFALSE; | |
585 | ||
586 | return kTRUE; | |
587 | ||
208f139e | 588 | } |
1a38e749 | 589 | |
208f139e | 590 | //__________________________________________________________________________ |
1fef78c8 | 591 | Bool_t AliMUONTrackReconstructor::FollowTrackInStation(AliMUONTrack &trackCandidate, AliMUONVClusterStore& clusterStore, Int_t nextStation) |
208f139e | 592 | { |
96ebe67e | 593 | /// Follow trackCandidate in station(0..) nextStation and search for compatible cluster(s) |
208f139e | 594 | /// Keep all possibilities or only the best one(s) according to the flag fgkTrackAllTracks: |
595 | /// kTRUE: duplicate "trackCandidate" if there are several possibilities and add the new tracks at the end of | |
596 | /// fRecTracksPtr to avoid conficts with other track candidates at this current stage of the tracking procedure. | |
597 | /// Remove the obsolete "trackCandidate" at the end. | |
96ebe67e | 598 | /// kFALSE: add only the best cluster(s) to the "trackCandidate". Try to add a couple of clusters in priority. |
208f139e | 599 | AliDebug(1,Form("Enter FollowTrackInStation(1..) %d", nextStation+1)); |
600 | ||
ea94c18b | 601 | // Order the chamber according to the propagation direction (tracking starts with chamber 2): |
602 | // - nextStation == station(1...) 5 => forward propagation | |
603 | // - nextStation < station(1...) 5 => backward propagation | |
604 | Int_t ch1, ch2; | |
605 | if (nextStation==4) { | |
606 | ch1 = 2*nextStation+1; | |
607 | ch2 = 2*nextStation; | |
608 | } else { | |
609 | ch1 = 2*nextStation; | |
610 | ch2 = 2*nextStation+1; | |
611 | } | |
612 | ||
4ea3f013 | 613 | Double_t chi2WithOneCluster = AliMUONTrack::MaxChi2(); |
614 | Double_t chi2WithTwoClusters = AliMUONTrack::MaxChi2(); | |
a0dc65b4 | 615 | Double_t maxChi2WithOneCluster = 2. * GetRecoParam()->GetSigmaCutForTracking() * |
616 | GetRecoParam()->GetSigmaCutForTracking(); // 2 because 2 quantities in chi2 | |
617 | Double_t maxChi2WithTwoClusters = 4. * GetRecoParam()->GetSigmaCutForTracking() * | |
618 | GetRecoParam()->GetSigmaCutForTracking(); // 4 because 4 quantities in chi2 | |
96ebe67e | 619 | Double_t bestChi2WithOneCluster = maxChi2WithOneCluster; |
620 | Double_t bestChi2WithTwoClusters = maxChi2WithTwoClusters; | |
621 | Bool_t foundOneCluster = kFALSE; | |
622 | Bool_t foundTwoClusters = kFALSE; | |
208f139e | 623 | AliMUONTrack *newTrack = 0x0; |
96ebe67e | 624 | AliMUONVCluster *clusterCh1, *clusterCh2; |
019df241 | 625 | AliMUONTrackParam extrapTrackParam; |
7332f213 | 626 | AliMUONTrackParam extrapTrackParamAtCh; |
96ebe67e | 627 | AliMUONTrackParam extrapTrackParamAtCluster1; |
628 | AliMUONTrackParam extrapTrackParamAtCluster2; | |
629 | AliMUONTrackParam bestTrackParamAtCluster1; | |
630 | AliMUONTrackParam bestTrackParamAtCluster2; | |
631 | ||
7332f213 | 632 | // Get track parameters according to the propagation direction |
633 | if (nextStation==4) extrapTrackParamAtCh = *(AliMUONTrackParam*)trackCandidate.GetTrackParamAtCluster()->Last(); | |
634 | else extrapTrackParamAtCh = *(AliMUONTrackParam*)trackCandidate.GetTrackParamAtCluster()->First(); | |
ea94c18b | 635 | |
9bf6860b | 636 | // Printout for debuging |
637 | if ((AliLog::GetDebugLevel("MUON","AliMUONTrackReconstructor") >= 2) || (AliLog::GetGlobalDebugLevel() >= 2)) { | |
638 | cout<<endl<<"Track parameters and covariances at first cluster:"<<endl; | |
639 | extrapTrackParamAtCh.GetParameters().Print(); | |
640 | extrapTrackParamAtCh.GetCovariances().Print(); | |
641 | } | |
642 | ||
ea94c18b | 643 | // Add MCS effect |
4663da9f | 644 | Int_t currentChamber = extrapTrackParamAtCh.GetClusterPtr()->GetChamberId(); |
645 | AliMUONTrackExtrap::AddMCSEffect(&extrapTrackParamAtCh,AliMUONConstants::ChamberThicknessInX0(currentChamber),-1.); | |
ea94c18b | 646 | |
9bf6860b | 647 | // Add MCS in the missing chamber(s) if any |
9bf6860b | 648 | while (ch1 < ch2 && currentChamber > ch2 + 1) { |
ea94c18b | 649 | // extrapolation to the missing chamber |
9bf6860b | 650 | currentChamber--; |
4ea3f013 | 651 | if (!AliMUONTrackExtrap::ExtrapToZCov(&extrapTrackParamAtCh, AliMUONConstants::DefaultChamberZ(currentChamber))) return kFALSE; |
ea94c18b | 652 | // add MCS effect |
4663da9f | 653 | AliMUONTrackExtrap::AddMCSEffect(&extrapTrackParamAtCh,AliMUONConstants::ChamberThicknessInX0(currentChamber),-1.); |
ea94c18b | 654 | } |
655 | ||
656 | //Extrapolate trackCandidate to chamber "ch2" | |
4ea3f013 | 657 | if (!AliMUONTrackExtrap::ExtrapToZCov(&extrapTrackParamAtCh, AliMUONConstants::DefaultChamberZ(ch2))) return kFALSE; |
ea94c18b | 658 | |
208f139e | 659 | // Printout for debuging |
660 | if ((AliLog::GetDebugLevel("MUON","AliMUONTrackReconstructor") >= 2) || (AliLog::GetGlobalDebugLevel() >= 2)) { | |
9bf6860b | 661 | cout<<endl<<"Track parameters and covariances at first cluster extrapolated to z = "<<AliMUONConstants::DefaultChamberZ(ch2)<<":"<<endl; |
662 | extrapTrackParamAtCh.GetParameters().Print(); | |
019df241 | 663 | extrapTrackParamAtCh.GetCovariances().Print(); |
208f139e | 664 | } |
ea94c18b | 665 | |
208f139e | 666 | // Printout for debuging |
667 | if ((AliLog::GetDebugLevel("MUON","AliMUONTrackReconstructor") >= 1) || (AliLog::GetGlobalDebugLevel() >= 1)) { | |
96ebe67e | 668 | cout << "FollowTrackInStation: look for clusters in chamber(1..): " << ch2+1 << endl; |
208f139e | 669 | } |
ea94c18b | 670 | |
1fef78c8 | 671 | // Ask the clustering to reconstruct new clusters around the track position in the current station |
672 | // except for station 4 and 5 that are already entirely clusterized | |
a0dc65b4 | 673 | if (GetRecoParam()->CombineClusterTrackReco()) { |
1fef78c8 | 674 | if (nextStation < 3) AskForNewClustersInStation(extrapTrackParamAtCh, clusterStore, nextStation); |
675 | } | |
676 | ||
4ea3f013 | 677 | Int_t nClusters = clusterStore.GetSize(); |
678 | Bool_t *clusterCh1Used = new Bool_t[nClusters]; | |
679 | for (Int_t i = 0; i < nClusters; i++) clusterCh1Used[i] = kFALSE; | |
680 | Int_t iCluster1; | |
681 | ||
96ebe67e | 682 | // Create iterators to loop over clusters in both chambers |
683 | TIter nextInCh1(clusterStore.CreateChamberIterator(ch1,ch1)); | |
684 | TIter nextInCh2(clusterStore.CreateChamberIterator(ch2,ch2)); | |
685 | ||
686 | // look for candidates in chamber 2 | |
687 | while ( ( clusterCh2 = static_cast<AliMUONVCluster*>(nextInCh2()) ) ) { | |
ea94c18b | 688 | |
96ebe67e | 689 | // try to add the current cluster fast |
690 | if (!TryOneClusterFast(extrapTrackParamAtCh, clusterCh2)) continue; | |
019df241 | 691 | |
96ebe67e | 692 | // try to add the current cluster accuratly |
693 | chi2WithOneCluster = TryOneCluster(extrapTrackParamAtCh, clusterCh2, extrapTrackParamAtCluster2); | |
ea94c18b | 694 | |
96ebe67e | 695 | // if good chi2 then try to attach a cluster in the other chamber too |
696 | if (chi2WithOneCluster < maxChi2WithOneCluster) { | |
697 | Bool_t foundSecondCluster = kFALSE; | |
ea94c18b | 698 | |
208f139e | 699 | // Printout for debuging |
700 | if ((AliLog::GetDebugLevel("MUON","AliMUONTrackReconstructor") >= 1) || (AliLog::GetGlobalDebugLevel() >= 1)) { | |
96ebe67e | 701 | cout << "FollowTrackInStation: found one cluster in chamber(1..): " << ch2+1 |
702 | << " (Chi2 = " << chi2WithOneCluster << ")" << endl; | |
9bf6860b | 703 | clusterCh2->Print(); |
96ebe67e | 704 | cout << " look for second clusters in chamber(1..): " << ch1+1 << " ..." << endl; |
a9e2aefa | 705 | } |
ea94c18b | 706 | |
707 | // add MCS effect for next step | |
4663da9f | 708 | AliMUONTrackExtrap::AddMCSEffect(&extrapTrackParamAtCluster2,AliMUONConstants::ChamberThicknessInX0(ch2),-1.); |
ea94c18b | 709 | |
019df241 | 710 | // copy new track parameters for next step |
96ebe67e | 711 | extrapTrackParam = extrapTrackParamAtCluster2; |
019df241 | 712 | |
713 | //Extrapolate track parameters to chamber "ch1" | |
4ea3f013 | 714 | Bool_t normalExtrap = AliMUONTrackExtrap::ExtrapToZ(&extrapTrackParam, AliMUONConstants::DefaultChamberZ(ch1)); |
019df241 | 715 | |
96ebe67e | 716 | // reset cluster iterator of chamber 1 |
717 | nextInCh1.Reset(); | |
718 | iCluster1 = -1; | |
719 | ||
720 | // look for second candidates in chamber 1 | |
4ea3f013 | 721 | if (normalExtrap) while ( ( clusterCh1 = static_cast<AliMUONVCluster*>(nextInCh1()) ) ) { |
96ebe67e | 722 | iCluster1++; |
ea94c18b | 723 | |
96ebe67e | 724 | // try to add the current cluster fast |
725 | if (!TryOneClusterFast(extrapTrackParam, clusterCh1)) continue; | |
019df241 | 726 | |
4ea3f013 | 727 | // try to add the current cluster accurately |
96ebe67e | 728 | chi2WithTwoClusters = TryTwoClusters(extrapTrackParamAtCluster2, clusterCh1, extrapTrackParamAtCluster1); |
ea94c18b | 729 | |
96ebe67e | 730 | // if good chi2 then create a new track by adding the 2 clusters to the "trackCandidate" |
731 | if (chi2WithTwoClusters < maxChi2WithTwoClusters) { | |
732 | foundSecondCluster = kTRUE; | |
733 | foundTwoClusters = kTRUE; | |
ea94c18b | 734 | |
735 | // Printout for debuging | |
736 | if ((AliLog::GetDebugLevel("MUON","AliMUONTrackReconstructor") >= 1) || (AliLog::GetGlobalDebugLevel() >= 1)) { | |
96ebe67e | 737 | cout << "FollowTrackInStation: found second cluster in chamber(1..): " << ch1+1 |
9bf6860b | 738 | << " (Global Chi2 = " << chi2WithTwoClusters << ")" << endl; |
739 | clusterCh1->Print(); | |
ea94c18b | 740 | } |
741 | ||
a0dc65b4 | 742 | if (GetRecoParam()->TrackAllTracks()) { |
96ebe67e | 743 | // copy trackCandidate into a new track put at the end of fRecTracksPtr and add the new clusters |
ea94c18b | 744 | newTrack = new ((*fRecTracksPtr)[fRecTracksPtr->GetLast()+1]) AliMUONTrack(trackCandidate); |
96ebe67e | 745 | UpdateTrack(*newTrack,extrapTrackParamAtCluster1,extrapTrackParamAtCluster2); |
208f139e | 746 | fNRecTracks++; |
ea94c18b | 747 | |
96ebe67e | 748 | // Tag clusterCh1 as used |
749 | clusterCh1Used[iCluster1] = kTRUE; | |
ea94c18b | 750 | |
208f139e | 751 | // Printout for debuging |
752 | if ((AliLog::GetDebugLevel("MUON","AliMUONTrackReconstructor") >= 1) || (AliLog::GetGlobalDebugLevel() >= 1)) { | |
96ebe67e | 753 | cout << "FollowTrackInStation: added two clusters in station(1..): " << nextStation+1 << endl; |
208f139e | 754 | if (AliLog::GetGlobalDebugLevel() >= 3) newTrack->RecursiveDump(); |
a9e2aefa | 755 | } |
ea94c18b | 756 | |
96ebe67e | 757 | } else if (chi2WithTwoClusters < bestChi2WithTwoClusters) { |
758 | // keep track of the best couple of clusters | |
759 | bestChi2WithTwoClusters = chi2WithTwoClusters; | |
760 | bestTrackParamAtCluster1 = extrapTrackParamAtCluster1; | |
761 | bestTrackParamAtCluster2 = extrapTrackParamAtCluster2; | |
208f139e | 762 | } |
ea94c18b | 763 | |
a9e2aefa | 764 | } |
ea94c18b | 765 | |
d0bfce8d | 766 | } |
ea94c18b | 767 | |
96ebe67e | 768 | // if no clusterCh1 found then consider to add clusterCh2 only |
769 | if (!foundSecondCluster) { | |
770 | foundOneCluster = kTRUE; | |
ea94c18b | 771 | |
a0dc65b4 | 772 | if (GetRecoParam()->TrackAllTracks()) { |
96ebe67e | 773 | // copy trackCandidate into a new track put at the end of fRecTracksPtr and add the new cluster |
ea94c18b | 774 | newTrack = new ((*fRecTracksPtr)[fRecTracksPtr->GetLast()+1]) AliMUONTrack(trackCandidate); |
96ebe67e | 775 | UpdateTrack(*newTrack,extrapTrackParamAtCluster2); |
208f139e | 776 | fNRecTracks++; |
ea94c18b | 777 | |
208f139e | 778 | // Printout for debuging |
779 | if ((AliLog::GetDebugLevel("MUON","AliMUONTrackReconstructor") >= 1) || (AliLog::GetGlobalDebugLevel() >= 1)) { | |
96ebe67e | 780 | cout << "FollowTrackInStation: added one cluster in chamber(1..): " << ch2+1 << endl; |
208f139e | 781 | if (AliLog::GetGlobalDebugLevel() >= 3) newTrack->RecursiveDump(); |
782 | } | |
ea94c18b | 783 | |
96ebe67e | 784 | } else if (!foundTwoClusters && chi2WithOneCluster < bestChi2WithOneCluster) { |
785 | // keep track of the best single cluster except if a couple of clusters has already been found | |
786 | bestChi2WithOneCluster = chi2WithOneCluster; | |
787 | bestTrackParamAtCluster1 = extrapTrackParamAtCluster2; | |
208f139e | 788 | } |
ea94c18b | 789 | |
d0bfce8d | 790 | } |
ea94c18b | 791 | |
208f139e | 792 | } |
ea94c18b | 793 | |
208f139e | 794 | } |
ea94c18b | 795 | |
208f139e | 796 | // look for candidates in chamber 1 not already attached to a track |
96ebe67e | 797 | // if we want to keep all possible tracks or if no good couple of clusters has been found |
a0dc65b4 | 798 | if (GetRecoParam()->TrackAllTracks() || !foundTwoClusters) { |
ea94c18b | 799 | |
ea94c18b | 800 | // add MCS effect for next step |
4663da9f | 801 | AliMUONTrackExtrap::AddMCSEffect(&extrapTrackParamAtCh,AliMUONConstants::ChamberThicknessInX0(ch2),-1.); |
019df241 | 802 | |
803 | //Extrapolate trackCandidate to chamber "ch1" | |
4ea3f013 | 804 | Bool_t normalExtrap = AliMUONTrackExtrap::ExtrapToZCov(&extrapTrackParamAtCh, AliMUONConstants::DefaultChamberZ(ch1)); |
019df241 | 805 | |
9bf6860b | 806 | // Printout for debuging |
807 | if ((AliLog::GetDebugLevel("MUON","AliMUONTrackReconstructor") >= 2) || (AliLog::GetGlobalDebugLevel() >= 2)) { | |
808 | cout<<endl<<"Track parameters and covariances at first cluster extrapolated to z = "<<AliMUONConstants::DefaultChamberZ(ch1)<<":"<<endl; | |
809 | extrapTrackParamAtCh.GetParameters().Print(); | |
810 | extrapTrackParamAtCh.GetCovariances().Print(); | |
811 | } | |
812 | ||
813 | // Printout for debuging | |
814 | if ((AliLog::GetDebugLevel("MUON","AliMUONTrackReconstructor") >= 1) || (AliLog::GetGlobalDebugLevel() >= 1)) { | |
815 | cout << "FollowTrackInStation: look for single clusters in chamber(1..): " << ch1+1 << endl; | |
816 | } | |
817 | ||
96ebe67e | 818 | // reset cluster iterator of chamber 1 |
819 | nextInCh1.Reset(); | |
820 | iCluster1 = -1; | |
821 | ||
822 | // look for second candidates in chamber 1 | |
4ea3f013 | 823 | if (normalExtrap) while ( ( clusterCh1 = static_cast<AliMUONVCluster*>(nextInCh1()) ) ) { |
96ebe67e | 824 | iCluster1++; |
ea94c18b | 825 | |
96ebe67e | 826 | if (clusterCh1Used[iCluster1]) continue; // Skip cluster already used |
ea94c18b | 827 | |
96ebe67e | 828 | // try to add the current cluster fast |
829 | if (!TryOneClusterFast(extrapTrackParamAtCh, clusterCh1)) continue; | |
019df241 | 830 | |
96ebe67e | 831 | // try to add the current cluster accuratly |
832 | chi2WithOneCluster = TryOneCluster(extrapTrackParamAtCh, clusterCh1, extrapTrackParamAtCluster1); | |
9bf6860b | 833 | |
96ebe67e | 834 | // if good chi2 then consider to add clusterCh1 |
835 | // We do not try to attach a cluster in the other chamber too since it has already been done above | |
836 | if (chi2WithOneCluster < maxChi2WithOneCluster) { | |
837 | foundOneCluster = kTRUE; | |
9bf6860b | 838 | |
ea94c18b | 839 | // Printout for debuging |
840 | if ((AliLog::GetDebugLevel("MUON","AliMUONTrackReconstructor") >= 1) || (AliLog::GetGlobalDebugLevel() >= 1)) { | |
96ebe67e | 841 | cout << "FollowTrackInStation: found one cluster in chamber(1..): " << ch1+1 |
842 | << " (Chi2 = " << chi2WithOneCluster << ")" << endl; | |
9bf6860b | 843 | clusterCh1->Print(); |
ea94c18b | 844 | } |
845 | ||
a0dc65b4 | 846 | if (GetRecoParam()->TrackAllTracks()) { |
96ebe67e | 847 | // copy trackCandidate into a new track put at the end of fRecTracksPtr and add the new cluster |
ea94c18b | 848 | newTrack = new ((*fRecTracksPtr)[fRecTracksPtr->GetLast()+1]) AliMUONTrack(trackCandidate); |
96ebe67e | 849 | UpdateTrack(*newTrack,extrapTrackParamAtCluster1); |
208f139e | 850 | fNRecTracks++; |
ea94c18b | 851 | |
852 | // Printout for debuging | |
208f139e | 853 | if ((AliLog::GetDebugLevel("MUON","AliMUONTrackReconstructor") >= 1) || (AliLog::GetGlobalDebugLevel() >= 1)) { |
96ebe67e | 854 | cout << "FollowTrackInStation: added one cluster in chamber(1..): " << ch1+1 << endl; |
208f139e | 855 | if (AliLog::GetGlobalDebugLevel() >= 3) newTrack->RecursiveDump(); |
856 | } | |
ea94c18b | 857 | |
96ebe67e | 858 | } else if (chi2WithOneCluster < bestChi2WithOneCluster) { |
859 | // keep track of the best single cluster except if a couple of clusters has already been found | |
860 | bestChi2WithOneCluster = chi2WithOneCluster; | |
861 | bestTrackParamAtCluster1 = extrapTrackParamAtCluster1; | |
208f139e | 862 | } |
ea94c18b | 863 | |
d0bfce8d | 864 | } |
ea94c18b | 865 | |
208f139e | 866 | } |
ea94c18b | 867 | |
208f139e | 868 | } |
ea94c18b | 869 | |
208f139e | 870 | // fill out the best track if required else clean up the fRecTracksPtr array |
a0dc65b4 | 871 | if (!GetRecoParam()->TrackAllTracks()) { |
96ebe67e | 872 | if (foundTwoClusters) { |
873 | UpdateTrack(trackCandidate,bestTrackParamAtCluster1,bestTrackParamAtCluster2); | |
ea94c18b | 874 | |
208f139e | 875 | // Printout for debuging |
876 | if ((AliLog::GetDebugLevel("MUON","AliMUONTrackReconstructor") >= 1) || (AliLog::GetGlobalDebugLevel() >= 1)) { | |
96ebe67e | 877 | cout << "FollowTrackInStation: added the two best clusters in station(1..): " << nextStation+1 << endl; |
208f139e | 878 | if (AliLog::GetGlobalDebugLevel() >= 3) newTrack->RecursiveDump(); |
a9e2aefa | 879 | } |
ea94c18b | 880 | |
96ebe67e | 881 | } else if (foundOneCluster) { |
882 | UpdateTrack(trackCandidate,bestTrackParamAtCluster1); | |
ea94c18b | 883 | |
208f139e | 884 | // Printout for debuging |
885 | if ((AliLog::GetDebugLevel("MUON","AliMUONTrackReconstructor") >= 1) || (AliLog::GetGlobalDebugLevel() >= 1)) { | |
96ebe67e | 886 | cout << "FollowTrackInStation: added the best cluster in chamber(1..): " << bestTrackParamAtCluster1.GetClusterPtr()->GetChamberId()+1 << endl; |
208f139e | 887 | if (AliLog::GetGlobalDebugLevel() >= 3) newTrack->RecursiveDump(); |
04b5ea16 | 888 | } |
ea94c18b | 889 | |
dd230855 | 890 | } else { |
96ebe67e | 891 | delete [] clusterCh1Used; |
dd230855 | 892 | return kFALSE; |
893 | } | |
ea94c18b | 894 | |
96ebe67e | 895 | } else if (foundOneCluster || foundTwoClusters) { |
ea94c18b | 896 | |
897 | // remove obsolete track | |
898 | fRecTracksPtr->Remove(&trackCandidate); | |
899 | fNRecTracks--; | |
900 | ||
dd230855 | 901 | } else { |
96ebe67e | 902 | delete [] clusterCh1Used; |
dd230855 | 903 | return kFALSE; |
904 | } | |
ea94c18b | 905 | |
96ebe67e | 906 | delete [] clusterCh1Used; |
ea94c18b | 907 | return kTRUE; |
908 | ||
909 | } | |
910 | ||
911 | //__________________________________________________________________________ | |
96ebe67e | 912 | Double_t AliMUONTrackReconstructor::TryTwoClusters(const AliMUONTrackParam &trackParamAtCluster1, AliMUONVCluster* cluster2, |
913 | AliMUONTrackParam &trackParamAtCluster2) | |
ea94c18b | 914 | { |
96ebe67e | 915 | /// Test the compatibility between the track and the 2 clusters together (using trackParam's covariance matrix): |
916 | /// return the corresponding Chi2 accounting for covariances between the 2 clusters | |
917 | /// return trackParamAtCluster1 & 2 | |
ea94c18b | 918 | |
96ebe67e | 919 | // extrapolate track parameters at the z position of the second cluster (no need to extrapolate the covariances) |
4ea3f013 | 920 | // and set pointer to cluster into trackParamAtCluster |
96ebe67e | 921 | trackParamAtCluster2.SetParameters(trackParamAtCluster1.GetParameters()); |
922 | trackParamAtCluster2.SetZ(trackParamAtCluster1.GetZ()); | |
96ebe67e | 923 | trackParamAtCluster2.SetClusterPtr(cluster2); |
4ea3f013 | 924 | if (!AliMUONTrackExtrap::ExtrapToZ(&trackParamAtCluster2, cluster2->GetZ())) return 2.*AliMUONTrack::MaxChi2(); |
ea94c18b | 925 | |
96ebe67e | 926 | // Set differences between track and the 2 clusters in the bending and non bending directions |
927 | AliMUONVCluster* cluster1 = trackParamAtCluster1.GetClusterPtr(); | |
ea94c18b | 928 | TMatrixD dPos(4,1); |
96ebe67e | 929 | dPos(0,0) = cluster1->GetX() - trackParamAtCluster1.GetNonBendingCoor(); |
930 | dPos(1,0) = cluster1->GetY() - trackParamAtCluster1.GetBendingCoor(); | |
931 | dPos(2,0) = cluster2->GetX() - trackParamAtCluster2.GetNonBendingCoor(); | |
932 | dPos(3,0) = cluster2->GetY() - trackParamAtCluster2.GetBendingCoor(); | |
ea94c18b | 933 | |
96ebe67e | 934 | // Calculate the error matrix from the track parameter covariances at first cluster |
ea94c18b | 935 | TMatrixD error(4,4); |
936 | error.Zero(); | |
96ebe67e | 937 | if (trackParamAtCluster1.CovariancesExist()) { |
938 | // Save track parameters at first cluster | |
939 | TMatrixD paramAtCluster1Save(trackParamAtCluster1.GetParameters()); | |
940 | ||
941 | // Save track coordinates at second cluster | |
942 | Double_t nonBendingCoor2 = trackParamAtCluster2.GetNonBendingCoor(); | |
943 | Double_t bendingCoor2 = trackParamAtCluster2.GetBendingCoor(); | |
ea94c18b | 944 | |
96ebe67e | 945 | // copy track parameters at first cluster for jacobian calculation |
946 | AliMUONTrackParam trackParam(trackParamAtCluster1); | |
ea94c18b | 947 | |
96ebe67e | 948 | // Get the pointer to the parameter covariance matrix at first cluster |
949 | const TMatrixD& kParamCov = trackParam.GetCovariances(); | |
ea94c18b | 950 | |
951 | // Calculate the jacobian related to the transformation between track parameters | |
96ebe67e | 952 | // at first cluster and track coordinates at the 2 cluster z-positions |
ea94c18b | 953 | TMatrixD jacob(4,5); |
954 | jacob.Zero(); | |
96ebe67e | 955 | // first derivative at the first cluster: |
ea94c18b | 956 | jacob(0,0) = 1.; // dx1/dx |
957 | jacob(1,2) = 1.; // dy1/dy | |
96ebe67e | 958 | // first derivative at the second cluster: |
ea94c18b | 959 | TMatrixD dParam(5,1); |
6b191dea | 960 | Double_t direction[5] = {-1.,-1.,1.,1.,-1.}; |
ea94c18b | 961 | for (Int_t i=0; i<5; i++) { |
962 | // Skip jacobian calculation for parameters with no associated error | |
963 | if (kParamCov(i,i) == 0.) continue; | |
964 | // Small variation of parameter i only | |
965 | for (Int_t j=0; j<5; j++) { | |
966 | if (j==i) { | |
967 | dParam(j,0) = TMath::Sqrt(kParamCov(i,i)); | |
6b191dea | 968 | dParam(j,0) *= TMath::Sign(1.,direction[j]*paramAtCluster1Save(j,0)); // variation always in the same direction |
ea94c18b | 969 | } else dParam(j,0) = 0.; |
970 | } | |
971 | ||
96ebe67e | 972 | // Set new track parameters at first cluster |
973 | trackParam.SetParameters(paramAtCluster1Save); | |
974 | trackParam.AddParameters(dParam); | |
975 | trackParam.SetZ(cluster1->GetZ()); | |
ea94c18b | 976 | |
96ebe67e | 977 | // Extrapolate new track parameters to the z position of the second cluster |
4ea3f013 | 978 | if (!AliMUONTrackExtrap::ExtrapToZ(&trackParam,cluster2->GetZ())) return 2.*AliMUONTrack::MaxChi2(); |
ea94c18b | 979 | |
980 | // Calculate the jacobian | |
96ebe67e | 981 | jacob(2,i) = (trackParam.GetNonBendingCoor() - nonBendingCoor2) / dParam(i,0); // dx2/dParami |
982 | jacob(3,i) = (trackParam.GetBendingCoor() - bendingCoor2 ) / dParam(i,0); // dy2/dParami | |
208f139e | 983 | } |
ea94c18b | 984 | |
985 | // Calculate the error matrix | |
986 | TMatrixD tmp(jacob,TMatrixD::kMult,kParamCov); | |
987 | error = TMatrixD(tmp,TMatrixD::kMultTranspose,jacob); | |
988 | } | |
989 | ||
96ebe67e | 990 | // Add cluster resolution to the error matrix |
991 | error(0,0) += cluster1->GetErrX2(); | |
992 | error(1,1) += cluster1->GetErrY2(); | |
993 | error(2,2) += cluster2->GetErrX2(); | |
994 | error(3,3) += cluster2->GetErrY2(); | |
ea94c18b | 995 | |
996 | // invert the error matrix for Chi2 calculation | |
997 | if (error.Determinant() != 0) { | |
998 | error.Invert(); | |
208f139e | 999 | } else { |
ea94c18b | 1000 | AliWarning(" Determinant error=0"); |
4ea3f013 | 1001 | return 2.*AliMUONTrack::MaxChi2(); |
208f139e | 1002 | } |
1003 | ||
ea94c18b | 1004 | // Compute the Chi2 value |
1005 | TMatrixD tmp2(dPos,TMatrixD::kTransposeMult,error); | |
1006 | TMatrixD result(tmp2,TMatrixD::kMult,dPos); | |
1007 | ||
1008 | return result(0,0); | |
1009 | ||
1010 | } | |
1011 | ||
1012 | //__________________________________________________________________________ | |
96ebe67e | 1013 | void AliMUONTrackReconstructor::UpdateTrack(AliMUONTrack &track, AliMUONTrackParam &trackParamAtCluster) |
ea94c18b | 1014 | { |
96ebe67e | 1015 | /// Add 1 cluster to the track candidate |
ea94c18b | 1016 | /// Update chi2 of the track |
1017 | ||
1018 | // Compute local chi2 | |
96ebe67e | 1019 | AliMUONVCluster* cluster = trackParamAtCluster.GetClusterPtr(); |
1020 | Double_t deltaX = trackParamAtCluster.GetNonBendingCoor() - cluster->GetX(); | |
1021 | Double_t deltaY = trackParamAtCluster.GetBendingCoor() - cluster->GetY(); | |
1022 | Double_t localChi2 = deltaX*deltaX / cluster->GetErrX2() + | |
1023 | deltaY*deltaY / cluster->GetErrY2(); | |
ea94c18b | 1024 | |
96ebe67e | 1025 | // Flag cluster as being not removable |
a0dc65b4 | 1026 | if (GetRecoParam()->RequestStation(cluster->GetChamberId()/2)) |
9bf6860b | 1027 | trackParamAtCluster.SetRemovable(kFALSE); |
1028 | else trackParamAtCluster.SetRemovable(kTRUE); | |
96ebe67e | 1029 | trackParamAtCluster.SetLocalChi2(0.); // --> Local chi2 not used |
5f4ceff2 | 1030 | |
ea94c18b | 1031 | // Update the chi2 of the new track |
96ebe67e | 1032 | track.SetGlobalChi2(track.GetGlobalChi2() + localChi2); |
ea94c18b | 1033 | |
96ebe67e | 1034 | // Update TrackParamAtCluster |
1035 | track.AddTrackParamAtCluster(trackParamAtCluster,*cluster); | |
ea94c18b | 1036 | |
04b5ea16 | 1037 | } |
1038 | ||
de2cd600 | 1039 | //__________________________________________________________________________ |
96ebe67e | 1040 | void AliMUONTrackReconstructor::UpdateTrack(AliMUONTrack &track, AliMUONTrackParam &trackParamAtCluster1, AliMUONTrackParam &trackParamAtCluster2) |
ea94c18b | 1041 | { |
96ebe67e | 1042 | /// Add 2 clusters to the track candidate |
ea94c18b | 1043 | /// Update track and local chi2 |
1044 | ||
96ebe67e | 1045 | // Update local chi2 at first cluster |
1046 | AliMUONVCluster* cluster1 = trackParamAtCluster1.GetClusterPtr(); | |
1047 | Double_t deltaX = trackParamAtCluster1.GetNonBendingCoor() - cluster1->GetX(); | |
1048 | Double_t deltaY = trackParamAtCluster1.GetBendingCoor() - cluster1->GetY(); | |
1049 | Double_t localChi2AtCluster1 = deltaX*deltaX / cluster1->GetErrX2() + | |
1050 | deltaY*deltaY / cluster1->GetErrY2(); | |
1051 | trackParamAtCluster1.SetLocalChi2(localChi2AtCluster1); | |
ea94c18b | 1052 | |
96ebe67e | 1053 | // Flag first cluster as being removable |
1054 | trackParamAtCluster1.SetRemovable(kTRUE); | |
ea94c18b | 1055 | |
96ebe67e | 1056 | // Update local chi2 at second cluster |
1057 | AliMUONVCluster* cluster2 = trackParamAtCluster2.GetClusterPtr(); | |
1058 | deltaX = trackParamAtCluster2.GetNonBendingCoor() - cluster2->GetX(); | |
1059 | deltaY = trackParamAtCluster2.GetBendingCoor() - cluster2->GetY(); | |
1060 | Double_t localChi2AtCluster2 = deltaX*deltaX / cluster2->GetErrX2() + | |
1061 | deltaY*deltaY / cluster2->GetErrY2(); | |
1062 | trackParamAtCluster2.SetLocalChi2(localChi2AtCluster2); | |
ea94c18b | 1063 | |
96ebe67e | 1064 | // Flag first cluster as being removable |
1065 | trackParamAtCluster2.SetRemovable(kTRUE); | |
ea94c18b | 1066 | |
1067 | // Update the chi2 of the new track | |
96ebe67e | 1068 | track.SetGlobalChi2(track.GetGlobalChi2() + localChi2AtCluster1 + localChi2AtCluster2); |
ea94c18b | 1069 | |
96ebe67e | 1070 | // Update TrackParamAtCluster |
1071 | track.AddTrackParamAtCluster(trackParamAtCluster1,*cluster1); | |
1072 | track.AddTrackParamAtCluster(trackParamAtCluster2,*cluster2); | |
ea94c18b | 1073 | |
1074 | } | |
1075 | ||
1076 | //__________________________________________________________________________ | |
1fef78c8 | 1077 | Bool_t AliMUONTrackReconstructor::RecoverTrack(AliMUONTrack &trackCandidate, AliMUONVClusterStore& clusterStore, Int_t nextStation) |
ea94c18b | 1078 | { |
1079 | /// Try to recover the track candidate in the next station | |
96ebe67e | 1080 | /// by removing the worst of the two clusters attached in the current station |
ea94c18b | 1081 | /// Return kTRUE if recovering succeeds |
1082 | AliDebug(1,"Enter RecoverTrack"); | |
1083 | ||
96ebe67e | 1084 | // Do not try to recover track until we have attached cluster(s) on station(1..) 3 |
ea94c18b | 1085 | if (nextStation > 1) return kFALSE; |
1086 | ||
96ebe67e | 1087 | Int_t worstClusterNumber = -1; |
9bf6860b | 1088 | Double_t localChi2, worstLocalChi2 = -1.; |
ea94c18b | 1089 | |
96ebe67e | 1090 | // Look for the cluster to remove |
1091 | for (Int_t clusterNumber = 0; clusterNumber < 2; clusterNumber++) { | |
1092 | AliMUONTrackParam *trackParamAtCluster = (AliMUONTrackParam*)trackCandidate.GetTrackParamAtCluster()->UncheckedAt(clusterNumber); | |
ea94c18b | 1093 | |
9bf6860b | 1094 | // check if current cluster is in the previous station |
1095 | if (trackParamAtCluster->GetClusterPtr()->GetChamberId()/2 != nextStation+1) break; | |
1096 | ||
96ebe67e | 1097 | // check if current cluster is removable |
1098 | if (!trackParamAtCluster->IsRemovable()) return kFALSE; | |
ea94c18b | 1099 | |
9bf6860b | 1100 | // reset the current cluster as beig not removable if it is on a required station |
a0dc65b4 | 1101 | if (GetRecoParam()->RequestStation(nextStation+1)) trackParamAtCluster->SetRemovable(kFALSE); |
9bf6860b | 1102 | |
96ebe67e | 1103 | // Pick up cluster with the worst chi2 |
1104 | localChi2 = trackParamAtCluster->GetLocalChi2(); | |
ea94c18b | 1105 | if (localChi2 > worstLocalChi2) { |
1106 | worstLocalChi2 = localChi2; | |
96ebe67e | 1107 | worstClusterNumber = clusterNumber; |
ea94c18b | 1108 | } |
9bf6860b | 1109 | |
ea94c18b | 1110 | } |
1111 | ||
9bf6860b | 1112 | // check if worst cluster found |
1113 | if (worstClusterNumber < 0) return kFALSE; | |
ea94c18b | 1114 | |
96ebe67e | 1115 | // Remove the worst cluster |
1116 | trackCandidate.RemoveTrackParamAtCluster((AliMUONTrackParam*)trackCandidate.GetTrackParamAtCluster()->UncheckedAt(worstClusterNumber)); | |
ea94c18b | 1117 | |
1118 | // Re-fit the track: | |
1119 | // Do not take into account the multiple scattering to speed up the fit | |
1120 | // Calculate the track parameter covariance matrix | |
96ebe67e | 1121 | Fit(trackCandidate, kFALSE, kFALSE, kTRUE); |
ea94c18b | 1122 | |
4ea3f013 | 1123 | // skip track if the normalized chi2 is too high |
1124 | if (trackCandidate.GetNormalizedChi2() > GetRecoParam()->GetSigmaCutForTracking() * GetRecoParam()->GetSigmaCutForTracking()) return kFALSE; | |
1125 | ||
6b191dea | 1126 | // skip track out of limits |
1127 | if (!IsAcceptable(*((AliMUONTrackParam*)trackCandidate.GetTrackParamAtCluster()->First()))) return kFALSE; | |
89c8d66d | 1128 | |
96ebe67e | 1129 | // Look for new cluster(s) in next station |
1130 | return FollowTrackInStation(trackCandidate,clusterStore,nextStation); | |
ea94c18b | 1131 | |
1132 | } | |
1133 | ||
1134 | //__________________________________________________________________________ | |
96ebe67e | 1135 | void AliMUONTrackReconstructor::SetVertexErrXY2ForFit(AliMUONTrack &trackCandidate) |
de2cd600 | 1136 | { |
96ebe67e | 1137 | /// Compute the vertex resolution square from natural vertex dispersion and |
208f139e | 1138 | /// multiple scattering effets according to trackCandidate path in absorber |
1139 | /// It is necessary to account for multiple scattering effects here instead of during the fit of | |
1140 | /// the "trackCandidate" to do not influence the result by changing track resolution at vertex | |
1141 | AliDebug(1,"Enter SetVertexForFit"); | |
de2cd600 | 1142 | |
a0dc65b4 | 1143 | Double_t nonBendingReso2 = GetRecoParam()->GetNonBendingVertexDispersion() * |
1144 | GetRecoParam()->GetNonBendingVertexDispersion(); | |
1145 | Double_t bendingReso2 = GetRecoParam()->GetBendingVertexDispersion() * | |
1146 | GetRecoParam()->GetBendingVertexDispersion(); | |
96ebe67e | 1147 | |
208f139e | 1148 | // add multiple scattering effets |
96ebe67e | 1149 | AliMUONTrackParam paramAtVertex(*((AliMUONTrackParam*)(trackCandidate.GetTrackParamAtCluster()->First()))); |
208f139e | 1150 | paramAtVertex.DeleteCovariances(); // to be sure to account only for multiple scattering |
4ea3f013 | 1151 | if (!AliMUONTrackExtrap::ExtrapToZ(¶mAtVertex,AliMUONConstants::AbsZEnd())) { |
1152 | nonBendingReso2 = 0.; | |
1153 | bendingReso2 = 0.; | |
1154 | } else { | |
1155 | AliMUONTrackExtrap::ExtrapToVertexUncorrected(¶mAtVertex,0.); | |
1156 | const TMatrixD& kParamCov = paramAtVertex.GetCovariances(); | |
1157 | nonBendingReso2 += kParamCov(0,0); | |
1158 | bendingReso2 += kParamCov(2,2); | |
1159 | } | |
96ebe67e | 1160 | |
1161 | // Set the vertex resolution square | |
1162 | trackCandidate.SetVertexErrXY2(nonBendingReso2,bendingReso2); | |
208f139e | 1163 | } |
1164 | ||
1165 | //__________________________________________________________________________ | |
96ebe67e | 1166 | void AliMUONTrackReconstructor::Fit(AliMUONTrack &track, Bool_t includeMCS, Bool_t fitWithVertex, Bool_t calcCov) |
208f139e | 1167 | { |
96ebe67e | 1168 | /// Fit the track |
1169 | /// w/wo multiple Coulomb scattering according to "includeMCS". | |
1170 | /// w/wo constraining the vertex according to "fitWithVertex". | |
1171 | /// calculating or not the covariance matrix according to "calcCov". | |
7332f213 | 1172 | AliDebug(1,"Enter Fit"); |
de2cd600 | 1173 | |
208f139e | 1174 | Double_t benC, errorParam, invBenP, nonBenC, x, y; |
de2cd600 | 1175 | AliMUONTrackParam *trackParam; |
96ebe67e | 1176 | Double_t arg[1], fedm, errdef, globalChi2; |
208f139e | 1177 | Int_t npari, nparx; |
1178 | Int_t status, covStatus; | |
1179 | ||
8cde4af5 | 1180 | // Instantiate gMinuit if not already done |
1181 | if (!gMinuit) gMinuit = new TMinuit(6); | |
208f139e | 1182 | // Clear MINUIT parameters |
1183 | gMinuit->mncler(); | |
1184 | // Give the fitted track to MINUIT | |
ea94c18b | 1185 | gMinuit->SetObjectFit(&track); |
208f139e | 1186 | if ((AliLog::GetDebugLevel("MUON","AliMUONTrackReconstructor") >= 2) || (AliLog::GetGlobalDebugLevel() >= 2)) { |
1187 | // Define print level | |
1188 | arg[0] = 1; | |
1189 | gMinuit->mnexcm("SET PRI", arg, 1, status); | |
1190 | // Print covariance matrix | |
1191 | gMinuit->mnexcm("SHO COV", arg, 0, status); | |
1192 | } else { | |
1193 | arg[0] = -1; | |
1194 | gMinuit->mnexcm("SET PRI", arg, 1, status); | |
1195 | } | |
de2cd600 | 1196 | // No warnings |
208f139e | 1197 | gMinuit->mnexcm("SET NOW", arg, 0, status); |
1198 | // Define strategy | |
1199 | //arg[0] = 2; | |
1200 | //gMinuit->mnexcm("SET STR", arg, 1, status); | |
1201 | ||
ea94c18b | 1202 | // set flag w/wo multiple scattering according to "includeMCS" |
96ebe67e | 1203 | track.FitWithMCS(includeMCS); |
ea94c18b | 1204 | if (includeMCS) { |
96ebe67e | 1205 | // compute cluster weights only once |
4ea3f013 | 1206 | if (!track.UpdateTrackParamAtCluster() || !track.ComputeClusterWeights()) { |
ea94c18b | 1207 | AliWarning("cannot take into account the multiple scattering effects"); |
96ebe67e | 1208 | track.FitWithMCS(kFALSE); |
ea94c18b | 1209 | } |
1210 | } | |
1211 | ||
96ebe67e | 1212 | track.FitWithVertex(fitWithVertex); |
1213 | if (fitWithVertex) SetVertexErrXY2ForFit(track); | |
1214 | ||
ea94c18b | 1215 | // Set fitting function |
1216 | gMinuit->SetFCN(TrackChi2); | |
208f139e | 1217 | |
1218 | // Set fitted parameters (!! The order is very important for the covariance matrix !!) | |
9bf6860b | 1219 | // Mandatory limits to avoid NaN values of parameters |
96ebe67e | 1220 | trackParam = (AliMUONTrackParam*) (track.GetTrackParamAtCluster()->First()); |
a0dc65b4 | 1221 | Double_t maxIBM = 1. / GetRecoParam()->GetMinBendingMomentum(); |
208f139e | 1222 | gMinuit->mnparm(0, "X", trackParam->GetNonBendingCoor(), 0.03, -500.0, 500.0, status); |
9bf6860b | 1223 | gMinuit->mnparm(1, "NonBenS", trackParam->GetNonBendingSlope(), 0.001, -1., 1., status); |
208f139e | 1224 | gMinuit->mnparm(2, "Y", trackParam->GetBendingCoor(), 0.10, -500.0, 500.0, status); |
9bf6860b | 1225 | gMinuit->mnparm(3, "BenS", trackParam->GetBendingSlope(), 0.001, -1.5, 1.5, status); |
1226 | gMinuit->mnparm(4, "InvBenP", trackParam->GetInverseBendingMomentum(), 0.003, -maxIBM, maxIBM, status); | |
208f139e | 1227 | |
de2cd600 | 1228 | // minimization |
208f139e | 1229 | gMinuit->mnexcm("MIGRAD", arg, 0, status); |
1230 | ||
1231 | // Calculate the covariance matrix more accurately if required | |
1232 | if (calcCov) gMinuit->mnexcm("HESSE", arg, 0, status); | |
8cde4af5 | 1233 | |
de2cd600 | 1234 | // get results into "invBenP", "benC", "nonBenC" ("x", "y") |
208f139e | 1235 | gMinuit->GetParameter(0, x, errorParam); |
1236 | trackParam->SetNonBendingCoor(x); | |
1237 | gMinuit->GetParameter(1, nonBenC, errorParam); | |
de2cd600 | 1238 | trackParam->SetNonBendingSlope(nonBenC); |
208f139e | 1239 | gMinuit->GetParameter(2, y, errorParam); |
1240 | trackParam->SetBendingCoor(y); | |
1241 | gMinuit->GetParameter(3, benC, errorParam); | |
1242 | trackParam->SetBendingSlope(benC); | |
1243 | gMinuit->GetParameter(4, invBenP, errorParam); | |
1244 | trackParam->SetInverseBendingMomentum(invBenP); | |
1245 | ||
de2cd600 | 1246 | // global result of the fit |
96ebe67e | 1247 | gMinuit->mnstat(globalChi2, fedm, errdef, npari, nparx, covStatus); |
1248 | track.SetGlobalChi2(globalChi2); | |
208f139e | 1249 | |
1250 | // Get the covariance matrix if required | |
1251 | if (calcCov) { | |
1252 | // Covariance matrix according to HESSE status | |
1253 | // If problem then keep only the diagonal terms (variances) | |
1254 | Double_t matrix[5][5]; | |
d373bcbe | 1255 | for (Int_t i=0; i<5; i++) for (Int_t j=0; j<5; j++) matrix[i][j] = 0.; |
208f139e | 1256 | gMinuit->mnemat(&matrix[0][0],5); |
1257 | if (covStatus == 3) trackParam->SetCovariances(matrix); | |
1258 | else trackParam->SetVariances(matrix); | |
ea94c18b | 1259 | } else trackParam->DeleteCovariances(); |
208f139e | 1260 | |
de2cd600 | 1261 | } |
1262 | ||
1263 | //__________________________________________________________________________ | |
ea94c18b | 1264 | void TrackChi2(Int_t & /*nParam*/, Double_t * /*gradient*/, Double_t &chi2, Double_t *param, Int_t /*flag*/) |
de2cd600 | 1265 | { |
ea94c18b | 1266 | /// Return the "Chi2" to be minimized with Minuit for track fitting. |
96ebe67e | 1267 | /// Assumes that the trackParamAtCluster are sorted according to increasing Z. |
1268 | /// Track parameters at each cluster are updated accordingly. | |
ea94c18b | 1269 | /// Vertex is used according to the flag "trackBeingFitted->GetFitWithVertex()". |
1270 | /// Multiple Coulomb scattering is taken into account according to the flag "trackBeingFitted->GetFitWithMCS()". | |
208f139e | 1271 | |
1272 | AliMUONTrack *trackBeingFitted = (AliMUONTrack*) gMinuit->GetObjectFit(); | |
96ebe67e | 1273 | AliMUONTrackParam* trackParamAtCluster = (AliMUONTrackParam*) trackBeingFitted->GetTrackParamAtCluster()->First(); |
208f139e | 1274 | Double_t dX, dY; |
ea94c18b | 1275 | chi2 = 0.; // initialize chi2 |
208f139e | 1276 | |
ea94c18b | 1277 | // update track parameters |
96ebe67e | 1278 | trackParamAtCluster->SetNonBendingCoor(param[0]); |
1279 | trackParamAtCluster->SetNonBendingSlope(param[1]); | |
1280 | trackParamAtCluster->SetBendingCoor(param[2]); | |
1281 | trackParamAtCluster->SetBendingSlope(param[3]); | |
1282 | trackParamAtCluster->SetInverseBendingMomentum(param[4]); | |
4ea3f013 | 1283 | if (!trackBeingFitted->UpdateTrackParamAtCluster()) { |
1284 | chi2 = 2.*AliMUONTrack::MaxChi2(); | |
1285 | return; | |
1286 | } | |
208f139e | 1287 | |
1288 | // Take the vertex into account in the fit if required | |
96ebe67e | 1289 | if (trackBeingFitted->FitWithVertex()) { |
1290 | Double_t nonBendingReso2,bendingReso2; | |
1291 | trackBeingFitted->GetVertexErrXY2(nonBendingReso2,bendingReso2); | |
4ea3f013 | 1292 | AliMUONTrackParam paramAtVertex(*trackParamAtCluster); |
1293 | if (nonBendingReso2 != 0. && bendingReso2 != 0. && AliMUONTrackExtrap::ExtrapToZ(¶mAtVertex, 0.)) { // vextex position = (0,0,0) | |
96ebe67e | 1294 | dX = paramAtVertex.GetNonBendingCoor(); |
1295 | dY = paramAtVertex.GetBendingCoor(); | |
1296 | chi2 += dX * dX / nonBendingReso2 + dY * dY / bendingReso2; | |
4ea3f013 | 1297 | } else { |
1298 | chi2 = 2.*AliMUONTrack::MaxChi2(); | |
1299 | return; | |
208f139e | 1300 | } |
de2cd600 | 1301 | } |
208f139e | 1302 | |
ea94c18b | 1303 | // compute chi2 w/wo multiple scattering |
96ebe67e | 1304 | chi2 += trackBeingFitted->ComputeGlobalChi2(trackBeingFitted->FitWithMCS()); |
b709ac13 | 1305 | |
1306 | } | |
1307 | ||
1308 | //__________________________________________________________________________ | |
89c8d66d | 1309 | Bool_t AliMUONTrackReconstructor::ComplementTracks(const AliMUONVClusterStore& clusterStore) |
b709ac13 | 1310 | { |
1311 | /// Complete tracks by adding missing clusters (if there is an overlap between | |
89c8d66d | 1312 | /// two detection elements, the track may have two clusters in the same chamber). |
1313 | /// Re-fit track parameters and covariances. | |
1314 | /// Return kTRUE if one or more tracks have been complemented. | |
b709ac13 | 1315 | AliDebug(1,"Enter ComplementTracks"); |
1316 | ||
1317 | Int_t chamberId, detElemId; | |
96ebe67e | 1318 | Double_t chi2OfCluster, bestChi2OfCluster; |
a0dc65b4 | 1319 | Double_t sigmaCut2 = GetRecoParam()->GetSigmaCutForTracking() * |
1320 | GetRecoParam()->GetSigmaCutForTracking(); | |
89c8d66d | 1321 | Bool_t foundOneCluster, trackModified, hasChanged = kFALSE; |
96ebe67e | 1322 | AliMUONVCluster* cluster; |
1323 | AliMUONTrackParam *trackParam, *nextTrackParam, copyOfTrackParam, trackParamAtCluster, bestTrackParamAtCluster; | |
b709ac13 | 1324 | |
b709ac13 | 1325 | AliMUONTrack *track = (AliMUONTrack*) fRecTracksPtr->First(); |
1326 | while (track) { | |
1327 | trackModified = kFALSE; | |
1328 | ||
96ebe67e | 1329 | trackParam = (AliMUONTrackParam*)track->GetTrackParamAtCluster()->First(); |
b709ac13 | 1330 | while (trackParam) { |
96ebe67e | 1331 | foundOneCluster = kFALSE; |
1332 | bestChi2OfCluster = 2. * sigmaCut2; // 2 because 2 quantities in chi2 | |
1333 | chamberId = trackParam->GetClusterPtr()->GetChamberId(); | |
1334 | detElemId = trackParam->GetClusterPtr()->GetDetElemId(); | |
b709ac13 | 1335 | |
1336 | // prepare nextTrackParam before adding new cluster because of the sorting | |
96ebe67e | 1337 | nextTrackParam = (AliMUONTrackParam*)track->GetTrackParamAtCluster()->After(trackParam); |
b709ac13 | 1338 | |
1339 | // recover track parameters from local fit and put them into a copy of trackParam | |
1340 | copyOfTrackParam.SetZ(trackParam->GetZ()); | |
1341 | copyOfTrackParam.SetParameters(trackParam->GetSmoothParameters()); | |
1342 | copyOfTrackParam.SetCovariances(trackParam->GetSmoothCovariances()); | |
1343 | ||
96ebe67e | 1344 | // Create iterators to loop over clusters in current chamber |
1345 | TIter nextInCh(clusterStore.CreateChamberIterator(chamberId,chamberId)); | |
1346 | ||
b709ac13 | 1347 | // look for one second candidate in the same chamber |
96ebe67e | 1348 | while ( ( cluster = static_cast<AliMUONVCluster*>(nextInCh()) ) ) { |
b709ac13 | 1349 | |
1350 | // look for a cluster in another detection element | |
96ebe67e | 1351 | if (cluster->GetDetElemId() == detElemId) continue; |
b709ac13 | 1352 | |
96ebe67e | 1353 | // try to add the current cluster fast |
1354 | if (!TryOneClusterFast(copyOfTrackParam, cluster)) continue; | |
b709ac13 | 1355 | |
96ebe67e | 1356 | // try to add the current cluster accurately |
1357 | chi2OfCluster = TryOneCluster(copyOfTrackParam, cluster, trackParamAtCluster); | |
b709ac13 | 1358 | |
1359 | // if better chi2 then prepare to add this cluster to the track | |
96ebe67e | 1360 | if (chi2OfCluster < bestChi2OfCluster) { |
1361 | bestChi2OfCluster = chi2OfCluster; | |
1362 | bestTrackParamAtCluster = trackParamAtCluster; | |
1363 | foundOneCluster = kTRUE; | |
b709ac13 | 1364 | } |
1365 | ||
1366 | } | |
1367 | ||
1368 | // add new cluster if any | |
96ebe67e | 1369 | if (foundOneCluster) { |
0e894e58 | 1370 | |
1371 | // Printout for debuging | |
1372 | if ((AliLog::GetDebugLevel("MUON","AliMUONTrackReconstructor") >= 1) || (AliLog::GetGlobalDebugLevel() >= 1)) { | |
1373 | cout << "ComplementTracks: found one cluster in chamber(1..): " << chamberId+1 << endl; | |
1374 | bestTrackParamAtCluster.GetClusterPtr()->Print(); | |
1375 | cout<<endl<<"Track parameters and covariances at cluster:"<<endl; | |
1376 | bestTrackParamAtCluster.GetParameters().Print(); | |
1377 | bestTrackParamAtCluster.GetCovariances().Print(); | |
1378 | } | |
1379 | ||
7332f213 | 1380 | trackParam->SetRemovable(kTRUE); |
1381 | bestTrackParamAtCluster.SetRemovable(kTRUE); | |
1382 | track->AddTrackParamAtCluster(bestTrackParamAtCluster,*(bestTrackParamAtCluster.GetClusterPtr())); | |
b709ac13 | 1383 | trackModified = kTRUE; |
89c8d66d | 1384 | hasChanged = kTRUE; |
b709ac13 | 1385 | } |
1386 | ||
1387 | trackParam = nextTrackParam; | |
1388 | } | |
1389 | ||
1390 | // re-fit track parameters if needed | |
96ebe67e | 1391 | if (trackModified) Fit(*track, kTRUE, kFALSE, kTRUE); |
b709ac13 | 1392 | |
1393 | track = (AliMUONTrack*) fRecTracksPtr->After(track); | |
1394 | } | |
ea94c18b | 1395 | |
89c8d66d | 1396 | return hasChanged; |
1397 | ||
de2cd600 | 1398 | } |
1399 | ||
1400 | //__________________________________________________________________________ | |
7332f213 | 1401 | void AliMUONTrackReconstructor::ImproveTrack(AliMUONTrack &track) |
de2cd600 | 1402 | { |
7332f213 | 1403 | /// Improve the given track by removing clusters with local chi2 highter than the defined cut |
ea94c18b | 1404 | /// Recompute track parameters and covariances at the remaining clusters |
7332f213 | 1405 | AliDebug(1,"Enter ImproveTrack"); |
208f139e | 1406 | |
ea94c18b | 1407 | Double_t localChi2, worstLocalChi2; |
7332f213 | 1408 | AliMUONTrackParam *trackParamAtCluster, *worstTrackParamAtCluster; |
a0dc65b4 | 1409 | Double_t sigmaCut2 = GetRecoParam()->GetSigmaCutForImprovement() * |
1410 | GetRecoParam()->GetSigmaCutForImprovement(); | |
208f139e | 1411 | |
7332f213 | 1412 | while (!track.IsImproved()) { |
ea94c18b | 1413 | |
7332f213 | 1414 | // identify removable clusters |
a0dc65b4 | 1415 | track.TagRemovableClusters(GetRecoParam()->RequestedStationMask()); |
b709ac13 | 1416 | |
7332f213 | 1417 | // Update track parameters and covariances |
4ea3f013 | 1418 | if (!track.UpdateCovTrackParamAtCluster()) { |
1419 | AliWarning("unable to update track parameters and covariances --> stop improvement"); | |
1420 | break; | |
1421 | } | |
7332f213 | 1422 | |
1423 | // Compute local chi2 of each clusters | |
1424 | track.ComputeLocalChi2(kTRUE); | |
1425 | ||
1426 | // Look for the cluster to remove | |
1427 | worstTrackParamAtCluster = NULL; | |
1428 | worstLocalChi2 = 0.; | |
1429 | trackParamAtCluster = (AliMUONTrackParam*) track.GetTrackParamAtCluster()->First(); | |
1430 | while (trackParamAtCluster) { | |
ea94c18b | 1431 | |
7332f213 | 1432 | // Pick up cluster with the worst chi2 |
1433 | localChi2 = trackParamAtCluster->GetLocalChi2(); | |
1434 | if (localChi2 > worstLocalChi2) { | |
1435 | worstLocalChi2 = localChi2; | |
1436 | worstTrackParamAtCluster = trackParamAtCluster; | |
ea94c18b | 1437 | } |
1438 | ||
7332f213 | 1439 | trackParamAtCluster = (AliMUONTrackParam*) track.GetTrackParamAtCluster()->After(trackParamAtCluster); |
1440 | } | |
1441 | ||
1442 | // Check if worst cluster found | |
1443 | if (!worstTrackParamAtCluster) { | |
1444 | AliWarning("Bad local chi2 values?"); | |
1445 | break; | |
1446 | } | |
1447 | ||
1448 | // Check whether the worst chi2 is under requirement or not | |
1449 | if (worstLocalChi2 < 2. * sigmaCut2) { // 2 because 2 quantities in chi2 | |
1450 | track.SetImproved(kTRUE); | |
1451 | break; | |
1452 | } | |
1453 | ||
1454 | // if the worst cluster is not removable then stop improvement | |
1455 | if (!worstTrackParamAtCluster->IsRemovable()) break; | |
1456 | ||
1457 | // Remove the worst cluster | |
1458 | track.RemoveTrackParamAtCluster(worstTrackParamAtCluster); | |
1459 | ||
1460 | // Re-fit the track: | |
1461 | // Take into account the multiple scattering | |
1462 | // Calculate the track parameter covariance matrix | |
1463 | Fit(track, kTRUE, kFALSE, kTRUE); | |
1464 | ||
1465 | // Printout for debuging | |
1466 | if ((AliLog::GetDebugLevel("MUON","AliMUONTrackReconstructor") >= 1) || (AliLog::GetGlobalDebugLevel() >= 1)) { | |
1467 | cout << "ImproveTracks: track " << fRecTracksPtr->IndexOf(&track)+1 << " improved " << endl; | |
de2cd600 | 1468 | } |
ea94c18b | 1469 | |
de2cd600 | 1470 | } |
1471 | ||
de2cd600 | 1472 | } |
1473 | ||
208f139e | 1474 | //__________________________________________________________________________ |
4ea3f013 | 1475 | Bool_t AliMUONTrackReconstructor::FinalizeTrack(AliMUONTrack &track) |
b8dc484b | 1476 | { |
7332f213 | 1477 | /// Recompute track parameters and covariances at each attached cluster |
1478 | /// from those at the first one, if not already done | |
1479 | AliDebug(1,"Enter FinalizeTrack"); | |
4ea3f013 | 1480 | if (!track.IsImproved() && !track.UpdateCovTrackParamAtCluster()) { |
1481 | AliWarning("finalization failed due to extrapolation problem"); | |
1482 | return kFALSE; | |
1483 | } | |
1484 | return kTRUE; | |
a9e2aefa | 1485 | } |
1486 | ||
9bf6860b | 1487 | //__________________________________________________________________________ |
b1fea02e | 1488 | Bool_t AliMUONTrackReconstructor::RefitTrack(AliMUONTrack &track, Bool_t enableImprovement) |
7deb8eb0 | 1489 | { |
1490 | /// re-fit the given track | |
1491 | ||
1492 | // check validity of the track | |
ad3c6eda | 1493 | if (track.GetNClusters() < 3) { |
7deb8eb0 | 1494 | AliWarning("the track does not contain enough clusters --> unable to refit"); |
1495 | return kFALSE; | |
1496 | } | |
1497 | ||
1498 | // reset the seed (i.e. parameters at first cluster) before fitting | |
1499 | AliMUONTrackParam* firstTrackParam = (AliMUONTrackParam*) track.GetTrackParamAtCluster()->First(); | |
1500 | if (firstTrackParam->GetInverseBendingMomentum() == 0.) { | |
1501 | AliWarning("track parameters at first chamber are not initialized --> unable to refit"); | |
1502 | return kFALSE; | |
1503 | } | |
1504 | ||
1505 | // compute track parameters at each cluster from parameters at the first one | |
1506 | // necessary to compute multiple scattering effect during refitting | |
4ea3f013 | 1507 | if (!track.UpdateTrackParamAtCluster()) { |
1508 | AliWarning("bad track refitting due to extrapolation failure"); | |
1509 | return kFALSE; | |
1510 | } | |
7deb8eb0 | 1511 | |
1512 | // Re-fit the track: | |
1513 | // Take into account the multiple scattering | |
1514 | // Calculate the track parameter covariance matrix | |
1515 | Fit(track, kTRUE, kFALSE, kTRUE); | |
1516 | ||
1517 | // Improve the reconstructed tracks if required | |
b1fea02e | 1518 | track.SetImproved(kFALSE); |
a0dc65b4 | 1519 | if (enableImprovement && GetRecoParam()->ImproveTracks()) ImproveTrack(track); |
7deb8eb0 | 1520 | |
1521 | // Fill AliMUONTrack data members | |
4ea3f013 | 1522 | if (track.GetGlobalChi2() < AliMUONTrack::MaxChi2()) return FinalizeTrack(track); |
1523 | else { | |
1524 | AliWarning("track not finalized due to extrapolation failure"); | |
1525 | return kFALSE; | |
1526 | } | |
7deb8eb0 | 1527 | |
1528 | } | |
1529 |