From 8a17017bedfe176ca0ca070dd801699fdc77bb85 Mon Sep 17 00:00:00 2001
From: Jochen Meyer <Jochen.Meyer@cern.ch>
Date: Mon, 15 Sep 2014 21:38:56 +0200
Subject: [PATCH] fixing compiler warning (MuonSegmentTrackMaker-02-00-01)

---
 .../MuonSegmentTrackMaker/MuPatTrackBuilder.h |  48 +++++
 .../MuonCombiTrackBuilder.h                   |  41 ++++
 .../MuonSegmentTrackMaker/cmt/requirements    |  30 +++
 .../MuonSegmentTrackMaker/doc/mainpage.h      |  30 +++
 .../src/MuPatTrackBuilder.cxx                 | 189 ++++++++++++++++++
 .../src/MuonCombiTrackBuilder.cxx             |  74 +++++++
 .../MuonSegmentTrackMaker_entries.cxx         |  12 ++
 .../components/MuonSegmentTrackMaker_load.cxx |   3 +
 8 files changed, 427 insertions(+)
 create mode 100755 MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerAlgs/MuonSegmentTrackMaker/MuonSegmentTrackMaker/MuPatTrackBuilder.h
 create mode 100755 MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerAlgs/MuonSegmentTrackMaker/MuonSegmentTrackMaker/MuonCombiTrackBuilder.h
 create mode 100755 MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerAlgs/MuonSegmentTrackMaker/cmt/requirements
 create mode 100644 MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerAlgs/MuonSegmentTrackMaker/doc/mainpage.h
 create mode 100755 MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerAlgs/MuonSegmentTrackMaker/src/MuPatTrackBuilder.cxx
 create mode 100755 MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerAlgs/MuonSegmentTrackMaker/src/MuonCombiTrackBuilder.cxx
 create mode 100755 MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerAlgs/MuonSegmentTrackMaker/src/components/MuonSegmentTrackMaker_entries.cxx
 create mode 100755 MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerAlgs/MuonSegmentTrackMaker/src/components/MuonSegmentTrackMaker_load.cxx

diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerAlgs/MuonSegmentTrackMaker/MuonSegmentTrackMaker/MuPatTrackBuilder.h b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerAlgs/MuonSegmentTrackMaker/MuonSegmentTrackMaker/MuPatTrackBuilder.h
new file mode 100755
index 0000000000000..03e2056aba415
--- /dev/null
+++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerAlgs/MuonSegmentTrackMaker/MuonSegmentTrackMaker/MuPatTrackBuilder.h
@@ -0,0 +1,48 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+#ifndef MUPATTRACKBUILDER_H
+#define MUPATTRACKBUILDER_H
+
+#include <string>
+
+#include "AthenaBaseComps/AthAlgorithm.h"
+#include "GaudiKernel/ToolHandle.h"
+
+namespace Muon {
+  class IMuonTrackFinder;
+  class MuonEDMHelperTool;
+}
+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:
+
+  std::string m_segmentLocation;       //!< Location of input MuonSegmentCombination collection
+  std::string m_spectroTrackLocation;  //!< Track output location for tracks strictly in MS
+  std::string m_spectroPartiLocation;  //!< Track output location for track particles (strictly in MS)
+  std::string m_extrapTrackLocation;  //!< Output location for back-extrapolated tracks
+  std::string m_extrapPartiLocation;  //!< Output location 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
+  ToolHandle<Muon::MuonEDMHelperTool> m_helper;    //!< helper Tool 
+};
+
+#endif 
diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerAlgs/MuonSegmentTrackMaker/MuonSegmentTrackMaker/MuonCombiTrackBuilder.h b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerAlgs/MuonSegmentTrackMaker/MuonSegmentTrackMaker/MuonCombiTrackBuilder.h
new file mode 100755
index 0000000000000..c365ffa3f6c66
--- /dev/null
+++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerAlgs/MuonSegmentTrackMaker/MuonSegmentTrackMaker/MuonCombiTrackBuilder.h
@@ -0,0 +1,41 @@
+/*
+  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"
+
+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:
+
+  std::string         m_segmentCombiLocation;     //!< Location of input MuonSegmentCombination collection
+  std::string         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/cmt/requirements b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerAlgs/MuonSegmentTrackMaker/cmt/requirements
new file mode 100755
index 0000000000000..887a1ce4b8b0f
--- /dev/null
+++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerAlgs/MuonSegmentTrackMaker/cmt/requirements
@@ -0,0 +1,30 @@
+package MuonSegmentTrackMaker
+
+author Niels van Eldik <niels.van.eldik@cern.ch>
+
+use AtlasPolicy         	AtlasPolicy-*
+use GaudiInterface      	GaudiInterface-*		External
+
+use AthenaBaseComps     	AthenaBaseComps-*   	Control
+
+private
+use MuonSegment 			MuonSegment-* 			MuonSpectrometer/MuonReconstruction/MuonRecEvent
+use MuonRecToolInterfaces 	MuonRecToolInterfaces-* MuonSpectrometer/MuonReconstruction/MuonRecTools
+use MuonRecHelperTools	 	MuonRecHelperTools-* MuonSpectrometer/MuonReconstruction/MuonRecTools
+#use MuonTrackMakerUtils         MuonTrackMakerUtils-*  MuonSpectrometer/MuonReconstruction/MuonTrackMakers
+use StoreGate				StoreGate-*				Control
+use TrkTrack				TrkTrack-*				Tracking/TrkEvent
+use TrkSegment				TrkSegment-*			Tracking/TrkEvent
+#use TrkParameters			TrkParameters-*			Tracking/TrkEvent
+#use TrkEventPrimitives		TrkEventPrimitives-*	Tracking/TrkEvent
+use MboyEDMToolInterfaces   MboyEDMToolInterfaces-* MuonSpectrometer/Muonboy
+use MboyAthToolInterfaces   MboyAthToolInterfaces-* MuonSpectrometer/Muonboy
+use Particle                Particle-*              Reconstruction
+end_private
+
+apply_pattern component_library
+library MuonSegmentTrackMaker *.cxx components/*.cxx
+
+private
+#macro cppdebugflags '$(cppdebugflags_s)'
+#macro_remove componentshr_linkopts "-Wl,-s"
diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerAlgs/MuonSegmentTrackMaker/doc/mainpage.h b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerAlgs/MuonSegmentTrackMaker/doc/mainpage.h
new file mode 100644
index 0000000000000..0a01f52ba57c2
--- /dev/null
+++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerAlgs/MuonSegmentTrackMaker/doc/mainpage.h
@@ -0,0 +1,30 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+/**
+
+@mainpage MuonSegmentTrackMaker package
+	 @author Niels.Van.Eldik@cern.ch
+	
+@section MuonSegmentTrackMakerIntro Introduction
+
+The MuonSegmentTrackMaker is a package containing an algorithm to find tracks in the muon spectrometer
+starting from MuonSegmentCombinations. It uses a combination of extrapolation + fitting to build the tracks
+ 	
+@section ExtrasMuonSegmentTrackMaker Extra Pages
+
+ - @ref UsedMuonSegmentTrackMaker
+ - @ref RequirementsMuonSegmentTrackMaker
+*/
+
+/**
+@page UsedMuonSegmentTrackMaker Used Packages
+@htmlinclude used_packages.html
+*/
+
+/**
+@page RequirementsMuonSegmentTrackMaker Requirements
+@include requirements
+
+*/
diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerAlgs/MuonSegmentTrackMaker/src/MuPatTrackBuilder.cxx b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerAlgs/MuonSegmentTrackMaker/src/MuPatTrackBuilder.cxx
new file mode 100755
index 0000000000000..5133820d11772
--- /dev/null
+++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerAlgs/MuonSegmentTrackMaker/src/MuPatTrackBuilder.cxx
@@ -0,0 +1,189 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+#include "MuonSegmentTrackMaker/MuPatTrackBuilder.h"
+#include "MuonRecHelperTools/MuonEDMHelperTool.h"
+
+#include "MuonRecToolInterfaces/IMuonTrackFinder.h"
+#include "StoreGate/DataHandle.h"
+#include "TrkSegment/SegmentCollection.h"
+#include "TrkTrack/Track.h"
+#include "TrkTrack/TrackCollection.h"
+#include "MuonSegment/MuonSegment.h"
+
+#include "TrkTrack/TrackStateOnSurface.h"
+#include "Particle/TrackParticleContainer.h"
+#include "MboyEDMToolInterfaces/IMuonboyToParticleTool.h"
+#include "MboyAthToolInterfaces/IMuonBackTracker.h"
+
+#include <vector>
+
+using namespace Muon;
+
+MuPatTrackBuilder::MuPatTrackBuilder(const std::string& name, ISvcLocator* pSvcLocator)
+   : AthAlgorithm(name,pSvcLocator)
+   , m_trackMaker("Muon::MuonTrackFinder/MuonTrackSteering")
+   , m_convTool("")
+   , p_IMuonBackTracker("")
+   , m_helper("Muon::MuonEDMHelperTool/MuonEDMHelperTool")
+{
+  // MoMu location segments (per chamner)
+  declareProperty("TrackSteering",m_trackMaker);
+  declareProperty("MuonSegmentCollection", m_segmentLocation                = "MooreSegments");
+  declareProperty("SpectrometerTrackOutputLocation", m_spectroTrackLocation = "MuonSpectrometerTracks");
+  declareProperty("SpectrometerParticleOutputLocation", m_spectroPartiLocation = "MuonSpectrometerParticles");
+  declareProperty("ExtrapolatedTrackOutputLocation",    m_extrapTrackLocation   = "" ); 
+  // set to "ExtrapolatedMuonSpectrometerTracks" for muonboy-like convention);
+  declareProperty("ExtrapolatedParticleOutputLocation", m_extrapPartiLocation   = "ExtrapolatedMuonSpectrometerParticles");
+  declareProperty("TrackToParticleTool",   m_convTool);
+  declareProperty("MuonBackTracker",   p_IMuonBackTracker);
+}
+
+MuPatTrackBuilder::~MuPatTrackBuilder()
+{;}
+
+StatusCode MuPatTrackBuilder::initialize()
+{
+  if (m_trackMaker.retrieve().isFailure()){
+    msg(MSG::FATAL) <<"Could not get " << m_trackMaker <<endreq; 
+    return StatusCode::FAILURE;
+  }
+  if (m_helper.retrieve().isFailure()){
+    msg(MSG::FATAL) <<"Could not get " << m_helper <<endreq; 
+    return StatusCode::FAILURE;
+  }
+  if( msgLvl(MSG::DEBUG) ) msg(MSG::DEBUG) << "Retrieved " << m_trackMaker << endreq;
+
+  if (!m_convTool.empty()) {
+    if (m_convTool.retrieve().isFailure()){
+      ATH_MSG_FATAL ("Could not get track converter " << m_convTool << ". STACO will have problems.");
+      return StatusCode::FAILURE;
+    } else {
+      ATH_MSG_DEBUG ("Retrieved " << m_convTool);
+    }
+  }
+
+  if (!p_IMuonBackTracker.empty()) {
+    if (p_IMuonBackTracker.retrieve().isFailure()){
+      ATH_MSG_FATAL ("Could not get track converter " << p_IMuonBackTracker << ". STACO will have problems.");
+      return StatusCode::FAILURE;
+    } else {
+      ATH_MSG_DEBUG ("Retrieved " << p_IMuonBackTracker);
+    }
+  }
+
+  return StatusCode::SUCCESS; 
+}
+
+StatusCode MuPatTrackBuilder::execute()
+{
+  typedef std::vector<const Muon::MuonSegment*> MuonSegmentCollection;
+
+  const DataHandle<Trk::SegmentCollection> segCol;
+  if (evtStore()->retrieve(segCol,m_segmentLocation).isFailure() ) {
+    msg(MSG::WARNING) << "Could not find MuonSegmentCollection at " << m_segmentLocation <<endreq;
+    return StatusCode::RECOVERABLE;
+  }
+    
+  if( !segCol ) {
+    msg(MSG::WARNING) << "Obtained zero pointer for MuonSegmentCollection at " << m_segmentLocation <<endreq;
+    return StatusCode::RECOVERABLE;
+  }
+      
+  if( msgLvl(MSG::DEBUG) ) msg(MSG::DEBUG) << "Retrieved MuonSegmentCollection "  << segCol->size() << endreq;
+
+  MuonSegmentCollection msc;
+  msc.reserve(segCol->size());
+  for (unsigned int i=0;i<segCol->size();++i){
+    if (!segCol->at(i)) continue;
+    const Muon::MuonSegment * ms = dynamic_cast<const Muon::MuonSegment*>(segCol->at(i));
+    if (ms) msc.push_back( ms );
+  }
+
+  if (msc.size() != segCol->size()){
+    msg(MSG::WARNING) << "Input segment collection (size " << segCol->size() << ") and translated MuonSegment collection (size "
+                      << msc.size() << ") are not the same size." << endreq;
+  }
+
+  TrackCollection * newtracks = m_trackMaker->find(msc);
+  if (!newtracks) newtracks = new TrackCollection();
+
+  if (m_extrapTrackLocation == ""){
+
+    // Record the track collection for a track builder reporting params only in MS
+    //
+    if (evtStore()->record(newtracks,m_spectroTrackLocation,false).isFailure()){
+      msg(MSG::WARNING) << "New Track Container " << m_spectroTrackLocation << " could not be recorded in StoreGate !" << endreq;
+      delete newtracks;
+      return StatusCode::RECOVERABLE;
+    }
+    if( msgLvl(MSG::DEBUG) ) msg(MSG::DEBUG) << "TrackCollection '" << m_spectroTrackLocation << "' recorded in storegate, ntracks: " << newtracks->size() << endreq;
+
+    // how about particle making here???
+
+  } else {
+
+    // Record two track collections, with and without extrapolated parameters
+    if (evtStore()->record(newtracks,m_spectroTrackLocation,false).isFailure()){
+      msg(MSG::WARNING) << "New Track Container " << m_spectroTrackLocation << " could not be recorded in StoreGate !" << endreq;
+      delete newtracks;
+      return StatusCode::RECOVERABLE;
+    }
+    ATH_MSG_DEBUG ("TrackCollection '" << m_spectroTrackLocation << "' recorded in storegate, ntracks: " << newtracks->size());
+
+    // Make track particles out of it and re-record
+    if (!m_convTool.empty()) {
+      Rec::TrackParticleContainer * recpart = new Rec::TrackParticleContainer();
+      if (newtracks->empty() || m_convTool->convertCollection( newtracks , recpart ).isSuccess() ){
+        ATH_MSG_DEBUG ("Sucessfully converted first track collection to track particles, "<<
+                       "now have container of size "<<recpart->size());
+        evtStore()->record(recpart,m_spectroPartiLocation,false).ignore();
+      } else {
+        ATH_MSG_DEBUG ("Could not convert first track collection to track particles!");
+        delete recpart;
+      }
+    }
+ 
+    // BackTrack
+    TrackCollection * BkTk_TrackCollection = new TrackCollection();
+    for (unsigned int tk=0;tk<newtracks->size();++tk){
+      if ( !newtracks->at(tk) ) continue;
+      Trk::Track* pTrack      = (*newtracks)[tk] ;
+      Trk::Track* BkTk_pTrack = p_IMuonBackTracker->MuonBackTrack(pTrack) ;
+      if (BkTk_pTrack){
+        BkTk_TrackCollection->push_back( BkTk_pTrack );
+      }else{
+	ATH_MSG_WARNING("Failed to create MS only track, copying track at IP ");
+        BkTk_TrackCollection->push_back(  new Trk::Track(*(*newtracks)[tk]) );
+      }
+    }
+    if (evtStore()->record(BkTk_TrackCollection,m_extrapTrackLocation,false).isFailure()){
+      msg(MSG::WARNING) << "New Track Container " << m_extrapTrackLocation << " could not be recorded in StoreGate !" << endreq;
+      delete BkTk_TrackCollection;
+      return StatusCode::RECOVERABLE;
+    }
+    if( msgLvl(MSG::DEBUG) ) msg(MSG::DEBUG) << "TrackCollection '" << m_extrapTrackLocation << "' recorded in storegate, ntracks: " << BkTk_TrackCollection->size() << endreq;
+
+    // Make track particles out of that and re-record
+    if (!m_convTool.empty()) {
+      Rec::TrackParticleContainer * BkTk_TrackParticleContainer = new Rec::TrackParticleContainer();
+      if (BkTk_TrackCollection->empty() || m_convTool->convertCollection( BkTk_TrackCollection , BkTk_TrackParticleContainer ).isSuccess() ){
+        ATH_MSG_DEBUG ("Sucessfully converted modified track collection to track particles, "<<
+                       "now have container of size "<<BkTk_TrackParticleContainer->size());
+        evtStore()->record(BkTk_TrackParticleContainer,m_extrapPartiLocation,false).ignore();
+      } else {
+        ATH_MSG_DEBUG ("Could not convert first track collection to track particles!");
+        delete BkTk_TrackParticleContainer;
+      }
+    }
+  }
+
+  return StatusCode::SUCCESS;
+} // execute
+
+StatusCode MuPatTrackBuilder::finalize()
+{
+  return StatusCode::SUCCESS;
+}
+
diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerAlgs/MuonSegmentTrackMaker/src/MuonCombiTrackBuilder.cxx b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerAlgs/MuonSegmentTrackMaker/src/MuonCombiTrackBuilder.cxx
new file mode 100755
index 0000000000000..ab971310346f9
--- /dev/null
+++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerAlgs/MuonSegmentTrackMaker/src/MuonCombiTrackBuilder.cxx
@@ -0,0 +1,74 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+#include "MuonSegmentTrackMaker/MuonCombiTrackBuilder.h"
+
+#include "MuonRecToolInterfaces/IMuonCombiTrackMaker.h"
+#include "MuonSegment/MuonSegmentCombinationCollection.h"
+#include "StoreGate/DataHandle.h"
+#include "TrkTrack/TrackCollection.h"
+
+using namespace Muon;
+
+MuonCombiTrackBuilder::MuonCombiTrackBuilder(const std::string& name, ISvcLocator* pSvcLocator):
+  AthAlgorithm(name,pSvcLocator),
+  m_trackMaker("Muon::MuonCombiTrackMaker/MuonCombiTrackMaker")
+{
+  // MoMu location segments (per chamner)
+  declareProperty("TrackSteering",m_trackMaker);
+  declareProperty("MuonSegmentCombinationInputLocation",m_segmentCombiLocation = "MooreSegmentCombinations");
+  declareProperty("TrackOutputLocation",m_trackLocation = "MooreTracks");
+}
+
+MuonCombiTrackBuilder::~MuonCombiTrackBuilder()
+{
+}
+
+StatusCode MuonCombiTrackBuilder::initialize()
+{
+  if (m_trackMaker.retrieve().isFailure()){
+    msg(MSG::FATAL) <<"Could not get " << m_trackMaker <<endreq; 
+    return StatusCode::FAILURE;
+  }
+  msg(MSG::INFO) << "Retrieved " << m_trackMaker << endreq;
+
+  return StatusCode::SUCCESS; 
+}
+
+StatusCode MuonCombiTrackBuilder::execute()
+{
+  
+  const DataHandle<MuonSegmentCombinationCollection> combiCol;
+  if (evtStore()->retrieve(combiCol,m_segmentCombiLocation).isFailure() ) {
+    msg(MSG::WARNING) << " Could not find MuonSegmentCombinationCollection at " << m_segmentCombiLocation <<endreq;
+    return StatusCode::RECOVERABLE;
+  }
+    
+  if( !combiCol ) {
+    msg(MSG::WARNING) << " Obtained zero pointer for MuonSegmentCombinationCollection at " << m_segmentCombiLocation <<endreq;
+    return StatusCode::RECOVERABLE;
+  }
+      
+  if( msgLvl(MSG::DEBUG) ) msg(MSG::DEBUG) << " Retrieved MuonSegmentCombinationCollection "  << combiCol->size() << endreq;
+ 
+  TrackCollection* newtracks = m_trackMaker->find(*combiCol);
+ 
+  // create dummy track collection
+  if( !newtracks ) newtracks = new TrackCollection();
+
+  if (evtStore()->record(newtracks,m_trackLocation,false).isFailure()){
+    msg(MSG::WARNING) << "New Track Container could not be recorded in StoreGate !" << endreq;
+    delete newtracks;
+    return StatusCode::RECOVERABLE;
+  }
+  if( msgLvl(MSG::DEBUG) ) msg(MSG::DEBUG) << "Track Container '" << m_trackLocation << "' recorded in storegate, ntracks: " << newtracks->size() << endreq;
+
+  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
new file mode 100755
index 0000000000000..25ed854b1e4e4
--- /dev/null
+++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerAlgs/MuonSegmentTrackMaker/src/components/MuonSegmentTrackMaker_entries.cxx
@@ -0,0 +1,12 @@
+#include "GaudiKernel/DeclareFactoryEntries.h"
+#include "MuonSegmentTrackMaker/MuonCombiTrackBuilder.h"
+#include "MuonSegmentTrackMaker/MuPatTrackBuilder.h"
+
+DECLARE_ALGORITHM_FACTORY( MuonCombiTrackBuilder )
+DECLARE_ALGORITHM_FACTORY( MuPatTrackBuilder )
+
+DECLARE_FACTORY_ENTRIES( MuonSegmentTrackMaker ) 
+{
+  DECLARE_ALGORITHM( MuonCombiTrackBuilder );
+  DECLARE_ALGORITHM( MuPatTrackBuilder );
+}
diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerAlgs/MuonSegmentTrackMaker/src/components/MuonSegmentTrackMaker_load.cxx b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerAlgs/MuonSegmentTrackMaker/src/components/MuonSegmentTrackMaker_load.cxx
new file mode 100755
index 0000000000000..adb5951e49af0
--- /dev/null
+++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerAlgs/MuonSegmentTrackMaker/src/components/MuonSegmentTrackMaker_load.cxx
@@ -0,0 +1,3 @@
+#include "GaudiKernel/LoadFactoryEntries.h"
+
+LOAD_FACTORY_ENTRIES( MuonSegmentTrackMaker )
-- 
GitLab