]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONClusterStoreV2.cxx
- Disentangle masks effect from trigger chamber efficiency estimation.
[u/mrichter/AliRoot.git] / MUON / AliMUONClusterStoreV2.cxx
index 9774a3eb51b9df1d6039b70c7fd711a53379f495..e4c0552c21d8b89c42de769d0fc46e71bb5493e4 100644 (file)
@@ -90,7 +90,11 @@ void AliMUONClusterStoreV2::Clear(Option_t*)
   /// Clear the internal cluster array AND the index
   fClusters->Clear("C");
   if (fMap) {
-    fMap->Clear("C");
+    Int_t nChamber = AliMpConstants::NofTrackingChambers();
+    for (Int_t chamber=0; chamber<nChamber; chamber++) {
+      AliMpExMap *map = static_cast<AliMpExMap *>(fMap->UncheckedAt(chamber));
+      map->Clear("C");
+    }
     fMapped = kFALSE;
   }
 }
@@ -145,7 +149,7 @@ AliMUONVCluster* AliMUONClusterStoreV2::Add(const AliMUONVCluster& vCluster)
   // check that there is no cluster with the same Id
   AliMUONVCluster *c = FindObject(cluster->GetUniqueID());
   if (c) {
-    AliError("cluster store already contains a cluster with the same ID --> add() aborted:");
+    AliError("cluster store already contains a cluster with the same ID --> add() exited:");
     c->Print("FULL");
     return 0x0;
   }
@@ -172,7 +176,7 @@ AliMUONVCluster* AliMUONClusterStoreV2::Add(Int_t chamberId, Int_t detElemId, In
   // check that there is no cluster with the same Id
   AliMUONVCluster *c = FindObject(AliMUONVCluster::BuildUniqueID(chamberId, detElemId, clusterIndex));
   if (c) {
-    AliError("cluster store already contains a cluster with the same ID --> add() aborted:");
+    AliError("cluster store already contains a cluster with the same ID --> add() exited:");
     c->Print("FULL");
     return 0x0;
   }
@@ -191,10 +195,15 @@ AliMUONVCluster* AliMUONClusterStoreV2::Remove(AliMUONVCluster& cluster)
   /// Remove a cluster
   AliMUONVCluster* c = static_cast<AliMUONVCluster*>(fClusters->Remove(&cluster));
   
-  if (c) {
+  if (c) 
+  {
     fClusters->Compress();
     fMapped = kFALSE;
   }
+  else
+  {
+    AliError("Could not remove cluster from array");
+  }
   
   return c;
 }
@@ -207,16 +216,24 @@ void AliMUONClusterStoreV2::ReMap()
   
   // Create (or clear) the TClonesArray of map
   Int_t nChamber = AliMpConstants::NofTrackingChambers();
-  if (!fMap) fMap = new TClonesArray("AliMpExMap",nChamber);
-  else fMap->Clear("C");
   
-  // Create one map per chamber
-  AliMpExMap *map;
-  for (Int_t chamber=0; chamber<nChamber; chamber++) {
-    map = new((*fMap)[chamber]) AliMpExMap(kTRUE);
-    map->SetOwner(kFALSE);
+  if (!fMap) {
+    fMap = new TClonesArray("AliMpExMap",nChamber);
+    
+    // Create one map per chamber
+    AliMpExMap *map;
+    for (Int_t chamber=0; chamber<nChamber; chamber++) {
+      map = new((*fMap)[chamber]) AliMpExMap;
+      map->SetOwner(kFALSE);
+    }
   }
-  
+  else {
+    for (Int_t chamber=0; chamber<nChamber; chamber++) {
+      AliMpExMap *map = static_cast<AliMpExMap *>(fMap->UncheckedAt(chamber));
+      map->Clear("C");
+    }
+  }  
+
   // Fill the maps
   TIter next(fClusters);
   AliMUONVCluster* cluster;