1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 //-----------------------------------------------------------------------------
19 /// \class AliMUONTrackReconstructorK
21 /// MUON track reconstructor using the kalman method
23 /// This class contains as data:
24 /// - the parameters for the track reconstruction
26 /// It contains as methods, among others:
27 /// - MakeTracks to build the tracks
29 //-----------------------------------------------------------------------------
31 #include "AliMUONTrackReconstructorK.h"
33 #include "AliMUONConstants.h"
34 #include "AliMUONVCluster.h"
35 #include "AliMUONVClusterServer.h"
36 #include "AliMUONVClusterStore.h"
37 #include "AliMUONTrack.h"
38 #include "AliMUONTrackParam.h"
39 #include "AliMUONTrackExtrap.h"
40 #include "AliMUONRecoParam.h"
42 #include "AliMpArea.h"
46 #include <Riostream.h>
51 ClassImp(AliMUONTrackReconstructorK) // Class implementation in ROOT context
54 //__________________________________________________________________________
55 AliMUONTrackReconstructorK::AliMUONTrackReconstructorK(const AliMUONRecoParam* recoParam, AliMUONVClusterServer* clusterServer)
56 : AliMUONVTrackReconstructor(recoParam, clusterServer)
61 //__________________________________________________________________________
62 AliMUONTrackReconstructorK::~AliMUONTrackReconstructorK()
67 //__________________________________________________________________________
68 void AliMUONTrackReconstructorK::MakeTrackCandidates(AliMUONVClusterStore& clusterStore)
70 /// To make track candidates (assuming linear propagation if the flag fgkMakeTrackCandidatesFast is set to kTRUE):
71 /// Start with segments station(1..) 4 or 5 then follow track in station 5 or 4.
72 /// Good candidates are made of at least three clusters if both station are requested (two otherwise).
73 /// Keep only best candidates or all of them according to the flag fgkTrackAllTracks.
75 TClonesArray *segments;
80 AliDebug(1,"Enter MakeTrackCandidates");
82 // Unless we're doing combined tracking, we'll clusterize all stations at once
83 Int_t firstChamber(0);
86 if (GetRecoParam()->CombineClusterTrackReco()) {
87 // ... Here's the exception : ask the clustering to reconstruct
88 // clusters *only* in station 4 and 5 for combined tracking
92 for (Int_t i = firstChamber; i <= lastChamber; ++i )
94 if (fClusterServer && GetRecoParam()->UseChamber(i)) fClusterServer->Clusterize(i, clusterStore, AliMpArea(), GetRecoParam());
97 // Loop over stations(1..) 5 and 4 and make track candidates
98 for (Int_t istat=4; istat>=3; istat--) {
100 // Make segments in the station
101 segments = MakeSegmentsBetweenChambers(clusterStore, 2*istat, 2*istat+1);
103 // Loop over segments
104 for (Int_t iseg=0; iseg<segments->GetEntriesFast(); iseg++) {
105 AliDebug(1,Form("Making primary candidate(1..) %d",++iCandidate));
107 // Transform segments to tracks and put them at the end of fRecTracksPtr
108 track = new ((*fRecTracksPtr)[fRecTracksPtr->GetLast()+1]) AliMUONTrack((AliMUONObjectPair*)((*segments)[iseg]),GetRecoParam()->GetBendingVertexDispersion());
111 // Look for compatible cluster(s) in the other station
112 if (GetRecoParam()->MakeTrackCandidatesFast())
113 clusterFound = FollowLinearTrackInStation(*track, clusterStore, 7-istat);
115 // First recompute track parameters and covariances on station(1..) 5 using Kalman filter
116 // (to make sure all tracks are treated in the same way)
117 if (istat == 4) RetraceTrack(*track, kTRUE);
118 clusterFound = FollowTrackInStation(*track, clusterStore, 7-istat);
121 // Remove track if no cluster found on a requested station
123 if (GetRecoParam()->RequestStation(7-istat)) {
124 fRecTracksPtr->Remove(track);
126 } else if (istat == 3 && !GetRecoParam()->MakeTrackCandidatesFast()) {
127 // update track parameters and covariances using Kalman filter
128 RetraceTrack(*track, kTRUE);
133 // delete the array of segments
138 // Retrace tracks using Kalman filter and remove bad ones
139 if (GetRecoParam()->MakeTrackCandidatesFast()) {
140 fRecTracksPtr->Compress(); // this is essential before checking tracks
142 Int_t currentNRecTracks = fNRecTracks;
143 for (Int_t iRecTrack = 0; iRecTrack < currentNRecTracks; iRecTrack++) {
144 track = (AliMUONTrack*) fRecTracksPtr->UncheckedAt(iRecTrack);
146 // Recompute track parameters and covariances using Kalman filter
147 RetraceTrack(*track,kTRUE);
149 // Remove the track if the normalized chi2 is too high
150 if (track->GetNormalizedChi2() > GetRecoParam()->GetSigmaCutForTracking() *
151 GetRecoParam()->GetSigmaCutForTracking()) {
152 fRecTracksPtr->Remove(track);
160 fRecTracksPtr->Compress(); // this is essential before checking tracks
162 // Keep all different tracks or only the best ones as required
163 if (GetRecoParam()->TrackAllTracks()) RemoveIdenticalTracks();
164 else RemoveDoubleTracks();
166 AliDebug(1,Form("Number of good candidates = %d",fNRecTracks));
170 //__________________________________________________________________________
171 void AliMUONTrackReconstructorK::MakeMoreTrackCandidates(AliMUONVClusterStore& clusterStore)
173 /// To make extra track candidates (assuming linear propagation if the flag fgkMakeTrackCandidatesFast is set to kTRUE):
174 /// clustering is supposed to be already done
175 /// Start with segments made of 1 cluster in each of the stations 4 and 5 then follow track in remaining chambers.
176 /// Good candidates are made of at least three clusters if both station are requested (two otherwise).
177 /// Keep only best candidates or all of them according to the flag fgkTrackAllTracks.
179 TClonesArray *segments;
181 Int_t iCandidate = 0, iCurrentTrack, nCurrentTracks;
182 Int_t initialNRecTracks = fNRecTracks;
185 AliDebug(1,"Enter MakeMoreTrackCandidates");
187 // Double loop over chambers in stations(1..) 4 and 5 to make track candidates
188 for (Int_t ich1 = 6; ich1 <= 7; ich1++) {
189 for (Int_t ich2 = 8; ich2 <= 9; ich2++) {
191 // Make segments between ch1 and ch2
192 segments = MakeSegmentsBetweenChambers(clusterStore, ich1, ich2);
194 // Loop over segments
195 for (Int_t iseg=0; iseg<segments->GetEntriesFast(); iseg++) {
196 AliDebug(1,Form("Making primary candidate(1..) %d",++iCandidate));
198 // Transform segments to tracks and put them at the end of fRecTracksPtr
199 iCurrentTrack = fRecTracksPtr->GetLast()+1;
200 track = new ((*fRecTracksPtr)[iCurrentTrack]) AliMUONTrack((AliMUONObjectPair*)((*segments)[iseg]),GetRecoParam()->GetBendingVertexDispersion());
203 // Look for compatible cluster(s) in the second chamber of station 5
204 if (GetRecoParam()->MakeTrackCandidatesFast())
205 clusterFound = FollowLinearTrackInChamber(*track, clusterStore, 17-ich2);
206 else clusterFound = FollowTrackInChamber(*track, clusterStore, 17-ich2);
208 // skip the original track in case it has been removed
209 if (GetRecoParam()->TrackAllTracks() && clusterFound) iCurrentTrack++;
211 // loop over every new tracks
212 nCurrentTracks = fRecTracksPtr->GetLast()+1;
213 while (iCurrentTrack < nCurrentTracks) {
214 track = (AliMUONTrack*) fRecTracksPtr->UncheckedAt(iCurrentTrack);
216 // Look for compatible cluster(s) in the second chamber of station 4
217 if (GetRecoParam()->MakeTrackCandidatesFast())
218 FollowLinearTrackInChamber(*track, clusterStore, 13-ich1);
219 else FollowTrackInChamber(*track, clusterStore, 13-ich1);
226 // delete the array of segments
231 fRecTracksPtr->Compress(); // this is essential before checking tracks
233 // Retrace tracks using Kalman filter
234 for (Int_t iRecTrack = initialNRecTracks; iRecTrack < fNRecTracks; iRecTrack++) {
235 track = (AliMUONTrack*) fRecTracksPtr->UncheckedAt(iRecTrack);
237 // Recompute track parameters and covariances using Kalman filter
238 RetraceTrack(*track,kTRUE);
240 // Remove the track if the normalized chi2 is too high
241 // (only if the tracking has been done without magnetic field)
242 if (GetRecoParam()->MakeTrackCandidatesFast() &&
243 track->GetNormalizedChi2() > GetRecoParam()->GetSigmaCutForTracking() *
244 GetRecoParam()->GetSigmaCutForTracking()) {
245 fRecTracksPtr->Remove(track);
251 // this is essential before checking tracks
252 if (GetRecoParam()->MakeTrackCandidatesFast()) fRecTracksPtr->Compress();
254 // Keep all different tracks or only the best ones as required
255 if (GetRecoParam()->TrackAllTracks()) RemoveIdenticalTracks();
256 else RemoveDoubleTracks();
258 AliDebug(1,Form("Number of good candidates = %d",fNRecTracks));
262 //__________________________________________________________________________
263 void AliMUONTrackReconstructorK::RetraceTrack(AliMUONTrack &trackCandidate, Bool_t resetSeed)
265 /// Re-run the kalman filter from the most downstream cluster to the most uptream one
266 AliDebug(1,"Enter RetraceTrack");
268 AliMUONTrackParam* lastTrackParam = (AliMUONTrackParam*) trackCandidate.GetTrackParamAtCluster()->Last();
270 // Reset the "seed" (= track parameters and their covariances at last cluster) if required
273 // parameters at last cluster
274 AliMUONVCluster* cluster2 = lastTrackParam->GetClusterPtr();
275 Double_t x2 = cluster2->GetX();
276 Double_t y2 = cluster2->GetY();
277 Double_t z2 = cluster2->GetZ();
279 // parameters at last but one cluster
280 AliMUONTrackParam* previousTrackParam = (AliMUONTrackParam*) trackCandidate.GetTrackParamAtCluster()->Before(lastTrackParam);
281 AliMUONVCluster* cluster1 = previousTrackParam->GetClusterPtr();
282 // make sure it is on the previous chamber (can have 2 clusters in the same chamber after "ComplementTrack")
283 if (cluster2->GetChamberId() == cluster1->GetChamberId()) {
284 previousTrackParam = (AliMUONTrackParam*) trackCandidate.GetTrackParamAtCluster()->Before(previousTrackParam);
285 cluster1 = previousTrackParam->GetClusterPtr();
287 Double_t x1 = cluster1->GetX();
288 Double_t y1 = cluster1->GetY();
289 Double_t z1 = cluster1->GetZ();
291 // reset track parameters
292 Double_t dZ = z1 - z2;
293 lastTrackParam->SetNonBendingCoor(x2);
294 lastTrackParam->SetBendingCoor(y2);
295 lastTrackParam->SetZ(z2);
296 lastTrackParam->SetNonBendingSlope((x1 - x2) / dZ);
297 lastTrackParam->SetBendingSlope((y1 - y2) / dZ);
298 Double_t bendingImpact = y2 - z2 * lastTrackParam->GetBendingSlope();
299 Double_t inverseBendingMomentum = 1. / AliMUONTrackExtrap::GetBendingMomentumFromImpactParam(bendingImpact);
300 lastTrackParam->SetInverseBendingMomentum(inverseBendingMomentum);
302 // => Reset track parameter covariances at last cluster (as if the other clusters did not exist)
303 TMatrixD lastParamCov(5,5);
306 lastParamCov(0,0) = cluster2->GetErrX2();
307 lastParamCov(1,1) = 100. * ( cluster1->GetErrX2() + cluster2->GetErrX2() ) / dZ / dZ;
309 lastParamCov(2,2) = cluster2->GetErrY2();
310 lastParamCov(3,3) = 100. * ( cluster1->GetErrY2() + cluster2->GetErrY2() ) / dZ / dZ;
311 // Inverse bending momentum (vertex resolution + bending slope resolution + 10% error on dipole parameters+field)
312 lastParamCov(4,4) = ((GetRecoParam()->GetBendingVertexDispersion() *
313 GetRecoParam()->GetBendingVertexDispersion() +
314 (z1 * z1 * cluster2->GetErrY2() + z2 * z2 * cluster1->GetErrY2()) / dZ / dZ) /
315 bendingImpact / bendingImpact + 0.1 * 0.1) * inverseBendingMomentum * inverseBendingMomentum;
316 lastTrackParam->SetCovariances(lastParamCov);
318 // Reset the track chi2
319 lastTrackParam->SetTrackChi2(0.);
324 RetracePartialTrack(trackCandidate, lastTrackParam);
328 //__________________________________________________________________________
329 void AliMUONTrackReconstructorK::RetracePartialTrack(AliMUONTrack &trackCandidate, const AliMUONTrackParam* startingTrackParam)
331 /// Re-run the kalman filter from the cluster attached to startingTrackParam to the most uptream cluster
332 AliDebug(1,"Enter RetracePartialTrack");
334 // Printout for debuging
335 if ((AliLog::GetDebugLevel("MUON","AliMUONTrackReconstructorK") >= 1) || (AliLog::GetGlobalDebugLevel() >= 1)) {
336 cout << "RetracePartialTrack: track chi2 before re-tracking: " << trackCandidate.GetGlobalChi2() << endl;
339 // Reset the track chi2
340 trackCandidate.SetGlobalChi2(startingTrackParam->GetTrackChi2());
342 // loop over attached clusters until the first one and recompute track parameters and covariances using kalman filter
343 Int_t expectedChamber = startingTrackParam->GetClusterPtr()->GetChamberId() - 1;
344 Int_t currentChamber;
345 Double_t addChi2TrackAtCluster;
346 AliMUONTrackParam* trackParamAtCluster = (AliMUONTrackParam*) trackCandidate.GetTrackParamAtCluster()->Before(startingTrackParam);
347 while (trackParamAtCluster) {
349 // reset track parameters and their covariances
350 trackParamAtCluster->SetParameters(startingTrackParam->GetParameters());
351 trackParamAtCluster->SetZ(startingTrackParam->GetZ());
352 trackParamAtCluster->SetCovariances(startingTrackParam->GetCovariances());
355 AliMUONTrackExtrap::AddMCSEffect(trackParamAtCluster,AliMUONConstants::ChamberThicknessInX0(),1.);
357 // reset propagator for smoother
358 if (GetRecoParam()->UseSmoother()) trackParamAtCluster->ResetPropagator();
360 // add MCS in missing chambers if any
361 currentChamber = trackParamAtCluster->GetClusterPtr()->GetChamberId();
362 while (currentChamber < expectedChamber) {
363 // extrapolation to the missing chamber (update the propagator)
364 AliMUONTrackExtrap::ExtrapToZCov(trackParamAtCluster, AliMUONConstants::DefaultChamberZ(expectedChamber),
365 GetRecoParam()->UseSmoother());
367 AliMUONTrackExtrap::AddMCSEffect(trackParamAtCluster,AliMUONConstants::ChamberThicknessInX0(),1.);
371 // extrapolation to the plane of the cluster attached to the current trackParamAtCluster (update the propagator)
372 AliMUONTrackExtrap::ExtrapToZCov(trackParamAtCluster, trackParamAtCluster->GetClusterPtr()->GetZ(),
373 GetRecoParam()->UseSmoother());
375 if (GetRecoParam()->UseSmoother()) {
376 // save extrapolated parameters for smoother
377 trackParamAtCluster->SetExtrapParameters(trackParamAtCluster->GetParameters());
379 // save extrapolated covariance matrix for smoother
380 trackParamAtCluster->SetExtrapCovariances(trackParamAtCluster->GetCovariances());
383 // Compute new track parameters using kalman filter
384 addChi2TrackAtCluster = RunKalmanFilter(*trackParamAtCluster);
386 // Update the track chi2
387 trackCandidate.SetGlobalChi2(trackCandidate.GetGlobalChi2() + addChi2TrackAtCluster);
388 trackParamAtCluster->SetTrackChi2(trackCandidate.GetGlobalChi2());
391 expectedChamber = currentChamber - 1;
392 startingTrackParam = trackParamAtCluster;
393 trackParamAtCluster = (AliMUONTrackParam*) (trackCandidate.GetTrackParamAtCluster()->Before(startingTrackParam));
396 // Printout for debuging
397 if ((AliLog::GetDebugLevel("MUON","AliMUONTrackReconstructorK") >= 1) || (AliLog::GetGlobalDebugLevel() >= 1)) {
398 cout << "RetracePartialTrack: track chi2 after re-tracking: " << trackCandidate.GetGlobalChi2() << endl;
403 //__________________________________________________________________________
404 void AliMUONTrackReconstructorK::FollowTracks(AliMUONVClusterStore& clusterStore)
406 /// Follow tracks in stations(1..) 3, 2 and 1
407 AliDebug(1,"Enter FollowTracks");
410 Int_t currentNRecTracks;
412 for (Int_t station = 2; station >= 0; station--) {
414 // Save the actual number of reconstructed track in case of
415 // tracks are added or suppressed during the tracking procedure
416 // !! Do not compress fRecTracksPtr until the end of the loop over tracks !!
417 currentNRecTracks = fNRecTracks;
419 for (Int_t iRecTrack = 0; iRecTrack <currentNRecTracks; iRecTrack++) {
420 AliDebug(1,Form("FollowTracks: track candidate(1..) %d", iRecTrack+1));
422 track = (AliMUONTrack*) fRecTracksPtr->UncheckedAt(iRecTrack);
424 // Look for compatible cluster(s) in station(0..) "station"
425 if (!FollowTrackInStation(*track, clusterStore, station)) {
427 // Try to recover track if required
428 if (GetRecoParam()->RecoverTracks()) {
430 // work on a copy of the track if this station is not required
431 // to keep the case where no cluster is reconstructed as a possible candidate
432 if (!GetRecoParam()->RequestStation(station)) {
433 track = new ((*fRecTracksPtr)[fRecTracksPtr->GetLast()+1]) AliMUONTrack(*track);
438 if (!RecoverTrack(*track, clusterStore, station)) {
439 // remove track if no cluster found
440 fRecTracksPtr->Remove(track);
444 } else if (GetRecoParam()->RequestStation(station)) {
445 // remove track if no cluster found
446 fRecTracksPtr->Remove(track);
454 fRecTracksPtr->Compress(); // this is essential before checking tracks
456 // Keep only the best tracks if required
457 if (!GetRecoParam()->TrackAllTracks()) RemoveDoubleTracks();
463 //__________________________________________________________________________
464 Bool_t AliMUONTrackReconstructorK::FollowTrackInChamber(AliMUONTrack &trackCandidate, AliMUONVClusterStore& clusterStore, Int_t nextChamber)
466 /// Follow trackCandidate in chamber(0..) nextChamber and search for compatible cluster(s)
467 /// Keep all possibilities or only the best one(s) according to the flag fgkTrackAllTracks:
468 /// kTRUE: duplicate "trackCandidate" if there are several possibilities and add the new tracks at the end of
469 /// fRecTracksPtr to avoid conficts with other track candidates at this current stage of the tracking procedure.
470 /// Remove the obsolete "trackCandidate" at the end.
471 /// kFALSE: add only the best cluster(s) to the "trackCandidate". Try to add a couple of clusters in priority.
472 /// return kTRUE if new cluster(s) have been found (otherwise return kFALSE)
473 AliDebug(1,Form("Enter FollowTrackInChamber(1..) %d", nextChamber+1));
475 Double_t bendingMomentum;
476 Double_t chi2OfCluster;
477 Double_t maxChi2OfCluster = 2. * GetRecoParam()->GetSigmaCutForTracking() *
478 GetRecoParam()->GetSigmaCutForTracking(); // 2 because 2 quantities in chi2
479 Double_t addChi2TrackAtCluster;
480 Double_t bestAddChi2TrackAtCluster = 1.e10;
481 Bool_t foundOneCluster = kFALSE;
482 AliMUONTrack *newTrack = 0x0;
483 AliMUONVCluster *cluster;
484 AliMUONTrackParam extrapTrackParamAtCh;
485 AliMUONTrackParam extrapTrackParamAtCluster;
486 AliMUONTrackParam bestTrackParamAtCluster;
488 // Get track parameters according to the propagation direction
489 if (nextChamber > 7) extrapTrackParamAtCh = *(AliMUONTrackParam*)trackCandidate.GetTrackParamAtCluster()->Last();
490 else extrapTrackParamAtCh = *(AliMUONTrackParam*)trackCandidate.GetTrackParamAtCluster()->First();
492 // Printout for debuging
493 if ((AliLog::GetDebugLevel("MUON","AliMUONTrackReconstructorK") >= 2) || (AliLog::GetGlobalDebugLevel() >= 2)) {
494 cout<<endl<<"Track parameters and covariances at first cluster:"<<endl;
495 extrapTrackParamAtCh.GetParameters().Print();
496 extrapTrackParamAtCh.GetCovariances().Print();
500 AliMUONTrackExtrap::AddMCSEffect(&extrapTrackParamAtCh,AliMUONConstants::ChamberThicknessInX0(),1.);
502 // reset propagator for smoother
503 if (GetRecoParam()->UseSmoother()) extrapTrackParamAtCh.ResetPropagator();
505 // Add MCS in the missing chamber(s) if any
506 Int_t currentChamber = extrapTrackParamAtCh.GetClusterPtr()->GetChamberId();
507 while (currentChamber > nextChamber + 1) {
508 // extrapolation to the missing chamber
510 AliMUONTrackExtrap::ExtrapToZCov(&extrapTrackParamAtCh, AliMUONConstants::DefaultChamberZ(currentChamber),
511 GetRecoParam()->UseSmoother());
513 AliMUONTrackExtrap::AddMCSEffect(&extrapTrackParamAtCh,AliMUONConstants::ChamberThicknessInX0(),1.);
516 //Extrapolate trackCandidate to chamber
517 AliMUONTrackExtrap::ExtrapToZCov(&extrapTrackParamAtCh, AliMUONConstants::DefaultChamberZ(nextChamber),
518 GetRecoParam()->UseSmoother());
520 // Printout for debuging
521 if ((AliLog::GetDebugLevel("MUON","AliMUONTrackReconstructorK") >= 2) || (AliLog::GetGlobalDebugLevel() >= 2)) {
522 cout<<endl<<"Track parameters and covariances at first cluster extrapolated to z = "<<AliMUONConstants::DefaultChamberZ(nextChamber)<<":"<<endl;
523 extrapTrackParamAtCh.GetParameters().Print();
524 extrapTrackParamAtCh.GetCovariances().Print();
527 // Printout for debuging
528 if ((AliLog::GetDebugLevel("MUON","AliMUONTrackReconstructorK") >= 1) || (AliLog::GetGlobalDebugLevel() >= 1)) {
529 cout << "FollowTrackInChamber: look for clusters in chamber(1..): " << nextChamber+1 << endl;
532 // Ask the clustering to reconstruct new clusters around the track position in the current chamber
533 // except for station 4 and 5 that are already entirely clusterized
534 if (GetRecoParam()->CombineClusterTrackReco()) {
535 if (nextChamber < 6) AskForNewClustersInChamber(extrapTrackParamAtCh, clusterStore, nextChamber);
538 // Create iterators to loop over clusters in both chambers
539 TIter next(clusterStore.CreateChamberIterator(nextChamber,nextChamber));
541 // look for candidates in chamber
542 while ( ( cluster = static_cast<AliMUONVCluster*>(next()) ) ) {
544 // try to add the current cluster fast
545 if (!TryOneClusterFast(extrapTrackParamAtCh, cluster)) continue;
547 // try to add the current cluster accuratly
548 chi2OfCluster = TryOneCluster(extrapTrackParamAtCh, cluster, extrapTrackParamAtCluster,
549 GetRecoParam()->UseSmoother());
551 // if good chi2 then consider to add cluster
552 if (chi2OfCluster < maxChi2OfCluster) {
553 foundOneCluster = kTRUE;
555 // Printout for debuging
556 if ((AliLog::GetDebugLevel("MUON","AliMUONTrackReconstructorK") >= 1) || (AliLog::GetGlobalDebugLevel() >= 1)) {
557 cout << "FollowTrackInChamber: found one cluster in chamber(1..): " << nextChamber+1
558 << " (Chi2 = " << chi2OfCluster << ")" << endl;
562 if (GetRecoParam()->UseSmoother()) {
563 // save extrapolated parameters for smoother
564 extrapTrackParamAtCluster.SetExtrapParameters(extrapTrackParamAtCluster.GetParameters());
566 // save extrapolated covariance matrix for smoother
567 extrapTrackParamAtCluster.SetExtrapCovariances(extrapTrackParamAtCluster.GetCovariances());
570 // Compute new track parameters including new cluster using kalman filter
571 addChi2TrackAtCluster = RunKalmanFilter(extrapTrackParamAtCluster);
573 // skip track with absolute bending momentum out of limits
574 bendingMomentum = TMath::Abs(1. / extrapTrackParamAtCluster.GetInverseBendingMomentum());
575 if (bendingMomentum < GetRecoParam()->GetMinBendingMomentum() ||
576 bendingMomentum > GetRecoParam()->GetMaxBendingMomentum()) continue;
578 if (GetRecoParam()->TrackAllTracks()) {
579 // copy trackCandidate into a new track put at the end of fRecTracksPtr and add the new cluster
580 newTrack = new ((*fRecTracksPtr)[fRecTracksPtr->GetLast()+1]) AliMUONTrack(trackCandidate);
581 UpdateTrack(*newTrack,extrapTrackParamAtCluster,addChi2TrackAtCluster);
584 // Printout for debuging
585 if ((AliLog::GetDebugLevel("MUON","AliMUONTrackReconstructorK") >= 1) || (AliLog::GetGlobalDebugLevel() >= 1)) {
586 cout << "FollowTrackInChamber: added one cluster in chamber(1..): " << nextChamber+1 << endl;
587 if (AliLog::GetGlobalDebugLevel() >= 3) newTrack->RecursiveDump();
590 } else if (addChi2TrackAtCluster < bestAddChi2TrackAtCluster) {
591 // keep track of the best cluster
592 bestAddChi2TrackAtCluster = addChi2TrackAtCluster;
593 bestTrackParamAtCluster = extrapTrackParamAtCluster;
600 // fill out the best track if required else clean up the fRecTracksPtr array
601 if (!GetRecoParam()->TrackAllTracks()) {
602 if (foundOneCluster) {
603 UpdateTrack(trackCandidate,bestTrackParamAtCluster,bestAddChi2TrackAtCluster);
605 // Printout for debuging
606 if ((AliLog::GetDebugLevel("MUON","AliMUONTrackReconstructorK") >= 1) || (AliLog::GetGlobalDebugLevel() >= 1)) {
607 cout << "FollowTrackInChamber: added the best cluster in chamber(1..): " << bestTrackParamAtCluster.GetClusterPtr()->GetChamberId()+1 << endl;
608 if (AliLog::GetGlobalDebugLevel() >= 3) newTrack->RecursiveDump();
611 } else return kFALSE;
613 } else if (foundOneCluster) {
615 // remove obsolete track
616 fRecTracksPtr->Remove(&trackCandidate);
619 } else return kFALSE;
625 //__________________________________________________________________________
626 Bool_t AliMUONTrackReconstructorK::FollowTrackInStation(AliMUONTrack &trackCandidate, AliMUONVClusterStore& clusterStore, Int_t nextStation)
628 /// Follow trackCandidate in station(0..) nextStation and search for compatible cluster(s)
629 /// Keep all possibilities or only the best one(s) according to the flag fgkTrackAllTracks:
630 /// kTRUE: duplicate "trackCandidate" if there are several possibilities and add the new tracks at the end of
631 /// fRecTracksPtr to avoid conficts with other track candidates at this current stage of the tracking procedure.
632 /// Remove the obsolete "trackCandidate" at the end.
633 /// kFALSE: add only the best cluster(s) to the "trackCandidate". Try to add a couple of clusters in priority.
634 /// return kTRUE if new cluster(s) have been found (otherwise return kFALSE)
635 AliDebug(1,Form("Enter FollowTrackInStation(1..) %d", nextStation+1));
637 // Order the chamber according to the propagation direction (tracking starts with chamber 2):
638 // - nextStation == station(1...) 5 => forward propagation
639 // - nextStation < station(1...) 5 => backward propagation
641 if (nextStation==4) {
642 ch1 = 2*nextStation+1;
646 ch2 = 2*nextStation+1;
649 Double_t bendingMomentum;
650 Double_t chi2OfCluster;
651 Double_t maxChi2OfCluster = 2. * GetRecoParam()->GetSigmaCutForTracking() *
652 GetRecoParam()->GetSigmaCutForTracking(); // 2 because 2 quantities in chi2
653 Double_t addChi2TrackAtCluster1;
654 Double_t addChi2TrackAtCluster2;
655 Double_t bestAddChi2TrackAtCluster1 = 1.e10;
656 Double_t bestAddChi2TrackAtCluster2 = 1.e10;
657 Bool_t foundOneCluster = kFALSE;
658 Bool_t foundTwoClusters = kFALSE;
659 AliMUONTrack *newTrack = 0x0;
660 AliMUONVCluster *clusterCh1, *clusterCh2;
661 AliMUONTrackParam extrapTrackParam;
662 AliMUONTrackParam extrapTrackParamAtCh;
663 AliMUONTrackParam extrapTrackParamAtCluster1;
664 AliMUONTrackParam extrapTrackParamAtCluster2;
665 AliMUONTrackParam bestTrackParamAtCluster1;
666 AliMUONTrackParam bestTrackParamAtCluster2;
668 Int_t nClusters = clusterStore.GetSize();
669 Bool_t *clusterCh1Used = new Bool_t[nClusters];
670 for (Int_t i = 0; i < nClusters; i++) clusterCh1Used[i] = kFALSE;
673 // Get track parameters according to the propagation direction
675 if (nextStation==4) extrapTrackParamAtCh = *(AliMUONTrackParam*)trackCandidate.GetTrackParamAtCluster()->Last();
676 else extrapTrackParamAtCh = *(AliMUONTrackParam*)trackCandidate.GetTrackParamAtCluster()->First();
678 // Printout for debuging
679 if ((AliLog::GetDebugLevel("MUON","AliMUONTrackReconstructorK") >= 2) || (AliLog::GetGlobalDebugLevel() >= 2)) {
680 cout<<endl<<"Track parameters and covariances at first cluster:"<<endl;
681 extrapTrackParamAtCh.GetParameters().Print();
682 extrapTrackParamAtCh.GetCovariances().Print();
686 AliMUONTrackExtrap::AddMCSEffect(&extrapTrackParamAtCh,AliMUONConstants::ChamberThicknessInX0(),1.);
688 // reset propagator for smoother
689 if (GetRecoParam()->UseSmoother()) extrapTrackParamAtCh.ResetPropagator();
691 // Add MCS in the missing chamber(s) if any
692 Int_t currentChamber = extrapTrackParamAtCh.GetClusterPtr()->GetChamberId();
693 while (ch1 < ch2 && currentChamber > ch2 + 1) {
694 // extrapolation to the missing chamber
696 AliMUONTrackExtrap::ExtrapToZCov(&extrapTrackParamAtCh, AliMUONConstants::DefaultChamberZ(currentChamber),
697 GetRecoParam()->UseSmoother());
699 AliMUONTrackExtrap::AddMCSEffect(&extrapTrackParamAtCh,AliMUONConstants::ChamberThicknessInX0(),1.);
702 //Extrapolate trackCandidate to chamber "ch2"
703 AliMUONTrackExtrap::ExtrapToZCov(&extrapTrackParamAtCh, AliMUONConstants::DefaultChamberZ(ch2),
704 GetRecoParam()->UseSmoother());
706 // Printout for debuging
707 if ((AliLog::GetDebugLevel("MUON","AliMUONTrackReconstructorK") >= 2) || (AliLog::GetGlobalDebugLevel() >= 2)) {
708 cout<<endl<<"Track parameters and covariances at first cluster extrapolated to z = "<<AliMUONConstants::DefaultChamberZ(ch2)<<":"<<endl;
709 extrapTrackParamAtCh.GetParameters().Print();
710 extrapTrackParamAtCh.GetCovariances().Print();
713 // Printout for debuging
714 if ((AliLog::GetDebugLevel("MUON","AliMUONTrackReconstructorK") >= 1) || (AliLog::GetGlobalDebugLevel() >= 1)) {
715 cout << "FollowTrackInStation: look for clusters in chamber(1..): " << ch2+1 << endl;
718 // Ask the clustering to reconstruct new clusters around the track position in the current station
719 // except for station 4 and 5 that are already entirely clusterized
720 if (GetRecoParam()->CombineClusterTrackReco()) {
721 if (nextStation < 3) AskForNewClustersInStation(extrapTrackParamAtCh, clusterStore, nextStation);
724 // Create iterators to loop over clusters in both chambers
725 TIter nextInCh1(clusterStore.CreateChamberIterator(ch1,ch1));
726 TIter nextInCh2(clusterStore.CreateChamberIterator(ch2,ch2));
728 // look for candidates in chamber 2
729 while ( ( clusterCh2 = static_cast<AliMUONVCluster*>(nextInCh2()) ) ) {
731 // try to add the current cluster fast
732 if (!TryOneClusterFast(extrapTrackParamAtCh, clusterCh2)) continue;
734 // try to add the current cluster accuratly
735 chi2OfCluster = TryOneCluster(extrapTrackParamAtCh, clusterCh2, extrapTrackParamAtCluster2,
736 GetRecoParam()->UseSmoother());
738 // if good chi2 then try to attach a cluster in the other chamber too
739 if (chi2OfCluster < maxChi2OfCluster) {
740 Bool_t foundSecondCluster = kFALSE;
742 // Printout for debuging
743 if ((AliLog::GetDebugLevel("MUON","AliMUONTrackReconstructorK") >= 1) || (AliLog::GetGlobalDebugLevel() >= 1)) {
744 cout << "FollowTrackInStation: found one cluster in chamber(1..): " << ch2+1
745 << " (Chi2 = " << chi2OfCluster << ")" << endl;
747 cout << " look for second clusters in chamber(1..): " << ch1+1 << " ..." << endl;
750 if (GetRecoParam()->UseSmoother()) {
751 // save extrapolated parameters for smoother
752 extrapTrackParamAtCluster2.SetExtrapParameters(extrapTrackParamAtCluster2.GetParameters());
754 // save extrapolated covariance matrix for smoother
755 extrapTrackParamAtCluster2.SetExtrapCovariances(extrapTrackParamAtCluster2.GetCovariances());
758 // Compute new track parameters including "clusterCh2" using kalman filter
759 addChi2TrackAtCluster2 = RunKalmanFilter(extrapTrackParamAtCluster2);
761 // skip track with absolute bending momentum out of limits
762 bendingMomentum = TMath::Abs(1. / extrapTrackParamAtCluster2.GetInverseBendingMomentum());
763 if (bendingMomentum < GetRecoParam()->GetMinBendingMomentum() ||
764 bendingMomentum > GetRecoParam()->GetMaxBendingMomentum()) continue;
766 // copy new track parameters for next step
767 extrapTrackParam = extrapTrackParamAtCluster2;
770 AliMUONTrackExtrap::AddMCSEffect(&extrapTrackParam,AliMUONConstants::ChamberThicknessInX0(),1.);
772 // reset propagator for smoother
773 if (GetRecoParam()->UseSmoother()) extrapTrackParam.ResetPropagator();
775 //Extrapolate track parameters to chamber "ch1"
776 AliMUONTrackExtrap::ExtrapToZCov(&extrapTrackParam, AliMUONConstants::DefaultChamberZ(ch1),
777 GetRecoParam()->UseSmoother());
779 // reset cluster iterator of chamber 1
783 // look for second candidates in chamber 1
784 while ( ( clusterCh1 = static_cast<AliMUONVCluster*>(nextInCh1()) ) ) {
787 // try to add the current cluster fast
788 if (!TryOneClusterFast(extrapTrackParam, clusterCh1)) continue;
790 // try to add the current cluster accuratly
791 chi2OfCluster = TryOneCluster(extrapTrackParam, clusterCh1, extrapTrackParamAtCluster1,
792 GetRecoParam()->UseSmoother());
794 // if good chi2 then consider to add the 2 clusters to the "trackCandidate"
795 if (chi2OfCluster < maxChi2OfCluster) {
796 foundSecondCluster = kTRUE;
797 foundTwoClusters = kTRUE;
799 // Printout for debuging
800 if ((AliLog::GetDebugLevel("MUON","AliMUONTrackReconstructorK") >= 1) || (AliLog::GetGlobalDebugLevel() >= 1)) {
801 cout << "FollowTrackInStation: found one cluster in chamber(1..): " << ch1+1
802 << " (Chi2 = " << chi2OfCluster << ")" << endl;
806 if (GetRecoParam()->UseSmoother()) {
807 // save extrapolated parameters for smoother
808 extrapTrackParamAtCluster1.SetExtrapParameters(extrapTrackParamAtCluster1.GetParameters());
810 // save extrapolated covariance matrix for smoother
811 extrapTrackParamAtCluster1.SetExtrapCovariances(extrapTrackParamAtCluster1.GetCovariances());
814 // Compute new track parameters including "clusterCh1" using kalman filter
815 addChi2TrackAtCluster1 = RunKalmanFilter(extrapTrackParamAtCluster1);
817 // skip track with absolute bending momentum out of limits
818 bendingMomentum = TMath::Abs(1. / extrapTrackParamAtCluster1.GetInverseBendingMomentum());
819 if (bendingMomentum < GetRecoParam()->GetMinBendingMomentum() ||
820 bendingMomentum > GetRecoParam()->GetMaxBendingMomentum()) continue;
822 if (GetRecoParam()->TrackAllTracks()) {
823 // copy trackCandidate into a new track put at the end of fRecTracksPtr and add the new clusters
824 newTrack = new ((*fRecTracksPtr)[fRecTracksPtr->GetLast()+1]) AliMUONTrack(trackCandidate);
825 UpdateTrack(*newTrack,extrapTrackParamAtCluster1,extrapTrackParamAtCluster2,addChi2TrackAtCluster1,addChi2TrackAtCluster2);
828 // if we are arrived on station(1..) 5, recompute track parameters and covariances starting from this station
829 // (going in the right direction)
830 if (nextStation == 4) RetraceTrack(*newTrack,kTRUE);
832 // Tag clusterCh1 as used
833 clusterCh1Used[iCluster1] = kTRUE;
835 // Printout for debuging
836 if ((AliLog::GetDebugLevel("MUON","AliMUONTrackReconstructorK") >= 1) || (AliLog::GetGlobalDebugLevel() >= 1)) {
837 cout << "FollowTrackInStation: added two clusters in station(1..): " << nextStation+1 << endl;
838 if (AliLog::GetGlobalDebugLevel() >= 3) newTrack->RecursiveDump();
841 } else if (addChi2TrackAtCluster1+addChi2TrackAtCluster2 < bestAddChi2TrackAtCluster1+bestAddChi2TrackAtCluster2) {
842 // keep track of the best couple of clusters
843 bestAddChi2TrackAtCluster1 = addChi2TrackAtCluster1;
844 bestAddChi2TrackAtCluster2 = addChi2TrackAtCluster2;
845 bestTrackParamAtCluster1 = extrapTrackParamAtCluster1;
846 bestTrackParamAtCluster2 = extrapTrackParamAtCluster2;
853 // if no clusterCh1 found then consider to add clusterCh2 only
854 if (!foundSecondCluster) {
855 foundOneCluster = kTRUE;
857 if (GetRecoParam()->TrackAllTracks()) {
858 // copy trackCandidate into a new track put at the end of fRecTracksPtr and add the new cluster
859 newTrack = new ((*fRecTracksPtr)[fRecTracksPtr->GetLast()+1]) AliMUONTrack(trackCandidate);
860 UpdateTrack(*newTrack,extrapTrackParamAtCluster2,addChi2TrackAtCluster2);
863 // if we are arrived on station(1..) 5, recompute track parameters and covariances starting from this station
864 // (going in the right direction)
865 if (nextStation == 4) RetraceTrack(*newTrack,kTRUE);
867 // Printout for debuging
868 if ((AliLog::GetDebugLevel("MUON","AliMUONTrackReconstructorK") >= 1) || (AliLog::GetGlobalDebugLevel() >= 1)) {
869 cout << "FollowTrackInStation: added one cluster in chamber(1..): " << ch2+1 << endl;
870 if (AliLog::GetGlobalDebugLevel() >= 3) newTrack->RecursiveDump();
873 } else if (!foundTwoClusters && addChi2TrackAtCluster2 < bestAddChi2TrackAtCluster1) {
874 // keep track of the best single cluster except if a couple of clusters has already been found
875 bestAddChi2TrackAtCluster1 = addChi2TrackAtCluster2;
876 bestTrackParamAtCluster1 = extrapTrackParamAtCluster2;
885 // look for candidates in chamber 1 not already attached to a track
886 // if we want to keep all possible tracks or if no good couple of clusters has been found
887 if (GetRecoParam()->TrackAllTracks() || !foundTwoClusters) {
889 // add MCS effect for next step
890 AliMUONTrackExtrap::AddMCSEffect(&extrapTrackParamAtCh,AliMUONConstants::ChamberThicknessInX0(),1.);
892 //Extrapolate trackCandidate to chamber "ch1"
893 AliMUONTrackExtrap::ExtrapToZCov(&extrapTrackParamAtCh, AliMUONConstants::DefaultChamberZ(ch1),
894 GetRecoParam()->UseSmoother());
896 // Printout for debuging
897 if ((AliLog::GetDebugLevel("MUON","AliMUONTrackReconstructorK") >= 2) || (AliLog::GetGlobalDebugLevel() >= 2)) {
898 cout<<endl<<"Track parameters and covariances at first cluster extrapolated to z = "<<AliMUONConstants::DefaultChamberZ(ch1)<<":"<<endl;
899 extrapTrackParamAtCh.GetParameters().Print();
900 extrapTrackParamAtCh.GetCovariances().Print();
903 // Printout for debuging
904 if ((AliLog::GetDebugLevel("MUON","AliMUONTrackReconstructorK") >= 1) || (AliLog::GetGlobalDebugLevel() >= 1)) {
905 cout << "FollowTrackInStation: look for single clusters in chamber(1..): " << ch1+1 << endl;
908 // reset cluster iterator of chamber 1
912 // look for second candidates in chamber 1
913 while ( ( clusterCh1 = static_cast<AliMUONVCluster*>(nextInCh1()) ) ) {
916 if (clusterCh1Used[iCluster1]) continue; // Skip clusters already used
918 // try to add the current cluster fast
919 if (!TryOneClusterFast(extrapTrackParamAtCh, clusterCh1)) continue;
921 // try to add the current cluster accuratly
922 chi2OfCluster = TryOneCluster(extrapTrackParamAtCh, clusterCh1, extrapTrackParamAtCluster1,
923 GetRecoParam()->UseSmoother());
925 // if good chi2 then consider to add clusterCh1
926 // We do not try to attach a cluster in the other chamber too since it has already been done above
927 if (chi2OfCluster < maxChi2OfCluster) {
928 foundOneCluster = kTRUE;
930 // Printout for debuging
931 if ((AliLog::GetDebugLevel("MUON","AliMUONTrackReconstructorK") >= 1) || (AliLog::GetGlobalDebugLevel() >= 1)) {
932 cout << "FollowTrackInStation: found one cluster in chamber(1..): " << ch1+1
933 << " (Chi2 = " << chi2OfCluster << ")" << endl;
937 if (GetRecoParam()->UseSmoother()) {
938 // save extrapolated parameters for smoother
939 extrapTrackParamAtCluster1.SetExtrapParameters(extrapTrackParamAtCluster1.GetParameters());
941 // save extrapolated covariance matrix for smoother
942 extrapTrackParamAtCluster1.SetExtrapCovariances(extrapTrackParamAtCluster1.GetCovariances());
945 // Compute new track parameters including "clusterCh1" using kalman filter
946 addChi2TrackAtCluster1 = RunKalmanFilter(extrapTrackParamAtCluster1);
948 // skip track with absolute bending momentum out of limits
949 bendingMomentum = TMath::Abs(1. / extrapTrackParamAtCluster1.GetInverseBendingMomentum());
950 if (bendingMomentum < GetRecoParam()->GetMinBendingMomentum() ||
951 bendingMomentum > GetRecoParam()->GetMaxBendingMomentum()) continue;
953 if (GetRecoParam()->TrackAllTracks()) {
954 // copy trackCandidate into a new track put at the end of fRecTracksPtr and add the new cluster
955 newTrack = new ((*fRecTracksPtr)[fRecTracksPtr->GetLast()+1]) AliMUONTrack(trackCandidate);
956 UpdateTrack(*newTrack,extrapTrackParamAtCluster1,addChi2TrackAtCluster1);
959 // if we are arrived on station(1..) 5, recompute track parameters and covariances starting from this station
960 // (going in the right direction)
961 if (nextStation == 4) RetraceTrack(*newTrack,kTRUE);
963 // Printout for debuging
964 if ((AliLog::GetDebugLevel("MUON","AliMUONTrackReconstructorK") >= 1) || (AliLog::GetGlobalDebugLevel() >= 1)) {
965 cout << "FollowTrackInStation: added one cluster in chamber(1..): " << ch1+1 << endl;
966 if (AliLog::GetGlobalDebugLevel() >= 3) newTrack->RecursiveDump();
969 } else if (addChi2TrackAtCluster1 < bestAddChi2TrackAtCluster1) {
970 // keep track of the best single cluster except if a couple of clusters has already been found
971 bestAddChi2TrackAtCluster1 = addChi2TrackAtCluster1;
972 bestTrackParamAtCluster1 = extrapTrackParamAtCluster1;
981 // fill out the best track if required else clean up the fRecTracksPtr array
982 if (!GetRecoParam()->TrackAllTracks()) {
983 if (foundTwoClusters) {
984 UpdateTrack(trackCandidate,bestTrackParamAtCluster1,bestTrackParamAtCluster2,bestAddChi2TrackAtCluster1,bestAddChi2TrackAtCluster2);
986 // if we are arrived on station(1..) 5, recompute track parameters and covariances starting from this station
987 // (going in the right direction)
988 if (nextStation == 4) RetraceTrack(trackCandidate,kTRUE);
990 // Printout for debuging
991 if ((AliLog::GetDebugLevel("MUON","AliMUONTrackReconstructorK") >= 1) || (AliLog::GetGlobalDebugLevel() >= 1)) {
992 cout << "FollowTrackInStation: added the two best clusters in station(1..): " << nextStation+1 << endl;
993 if (AliLog::GetGlobalDebugLevel() >= 3) newTrack->RecursiveDump();
996 } else if (foundOneCluster) {
997 UpdateTrack(trackCandidate,bestTrackParamAtCluster1,bestAddChi2TrackAtCluster1);
999 // if we are arrived on station(1..) 5, recompute track parameters and covariances starting from this station
1000 // (going in the right direction)
1001 if (nextStation == 4) RetraceTrack(trackCandidate,kTRUE);
1003 // Printout for debuging
1004 if ((AliLog::GetDebugLevel("MUON","AliMUONTrackReconstructorK") >= 1) || (AliLog::GetGlobalDebugLevel() >= 1)) {
1005 cout << "FollowTrackInStation: added the best cluster in chamber(1..): " << bestTrackParamAtCluster1.GetClusterPtr()->GetChamberId()+1 << endl;
1006 if (AliLog::GetGlobalDebugLevel() >= 3) newTrack->RecursiveDump();
1010 delete [] clusterCh1Used;
1014 } else if (foundOneCluster || foundTwoClusters) {
1016 // remove obsolete track
1017 fRecTracksPtr->Remove(&trackCandidate);
1021 delete [] clusterCh1Used;
1025 delete [] clusterCh1Used;
1030 //__________________________________________________________________________
1031 Double_t AliMUONTrackReconstructorK::RunKalmanFilter(AliMUONTrackParam &trackParamAtCluster)
1033 /// Compute new track parameters and their covariances including new cluster using kalman filter
1034 /// return the additional track chi2
1035 AliDebug(1,"Enter RunKalmanFilter");
1037 // Get actual track parameters (p)
1038 TMatrixD param(trackParamAtCluster.GetParameters());
1040 // Get new cluster parameters (m)
1041 AliMUONVCluster *cluster = trackParamAtCluster.GetClusterPtr();
1042 TMatrixD clusterParam(5,1);
1043 clusterParam.Zero();
1044 clusterParam(0,0) = cluster->GetX();
1045 clusterParam(2,0) = cluster->GetY();
1047 // Compute the actual parameter weight (W)
1048 TMatrixD paramWeight(trackParamAtCluster.GetCovariances());
1049 if (paramWeight.Determinant() != 0) {
1050 paramWeight.Invert();
1052 AliWarning(" Determinant = 0");
1056 // Compute the new cluster weight (U)
1057 TMatrixD clusterWeight(5,5);
1058 clusterWeight.Zero();
1059 clusterWeight(0,0) = 1. / cluster->GetErrX2();
1060 clusterWeight(2,2) = 1. / cluster->GetErrY2();
1062 // Compute the new parameters covariance matrix ( (W+U)^-1 )
1063 TMatrixD newParamCov(paramWeight,TMatrixD::kPlus,clusterWeight);
1064 if (newParamCov.Determinant() != 0) {
1065 newParamCov.Invert();
1067 AliWarning(" Determinant = 0");
1071 // Save the new parameters covariance matrix
1072 trackParamAtCluster.SetCovariances(newParamCov);
1074 // Compute the new parameters (p' = ((W+U)^-1)U(m-p) + p)
1075 TMatrixD tmp(clusterParam,TMatrixD::kMinus,param);
1076 TMatrixD tmp2(clusterWeight,TMatrixD::kMult,tmp); // U(m-p)
1077 TMatrixD newParam(newParamCov,TMatrixD::kMult,tmp2); // ((W+U)^-1)U(m-p)
1078 newParam += param; // ((W+U)^-1)U(m-p) + p
1080 // Save the new parameters
1081 trackParamAtCluster.SetParameters(newParam);
1083 // Compute the additional chi2 (= ((p'-p)^-1)W(p'-p) + ((p'-m)^-1)U(p'-m))
1084 tmp = newParam; // p'
1085 tmp -= param; // (p'-p)
1086 TMatrixD tmp3(paramWeight,TMatrixD::kMult,tmp); // W(p'-p)
1087 TMatrixD addChi2Track(tmp,TMatrixD::kTransposeMult,tmp3); // ((p'-p)^-1)W(p'-p)
1088 tmp = newParam; // p'
1089 tmp -= clusterParam; // (p'-m)
1090 TMatrixD tmp4(clusterWeight,TMatrixD::kMult,tmp); // U(p'-m)
1091 addChi2Track += TMatrixD(tmp,TMatrixD::kTransposeMult,tmp4); // ((p'-p)^-1)W(p'-p) + ((p'-m)^-1)U(p'-m)
1093 return addChi2Track(0,0);
1097 //__________________________________________________________________________
1098 void AliMUONTrackReconstructorK::UpdateTrack(AliMUONTrack &track, AliMUONTrackParam &trackParamAtCluster, Double_t addChi2)
1100 /// Add 1 cluster to the track candidate
1101 /// Update chi2 of the track
1103 // Flag cluster as being (not) removable
1104 if (GetRecoParam()->RequestStation(trackParamAtCluster.GetClusterPtr()->GetChamberId()/2))
1105 trackParamAtCluster.SetRemovable(kFALSE);
1106 else trackParamAtCluster.SetRemovable(kTRUE);
1107 trackParamAtCluster.SetLocalChi2(0.); // --> Local chi2 not used
1109 // Update the track chi2 into trackParamAtCluster
1110 trackParamAtCluster.SetTrackChi2(track.GetGlobalChi2() + addChi2);
1112 // Update the chi2 of the new track
1113 track.SetGlobalChi2(trackParamAtCluster.GetTrackChi2());
1115 // Update array of TrackParamAtCluster
1116 track.AddTrackParamAtCluster(trackParamAtCluster,*(trackParamAtCluster.GetClusterPtr()));
1120 //__________________________________________________________________________
1121 void AliMUONTrackReconstructorK::UpdateTrack(AliMUONTrack &track, AliMUONTrackParam &trackParamAtCluster1, AliMUONTrackParam &trackParamAtCluster2,
1122 Double_t addChi2AtCluster1, Double_t addChi2AtCluster2)
1124 /// Add 2 clusters to the track candidate (order is important)
1125 /// Update track and local chi2
1127 // Update local chi2 at first cluster
1128 AliMUONVCluster* cluster1 = trackParamAtCluster1.GetClusterPtr();
1129 Double_t deltaX = trackParamAtCluster1.GetNonBendingCoor() - cluster1->GetX();
1130 Double_t deltaY = trackParamAtCluster1.GetBendingCoor() - cluster1->GetY();
1131 Double_t localChi2AtCluster1 = deltaX*deltaX / cluster1->GetErrX2() +
1132 deltaY*deltaY / cluster1->GetErrY2();
1133 trackParamAtCluster1.SetLocalChi2(localChi2AtCluster1);
1135 // Flag first cluster as being removable
1136 trackParamAtCluster1.SetRemovable(kTRUE);
1138 // Update local chi2 at second cluster
1139 AliMUONVCluster* cluster2 = trackParamAtCluster2.GetClusterPtr();
1140 AliMUONTrackParam extrapTrackParamAtCluster2(trackParamAtCluster1);
1141 AliMUONTrackExtrap::ExtrapToZ(&extrapTrackParamAtCluster2, trackParamAtCluster2.GetZ());
1142 deltaX = extrapTrackParamAtCluster2.GetNonBendingCoor() - cluster2->GetX();
1143 deltaY = extrapTrackParamAtCluster2.GetBendingCoor() - cluster2->GetY();
1144 Double_t localChi2AtCluster2 = deltaX*deltaX / cluster2->GetErrX2() +
1145 deltaY*deltaY / cluster2->GetErrY2();
1146 trackParamAtCluster2.SetLocalChi2(localChi2AtCluster2);
1148 // Flag second cluster as being removable
1149 trackParamAtCluster2.SetRemovable(kTRUE);
1151 // Update the track chi2 into trackParamAtCluster2
1152 trackParamAtCluster2.SetTrackChi2(track.GetGlobalChi2() + addChi2AtCluster2);
1154 // Update the track chi2 into trackParamAtCluster1
1155 trackParamAtCluster1.SetTrackChi2(trackParamAtCluster2.GetTrackChi2() + addChi2AtCluster1);
1157 // Update the chi2 of the new track
1158 track.SetGlobalChi2(trackParamAtCluster1.GetTrackChi2());
1160 // Update array of trackParamAtCluster
1161 track.AddTrackParamAtCluster(trackParamAtCluster1,*cluster1);
1162 track.AddTrackParamAtCluster(trackParamAtCluster2,*cluster2);
1166 //__________________________________________________________________________
1167 Bool_t AliMUONTrackReconstructorK::RecoverTrack(AliMUONTrack &trackCandidate, AliMUONVClusterStore& clusterStore, Int_t nextStation)
1169 /// Try to recover the track candidate in the next station
1170 /// by removing the worst of the two clusters attached in the current station
1171 /// Return kTRUE if recovering succeeds
1172 AliDebug(1,"Enter RecoverTrack");
1174 // Do not try to recover track until we have attached cluster(s) on station(1..) 3
1175 if (nextStation > 1) return kFALSE;
1177 Int_t worstClusterNumber = -1;
1178 Double_t localChi2, worstLocalChi2 = -1.;
1180 // Look for the cluster to remove
1181 for (Int_t clusterNumber = 0; clusterNumber < 2; clusterNumber++) {
1182 AliMUONTrackParam *trackParamAtCluster = (AliMUONTrackParam*)trackCandidate.GetTrackParamAtCluster()->UncheckedAt(clusterNumber);
1184 // check if current cluster is in the previous station
1185 if (trackParamAtCluster->GetClusterPtr()->GetChamberId()/2 != nextStation+1) break;
1187 // check if current cluster is removable
1188 if (!trackParamAtCluster->IsRemovable()) return kFALSE;
1190 // reset the current cluster as being not removable if it is on a required station
1191 if (GetRecoParam()->RequestStation(nextStation+1)) trackParamAtCluster->SetRemovable(kFALSE);
1193 // Pick up cluster with the worst chi2
1194 localChi2 = trackParamAtCluster->GetLocalChi2();
1195 if (localChi2 > worstLocalChi2) {
1196 worstLocalChi2 = localChi2;
1197 worstClusterNumber = clusterNumber;
1201 // check if worst cluster found
1202 if (worstClusterNumber < 0) return kFALSE;
1204 // Remove the worst cluster
1205 trackCandidate.RemoveTrackParamAtCluster((AliMUONTrackParam*)trackCandidate.GetTrackParamAtCluster()->UncheckedAt(worstClusterNumber));
1207 // Re-calculate track parameters at the (new) first cluster
1208 RetracePartialTrack(trackCandidate,(AliMUONTrackParam*)trackCandidate.GetTrackParamAtCluster()->UncheckedAt(1));
1210 // skip track with absolute bending momentum out of limits
1211 Double_t bendingMomentum = TMath::Abs(1. / ((AliMUONTrackParam*)trackCandidate.GetTrackParamAtCluster()->First())->GetInverseBendingMomentum());
1212 if (bendingMomentum < GetRecoParam()->GetMinBendingMomentum() ||
1213 bendingMomentum > GetRecoParam()->GetMaxBendingMomentum()) return kFALSE;
1215 // Look for new cluster(s) in next station
1216 return FollowTrackInStation(trackCandidate, clusterStore, nextStation);
1220 //__________________________________________________________________________
1221 Bool_t AliMUONTrackReconstructorK::RunSmoother(AliMUONTrack &track)
1223 /// Compute new track parameters and their covariances using smoother
1224 AliDebug(1,"Enter UseSmoother");
1226 AliMUONTrackParam *previousTrackParam = (AliMUONTrackParam*) track.GetTrackParamAtCluster()->First();
1228 // Smoothed parameters and covariances at first cluster = filtered parameters and covariances
1229 previousTrackParam->SetSmoothParameters(previousTrackParam->GetParameters());
1230 previousTrackParam->SetSmoothCovariances(previousTrackParam->GetCovariances());
1232 // Compute local chi2 at first cluster
1233 AliMUONVCluster *cluster = previousTrackParam->GetClusterPtr();
1234 Double_t dX = cluster->GetX() - previousTrackParam->GetNonBendingCoor();
1235 Double_t dY = cluster->GetY() - previousTrackParam->GetBendingCoor();
1236 Double_t chi2 = dX * dX / cluster->GetErrX2() + dY * dY / cluster->GetErrY2();
1238 // Save local chi2 at first cluster
1239 previousTrackParam->SetLocalChi2(chi2);
1241 AliMUONTrackParam *currentTrackParam = (AliMUONTrackParam*) track.GetTrackParamAtCluster()->After(previousTrackParam);
1242 while (currentTrackParam) {
1245 const TMatrixD &extrapParameters = previousTrackParam->GetExtrapParameters(); // X(k+1 k)
1246 const TMatrixD &filteredParameters = currentTrackParam->GetParameters(); // X(k k)
1247 const TMatrixD &previousSmoothParameters = previousTrackParam->GetSmoothParameters(); // X(k+1 n)
1248 const TMatrixD &propagator = previousTrackParam->GetPropagator(); // F(k)
1249 const TMatrixD &extrapCovariances = previousTrackParam->GetExtrapCovariances(); // C(k+1 k)
1250 const TMatrixD &filteredCovariances = currentTrackParam->GetCovariances(); // C(k k)
1251 const TMatrixD &previousSmoothCovariances = previousTrackParam->GetSmoothCovariances(); // C(k+1 n)
1253 // Compute smoother gain: A(k) = C(kk) * F(f)^t * (C(k+1 k))^-1
1254 TMatrixD extrapWeight(extrapCovariances);
1255 if (extrapWeight.Determinant() != 0) {
1256 extrapWeight.Invert(); // (C(k+1 k))^-1
1258 AliWarning(" Determinant = 0");
1261 TMatrixD smootherGain(filteredCovariances,TMatrixD::kMultTranspose,propagator); // C(kk) * F(f)^t
1262 smootherGain *= extrapWeight; // C(kk) * F(f)^t * (C(k+1 k))^-1
1264 // Compute smoothed parameters: X(k n) = X(k k) + A(k) * (X(k+1 n) - X(k+1 k))
1265 TMatrixD tmpParam(previousSmoothParameters,TMatrixD::kMinus,extrapParameters); // X(k+1 n) - X(k+1 k)
1266 TMatrixD smoothParameters(smootherGain,TMatrixD::kMult,tmpParam); // A(k) * (X(k+1 n) - X(k+1 k))
1267 smoothParameters += filteredParameters; // X(k k) + A(k) * (X(k+1 n) - X(k+1 k))
1269 // Save smoothed parameters
1270 currentTrackParam->SetSmoothParameters(smoothParameters);
1272 // Compute smoothed covariances: C(k n) = C(k k) + A(k) * (C(k+1 n) - C(k+1 k)) * (A(k))^t
1273 TMatrixD tmpCov(previousSmoothCovariances,TMatrixD::kMinus,extrapCovariances); // C(k+1 n) - C(k+1 k)
1274 TMatrixD tmpCov2(tmpCov,TMatrixD::kMultTranspose,smootherGain); // (C(k+1 n) - C(k+1 k)) * (A(k))^t
1275 TMatrixD smoothCovariances(smootherGain,TMatrixD::kMult,tmpCov2); // A(k) * (C(k+1 n) - C(k+1 k)) * (A(k))^t
1276 smoothCovariances += filteredCovariances; // C(k k) + A(k) * (C(k+1 n) - C(k+1 k)) * (A(k))^t
1278 // Save smoothed covariances
1279 currentTrackParam->SetSmoothCovariances(smoothCovariances);
1281 // Compute smoothed residual: r(k n) = cluster - X(k n)
1282 cluster = currentTrackParam->GetClusterPtr();
1283 TMatrixD smoothResidual(2,1);
1284 smoothResidual.Zero();
1285 smoothResidual(0,0) = cluster->GetX() - smoothParameters(0,0);
1286 smoothResidual(1,0) = cluster->GetY() - smoothParameters(2,0);
1288 // Compute weight of smoothed residual: W(k n) = (clusterCov - C(k n))^-1
1289 TMatrixD smoothResidualWeight(2,2);
1290 smoothResidualWeight(0,0) = cluster->GetErrX2() - smoothCovariances(0,0);
1291 smoothResidualWeight(0,1) = - smoothCovariances(0,2);
1292 smoothResidualWeight(1,0) = - smoothCovariances(2,0);
1293 smoothResidualWeight(1,1) = cluster->GetErrY2() - smoothCovariances(2,2);
1294 if (smoothResidualWeight.Determinant() != 0) {
1295 smoothResidualWeight.Invert();
1297 AliWarning(" Determinant = 0");
1301 // Compute local chi2 = (r(k n))^t * W(k n) * r(k n)
1302 TMatrixD tmpChi2(smoothResidual,TMatrixD::kTransposeMult,smoothResidualWeight); // (r(k n))^t * W(k n)
1303 TMatrixD localChi2(tmpChi2,TMatrixD::kMult,smoothResidual); // (r(k n))^t * W(k n) * r(k n)
1306 currentTrackParam->SetLocalChi2(localChi2(0,0));
1308 previousTrackParam = currentTrackParam;
1309 currentTrackParam = (AliMUONTrackParam*) track.GetTrackParamAtCluster()->After(previousTrackParam);
1316 //__________________________________________________________________________
1317 void AliMUONTrackReconstructorK::ComplementTracks(const AliMUONVClusterStore& clusterStore)
1319 /// Complete tracks by adding missing clusters (if there is an overlap between
1320 /// two detection elements, the track may have two clusters in the same chamber)
1321 /// Recompute track parameters and covariances at each clusters
1322 AliDebug(1,"Enter ComplementTracks");
1324 Int_t chamberId, detElemId;
1325 Double_t chi2OfCluster, addChi2TrackAtCluster, bestAddChi2TrackAtCluster;
1326 Double_t maxChi2OfCluster = 2. * GetRecoParam()->GetSigmaCutForTracking() *
1327 GetRecoParam()->GetSigmaCutForTracking(); // 2 because 2 quantities in chi2
1328 Bool_t foundOneCluster, trackModified;
1329 AliMUONVCluster *cluster;
1330 AliMUONTrackParam *trackParam, *previousTrackParam, *nextTrackParam, trackParamAtCluster, bestTrackParamAtCluster;
1332 AliMUONTrack *track = (AliMUONTrack*) fRecTracksPtr->First();
1334 trackModified = kFALSE;
1336 trackParam = (AliMUONTrackParam*)track->GetTrackParamAtCluster()->First();
1337 previousTrackParam = trackParam;
1338 while (trackParam) {
1339 foundOneCluster = kFALSE;
1340 bestAddChi2TrackAtCluster = 1.e10;
1341 chamberId = trackParam->GetClusterPtr()->GetChamberId();
1342 detElemId = trackParam->GetClusterPtr()->GetDetElemId();
1344 // prepare nextTrackParam before adding new cluster because of the sorting
1345 nextTrackParam = (AliMUONTrackParam*)track->GetTrackParamAtCluster()->After(trackParam);
1347 // Create iterators to loop over clusters in current chamber
1348 TIter nextInCh(clusterStore.CreateChamberIterator(chamberId,chamberId));
1350 // look for one second candidate in the same chamber
1351 while ( ( cluster = static_cast<AliMUONVCluster*>(nextInCh()) ) ) {
1353 // look for a cluster in another detection element
1354 if (cluster->GetDetElemId() == detElemId) continue;
1356 // try to add the current cluster fast
1357 if (!TryOneClusterFast(*trackParam, cluster)) continue;
1359 // try to add the current cluster accurately
1360 // never use track parameters at last cluster because the covariance matrix is meaningless
1361 if (nextTrackParam) chi2OfCluster = TryOneCluster(*trackParam, cluster, trackParamAtCluster);
1362 else chi2OfCluster = TryOneCluster(*previousTrackParam, cluster, trackParamAtCluster);
1364 // if good chi2 then consider to add this cluster to the track
1365 if (chi2OfCluster < maxChi2OfCluster) {
1367 // Compute local track parameters including current cluster using kalman filter
1368 addChi2TrackAtCluster = RunKalmanFilter(trackParamAtCluster);
1370 // keep track of the best cluster
1371 if (addChi2TrackAtCluster < bestAddChi2TrackAtCluster) {
1372 bestAddChi2TrackAtCluster = addChi2TrackAtCluster;
1373 bestTrackParamAtCluster = trackParamAtCluster;
1374 foundOneCluster = kTRUE;
1381 // add new cluster if any
1382 if (foundOneCluster) {
1384 // Printout for debuging
1385 if ((AliLog::GetDebugLevel("MUON","AliMUONTrackReconstructorK") >= 1) || (AliLog::GetGlobalDebugLevel() >= 1)) {
1386 cout << "ComplementTracks: found one cluster in chamber(1..): " << chamberId+1 << endl;
1387 bestTrackParamAtCluster.GetClusterPtr()->Print();
1388 if ((AliLog::GetDebugLevel("MUON","AliMUONTrackReconstructorK") >= 2) || (AliLog::GetGlobalDebugLevel() >= 2)) {
1389 cout<<endl<<"Track parameters and covariances at cluster:"<<endl;
1390 bestTrackParamAtCluster.GetParameters().Print();
1391 bestTrackParamAtCluster.GetCovariances().Print();
1395 trackParam->SetRemovable(kTRUE);
1396 bestTrackParamAtCluster.SetRemovable(kTRUE);
1397 track->AddTrackParamAtCluster(bestTrackParamAtCluster,*(bestTrackParamAtCluster.GetClusterPtr()));
1398 trackModified = kTRUE;
1401 previousTrackParam = trackParam;
1402 trackParam = nextTrackParam;
1405 // re-compute track parameters using kalman filter if needed
1406 if (trackModified) RetraceTrack(*track,kTRUE);
1408 track = (AliMUONTrack*) fRecTracksPtr->After(track);
1413 //__________________________________________________________________________
1414 void AliMUONTrackReconstructorK::ImproveTrack(AliMUONTrack &track)
1416 /// Improve the given track by removing removable clusters with local chi2 highter than the defined cut
1417 /// Removable clusters are identified by the method AliMUONTrack::TagRemovableClusters()
1418 /// Recompute track parameters and covariances at the remaining clusters
1419 AliDebug(1,"Enter ImproveTrack");
1421 Double_t localChi2, worstLocalChi2;
1422 AliMUONTrackParam *trackParamAtCluster, *worstTrackParamAtCluster, *nextTrackParam;
1424 Double_t sigmaCut2 = GetRecoParam()->GetSigmaCutForImprovement() *
1425 GetRecoParam()->GetSigmaCutForImprovement();
1427 while (!track.IsImproved()) {
1429 // identify removable clusters
1430 track.TagRemovableClusters(GetRecoParam()->RequestedStationMask());
1432 // Run smoother if required
1434 if (GetRecoParam()->UseSmoother()) smoothed = RunSmoother(track);
1436 // Use standard procedure to compute local chi2 if smoother not required or not working
1439 // Update track parameters and covariances
1440 track.UpdateCovTrackParamAtCluster();
1442 // Compute local chi2 of each clusters
1443 track.ComputeLocalChi2(kTRUE);
1446 // Look for the cluster to remove
1447 worstTrackParamAtCluster = 0x0;
1448 worstLocalChi2 = 0.;
1449 trackParamAtCluster = (AliMUONTrackParam*)track.GetTrackParamAtCluster()->First();
1450 while (trackParamAtCluster) {
1452 // save parameters into smooth parameters in case of smoother did not work properly
1453 if (GetRecoParam()->UseSmoother() && !smoothed) {
1454 trackParamAtCluster->SetSmoothParameters(trackParamAtCluster->GetParameters());
1455 trackParamAtCluster->SetSmoothCovariances(trackParamAtCluster->GetCovariances());
1458 // Pick up cluster with the worst chi2
1459 localChi2 = trackParamAtCluster->GetLocalChi2();
1460 if (localChi2 > worstLocalChi2) {
1461 worstLocalChi2 = localChi2;
1462 worstTrackParamAtCluster = trackParamAtCluster;
1465 trackParamAtCluster = (AliMUONTrackParam*)track.GetTrackParamAtCluster()->After(trackParamAtCluster);
1468 // Check if worst cluster found
1469 if (!worstTrackParamAtCluster) {
1470 AliWarning("Bad local chi2 values?");
1474 // Check whether the worst chi2 is under requirement or not
1475 if (worstLocalChi2 < 2. * sigmaCut2) { // 2 because 2 quantities in chi2
1476 track.SetImproved(kTRUE);
1480 // if the worst cluster is not removable then stop improvement
1481 if (!worstTrackParamAtCluster->IsRemovable()) break;
1483 // get track parameters at cluster next to the one to be removed
1484 nextTrackParam = (AliMUONTrackParam*) track.GetTrackParamAtCluster()->After(worstTrackParamAtCluster);
1486 // Remove the worst cluster
1487 track.RemoveTrackParamAtCluster(worstTrackParamAtCluster);
1489 // Re-calculate track parameters
1490 // - from the cluster immediately downstream the one suppressed
1491 // - or from the begining - if parameters have been re-computed using the standard method (kalman parameters have been lost)
1492 // - or if the removed cluster was the last one
1493 if (smoothed && nextTrackParam) RetracePartialTrack(track,nextTrackParam);
1494 else RetraceTrack(track,kTRUE);
1496 // Printout for debuging
1497 if ((AliLog::GetDebugLevel("MUON","AliMUONTrackReconstructorK") >= 1) || (AliLog::GetGlobalDebugLevel() >= 1)) {
1498 cout << "ImproveTracks: track " << fRecTracksPtr->IndexOf(&track)+1 << " improved " << endl;
1505 //__________________________________________________________________________
1506 void AliMUONTrackReconstructorK::FinalizeTrack(AliMUONTrack &track)
1508 /// Update track parameters and covariances at each attached cluster
1509 /// using smoother if required, if not already done
1511 AliMUONTrackParam *trackParamAtCluster;
1512 Bool_t smoothed = kFALSE;
1514 // update track parameters (using smoother if required) if not already done
1515 if (!track.IsImproved()) {
1517 if (GetRecoParam()->UseSmoother()) smoothed = RunSmoother(track);
1518 if (!smoothed) track.UpdateCovTrackParamAtCluster();
1519 } else smoothed = GetRecoParam()->UseSmoother();
1521 // copy smoothed parameters and covariances if any
1524 trackParamAtCluster = (AliMUONTrackParam*) (track.GetTrackParamAtCluster()->First());
1525 while (trackParamAtCluster) {
1527 trackParamAtCluster->SetParameters(trackParamAtCluster->GetSmoothParameters());
1528 trackParamAtCluster->SetCovariances(trackParamAtCluster->GetSmoothCovariances());
1530 trackParamAtCluster = (AliMUONTrackParam*) (track.GetTrackParamAtCluster()->After(trackParamAtCluster));
1537 //__________________________________________________________________________
1538 Bool_t AliMUONTrackReconstructorK::RefitTrack(AliMUONTrack &track, Bool_t enableImprovement)
1540 /// re-fit the given track
1542 // check validity of the track
1543 if (track.GetNClusters() < 3) {
1544 AliWarning("the track does not contain enough clusters --> unable to refit");
1548 // re-compute track parameters and covariances using Kalman filter
1549 RetraceTrack(track,kTRUE);
1551 // Improve the reconstructed tracks if required
1552 track.SetImproved(kFALSE);
1553 if (enableImprovement && GetRecoParam()->ImproveTracks()) ImproveTrack(track);
1555 // Fill AliMUONTrack data members
1556 FinalizeTrack(track);