From ab2c9e7d229c642c2c85c43706146307fc8a92d8 Mon Sep 17 00:00:00 2001
From: Frank Winklmeier <fwinkl@cern>
Date: Thu, 10 Dec 2020 18:56:54 +0100
Subject: [PATCH] ZdcConditions: Delete unsused ZdcCablingSvc

The `ZdcCablingSvc` (intended as a wrapper to the `ZdcCablingService`
singleton) is not used anywhere in Athena and no component is actually
being built in this package. So delete this code entirely.
---
 .../ZDC/ZdcConditions/CMakeLists.txt          |   4 +-
 .../ZdcConditions/ZdcCablingService.h         |   6 -
 .../ZdcConditions/ZdcCablingSvc.h             |  45 -----
 .../ZDC/ZdcConditions/src/ZdcCablingSvc.cxx   | 175 ------------------
 4 files changed, 2 insertions(+), 228 deletions(-)
 delete mode 100755 ForwardDetectors/ZDC/ZdcConditions/ZdcConditions/ZdcCablingSvc.h
 delete mode 100755 ForwardDetectors/ZDC/ZdcConditions/src/ZdcCablingSvc.cxx

diff --git a/ForwardDetectors/ZDC/ZdcConditions/CMakeLists.txt b/ForwardDetectors/ZDC/ZdcConditions/CMakeLists.txt
index 881a4389073a..e189131f11ce 100644
--- a/ForwardDetectors/ZDC/ZdcConditions/CMakeLists.txt
+++ b/ForwardDetectors/ZDC/ZdcConditions/CMakeLists.txt
@@ -7,5 +7,5 @@ atlas_subdir( ZdcConditions )
 atlas_add_library( ZdcConditions
                    src/*.cxx
                    PUBLIC_HEADERS ZdcConditions
-                   LINK_LIBRARIES AthenaBaseComps AthenaKernel Identifier ZdcIdentifier GaudiKernel StoreGateLib
-                   PRIVATE_LINK_LIBRARIES GeoModelInterfaces )
+                   LINK_LIBRARIES Identifier ZdcIdentifier
+                   PRIVATE_LINK_LIBRARIES StoreGateLib )
diff --git a/ForwardDetectors/ZDC/ZdcConditions/ZdcConditions/ZdcCablingService.h b/ForwardDetectors/ZDC/ZdcConditions/ZdcConditions/ZdcCablingService.h
index 3cfead95fcba..3f44a8c2e843 100755
--- a/ForwardDetectors/ZDC/ZdcConditions/ZdcConditions/ZdcCablingService.h
+++ b/ForwardDetectors/ZDC/ZdcConditions/ZdcConditions/ZdcCablingService.h
@@ -17,12 +17,6 @@
 
 class ZdcCablingService
 {
-  //friend class ZdcInfoLoader;
-  //friend class ZdcDetectorTool;
-  //friend class ZdcDetectorFactory;
-  friend class ZdcCablingSvc;
-  //friend class ZdcROD_Decoder;
-
 public:
 
     /** get pointer to service instance*/
diff --git a/ForwardDetectors/ZDC/ZdcConditions/ZdcConditions/ZdcCablingSvc.h b/ForwardDetectors/ZDC/ZdcConditions/ZdcConditions/ZdcCablingSvc.h
deleted file mode 100755
index 4b715e65f880..000000000000
--- a/ForwardDetectors/ZDC/ZdcConditions/ZdcConditions/ZdcCablingSvc.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
-  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
-*/
-
-#ifndef ZDCCONDITIONS_ZDCCABLINGSVC_H
-#define ZDCCONDITIONS_ZDCCABLINGSVC_H
-
-//#include "GaudiKernel/Service.h"
-#include "AthenaBaseComps/AthService.h"
-#include "ZdcConditions/ZdcCablingService.h"
-#include "AthenaKernel/IOVSvcDefs.h"
-#include "GaudiKernel/ServiceHandle.h"
-#include "StoreGate/StoreGateSvc.h"
-
-template <class TYPE> class SvcFactory;
-//NGO This is a quick hack to make ZdcCablingService self contained, i.e. this
-//NGO wrapper tool takes care of the initialization.
-//NGO At some point ZdcCablingService should be made a tool, but this will introduce
-//NGO many upstream code changes.
-
-class ZdcCablingSvc : public AthService
-{
-  friend class SvcFactory<ZdcCablingSvc>;
-  
- public:
-  static const InterfaceID& interfaceID();
-  ZdcCablingSvc(const std::string& name, ISvcLocator* pSvcLocator);
-  virtual ~ZdcCablingSvc(){}
-
-  StatusCode initialize();
-  StatusCode finalize();
-  StatusCode queryInterface(const InterfaceID& riid, void** ppvInterface);
-
-  const ZdcCablingService* cablingService() const { return m_cablingService; }
-
- private:
-
-  const ZdcCablingService* m_cablingService;
-
-  ServiceHandle<StoreGateSvc> m_detStore;
-
-  int m_cablingType;
-};
-
-#endif
diff --git a/ForwardDetectors/ZDC/ZdcConditions/src/ZdcCablingSvc.cxx b/ForwardDetectors/ZDC/ZdcConditions/src/ZdcCablingSvc.cxx
deleted file mode 100755
index 5a732eea9bcf..000000000000
--- a/ForwardDetectors/ZDC/ZdcConditions/src/ZdcCablingSvc.cxx
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
-  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
-*/
-
-#include "ZdcConditions/ZdcCablingSvc.h"
-#include "GaudiKernel/MsgStream.h"
-#include "StoreGate/StoreGateSvc.h"
-#include <cstdlib>
-#include "GeoModelInterfaces/IGeoModelSvc.h"
-
-//
-//____________________________________________________________________
-static const InterfaceID IID_ZdcCablingSvc("ZdcCablingSvc", 1, 0);  
-const InterfaceID&  ZdcCablingSvc::interfaceID() 
-{ 
-  return IID_ZdcCablingSvc;
-}
-
-//
-//_____________________________________________________________________________
-ZdcCablingSvc::ZdcCablingSvc(const std::string& name, ISvcLocator* pSvcLocator) :
-  AthService(name, pSvcLocator),
-  m_cablingService(0),
-  m_detStore("DetectorStore", name)
-{
-  declareProperty("CablingType", m_cablingType = 0, "Cabling type: 0 - simulation, 1 - 2009");
-}
-
-//
-//_____________________________________________________________________________
-StatusCode 
-ZdcCablingSvc::queryInterface(const InterfaceID& riid, void** ppvInterface) 
-{
-  if ( ZdcCablingSvc::interfaceID().versionMatch(riid) ) {
-    *ppvInterface = dynamic_cast<ZdcCablingSvc*>(this);
-  } 
-  else {
-    return Service::queryInterface(riid, ppvInterface);
-  }
-  addRef();
-  return StatusCode::SUCCESS;
-}
-
-//
-//_____________________________________________________________________________
-StatusCode
-ZdcCablingSvc::initialize()
-{
-  MsgStream log(msgSvc(),name());
-  log <<MSG::DEBUG <<"In initialize() " << endmsg;
-
-  //=== initialize base class
-  if(Service::initialize().isFailure()){
-    log << MSG::ERROR << "Unable to initialize base class" << endmsg;
-  }
-
-  //=== set properties
-  if(setProperties().isFailure()){
-    log << MSG::ERROR << "Unable to set properties" << endmsg;
-  }
-  
-  //=== 
-  if(m_detStore.retrieve().isFailure()){
-    log << MSG::ERROR << "Unable to retrieve " << m_detStore << endmsg;
-    return StatusCode::FAILURE;
-  }
-  //=== retrieve all helpers from detector store
-
-  /*
-  const ZdcLVL1_ID* zdcL1ID(0);
-  if(m_detStore->retrieve(caloID).isFailure()){
-    log << MSG::ERROR << "Unable to retrieve ZdcLVL1_ID helper from DetectorStore" << endmsg;
-    return StatusCode::FAILURE;
-  }
-  */
-
-  //=== Initialize ZdcCablingService singleton
-  m_cablingService = ZdcCablingService::getInstance();
-  if(!m_cablingService){
-    log << MSG::ERROR << "Cannot get instance of ZdcCablingService"<< endmsg ;
-    return StatusCode::FAILURE ;
-  }
-
-  IGeoModelSvc *geoModel=0;
-  StatusCode sc = service("GeoModelSvc", geoModel);
-  if(sc.isFailure())
-  {
-    log << MSG::ERROR << "Could not locate GeoModelSvc" << endmsg;
-  } else {
-    // check the DetDescr version
-    std::string atlasVersion = geoModel->atlasVersion();
-    int geo  = atlasVersion.compare(0,9,"ATLAS-GEO");
-    int ibl  = atlasVersion.compare(0,9,"ATLAS-IBL");
-    int slhc = atlasVersion.compare(0,10,"ATLAS-SLHC");
-    int comm = atlasVersion.compare(0,10,"ATLAS-Comm");
-
-    if (geo == 0 || ibl == 0 || slhc == 0) {
-      log << MSG::INFO << "New ATLAS geometry detected: " << atlasVersion << endmsg;
-      m_cablingType = 2;
-    } else if (comm == 0) {
-      log << MSG::INFO << "ATLAS Commissioning geometry detected: " << atlasVersion << endmsg;
-      m_cablingType = 2;
-    } else {
-      log << MSG::INFO << "Old ATLAS geometry detected: " << atlasVersion << endmsg;
-      // in this case change cabling type only if it is not set via jobOptions
-      if (m_cablingType < -1 || m_cablingType > 3)
-        m_cablingType = 0;
-      else 
-        log << MSG::INFO << "Using cabling type from jobOptions " << endmsg;
-    }
-  }
-
-  MSG::Level logLevel = log.level();
-  if (logLevel <= MSG::VERBOSE) {
-
-    // checking all HWIDs
-    std::cout << "===============================" << std::endl;
-
-    // should do something similar for zdc
-    /*    
-    for (int ros=1; ros<5; ++ros) {
-      for (int drawer=0; drawer<64; ++drawer) {
-        for (int channel=0; channel<48; ++channel) {
-        
-          HWIdentifier hwid1 = tileHWID->channel_id(ros,drawer,channel);
-          std::cout << " hw1=" << tileHWID->to_string(hwid1,-1);
-          Identifier id1 = m_cablingService->h2s_pmt_id(hwid1);
-          std::cout << " id1=" << tileID->to_string(id1,-1);
-          HWIdentifier hwid2 = m_cablingService->s2h_channel_id(id1);
-          if (hwid2 != hwid1) std::cout << " hw1!=hw2=" << tileHWID->to_string(hwid2,-1);
-          Identifier id2 = m_cablingService->h2s_pmt_id(hwid2);
-          if (id2 != id1) std::cout << " id1!=id2=" << tileID->to_string(id2,-1);
-          std::cout << std::endl;
-        }
-      }
-    }
-    */
-    
-    // check all ID's
-    /*
-    std::cout << "===============================" << std::endl;
-    
-    for (int side=-1; side<2; side+=2) {
-      for (int module=0; module<64; ++module) {
-        for (int tower=13; tower<16; tower+=2) {
-        
-          Identifier id1 = tileID->pmt_id(3, side, module, tower, 3, 0);
-          std::cout << " id1=" << tileID->to_string(id1,-1);
-          HWIdentifier hw1 = m_cablingService->s2h_channel_id(id1);
-          std::cout << " hw1=" << tileHWID->to_string(hw1,-1);
-          Identifier id2 = m_cablingService->h2s_pmt_id(hw1);
-          if (id2 != id1) std::cout << " id1!=id2=" << tileID->to_string(id2,-1);
-          HWIdentifier hw2 = m_cablingService->s2h_channel_id(id2);
-          if (hw2 != hw1) std::cout << " hwid1!=hwid2=" << tileHWID->to_string(hw2,-1);
-          std::cout << std::endl;
-        }
-      }
-    }
-    */
-
-  }
-  
-  return StatusCode::SUCCESS;
-}
-
-//
-//_____________________________________________________________________________
-StatusCode
-ZdcCablingSvc::finalize()
-{
-  MsgStream log(msgSvc(),name());
-  log << MSG::DEBUG << "finalize called, deleting ZdcCablingService instance" << endmsg;
-  m_cablingService->deleteInstance();
-  return StatusCode::SUCCESS;
-}
-- 
GitLab