From e423b1d77b6bb97858fc443996b7098e7946caf6 Mon Sep 17 00:00:00 2001 From: lintao <lintao51@gmail.com> Date: Tue, 15 Oct 2019 16:03:03 +0800 Subject: [PATCH] WIP: Prepare for the plcio output. --- Simulation/DetSimAna/CMakeLists.txt | 12 ++++++++++-- Simulation/DetSimAna/src/ExampleAnaElemTool.cpp | 4 ++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Simulation/DetSimAna/CMakeLists.txt b/Simulation/DetSimAna/CMakeLists.txt index 7bf795e6..458772ae 100644 --- a/Simulation/DetSimAna/CMakeLists.txt +++ b/Simulation/DetSimAna/CMakeLists.txt @@ -9,11 +9,19 @@ find_package(Geant4 REQUIRED ui_all vis_all) include(${Geant4_USE_FILE}) find_package(DD4hep COMPONENTS DDG4 REQUIRED) +# For EDM & I/O +find_package(podio REQUIRED) +find_package(plcio REQUIRED) +# find_package(LCIO REQUIRED) + set(DetSimAna_srcs src/ExampleAnaElemTool.cpp ) - +message("podio_LIBRARIES: ${podio_LIBRARIES}") +message("plcio_LIBRARIES: ${plcio_LIBRARIES}") gaudi_add_module(DetSimAna ${DetSimAna_srcs} - INCLUDE_DIRS DetSimInterface DD4hep GaudiKernel Geant4 + INCLUDE_DIRS DetSimInterface DD4hep GaudiKernel Geant4 + ${plcio_INCLUDE_DIRS} ${podio_INCLUDE_DIRS} LINK_LIBRARIES DetSimInterface DD4hep ${DD4hep_COMPONENT_LIBRARIES} GaudiKernel Geant4 + ${plcio_LIBRARIES} ${podio_LIBRARIES} ) diff --git a/Simulation/DetSimAna/src/ExampleAnaElemTool.cpp b/Simulation/DetSimAna/src/ExampleAnaElemTool.cpp index 743b2bb0..0b59081d 100644 --- a/Simulation/DetSimAna/src/ExampleAnaElemTool.cpp +++ b/Simulation/DetSimAna/src/ExampleAnaElemTool.cpp @@ -59,6 +59,10 @@ ExampleAnaElemTool::EndOfEventAction(const G4Event* anEvent) { << " #" << icol << " has " << nhits << " hits." << endmsg; + if (nhits==0) { + // just skip this collection. + continue; + } // There are different types (new and old) dd4hep::sim::Geant4HitCollection* coll = dynamic_cast<dd4hep::sim::Geant4HitCollection*>(collect); -- GitLab