From 30f415b07af5337f50e777ee8a779ac2b5b3cc9c Mon Sep 17 00:00:00 2001
From: Vakho Tsulaia <vakhtang.tsulaia@cern.ch>
Date: Thu, 26 Nov 2020 01:40:05 +0100
Subject: [PATCH] Removed duplicate include statements from several packages in
 Control

Partially addresses ATEAM-677
---
 Control/AthAllocators/AthAllocators/Arena.h   |  1 -
 .../AthenaExamples/AthExHive/src/HiveAlgC.h   |  1 -
 .../AthExHive/src/condEx/ASCIICondDbSvc.h     |  1 -
 .../AthenaMPTools/src/AthenaMPToolBase.cxx    | 32 ++++---------------
 .../src/SharedHiveEvtQueueConsumer.cxx        |  1 -
 .../src/AthenaHiveEventLoopMgr.h              | 14 ++++----
 .../test/AthenaEventLoopMgr_test.cxx          |  2 --
 Control/IOVSvc/src/CondSvc.h                  |  1 -
 Control/SGComps/src/SGFolder.cxx              |  2 --
 Control/StoreGate/StoreGate/StoreGateSvc.h    |  3 --
 Control/StoreGate/StoreGate/tools/SGImplSvc.h |  3 +-
 Control/StoreGate/src/SGImplSvc.cxx           |  4 +--
 Control/StoreGate/test/VarHandleBase_test.cxx |  1 -
 13 files changed, 14 insertions(+), 52 deletions(-)

diff --git a/Control/AthAllocators/AthAllocators/Arena.h b/Control/AthAllocators/AthAllocators/Arena.h
index 5875379b9868..21a354f3485d 100644
--- a/Control/AthAllocators/AthAllocators/Arena.h
+++ b/Control/AthAllocators/AthAllocators/Arena.h
@@ -222,7 +222,6 @@
 #include "AthAllocators/ArenaAllocatorBase.h"
 #include <cstdlib>
 #include <string>
-#include <string>
 #include <ostream>
 
 
diff --git a/Control/AthenaExamples/AthExHive/src/HiveAlgC.h b/Control/AthenaExamples/AthExHive/src/HiveAlgC.h
index e7c1152ca930..32f6b2eec36a 100644
--- a/Control/AthenaExamples/AthExHive/src/HiveAlgC.h
+++ b/Control/AthenaExamples/AthExHive/src/HiveAlgC.h
@@ -15,7 +15,6 @@
 #include "StoreGate/WriteHandleKey.h"
 #include "StoreGate/ReadHandleKey.h"
 #include "AthExHive/HiveDataObj.h"
-#include "HiveAlgBase.h"
 
 #include <string>
 
diff --git a/Control/AthenaExamples/AthExHive/src/condEx/ASCIICondDbSvc.h b/Control/AthenaExamples/AthExHive/src/condEx/ASCIICondDbSvc.h
index 8823698d4d4c..d96a51d0605f 100644
--- a/Control/AthenaExamples/AthExHive/src/condEx/ASCIICondDbSvc.h
+++ b/Control/AthenaExamples/AthExHive/src/condEx/ASCIICondDbSvc.h
@@ -9,7 +9,6 @@
 #include "GaudiKernel/EventIDBase.h"
 #include "GaudiKernel/EventIDRange.h"
 #include "AthenaBaseComps/AthService.h"
-#include "AthenaBaseComps/AthService.h"
 
 #include "AthExHive/IASCIICondDbSvc.h"
 
diff --git a/Control/AthenaMPTools/src/AthenaMPToolBase.cxx b/Control/AthenaMPTools/src/AthenaMPToolBase.cxx
index a4fcd1e2cd04..b7d88e76ad04 100644
--- a/Control/AthenaMPTools/src/AthenaMPToolBase.cxx
+++ b/Control/AthenaMPTools/src/AthenaMPToolBase.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #include "AthenaMPToolBase.h"
@@ -21,9 +21,6 @@
 
 #include <iterator>
 
