From 5738c6aaa317e4e89b386df346d959ffc26c6ee3 Mon Sep 17 00:00:00 2001
From: Sergi Rodriguez <Sergi.Rodriguez@cern.ch>
Date: Mon, 19 Feb 2024 11:32:16 +0100
Subject: [PATCH] adding last L1 comments

---
 .../TRT_CalibAlgs/TRTCalibrationMgr.h         |  4 ++--
 .../python/TRTCalibrationMgrConfig.py         | 19 ++++++++++---------
 .../TRT_CalibAlgs/src/TRTCalibrationMgr.cxx   |  6 ------
 3 files changed, 12 insertions(+), 17 deletions(-)

diff --git a/InnerDetector/InDetCalibAlgs/TRT_CalibAlgs/TRT_CalibAlgs/TRTCalibrationMgr.h b/InnerDetector/InDetCalibAlgs/TRT_CalibAlgs/TRT_CalibAlgs/TRTCalibrationMgr.h
index b404c2c0b26f..25bb9dcfddcd 100755
--- a/InnerDetector/InDetCalibAlgs/TRT_CalibAlgs/TRT_CalibAlgs/TRTCalibrationMgr.h
+++ b/InnerDetector/InDetCalibAlgs/TRT_CalibAlgs/TRT_CalibAlgs/TRTCalibrationMgr.h
@@ -77,8 +77,8 @@ private:
     PublicToolHandleArray<ITRTCalibrator> m_TRTCalibTools {this, "TRTCalibrator", {}, ""};
     ToolHandleArray<IFitTool> m_FitTools {this, "FitTools", {}, ""};
     ToolHandle<Trk::ITrackFitter> m_trackFitter {this, "TrackFitter", "ActsTrk::KalmanFitter/TrkKalmanFitter", ""};
-    ToolHandle<Trk::ITrackSelectorTool> m_trackSelector; //!< Tool handle to the Trk::ITrackSelectorTool
-    ToolHandle<IAthenaOutputStreamTool> m_streamer; //!< OutputStreamTool
+    ToolHandle<Trk::ITrackSelectorTool> m_trackSelector {this, "TrackSelectorTool", "InDet::InDetTrackSelectorTool/InDetTrackSelectorTool", "Tool for the selection of tracks"}; 
+    ToolHandle<IAthenaOutputStreamTool> m_streamer {this, "StreamTool", "AthenaOutputStreamTool/CondStream1"}; //!< OutputStreamTool
 
     // Gaudi properties
     Gaudi::Property<bool> m_dorefit       {this, "DoRefit"       , true , "Does a Re-Fit"};
diff --git a/InnerDetector/InDetCalibAlgs/TRT_CalibAlgs/python/TRTCalibrationMgrConfig.py b/InnerDetector/InDetCalibAlgs/TRT_CalibAlgs/python/TRTCalibrationMgrConfig.py
index 16b2f55b5cbf..fedb5ca91ead 100644
--- a/InnerDetector/InDetCalibAlgs/TRT_CalibAlgs/python/TRTCalibrationMgrConfig.py
+++ b/InnerDetector/InDetCalibAlgs/TRT_CalibAlgs/python/TRTCalibrationMgrConfig.py
@@ -61,23 +61,25 @@ def TRTCalibratorCfg(flags, name="TRTCalibrator", **kwargs) :
     if "NeighbourSvc" not in kwargs:
         from TRT_ConditionsServices.TRT_ConditionsServicesConfig import TRT_StrawNeighbourSvcCfg
         kwargs.setdefault("NeighbourSvc", acc.getPrimaryAndMerge(TRT_StrawNeighbourSvcCfg(flags)))
-    if "TRTCaldbTool" not in kwargs:
+    if "TRTCalDbTool" not in kwargs:
         from TRT_ConditionsServices.TRT_ConditionsServicesConfig import TRT_CalDbToolCfg
