From 90cc0840c98f30abe865e13be80eef82c50619bb Mon Sep 17 00:00:00 2001
From: Sergi Rodriguez <Sergi.Rodriguez@cern.ch>
Date: Mon, 19 Feb 2024 15:45:00 +0100
Subject: [PATCH] solving problem with extrapolator and getting a working chain

---
 .../TRT_CalibAlgs/TRT_CalibAlgs/TRTCalibrationMgr.h  | 12 +++++++-----
 .../TRT_CalibAlgs/python/TRTCalibrationMgrConfig.py  | 10 +++++-----
 .../TRT_CalibAlgs/src/TRTCalibrationMgr.cxx          |  8 +-------
 3 files changed, 13 insertions(+), 17 deletions(-)

diff --git a/InnerDetector/InDetCalibAlgs/TRT_CalibAlgs/TRT_CalibAlgs/TRTCalibrationMgr.h b/InnerDetector/InDetCalibAlgs/TRT_CalibAlgs/TRT_CalibAlgs/TRTCalibrationMgr.h
index 25bb9dcfddcd..6e24e5d654c6 100755
--- a/InnerDetector/InDetCalibAlgs/TRT_CalibAlgs/TRT_CalibAlgs/TRTCalibrationMgr.h
+++ b/InnerDetector/InDetCalibAlgs/TRT_CalibAlgs/TRT_CalibAlgs/TRTCalibrationMgr.h
@@ -78,19 +78,21 @@ private:
     ToolHandleArray<IFitTool> m_FitTools {this, "FitTools", {}, ""};
     ToolHandle<Trk::ITrackFitter> m_trackFitter {this, "TrackFitter", "ActsTrk::KalmanFitter/TrkKalmanFitter", ""};
     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
+    ToolHandle<IAthenaOutputStreamTool> m_streamer {this, "StreamTool", "AthenaOutputStreamTool/CondStream1", "OutputStreamTool"};
 
     // Gaudi properties
     Gaudi::Property<bool> m_dorefit       {this, "DoRefit"       , true , "Does a Re-Fit"};
     Gaudi::Property<bool> m_docalibrate   {this, "DoCalibrate"   , false, "Does the calibration"};
     Gaudi::Property<bool> m_writeConstants{this, "WriteConstants", false, "Write out the calibration constants"};
 
+    Gaudi::Property<unsigned int> m_max_ntrk {this, "Max_ntrk", 100000, ""};
+
+    Gaudi::Property<std::string> m_par_rtcontainerkey {this, "Par_rtcontainer", "/TRT/Calib/RT", ""};
+    Gaudi::Property<std::string> m_par_t0containerkey {this, "par_t0container", "/TRT/Calib/T0", ""};
+
+
     int m_ntrk = 0;
     
-    unsigned int m_max_ntrk;
-    std::string m_par_rtcontainerkey; //"/TRT/Calib/RT"
-    std::string m_par_t0containerkey; //"/TRT/Calib/T0"
-
     // ReadHandleKeys
     SG::ReadHandleKey<xAOD::VertexContainer> m_verticesKey   {this, "VerticesKey"     , "PrimaryVertices"    , "RHK for primary vertices"  };
     SG::ReadHandleKey<xAOD::EventInfo>       m_EventInfoKey  {this, "EventInfoKey"    , "EventInfo"          , "RHK for xAOD::EventInfo"   };
