Skip to content

Commit

Permalink
test_EventReaders: typos, tweaks, testing EDM4hep with direct access
Browse files Browse the repository at this point in the history
  • Loading branch information
andresailer committed Dec 17, 2024
1 parent eb947b5 commit db8bfbe
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions DDTest/src/test_EventReaders.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<Particle*> particles;
std::vector<Vertex*> 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<Particle>);
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<dd4hep::sim::Geant4EventReader*>(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;
}
Expand Down

0 comments on commit db8bfbe

Please sign in to comment.