From 5a703ae9f1e568577359c287e89de6974a8ab6f1 Mon Sep 17 00:00:00 2001
From: Edward Moyse <edward.moyse@cern.ch>
Date: Thu, 26 Sep 2019 16:09:13 +0200
Subject: [PATCH] Remove MuonCombiTrackBuilder which is no longer used, and
 other misc cleanup to this package.

I have removed MuonCombiTrackBuilder because it is not called by any python fragment, and the tool it requires seems to be missing. Also moved the remaining .h file to the src/ directory and added the thread safety file.
---
 .../ATLAS_CHECK_THREAD_SAFETY                 |  0
 .../MuonSegmentTrackMaker/MuPatTrackBuilder.h | 53 -------------
 .../MuonCombiTrackBuilder.h                   | 43 ----------
 .../src/MuPatTrackBuilder.cxx                 | 19 +----
 .../src/MuonCombiTrackBuilder.cxx             | 79 -------------------
 .../MuonSegmentTrackMaker_entries.cxx         |  4 +-
 6 files changed, 3 insertions(+), 195 deletions(-)
 create mode 100644 MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerAlgs/MuonSegmentTrackMaker/ATLAS_CHECK_THREAD_SAFETY
 delete mode 100755 MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerAlgs/MuonSegmentTrackMaker/MuonSegmentTrackMaker/MuPatTrackBuilder.h
 delete mode 100755 MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerAlgs/MuonSegmentTrackMaker/MuonSegmentTrackMaker/MuonCombiTrackBuilder.h
 delete mode 100755 MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerAlgs/MuonSegmentTrackMaker/src/MuonCombiTrackBuilder.cxx

diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerAlgs/MuonSegmentTrackMaker/ATLAS_CHECK_THREAD_SAFETY b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerAlgs/MuonSegmentTrackMaker/ATLAS_CHECK_THREAD_SAFETY
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerAlgs/MuonSegmentTrackMaker/MuonSegmentTrackMaker/MuPatTrackBuilder.h b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerAlgs/MuonSegmentTrackMaker/MuonSegmentTrackMaker/MuPatTrackBuilder.h
deleted file mode 100755
index 5906898d8b6..00000000000
--- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerAlgs/MuonSegmentTrackMaker/MuonSegmentTrackMaker/MuPatTrackBuilder.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
-*/
-
-#ifndef MUPATTRACKBUILDER_H
-#define MUPATTRACKBUILDER_H
-
-#include <string>
-
-#include "AthenaBaseComps/AthAlgorithm.h"
-#include "GaudiKernel/ServiceHandle.h"
-#include "GaudiKernel/ToolHandle.h"
-#include "TrkSegment/SegmentCollection.h"
-#include "TrkTrack/TrackCollection.h"
-#include "MuonRecHelperTools/IMuonEDMHelperSvc.h"
-
-namespace Muon {
-  class IMuonTrackFinder;
-}
-//class IMuonboyToParticleTool;
-//namespace Muon {
-//  class IMuonBackTracker;
-//}
-
-class MuPatTrackBuilder : public AthAlgorithm
-{
- public:
-  MuPatTrackBuilder(const std::string& name, ISvcLocator* pSvcLocator);
-
- public:
-  virtual ~MuPatTrackBuilder();
-
-  virtual StatusCode initialize();
-  virtual StatusCode execute();
-  virtual StatusCode finalize();
-
- private:
-
-  SG::ReadHandleKey<Trk::SegmentCollection>  m_segmentKey;       //!< Key of input MuonSegmentCombination collection
-  SG::WriteHandleKey<TrackCollection>        m_spectroTrackKey;  //!< Track output Key for tracks strictly in MS
-  SG::WriteHandleKey<TrackCollection>        m_spectroPartiKey;  //!< Track output Key for track particles (strictly in MS)
-  SG::WriteHandleKey<TrackCollection>        m_extrapTrackKey;  //!< Output Key for back-extrapolated tracks
-  SG::WriteHandleKey<TrackCollection>        m_extrapPartiKey;  //!< Output Key for back-extrapolated particles
-
-  ToolHandle<Muon::IMuonTrackFinder> m_trackMaker;  //!< Actual tool to do the track finding
-//  ToolHandle<IMuonboyToParticleTool> m_convTool;    //!< Tool for converting from tracks to track particles (acts as a flag)
-//  ToolHandle<Muon::IMuonBackTracker> p_IMuonBackTracker;    //!< Tool for extrapolating tracks
-  ServiceHandle<Muon::IMuonEDMHelperSvc> m_edmHelperSvc {this, "edmHelper", 
-      "Muon::MuonEDMHelperSvc/MuonEDMHelperSvc", 
-      "Handle to the service providing the IMuonEDMHelperSvc interface" };    //!< helper Tool 
-};
-
-#endif 
diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerAlgs/MuonSegmentTrackMaker/MuonSegmentTrackMaker/MuonCombiTrackBuilder.h b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerAlgs/MuonSegmentTrackMaker/MuonSegmentTrackMaker/MuonCombiTrackBuilder.h
deleted file mode 100755
index 960ef651d26..00000000000
--- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerAlgs/MuonSegmentTrackMaker/MuonSegmentTrackMaker/MuonCombiTrackBuilder.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#ifndef MUONCOMBITRACKBUILDER_H
-#define MUONCOMBITRACKBUILDER_H
-
-#include <string>
-
-#include "AthenaBaseComps/AthAlgorithm.h"
-#include "GaudiKernel/ToolHandle.h"
-#include "MuonSegment/MuonSegmentCombinationCollection.h"
-#include "TrkTrack/TrackCollection.h"
-
-namespace Muon {
-  class IMuonCombiTrackMaker;
-}
-
-class MuonCombiTrackBuilder : public AthAlgorithm
-{
- public:
-  MuonCombiTrackBuilder(const std::string& name, ISvcLocator* pSvcLocator);
-
- public:
-  virtual ~MuonCombiTrackBuilder();
-
-  virtual StatusCode initialize();
-  virtual StatusCode execute();
-  virtual StatusCode finalize();
-
- private:
-
-  SG::ReadHandle<MuonSegmentCombinationCollection>        m_segmentCombiLocation;     //!< Location of input MuonSegmentCombination collection
-  SG::WriteHandle<TrackCollection>                        m_trackLocation;            //!< Location of the track output location
-
-  // member set by Joboptions 
-  ToolHandle<Muon::IMuonCombiTrackMaker> m_trackMaker;
-  
-};
-  
-
-
-#endif 
diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerAlgs/MuonSegmentTrackMaker/src/MuPatTrackBuilder.cxx b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerAlgs/MuonSegmentTrackMaker/src/MuPatTrackBuilder.cxx
index f7c38de12ff..c2f7d26c16a 100755
--- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerAlgs/MuonSegmentTrackMaker/src/MuPatTrackBuilder.cxx
+++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerAlgs/MuonSegmentTrackMaker/src/MuPatTrackBuilder.cxx
@@ -2,10 +2,9 @@
   Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
 */
 
