From b8e0ca87c973a9247e5be4be215ceb677449aade Mon Sep 17 00:00:00 2001
From: Frank Winklmeier <frank.winklmeier@cern.ch>
Date: Tue, 19 Feb 2019 10:12:18 +0100
Subject: [PATCH] Remove EventIncident class

The `EventIncident` class is obsolete as the Gaudi `Incident` class
provides the same features. Listener usage has been migrated away in
atlas/athena!21227. Now change all code to fire Gaudi `Incident` and
remove the `EventIncident` class.
---
 .../IOVDbTestAlg/src/IOVDbTestAlg.cxx         |  9 +---
 Control/AthenaServices/src/AthIncFirerAlg.cxx | 10 +---
 .../AthenaServices/src/AthenaEventLoopMgr.cxx |  9 ++--
 .../src/AthenaHiveEventLoopMgr.cxx            |  5 +-
 .../PileUpComps/src/PileUpEventLoopMgr.cxx    |  7 ++-
 Event/EventInfo/CMakeLists.txt                |  1 -
 Event/EventInfo/EventInfo/EventIncident.h     | 54 -------------------
 Event/EventInfo/doc/packagedoc.h              | 11 +---
 Event/EventInfo/src/EventIncident.cxx         | 21 --------
 .../PixelToTPIDTool/src/PixeldEdxTestAlg.cxx  | 10 ++--
 .../src/CalibNtupleLoader.cxx                 | 10 ++--
 .../src/MergingEventLoopMgr.cxx               | 10 ++--
 12 files changed, 27 insertions(+), 130 deletions(-)
 delete mode 100755 Event/EventInfo/EventInfo/EventIncident.h
 delete mode 100755 Event/EventInfo/src/EventIncident.cxx

diff --git a/AtlasTest/DatabaseTest/IOVDbTestAlg/src/IOVDbTestAlg.cxx b/AtlasTest/DatabaseTest/IOVDbTestAlg/src/IOVDbTestAlg.cxx
index 16ec2cb4de1..b504c16b272 100755
--- a/AtlasTest/DatabaseTest/IOVDbTestAlg/src/IOVDbTestAlg.cxx
+++ b/AtlasTest/DatabaseTest/IOVDbTestAlg/src/IOVDbTestAlg.cxx
@@ -2,8 +2,6 @@
   Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
 */
 
-// $Id: IOVDbTestAlg.cxx,v 1.39 2009-03-30 12:10:15 ivukotic Exp $
-
 #include "IOVDbTestAlg/IOVDbTestAlg.h"
 
 // IOVDbTest includes
@@ -18,12 +16,10 @@
 
 // Gaudi includes
 #include "GaudiKernel/IIncidentSvc.h"
+#include "GaudiKernel/Incident.h"
 #include "GaudiKernel/GaudiException.h" 
 #include "GaudiKernel/IToolSvc.h"
 
-// Event Incident 
-#include "EventInfo/EventIncident.h"
-
 // AttributeList
 #include "CoralBase/Attribute.h"
 #include "CoralBase/Blob.h"
@@ -170,8 +166,7 @@ StatusCode IOVDbTestAlg::readWithBeginRun(){
     ServiceHandle<IIncidentSvc> incSvc("IncidentSvc", name() );
     ATH_CHECK( incSvc.retrieve() );
 
-    EventIncident evtInc(name(), "BeginRun",Gaudi::Hive::currentContext());
-    incSvc->fireIncident( evtInc );
+    incSvc->fireIncident( Incident(name(), IncidentType::BeginRun, Gaudi::Hive::currentContext()) );
 
     return StatusCode::SUCCESS;
 }
diff --git a/Control/AthenaServices/src/AthIncFirerAlg.cxx b/Control/AthenaServices/src/AthIncFirerAlg.cxx
index 69ac92f1107..683394c6a8a 100644
--- a/Control/AthenaServices/src/AthIncFirerAlg.cxx
+++ b/Control/AthenaServices/src/AthIncFirerAlg.cxx
@@ -4,7 +4,6 @@
 #include "AthIncFirerAlg.h"
 #include "GaudiKernel/IIncidentSvc.h"
 #include "GaudiKernel/Incident.h"
