From db8bfbe6c2b121ecdcb7951827bb13cecf5fb2b3 Mon Sep 17 00:00:00 2001 From: Andre Sailer Date: Tue, 17 Dec 2024 16:51:16 +0100 Subject: [PATCH] test_EventReaders: typos, tweaks, testing EDM4hep with direct access --- DDTest/src/test_EventReaders.cc | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/DDTest/src/test_EventReaders.cc b/DDTest/src/test_EventReaders.cc index 9bc6cb280..2384402ed 100644 --- a/DDTest/src/test_EventReaders.cc +++ b/DDTest/src/test_EventReaders.cc @@ -64,29 +64,27 @@ int main(int argc, char** argv ){ continue; } test( thisReader->currentEventNumber() == 0 , readerType + std::string("Initial Event Number") ); - thisReader->moveToEvent(1); - test( thisReader->currentEventNumber() == 1 , readerType + std::string("Event Number after Skip") ); + if (!thisReader->hasDirectAccess()) { + thisReader->moveToEvent(1); + test( thisReader->currentEventNumber() == 1 , readerType + std::string("Event Number after Skip") ); + } std::vector particles; std::vector vertices ; - - dd4hep::sim::Geant4EventReader::EventReaderStatus sc = thisReader->readParticles(3,vertices,particles); + dd4hep::sim::Geant4EventReader::EventReaderStatus sc = thisReader->readParticles(2,vertices,particles); std::for_each(particles.begin(),particles.end(),dd4hep::detail::deleteObject); test( thisReader->currentEventNumber() == 2 && sc == dd4hep::sim::Geant4EventReader::EVENT_READER_OK, readerType + std::string("Event Number Read") ); - //Reset Reader to check what happens if moving to far in the file + //Reset Reader to check what happens if moving too far in the file if (not skipEOF) { thisReader = dd4hep::PluginService::Create(readerType, std::move(inputFile)); sc = thisReader->moveToEvent(1000000); test( sc != dd4hep::sim::Geant4EventReader::EVENT_READER_OK , readerType + std::string("EventReader False") ); } } - } catch( std::exception &e ){ - //} catch( ... ){ - - test.log( e.what() ); - test.error( "exception occurred" ); + test.error("Exception occurred:"); + test.log(e.what()); } return 0; }