diff --git a/InnerDetector/InDetCalibAlgs/TRT_CalibAlgs/python/TRTCalibrationMgrConfig.py b/InnerDetector/InDetCalibAlgs/TRT_CalibAlgs/python/TRTCalibrationMgrConfig.py
index fedb5ca91ead..314e0f256bf1 100644
--- a/InnerDetector/InDetCalibAlgs/TRT_CalibAlgs/python/TRTCalibrationMgrConfig.py
+++ b/InnerDetector/InDetCalibAlgs/TRT_CalibAlgs/python/TRTCalibrationMgrConfig.py
@@ -106,7 +106,6 @@ def TRT_CalibrationMgrCfg(flags,name='TRT_CalibrationMgr',calibconstants='',**kw
     
     kwargs.setdefault("DoCalibrate",False)
 
-
     # FIXME - FillAlignTRTHitsCfg and FillAlignTrkInfoCfg functions should be moved to TRT_CalibTools (where the .cxx/.h are stored)
     kwargs.setdefault("AlignTrkTools", [acc.addPublicTool(acc.popToolsAndMerge(FillAlignTrkInfoCfg(flags))), 
                                         acc.addPublicTool(acc.popToolsAndMerge(FillAlignTRTHitsCfg(flags)))] )      
@@ -115,10 +114,11 @@ def TRT_CalibrationMgrCfg(flags,name='TRT_CalibrationMgr',calibconstants='',**kw
     kwargs.setdefault("FitTools", [acc.popToolsAndMerge(FitToolCfg(flags))])
     
     # check this line below - needs the function
-    # kwargs.setdefault("TrackFitter", acc.setPrivateTools(CompFactory.ActsTrk.KalmanFitter("KalmanFitter")))
     from ActsConfig.ActsTrackFittingConfig import ActsFitterCfg
     kwargs.setdefault("TrackFitter", acc.popToolsAndMerge(ActsFitterCfg(flags)))
     
+    kwargs.setdefault("TrackSelectorTool", acc.popToolsAndMerge(InDetDetailedTrackSelectorToolCfg(flags)))
+    
     # FIXME! Let all straws participate in trackfinding as default - SERGI This is wrong and needs to be UPDATED @peter    
         # acc.merge(addOverride('/TRT/Cond/Status','TRTCondStatus-empty-00-00'))
         # TypeError: addOverride() missing 1 required positional argument: 'tag'  
@@ -126,10 +126,10 @@ def TRT_CalibrationMgrCfg(flags,name='TRT_CalibrationMgr',calibconstants='',**kw
     # acc.merge(addOverride('/TRT/Cond/Status','TRTCondStatus-empty-00-00'))
                           
     # if a text file is in the arguments, use the constants in that instead of the DB
-    if not calibconstants=="":
+    # if not calibconstants=="":
 
-        from TRT_ConditionsAlgs.TRT_ConditionsAlgsConfig import TRTCondWriteCfg
-        acc.merge(TRTCondWriteCfg(flags,calibconstants))
+    #     from TRT_ConditionsAlgs.TRT_ConditionsAlgsConfig import TRTCondWriteCfg
+    #     acc.merge(TRTCondWriteCfg(flags,calibconstants))
 
     # add this algorithm to the configuration accumulator                       
     acc.addEventAlgo(CompFactory.TRTCalibrationMgr(name, **kwargs))
diff --git a/InnerDetector/InDetCalibAlgs/TRT_CalibAlgs/src/TRTCalibrationMgr.cxx b/InnerDetector/InDetCalibAlgs/TRT_CalibAlgs/src/TRTCalibrationMgr.cxx
index 37aa1196b401..0a4386094da7 100644
--- a/InnerDetector/InDetCalibAlgs/TRT_CalibAlgs/src/TRTCalibrationMgr.cxx
+++ b/InnerDetector/InDetCalibAlgs/TRT_CalibAlgs/src/TRTCalibrationMgr.cxx
@@ -26,13 +26,7 @@
 #include "StoreGate/ReadHandle.h"
 
 TRTCalibrationMgr::TRTCalibrationMgr(const std::string& name, ISvcLocator* pSvcLocator) :
-	AthAlgorithm   (name, pSvcLocator),
-	m_max_ntrk(100000),
-    m_par_rtcontainerkey("/TRT/Calib/RT"),
-    m_par_t0containerkey("/TRT/Calib/T0")
-{
-	declareProperty("Max_ntrk",m_max_ntrk);
-}
+	AthAlgorithm   (name, pSvcLocator){}
 
 //---------------------------------------------------------------------
 
-- 
GitLab