Correction in the loop over track references. Upper bound has been affected
authormorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 23 May 2006 15:21:38 +0000 (15:21 +0000)
committermorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 23 May 2006 15:21:38 +0000 (15:21 +0000)
by removing hits.

STEER/AliMC.cxx
STEER/AliModule.cxx

index a913076..31db1a8 100644 (file)
@@ -1041,17 +1041,17 @@ void AliMC::RemapTrackReferencesIDs(Int_t *map)
   // Called at finish primary
   //
   if (!fTrackReferences) return;
-  for (Int_t i=0;i<fTrackReferences->GetEntries();i++){
-    AliTrackReference * ref = dynamic_cast<AliTrackReference*>(fTrackReferences->UncheckedAt(i));
-    if (ref) {
-      Int_t newID = map[ref->GetTrack()];
-      if (newID>=0) ref->SetTrack(newID);
-      else {
-        //ref->SetTrack(-1);
-        ref->SetBit(kNotDeleted,kFALSE);
-        fTrackReferences->RemoveAt(i);  
-      }      
-    }
+  Int_t nEntries = fTrackReferences->GetEntries();
+  for (Int_t i=0; i < nEntries; i++){
+      AliTrackReference * ref = dynamic_cast<AliTrackReference*>(fTrackReferences->UncheckedAt(i));
+      if (ref) {
+         Int_t newID = map[ref->GetTrack()];
+         if (newID>=0) ref->SetTrack(newID);
+         else {
+             ref->SetBit(kNotDeleted,kFALSE);
+             fTrackReferences->RemoveAt(i);  
+         }      
+      } // if ref
   }
   fTrackReferences->Compress();
 }
index 4fd333f..46e97fb 100644 (file)
@@ -695,13 +695,14 @@ void AliModule::RemapTrackReferencesIDs(Int_t *map)
   // Called at finish primary
   //
   if (!fTrackReferences) return;
-  for (Int_t i=0;i<fTrackReferences->GetEntries();i++){
+  Int_t nEntries = fTrackReferences->GetEntries();
+  
+  for (Int_t i=0;i<nEntries;i++){
     AliTrackReference * ref = dynamic_cast<AliTrackReference*>(fTrackReferences->UncheckedAt(i));
     if (ref) {
       Int_t newID = map[ref->GetTrack()];
       if (newID>=0) ref->SetTrack(newID);
       else {
-        //ref->SetTrack(-1);
         ref->SetBit(kNotDeleted,kFALSE);
         fTrackReferences->RemoveAt(i);  
       }