Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test hepmc3 #766

Merged
merged 3 commits into from
Dec 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/scripts/compile_and_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ cmake -GNinja \
-DBoost_NO_BOOST_CMAKE=ON \
-DDD4HEP_USE_LCIO=ON \
-DDD4HEP_USE_TBB=${TBB} \
-DDD4HEP_USE_HEPMC3=${HEPMC3:-OFF} \
-DBUILD_TESTING=ON \
-DDD4HEP_DEBUG_CMAKE=ON \
-DBUILD_SHARED_LIBS=${SHARED} \
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ jobs:
SHARED: ON
STANDARD: 17
TBB: OFF
HEPMC3: ON
steps:
- uses: actions/checkout@v2
- name: Install CVMFS
Expand All @@ -170,7 +171,7 @@ jobs:
- name: Start container
run: |
ls
docker run -it --name CI_container -v /home/runner/work/DD4hep/DD4hep:/Package -e VIEW=${{ matrix.LCG }} -e SHARED=${SHARED} -e STANDARD=${STANDARD} -e TBB=${TBB} -v /cvmfs/sft.cern.ch:/cvmfs/sft.cern.ch -v /cvmfs/geant4.cern.ch:/cvmfs/geant4.cern.ch -v /cvmfs/sft-nightlies.cern.ch:/cvmfs/sft-nightlies.cern.ch -d ghcr.io/aidasoft/centos7:latest /bin/bash
docker run -it --name CI_container -v /home/runner/work/DD4hep/DD4hep:/Package -e VIEW=${{ matrix.LCG }} -e SHARED=${SHARED} -e STANDARD=${STANDARD} -e TBB=${TBB} -e HEPMC3=${HEPMC3} -v /cvmfs/sft.cern.ch:/cvmfs/sft.cern.ch -v /cvmfs/geant4.cern.ch:/cvmfs/geant4.cern.ch -v /cvmfs/sft-nightlies.cern.ch:/cvmfs/sft-nightlies.cern.ch -d ghcr.io/aidasoft/centos7:latest /bin/bash
- name: Compile and test
run: |
docker exec CI_container /bin/bash -c "./Package/.github/scripts/compile_and_test.sh"
10 changes: 8 additions & 2 deletions DDG4/hepmc/HepMC3FileReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,10 @@ HEPMC3FileReader::moveToEvent(int event_number) {
while( m_currEvent != event_number) {
printout(INFO,"HEPMC3FileReader::moveToEvent","Event number before skipping: %d", m_currEvent );
HepMC3::GenEvent genEvent;
m_reader->skip(event_number);
auto status_OK = m_reader->skip(event_number);
if(not status_OK) {
return EVENT_READER_IO_ERROR;
}
m_currEvent = event_number;
printout(INFO,"HEPMC3FileReader::moveToEvent","Event number after skipping: %d", m_currEvent );
}
Expand All @@ -119,7 +122,10 @@ HEPMC3FileReader::moveToEvent(int event_number) {
/// Read an event and fill a vector of MCParticles.
Geant4EventReader::EventReaderStatus
HEPMC3FileReader::readGenEvent(int /*event_number*/, HepMC3::GenEvent& genEvent) {
m_reader->read_event(genEvent);
auto status_OK = m_reader->read_event(genEvent);
if(not status_OK) {
return EVENT_READER_IO_ERROR;
}
++m_currEvent;
if (genEvent.particles().size()) {
printout(INFO,"HEPMC3FileReader","Read event from file");
Expand Down
6 changes: 6 additions & 0 deletions DDTest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ if (DD4HEP_USE_GEANT4)
test_EventReaders
)
add_executable(${TEST_NAME} src/${TEST_NAME}.cc)
if(DD4HEP_USE_HEPMC3)
target_compile_definitions(${TEST_NAME} PRIVATE DD4HEP_USE_HEPMC3)
endif()
if(DD4HEP_USE_LCIO)
target_compile_definitions(${TEST_NAME} PRIVATE DD4HEP_USE_LCIO)
endif()
target_link_libraries(${TEST_NAME} DD4hep::DDCore DD4hep::DDRec DD4hep::DDG4)
target_include_directories(${TEST_NAME} PRIVATE ./include)
install(TARGETS ${TEST_NAME} DESTINATION bin)
Expand Down
7 changes: 5 additions & 2 deletions DDTest/src/test_EventReaders.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,14 @@ int main(int argc, char** argv ){
std::string inputFileFolder = argv[1];

std::vector<TestTuple> tests;
#ifdef DD4HEP_USE_LCIO
tests.push_back( TestTuple( "LCIOStdHepReader", "bbudsc_3evt.stdhep" ) );
tests.push_back( TestTuple( "LCIOFileReader", "muons.slcio" , /*skipEOF= */ true ) );
#endif
tests.push_back( TestTuple( "Geant4EventReaderHepEvtShort", "Muons10GeV.HEPEvt" ) );
tests.push_back( TestTuple( "Geant4EventReaderHepMC", "g4pythia.hepmc" ) );

#ifdef DD4HEP_USE_HEPMC3
tests.push_back( TestTuple( "HEPMC3FileReader", "g4pythia.hepmc", /*skipEOF= */ true) );
#endif

try{
for(std::vector<TestTuple>::const_iterator it = tests.begin(); it != tests.end(); ++it) {
Expand Down