-#include "MuonSegmentTrackMaker/MuPatTrackBuilder.h"
+#include "MuPatTrackBuilder.h"
 #include "MuonRecHelperTools/IMuonEDMHelperSvc.h"
 
-#include "MuonRecToolInterfaces/IMuonTrackFinder.h"
 #include "StoreGate/DataHandle.h"
 #include "TrkSegment/SegmentCollection.h"
 #include "TrkTrack/Track.h"
@@ -19,24 +18,10 @@
 using namespace Muon;
 
 MuPatTrackBuilder::MuPatTrackBuilder(const std::string& name, ISvcLocator* pSvcLocator)
-   : AthAlgorithm(name,pSvcLocator),
-     m_segmentKey("MooreSegments"),
-     m_spectroTrackKey("MuonSpectrometerTracks"),
-     m_spectroPartiKey("MuonSpectrometerParticles"),
-     m_extrapPartiKey("ExtrapolatedMuonSpectrometerParticles"),
-     m_trackMaker("Muon::MuonTrackFinder/MuonTrackSteering")
+   : AthAlgorithm(name,pSvcLocator)
 {
-  // MoMu Key segments (per chamber)
-  declareProperty("TrackSteering",m_trackMaker);
-  declareProperty("MuonSegmentCollection", m_segmentKey);
-  declareProperty("SpectrometerTrackOutputLocation", m_spectroTrackKey);
-  declareProperty("SpectrometerParticleOutputLocation", m_spectroPartiKey);
-  declareProperty("ExtrapolatedParticleOutputLocation", m_extrapPartiKey);
 }
 
