diff --git a/DDDigi/CMakeLists.txt b/DDDigi/CMakeLists.txt
index 4151b4b740a49c65493bce898aabb1064694e20c..7f0e28b1568611dd3afb89def1e9d9abae750efb 100644
--- a/DDDigi/CMakeLists.txt
+++ b/DDDigi/CMakeLists.txt
@@ -48,7 +48,7 @@ dd4hep_add_plugin(DDDigiPlugins
 #
 #----------------  I/O Plugin library to read/write DDG4 and edm4hep files ---------
 set(DDDigiIO_USES        "DD4hep::DDDigi;DD4hep::DDCore")
-set(DDDigiIO_SOURCES     "io/DigiIO.cpp")
+set(DDDigiIO_SOURCES     "io/DigiIO.cpp;io/Digi2ROOT.cpp")
 set(DDDigiIO_GENERATED)
 set(DDDigiIO_DEFINITIONS)
 if(DD4HEP_USE_GEANT4)
diff --git a/DDDigi/io/Digi2edm4hep.cpp b/DDDigi/io/Digi2edm4hep.cpp
index dbfdc657adc908ff991818f21b0677480b1077f4..745f6b5c36ac6e732db8e820175c25d8c9c153a6 100644
--- a/DDDigi/io/Digi2edm4hep.cpp
+++ b/DDDigi/io/Digi2edm4hep.cpp
@@ -406,7 +406,7 @@ namespace dd4hep {
     {
       auto* coll = internals->m_particles;
       std::size_t start = coll->size();
-      digi_io()._to_edm4hep(cont, coll);
+      data_io<edm4hep_input>::_to_edm4hep(cont, coll);
       std::size_t end = internals->m_particles->size();
       info("%s+++ %-24s added %6ld/%6ld entries from mask: %04X to %s",
            ctxt.event->id(), cont.name.c_str(), end-start, end, cont.key.mask(),
@@ -423,7 +423,7 @@ namespace dd4hep {
       };
       for ( const auto& depo : cont )   {
         if ( predicate(depo) )   {
-          digi_io::_to_edm4hep(depo, covMat, m_hit_type /* edm4hep::SIMTRACKERHIT */, collection);
+          data_io<edm4hep_input>::_to_edm4hep(depo, covMat, *collection, m_hit_type /* edm4hep::SIMTRACKERHIT */);
         }
       }
     }
@@ -435,7 +435,7 @@ namespace dd4hep {
     {
       for ( const auto& depo : cont )   {
         if ( predicate(depo) )   {
-          digi_io::_to_edm4hep(depo, m_hit_type /* edm4hep::SIMCALORIMETERHIT */, collection);
+          data_io<edm4hep_input>::_to_edm4hep(depo, *collection, m_hit_type /* edm4hep::SIMCALORIMETERHIT */);
         }
       }
     }
diff --git a/DDDigi/io/Digi2edm4hepEx.cpp b/DDDigi/io/Digi2edm4hepEx.cpp
deleted file mode 100644
index 5e55aace0e87eb4f90e38e51c3517c2dd9614754..0000000000000000000000000000000000000000
--- a/DDDigi/io/Digi2edm4hepEx.cpp
+++ /dev/null
@@ -1,98 +0,0 @@
-//==========================================================================
-//  AIDA Detector description implementation 
-//--------------------------------------------------------------------------
-// Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
-// All rights reserved.
-//
-// For the licensing terms see $DD4hepINSTALL/LICENSE.
-// For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
-//
-// Author     : M.Frank
-//
-//==========================================================================
-
-// Framework include files
-#include <DDDigi/DigiContext.h>
-#include <DDDigi/DigiContainerProcessor.h>
-
-// edm4hep include files
-#include <podio/EventStore.h>
-#include <podio/ROOTWriter.h>
-#include <edm4hep/MCParticleCollection.h>
-#include <edm4hep/EventHeaderCollection.h>
-#include <edm4hep/SimTrackerHitCollection.h>
-#include <edm4hep/SimCalorimeterHitCollection.h>
-#include <edm4hep/CaloHitContributionCollection.h>
-
-/// Namespace for the AIDA detector description toolkit
-namespace dd4hep {
-
-  /// Namespace for the Digitization part of the AIDA detector description toolkit
-  namespace digi {
-
-    /// Actor to select energy deposits according to the supplied segmentation
-    /** Actor to select energy deposits according to the supplied segmentation
-     *
-     *  The selected deposits are placed in the output container
-     *  supplied by the arguments.
-     *
-     *  \author  M.Frank
-     *  \version 1.0
-     *  \ingroup DD4HEP_DIGITIZATION
-     */
-    class Digi2edm4hep : public DigiContainerProcessor   {
-
-      std::unordered_map<std::string, podio::CollectionBase*> m_collections;
-    public:
-      /// Standard constructor
-      Digi2edm4hep(const DigiKernel& krnl, const std::string& nam)
-	: DigiContainerProcessor(krnl, nam)
-      {
-	//declareProperty("mean",  m_mean);
-	//declareProperty("sigma", m_sigma);
-      }
-
-      /// Standard destructor
-      virtual ~Digi2edm4hep() = default;
-
-      template <typename T> void
-      convert_deposits(const char* tag, const T& cont, work_t& work, const predicate_t& predicate)  const  {
-	Key key(cont.name, work.environ.output.mask);
-	DepositMapping m(cont.name, work.environ.output.mask, cont.data_type);
-	std::size_t start = m.size();
-	for( const auto& dep : cont )   {
-	  if ( predicate(dep) )    {
-	    m.data.emplace(dep.first, EnergyDeposit());
-	  }
-	}
-	std::size_t end   = m.size();
-	work.environ.output.data.put(m.key, std::move(m));
-	info("%s+++ %-32s added %6ld entries (now: %6ld) from mask: %04X to mask: %04X",
-	     tag, cont.name.c_str(), end-start, end, cont.key.mask(), m.key.mask());
-      }
-      void convert_history(const char* tag, const DepositsHistory& cont, work_t& work, const predicate_t& predicate)  const  {
-      }
-      void convert_particles(const char* tag, const ParticleMapping& cont, work_t& work, const predicate_t& predicate)  const  {
-	//auto mcpc = static_cast<edm4hep::MCParticleCollection*>(m_collections["MCParticles"]);
-	
-      }
-      /// Main functional callback
-      virtual void execute(DigiContext& context, work_t& work, const predicate_t& predicate)  const override final  {
-	if ( const auto* m = work.get_input<DepositMapping>() )
-	  convert_deposits(context.event->id(), *m, work, predicate);
-	else if ( const auto* v = work.get_input<DepositVector>() )
-	  convert_deposits(context.event->id(), *v, work, predicate);
-	else if ( const auto* h = work.get_input<DepositsHistory>() )
-	  convert_history(context.event->id(), *h, work, predicate);
-	else if ( const auto* p = work.get_input<ParticleMapping>() )
-	  convert_particles(context.event->id(), *p, work, predicate);
-	else
-	  except("Request to handle unknown data type: %s", work.input_type_name().c_str());
-      }
-    };
-  }    // End namespace digi
-}      // End namespace dd4hep
-
-/// Factory instantiation:
-#include <DDDigi/DigiFactories.h>
-DECLARE_DIGIACTION_NS(dd4hep::digi,Digi2edm4hep)
diff --git a/DDDigi/io/DigiIO.cpp b/DDDigi/io/DigiIO.cpp
index 872697953b33c5b912ee503c7caf6466b6d2117f..b70cadfb22b9c6bc9a333c3562f51ba101e20187 100644
--- a/DDDigi/io/DigiIO.cpp
+++ b/DDDigi/io/DigiIO.cpp
@@ -28,6 +28,10 @@
 #include <edm4hep/SimTrackerHit.h>
 #include <edm4hep/MCParticle.h>
 #include <edm4hep/MCParticleCollection.h>
+#include <edm4hep/TrackerHitCollection.h>
+#include <edm4hep/SimTrackerHitCollection.h>
+#include <edm4hep/CalorimeterHitCollection.h>
+#include <edm4hep/SimCalorimeterHitCollection.h>
 
 /// Namespace for the AIDA detector description toolkit
 namespace dd4hep {
@@ -40,6 +44,9 @@ namespace dd4hep {
       typedef my_part particle_type;
     };
 
+    edm4hep::Vector3d _toVectorD(const Position& ep);
+    edm4hep::Vector3f _toVectorF(const Position& ep);
+
     /// Structure definitions for DDDigi input data
     /**
      *
@@ -53,6 +60,19 @@ namespace dd4hep {
       struct  input_calorimeterhit_type {};
     };
 
+    /// Structure definitions for edm4hep input data
+    /**
+     *
+     *  \author  M.Frank
+     *  \version 1.0
+     *  \ingroup DD4HEP_DIGITIZATION
+     */
+    struct edm4hep_input  {
+      typedef edm4hep::MutableMCParticle particle_type;
+      struct  input_trackerhit_type     {};
+      struct  input_calorimeterhit_type {};
+    };
+
     /// Structure definitions for DDG4 input data
     /**
      *
@@ -66,6 +86,15 @@ namespace dd4hep {
       struct  input_calorimeterhit_type {};
     };
 
+    template <typename T> struct data_input   {
+      using particle_t       = typename T::particle_type;
+      using trackerhit_t     = typename T::input_trackerhit_type;
+      using calorimeterhit_t = typename T::input_calorimeterhit_type;
+      using pwrap_t          = std::shared_ptr<particle_t>;
+      using twrap_t          = std::shared_ptr<trackerhit_t>;
+      using cwrap_t          = std::shared_ptr<calorimeterhit_t>;
+    };
+
     edm4hep::Vector3d _toVectorD(const dd4hep::Position& ep)  {
       return { ep.x(), ep.y(), ep.z() };
     }
@@ -82,28 +111,27 @@ namespace dd4hep {
       }
     }
 
-    template <typename T> template <typename DATA>
-    bool data_io<T>::_can_handle(const DATA& data)  {
-      return internal_can_handle(data, typeid(T::pwrap_t));
+    template <typename INPUT, typename DATA>
+    static bool _can_handle(const INPUT& , const DATA& data)  {
+      return internal_can_handle(data, typeid(typename data_input<INPUT>::pwrap_t));
     }
 
-    template <typename T> template <typename CONT>
-    void data_io<T>::_pre_create(CONT* coll, std::size_t n)  {
+    template <typename CONT>
+    void _pre_create(CONT* coll, std::size_t n)  {
       /// We have to pre-create all objects to be able to fill the parent-daughter relationships
       for ( std::size_t i=0; i<n; ++i )   {
         coll->create();
       }
     }
 
-    template <typename T> template <typename CONT>
-    std::vector<const typename data_io<T>::particle_t*> 
-    data_io<T>::_to_vector(const CONT& cont)   {
-      std::vector<const particle_t*> vec;
+    template <typename INPUT, typename CONT>
+    std::vector<const typename INPUT::particle_t*> _to_vector(const INPUT&, const CONT& cont)   {
+      std::vector<const typename INPUT::particle_t*> vec;
       vec.reserve(cont.size());
       for ( const auto& part : cont )   {
         const auto& p = part.second;
-        if ( p.source.type() == typeid(pwrap_t) )   {
-          const auto* ptr = std::any_cast<pwrap_t>(&p.source);
+        if ( p.source.type() == typeid(typename INPUT::pwrap_t) )   {
+          const auto* ptr = std::any_cast<typename INPUT::pwrap_t>(&p.source);
           vec.emplace_back(ptr->get());
         }
       }
@@ -121,7 +149,7 @@ namespace dd4hep {
 
     /// Set all properties of the MutableMCParticle
     template <> template <>
-    void data_io<digi_input>::_to_edm4hep(const particle_t& p, 
+    void data_io<digi_input>::_to_edm4hep(const Particle& p, 
                                           edm4hep::MutableMCParticle mcp)  {
       mcp.setPDG(p.pdgID);
       mcp.setTime(p.time);
@@ -134,7 +162,7 @@ namespace dd4hep {
     }
 
     template <> template <>
-    void data_io<digi_input>::_to_edm4hep(const std::vector<const particle_t*>& cont,
+    void data_io<digi_input>::_to_edm4hep(const std::vector<const Particle*>& cont,
                                           edm4hep::MCParticleCollection* coll)   {
       std::size_t i, n = cont.size();
       _pre_create(coll, n);
@@ -146,7 +174,7 @@ namespace dd4hep {
 
     /// Set all properties of the MutableMCParticle
     template <> template <>
-    void data_io<edm4hep_input>::_to_edm4hep(const particle_t& p, 
+    void data_io<edm4hep_input>::_to_edm4hep(const edm4hep::MCParticle& p, 
                                              edm4hep::MutableMCParticle mcp)
     {
       mcp.setPDG( p.getPDG() );
@@ -164,15 +192,15 @@ namespace dd4hep {
     }
 
     template <> template <>
-    void data_io<edm4hep_input>::_to_edm4hep(const std::vector<const particle_t*>& cont,
+    void data_io<edm4hep_input>::_to_edm4hep(const std::vector<const edm4hep::MCParticle*>& cont,
                                              edm4hep::MCParticleCollection* coll)
     {
       std::size_t i, n = cont.size();
       _pre_create(coll, n);
       /// Convert particle body
       for ( i=0; i<n; ++i)   {
-        const particle_t* p = cont[i];
-        auto  mcp = coll->at(i);
+        const auto* p = cont[i];
+        auto mcp = coll->at(i);
         _to_edm4hep(*p, mcp);
 #if 0
         /// Relationships are already resolved and kept in order: Just copy indices
@@ -185,6 +213,48 @@ namespace dd4hep {
 #endif
       }
     }
+
+    template <> template <> 
+    void data_io<edm4hep_input>::_to_edm4hep(const std::pair<const CellID, EnergyDeposit>& dep,
+					     const std::array<float, 6>& covMat,
+					     edm4hep::TrackerHitCollection& collection,
+					     int hit_type)
+
+    {
+      const EnergyDeposit& de = dep.second;
+      auto hit = collection.create();
+      double dep_error = de.depositError;
+      if ( dep_error < -std::numeric_limits<double>::epsilon() )   {
+        dep_error = 0e0;
+      }
+      hit.setType( hit_type );
+      hit.setTime( de.time );
+      hit.setCovMatrix( covMat );
+      hit.setCellID( dep.first );
+      hit.setEDep( de.deposit );
+      hit.setEDepError( dep_error );
+      hit.setEdx( de.deposit/de.length );
+      hit.setPosition( _toVectorD(de.position) );
+    }
+
+    template <> template <>
+    void data_io<edm4hep_input>::_to_edm4hep(const std::pair<const CellID, EnergyDeposit>& dep,
+					     edm4hep::CalorimeterHitCollection& collection,
+					     int hit_type)
+    {
+      const EnergyDeposit& de = dep.second;
+      auto hit = collection.create();
+      double dep_error = de.depositError;
+      if ( dep_error < -std::numeric_limits<double>::epsilon() )   {
+        dep_error = 0e0;
+      }
+      hit.setType( hit_type );
+      hit.setTime( de.time );
+      hit.setCellID( dep.first );
+      hit.setEnergy( de.deposit );
+      hit.setEnergyError( dep_error );
+      hit.setPosition( _toVectorF(de.position) );
+    }
   }     // End namespace digi
 }       // End namespace dd4hep
 #endif  // DD4HEP_USE_EDM4HEP
@@ -331,7 +401,7 @@ namespace dd4hep {
 
     /// Set all properties of the MutableMCParticle
     template <> template <>
-    void data_io<ddg4_input>::_to_edm4hep(const particle_t& p, 
+    void data_io<ddg4_input>::_to_edm4hep(const sim::Geant4Particle& p, 
                                           edm4hep::MutableMCParticle mcp)
     {
       auto status = p.status;
@@ -378,14 +448,15 @@ namespace dd4hep {
     }
 
     template <> template <> 
-    void data_io<ddg4_input>::_to_edm4hep(const std::vector<const particle_t*>& cont,
+    void data_io<ddg4_input>::_to_edm4hep(const std::vector<const sim::Geant4Particle*>& cont,
                                           edm4hep::MCParticleCollection* coll)
     {
+      /// Precreate objects to allow setting the references without second pass
       std::size_t i, n = cont.size();
       _pre_create(coll, n);
       /// Convert particle body
       for ( i=0; i<n; ++i)   {
-        const particle_t* p = cont[i];
+        const auto* p = cont[i];
         auto  mcp = coll->at(i);
         _to_edm4hep(*p, mcp);
         /// Relationships are already resolved and kept in order: Just copy indices
@@ -410,76 +481,32 @@ namespace dd4hep {
   /// Namespace for the Digitization part of the AIDA detector description toolkit
   namespace digi {
 
-    template <>
-    void digi_io::_to_edm4hep(const ParticleMapping& cont,
-                              edm4hep::MCParticleCollection* coll)
+    template <> template <> 
+    void data_io<edm4hep_input>::_to_edm4hep(const ParticleMapping& cont,
+					     edm4hep::MCParticleCollection* coll)
     {
       if ( cont.empty() )   {
         return;
       }
-      if ( data_io<edm4hep_input>::_can_handle(*cont.begin()) )  {
-        data_io<edm4hep_input> io;
-        auto vec = io._to_vector(cont);
+      else if ( _can_handle(edm4hep_input(), *cont.begin()) )  {
+        auto vec = _to_vector(data_input<edm4hep_input>(), cont);
         if ( !vec.empty() )  {
-          io._to_edm4hep(vec, coll);
+	  data_io<edm4hep_input>::_to_edm4hep(vec, coll);
         }
-        return;
       }
-      else if ( data_io<ddg4_input>::_can_handle(*cont.begin()) )  {
-        data_io<ddg4_input> io;
-        auto vec = io._to_vector(cont);
+      else if ( _can_handle(ddg4_input(), *cont.begin()) )  {
+        auto vec = _to_vector(data_input<ddg4_input>(), cont);
         if ( !vec.empty() )  {
-          io._to_edm4hep(vec, coll);
+          data_io<ddg4_input>::_to_edm4hep(vec, coll);
         }
-        return;
       }
-      // Catch-all: convert what we have at hands
-      data_io<digi_input> io;
-      auto vec = io._to_vector(cont);
-      if ( !vec.empty() )  {
-        io._to_edm4hep(vec, coll);
-      }
-    }
-
-    template <>
-    void digi_io::_to_edm4hep(const std::pair<const CellID, EnergyDeposit>& dep,
-                              const std::array<float, 6>& covMat,
-                              int hit_type,
-                              edm4hep::TrackerHitCollection* collection)
-    {
-      const EnergyDeposit& de = dep.second;
-      auto hit = collection->create();
-      double dep_error = de.depositError;
-      if ( dep_error < -std::numeric_limits<double>::epsilon() )   {
-        dep_error = 0e0;
-      }
-      hit.setType( hit_type );
-      hit.setTime( de.time );
-      hit.setCovMatrix( covMat );
-      hit.setCellID( dep.first );
-      hit.setEDep( de.deposit );
-      hit.setEDepError( dep_error );
-      hit.setEdx( de.deposit/de.length );
-      hit.setPosition( _toVectorD(de.position) );
-    }
-
-    template <>
-    void digi_io::_to_edm4hep(const std::pair<const CellID, EnergyDeposit>& dep,
-                              int hit_type,
-                              edm4hep::CalorimeterHitCollection* collection)
-    {
-      const EnergyDeposit& de = dep.second;
-      auto hit = collection->create();
-      double dep_error = de.depositError;
-      if ( dep_error < -std::numeric_limits<double>::epsilon() )   {
-        dep_error = 0e0;
+      else   {
+	// Catch-all: convert what we have at hands
+	auto vec = _to_vector(data_input<digi_input>(), cont);
+	if ( !vec.empty() )  {
+	  data_io<digi_input>::_to_edm4hep(vec, coll);
+	}
       }
-      hit.setType( hit_type );
-      hit.setTime( de.time );
-      hit.setCellID( dep.first );
-      hit.setEnergy( de.deposit );
-      hit.setEnergyError( dep_error );
-      hit.setPosition( _toVectorF(de.position) );
     }
   }     // End namespace digi
 }       // End namespace dd4hep
diff --git a/DDDigi/io/DigiIO.h b/DDDigi/io/DigiIO.h
index 7a34234945d3ce493042ff6ea6058624e5909432..0fe1e87df15ba541258af2687d25950d231ee871 100644
--- a/DDDigi/io/DigiIO.h
+++ b/DDDigi/io/DigiIO.h
@@ -63,36 +63,20 @@ namespace dd4hep {
      *  \ingroup DD4HEP_DIGITIZATION
      */
     template <typename T> struct data_io   {
-#if 0
-      using particle_t       = typename T::particle_type;
-      using trackerhit_t     = typename T::input_trackerhit_type;
-      using calorimeterhit_t = typename T::input_calorimeterhit_type;
-      using pwrap_t          = std::shared_ptr<particle_t>;
-      using twrap_t          = std::shared_ptr<trackerhit_t>;
-      using cwrap_t          = std::shared_ptr<calorimeterhit_t>;
-#endif
+    public:
       /// Default constructor
       data_io() = default;
       /// Default destructor
       ~data_io() = default;
-#if 0
-      /// Check if specialization can handle data conversion
-      template <typename DATA>
-      static bool _can_handle(const DATA& data);
-
-      /// Convert data of particle type
-      template <typename CONT> static
-      std::vector<const particle_t*> _to_vector(const CONT& cont);
-#endif
-      /// Pre-create container of output data
-      template <typename CONT> static
-      void _pre_create(CONT* coll, std::size_t n);
 
       template <typename FIRST, typename SECOND> static
-      void _to_edm4hep(const FIRST& cont, SECOND coll);
+      void _to_edm4hep(const FIRST& first, SECOND second);
 
       template <typename FIRST, typename SECOND> static
-      void _to_edm4hep(const FIRST& cont, SECOND coll, int hit_type);
+      void _to_edm4hep(const FIRST& first, SECOND& second, int hit_type);
+
+      template <typename FIRST, typename SECOND, typename THIRD> static
+      void _to_edm4hep(const FIRST& first, const SECOND& second, THIRD& third, int hit_type);
 
       template <typename FIRST, typename SECOND, typename THIRD> static
       void _to_digi(FIRST first, const SECOND& second, THIRD& third);
@@ -101,66 +85,11 @@ namespace dd4hep {
       void _to_digi_if(const FIRST& first, SECOND& second, const PREDICATE& pred);
     };
 
+    /// Structure definitions for template specializations
     struct ddg4_input;
     struct digi_input;
+    struct edm4hep_input;
 
   }    // End namespace digi
 }      // End namespace dd4hep
-
-
-#ifdef DD4HEP_USE_EDM4HEP
-
-/// edm4hep include files
-#include <edm4hep/MCParticleCollection.h>
-#include <edm4hep/TrackerHitCollection.h>
-#include <edm4hep/SimTrackerHitCollection.h>
-#include <edm4hep/CalorimeterHitCollection.h>
-#include <edm4hep/SimCalorimeterHitCollection.h>
-
-/// Namespace for the AIDA detector description toolkit
-namespace dd4hep {
-
-  /// Namespace for the Digitization part of the AIDA detector description toolkit
-  namespace digi {
-
-    edm4hep::Vector3d _toVectorD(const Position& ep);
-    edm4hep::Vector3f _toVectorF(const Position& ep);
-
-    /// Structure definitions for edm4hep input data
-    /**
-     *
-     *  \author  M.Frank
-     *  \version 1.0
-     *  \ingroup DD4HEP_DIGITIZATION
-     */
-    struct edm4hep_input  {
-      typedef edm4hep::MutableMCParticle particle_type;
-      struct  input_trackerhit_type     {};
-      struct  input_calorimeterhit_type {};
-    };
-
-    /// Generic I/O helper to output digi data in edm4hep format
-    /**
-     *
-     *  \author  M.Frank
-     *  \version 1.0
-     *  \ingroup DD4HEP_DIGITIZATION
-     */
-    struct digi_io  {
-    public:
-      /// Default constructor
-      digi_io() = default;
-      template <typename FIRST_TYPE, typename OUTPUT_TYPE> static
-      void _to_edm4hep(const FIRST_TYPE& first, OUTPUT_TYPE output);
-
-      template <typename FIRST_TYPE, typename OUTPUT_TYPE> static
-      void _to_edm4hep(const FIRST_TYPE& first, int hit_type, OUTPUT_TYPE output);
-
-      template <typename FIRST_TYPE, typename SECOND_TYPE, typename OUTPUT_TYPE> static
-      void _to_edm4hep(const FIRST_TYPE& first, const SECOND_TYPE& second, int hit_type, OUTPUT_TYPE output);
-    };
-  }    // End namespace digi
-}      // End namespace dd4hep
-#endif
-
 #endif // DDDIGI_DIGIIO_H
diff --git a/examples/DDDigi/CMakeLists.txt b/examples/DDDigi/CMakeLists.txt
index 76dac9f350fe5f5ec99edf47c48722475327c778..7d3028138e2897aa7bfb673e1c77621d93308d33 100644
--- a/examples/DDDigi/CMakeLists.txt
+++ b/examples/DDDigi/CMakeLists.txt
@@ -16,17 +16,17 @@ IF(NOT TARGET DD4hep::DDCore)
   include ( ${DD4hep_DIR}/cmake/DD4hepBuild.cmake )
   dd4hep_configure_output()
 ENDIF()
-
+#
 IF(NOT TARGET DD4hep::DDDigi)
   MESSAGE(STATUS "+++> DDDigi examples shall not be built! [DDDigi not enabled]")
   return()
 ENDIF()
-
+#
 dd4hep_set_compiler_flags()
 dd4hep_use_python_executable()
 #==========================================================================
 dd4hep_configure_output ()
-
+#
 set(DDDigiexamples_INSTALL  ${CMAKE_INSTALL_PREFIX}/examples/DDDigi)
 #
 dd4hep_add_plugin(DDDigiExampleLib SOURCES src/*.cpp )
@@ -206,15 +206,18 @@ if (DD4HEP_USE_GEANT4)
     REGEX_PASS "\\+\\+\\+ 5 Events out of 5 processed"
     REGEX_FAIL "Error;ERROR;Exception"
   )
-  # Test edm4hep write (needs to be expanded)
-  dd4hep_add_test_reg(DDDigi_test_edm4hep_write_1
-    COMMAND    "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDDigi.sh"
-    EXEC_ARGS  ${Python_EXECUTABLE} ${CMAKE_INSTALL_PREFIX}/examples/DDDigi/scripts/TestWriteEdm4hep.py
-               -num_events 5 -num_threads 10 -events_parallel 4
-    DEPENDS    DDDigi_generate_data
-    REGEX_PASS "\\+\\+\\+ 5 Events out of 5 processed."
-    REGEX_FAIL "Error;ERROR;Exception"
-  )
+  #
+  if (DD4HEP_USE_EDM4HEP)
+    # Test edm4hep write (needs to be expanded)
+    dd4hep_add_test_reg(DDDigi_test_edm4hep_write
+      COMMAND    "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDDigi.sh"
+      EXEC_ARGS  ${Python_EXECUTABLE} ${CMAKE_INSTALL_PREFIX}/examples/DDDigi/scripts/TestWriteEdm4hep.py
+                 -num_events 5 -num_threads 10 -events_parallel 4
+      DEPENDS    DDDigi_generate_data
+      REGEX_PASS "\\+\\+\\+ 5 Events out of 5 processed."
+      REGEX_FAIL "Error;ERROR;Exception"
+    )
+  endif()
 #
 endif()
 #
diff --git a/examples/DDDigi/scripts/TestWriteEdm4hep.py b/examples/DDDigi/scripts/TestWriteEdm4hep.py
index e963f7ae3932fc252bf90baa409de9a2584e6bb3..b91f12253ab40066b296405ab743ad36ef8f7d76 100644
--- a/examples/DDDigi/scripts/TestWriteEdm4hep.py
+++ b/examples/DDDigi/scripts/TestWriteEdm4hep.py
@@ -21,7 +21,7 @@ def run():
                             parallel=True,
                             input_mask=0x0,
                             input_segment='input',
-                            output='test_edm4hep.root')
+                            output='dddigi_write_edm4hep.root')
   proc = digi.create_action('Digi2edm4hepProcessor/edm4hep')
   hit_type = 'TrackerHits'
   if digi.hit_type: