From 9ba0215a8c2d0f2a56c8584a534d70b2740dd8af Mon Sep 17 00:00:00 2001
From: Vincent Pascuzzi <vincent.pascuzzi@cern.ch>
Date: Mon, 11 May 2020 14:46:04 +0000
Subject: [PATCH] Update DigitizationTests pile-up event info

Pile-up is now managed by `xAOD::EventInfo`. `PileUpEventInfo`
is therefore no longer used, so `PileUpEventInfoTest` and
associated tool are renamed to reflect the changes:
`PileUpEventInfoTest{Tool}` -> `EventInfoTest{Tool}`

Also took this opportunity to adopt use of new-style
`StoreGate` retrieves.

Closes ATLASSIM-4467
---
 .../Tests/DigitizationTests/CMakeLists.txt    |  4 +-
 .../DigitizationTests/EventInfoTest.h         | 24 +++++
 .../DigitizationTests/PileUpEventInfoTest.h   | 21 -----
 .../python/DigitizationTestsConfig.py         | 16 +++-
 .../python/DigitizationTestsConfigDb.py       | 17 ++--
 .../share/postInclude.RDO_Plots.py            | 25 +++---
 .../DigitizationTests/src/EventInfoTest.cxx   | 65 ++++++++++++++
 .../src/EventInfoTestTool.cxx                 | 70 +++++++++++++++
 .../DigitizationTests/src/EventInfoTestTool.h | 27 ++++++
 .../src/PileUpEventInfoTest.cxx               | 77 ----------------
 .../src/PileUpEventInfoTestTool.cxx           | 88 -------------------
 .../src/PileUpEventInfoTestTool.h             | 32 -------
 .../components/DigitizationTests_entries.cxx  | 20 ++---
 13 files changed, 234 insertions(+), 252 deletions(-)
 create mode 100644 Simulation/Tests/DigitizationTests/DigitizationTests/EventInfoTest.h
 delete mode 100644 Simulation/Tests/DigitizationTests/DigitizationTests/PileUpEventInfoTest.h
 create mode 100644 Simulation/Tests/DigitizationTests/src/EventInfoTest.cxx
 create mode 100644 Simulation/Tests/DigitizationTests/src/EventInfoTestTool.cxx
 create mode 100644 Simulation/Tests/DigitizationTests/src/EventInfoTestTool.h
 delete mode 100644 Simulation/Tests/DigitizationTests/src/PileUpEventInfoTest.cxx
 delete mode 100644 Simulation/Tests/DigitizationTests/src/PileUpEventInfoTestTool.cxx
 delete mode 100644 Simulation/Tests/DigitizationTests/src/PileUpEventInfoTestTool.h