-MuPatTrackBuilder::~MuPatTrackBuilder()
-{;}
-
 StatusCode MuPatTrackBuilder::initialize()
 {
   if (m_trackMaker.retrieve().isFailure()){
diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerAlgs/MuonSegmentTrackMaker/src/MuonCombiTrackBuilder.cxx b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerAlgs/MuonSegmentTrackMaker/src/MuonCombiTrackBuilder.cxx
deleted file mode 100755
index 20393fd58f0..00000000000
--- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerAlgs/MuonSegmentTrackMaker/src/MuonCombiTrackBuilder.cxx
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#include "MuonSegmentTrackMaker/MuonCombiTrackBuilder.h"
-
-#include "MuonRecToolInterfaces/IMuonCombiTrackMaker.h"
-#include "StoreGate/DataHandle.h"
-#include <memory>
-
-using namespace Muon;
-
-MuonCombiTrackBuilder::MuonCombiTrackBuilder(const std::string& name, ISvcLocator* pSvcLocator):
-  AthAlgorithm(name,pSvcLocator),
-  m_segmentCombiLocation("MooreSegmentCombinations"),
-  m_trackLocation("MooreTracks"),
-  m_trackMaker("Muon::MuonCombiTrackMaker/MuonCombiTrackMaker")
-{
-  // MoMu location segments (per chamner)
-  declareProperty("MuonSegmentCombinationInputLocation",m_segmentCombiLocation );
-  declareProperty("TrackOutputLocation",m_trackLocation );
-  declareProperty("TrackSteering",m_trackMaker);
-}
-
-MuonCombiTrackBuilder::~MuonCombiTrackBuilder()
-{
-}
-
-StatusCode MuonCombiTrackBuilder::initialize()
-{
-  if (m_trackMaker.retrieve().isFailure()){
-    msg(MSG::FATAL) <<"Could not get " << m_trackMaker <<endmsg; 
-    return StatusCode::FAILURE;
-  }
-  msg(MSG::INFO) << "Retrieved " << m_trackMaker << endmsg;
-
-  ATH_CHECK( m_segmentCombiLocation.initialize() );
-  ATH_CHECK( m_trackLocation.initialize() );
-
-  return StatusCode::SUCCESS; 
-}
-
-StatusCode MuonCombiTrackBuilder::execute()
-{
-  
-  if (!m_segmentCombiLocation.isValid() ) {
-    msg(MSG::WARNING) << " Could not find MuonSegmentCombinationCollection at " << m_segmentCombiLocation.name() <<endmsg;
-    return StatusCode::RECOVERABLE;
-  }
-    
-  if( !m_segmentCombiLocation.cptr() ) {
-    msg(MSG::WARNING) << " Obtained zero pointer for MuonSegmentCombinationCollection at " << m_segmentCombiLocation <<endmsg;
-    return StatusCode::RECOVERABLE;
-  }
-      
-  if( msgLvl(MSG::DEBUG) ) msg(MSG::DEBUG) << " Retrieved MuonSegmentCombinationCollection "  << m_segmentCombiLocation->size() << endmsg;
- 
-  TrackCollection* newtracks = m_trackMaker->find(*m_segmentCombiLocation);
-
-  // create dummy track collection
-  if( !newtracks ) newtracks = new TrackCollection();
-
-  if (m_trackLocation.record(std::unique_ptr<TrackCollection>(newtracks)).isFailure()){    
-    msg(MSG::WARNING) << "New Track Container could not be recorded in StoreGate !" << endmsg;
-    delete newtracks;
-    return StatusCode::RECOVERABLE;
-  }
-  if( msgLvl(MSG::DEBUG) ) msg(MSG::DEBUG) << "Track Container '" << m_trackLocation << "' recorded in storegate, ntracks: " << newtracks->size() << endmsg;
-
-  return StatusCode::SUCCESS;
-} // execute
-
-StatusCode MuonCombiTrackBuilder::finalize()
-{
-  return StatusCode::SUCCESS;
-}
-
-
-
diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerAlgs/MuonSegmentTrackMaker/src/components/MuonSegmentTrackMaker_entries.cxx b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerAlgs/MuonSegmentTrackMaker/src/components/MuonSegmentTrackMaker_entries.cxx
index 41400e7fa0e..86aecb453e1 100644
--- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerAlgs/MuonSegmentTrackMaker/src/components/MuonSegmentTrackMaker_entries.cxx
+++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerAlgs/MuonSegmentTrackMaker/src/components/MuonSegmentTrackMaker_entries.cxx
@@ -1,6 +1,4 @@
-#include "MuonSegmentTrackMaker/MuonCombiTrackBuilder.h"
-#include "MuonSegmentTrackMaker/MuPatTrackBuilder.h"
+#include "../MuPatTrackBuilder.h"
 
-DECLARE_COMPONENT( MuonCombiTrackBuilder )
 DECLARE_COMPONENT( MuPatTrackBuilder )
 
-- 
GitLab