diff --git a/Examples/Io/Root/src/RootMaterialTrackReader.cpp b/Examples/Io/Root/src/RootMaterialTrackReader.cpp index d1b1c443c92..70b2ab8d997 100644 --- a/Examples/Io/Root/src/RootMaterialTrackReader.cpp +++ b/Examples/Io/Root/src/RootMaterialTrackReader.cpp @@ -91,7 +91,7 @@ RootMaterialTrackReader::RootMaterialTrackReader(const Config& config, { // necessary to guarantee that m_inputChain->GetV1() is valid for the // entire range - m_inputChain->SetEstimate(nentries); + m_inputChain->SetEstimate(nentries + 1); m_entryNumbers.resize(nentries); m_inputChain->Draw("event_id", "", "goff"); diff --git a/Examples/Io/Root/src/RootParticleReader.cpp b/Examples/Io/Root/src/RootParticleReader.cpp index a76255dbb4a..631fc25ef3e 100644 --- a/Examples/Io/Root/src/RootParticleReader.cpp +++ b/Examples/Io/Root/src/RootParticleReader.cpp @@ -80,6 +80,10 @@ RootParticleReader::RootParticleReader(const RootParticleReader::Config& config, // Sort the entry numbers of the events { + // necessary to guarantee that m_inputChain->GetV1() is valid for the + // entire range + m_inputChain->SetEstimate(m_events + 1); + m_entryNumbers.resize(m_events); m_inputChain->Draw("event_id", "", "goff"); RootUtility::stableSort(m_inputChain->GetEntries(), m_inputChain->GetV1(), diff --git a/Examples/Io/Root/src/RootTrackSummaryReader.cpp b/Examples/Io/Root/src/RootTrackSummaryReader.cpp index 1827c26ad30..9ff3590271a 100644 --- a/Examples/Io/Root/src/RootTrackSummaryReader.cpp +++ b/Examples/Io/Root/src/RootTrackSummaryReader.cpp @@ -99,6 +99,10 @@ RootTrackSummaryReader::RootTrackSummaryReader( // Sort the entry numbers of the events { + // necessary to guarantee that m_inputChain->GetV1() is valid for the + // entire range + m_inputChain->SetEstimate(m_events + 1); + m_entryNumbers.resize(m_events); m_inputChain->Draw("event_nr", "", "goff"); RootUtility::stableSort(m_inputChain->GetEntries(), m_inputChain->GetV1(), diff --git a/Examples/Io/Root/src/RootVertexReader.cpp b/Examples/Io/Root/src/RootVertexReader.cpp index 336e0364f9b..31a8e6d5bec 100644 --- a/Examples/Io/Root/src/RootVertexReader.cpp +++ b/Examples/Io/Root/src/RootVertexReader.cpp @@ -8,13 +8,12 @@ #include "ActsExamples/Io/Root/RootVertexReader.hpp" -#include "Acts/Definitions/PdgParticle.hpp" #include "Acts/Utilities/Logger.hpp" #include "ActsExamples/EventData/SimParticle.hpp" #include "ActsExamples/Framework/AlgorithmContext.hpp" +#include "ActsExamples/Io/Root/RootUtility.hpp" #include "ActsFatras/EventData/ProcessType.hpp" -#include #include #include #include @@ -64,11 +63,14 @@ RootVertexReader::RootVertexReader(const RootVertexReader::Config& config, // Sort the entry numbers of the events { + // necessary to guarantee that m_inputChain->GetV1() is valid for the + // entire range + m_inputChain->SetEstimate(m_events + 1); + m_entryNumbers.resize(m_events); m_inputChain->Draw("event_id", "", "goff"); - // Sort to get the entry numbers of the ordered events - TMath::Sort(m_inputChain->GetEntries(), m_inputChain->GetV1(), - m_entryNumbers.data(), false); + RootUtility::stableSort(m_inputChain->GetEntries(), m_inputChain->GetV1(), + m_entryNumbers.data(), false); } } diff --git a/Examples/Scripts/TrackingPerformance/TreeReader.h b/Examples/Scripts/TrackingPerformance/TreeReader.h index 4ab47746dc0..b12ce19d373 100644 --- a/Examples/Scripts/TrackingPerformance/TreeReader.h +++ b/Examples/Scripts/TrackingPerformance/TreeReader.h @@ -145,6 +145,7 @@ struct TrackStatesReader : public TreeReader { // It's not necessary if you just need to read one file, but please do it to // synchronize events if multiple root files are read if (sortEvents) { + tree->SetEstimate(tree->GetEntries() + 1); entryNumbers.resize(tree->GetEntries()); tree->Draw("event_nr", "", "goff"); // Sort to get the entry numbers of the ordered events @@ -338,6 +339,7 @@ struct TrackSummaryReader : public TreeReader { // It's not necessary if you just need to read one file, but please do it to // synchronize events if multiple root files are read if (sortEvents) { + tree->SetEstimate(tree->GetEntries() + 1); entryNumbers.resize(tree->GetEntries()); tree->Draw("event_nr", "", "goff"); // Sort to get the entry numbers of the ordered events @@ -368,7 +370,8 @@ struct TrackSummaryReader : public TreeReader { std::vector>* outlierLayer = new std::vector>; std::vector* nMajorityHits = new std::vector; - std::vector* majorityParticleId = new std::vector; + std::vector* majorityParticleId = + new std::vector; std::vector* hasFittedParams = new std::vector; @@ -427,6 +430,7 @@ struct ParticleReader : public TreeReader { // It's not necessary if you just need to read one file, but please do it to // synchronize events if multiple root files are read if (sortEvents) { + tree->SetEstimate(tree->GetEntries() + 1); entryNumbers.resize(tree->GetEntries()); tree->Draw("event_id", "", "goff"); // Sort to get the entry numbers of the ordered events @@ -436,7 +440,8 @@ struct ParticleReader : public TreeReader { } // Get all the particles with requested event id - std::vector getParticles(const std::uint32_t& eventNumber) const { + std::vector getParticles( + const std::uint32_t& eventNumber) const { // Find the start entry and the batch size for this event std::string eventNumberStr = std::to_string(eventNumber); std::string findStartEntry = "event_id<" + eventNumberStr;