diff --git a/Simulation/DetSimAna/CMakeLists.txt b/Simulation/DetSimAna/CMakeLists.txt
index 7bf795e6d4b3d1536cd9276ee57fabd08e59a5b2..458772ae86508a07062e64a94d4afd4df8a2fc82 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 743b2bb056471a5741546d75b4725c3832eab6ab..0b59081dcf0148be9aea5784f01cea89753845ba 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);