-        TRT_CalDbTool = acc.popToolsAndMerge(TRT_CalDbToolCfg(flags))
-        acc.setPrivateTools(TRT_CalDbTool)
+        kwargs.setdefault("TRT_CalDbTool", acc.popToolsAndMerge(TRT_CalDbToolCfg(flags)))
+
+    acc.setPrivateTools(CompFactory.TRTCalibrator(name, **kwargs))
+
         
         
     return acc
 
 # Tool to select tracks to be used for calibration
 def InDetDetailedTrackSelectorToolCfg(flags,name="InDetDetailedTrackSelectorTool",**kwargs):
+    # FIXME - This function should go to the correct Athena pkg...
     
     from AthenaCommon.SystemOfUnits import GeV, mm
     
     acc = ComponentAccumulator()      
-    kwargs.setdefault("name", name)    
     kwargs.setdefault("pTMin", 1.0*GeV)     
-    # kwargs.setdefault("fitChi2OndfMax",50.0)  ---> This does not exist in the InDetDetailedTrackSelectorTool.cxx file
+    kwargs.setdefault("fitChi2OnNdfMax",50.0)
     kwargs.setdefault("z0Max",99999.0*mm)   
     kwargs.setdefault("IPd0Max",10.0*mm)    
     kwargs.setdefault("IPd0Max",300.0*mm)   
@@ -91,12 +93,11 @@ def InDetDetailedTrackSelectorToolCfg(flags,name="InDetDetailedTrackSelectorTool
     kwargs.setdefault("nHitTrtPlusOutliersHighE",20)
     kwargs.setdefault("nHitTrtHighE",0)
     
-    # from TrkConfig.AtlasExtrapolatorConfig import InDetExtrapolatorCfg
-    # kwargs.setdefault("Extrapolator", acc.popToolsAndMerge(InDetExtrapolatorCfg(flags, **kwargs)))
-    
+    from TrkConfig.AtlasExtrapolatorConfig import InDetExtrapolatorCfg
+    kwargs.setdefault("Extrapolator", acc.popToolsAndMerge(InDetExtrapolatorCfg(flags)))
     
     from InDetConfig.InDetTrackSelectorToolConfig import InDetTrackSelectorToolCfg
-    acc.setPrivateTools(acc.popToolsAndMerge(InDetTrackSelectorToolCfg(flags, **kwargs)))
+    acc.setPrivateTools(acc.popToolsAndMerge(InDetTrackSelectorToolCfg(flags, name=name , **kwargs)))
     return acc
     
 # Steering algorithm. Either it fills track and hit ntuples, or it calls TRTCalibrator
diff --git a/InnerDetector/InDetCalibAlgs/TRT_CalibAlgs/src/TRTCalibrationMgr.cxx b/InnerDetector/InDetCalibAlgs/TRT_CalibAlgs/src/TRTCalibrationMgr.cxx
index e163a14c74f5..37aa1196b401 100644
--- a/InnerDetector/InDetCalibAlgs/TRT_CalibAlgs/src/TRTCalibrationMgr.cxx
+++ b/InnerDetector/InDetCalibAlgs/TRT_CalibAlgs/src/TRTCalibrationMgr.cxx
@@ -27,17 +27,11 @@
 
 TRTCalibrationMgr::TRTCalibrationMgr(const std::string& name, ISvcLocator* pSvcLocator) :
 	AthAlgorithm   (name, pSvcLocator),
-    m_trackSelector("InDet::InDetTrackSelectorTool/InDetTrackSelectorTool"),
-    m_streamer("AthenaOutputStreamTool/CondStream1"),
 	m_max_ntrk(100000),
     m_par_rtcontainerkey("/TRT/Calib/RT"),
     m_par_t0containerkey("/TRT/Calib/T0")
 {
-	m_TRTCalibTools.push_back("TRTCalibrator");
-	// declare algorithm parameters
-	declareProperty("StreamTool", m_streamer);
 	declareProperty("Max_ntrk",m_max_ntrk);
-	declareProperty("TrackSelectorTool", m_trackSelector, "Tool for the selection of tracks");
 }
 
 //---------------------------------------------------------------------
-- 
GitLab