diff --git a/Simulation/Tests/DigitizationTests/CMakeLists.txt b/Simulation/Tests/DigitizationTests/CMakeLists.txt
index 06c3cf0c96b..455235174d1 100644
--- a/Simulation/Tests/DigitizationTests/CMakeLists.txt
+++ b/Simulation/Tests/DigitizationTests/CMakeLists.txt
@@ -11,7 +11,7 @@ atlas_depends_on_subdirs( PUBLIC
                           GaudiKernel
                           PRIVATE
                           Control/AthenaKernel
-                          Event/EventInfo
+                          Event/xAOD/xAODEventInfo
                           Generators/GeneratorObjects
                           InnerDetector/InDetDetDescr/InDetIdentifier
                           InnerDetector/InDetRawEvent/InDetRawData
@@ -26,7 +26,7 @@ atlas_add_component( DigitizationTests
                      src/*.cxx
                      src/components/*.cxx
                      INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS}
-                     LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} AthenaBaseComps GaudiKernel AthenaKernel EventInfo GeneratorObjects InDetIdentifier InDetRawData InDetSimData )
+                     LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} AthenaBaseComps GaudiKernel AthenaKernel GeneratorObjects InDetIdentifier InDetRawData InDetSimData xAODEventInfo )
 
 # Install files from the package:
 atlas_install_headers( DigitizationTests )
diff --git a/Simulation/Tests/DigitizationTests/DigitizationTests/EventInfoTest.h b/Simulation/Tests/DigitizationTests/DigitizationTests/EventInfoTest.h
new file mode 100644
index 00000000000..7bad30f58a5
--- /dev/null
+++ b/Simulation/Tests/DigitizationTests/DigitizationTests/EventInfoTest.h
@@ -0,0 +1,24 @@
+/*
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+*/
+
+#ifndef DIGITIZATIONTESTS_EVENTINFOTEST_H
+#define DIGITIZATIONTESTS_EVENTINFOTEST_H
+
+#include "AthenaBaseComps/AthAlgorithm.h"
+#include "xAODEventInfo/EventInfo.h"
+
+class EventInfoTest : public AthAlgorithm {
+ public:
+  EventInfoTest(const std::string& name, ISvcLocator* pSvcLocator);
+
+  StatusCode initialize();
+  StatusCode execute();
+
+ private:
+  // SG::ReadHandleKey<xAOD::EventInfo> m_rhkEventInfo;
+  SG::ReadHandleKey<xAOD::EventInfo> m_rhkEventInfo{
+      this, "EventInfoName", "EventInfo", "EventInfo name"};
+};
+
+#endif
diff --git a/Simulation/Tests/DigitizationTests/DigitizationTests/PileUpEventInfoTest.h b/Simulation/Tests/DigitizationTests/DigitizationTests/PileUpEventInfoTest.h
deleted file mode 100644
index ad4453847d8..00000000000
--- a/Simulation/Tests/DigitizationTests/DigitizationTests/PileUpEventInfoTest.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#ifndef DIGITIZATIONTESTS_PILEUPEVENTINFOTEST_H
-#define DIGITIZATIONTESTS_PILEUPEVENTINFOTEST_H
-
-#include "AthenaBaseComps/AthAlgorithm.h"
-
-class PileUpEventInfoTest : public AthAlgorithm {
-
-public:
-
-  PileUpEventInfoTest(const std::string& name, ISvcLocator* pSvcLocator);
-
-  StatusCode initialize();
-  StatusCode execute();
-  StringProperty m_pileupInfo;
-};
-
-#endif
diff --git a/Simulation/Tests/DigitizationTests/python/DigitizationTestsConfig.py b/Simulation/Tests/DigitizationTests/python/DigitizationTestsConfig.py
index d9f3d2d69f8..08255549d10 100644
--- a/Simulation/Tests/DigitizationTests/python/DigitizationTestsConfig.py
+++ b/Simulation/Tests/DigitizationTests/python/DigitizationTestsConfig.py
@@ -1,15 +1,23 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 from AthenaCommon import CfgMgr
 
+
 def McEventCollectionTestTool(name="McEventCollectionTestTool", **kwargs):
     return CfgMgr.McEventCollectionTestTool(name, **kwargs)
-def PileUpEventInfoTestTool(name="PileUpEventInfoTestTool", **kwargs):
-    return CfgMgr.PileUpEventInfoTestTool(name, **kwargs)
+
+
+def EventInfoTestTool(name="EventInfoTestTool", **kwargs):
+    return CfgMgr.EventInfoTestTool(name, **kwargs)
+
+
 def PixelRDOsTestTool(name="PixelRDOsTestTool", **kwargs):
     return CfgMgr.PixelRDOsTestTool(name, **kwargs)
+
+
 def SCT_RDOsTestTool(name="SCT_RDOsTestTool", **kwargs):
     return CfgMgr.SCT_RDOsTestTool(name, **kwargs)
+
+
 def TRT_RDOsTestTool(name="TRT_RDOsTestTool", **kwargs):
     return CfgMgr.TRT_RDOsTestTool(name, **kwargs)
-
diff --git a/Simulation/Tests/DigitizationTests/python/DigitizationTestsConfigDb.py b/Simulation/Tests/DigitizationTests/python/DigitizationTestsConfigDb.py
index 3f440b76a0e..1ab8de54905 100644
--- a/Simulation/Tests/DigitizationTests/python/DigitizationTestsConfigDb.py
+++ b/Simulation/Tests/DigitizationTests/python/DigitizationTestsConfigDb.py
@@ -1,9 +1,14 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 from AthenaCommon.CfgGetter import addTool
 
-addTool("DigitizationTests.DigitizationTestsConfig.McEventCollectionTestTool", "McEventCollectionTestTool")
-addTool("DigitizationTests.DigitizationTestsConfig.PileUpEventInfoTestTool", "PileUpEventInfoTestTool")
-addTool("DigitizationTests.DigitizationTestsConfig.PixelRDOsTestTool", "PixelRDOsTestTool")
-addTool("DigitizationTests.DigitizationTestsConfig.SCT_RDOsTestTool", "SCT_RDOsTestTool")
-addTool("DigitizationTests.DigitizationTestsConfig.TRT_RDOsTestTool", "TRT_RDOsTestTool")
+addTool("DigitizationTests.DigitizationTestsConfig.McEventCollectionTestTool",
+        "McEventCollectionTestTool")
+addTool("DigitizationTests.DigitizationTestsConfig.EventInfoTestTool",
+        "EventInfoTestTool")
+addTool("DigitizationTests.DigitizationTestsConfig.PixelRDOsTestTool",
+        "PixelRDOsTestTool")
+addTool("DigitizationTests.DigitizationTestsConfig.SCT_RDOsTestTool",
+        "SCT_RDOsTestTool")
+addTool("DigitizationTests.DigitizationTestsConfig.TRT_RDOsTestTool",
+        "TRT_RDOsTestTool")
diff --git a/Simulation/Tests/DigitizationTests/share/postInclude.RDO_Plots.py b/Simulation/Tests/DigitizationTests/share/postInclude.RDO_Plots.py
index 78144701fef..c009af60b1c 100644
--- a/Simulation/Tests/DigitizationTests/share/postInclude.RDO_Plots.py
+++ b/Simulation/Tests/DigitizationTests/share/postInclude.RDO_Plots.py
@@ -1,22 +1,27 @@
+from DigitizationTests.DigitizationTestsConf import DigiTestAlg, McEventCollectionTestTool, PixelRDOsTestTool, SCT_RDOsTestTool, TRT_RDOsTestTool
+from AthenaCommon import CfgGetter
+from AthenaCommon.AlgSequence import AlgSequence
 from AthenaCommon.AppMgr import ServiceMgr
 from GaudiSvc.GaudiSvcConf import THistSvc
 ServiceMgr += THistSvc("THistSvc")
 #ServiceMgr.THistSvc.Output  = ["atlasTest DATAFILE='atlasTest.muons.histo.root' OPT='RECREATE'"];
-ServiceMgr.THistSvc.Output  = ["truth DATAFILE='RDO_truth.root' OPT='RECREATE'"];
+ServiceMgr.THistSvc.Output = ["truth DATAFILE='RDO_truth.root' OPT='RECREATE'"]
 
-from AthenaCommon.AlgSequence import AlgSequence
 job = AlgSequence()
-from AthenaCommon import CfgGetter
-from DigitizationTests.DigitizationTestsConf import DigiTestAlg,McEventCollectionTestTool,PixelRDOsTestTool,SCT_RDOsTestTool,TRT_RDOsTestTool
 job += DigiTestAlg()
 if DetFlags.Truth_on():
-  job.DigiTestAlg.DigiTestTools += [CfgGetter.getPublicTool("McEventCollectionTestTool", checkType=True)]
+    job.DigiTestAlg.DigiTestTools += [CfgGetter.getPublicTool(
+        "McEventCollectionTestTool", checkType=True)]
 if DetFlags.Truth_on():
-  if DetFlags.pileup.any_on():
-    job.DigiTestAlg.DigiTestTools += [CfgGetter.getPublicTool("PileUpEventInfoTestTool", checkType=True)]
+    if DetFlags.pileup.any_on():
+        job.DigiTestAlg.DigiTestTools += [
+            CfgGetter.getPublicTool("EventInfoTestTool", checkType=True)]
 if DetFlags.pixel_on():
-  job.DigiTestAlg.DigiTestTools += [CfgGetter.getPublicTool("PixelRDOsTestTool", checkType=True)]
+    job.DigiTestAlg.DigiTestTools += [
+        CfgGetter.getPublicTool("PixelRDOsTestTool", checkType=True)]
 if DetFlags.SCT_on():
-  job.DigiTestAlg.DigiTestTools += [CfgGetter.getPublicTool("SCT_RDOsTestTool", checkType=True)]
+    job.DigiTestAlg.DigiTestTools += [
+        CfgGetter.getPublicTool("SCT_RDOsTestTool", checkType=True)]
 if DetFlags.TRT_on():
-  job.DigiTestAlg.DigiTestTools += [CfgGetter.getPublicTool("TRT_RDOsTestTool", checkType=True)]
+    job.DigiTestAlg.DigiTestTools += [
+        CfgGetter.getPublicTool("TRT_RDOsTestTool", checkType=True)]
diff --git a/Simulation/Tests/DigitizationTests/src/EventInfoTest.cxx b/Simulation/Tests/DigitizationTests/src/EventInfoTest.cxx
new file mode 100644
index 00000000000..6457d3aab02
--- /dev/null
+++ b/Simulation/Tests/DigitizationTests/src/EventInfoTest.cxx
@@ -0,0 +1,65 @@
+/*
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+*/
+
+#include "DigitizationTests/EventInfoTest.h"
+
+#include "AthenaBaseComps/AthMsgStreamMacros.h"
+#include "AthenaKernel/errorcheck.h"
+
+EventInfoTest::EventInfoTest(const std::string& name, ISvcLocator* pSvcLocator)
+    : AthAlgorithm(name, pSvcLocator) {
+  declareProperty("EventInfoName", m_rhkEventInfo);
+}
+
+StatusCode EventInfoTest::initialize() {
+  ATH_MSG_INFO("Initializing " << name() << " - package version "
+                               << PACKAGE_VERSION);
+  ATH_CHECK(m_rhkEventInfo.initialize());
+  return StatusCode::SUCCESS;
+}
+
+StatusCode EventInfoTest::execute() {
+  SG::ReadHandle<xAOD::EventInfo> pevt(m_rhkEventInfo);
+  if (!pevt.isValid()) {
+    ATH_MSG_ERROR("Could not get xAOD::EventInfo with key "
+                  << m_rhkEventInfo.key());
+    return StatusCode::SUCCESS;
+  }
+
+  ATH_MSG_DEBUG("Successfully retrieved event info as xAOD::EventInfo");
+
+  //+++ Get sub-event info object
+  ATH_MSG_DEBUG("Main Event Info: ");
+  ATH_MSG_INFO("RunNumber = " << pevt->runNumber());
+  ATH_MSG_INFO("Event Number = " << pevt->eventNumber());
+  ATH_MSG_INFO("LumiBlock = " << pevt->lumiBlock());
+  ATH_MSG_INFO("TimeStamp = " << pevt->timeStamp());
+  ATH_MSG_INFO("BCID = " << pevt->bcid());
+  ATH_MSG_INFO("mu = " << pevt->actualInteractionsPerCrossing());
+  ATH_MSG_INFO("<mu> = " << pevt->averageInteractionsPerCrossing());
+
+  ATH_MSG_INFO("xAOD::EventInfo::SubEvent info: ");
+  std::vector<xAOD::EventInfo::SubEvent>::const_iterator it =
+      pevt->subEvents().begin();
+  std::vector<xAOD::EventInfo::SubEvent>::const_iterator end =
+      pevt->subEvents().end();
+  if (it == end) ATH_MSG_INFO("No xAOD::EventInfo::SubEvent found");
+  for (auto sevt : pevt->subEvents()) {
+    if (sevt.ptr() != NULL) {
+      ATH_MSG_INFO("SubEvent info:");
+      ATH_MSG_INFO("  Time         : "
+                   << (*it).time() << endmsg
+                   << "  Index        : " << (*it).index() << endmsg
+                   << "  Run Number   : " << sevt.ptr()->runNumber() << endmsg
+                   << "  Event Number : " << sevt.ptr()->eventNumber() << endmsg
+                   << "  ns Offset    : " << sevt.ptr()->timeStampNSOffset()
+                   << endmsg << "  Lumi Block   : " << sevt.ptr()->lumiBlock()
+                   << endmsg << "  BCID         : " << sevt.ptr()->bcid()
+                   << endmsg << "  PileUpType   : " << (*it).type());
+      ++it;
+    } else
+      ATH_MSG_INFO("xAOD::EventInfo::SubEvent is null");
+  }
+  return StatusCode::SUCCESS;
+}
diff --git a/Simulation/Tests/DigitizationTests/src/EventInfoTestTool.cxx b/Simulation/Tests/DigitizationTests/src/EventInfoTestTool.cxx
new file mode 100644
index 00000000000..59fcf8c3e0b
--- /dev/null
+++ b/Simulation/Tests/DigitizationTests/src/EventInfoTestTool.cxx
@@ -0,0 +1,70 @@
+/*
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+*/
+
+#include "EventInfoTestTool.h"
+
+#include "AthenaBaseComps/AthMsgStreamMacros.h"
+#include "AthenaKernel/errorcheck.h"
+
+EventInfoTestTool::EventInfoTestTool(const std::string& type,
+                                     const std::string& name,
+                                     const IInterface* parent)
+    : DigiTestToolBase(type, name, parent) {
+  declareProperty("EventInfoName", m_rhkEventInfo);
+}
+
+StatusCode EventInfoTestTool::initialize() {
+  ATH_MSG_INFO("Initializing " << name() << " - package version "
+                               << PACKAGE_VERSION);
+  ATH_CHECK(m_rhkEventInfo.initialize());
+  return StatusCode::SUCCESS;
+}
+
+StatusCode EventInfoTestTool::processEvent() {
+  SG::ReadHandle<xAOD::EventInfo> pevt(m_rhkEventInfo);
+  if (!pevt.isValid()) {
+    ATH_MSG_ERROR("Could not get xAOD::EventInfo with key "
+                  << m_rhkEventInfo.key());
+    return StatusCode::SUCCESS;
+  }
+
+  ATH_MSG_DEBUG("Successfully retrieved event info as xAOD::EventInfo");
+
+  //+++ Get sub-event info object
+  ATH_MSG_DEBUG("Main Event Info: ");
+  ATH_MSG_INFO("RunNumber = " << pevt->runNumber());
+  ATH_MSG_INFO("Event Number = " << pevt->eventNumber());
+  ATH_MSG_INFO("LumiBlock = " << pevt->lumiBlock());
+  ATH_MSG_INFO("TimeStamp = " << pevt->timeStamp());
+  ATH_MSG_INFO("BCID = " << pevt->bcid());
+  ATH_MSG_INFO("mu = " << pevt->actualInteractionsPerCrossing());
+  ATH_MSG_INFO("<mu> = " << pevt->averageInteractionsPerCrossing());
+
+  ATH_MSG_INFO("xAOD::EventInfo::SubEvent info: ");
+  std::vector<xAOD::EventInfo::SubEvent>::const_iterator it =
+      pevt->subEvents().begin();
+  std::vector<xAOD::EventInfo::SubEvent>::const_iterator end =
+      pevt->subEvents().end();
+  if (it == end) ATH_MSG_INFO("No xAOD::EventInfo::SubEvent found");
+  for (auto sevt : pevt->subEvents()) {
+    if (sevt.ptr() != NULL) {
+      ATH_MSG_INFO("SubEvent info:");
+      ATH_MSG_INFO("  Time         : "
+                   << (*it).time() << endmsg
+                   << "  Index        : " << (*it).index() << endmsg
+                   << "  Run Number   : " << sevt.ptr()->runNumber() << endmsg
+                   << "  Event Number : " << sevt.ptr()->eventNumber() << endmsg
+                   << "  ns Offset    : " << sevt.ptr()->timeStampNSOffset()
+                   << endmsg << "  Lumi Block   : " << sevt.ptr()->lumiBlock()
+                   << endmsg << "  BCID         : " << sevt.ptr()->bcid()
+                   << endmsg << "  PileUpType   : " << (*it).type());
+      ++it;
+    } else
+      ATH_MSG_INFO("xAOD::EventInfo::SubEvent is null");
+  }
+
+  return StatusCode::SUCCESS;
+}
+
+StatusCode EventInfoTestTool::finalize() { return StatusCode::SUCCESS; }
diff --git a/Simulation/Tests/DigitizationTests/src/EventInfoTestTool.h b/Simulation/Tests/DigitizationTests/src/EventInfoTestTool.h
new file mode 100644
index 00000000000..014a713f55e
--- /dev/null
+++ b/Simulation/Tests/DigitizationTests/src/EventInfoTestTool.h
@@ -0,0 +1,27 @@
+/*
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+*/
+
+#ifndef G4AT_EVENTINFOTESTTOOL
+#define G4AT_EVENTINFOTESTTOOL
+
+#include "DigiTestToolBase.h"
+#include "xAODEventInfo/EventInfo.h"
+
+class EventInfoTestTool : public DigiTestToolBase {
+ public:
+  EventInfoTestTool(const std::string& name, const std::string& type,
+                    const IInterface* parent);
+
+  StatusCode initialize();
+
+  StatusCode processEvent();
+
+  StatusCode finalize();
+
+ private:
+  SG::ReadHandleKey<xAOD::EventInfo> m_rhkEventInfo{
+      this, "EventInfoName", "EventInfo", "EventInfo name"};
+};
+
+#endif
diff --git a/Simulation/Tests/DigitizationTests/src/PileUpEventInfoTest.cxx b/Simulation/Tests/DigitizationTests/src/PileUpEventInfoTest.cxx
deleted file mode 100644
index 8988f89fd5b..00000000000
--- a/Simulation/Tests/DigitizationTests/src/PileUpEventInfoTest.cxx
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
-*/
-
-#include "DigitizationTests/PileUpEventInfoTest.h"
-
-#include "EventInfo/PileUpEventInfo.h"
-#include "EventInfo/EventInfo.h"
-#include "EventInfo/EventID.h"
-#include "EventInfo/PileUpTimeEventIndex.h"
-#include "EventInfo/EventType.h"
-
-#include "AthenaBaseComps/AthMsgStreamMacros.h"
-#include "AthenaKernel/errorcheck.h"
-PileUpEventInfoTest::PileUpEventInfoTest(const std::string& name, ISvcLocator* pSvcLocator)
-  : AthAlgorithm(name, pSvcLocator),
-    m_pileupInfo("McEventInfo")
-{
-  declareProperty("EventInfoName", m_pileupInfo);
-}
-
-
-StatusCode PileUpEventInfoTest::initialize()
-{
-  ATH_MSG_INFO ( "Initializing " << name() << " - package version " << PACKAGE_VERSION );
-  return StatusCode::SUCCESS;
-}
-
-
-StatusCode PileUpEventInfoTest::execute()
-{
-  const PileUpEventInfo* pevt = 0;
-  if ( evtStore()->retrieve(pevt, m_pileupInfo.value()).isFailure() ) {
-    ATH_MSG_ERROR ( "** Could not get pileup event info" );
-    return StatusCode::SUCCESS;
-  }
-  else {
-    ATH_MSG_DEBUG ( "Pileup Info Retrieved Successfully as 'PileUpEventInfo' Object " );
-    //+++ Get sub-event info object
-    const EventID *eventid = pevt->event_ID();
-    ATH_MSG_DEBUG ( "Main Event Info: " );
-    ATH_MSG_INFO ( "RunNumber = " << eventid->run_number() );
-    ATH_MSG_INFO ( "Event Number = " << eventid->event_number() );
-    ATH_MSG_INFO ( "LumiBlock = " << eventid->lumi_block() );
-    ATH_MSG_INFO ( "TimeStamp = " << eventid->time_stamp() );
-    ATH_MSG_INFO ( "BCID = " << eventid->bunch_crossing_id() );
-    ATH_MSG_INFO ( "mu = " << pevt->actualInteractionsPerCrossing() );
-    ATH_MSG_INFO ( "<mu> = " << pevt->averageInteractionsPerCrossing() );
-
-    ATH_MSG_INFO ( "Sub Event Infos: " );
-    PileUpEventInfo::SubEvent::const_iterator it  = pevt->beginSubEvt();
-    PileUpEventInfo::SubEvent::const_iterator end = pevt->endSubEvt();
-    if (it == end) ATH_MSG_INFO ( "None found" );
-    for (; it != end; ++it) {
-      const EventInfo* sevt = (*it).pSubEvt;
-      if (sevt!=NULL) {
-        ATH_MSG_INFO ( "Sub Event Info:" );
-        ATH_MSG_INFO ( "  Time         : " << (*it).time()                             << endmsg
-                       << "  Index        : " << (*it).index()                            << endmsg
-                       << "  Provenance   : " << (*it).type()                        << endmsg // This is the provenance stuff: signal, minbias, cavern, etc
-                        << "  Run Number   : " << sevt->event_ID()->run_number()           << endmsg
-                        << "  Event Number : " << sevt->event_ID()->event_number()         << endmsg
-                        << "  ns Offset    : " << sevt->event_ID()->time_stamp_ns_offset() << endmsg
-                        << "  Lumi Block   : " << sevt->event_ID()->lumi_block()           << endmsg
-                        << "  BCID         : " << sevt->event_ID()->bunch_crossing_id()    << endmsg
-                        << "  User Type    : " << sevt->event_type()->user_type()          );
-        // if ((*it).time() == 0) {
-        //   NInTimeEvents++;
-        //   if ((*it).index() > 0) NInTimePileup++;
-        // }
-      }
-      else ATH_MSG_INFO ( "Subevent is null ptr " );
-    }
-  }
-  return StatusCode::SUCCESS;
-}
-
diff --git a/Simulation/Tests/DigitizationTests/src/PileUpEventInfoTestTool.cxx b/Simulation/Tests/DigitizationTests/src/PileUpEventInfoTestTool.cxx
deleted file mode 100644
index 0ded0d32a81..00000000000
--- a/Simulation/Tests/DigitizationTests/src/PileUpEventInfoTestTool.cxx
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
-*/
-
-
-#include "PileUpEventInfoTestTool.h"
-
-#include "EventInfo/PileUpEventInfo.h"
-#include "EventInfo/EventInfo.h"
-#include "EventInfo/EventID.h"
-#include "EventInfo/PileUpTimeEventIndex.h"
-#include "EventInfo/EventType.h"
-
-#include "AthenaBaseComps/AthMsgStreamMacros.h"
-#include "AthenaKernel/errorcheck.h"
-
-PileUpEventInfoTestTool::PileUpEventInfoTestTool(const std::string& type,
-                                                     const std::string& name,
-                                                     const IInterface* parent)
-  : DigiTestToolBase(type, name, parent),
-    //m_numberOfEventsSelected(0),
-    //m_collection("TruthEvent"), //("GEN_EVENT"),
-    m_pileupInfo("McEventInfo")
-{
-  declareProperty("PileUpEventInfoName", m_pileupInfo);
-}
-
-StatusCode PileUpEventInfoTestTool::initialize()
-{
-  ATH_MSG_INFO ( "Initializing " << name() << " - package version " << PACKAGE_VERSION );
-  return StatusCode::SUCCESS;
-}
-
-StatusCode PileUpEventInfoTestTool::processEvent() {
-
-  const PileUpEventInfo* pevt;
-  if ( evtStore()->retrieve(pevt, m_pileupInfo.value()).isFailure() ) {
-    ATH_MSG_ERROR ( "** Could not get pileup event info" );
-    return StatusCode::SUCCESS;
-  }
-	      
-
-  ATH_MSG_DEBUG ( "Pileup Info Retrieved Successfully as 'PileUpEventInfo' Object " );
-  //+++ Get sub-event info object
-  const EventID *eventid = pevt->event_ID();
-  ATH_MSG_DEBUG ( "Main Event Info: " );
-  ATH_MSG_INFO ( "RunNumber = " << eventid->run_number() );
-  ATH_MSG_INFO ( "Event Number = " << eventid->event_number() );
-  ATH_MSG_INFO ( "LumiBlock = " << eventid->lumi_block() );
-  ATH_MSG_INFO ( "TimeStamp = " << eventid->time_stamp() );
-  ATH_MSG_INFO ( "BCID = " << eventid->bunch_crossing_id() );
-  ATH_MSG_INFO ( "mu = " << pevt->actualInteractionsPerCrossing() );
-  ATH_MSG_INFO ( "<mu> = " << pevt->averageInteractionsPerCrossing() );
-
-  ATH_MSG_INFO ( "Sub Event Infos: " );
-  PileUpEventInfo::SubEvent::const_iterator it  = pevt->beginSubEvt();
-  PileUpEventInfo::SubEvent::const_iterator end = pevt->endSubEvt();
-  if (it == end) ATH_MSG_INFO ( "None found" );
-  for (; it != end; ++it) {
-    const EventInfo* sevt = (*it).pSubEvt;
-    if (sevt!=NULL) {
-      ATH_MSG_INFO ( "Sub Event Info:" );
-      ATH_MSG_INFO ( "  Time         : " << (*it).time()                             << endmsg
-		     << "  Index        : " << (*it).index()                            << endmsg
-		     << "  Provenance   : " << (*it).type()                        << endmsg // This is the provenance stuff: signal, minbias, cavern, etc
-		     << "  Run Number   : " << sevt->event_ID()->run_number()           << endmsg
-		     << "  Event Number : " << sevt->event_ID()->event_number()         << endmsg
-		     << "  ns Offset    : " << sevt->event_ID()->time_stamp_ns_offset() << endmsg
-		     << "  Lumi Block   : " << sevt->event_ID()->lumi_block()           << endmsg
-		     << "  BCID         : " << sevt->event_ID()->bunch_crossing_id()    << endmsg
-		     << "  User Type    : " << sevt->event_type()->user_type()          );
-      // if ((*it).time() == 0) {
-      //   NInTimeEvents++;
-      //   if ((*it).index() > 0) NInTimePileup++;
-      // }
-    }
-    else ATH_MSG_INFO ( "Subevent is null ptr " );
-  }
-
-  
-  return StatusCode::SUCCESS;
-}
-
-StatusCode PileUpEventInfoTestTool::finalize()
-{
-  return StatusCode::SUCCESS;
-}
-
diff --git a/Simulation/Tests/DigitizationTests/src/PileUpEventInfoTestTool.h b/Simulation/Tests/DigitizationTests/src/PileUpEventInfoTestTool.h
deleted file mode 100644
index 9615965b257..00000000000
--- a/Simulation/Tests/DigitizationTests/src/PileUpEventInfoTestTool.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#ifndef G4AT_PILEUPEVENTINFOTESTTOOL
-#define G4AT_PILEUPEVENTINFOTESTTOOL
-
-#include "DigiTestToolBase.h"
-
-class PixelID;
-
-class PileUpEventInfoTestTool : public DigiTestToolBase {
-
- public:
-
-  PileUpEventInfoTestTool(const std::string& name,
-                            const std::string& type,
-                            const IInterface* parent);
-
-  StatusCode initialize();
-
-  StatusCode processEvent();
-
-  StatusCode finalize();
-
- private:
-
-  StringProperty m_pileupInfo;
-
-};
-
-#endif
diff --git a/Simulation/Tests/DigitizationTests/src/components/DigitizationTests_entries.cxx b/Simulation/Tests/DigitizationTests/src/components/DigitizationTests_entries.cxx
index 4586a77e429..4bb919fcc93 100644
--- a/Simulation/Tests/DigitizationTests/src/components/DigitizationTests_entries.cxx
+++ b/Simulation/Tests/DigitizationTests/src/components/DigitizationTests_entries.cxx
@@ -1,17 +1,13 @@
-#include "DigitizationTests/DigiTestAlg.h"
-//#include "DigitizationTests/PileUpEventInfoTest.h"
+#include "../EventInfoTestTool.h"
 #include "../McEventCollectionTestTool.h"
-#include "../PileUpEventInfoTestTool.h"
 #include "../PixelRDOsTestTool.h"
 #include "../SCT_RDOsTestTool.h"
 #include "../TRT_RDOsTestTool.h"
+#include "DigitizationTests/DigiTestAlg.h"
 
-
-DECLARE_COMPONENT( McEventCollectionTestTool )
-DECLARE_COMPONENT( PileUpEventInfoTestTool )
-DECLARE_COMPONENT( PixelRDOsTestTool )
-DECLARE_COMPONENT( SCT_RDOsTestTool )
-DECLARE_COMPONENT( TRT_RDOsTestTool )
-DECLARE_COMPONENT( DigiTestAlg )
-//DECLARE_COMPONENT( PileUpEventInfoTest )
-
+DECLARE_COMPONENT(McEventCollectionTestTool)
+DECLARE_COMPONENT(EventInfoTestTool)
+DECLARE_COMPONENT(PixelRDOsTestTool)
+DECLARE_COMPONENT(SCT_RDOsTestTool)
+DECLARE_COMPONENT(TRT_RDOsTestTool)
+DECLARE_COMPONENT(DigiTestAlg)
-- 
GitLab