-#include "EventInfo/EventIncident.h"
 #include "AthenaKernel/errorcheck.h"
 
 AthIncFirerAlg::AthIncFirerAlg( const std::string& name, ISvcLocator* pSvcLocator ):AthReentrantAlgorithm(name,pSvcLocator),m_Serial(false){
@@ -26,13 +25,8 @@ StatusCode AthIncFirerAlg::execute(const EventContext& ctx)const {
   auto ctxcp=ctx;
   for(auto & i:m_incLists.value()){
     ATH_MSG_VERBOSE("Firing incident "<<i);
-    if((i=="BeginEvent")||(i=="EndEvent")){
-      m_incSvc->fireIncident(std::make_unique<EventIncident>(name(),i,ctxcp));
-      if(m_Serial.value())m_incSvc->fireIncident(EventIncident(name(),i,ctxcp));
-    }else{
-      m_incSvc->fireIncident(std::make_unique<Incident>(name(),i,ctxcp));
-      if(m_Serial.value())m_incSvc->fireIncident(Incident( name(),i,ctxcp));
-    }
+    m_incSvc->fireIncident(std::make_unique<Incident>(name(),i,ctxcp));
+    if (m_Serial.value()) m_incSvc->fireIncident(Incident(name(),i,ctxcp));
   }
   return StatusCode::SUCCESS;
 }
diff --git a/Control/AthenaServices/src/AthenaEventLoopMgr.cxx b/Control/AthenaServices/src/AthenaEventLoopMgr.cxx
index 109e9b85637..c52edc827a0 100644
--- a/Control/AthenaServices/src/AthenaEventLoopMgr.cxx
+++ b/Control/AthenaServices/src/AthenaEventLoopMgr.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
 */
 
 #define  GAUDISVC_EVENTLOOPMGR_CPP
@@ -34,7 +34,6 @@
 #include "StoreGate/StoreGateSvc.h"
 #include "StoreGate/ActiveStoreSvc.h"
 
-#include "EventInfo/EventIncident.h"
 #include "EventInfo/EventInfo.h"
 #include "EventInfo/EventID.h"
 #include "EventInfo/EventType.h"
@@ -503,7 +502,7 @@ StatusCode AthenaEventLoopMgr::writeHistograms(bool force) {
 StatusCode AthenaEventLoopMgr::beginRunAlgorithms() {
 
   // Fire BeginRun "Incident"
-  m_incidentSvc->fireIncident(EventIncident(name(),IncidentType::BeginRun,m_eventContext));
+  m_incidentSvc->fireIncident(Incident(name(),IncidentType::BeginRun,m_eventContext));
 
   // Call the execute() method of all top algorithms 
   for ( ListAlg::iterator ita = m_topAlgList.begin(); 
@@ -737,7 +736,7 @@ StatusCode AthenaEventLoopMgr::executeEvent(void* /*par*/)
   resetTimeout(Athena::Timeout::instance(m_eventContext));
   if(toolsPassed) {
   // Fire BeginEvent "Incident"
-  //m_incidentSvc->fireIncident(EventIncident(*pEvent, name(),"BeginEvent"));
+  //m_incidentSvc->fireIncident(Incident(*pEvent, name(),"BeginEvent"));
 
   // An incident may schedule a stop, in which case is better to exit before the actual execution.
   if ( m_scheduledStop ) {
@@ -800,7 +799,7 @@ StatusCode AthenaEventLoopMgr::executeEvent(void* /*par*/)
   }
 
   // Fire EndEvent "Incident"
-  //m_incidentSvc->fireIncident(EventIncident(*pEvent, name(),"EndEvent"));
+  //m_incidentSvc->fireIncident(Incident(*pEvent, name(),"EndEvent"));
   ++m_proc;
   }  // end of toolsPassed test
   ++m_nev;
diff --git a/Control/AthenaServices/src/AthenaHiveEventLoopMgr.cxx b/Control/AthenaServices/src/AthenaHiveEventLoopMgr.cxx
index f8c30f49b1d..ff44dbfdfa8 100644
--- a/Control/AthenaServices/src/AthenaHiveEventLoopMgr.cxx
+++ b/Control/AthenaServices/src/AthenaHiveEventLoopMgr.cxx
@@ -39,7 +39,6 @@
 #include "StoreGate/StoreGateSvc.h"
 #include "StoreGate/ActiveStoreSvc.h"
 
-#include "EventInfo/EventIncident.h"
 #include "EventInfo/EventInfo.h"
 #include "EventInfo/EventID.h"
 #include "EventInfo/EventType.h"
@@ -664,7 +663,7 @@ StatusCode AthenaHiveEventLoopMgr::executeEvent(void* createdEvts_IntPtr )
            << endmsg;
 
     // FIXME!!! Fire BeginRun "Incident"
-    m_incidentSvc->fireIncident(EventIncident(name(),IncidentType::BeginRun,*evtContext));
+    m_incidentSvc->fireIncident(Incident(name(),IncidentType::BeginRun,*evtContext));
 
   }
 
@@ -705,7 +704,7 @@ StatusCode AthenaHiveEventLoopMgr::executeEvent(void* createdEvts_IntPtr )
   resetTimeout(Athena::Timeout::instance(*evtContext));
   if(toolsPassed) {
     // Fire BeginEvent "Incident"
-    //m_incidentSvc->fireIncident(EventIncident(*pEvent, name(),"BeginEvent",*evtContext));
+    //m_incidentSvc->fireIncident(Incident(*pEvent, name(),"BeginEvent",*evtContext));
 
 
     CHECK( m_conditionsCleaner->event (*evtContext, true) );
diff --git a/Control/PileUpComps/src/PileUpEventLoopMgr.cxx b/Control/PileUpComps/src/PileUpEventLoopMgr.cxx
index b85fd9fb5a7..f1c4dad262b 100644
--- a/Control/PileUpComps/src/PileUpEventLoopMgr.cxx
+++ b/Control/PileUpComps/src/PileUpEventLoopMgr.cxx
@@ -16,7 +16,6 @@
 #include "EventInfo/EventID.h"         // OLD EDM
 #include "EventInfo/EventType.h"       // OLD EDM
 #include "EventInfo/EventInfo.h"       // OLD EDM
-#include "EventInfo/EventIncident.h"   // OLD EDM
 
 #include "PileUpTools/IBeamIntensity.h"
 #include "PileUpTools/IBeamLuminosity.h"
@@ -733,12 +732,12 @@ StatusCode PileUpEventLoopMgr::executeEvent(void* par)
       ATH_MSG_INFO ( "  ===>>>  start of run " << m_currentRun << "    <<<===" );
 
       // Fire BeginRun "Incident"
-      m_incidentSvc->fireIncident(EventIncident(this->name(),IncidentType::BeginRun,*m_eventContext));
+      m_incidentSvc->fireIncident(Incident(this->name(),IncidentType::BeginRun,*m_eventContext));
       CHECK(this->beginRunAlgorithms());
     }
 
   // Fire BeginEvent "Incident"
-  //m_incidentSvc->fireIncident(EventIncident(ei, this->name(),IncidentType::BeginEvent));
+  //m_incidentSvc->fireIncident(Incident(ei, this->name(),IncidentType::BeginEvent));
 
   // Execute Algorithms
   //  StatusCode sc = MinimalEventLoopMgr::executeEvent(par);
@@ -790,7 +789,7 @@ StatusCode PileUpEventLoopMgr::executeEvent(void* par)
     }
 
   // Fire EndEvent "Incident"
-  //m_incidentSvc->fireIncident( EventIncident(ei, this->name(), IncidentType::EndEvent) );
+  //m_incidentSvc->fireIncident( Incident(ei, this->name(), IncidentType::EndEvent) );
 
   //------------------------------------------------------------------------
   // Check if there was an error processing current event
diff --git a/Event/EventInfo/CMakeLists.txt b/Event/EventInfo/CMakeLists.txt
index 1e96943a7f0..d8686924d36 100644
--- a/Event/EventInfo/CMakeLists.txt
+++ b/Event/EventInfo/CMakeLists.txt
@@ -24,7 +24,6 @@ atlas_add_library( EventInfo
                    src/EventStreamInfo.cxx
                    src/PileUpEventInfo.cxx
                    src/PileUpTimeEventIndex.cxx
-                   src/EventIncident.cxx
                    src/TriggerInfo.cxx
                    src/MergedEventInfo.cxx
                    src/TagInfo.cxx
diff --git a/Event/EventInfo/EventInfo/EventIncident.h b/Event/EventInfo/EventInfo/EventIncident.h
deleted file mode 100755
index 882b0c3d996..00000000000
--- a/Event/EventInfo/EventInfo/EventIncident.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#ifndef EVENTINFO_EVENTINCIDENT_H
-# define EVENTINFO_EVENTINCIDENT_H 1
-/**
- * @file EventIncident.h
- *
- * @brief an incident that carries the EventInfo object
- *
- * @author Paolo Calafiura <pcalafiura@lbl.gov>
- *
- * $Id: EventIncident.h,v 1.2 2005-01-12 11:07:52 schaffer Exp $
- */
-
-
-//<<<<<< INCLUDES                                                       >>>>>>
-#include <string>
-#ifndef GAUDIKERNEL_INCIDENT_H
-# include "GaudiKernel/Incident.h"
-#endif
-
-#include "GaudiKernel/EventContext.h"
-
-//<<<<<< CLASS DECLARATIONS                                             >>>>>>
-
-/** @class EventIncident
- * @brief an incident that carries the EventInfo object
- * @author pcalafiura@lbl.gov - ATLAS Collaboration
- **/
-
-class EventIncident : public Incident {
-public:
-
-  /// \name structors
-  //@{
-  /// standard constructor
-  ///@param source   the name of the service/algorithm firing
-  ///@param type     e.g. "BeginEvent"
-  ///@param ctx      event context
-  EventIncident(const std::string& source,
-		const std::string& type,
-		const EventContext& ctx);
-  // Use default copy constructor.
-  virtual ~EventIncident();
-  //@}
-
-private:
-};
-
-#endif // EVENTINFO_EVENTINCIDENT_H
-
-
diff --git a/Event/EventInfo/doc/packagedoc.h b/Event/EventInfo/doc/packagedoc.h
index 4495f5b8339..ab2787886ec 100644
--- a/Event/EventInfo/doc/packagedoc.h
+++ b/Event/EventInfo/doc/packagedoc.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
 */
 
 /**
@@ -28,13 +28,4 @@ during event processing the tags are stored in a TagInfo object in the
 DetectorStore. The TagInfoMgr service manages the creation of the
 TagInfo object from information in the incoming event and IOVDb.
 
-Finally, there is an EventIncident class which is sent along with
-begin/end event incidences by the IIncidentSvc. This class provides
-access to the EventInfo object to the object receiving the Incident. 
-
-
-
-
-
-
 */
diff --git a/Event/EventInfo/src/EventIncident.cxx b/Event/EventInfo/src/EventIncident.cxx
deleted file mode 100755
index d9238da9961..00000000000
--- a/Event/EventInfo/src/EventIncident.cxx
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-/**
- * @file EventIncident.cxx
- *
- * @author Paolo Calafiura <pcalafiura@lbl.gov>
- *
- * $Id: EventIncident.cxx,v 1.2 2005-01-12 11:07:53 schaffer Exp $
- */
-#include "EventInfo/EventIncident.h"
-
-EventIncident::EventIncident(const std::string& source,
-			     const std::string& type,
-			     const EventContext& ctx) 
-  : Incident(source, type, ctx)
-{}
-
-EventIncident::~EventIncident() 
-{}
diff --git a/InnerDetector/InDetRecTools/PixelToTPIDTool/src/PixeldEdxTestAlg.cxx b/InnerDetector/InDetRecTools/PixelToTPIDTool/src/PixeldEdxTestAlg.cxx
index 3d6d682da47..6fd9c6fcf99 100755
--- a/InnerDetector/InDetRecTools/PixelToTPIDTool/src/PixeldEdxTestAlg.cxx
+++ b/InnerDetector/InDetRecTools/PixelToTPIDTool/src/PixeldEdxTestAlg.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
 */
 
 #include "PixelToTPIDTool/PixeldEdxTestAlg.h"
@@ -13,12 +13,10 @@
 
 // Gaudi includes
 #include "GaudiKernel/IIncidentSvc.h"
+#include "GaudiKernel/Incident.h"
 #include "GaudiKernel/GaudiException.h" 
 #include "GaudiKernel/ThreadLocalContext.h"
 
-// Event Info 
-#include "EventInfo/EventIncident.h"
-
 // AttributeList
 #include "CoralBase/Attribute.h"
 #include "CoralBase/AttributeListSpecification.h"
@@ -95,7 +93,6 @@ StatusCode PixeldEdxTestAlg::initialize(){
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
 
 StatusCode PixeldEdxTestAlg::readWithBeginRun(){
-    StatusCode status;
     ATH_MSG_INFO ( "in readWithBeginRun()"  );
 
     // As a result of the restructuring the EventIncident class (dropping the reference to EventInfo)
@@ -106,8 +103,7 @@ StatusCode PixeldEdxTestAlg::readWithBeginRun(){
     ServiceHandle<IIncidentSvc> incSvc("IncidentSvc", name() );
     ATH_CHECK( incSvc.retrieve() );
 
-    EventIncident evtInc(name(), "BeginRun", getContext());
-    incSvc->fireIncident( evtInc );
+    incSvc->fireIncident( Incident(name(), IncidentType::BeginRun, getContext()) );
 
     return StatusCode::SUCCESS;
 }
diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/src/CalibNtupleLoader.cxx b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/src/CalibNtupleLoader.cxx
index ceb64abcf7a..526de669b36 100644
--- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/src/CalibNtupleLoader.cxx
+++ b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/src/CalibNtupleLoader.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
 */
 
 //this
@@ -17,10 +17,10 @@
 // StoreGateSvc, IncidentSvc
 #include "StoreGate/StoreGateSvc.h"
 #include "GaudiKernel/IIncidentSvc.h"
+#include "GaudiKernel/Incident.h"
 #include "GaudiKernel/ThreadLocalContext.h"
 
 // Athena EventInfo
-#include "EventInfo/EventIncident.h"
 #include "EventInfo/EventType.h"
 #include "EventInfo/EventInfo.h"
 #include "EventInfo/EventID.h"
@@ -178,7 +178,7 @@ void CalibNtupleLoader::prepareSegments(const MuonCalibEvent *&event, std::map<N
   // Fire the EndEvent incident; this is normally done by the 
   // AthenaEventLoopMgr after calling the "execute" method of all
   // Algorithms
-  m_incSvc->fireIncident(EventIncident(name(),"EndEvent",Gaudi::Hive::currentContext()));
+  m_incSvc->fireIncident(Incident(name(),IncidentType::EndEvent,Gaudi::Hive::currentContext()));
 
   // Change the EventInfo in StoreGate to the correct info from 
   // the event in the ntuple
@@ -198,11 +198,11 @@ void CalibNtupleLoader::prepareSegments(const MuonCalibEvent *&event, std::map<N
   if ( event->eventInfo().runNumber() != m_prev_run_nr ) {
     m_prev_run_nr = event->eventInfo().runNumber() ;
     m_incSvc->fireIncident(Incident(name(),"EndRun"));
-    m_incSvc->fireIncident(EventIncident(name(),"BeginRun",Gaudi::Hive::currentContext()));
+    m_incSvc->fireIncident(Incident(name(),IncidentType::BeginRun,Gaudi::Hive::currentContext()));
   }
 
   // Fire BeginEvent Incident
-  m_incSvc->fireIncident(EventIncident(name(),"BeginEvent",Gaudi::Hive::currentContext()));
+  m_incSvc->fireIncident(Incident(name(),IncidentType::BeginEvent,Gaudi::Hive::currentContext()));
 
 } //end CalibNtupleLoader::prepareSegments
 
diff --git a/Trigger/TriggerSimulation/TrigSimTransforms/src/MergingEventLoopMgr.cxx b/Trigger/TriggerSimulation/TrigSimTransforms/src/MergingEventLoopMgr.cxx
index 26705951d36..b82063281df 100644
--- a/Trigger/TriggerSimulation/TrigSimTransforms/src/MergingEventLoopMgr.cxx
+++ b/Trigger/TriggerSimulation/TrigSimTransforms/src/MergingEventLoopMgr.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
 */
 
 //------------------------------------------------------------------------------
@@ -21,7 +21,6 @@
 #include "EventInfo/EventID.h"
 #include "EventInfo/EventType.h"
 #include "EventInfo/TriggerInfo.h"
-#include "EventInfo/EventIncident.h"
 
 #include "SGTools/DataProxy.h"
 
@@ -33,6 +32,7 @@
 
 #include "GaudiKernel/ThreadLocalContext.h"
 #include "GaudiKernel/Algorithm.h"
+#include "GaudiKernel/Incident.h"
 #include "GaudiKernel/ThreadLocalContext.h"
 
 
@@ -526,7 +526,7 @@ namespace TrigSim {
                 m_currentRun = pPrimEvt->event_ID()->run_number();
                 m_firstRun = false;
 
-                m_incidentSvc->fireIncident(EventIncident(name(),"BeginRun",Gaudi::Hive::currentContext()));
+                m_incidentSvc->fireIncident(Incident(name(),IncidentType::BeginRun,Gaudi::Hive::currentContext()));
 
                 sc = beginRunAlgorithms();
                 if(sc.isFailure()) {
@@ -545,7 +545,7 @@ namespace TrigSim {
              *  Fire suitable incident
              */
 
-            m_incidentSvc->fireIncident(EventIncident(name(),"BeginEvent",Gaudi::Hive::currentContext()));
+            m_incidentSvc->fireIncident(Incident(name(),IncidentType::BeginEvent,Gaudi::Hive::currentContext()));
 
 
 
@@ -849,7 +849,7 @@ namespace TrigSim {
             /*
              *  Fire suitable incident
              */
-            m_incidentSvc->fireIncident(EventIncident(name(),"EndEvent",Gaudi::Hive::currentContext()));
+            m_incidentSvc->fireIncident(Incident(name(),IncidentType::EndEvent,Gaudi::Hive::currentContext()));
 
 
 
-- 
GitLab