-#include "unistd.h"
-#include <signal.h>
-
 namespace AthenaMPToolBase_d {
   bool sig_done = false;
   void pauseForDebug(int /*sig*/) {
@@ -57,40 +54,23 @@ AthenaMPToolBase::~AthenaMPToolBase()
 StatusCode AthenaMPToolBase::initialize()
 {
   ATH_MSG_DEBUG("In initialize");
-  StatusCode sc = m_evtProcessor.retrieve();
-  if(!sc.isSuccess()) {
-    ATH_MSG_ERROR("Error retrieving wrapped Event Loop Manager");
-    return sc;
-  }
-
-  sc = m_appMgr.retrieve();
-  if(!sc.isSuccess()) {
-    ATH_MSG_ERROR("Error retrieving ApplicationMgr");
-    return sc;
-  }
+  ATH_CHECK(m_evtProcessor.retrieve());
+  ATH_CHECK(m_appMgr.retrieve());
 
   SmartIF<IProperty> prpMgr(serviceLocator());
   if(prpMgr.isValid()) {
     // Get event selector name. Retrieve EventSelector and EventSeek
     m_evtSelName = prpMgr->getProperty("EvtSel").toString();
-    sc = serviceLocator()->service(m_evtSelName,m_evtSelector);
-    if(sc.isFailure() || m_evtSelector==0) {
-      ATH_MSG_ERROR("Error retrieving EventSelector");
-      return StatusCode::FAILURE;
-    }
+    ATH_CHECK(serviceLocator()->service(m_evtSelName,m_evtSelector));
   }
   else {
     ATH_MSG_ERROR("IProperty interface not found in ApplicationMgr");
     return StatusCode::FAILURE;
   }
 
-  sc = m_fileMgr.retrieve();
-  if(!sc.isSuccess()) {
-    ATH_MSG_ERROR("Error retrieving FileMgr");
-    return sc;
-  }
+  ATH_CHECK(m_fileMgr.retrieve());
 
-  SmartIF<IProperty> prpMgr1(&*m_fileMgr);
+  SmartIF<IProperty> prpMgr1(m_fileMgr.get());
   if(prpMgr1.isValid()) {
     m_fileMgrLog = prpMgr1->getProperty("LogFile").toString();
   }
diff --git a/Control/AthenaMPTools/src/SharedHiveEvtQueueConsumer.cxx b/Control/AthenaMPTools/src/SharedHiveEvtQueueConsumer.cxx
index c268827e057c..a66ab348804a 100644
--- a/Control/AthenaMPTools/src/SharedHiveEvtQueueConsumer.cxx
+++ b/Control/AthenaMPTools/src/SharedHiveEvtQueueConsumer.cxx
@@ -26,7 +26,6 @@
 #include <stdexcept>
 #include <cmath> // For pow
 
-#include "unistd.h"
 #include <signal.h>
 
 namespace SharedHiveEvtQueueConsumer_d {
diff --git a/Control/AthenaServices/src/AthenaHiveEventLoopMgr.h b/Control/AthenaServices/src/AthenaHiveEventLoopMgr.h
index c9109cf6bc32..9181d5ea11c2 100644
--- a/Control/AthenaServices/src/AthenaHiveEventLoopMgr.h
+++ b/Control/AthenaServices/src/AthenaHiveEventLoopMgr.h
@@ -14,26 +14,24 @@
 #include <string>
 #include <vector>
 
-#include "GaudiKernel/IEvtSelector.h"
 #include "Gaudi/Property.h"
 #include "GaudiKernel/ServiceHandle.h"
 #include "GaudiKernel/ToolHandle.h"
 #include "GaudiKernel/MsgStream.h"
 #include "GaudiKernel/MinimalEventLoopMgr.h"
 #include "GaudiKernel/IIncidentListener.h"
-#include "AthenaKernel/Timeout.h"
-#include "AthenaKernel/IAthenaEvtLoopPreSelectTool.h"
-#include "AthenaKernel/IEventSeek.h"
-#include "AthenaKernel/ICollectionSize.h"
-#include "AthenaKernel/IConditionsCleanerSvc.h"
-
-//////////////////////////////////////////////////
 #include "GaudiKernel/IAlgResourcePool.h"
 #include "GaudiKernel/IEvtSelector.h"
 #include "GaudiKernel/IHiveWhiteBoard.h"
 #include "GaudiKernel/IScheduler.h"
 #include "GaudiKernel/IAlgExecStateSvc.h"
 
+#include "AthenaKernel/Timeout.h"
+#include "AthenaKernel/IAthenaEvtLoopPreSelectTool.h"
+#include "AthenaKernel/IEventSeek.h"
+#include "AthenaKernel/ICollectionSize.h"
+#include "AthenaKernel/IConditionsCleanerSvc.h"
+
 // Standard includes
 #include <functional>
 
diff --git a/Control/AthenaServices/test/AthenaEventLoopMgr_test.cxx b/Control/AthenaServices/test/AthenaEventLoopMgr_test.cxx
index 018985b108d7..f46d944f640f 100644
--- a/Control/AthenaServices/test/AthenaEventLoopMgr_test.cxx
+++ b/Control/AthenaServices/test/AthenaEventLoopMgr_test.cxx
@@ -23,11 +23,9 @@
 #include "AthenaKernel/IEventSeek.h"
 #include "AthenaKernel/IEvtSelectorSeek.h"
 #include "GaudiKernel/ISvcLocator.h"
-#include "GaudiKernel/Service.h"
 #include "GaudiKernel/IEvtSelector.h"
 #include "GaudiKernel/IEventProcessor.h"
 #include "GaudiKernel/Service.h"
-// //#include "GaudiKernel/DeclareFactoryEntries.h"
 #include "GaudiKernel/Converter.h"
 #include "GaudiKernel/ConversionSvc.h"
 #include <iostream>
diff --git a/Control/IOVSvc/src/CondSvc.h b/Control/IOVSvc/src/CondSvc.h
index 072814fe7562..ef50ecdc5faf 100644
--- a/Control/IOVSvc/src/CondSvc.h
+++ b/Control/IOVSvc/src/CondSvc.h
@@ -7,7 +7,6 @@
 
 #include "GaudiKernel/ICondSvc.h"
 #include "GaudiKernel/Service.h"
-#include "AthenaBaseComps/AthService.h"
 #include "StoreGate/StoreGateSvc.h"
 #include "AthenaBaseComps/AthService.h"
 #include "ICondSvcSetupDone.h"
diff --git a/Control/SGComps/src/SGFolder.cxx b/Control/SGComps/src/SGFolder.cxx
index 70a5e47cd053..89d62ab4ad5d 100644
--- a/Control/SGComps/src/SGFolder.cxx
+++ b/Control/SGComps/src/SGFolder.cxx
@@ -12,8 +12,6 @@
 #include "GaudiKernel/ISvcLocator.h"
 
 #include "AthenaKernel/DefaultKey.h"
-#include "AthenaKernel/IClassIDSvc.h"
-
 #include "AthenaKernel/IClassIDSvc.h"
 #include "AthenaKernel/ClassID_traits.h"
 
diff --git a/Control/StoreGate/StoreGate/StoreGateSvc.h b/Control/StoreGate/StoreGate/StoreGateSvc.h
index f45e3392be30..81a075c63f41 100644
--- a/Control/StoreGate/StoreGate/StoreGateSvc.h
+++ b/Control/StoreGate/StoreGate/StoreGateSvc.h
@@ -41,7 +41,6 @@
 #include <type_traits>
 
 #include "AthenaKernel/StoreID.h"
-#include "AthenaKernel/IProxyDict.h"
 #include "AthenaKernel/IOVSvcDefs.h"
 #include "AthenaKernel/DefaultKey.h"
 #include "AthAllocators/Arena.h"
@@ -53,7 +52,6 @@
 #include "AthenaKernel/IResetable.h"
 #include "AthenaKernel/IClassIDSvc.h"
 #include "AthenaKernel/IIOVSvc.h"
-#include "StoreGate/SGHiveEventSlot.h"
 #include "StoreGate/SGIterator.h"
 #include "StoreGate/DataHandle.h"
 #include "StoreGate/SGWPtr.h"
@@ -61,7 +59,6 @@
 #include "StoreGate/SGObjectWithVersion.h"
 #include "CxxUtils/checker_macros.h"
 
-#include "GaudiKernel/ServiceHandle.h"
 #include "GaudiKernel/IIncidentListener.h"
 
 #ifdef SG_DEPRECATION_WARNINGS
diff --git a/Control/StoreGate/StoreGate/tools/SGImplSvc.h b/Control/StoreGate/StoreGate/tools/SGImplSvc.h
index 0e6cb93210b6..73ea18e8d81f 100644
--- a/Control/StoreGate/StoreGate/tools/SGImplSvc.h
+++ b/Control/StoreGate/StoreGate/tools/SGImplSvc.h
@@ -37,7 +37,6 @@
 #include <thread>
 
 #include "AthenaKernel/StoreID.h"
-#include "AthenaKernel/IProxyDict.h"
 #include "AthenaKernel/IProxyProviderSvc.h"
 #include "AthenaKernel/IHiveStoreMgr.h"
 #include "AthenaKernel/IOVSvcDefs.h"
@@ -59,7 +58,7 @@
 #include "AthAllocators/Arena.h"
 
 #include "GaudiKernel/IIncidentSvc.h"
-#include "GaudiKernel/ServiceHandle.h"
+
 //forward declarations
 namespace SG {
   class DataProxy;
diff --git a/Control/StoreGate/src/SGImplSvc.cxx b/Control/StoreGate/src/SGImplSvc.cxx
index ed2141f4c4c1..66d8f08d59c3 100644
--- a/Control/StoreGate/src/SGImplSvc.cxx
+++ b/Control/StoreGate/src/SGImplSvc.cxx
@@ -21,7 +21,7 @@
 #include "AthenaKernel/IIOVSvc.h"
 #include "AthenaKernel/CLIDRegistry.h"
 #include "AthenaKernel/errorcheck.h"
-//#include "CxxUtils/PageAccessControl.h"
+#include "AthenaKernel/StoreID.h"
 #include "GaudiKernel/IHistorySvc.h"
 #include "GaudiKernel/ISvcLocator.h"
 #include "GaudiKernel/IConversionSvc.h"
@@ -41,8 +41,6 @@
 #include "StoreGate/ActiveStoreSvc.h"
 #include "StoreGate/StoreClearedIncident.h"
 #include "AthAllocators/ArenaHeader.h"
-#include "AthenaKernel/errorcheck.h"
-#include "AthenaKernel/StoreID.h"
 
 // StoreGateSvc. must come before SGImplSvc.h
 #include "StoreGate/StoreGateSvc.h"
diff --git a/Control/StoreGate/test/VarHandleBase_test.cxx b/Control/StoreGate/test/VarHandleBase_test.cxx
index df5283ce6f7d..6d294f411554 100644
--- a/Control/StoreGate/test/VarHandleBase_test.cxx
+++ b/Control/StoreGate/test/VarHandleBase_test.cxx
@@ -14,7 +14,6 @@
 #include "StoreGate/exceptions.h"
 #include "SGTools/TestStore.h"
 #include "SGTools/DataProxy.h"
-#include "SGTools/TestStore.h"
 #include "TestTools/initGaudi.h"
 #include "TestTools/expect_exception.h"
 #include "AthenaKernel/StorableConversions.h"
-- 
GitLab