]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Do not add vertices w/o contributors to temporary array
authorshahoian <ruben.shahoyan@cern.ch>
Tue, 29 Jul 2014 16:30:34 +0000 (18:30 +0200)
committershahoian <ruben.shahoyan@cern.ch>
Tue, 29 Jul 2014 16:31:19 +0000 (18:31 +0200)
STEER/ESD/AliVertexerTracks.cxx

index 6ed9fa70ea860a05f07461bb5395cc1136e1a99f..7cfa45b5b6da9f348e6063f8bbc936fbe6e2d9f7 100644 (file)
@@ -1928,6 +1928,11 @@ Bool_t AliVertexerTracks::FindNextVertexMV()
     // create indices
     int ntrk = fTrkArraySel.GetEntries();
     int nindices = fCurrentVertex->GetNContributors() - (fConstraint ? 1:0);
+    if (nindices<1) {
+      delete fCurrentVertex;
+      fCurrentVertex = 0;
+      return kFALSE;
+    }
     UShort_t *indices = 0;
     if (nindices>0) indices = new UShort_t[nindices];
     int nadded = 0;
@@ -1937,8 +1942,10 @@ Bool_t AliVertexerTracks::FindNextVertexMV()
       t->SetBit(kBitAccounted);
       indices[nadded++] = fIdSel[itr];
     }
-    if (nadded!=nindices) printf("Mismatch : NInd: %d Nadd: %d\n",nindices,nadded);
-    fCurrentVertex->SetIndices(nindices,indices);
+    if (nadded!=nindices) {
+      printf("Mismatch : NInd: %d Nadd: %d\n",nindices,nadded);
+    }
+    fCurrentVertex->SetIndices(nadded,indices);
     // set vertex title
     TString title="VertexerTracksMVNoConstraint";
     if(fConstraint) title="VertexerTracksMVWithConstraint";