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"
41 #include "AliMpArea.h"
45 #include <Riostream.h>
50 ClassImp(AliMUONTrackReconstructorK) // Class implementation in ROOT context
53 //__________________________________________________________________________
54 AliMUONTrackReconstructorK::AliMUONTrackReconstructorK(AliMUONVClusterServer& clusterServer)
55 : AliMUONVTrackReconstructor(clusterServer)
60 //__________________________________________________________________________
61 AliMUONTrackReconstructorK::~AliMUONTrackReconstructorK()
66 //__________________________________________________________________________
67 void AliMUONTrackReconstructorK::MakeTrackCandidates(AliMUONVClusterStore& clusterStore)
69 /// To make track candidates (assuming linear propagation if the flag fgkMakeTrackCandidatesFast is set to kTRUE):
70 /// Start with segments station(1..) 4 or 5 then follow track in station 5 or 4.
71 /// Good candidates are made of at least three clusters if both station are requested (two otherwise).
72 /// Keep only best candidates or all of them according to the flag fgkTrackAllTracks.
74 TClonesArray *segments;
79 AliDebug(1,"Enter MakeTrackCandidates");
81 // Unless we're doing combined tracking, we'll clusterize all stations at once
82 Int_t firstChamber(0);
85 if (AliMUONReconstructor::GetRecoParam()->CombineClusterTrackReco()) {
86 // ... Here's the exception : ask the clustering to reconstruct
87 // clusters *only* in station 4 and 5 for combined tracking
91 for (Int_t i = firstChamber; i <= lastChamber; ++i )
93 if (AliMUONReconstructor::GetRecoParam()->UseChamber(i)) fClusterServer.Clusterize(i, clusterStore, AliMpArea());
96 // Loop over stations(1..) 5 and 4 and make track candidates
97 for (Int_t istat=4; istat>=3; istat--) {
99 // Make segments in the station
100 segments = MakeSegmentsBetweenChambers(clusterStore, 2*istat, 2*istat+1);
102 // Loop over segments
103 for (Int_t iseg=0; iseg<segments->GetEntriesFast(); iseg++) {
104 AliDebug(1,Form("Making primary candidate(1..) %d",++iCandidate));
106 // Transform segments to tracks and put them at the end of fRecTracksPtr
107 track = new ((*fRecTracksPtr)[fRecTracksPtr->GetLast()+1]) AliMUONTrack((AliMUONObjectPair*)((*segments)[iseg]));
110 // Look for compatible cluster(s) in the other station
111 if (AliMUONReconstructor::GetRecoParam()->MakeTrackCandidatesFast())
112 clusterFound = FollowLinearTrackInStation(*track, clusterStore, 7-istat);
114 // First recompute track parameters and covariances on station(1..) 5 using Kalman filter
115 // (to make sure all tracks are treated in the same way)
116 if (istat == 4) RetraceTrack(*track, kTRUE);
117 clusterFound = FollowTrackInStation(*track, clusterStore, 7-istat);
120 // Remove track if no cluster found on a requested station
122 if (AliMUONReconstructor::GetRecoParam()->RequestStation(7-istat)) {
123 fRecTracksPtr->Remove(track);
125 } else if (istat == 3 && !AliMUONReconstructor::GetRecoParam()->MakeTrackCandidatesFast()) {
126 // update track parameters and covariances using Kalman filter
127 RetraceTrack(*track, kTRUE);
132 // delete the array of segments
137 // Retrace tracks using Kalman filter and remove bad ones
138 if (AliMUONReconstructor::GetRecoParam()->MakeTrackCandidatesFast()) {
139 fRecTracksPtr->Compress(); // this is essential before checking tracks
141 Int_t currentNRecTracks = fNRecTracks;
142 for (Int_t iRecTrack = 0; iRecTrack < currentNRecTracks; iRecTrack++) {
143 track = (AliMUONTrack*) fRecTracksPtr->UncheckedAt(iRecTrack);
145 // Recompute track parameters and covariances using Kalman filter
146 RetraceTrack(*track,kTRUE);
148 // Remove the track if the normalized chi2 is too high
149 if (track->GetNormalizedChi2() > AliMUONReconstructor::GetRecoParam()->GetSigmaCutForTracking() *
150 AliMUONReconstructor::GetRecoParam()->GetSigmaCutForTracking()) {
151 fRecTracksPtr->Remove(track);
159 fRecTracksPtr->Compress(); // this is essential before checking tracks
161 // Keep all different tracks or only the best ones as required
162 if (AliMUONReconstructor::GetRecoParam()->TrackAllTracks()) RemoveIdenticalTracks();
163 else RemoveDoubleTracks();
165 AliDebug(1,Form("Number of good candidates = %d",fNRecTracks));
169 //__________________________________________________________________________
170 void AliMUONTrackReconstructorK::MakeMoreTrackCandidates(AliMUONVClusterStore& clusterStore)
172 /// To make extra track candidates (assuming linear propagation if the flag fgkMakeTrackCandidatesFast is set to kTRUE):
173 /// clustering is supposed to be already done
174 /// Start with segments made of 1 cluster in each of the stations 4 and 5 then follow track in remaining chambers.
175 /// Good candidates are made of at least three clusters if both station are requested (two otherwise).
176 /// Keep only best candidates or all of them according to the flag fgkTrackAllTracks.
178 TClonesArray *segments;
180 Int_t iCandidate = 0, iCurrentTrack, nCurrentTracks;
181 Int_t initialNRecTracks = fNRecTracks;
184 AliDebug(1,"Enter MakeMoreTrackCandidates");
186 // Double loop over chambers in stations(1..) 4 and 5 to make track candidates
187 for (Int_t ich1 = 6; ich1 <= 7; ich1++) {
188 for (Int_t ich2 = 8; ich2 <= 9; ich2++) {
190 // Make segments between ch1 and ch2
191 segments = MakeSegmentsBetweenChambers(clusterStore, ich1, ich2);
193 // Loop over segments
194 for (Int_t iseg=0; iseg<segments->GetEntriesFast(); iseg++) {
195 AliDebug(1,Form("Making primary candidate(1..) %d",++iCandidate));
197 // Transform segments to tracks and put them at the end of fRecTracksPtr
198 iCurrentTrack = fRecTracksPtr->GetLast()+1;
199 track = new ((*fRecTracksPtr)[iCurrentTrack]) AliMUONTrack((AliMUONObjectPair*)((*segments)[iseg]));
202 // Look for compatible cluster(s) in the second chamber of station 5
203 if (AliMUONReconstructor::GetRecoParam()->MakeTrackCandidatesFast())
204 clusterFound = FollowLinearTrackInChamber(*track, clusterStore, 17-ich2);
205 else clusterFound = FollowTrackInChamber(*track, clusterStore, 17-ich2);
207 // skip the original track in case it has been removed
208 if (AliMUONReconstructor::GetRecoParam()->TrackAllTracks() && clusterFound) iCurrentTrack++;
210 // loop over every new tracks
211 nCurrentTracks = fRecTracksPtr->GetLast()+1;
212 while (iCurrentTrack < nCurrentTracks) {
213 track = (AliMUONTrack*) fRecTracksPtr->UncheckedAt(iCurrentTrack);
215 // Look for compatible cluster(s) in the second chamber of station 4
216 if (AliMUONReconstructor::GetRecoParam()->MakeTrackCandidatesFast())
217 FollowLinearTrackInChamber(*track, clusterStore, 13-ich1);
218 else FollowTrackInChamber(*track, clusterStore, 13-ich1);
225 // delete the array of segments
230 fRecTracksPtr->Compress(); // this is essential before checking tracks
232 // Retrace tracks using Kalman filter
233 for (Int_t iRecTrack = initialNRecTracks; iRecTrack < fNRecTracks; iRecTrack++) {
234 track = (AliMUONTrack*) fRecTracksPtr->UncheckedAt(iRecTrack);
236 // Recompute track parameters and covariances using Kalman filter
237 RetraceTrack(*track,kTRUE);
239 // Remove the track if the normalized chi2 is too high
240 // (only if the tracking has been done without magnetic field)
241 if (AliMUONReconstructor::GetRecoParam()->MakeTrackCandidatesFast() &&
242 track->GetNormalizedChi2() > AliMUONReconstructor::GetRecoParam()->GetSigmaCutForTracking() *
243 AliMUONReconstructor::GetRecoParam()->GetSigmaCutForTracking()) {
244 fRecTracksPtr->Remove(track);
250 // this is essential before checking tracks
251 if (AliMUONReconstructor::GetRecoParam()->MakeTrackCandidatesFast()) fRecTracksPtr->Compress();
253 // Keep all different tracks or only the best ones as required
254 if (AliMUONReconstructor::GetRecoParam()->TrackAllTracks()) RemoveIdenticalTracks();
255 else RemoveDoubleTracks();
257 AliDebug(1,Form("Number of good candidates = %d",fNRecTracks));
261 //__________________________________________________________________________
262 void AliMUONTrackReconstructorK::RetraceTrack(AliMUONTrack &trackCandidate, Bool_t resetSeed)
264 /// Re-run the kalman filter from the most downstream cluster to the most uptream one
265 AliDebug(1,"Enter RetraceTrack");
267 AliMUONTrackParam* lastTrackParam = (AliMUONTrackParam*) trackCandidate.GetTrackParamAtCluster()->Last();
269 // Reset the "seed" (= track parameters and their covariances at last cluster) if required
272 // parameters at last cluster
273 AliMUONVCluster* cluster2 = lastTrackParam->GetClusterPtr();
274 Double_t x2 = cluster2->GetX();
275 Double_t y2 = cluster2->GetY();
276 Double_t z2 = cluster2->GetZ();
278 // parameters at last but one cluster
279 AliMUONTrackParam* previousTrackParam = (AliMUONTrackParam*) trackCandidate.GetTrackParamAtCluster()->Before(lastTrackParam);
280 AliMUONVCluster* cluster1 = previousTrackParam->GetClusterPtr();
281 Double_t x1 = cluster1->GetX();
282 Double_t y1 = cluster1->GetY();
283 Double_t z1 = cluster1->GetZ();
285 // reset track parameters
286 Double_t dZ = z1 - z2;
287 lastTrackParam->SetNonBendingCoor(x2);
288 lastTrackParam->SetBendingCoor(y2);
289 lastTrackParam->SetZ(z2);
290 lastTrackParam->SetNonBendingSlope((x1 - x2) / dZ);
291 lastTrackParam->SetBendingSlope((y1 - y2) / dZ);
292 Double_t bendingImpact = y2 - z2 * lastTrackParam->GetBendingSlope();
293 Double_t inverseBendingMomentum = 1. / AliMUONTrackExtrap::GetBendingMomentumFromImpactParam(bendingImpact);
294 lastTrackParam->SetInverseBendingMomentum(inverseBendingMomentum);
296 // => Reset track parameter covariances at last cluster (as if the other clusters did not exist)
297 TMatrixD lastParamCov(5,5);
300 lastParamCov(0,0) = cluster2->GetErrX2();
301 lastParamCov(1,1) = 100. * ( cluster1->GetErrX2() + cluster2->GetErrX2() ) / dZ / dZ;
303 lastParamCov(2,2) = cluster2->GetErrY2();
304 lastParamCov(3,3) = 100. * ( cluster1->GetErrY2() + cluster2->GetErrY2() ) / dZ / dZ;
305 // Inverse bending momentum (vertex resolution + bending slope resolution + 10% error on dipole parameters+field)
306 lastParamCov(4,4) = ((AliMUONReconstructor::GetRecoParam()->GetBendingVertexDispersion() *
307 AliMUONReconstructor::GetRecoParam()->GetBendingVertexDispersion() +
308 (z1 * z1 * cluster2->GetErrY2() + z2 * z2 * cluster1->GetErrY2()) / dZ / dZ) /
309 bendingImpact / bendingImpact + 0.1 * 0.1) * inverseBendingMomentum * inverseBendingMomentum;
310 lastTrackParam->SetCovariances(lastParamCov);
312 // Reset the track chi2
313 lastTrackParam->SetTrackChi2(0.);
318 RetracePartialTrack(trackCandidate, lastTrackParam);
322 //__________________________________________________________________________
323 void AliMUONTrackReconstructorK::RetracePartialTrack(AliMUONTrack &trackCandidate, const AliMUONTrackParam* startingTrackParam)
325 /// Re-run the kalman filter from the cluster attached to startingTrackParam to the most uptream cluster
326 AliDebug(1,"Enter RetracePartialTrack");
328 // Printout for debuging
329 if ((AliLog::GetDebugLevel("MUON","AliMUONTrackReconstructorK") >= 1) || (AliLog::GetGlobalDebugLevel() >= 1)) {
330 cout << "RetracePartialTrack: track chi2 before re-tracking: " << trackCandidate.GetGlobalChi2() << endl;
333 // Reset the track chi2
334 trackCandidate.SetGlobalChi2(startingTrackParam->GetTrackChi2());
336 // loop over attached clusters until the first one and recompute track parameters and covariances using kalman filter
337 Int_t expectedChamber = startingTrackParam->GetClusterPtr()->GetChamberId() - 1;
338 Int_t currentChamber;
339 Double_t addChi2TrackAtCluster;
340 AliMUONTrackParam* trackParamAtCluster = (AliMUONTrackParam*) trackCandidate.GetTrackParamAtCluster()->Before(startingTrackParam);
341 while (trackParamAtCluster) {
343 // reset track parameters and their covariances
344 trackParamAtCluster->SetParameters(startingTrackParam->GetParameters());
345 trackParamAtCluster->SetZ(startingTrackParam->GetZ());
346 trackParamAtCluster->SetCovariances(startingTrackParam->GetCovariances());
349 AliMUONTrackExtrap::AddMCSEffect(trackParamAtCluster,AliMUONConstants::ChamberThicknessInX0(),1.);
351 // reset propagator for smoother
352 if (AliMUONReconstructor::GetRecoParam()->UseSmoother()) trackParamAtCluster->ResetPropagator();
354 // add MCS in missing chambers if any
355 currentChamber = trackParamAtCluster->GetClusterPtr()->GetChamberId();
356 while (currentChamber < expectedChamber) {
357 // extrapolation to the missing chamber (update the propagator)
358 AliMUONTrackExtrap::ExtrapToZCov(trackParamAtCluster, AliMUONConstants::DefaultChamberZ(expectedChamber),
359 AliMUONReconstructor::GetRecoParam()->UseSmoother());
361 AliMUONTrackExtrap::AddMCSEffect(trackParamAtCluster,AliMUONConstants::ChamberThicknessInX0(),1.);
365 // extrapolation to the plane of the cluster attached to the current trackParamAtCluster (update the propagator)
366 AliMUONTrackExtrap::ExtrapToZCov(trackParamAtCluster, trackParamAtCluster->GetClusterPtr()->GetZ(),
367 AliMUONReconstructor::GetRecoParam()->UseSmoother());
369 if (AliMUONReconstructor::GetRecoParam()->UseSmoother()) {
370 // save extrapolated parameters for smoother
371 trackParamAtCluster->SetExtrapParameters(trackParamAtCluster->GetParameters());
373 // save extrapolated covariance matrix for smoother
374 trackParamAtCluster->SetExtrapCovariances(trackParamAtCluster->GetCovariances());
377 // Compute new track parameters using kalman filter
378 addChi2TrackAtCluster = RunKalmanFilter(*trackParamAtCluster);
380 // Update the track chi2
381 trackCandidate.SetGlobalChi2(trackCandidate.GetGlobalChi2() + addChi2TrackAtCluster);
382 trackParamAtCluster->SetTrackChi2(trackCandidate.GetGlobalChi2());
385 expectedChamber = currentChamber - 1;
386 startingTrackParam = trackParamAtCluster;
387 trackParamAtCluster = (AliMUONTrackParam*) (trackCandidate.GetTrackParamAtCluster()->Before(startingTrackParam));
390 // Printout for debuging
391 if ((AliLog::GetDebugLevel("MUON","AliMUONTrackReconstructorK") >= 1) || (AliLog::GetGlobalDebugLevel() >= 1)) {
392 cout << "RetracePartialTrack: track chi2 after re-tracking: " << trackCandidate.GetGlobalChi2() << endl;
397 //__________________________________________________________________________
398 void AliMUONTrackReconstructorK::FollowTracks(AliMUONVClusterStore& clusterStore)
400 /// Follow tracks in stations(1..) 3, 2 and 1
401 AliDebug(1,"Enter FollowTracks");
404 Int_t currentNRecTracks;
406 for (Int_t station = 2; station >= 0; station--) {
408 // Save the actual number of reconstructed track in case of
409 // tracks are added or suppressed during the tracking procedure
410 // !! Do not compress fRecTracksPtr until the end of the loop over tracks !!
411 currentNRecTracks = fNRecTracks;
413 for (Int_t iRecTrack = 0; iRecTrack <currentNRecTracks; iRecTrack++) {
414 AliDebug(1,Form("FollowTracks: track candidate(1..) %d", iRecTrack+1));
416 track = (AliMUONTrack*) fRecTracksPtr->UncheckedAt(iRecTrack);
418 // Look for compatible cluster(s) in station(0..) "station"
419 if (!FollowTrackInStation(*track, clusterStore, station)) {
421 // Try to recover track if required
422 if (AliMUONReconstructor::GetRecoParam()->RecoverTracks()) {
424 // work on a copy of the track if this station is not required
425 // to keep the case where no cluster is reconstructed as a possible candidate
426 if (!AliMUONReconstructor::GetRecoParam()->RequestStation(station)) {
427 track = new ((*fRecTracksPtr)[fRecTracksPtr->GetLast()+1]) AliMUONTrack(*track);
432 if (!RecoverTrack(*track, clusterStore, station)) {
433 // remove track if no cluster found
434 fRecTracksPtr->Remove(track);
438 } else if (AliMUONReconstructor::GetRecoParam()->RequestStation(station)) {
439 // remove track if no cluster found
440 fRecTracksPtr->Remove(track);
448 fRecTracksPtr->Compress(); // this is essential before checking tracks
450 // Keep only the best tracks if required
451 if (!AliMUONReconstructor::GetRecoParam()->TrackAllTracks()) RemoveDoubleTracks();
457 //__________________________________________________________________________
458 Bool_t AliMUONTrackReconstructorK::FollowTrackInChamber(AliMUONTrack &trackCandidate, AliMUONVClusterStore& clusterStore, Int_t nextChamber)
460 /// Follow trackCandidate in chamber(0..) nextChamber and search for compatible cluster(s)
461 /// Keep all possibilities or only the best one(s) according to the flag fgkTrackAllTracks:
462 /// kTRUE: duplicate "trackCandidate" if there are several possibilities and add the new tracks at the end of
463 /// fRecTracksPtr to avoid conficts with other track candidates at this current stage of the tracking procedure.
464 /// Remove the obsolete "trackCandidate" at the end.
465 /// kFALSE: add only the best cluster(s) to the "trackCandidate". Try to add a couple of clusters in priority.
466 /// return kTRUE if new cluster(s) have been found (otherwise return kFALSE)
467 AliDebug(1,Form("Enter FollowTrackInChamber(1..) %d", nextChamber+1));
469 Double_t bendingMomentum;
470 Double_t chi2OfCluster;
471 Double_t maxChi2OfCluster = 2. * AliMUONReconstructor::GetRecoParam()->GetSigmaCutForTracking() *
472 AliMUONReconstructor::GetRecoParam()->GetSigmaCutForTracking(); // 2 because 2 quantities in chi2
473 Double_t addChi2TrackAtCluster;
474 Double_t bestAddChi2TrackAtCluster = 1.e10;
475 Bool_t foundOneCluster = kFALSE;
476 AliMUONTrack *newTrack = 0x0;
477 AliMUONVCluster *cluster;
478 AliMUONTrackParam extrapTrackParamAtCh;
479 AliMUONTrackParam extrapTrackParamAtCluster;
480 AliMUONTrackParam bestTrackParamAtCluster;
482 // Get track parameters according to the propagation direction
483 if (nextChamber > 7) extrapTrackParamAtCh = *(AliMUONTrackParam*)trackCandidate.GetTrackParamAtCluster()->Last();
484 else extrapTrackParamAtCh = *(AliMUONTrackParam*)trackCandidate.GetTrackParamAtCluster()->First();
486 // Printout for debuging
487 if ((AliLog::GetDebugLevel("MUON","AliMUONTrackReconstructorK") >= 2) || (AliLog::GetGlobalDebugLevel() >= 2)) {
488 cout<<endl<<"Track parameters and covariances at first cluster:"<<endl;
489 extrapTrackParamAtCh.GetParameters().Print();
490 extrapTrackParamAtCh.GetCovariances().Print();
494 AliMUONTrackExtrap::AddMCSEffect(&extrapTrackParamAtCh,AliMUONConstants::ChamberThicknessInX0(),1.);
496 // reset propagator for smoother
497 if (AliMUONReconstructor::GetRecoParam()->UseSmoother()) extrapTrackParamAtCh.ResetPropagator();
499 // Add MCS in the missing chamber(s) if any
500 Int_t currentChamber = extrapTrackParamAtCh.GetClusterPtr()->GetChamberId();
501 while (currentChamber > nextChamber + 1) {
502 // extrapolation to the missing chamber
504 AliMUONTrackExtrap::ExtrapToZCov(&extrapTrackParamAtCh, AliMUONConstants::DefaultChamberZ(currentChamber),
505 AliMUONReconstructor::GetRecoParam()->UseSmoother());
507 AliMUONTrackExtrap::AddMCSEffect(&extrapTrackParamAtCh,AliMUONConstants::ChamberThicknessInX0(),1.);
510 //Extrapolate trackCandidate to chamber
511 AliMUONTrackExtrap::ExtrapToZCov(&extrapTrackParamAtCh, AliMUONConstants::DefaultChamberZ(nextChamber),
512 AliMUONReconstructor::GetRecoParam()->UseSmoother());
514 // Printout for debuging
515 if ((AliLog::GetDebugLevel("MUON","AliMUONTrackReconstructorK") >= 2) || (AliLog::GetGlobalDebugLevel() >= 2)) {
516 cout<<endl<<"Track parameters and covariances at first cluster extrapolated to z = "<<AliMUONConstants::DefaultChamberZ(nextChamber)<<":"<<endl;
517 extrapTrackParamAtCh.GetParameters().Print();
518 extrapTrackParamAtCh.GetCovariances().Print();
521 // Printout for debuging
522 if ((AliLog::GetDebugLevel("MUON","AliMUONTrackReconstructorK") >= 1) || (AliLog::GetGlobalDebugLevel() >= 1)) {
523 cout << "FollowTrackInChamber: look for clusters in chamber(1..): " << nextChamber+1 << endl;
526 // Ask the clustering to reconstruct new clusters around the track position in the current chamber
527 // except for station 4 and 5 that are already entirely clusterized
528 if (AliMUONReconstructor::GetRecoParam()->CombineClusterTrackReco()) {
529 if (nextChamber < 6) AskForNewClustersInChamber(extrapTrackParamAtCh, clusterStore, nextChamber);
532 // Create iterators to loop over clusters in both chambers
533 TIter next(clusterStore.CreateChamberIterator(nextChamber,nextChamber));
535 // look for candidates in chamber
536 while ( ( cluster = static_cast<AliMUONVCluster*>(next()) ) ) {
538 // try to add the current cluster fast
539 if (!TryOneClusterFast(extrapTrackParamAtCh, cluster)) continue;
541 // try to add the current cluster accuratly
542 chi2OfCluster = TryOneCluster(extrapTrackParamAtCh, cluster, extrapTrackParamAtCluster,
543 AliMUONReconstructor::GetRecoParam()->UseSmoother());
545 // if good chi2 then consider to add cluster
546 if (chi2OfCluster < maxChi2OfCluster) {
547 foundOneCluster = kTRUE;
549 // Printout for debuging
550 if ((AliLog::GetDebugLevel("MUON","AliMUONTrackReconstructorK") >= 1) || (AliLog::GetGlobalDebugLevel() >= 1)) {
551 cout << "FollowTrackInChamber: found one cluster in chamber(1..): " << nextChamber+1
552 << " (Chi2 = " << chi2OfCluster << ")" << endl;
556 if (AliMUONReconstructor::GetRecoParam()->UseSmoother()) {
557 // save extrapolated parameters for smoother
558 extrapTrackParamAtCluster.SetExtrapParameters(extrapTrackParamAtCluster.GetParameters());
560 // save extrapolated covariance matrix for smoother
561 extrapTrackParamAtCluster.SetExtrapCovariances(extrapTrackParamAtCluster.GetCovariances());
564 // Compute new track parameters including new cluster using kalman filter
565 addChi2TrackAtCluster = RunKalmanFilter(extrapTrackParamAtCluster);
567 // skip track with absolute bending momentum out of limits
568 bendingMomentum = TMath::Abs(1. / extrapTrackParamAtCluster.GetInverseBendingMomentum());
569 if (bendingMomentum < AliMUONReconstructor::GetRecoParam()->GetMinBendingMomentum() ||
570 bendingMomentum > AliMUONReconstructor::GetRecoParam()->GetMaxBendingMomentum()) continue;
572 if (AliMUONReconstructor::GetRecoParam()->TrackAllTracks()) {
573 // copy trackCandidate into a new track put at the end of fRecTracksPtr and add the new cluster
574 newTrack = new ((*fRecTracksPtr)[fRecTracksPtr->GetLast()+1]) AliMUONTrack(trackCandidate);
575 UpdateTrack(*newTrack,extrapTrackParamAtCluster,addChi2TrackAtCluster);
578 // Printout for debuging
579 if ((AliLog::GetDebugLevel("MUON","AliMUONTrackReconstructorK") >= 1) || (AliLog::GetGlobalDebugLevel() >= 1)) {
580 cout << "FollowTrackInChamber: added one cluster in chamber(1..): " << nextChamber+1 << endl;
581 if (AliLog::GetGlobalDebugLevel() >= 3) newTrack->RecursiveDump();
584 } else if (addChi2TrackAtCluster < bestAddChi2TrackAtCluster) {
585 // keep track of the best cluster
586 bestAddChi2TrackAtCluster = addChi2TrackAtCluster;
587 bestTrackParamAtCluster = extrapTrackParamAtCluster;
594 // fill out the best track if required else clean up the fRecTracksPtr array
595 if (!AliMUONReconstructor::GetRecoParam()->TrackAllTracks()) {
596 if (foundOneCluster) {
597 UpdateTrack(trackCandidate,bestTrackParamAtCluster,bestAddChi2TrackAtCluster);
599 // Printout for debuging
600 if ((AliLog::GetDebugLevel("MUON","AliMUONTrackReconstructorK") >= 1) || (AliLog::GetGlobalDebugLevel() >= 1)) {
601 cout << "FollowTrackInChamber: added the best cluster in chamber(1..): " << bestTrackParamAtCluster.GetClusterPtr()->GetChamberId()+1 << endl;
602 if (AliLog::GetGlobalDebugLevel() >= 3) newTrack->RecursiveDump();
605 } else return kFALSE;
607 } else if (foundOneCluster) {
609 // remove obsolete track
610 fRecTracksPtr->Remove(&trackCandidate);
613 } else return kFALSE;
619 //__________________________________________________________________________
620 Bool_t AliMUONTrackReconstructorK::FollowTrackInStation(AliMUONTrack &trackCandidate, AliMUONVClusterStore& clusterStore, Int_t nextStation)
622 /// Follow trackCandidate in station(0..) nextStation and search for compatible cluster(s)
623 /// Keep all possibilities or only the best one(s) according to the flag fgkTrackAllTracks:
624 /// kTRUE: duplicate "trackCandidate" if there are several possibilities and add the new tracks at the end of
625 /// fRecTracksPtr to avoid conficts with other track candidates at this current stage of the tracking procedure.
626 /// Remove the obsolete "trackCandidate" at the end.
627 /// kFALSE: add only the best cluster(s) to the "trackCandidate". Try to add a couple of clusters in priority.
628 /// return kTRUE if new cluster(s) have been found (otherwise return kFALSE)
629 AliDebug(1,Form("Enter FollowTrackInStation(1..) %d", nextStation+1));
631 // Order the chamber according to the propagation direction (tracking starts with chamber 2):
632 // - nextStation == station(1...) 5 => forward propagation
633 // - nextStation < station(1...) 5 => backward propagation
635 if (nextStation==4) {
636 ch1 = 2*nextStation+1;
640 ch2 = 2*nextStation+1;
643 Double_t bendingMomentum;
644 Double_t chi2OfCluster;
645 Double_t maxChi2OfCluster = 2. * AliMUONReconstructor::GetRecoParam()->GetSigmaCutForTracking() *
646 AliMUONReconstructor::GetRecoParam()->GetSigmaCutForTracking(); // 2 because 2 quantities in chi2
647 Double_t addChi2TrackAtCluster1;
648 Double_t addChi2TrackAtCluster2;
649 Double_t bestAddChi2TrackAtCluster1 = 1.e10;
650 Double_t bestAddChi2TrackAtCluster2 = 1.e10;
651 Bool_t foundOneCluster = kFALSE;
652 Bool_t foundTwoClusters = kFALSE;
653 AliMUONTrack *newTrack = 0x0;
654 AliMUONVCluster *clusterCh1, *clusterCh2;
655 AliMUONTrackParam extrapTrackParam;
656 AliMUONTrackParam extrapTrackParamAtCh;
657 AliMUONTrackParam extrapTrackParamAtCluster1;
658 AliMUONTrackParam extrapTrackParamAtCluster2;
659 AliMUONTrackParam bestTrackParamAtCluster1;
660 AliMUONTrackParam bestTrackParamAtCluster2;
662 Int_t nClusters = clusterStore.GetSize();
663 Bool_t *clusterCh1Used = new Bool_t[nClusters];
664 for (Int_t i = 0; i < nClusters; i++) clusterCh1Used[i] = kFALSE;
667 // Get track parameters according to the propagation direction
669 if (nextStation==4) extrapTrackParamAtCh = *(AliMUONTrackParam*)trackCandidate.GetTrackParamAtCluster()->Last();
670 else extrapTrackParamAtCh = *(AliMUONTrackParam*)trackCandidate.GetTrackParamAtCluster()->First();
672 // Printout for debuging
673 if ((AliLog::GetDebugLevel("MUON","AliMUONTrackReconstructorK") >= 2) || (AliLog::GetGlobalDebugLevel() >= 2)) {
674 cout<<endl<<"Track parameters and covariances at first cluster:"<<endl;
675 extrapTrackParamAtCh.GetParameters().Print();
676 extrapTrackParamAtCh.GetCovariances().Print();
680 AliMUONTrackExtrap::AddMCSEffect(&extrapTrackParamAtCh,AliMUONConstants::ChamberThicknessInX0(),1.);
682 // reset propagator for smoother
683 if (AliMUONReconstructor::GetRecoParam()->UseSmoother()) extrapTrackParamAtCh.ResetPropagator();
685 // Add MCS in the missing chamber(s) if any
686 Int_t currentChamber = extrapTrackParamAtCh.GetClusterPtr()->GetChamberId();
687 while (ch1 < ch2 && currentChamber > ch2 + 1) {
688 // extrapolation to the missing chamber
690 AliMUONTrackExtrap::ExtrapToZCov(&extrapTrackParamAtCh, AliMUONConstants::DefaultChamberZ(currentChamber),
691 AliMUONReconstructor::GetRecoParam()->UseSmoother());
693 AliMUONTrackExtrap::AddMCSEffect(&extrapTrackParamAtCh,AliMUONConstants::ChamberThicknessInX0(),1.);
696 //Extrapolate trackCandidate to chamber "ch2"
697 AliMUONTrackExtrap::ExtrapToZCov(&extrapTrackParamAtCh, AliMUONConstants::DefaultChamberZ(ch2),
698 AliMUONReconstructor::GetRecoParam()->UseSmoother());
700 // Printout for debuging
701 if ((AliLog::GetDebugLevel("MUON","AliMUONTrackReconstructorK") >= 2) || (AliLog::GetGlobalDebugLevel() >= 2)) {
702 cout<<endl<<"Track parameters and covariances at first cluster extrapolated to z = "<<AliMUONConstants::DefaultChamberZ(ch2)<<":"<<endl;
703 extrapTrackParamAtCh.GetParameters().Print();
704 extrapTrackParamAtCh.GetCovariances().Print();
707 // Printout for debuging
708 if ((AliLog::GetDebugLevel("MUON","AliMUONTrackReconstructorK") >= 1) || (AliLog::GetGlobalDebugLevel() >= 1)) {
709 cout << "FollowTrackInStation: look for clusters in chamber(1..): " << ch2+1 << endl;
712 // Ask the clustering to reconstruct new clusters around the track position in the current station
713 // except for station 4 and 5 that are already entirely clusterized
714 if (AliMUONReconstructor::GetRecoParam()->CombineClusterTrackReco()) {
715 if (nextStation < 3) AskForNewClustersInStation(extrapTrackParamAtCh, clusterStore, nextStation);
718 // Create iterators to loop over clusters in both chambers
719 TIter nextInCh1(clusterStore.CreateChamberIterator(ch1,ch1));
720 TIter nextInCh2(clusterStore.CreateChamberIterator(ch2,ch2));
722 // look for candidates in chamber 2
723 while ( ( clusterCh2 = static_cast<AliMUONVCluster*>(nextInCh2()) ) ) {
725 // try to add the current cluster fast
726 if (!TryOneClusterFast(extrapTrackParamAtCh, clusterCh2)) continue;
728 // try to add the current cluster accuratly
729 chi2OfCluster = TryOneCluster(extrapTrackParamAtCh, clusterCh2, extrapTrackParamAtCluster2,
730 AliMUONReconstructor::GetRecoParam()->UseSmoother());
732 // if good chi2 then try to attach a cluster in the other chamber too
733 if (chi2OfCluster < maxChi2OfCluster) {
734 Bool_t foundSecondCluster = kFALSE;
736 // Printout for debuging
737 if ((AliLog::GetDebugLevel("MUON","AliMUONTrackReconstructorK") >= 1) || (AliLog::GetGlobalDebugLevel() >= 1)) {
738 cout << "FollowTrackInStation: found one cluster in chamber(1..): " << ch2+1
739 << " (Chi2 = " << chi2OfCluster << ")" << endl;
741 cout << " look for second clusters in chamber(1..): " << ch1+1 << " ..." << endl;
744 if (AliMUONReconstructor::GetRecoParam()->UseSmoother()) {
745 // save extrapolated parameters for smoother
746 extrapTrackParamAtCluster2.SetExtrapParameters(extrapTrackParamAtCluster2.GetParameters());
748 // save extrapolated covariance matrix for smoother
749 extrapTrackParamAtCluster2.SetExtrapCovariances(extrapTrackParamAtCluster2.GetCovariances());
752 // Compute new track parameters including "clusterCh2" using kalman filter
753 addChi2TrackAtCluster2 = RunKalmanFilter(extrapTrackParamAtCluster2);
755 // skip track with absolute bending momentum out of limits
756 bendingMomentum = TMath::Abs(1. / extrapTrackParamAtCluster2.GetInverseBendingMomentum());
757 if (bendingMomentum < AliMUONReconstructor::GetRecoParam()->GetMinBendingMomentum() ||
758 bendingMomentum > AliMUONReconstructor::GetRecoParam()->GetMaxBendingMomentum()) continue;
760 // copy new track parameters for next step
761 extrapTrackParam = extrapTrackParamAtCluster2;
764 AliMUONTrackExtrap::AddMCSEffect(&extrapTrackParam,AliMUONConstants::ChamberThicknessInX0(),1.);
766 // reset propagator for smoother
767 if (AliMUONReconstructor::GetRecoParam()->UseSmoother()) extrapTrackParam.ResetPropagator();
769 //Extrapolate track parameters to chamber "ch1"
770 AliMUONTrackExtrap::ExtrapToZCov(&extrapTrackParam, AliMUONConstants::DefaultChamberZ(ch1),
771 AliMUONReconstructor::GetRecoParam()->UseSmoother());
773 // reset cluster iterator of chamber 1
777 // look for second candidates in chamber 1
778 while ( ( clusterCh1 = static_cast<AliMUONVCluster*>(nextInCh1()) ) ) {
781 // try to add the current cluster fast
782 if (!TryOneClusterFast(extrapTrackParam, clusterCh1)) continue;
784 // try to add the current cluster accuratly
785 chi2OfCluster = TryOneCluster(extrapTrackParam, clusterCh1, extrapTrackParamAtCluster1,
786 AliMUONReconstructor::GetRecoParam()->UseSmoother());
788 // if good chi2 then consider to add the 2 clusters to the "trackCandidate"
789 if (chi2OfCluster < maxChi2OfCluster) {
790 foundSecondCluster = kTRUE;
791 foundTwoClusters = kTRUE;
793 // Printout for debuging
794 if ((AliLog::GetDebugLevel("MUON","AliMUONTrackReconstructorK") >= 1) || (AliLog::GetGlobalDebugLevel() >= 1)) {
795 cout << "FollowTrackInStation: found one cluster in chamber(1..): " << ch1+1
796 << " (Chi2 = " << chi2OfCluster << ")" << endl;
800 if (AliMUONReconstructor::GetRecoParam()->UseSmoother()) {
801 // save extrapolated parameters for smoother
802 extrapTrackParamAtCluster1.SetExtrapParameters(extrapTrackParamAtCluster1.GetParameters());
804 // save extrapolated covariance matrix for smoother
805 extrapTrackParamAtCluster1.SetExtrapCovariances(extrapTrackParamAtCluster1.GetCovariances());
808 // Compute new track parameters including "clusterCh1" using kalman filter
809 addChi2TrackAtCluster1 = RunKalmanFilter(extrapTrackParamAtCluster1);
811 // skip track with absolute bending momentum out of limits
812 bendingMomentum = TMath::Abs(1. / extrapTrackParamAtCluster1.GetInverseBendingMomentum());
813 if (bendingMomentum < AliMUONReconstructor::GetRecoParam()->GetMinBendingMomentum() ||
814 bendingMomentum > AliMUONReconstructor::GetRecoParam()->GetMaxBendingMomentum()) continue;
816 if (AliMUONReconstructor::GetRecoParam()->TrackAllTracks()) {
817 // copy trackCandidate into a new track put at the end of fRecTracksPtr and add the new clusters
818 newTrack = new ((*fRecTracksPtr)[fRecTracksPtr->GetLast()+1]) AliMUONTrack(trackCandidate);
819 UpdateTrack(*newTrack,extrapTrackParamAtCluster1,extrapTrackParamAtCluster2,addChi2TrackAtCluster1,addChi2TrackAtCluster2);
822 // if we are arrived on station(1..) 5, recompute track parameters and covariances starting from this station
823 // (going in the right direction)
824 if (nextStation == 4) RetraceTrack(*newTrack,kTRUE);
826 // Tag clusterCh1 as used
827 clusterCh1Used[iCluster1] = kTRUE;
829 // Printout for debuging
830 if ((AliLog::GetDebugLevel("MUON","AliMUONTrackReconstructorK") >= 1) || (AliLog::GetGlobalDebugLevel() >= 1)) {
831 cout << "FollowTrackInStation: added two clusters in station(1..): " << nextStation+1 << endl;
832 if (AliLog::GetGlobalDebugLevel() >= 3) newTrack->RecursiveDump();
835 } else if (addChi2TrackAtCluster1+addChi2TrackAtCluster2 < bestAddChi2TrackAtCluster1+bestAddChi2TrackAtCluster2) {
836 // keep track of the best couple of clusters
837 bestAddChi2TrackAtCluster1 = addChi2TrackAtCluster1;
838 bestAddChi2TrackAtCluster2 = addChi2TrackAtCluster2;
839 bestTrackParamAtCluster1 = extrapTrackParamAtCluster1;
840 bestTrackParamAtCluster2 = extrapTrackParamAtCluster2;
847 // if no clusterCh1 found then consider to add clusterCh2 only
848 if (!foundSecondCluster) {
849 foundOneCluster = kTRUE;
851 if (AliMUONReconstructor::GetRecoParam()->TrackAllTracks()) {
852 // copy trackCandidate into a new track put at the end of fRecTracksPtr and add the new cluster
853 newTrack = new ((*fRecTracksPtr)[fRecTracksPtr->GetLast()+1]) AliMUONTrack(trackCandidate);
854 UpdateTrack(*newTrack,extrapTrackParamAtCluster2,addChi2TrackAtCluster2);
857 // if we are arrived on station(1..) 5, recompute track parameters and covariances starting from this station
858 // (going in the right direction)
859 if (nextStation == 4) RetraceTrack(*newTrack,kTRUE);
861 // Printout for debuging
862 if ((AliLog::GetDebugLevel("MUON","AliMUONTrackReconstructorK") >= 1) || (AliLog::GetGlobalDebugLevel() >= 1)) {
863 cout << "FollowTrackInStation: added one cluster in chamber(1..): " << ch2+1 << endl;
864 if (AliLog::GetGlobalDebugLevel() >= 3) newTrack->RecursiveDump();
867 } else if (!foundTwoClusters && addChi2TrackAtCluster2 < bestAddChi2TrackAtCluster1) {
868 // keep track of the best single cluster except if a couple of clusters has already been found
869 bestAddChi2TrackAtCluster1 = addChi2TrackAtCluster2;
870 bestTrackParamAtCluster1 = extrapTrackParamAtCluster2;
879 // look for candidates in chamber 1 not already attached to a track
880 // if we want to keep all possible tracks or if no good couple of clusters has been found
881 if (AliMUONReconstructor::GetRecoParam()->TrackAllTracks() || !foundTwoClusters) {
883 // add MCS effect for next step
884 AliMUONTrackExtrap::AddMCSEffect(&extrapTrackParamAtCh,AliMUONConstants::ChamberThicknessInX0(),1.);
886 //Extrapolate trackCandidate to chamber "ch1"
887 AliMUONTrackExtrap::ExtrapToZCov(&extrapTrackParamAtCh, AliMUONConstants::DefaultChamberZ(ch1),
888 AliMUONReconstructor::GetRecoParam()->UseSmoother());
890 // Printout for debuging
891 if ((AliLog::GetDebugLevel("MUON","AliMUONTrackReconstructorK") >= 2) || (AliLog::GetGlobalDebugLevel() >= 2)) {
892 cout<<endl<<"Track parameters and covariances at first cluster extrapolated to z = "<<AliMUONConstants::DefaultChamberZ(ch1)<<":"<<endl;
893 extrapTrackParamAtCh.GetParameters().Print();
894 extrapTrackParamAtCh.GetCovariances().Print();
897 // Printout for debuging
898 if ((AliLog::GetDebugLevel("MUON","AliMUONTrackReconstructorK") >= 1) || (AliLog::GetGlobalDebugLevel() >= 1)) {
899 cout << "FollowTrackInStation: look for single clusters in chamber(1..): " << ch1+1 << endl;
902 // reset cluster iterator of chamber 1
906 // look for second candidates in chamber 1
907 while ( ( clusterCh1 = static_cast<AliMUONVCluster*>(nextInCh1()) ) ) {
910 if (clusterCh1Used[iCluster1]) continue; // Skip clusters already used
912 // try to add the current cluster fast
913 if (!TryOneClusterFast(extrapTrackParamAtCh, clusterCh1)) continue;
915 // try to add the current cluster accuratly
916 chi2OfCluster = TryOneCluster(extrapTrackParamAtCh, clusterCh1, extrapTrackParamAtCluster1,
917 AliMUONReconstructor::GetRecoParam()->UseSmoother());
919 // if good chi2 then consider to add clusterCh1
920 // We do not try to attach a cluster in the other chamber too since it has already been done above
921 if (chi2OfCluster < maxChi2OfCluster) {
922 foundOneCluster = kTRUE;
924 // Printout for debuging
925 if ((AliLog::GetDebugLevel("MUON","AliMUONTrackReconstructorK") >= 1) || (AliLog::GetGlobalDebugLevel() >= 1)) {
926 cout << "FollowTrackInStation: found one cluster in chamber(1..): " << ch1+1
927 << " (Chi2 = " << chi2OfCluster << ")" << endl;
931 if (AliMUONReconstructor::GetRecoParam()->UseSmoother()) {
932 // save extrapolated parameters for smoother
933 extrapTrackParamAtCluster1.SetExtrapParameters(extrapTrackParamAtCluster1.GetParameters());
935 // save extrapolated covariance matrix for smoother
936 extrapTrackParamAtCluster1.SetExtrapCovariances(extrapTrackParamAtCluster1.GetCovariances());
939 // Compute new track parameters including "clusterCh1" using kalman filter
940 addChi2TrackAtCluster1 = RunKalmanFilter(extrapTrackParamAtCluster1);
942 // skip track with absolute bending momentum out of limits
943 bendingMomentum = TMath::Abs(1. / extrapTrackParamAtCluster1.GetInverseBendingMomentum());
944 if (bendingMomentum < AliMUONReconstructor::GetRecoParam()->GetMinBendingMomentum() ||
945 bendingMomentum > AliMUONReconstructor::GetRecoParam()->GetMaxBendingMomentum()) continue;
947 if (AliMUONReconstructor::GetRecoParam()->TrackAllTracks()) {
948 // copy trackCandidate into a new track put at the end of fRecTracksPtr and add the new cluster
949 newTrack = new ((*fRecTracksPtr)[fRecTracksPtr->GetLast()+1]) AliMUONTrack(trackCandidate);
950 UpdateTrack(*newTrack,extrapTrackParamAtCluster1,addChi2TrackAtCluster1);
953 // if we are arrived on station(1..) 5, recompute track parameters and covariances starting from this station
954 // (going in the right direction)
955 if (nextStation == 4) RetraceTrack(*newTrack,kTRUE);
957 // Printout for debuging
958 if ((AliLog::GetDebugLevel("MUON","AliMUONTrackReconstructorK") >= 1) || (AliLog::GetGlobalDebugLevel() >= 1)) {
959 cout << "FollowTrackInStation: added one cluster in chamber(1..): " << ch1+1 << endl;
960 if (AliLog::GetGlobalDebugLevel() >= 3) newTrack->RecursiveDump();
963 } else if (addChi2TrackAtCluster1 < bestAddChi2TrackAtCluster1) {
964 // keep track of the best single cluster except if a couple of clusters has already been found
965 bestAddChi2TrackAtCluster1 = addChi2TrackAtCluster1;
966 bestTrackParamAtCluster1 = extrapTrackParamAtCluster1;
975 // fill out the best track if required else clean up the fRecTracksPtr array
976 if (!AliMUONReconstructor::GetRecoParam()->TrackAllTracks()) {
977 if (foundTwoClusters) {
978 UpdateTrack(trackCandidate,bestTrackParamAtCluster1,bestTrackParamAtCluster2,bestAddChi2TrackAtCluster1,bestAddChi2TrackAtCluster2);
980 // if we are arrived on station(1..) 5, recompute track parameters and covariances starting from this station
981 // (going in the right direction)
982 if (nextStation == 4) RetraceTrack(trackCandidate,kTRUE);
984 // Printout for debuging
985 if ((AliLog::GetDebugLevel("MUON","AliMUONTrackReconstructorK") >= 1) || (AliLog::GetGlobalDebugLevel() >= 1)) {
986 cout << "FollowTrackInStation: added the two best clusters in station(1..): " << nextStation+1 << endl;
987 if (AliLog::GetGlobalDebugLevel() >= 3) newTrack->RecursiveDump();
990 } else if (foundOneCluster) {
991 UpdateTrack(trackCandidate,bestTrackParamAtCluster1,bestAddChi2TrackAtCluster1);
993 // if we are arrived on station(1..) 5, recompute track parameters and covariances starting from this station
994 // (going in the right direction)
995 if (nextStation == 4) RetraceTrack(trackCandidate,kTRUE);
997 // Printout for debuging
998 if ((AliLog::GetDebugLevel("MUON","AliMUONTrackReconstructorK") >= 1) || (AliLog::GetGlobalDebugLevel() >= 1)) {
999 cout << "FollowTrackInStation: added the best cluster in chamber(1..): " << bestTrackParamAtCluster1.GetClusterPtr()->GetChamberId()+1 << endl;
1000 if (AliLog::GetGlobalDebugLevel() >= 3) newTrack->RecursiveDump();
1004 delete [] clusterCh1Used;
1008 } else if (foundOneCluster || foundTwoClusters) {
1010 // remove obsolete track
1011 fRecTracksPtr->Remove(&trackCandidate);
1015 delete [] clusterCh1Used;
1019 delete [] clusterCh1Used;
1024 //__________________________________________________________________________
1025 Double_t AliMUONTrackReconstructorK::RunKalmanFilter(AliMUONTrackParam &trackParamAtCluster)
1027 /// Compute new track parameters and their covariances including new cluster using kalman filter
1028 /// return the additional track chi2
1029 AliDebug(1,"Enter RunKalmanFilter");
1031 // Get actual track parameters (p)
1032 TMatrixD param(trackParamAtCluster.GetParameters());
1034 // Get new cluster parameters (m)
1035 AliMUONVCluster *cluster = trackParamAtCluster.GetClusterPtr();
1036 TMatrixD clusterParam(5,1);
1037 clusterParam.Zero();
1038 clusterParam(0,0) = cluster->GetX();
1039 clusterParam(2,0) = cluster->GetY();
1041 // Compute the actual parameter weight (W)
1042 TMatrixD paramWeight(trackParamAtCluster.GetCovariances());
1043 if (paramWeight.Determinant() != 0) {
1044 paramWeight.Invert();
1046 AliWarning(" Determinant = 0");
1050 // Compute the new cluster weight (U)
1051 TMatrixD clusterWeight(5,5);
1052 clusterWeight.Zero();
1053 clusterWeight(0,0) = 1. / cluster->GetErrX2();
1054 clusterWeight(2,2) = 1. / cluster->GetErrY2();
1056 // Compute the new parameters covariance matrix ( (W+U)^-1 )
1057 TMatrixD newParamCov(paramWeight,TMatrixD::kPlus,clusterWeight);
1058 if (newParamCov.Determinant() != 0) {
1059 newParamCov.Invert();
1061 AliWarning(" Determinant = 0");
1065 // Save the new parameters covariance matrix
1066 trackParamAtCluster.SetCovariances(newParamCov);
1068 // Compute the new parameters (p' = ((W+U)^-1)U(m-p) + p)
1069 TMatrixD tmp(clusterParam,TMatrixD::kMinus,param);
1070 TMatrixD tmp2(clusterWeight,TMatrixD::kMult,tmp); // U(m-p)
1071 TMatrixD newParam(newParamCov,TMatrixD::kMult,tmp2); // ((W+U)^-1)U(m-p)
1072 newParam += param; // ((W+U)^-1)U(m-p) + p
1074 // Save the new parameters
1075 trackParamAtCluster.SetParameters(newParam);
1077 // Compute the additional chi2 (= ((p'-p)^-1)W(p'-p) + ((p'-m)^-1)U(p'-m))
1078 tmp = newParam; // p'
1079 tmp -= param; // (p'-p)
1080 TMatrixD tmp3(paramWeight,TMatrixD::kMult,tmp); // W(p'-p)
1081 TMatrixD addChi2Track(tmp,TMatrixD::kTransposeMult,tmp3); // ((p'-p)^-1)W(p'-p)
1082 tmp = newParam; // p'
1083 tmp -= clusterParam; // (p'-m)
1084 TMatrixD tmp4(clusterWeight,TMatrixD::kMult,tmp); // U(p'-m)
1085 addChi2Track += TMatrixD(tmp,TMatrixD::kTransposeMult,tmp4); // ((p'-p)^-1)W(p'-p) + ((p'-m)^-1)U(p'-m)
1087 return addChi2Track(0,0);
1091 //__________________________________________________________________________
1092 void AliMUONTrackReconstructorK::UpdateTrack(AliMUONTrack &track, AliMUONTrackParam &trackParamAtCluster, Double_t addChi2)
1094 /// Add 1 cluster to the track candidate
1095 /// Update chi2 of the track
1097 // Flag cluster as being (not) removable
1098 if (AliMUONReconstructor::GetRecoParam()->RequestStation(trackParamAtCluster.GetClusterPtr()->GetChamberId()/2))
1099 trackParamAtCluster.SetRemovable(kFALSE);
1100 else trackParamAtCluster.SetRemovable(kTRUE);
1101 trackParamAtCluster.SetLocalChi2(0.); // --> Local chi2 not used
1103 // Update the track chi2 into trackParamAtCluster
1104 trackParamAtCluster.SetTrackChi2(track.GetGlobalChi2() + addChi2);
1106 // Update the chi2 of the new track
1107 track.SetGlobalChi2(trackParamAtCluster.GetTrackChi2());
1109 // Update array of TrackParamAtCluster
1110 track.AddTrackParamAtCluster(trackParamAtCluster,*(trackParamAtCluster.GetClusterPtr()));
1114 //__________________________________________________________________________
1115 void AliMUONTrackReconstructorK::UpdateTrack(AliMUONTrack &track, AliMUONTrackParam &trackParamAtCluster1, AliMUONTrackParam &trackParamAtCluster2,
1116 Double_t addChi2AtCluster1, Double_t addChi2AtCluster2)
1118 /// Add 2 clusters to the track candidate (order is important)
1119 /// Update track and local chi2
1121 // Update local chi2 at first cluster
1122 AliMUONVCluster* cluster1 = trackParamAtCluster1.GetClusterPtr();
1123 Double_t deltaX = trackParamAtCluster1.GetNonBendingCoor() - cluster1->GetX();
1124 Double_t deltaY = trackParamAtCluster1.GetBendingCoor() - cluster1->GetY();
1125 Double_t localChi2AtCluster1 = deltaX*deltaX / cluster1->GetErrX2() +
1126 deltaY*deltaY / cluster1->GetErrY2();
1127 trackParamAtCluster1.SetLocalChi2(localChi2AtCluster1);
1129 // Flag first cluster as being removable
1130 trackParamAtCluster1.SetRemovable(kTRUE);
1132 // Update local chi2 at second cluster
1133 AliMUONVCluster* cluster2 = trackParamAtCluster2.GetClusterPtr();
1134 AliMUONTrackParam extrapTrackParamAtCluster2(trackParamAtCluster1);
1135 AliMUONTrackExtrap::ExtrapToZ(&extrapTrackParamAtCluster2, trackParamAtCluster2.GetZ());
1136 deltaX = extrapTrackParamAtCluster2.GetNonBendingCoor() - cluster2->GetX();
1137 deltaY = extrapTrackParamAtCluster2.GetBendingCoor() - cluster2->GetY();
1138 Double_t localChi2AtCluster2 = deltaX*deltaX / cluster2->GetErrX2() +
1139 deltaY*deltaY / cluster2->GetErrY2();
1140 trackParamAtCluster2.SetLocalChi2(localChi2AtCluster2);
1142 // Flag second cluster as being removable
1143 trackParamAtCluster2.SetRemovable(kTRUE);
1145 // Update the track chi2 into trackParamAtCluster2
1146 trackParamAtCluster2.SetTrackChi2(track.GetGlobalChi2() + addChi2AtCluster2);
1148 // Update the track chi2 into trackParamAtCluster1
1149 trackParamAtCluster1.SetTrackChi2(trackParamAtCluster2.GetTrackChi2() + addChi2AtCluster1);
1151 // Update the chi2 of the new track
1152 track.SetGlobalChi2(trackParamAtCluster1.GetTrackChi2());
1154 // Update array of trackParamAtCluster
1155 track.AddTrackParamAtCluster(trackParamAtCluster1,*cluster1);
1156 track.AddTrackParamAtCluster(trackParamAtCluster2,*cluster2);
1160 //__________________________________________________________________________
1161 Bool_t AliMUONTrackReconstructorK::RecoverTrack(AliMUONTrack &trackCandidate, AliMUONVClusterStore& clusterStore, Int_t nextStation)
1163 /// Try to recover the track candidate in the next station
1164 /// by removing the worst of the two clusters attached in the current station
1165 /// Return kTRUE if recovering succeeds
1166 AliDebug(1,"Enter RecoverTrack");
1168 // Do not try to recover track until we have attached cluster(s) on station(1..) 3
1169 if (nextStation > 1) return kFALSE;
1171 Int_t worstClusterNumber = -1;
1172 Double_t localChi2, worstLocalChi2 = -1.;
1174 // Look for the cluster to remove
1175 for (Int_t clusterNumber = 0; clusterNumber < 2; clusterNumber++) {
1176 AliMUONTrackParam *trackParamAtCluster = (AliMUONTrackParam*)trackCandidate.GetTrackParamAtCluster()->UncheckedAt(clusterNumber);
1178 // check if current cluster is in the previous station
1179 if (trackParamAtCluster->GetClusterPtr()->GetChamberId()/2 != nextStation+1) break;
1181 // check if current cluster is removable
1182 if (!trackParamAtCluster->IsRemovable()) return kFALSE;
1184 // reset the current cluster as being not removable if it is on a required station
1185 if (AliMUONReconstructor::GetRecoParam()->RequestStation(nextStation+1)) trackParamAtCluster->SetRemovable(kFALSE);
1187 // Pick up cluster with the worst chi2
1188 localChi2 = trackParamAtCluster->GetLocalChi2();
1189 if (localChi2 > worstLocalChi2) {
1190 worstLocalChi2 = localChi2;
1191 worstClusterNumber = clusterNumber;
1195 // check if worst cluster found
1196 if (worstClusterNumber < 0) return kFALSE;
1198 // Remove the worst cluster
1199 trackCandidate.RemoveTrackParamAtCluster((AliMUONTrackParam*)trackCandidate.GetTrackParamAtCluster()->UncheckedAt(worstClusterNumber));
1201 // Re-calculate track parameters at the (new) first cluster
1202 RetracePartialTrack(trackCandidate,(AliMUONTrackParam*)trackCandidate.GetTrackParamAtCluster()->UncheckedAt(1));
1204 // skip track with absolute bending momentum out of limits
1205 Double_t bendingMomentum = TMath::Abs(1. / ((AliMUONTrackParam*)trackCandidate.GetTrackParamAtCluster()->First())->GetInverseBendingMomentum());
1206 if (bendingMomentum < AliMUONReconstructor::GetRecoParam()->GetMinBendingMomentum() ||
1207 bendingMomentum > AliMUONReconstructor::GetRecoParam()->GetMaxBendingMomentum()) return kFALSE;
1209 // Look for new cluster(s) in next station
1210 return FollowTrackInStation(trackCandidate, clusterStore, nextStation);
1214 //__________________________________________________________________________
1215 Bool_t AliMUONTrackReconstructorK::RunSmoother(AliMUONTrack &track)
1217 /// Compute new track parameters and their covariances using smoother
1218 AliDebug(1,"Enter UseSmoother");
1220 AliMUONTrackParam *previousTrackParam = (AliMUONTrackParam*) track.GetTrackParamAtCluster()->First();
1222 // Smoothed parameters and covariances at first cluster = filtered parameters and covariances
1223 previousTrackParam->SetSmoothParameters(previousTrackParam->GetParameters());
1224 previousTrackParam->SetSmoothCovariances(previousTrackParam->GetCovariances());
1226 // Compute local chi2 at first cluster
1227 AliMUONVCluster *cluster = previousTrackParam->GetClusterPtr();
1228 Double_t dX = cluster->GetX() - previousTrackParam->GetNonBendingCoor();
1229 Double_t dY = cluster->GetY() - previousTrackParam->GetBendingCoor();
1230 Double_t localChi2 = dX * dX / cluster->GetErrX2() + dY * dY / cluster->GetErrY2();
1232 // Save local chi2 at first cluster
1233 previousTrackParam->SetLocalChi2(localChi2);
1235 AliMUONTrackParam *currentTrackParam = (AliMUONTrackParam*) track.GetTrackParamAtCluster()->After(previousTrackParam);
1236 while (currentTrackParam) {
1239 const TMatrixD &extrapParameters = previousTrackParam->GetExtrapParameters(); // X(k+1 k)
1240 const TMatrixD &filteredParameters = currentTrackParam->GetParameters(); // X(k k)
1241 const TMatrixD &previousSmoothParameters = previousTrackParam->GetSmoothParameters(); // X(k+1 n)
1242 const TMatrixD &propagator = previousTrackParam->GetPropagator(); // F(k)
1243 const TMatrixD &extrapCovariances = previousTrackParam->GetExtrapCovariances(); // C(k+1 k)
1244 const TMatrixD &filteredCovariances = currentTrackParam->GetCovariances(); // C(k k)
1245 const TMatrixD &previousSmoothCovariances = previousTrackParam->GetSmoothCovariances(); // C(k+1 n)
1247 // Compute smoother gain: A(k) = C(kk) * F(f)^t * (C(k+1 k))^-1
1248 TMatrixD extrapWeight(extrapCovariances);
1249 if (extrapWeight.Determinant() != 0) {
1250 extrapWeight.Invert(); // (C(k+1 k))^-1
1252 AliWarning(" Determinant = 0");
1255 TMatrixD smootherGain(filteredCovariances,TMatrixD::kMultTranspose,propagator); // C(kk) * F(f)^t
1256 smootherGain *= extrapWeight; // C(kk) * F(f)^t * (C(k+1 k))^-1
1258 // Compute smoothed parameters: X(k n) = X(k k) + A(k) * (X(k+1 n) - X(k+1 k))
1259 TMatrixD tmpParam(previousSmoothParameters,TMatrixD::kMinus,extrapParameters); // X(k+1 n) - X(k+1 k)
1260 TMatrixD smoothParameters(smootherGain,TMatrixD::kMult,tmpParam); // A(k) * (X(k+1 n) - X(k+1 k))
1261 smoothParameters += filteredParameters; // X(k k) + A(k) * (X(k+1 n) - X(k+1 k))
1263 // Save smoothed parameters
1264 currentTrackParam->SetSmoothParameters(smoothParameters);
1266 // Compute smoothed covariances: C(k n) = C(k k) + A(k) * (C(k+1 n) - C(k+1 k)) * (A(k))^t
1267 TMatrixD tmpCov(previousSmoothCovariances,TMatrixD::kMinus,extrapCovariances); // C(k+1 n) - C(k+1 k)
1268 TMatrixD tmpCov2(tmpCov,TMatrixD::kMultTranspose,smootherGain); // (C(k+1 n) - C(k+1 k)) * (A(k))^t
1269 TMatrixD smoothCovariances(smootherGain,TMatrixD::kMult,tmpCov2); // A(k) * (C(k+1 n) - C(k+1 k)) * (A(k))^t
1270 smoothCovariances += filteredCovariances; // C(k k) + A(k) * (C(k+1 n) - C(k+1 k)) * (A(k))^t
1272 // Save smoothed covariances
1273 currentTrackParam->SetSmoothCovariances(smoothCovariances);
1275 // Compute smoothed residual: r(k n) = cluster - X(k n)
1276 cluster = currentTrackParam->GetClusterPtr();
1277 TMatrixD smoothResidual(2,1);
1278 smoothResidual.Zero();
1279 smoothResidual(0,0) = cluster->GetX() - smoothParameters(0,0);
1280 smoothResidual(1,0) = cluster->GetY() - smoothParameters(2,0);
1282 // Compute weight of smoothed residual: W(k n) = (clusterCov - C(k n))^-1
1283 TMatrixD smoothResidualWeight(2,2);
1284 smoothResidualWeight(0,0) = cluster->GetErrX2() - smoothCovariances(0,0);
1285 smoothResidualWeight(0,1) = - smoothCovariances(0,2);
1286 smoothResidualWeight(1,0) = - smoothCovariances(2,0);
1287 smoothResidualWeight(1,1) = cluster->GetErrY2() - smoothCovariances(2,2);
1288 if (smoothResidualWeight.Determinant() != 0) {
1289 smoothResidualWeight.Invert();
1291 AliWarning(" Determinant = 0");
1295 // Compute local chi2 = (r(k n))^t * W(k n) * r(k n)
1296 TMatrixD tmpChi2(smoothResidual,TMatrixD::kTransposeMult,smoothResidualWeight); // (r(k n))^t * W(k n)
1297 TMatrixD localChi2(tmpChi2,TMatrixD::kMult,smoothResidual); // (r(k n))^t * W(k n) * r(k n)
1300 currentTrackParam->SetLocalChi2(localChi2(0,0));
1302 previousTrackParam = currentTrackParam;
1303 currentTrackParam = (AliMUONTrackParam*) track.GetTrackParamAtCluster()->After(previousTrackParam);
1310 //__________________________________________________________________________
1311 void AliMUONTrackReconstructorK::ComplementTracks(const AliMUONVClusterStore& clusterStore)
1313 /// Complete tracks by adding missing clusters (if there is an overlap between
1314 /// two detection elements, the track may have two clusters in the same chamber)
1315 /// Recompute track parameters and covariances at each clusters
1316 AliDebug(1,"Enter ComplementTracks");
1318 Int_t chamberId, detElemId;
1319 Double_t chi2OfCluster, addChi2TrackAtCluster, bestAddChi2TrackAtCluster;
1320 Double_t maxChi2OfCluster = 2. * AliMUONReconstructor::GetRecoParam()->GetSigmaCutForTracking() *
1321 AliMUONReconstructor::GetRecoParam()->GetSigmaCutForTracking(); // 2 because 2 quantities in chi2
1322 Bool_t foundOneCluster, trackModified;
1323 AliMUONVCluster *cluster;
1324 AliMUONTrackParam *trackParam, *previousTrackParam, *nextTrackParam, trackParamAtCluster, bestTrackParamAtCluster;
1326 // Remove double track to complete only "good" tracks
1327 RemoveDoubleTracks();
1329 AliMUONTrack *track = (AliMUONTrack*) fRecTracksPtr->First();
1331 trackModified = kFALSE;
1333 trackParam = (AliMUONTrackParam*)track->GetTrackParamAtCluster()->First();
1334 previousTrackParam = trackParam;
1335 while (trackParam) {
1336 foundOneCluster = kFALSE;
1337 bestAddChi2TrackAtCluster = 1.e10;
1338 chamberId = trackParam->GetClusterPtr()->GetChamberId();
1339 detElemId = trackParam->GetClusterPtr()->GetDetElemId();
1341 // prepare nextTrackParam before adding new cluster because of the sorting
1342 nextTrackParam = (AliMUONTrackParam*)track->GetTrackParamAtCluster()->After(trackParam);
1344 // Create iterators to loop over clusters in current chamber
1345 TIter nextInCh(clusterStore.CreateChamberIterator(chamberId,chamberId));
1347 // look for one second candidate in the same chamber
1348 while ( ( cluster = static_cast<AliMUONVCluster*>(nextInCh()) ) ) {
1350 // look for a cluster in another detection element
1351 if (cluster->GetDetElemId() == detElemId) continue;
1353 // try to add the current cluster fast
1354 if (!TryOneClusterFast(*trackParam, cluster)) continue;
1356 // try to add the current cluster accurately
1357 // never use track parameters at last cluster because the covariance matrix is meaningless
1358 if (nextTrackParam) chi2OfCluster = TryOneCluster(*trackParam, cluster, trackParamAtCluster);
1359 else chi2OfCluster = TryOneCluster(*previousTrackParam, cluster, trackParamAtCluster);
1361 // if good chi2 then consider to add this cluster to the track
1362 if (chi2OfCluster < maxChi2OfCluster) {
1364 // Compute local track parameters including current cluster using kalman filter
1365 addChi2TrackAtCluster = RunKalmanFilter(trackParamAtCluster);
1367 // keep track of the best cluster
1368 if (addChi2TrackAtCluster < bestAddChi2TrackAtCluster) {
1369 bestAddChi2TrackAtCluster = addChi2TrackAtCluster;
1370 bestTrackParamAtCluster = trackParamAtCluster;
1371 foundOneCluster = kTRUE;
1378 // add new cluster if any
1379 if (foundOneCluster) {
1380 trackParam->SetRemovable(kTRUE);
1381 bestTrackParamAtCluster.SetRemovable(kTRUE);
1382 track->AddTrackParamAtCluster(bestTrackParamAtCluster,*(bestTrackParamAtCluster.GetClusterPtr()));
1383 trackModified = kTRUE;
1386 previousTrackParam = trackParam;
1387 trackParam = nextTrackParam;
1390 // re-compute track parameters using kalman filter if needed
1391 if (trackModified) RetraceTrack(*track,kTRUE);
1393 track = (AliMUONTrack*) fRecTracksPtr->After(track);
1398 //__________________________________________________________________________
1399 void AliMUONTrackReconstructorK::ImproveTrack(AliMUONTrack &track)
1401 /// Improve the given track by removing removable clusters with local chi2 highter than the defined cut
1402 /// Removable clusters are identified by the method AliMUONTrack::TagRemovableClusters()
1403 /// Recompute track parameters and covariances at the remaining clusters
1404 AliDebug(1,"Enter ImproveTrack");
1406 Double_t localChi2, worstLocalChi2;
1407 AliMUONTrackParam *trackParamAtCluster, *worstTrackParamAtCluster, *nextTrackParam;
1409 Double_t sigmaCut2 = AliMUONReconstructor::GetRecoParam()->GetSigmaCutForImprovement() *
1410 AliMUONReconstructor::GetRecoParam()->GetSigmaCutForImprovement();
1412 while (!track.IsImproved()) {
1414 // identify removable clusters
1415 track.TagRemovableClusters();
1417 // Run smoother if required
1419 if (AliMUONReconstructor::GetRecoParam()->UseSmoother()) smoothed = RunSmoother(track);
1421 // Use standard procedure to compute local chi2 if smoother not required or not working
1424 // Update track parameters and covariances
1425 track.UpdateCovTrackParamAtCluster();
1427 // Compute local chi2 of each clusters
1428 track.ComputeLocalChi2(kTRUE);
1431 // Look for the cluster to remove
1432 worstTrackParamAtCluster = 0x0;
1433 worstLocalChi2 = 0.;
1434 trackParamAtCluster = (AliMUONTrackParam*)track.GetTrackParamAtCluster()->First();
1435 while (trackParamAtCluster) {
1437 // save parameters into smooth parameters in case of smoother did not work properly
1438 if (AliMUONReconstructor::GetRecoParam()->UseSmoother() && !smoothed) {
1439 trackParamAtCluster->SetSmoothParameters(trackParamAtCluster->GetParameters());
1440 trackParamAtCluster->SetSmoothCovariances(trackParamAtCluster->GetCovariances());
1443 // Pick up cluster with the worst chi2
1444 localChi2 = trackParamAtCluster->GetLocalChi2();
1445 if (localChi2 > worstLocalChi2) {
1446 worstLocalChi2 = localChi2;
1447 worstTrackParamAtCluster = trackParamAtCluster;
1450 trackParamAtCluster = (AliMUONTrackParam*)track.GetTrackParamAtCluster()->After(trackParamAtCluster);
1453 // Check if worst cluster found
1454 if (!worstTrackParamAtCluster) {
1455 AliWarning("Bad local chi2 values?");
1459 // Check whether the worst chi2 is under requirement or not
1460 if (worstLocalChi2 < 2. * sigmaCut2) { // 2 because 2 quantities in chi2
1461 track.SetImproved(kTRUE);
1465 // if the worst cluster is not removable then stop improvement
1466 if (!worstTrackParamAtCluster->IsRemovable()) break;
1468 // get track parameters at cluster next to the one to be removed
1469 nextTrackParam = (AliMUONTrackParam*) track.GetTrackParamAtCluster()->After(worstTrackParamAtCluster);
1471 // Remove the worst cluster
1472 track.RemoveTrackParamAtCluster(worstTrackParamAtCluster);
1474 // Re-calculate track parameters
1475 // - from the cluster immediately downstream the one suppressed
1476 // - or from the begining - if parameters have been re-computed using the standard method (kalman parameters have been lost)
1477 // - or if the removed cluster was the last one
1478 if (smoothed && nextTrackParam) RetracePartialTrack(track,nextTrackParam);
1479 else RetraceTrack(track,kTRUE);
1481 // Printout for debuging
1482 if ((AliLog::GetDebugLevel("MUON","AliMUONTrackReconstructorK") >= 1) || (AliLog::GetGlobalDebugLevel() >= 1)) {
1483 cout << "ImproveTracks: track " << fRecTracksPtr->IndexOf(&track)+1 << " improved " << endl;
1490 //__________________________________________________________________________
1491 void AliMUONTrackReconstructorK::FinalizeTrack(AliMUONTrack &track)
1493 /// Update track parameters and covariances at each attached cluster
1494 /// using smoother if required, if not already done
1496 AliMUONTrackParam *trackParamAtCluster;
1497 Bool_t smoothed = kFALSE;
1499 // update track parameters (using smoother if required) if not already done
1500 if (!track.IsImproved()) {
1502 if (AliMUONReconstructor::GetRecoParam()->UseSmoother()) smoothed = RunSmoother(track);
1503 if (!smoothed) track.UpdateCovTrackParamAtCluster();
1504 } else smoothed = AliMUONReconstructor::GetRecoParam()->UseSmoother();
1506 // copy smoothed parameters and covariances if any
1509 trackParamAtCluster = (AliMUONTrackParam*) (track.GetTrackParamAtCluster()->First());
1510 while (trackParamAtCluster) {
1512 trackParamAtCluster->SetParameters(trackParamAtCluster->GetSmoothParameters());
1513 trackParamAtCluster->SetCovariances(trackParamAtCluster->GetSmoothCovariances());
1515 trackParamAtCluster = (AliMUONTrackParam*) (track.GetTrackParamAtCluster()->After(trackParamAtCluster));
1522 //__________________________________________________________________________
1523 Bool_t AliMUONTrackReconstructorK::RefitTrack(AliMUONTrack &track)
1525 /// re-fit the given track
1527 // check validity of the track
1528 if (!track.IsValid()) {
1529 AliWarning("the track does not contain enough clusters --> unable to refit");
1533 // re-compute track parameters and covariances using Kalman filter
1534 RetraceTrack(track,kTRUE);
1536 // Improve the reconstructed tracks if required
1537 if (AliMUONReconstructor::GetRecoParam()->ImproveTracks()) ImproveTrack(track);
1539 // Fill AliMUONTrack data members
1540 FinalizeTrack(track);