]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONRefitter.cxx
Updates
[u/mrichter/AliRoot.git] / MUON / AliMUONRefitter.cxx
index 035f1d15ce2b307653ca14ccd356148ccd8dce0d..51848ed977c3cab9b1a0a8fa2531d07dc8b5daa0 100644 (file)
@@ -69,12 +69,13 @@ AliMUONRefitter::AliMUONRefitter(const AliMUONRecoParam* recoParam)
   fkESDInterface(0x0),
   fGeometryTransformer(0x0),
   fClusterServer(0x0),
-  fTracker(0x0)
+  fTracker(0x0),
+  nextClusterIndex(0)
 {
   /// Default constructor
   CreateGeometryTransformer();
   CreateClusterServer(*fGeometryTransformer);
-  if (fClusterServer) fTracker = AliMUONTracker::CreateTrackReconstructor(recoParam,fClusterServer);
+  if (fClusterServer) fTracker = AliMUONTracker::CreateTrackReconstructor(recoParam,fClusterServer,fGeometryTransformer);
   if (!fClusterServer || !fTracker) {
     AliFatal("refitter initialization failed");
     exit(-1);
@@ -216,6 +217,12 @@ AliMUONVClusterStore* AliMUONRefitter::ReClusterize(UInt_t trackId, UInt_t clust
   fClusterServer->UseDigits(next,fkESDInterface->GetDigits());
   fClusterServer->Clusterize(cluster->GetChamberId(),*clusterStore,AliMpArea(),fkRecoParam);
   
+  // set the uniqueID of the new clusters
+  TIter nextCl(clusterStore->CreateIterator());
+  AliMUONVCluster* newCluster = 0x0;
+  while ((newCluster = static_cast<AliMUONVCluster*>(nextCl())))
+    newCluster->SetUniqueID(AliMUONVCluster::BuildUniqueID(cluster->GetChamberId(), cluster->GetDetElemId(), nextClusterIndex++));
+  
   return clusterStore;
 }
 
@@ -250,6 +257,12 @@ AliMUONVClusterStore* AliMUONRefitter::ReClusterize(UInt_t clusterId)
   fClusterServer->UseDigits(next,fkESDInterface->GetDigits());
   fClusterServer->Clusterize(cluster->GetChamberId(),*clusterStore,AliMpArea(),fkRecoParam);
   
+  // set the uniqueID of the new clusters
+  TIter nextCl(clusterStore->CreateIterator());
+  AliMUONVCluster* newCluster = 0x0;
+  while ((newCluster = static_cast<AliMUONVCluster*>(nextCl())))
+    newCluster->SetUniqueID(AliMUONVCluster::BuildUniqueID(cluster->GetChamberId(), cluster->GetDetElemId(), nextClusterIndex++));
+  
   return clusterStore;
 }
 
@@ -280,7 +293,7 @@ AliMUONTrack* AliMUONRefitter::RetrackFromDigits(const AliMUONTrack& track)
   
   // check if digits exist
   UInt_t trackId = track.GetUniqueID();
-  if (fkESDInterface->GetNDigits(trackId) == 0) {
+  if (!fkESDInterface->DigitsStored(trackId)) {
     AliError(Form("no digit attached to track #%d",trackId));
     return 0x0;
   }
@@ -318,6 +331,12 @@ AliMUONTrack* AliMUONRefitter::RetrackFromDigits(const AliMUONTrack& track)
       continue;
     }
     
+    // set the uniqueID of the new clusters
+    TIter nextCl(newClusterStore->CreateIterator());
+    AliMUONVCluster* newCluster = 0x0;
+    while ((newCluster = static_cast<AliMUONVCluster*>(nextCl())))
+      newCluster->SetUniqueID(AliMUONVCluster::BuildUniqueID(cluster->GetChamberId(), cluster->GetDetElemId(), nextClusterIndex++));
+    
     // add the new cluster(s) to the tracks
     if (!AddClusterToTracks(*newClusterStore, *newTrackStore)) {
       delete newClusterStore;
@@ -343,7 +362,10 @@ AliMUONTrack* AliMUONRefitter::RetrackFromDigits(const AliMUONTrack& track)
     // refit the track
     if (!fTracker->RefitTrack(*currentTrack)) continue;
     
-    // find best track (the one with the higher number of cluster or the best chi2 in case of equality)
+    // check the status of the improvement if enabled
+    if (fkRecoParam->ImproveTracks() && !currentTrack->IsImproved()) continue;
+    
+    // find best track (the one with the highest number of cluster or the best chi2 in case of equality)
     currentNCluster = currentTrack->GetNClusters();
     currentChi2 = currentTrack->GetGlobalChi2();
     if (currentNCluster > bestNClusters || (currentNCluster == bestNClusters && currentChi2 < bestChi2)) {