From bf0268162c8472fec7c4e412196c201fda3c3708 Mon Sep 17 00:00:00 2001
From: Markus Frank <Markus.Frank@cern.ch>
Date: Mon, 9 Jan 2023 17:11:51 +0100
Subject: [PATCH] Fix compile error

---
 DDDigi/io/DigiDDG4Input.cpp |  3 +++
 DDDigi/io/DigiIO.h          | 26 +++++++++++++++++---------
 2 files changed, 20 insertions(+), 9 deletions(-)

diff --git a/DDDigi/io/DigiDDG4Input.cpp b/DDDigi/io/DigiDDG4Input.cpp
index 1dda13b5b..cdbda2200 100644
--- a/DDDigi/io/DigiDDG4Input.cpp
+++ b/DDDigi/io/DigiDDG4Input.cpp
@@ -17,6 +17,7 @@
 #include "DigiIO.h"
 
 #include <DDG4/Geant4Data.h>
+#include <DDG4/Geant4Particle.h>
 
 // ROOT include files
 #include <TBranch.h>
@@ -123,4 +124,6 @@ namespace dd4hep {
     };
   }    // End namespace digi
 }      // End namespace dd4hep
+
+/// Factory instantiation
 DECLARE_DIGIACTION_NS(dd4hep::digi,DigiDDG4ROOT)
diff --git a/DDDigi/io/DigiIO.h b/DDDigi/io/DigiIO.h
index ced444b50..028ae6204 100644
--- a/DDDigi/io/DigiIO.h
+++ b/DDDigi/io/DigiIO.h
@@ -35,19 +35,27 @@ namespace dd4hep {
   /// Namespace for the Digitization part of the AIDA detector description toolkit
   namespace digi {
 
+    /// Auto cast union to read objects from ROOT files
     template <typename T> union input_data  {
+      /// Void type
       const void*      m_raw;
-      std::vector<T*>* m_items;
+      /// Concrete type
+      std::vector<T*>* m_data;
+
+      /// Constructor
       input_data(const void* p)   { this->m_raw = p; }
-      void clear()  { if ( this->m_items ) this->m_items->clear(); }
-      std::size_t size()  { return (this->m_items) ? this->m_items->size() : 0UL; }
+      /// Vector interface: get object
       std::vector<T*>& get()    { 
-	if ( this->m_items ) return *(this->m_items);
+	if ( this->m_data ) return *(this->m_data);
 	throw std::runtime_error("input_data: Invalid data!");
       }
+      /// Vector interface: clear items
+      void clear()         { if ( this->m_data ) this->m_data->clear(); }
+      /// Vector interface: access array size
+      std::size_t size()   { return (this->m_data) ? this->m_data->size() : 0UL; }
     };
 
-    /// Generci I/O helper to input/output digi data
+    /// Generic I/O helper to input/output digi data
     /**
      *
      *  \author  M.Frank
@@ -135,18 +143,18 @@ namespace dd4hep {
      *  \ingroup DD4HEP_DIGITIZATION
      */
     struct edm4hep_input  {
-      typedef edm4hep::MutableMCParticle        particle_type;
-      struct  input_trackerhit_type {};
+      typedef edm4hep::MutableMCParticle particle_type;
+      struct  input_trackerhit_type     {};
       struct  input_calorimeterhit_type {};
     };
 
     struct digi_input  {
       typedef Particle particle_type;
-      struct  input_trackerhit_type {};
+      struct  input_trackerhit_type     {};
       struct  input_calorimeterhit_type {};
     };
 
-    /// Generci I/O helper to output digi data in edm4hep format
+    /// Generic I/O helper to output digi data in edm4hep format
     /**
      *
      *  \author  M.Frank
-- 
GitLab