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