From 5cc878761bc22f831e38dd505664df070cbab146 Mon Sep 17 00:00:00 2001
From: Shaun Roe <shaun.roe@cern.ch>
Date: Tue, 10 Dec 2024 12:19:52 +0100
Subject: [PATCH 1/2] address cppcheck defects

---
 .../src/IDAlignMonGenericTracksAlg.cxx        |  4 ++--
 .../src/IDAlignMonResidualsAlg.cxx            | 23 ++++++++-----------
 2 files changed, 12 insertions(+), 15 deletions(-)

diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoringRun3/src/IDAlignMonGenericTracksAlg.cxx b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoringRun3/src/IDAlignMonGenericTracksAlg.cxx
index 6ce2303940d0..2e152eb147ac 100644
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoringRun3/src/IDAlignMonGenericTracksAlg.cxx
+++ b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoringRun3/src/IDAlignMonGenericTracksAlg.cxx
@@ -48,9 +48,9 @@ IDAlignMonGenericTracksAlg::IDAlignMonGenericTracksAlg( const std::string & name
    m_etaRange(3.0),
    m_NTracksRange(200),
    m_barrelEta(0.8), //Tracks between -0.8 & 0.8 are considered as Barrel Tracks, otherwise are End-Caps
-   m_trackSelection( "InDet::InDetTrackSelectionTool/TrackSelectionTool", this)
+   m_trackSelection( "InDet::InDetTrackSelectionTool/TrackSelectionTool", this),
+   m_hitQualityTool("")
 {
-  m_hitQualityTool = ToolHandle<IInDetAlignHitQualSelTool>("");
   declareProperty("Pixel_Manager"        , m_Pixel_Manager);
   declareProperty("SCT_Manager"          , m_SCT_Manager);
   declareProperty("TRT_Manager"          , m_TRT_Manager);
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoringRun3/src/IDAlignMonResidualsAlg.cxx b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoringRun3/src/IDAlignMonResidualsAlg.cxx
index 5619d2f604b1..f1103c912b7b 100644
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoringRun3/src/IDAlignMonResidualsAlg.cxx
+++ b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoringRun3/src/IDAlignMonResidualsAlg.cxx
@@ -47,15 +47,11 @@
 IDAlignMonResidualsAlg::IDAlignMonResidualsAlg( const std::string & name, ISvcLocator* pSvcLocator ) :
   AthMonitorAlgorithm(name, pSvcLocator),
   m_trtcaldbTool("TRT_CalDbTool", this),
+  m_iUpdator ("Trk::KalmanUpdator"),
+  m_propagator ("Trk::RungeKuttaPropagator"),
+  m_residualPullCalculator( "Trk::ResidualPullCalculator/ResidualPullCalculator"),
   m_trackSelection( "InDet::InDetTrackSelectionTool/TrackSelectionTool", this),
-  m_extendedPlots(false)
-{
-  m_iUpdator = ToolHandle<Trk::IUpdator>("Trk::KalmanUpdator");
-  m_propagator = ToolHandle<Trk::IPropagator>("Trk::RungeKuttaPropagator");
-  m_residualPullCalculator = ToolHandle<Trk::IResidualPullCalculator>(
-								      "Trk::ResidualPullCalculator/ResidualPullCalculator");
-  m_hitQualityTool = ToolHandle<IInDetAlignHitQualSelTool>("");
-  
+  m_hitQualityTool(""){ 
   declareProperty("CheckRate"                 , m_checkrate=1000);
   declareProperty("ITRT_CalDbTool"            , m_trtcaldbTool);
   declareProperty("iUpdator"                  , m_iUpdator);
@@ -292,6 +288,11 @@ StatusCode IDAlignMonResidualsAlg::fillHistograms( const EventContext& ctx ) con
         ATH_MSG_DEBUG("** IDAlignMonResidualsAlg::fillHistograms() ** Hit is from the TRT, finding residuals... ");
         bool isTubeHit = (mesh->localCovariance()(Trk::locX, Trk::locX) > 1.0);
         const Trk::TrackParameters* trackParameter = tsos->trackParameters();
+        //finding residuals
+        if (!trackParameter) {
+          ATH_MSG_WARNING("No TrackParameters associated with TRT TrkSurface " << nTSOS);
+          continue;
+        }
         float hitR = hit->localParameters()[Trk::driftRadius];
         float trketa = tsos->trackParameters()->eta();
         float pullR = -9.9;
@@ -301,11 +302,7 @@ StatusCode IDAlignMonResidualsAlg::fillHistograms( const EventContext& ctx ) con
         int layer_or_wheel = m_trtID->layer_or_wheel(id);
         int phi_module = m_trtID->phi_module(id);
 	
-        //finding residuals
-        if (!trackParameter) {
-          ATH_MSG_WARNING("No TrackParameters associated with TRT TrkSurface " << nTSOS);
-          continue;
-        }
+        
         ATH_MSG_DEBUG("Found Trk::TrackParameters for hit " << nTSOS << " --> TRT hit (detType= " << detType << ")" );
 	
         //getting unbiased track parameters by removing the hit from the track and refitting
-- 
GitLab


From 0430235770ed201893aed9b1e29b4d60df3b2379 Mon Sep 17 00:00:00 2001
From: Shaun Roe <shaun.roe@cern.ch>
Date: Tue, 10 Dec 2024 12:22:50 +0100
Subject: [PATCH 2/2] idk

---
 .../InDetAlignmentMonitoringRun3/src/IDAlignMonResidualsAlg.h   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoringRun3/src/IDAlignMonResidualsAlg.h b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoringRun3/src/IDAlignMonResidualsAlg.h
index 58611169beb4..2bf888f0c904 100644
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoringRun3/src/IDAlignMonResidualsAlg.h
+++ b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoringRun3/src/IDAlignMonResidualsAlg.h
@@ -84,7 +84,7 @@ class IDAlignMonResidualsAlg :  public AthMonitorAlgorithm {
 
   std::string m_Pixel_Manager;
   std::string m_SCT_Manager;
-  bool m_extendedPlots;
+  bool m_extendedPlots{};
   bool m_doHitQuality{false};
   int  m_checkrate {};
   bool m_doPulls {};
-- 
GitLab