diff --git a/reco/L1/CbmL1ReadEvent.cxx b/reco/L1/CbmL1ReadEvent.cxx index ffe86377ff9e8e03f7f6cc71c9bd2e17b12b4000..d8ff079c19b86a97f9da0a8bd950d648249a1b0f 100644 --- a/reco/L1/CbmL1ReadEvent.cxx +++ b/reco/L1/CbmL1ReadEvent.cxx @@ -928,8 +928,14 @@ void CbmL1::ReadEvent(L1AlgoInputData* fData_, float& TsStart, float& TsLength, if (fVerbose >= 10) { cout << "ReadEvent: strips are read." << endl; } // -- save hits -- - int nEffHits = 0; - SortedIndex.resize(max(nEntSts, nHits)); + int nEffHits = 0; + int maxHitIndex = 0; + if (fTofHits) maxHitIndex = fTofHits->GetEntriesFast() + nMvdHits + nStsHits + nMuchHits + nTrdHits; + else + maxHitIndex = nMvdHits + nStsHits + nMuchHits + nTrdHits; + + SortedIndex.resize(max(nEntSts, maxHitIndex)); + vector<float> vStsZPos_temp; // temp array for unsorted z positions of detectors segments for (int i = 0; i < nHits; i++) {