From 8c1427fad926c79d93c86b6d6e35f2c729d7a6ec Mon Sep 17 00:00:00 2001
From: Peter Onyisi <ponyisi@utexas.edu>
Date: Mon, 25 May 2020 13:52:13 +0000
Subject: [PATCH] Fix DQ crashes in MT standard tests

---
 .../share/DataQualitySteering_jobOptions.py         | 13 +++++++------
 .../src/components/AthenaMonitoring_entries.cxx     |  2 +-
 .../LArMonitoring/share/LArMonitoring_jobOption.py  | 11 ++++++-----
 .../MdtRawDataMonitoring/src/MdtRawDataValAlg.cxx   |  2 +-
 .../JetTagMonitoring/JetTagMonitoring.h             | 10 ++++------
 .../JetTagMonitoring/src/JetTagMonitoring.cxx       |  5 -----
 .../JetTagTools/JetTagTools/TrackSelector.h         |  4 +++-
 .../JetTagging/JetTagTools/src/TrackSelector.cxx    |  6 ++----
 .../RecoTools/TrackToVertex/src/TrackToVertex.cxx   |  4 +---
 .../src/RungeKuttaPropagator.cxx                    |  4 ++--
 .../TrkExTools/TrkExTools/Extrapolator.h            | 13 +++++++------
 .../TrkExTools/src/Extrapolator.cxx                 | 13 -------------
 12 files changed, 34 insertions(+), 53 deletions(-)

diff --git a/Control/AthenaMonitoring/share/DataQualitySteering_jobOptions.py b/Control/AthenaMonitoring/share/DataQualitySteering_jobOptions.py
index 6780f16fbc3..783cbad9b3d 100644
--- a/Control/AthenaMonitoring/share/DataQualitySteering_jobOptions.py
+++ b/Control/AthenaMonitoring/share/DataQualitySteering_jobOptions.py
@@ -124,12 +124,6 @@ if DQMonFlags.doMonitoring():
    # LAr monitoring   #
    #------------------#
    if DQMonFlags.doLArMon():
-      # FIXME: don't use global flags here
-      if 'doLArCollisionTimeMon' not in dir():
-         doLArCollisionTimeMon=True
-      if doLArCollisionTimeMon:
-         include ("LArCellRec/LArCollisionTime_jobOptions.py")
-         include("LArClusterRec/LArClusterCollisionTime_jobOptions.py")
       try:
          LArMon = AthenaMonManager(name="LArMonManager",
                           FileKey             = DQMonFlags.monManFileKey(),
@@ -250,6 +244,13 @@ if DQMonFlags.doMonitoring():
    #--------------------------#
    # Post-setup configuration #
    #--------------------------#
+   # force conditions update because the converter can't do it
+   if DQMonFlags.monManEnvironment in ('tier0ESD', 'AOD'):
+      from AthenaCommon.AlgSequence import AthSequencer
+      from AthenaMonitoring.AthenaMonitoringConf import ForceIDConditionsAlg
+      asq = AthSequencer("AthBeginSeq") 
+      asq += [ForceIDConditionsAlg()]
+
    if rec.triggerStream()=='express':
       include("AthenaMonitoring/AtlasReadyFilterTool_jobOptions.py")
    local_logger.debug('DQ Post-Setup Configuration')
diff --git a/Control/AthenaMonitoring/src/components/AthenaMonitoring_entries.cxx b/Control/AthenaMonitoring/src/components/AthenaMonitoring_entries.cxx
index 498a378bc55..a8158c190fa 100644
--- a/Control/AthenaMonitoring/src/components/AthenaMonitoring_entries.cxx
+++ b/Control/AthenaMonitoring/src/components/AthenaMonitoring_entries.cxx
@@ -29,4 +29,4 @@ DECLARE_COMPONENT( DQBadLBFilterAlg )
 DECLARE_COMPONENT( TriggerTranslatorToolSimple )
 DECLARE_COMPONENT( ExampleMonitorAlgorithm )
 DECLARE_COMPONENT( ForceIDConditionsAlg )
-DECLARE_COMPONENT( ForceMSConditionsAlg )
+DECLARE_COMPONENT( ForceMSConditionsAlg )
\ No newline at end of file
diff --git a/LArCalorimeter/LArMonitoring/share/LArMonitoring_jobOption.py b/LArCalorimeter/LArMonitoring/share/LArMonitoring_jobOption.py
index c0e3c203ad2..6eeca6d65fc 100644
--- a/LArCalorimeter/LArMonitoring/share/LArMonitoring_jobOption.py
+++ b/LArCalorimeter/LArMonitoring/share/LArMonitoring_jobOption.py
@@ -11,11 +11,12 @@ from LumiBlockComps.BunchCrossingCondAlgDefault import BunchCrossingCondAlgDefau
 BunchCrossingCondAlgDefault()
 
 if DQMonFlags.monManEnvironment() == 'tier0ESD':
-   from LArMonitoring.LArCollisionTimeMonAlg import LArCollisionTimeMonConfigOld
-   topSequence +=LArCollisionTimeMonConfigOld(DQMonFlags)
-   if globalflags.DataSource()=='data':
-      from LArMonitoring.LArAffectedRegionsAlg import LArAffectedRegionsConfigOld
-      topSequence +=LArAffectedRegionsConfigOld(DQMonFlags)
+    include ("LArCellRec/LArCollisionTime_jobOptions.py")
+    from LArMonitoring.LArCollisionTimeMonAlg import LArCollisionTimeMonConfigOld
+    topSequence +=LArCollisionTimeMonConfigOld(DQMonFlags)
+    if globalflags.DataSource()=='data':
+        from LArMonitoring.LArAffectedRegionsAlg import LArAffectedRegionsConfigOld
+        topSequence +=LArAffectedRegionsConfigOld(DQMonFlags)
 
 if DQMonFlags.monManEnvironment() == 'tier0Raw':
     from LArMonitoring.LArNoisyROMonAlg import LArNoisyROMonConfigOld
diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtRawDataMonitoring/src/MdtRawDataValAlg.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtRawDataMonitoring/src/MdtRawDataValAlg.cxx
index 0bc7b9b7c7e..66be19e7ae9 100755
--- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtRawDataMonitoring/src/MdtRawDataValAlg.cxx
+++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtRawDataMonitoring/src/MdtRawDataValAlg.cxx
@@ -66,7 +66,7 @@ MdtRawDataValAlg::MdtRawDataValAlg( const std::string & type, const std::string
 :ManagedMonitorToolBase( type, name, parent ),
  m_mg(0),
  m_masked_tubes(NULL),
- m_muonSelectionTool("CP::MuonSelectionTool/MuonSelectionTool"),
+ m_muonSelectionTool(this, "MuonSelectionTool", "CP::MuonSelectionTool/MuonSelectionTool"),
  m_DQFilterTools(this),
  m_atlas_ready(0),
  m_trig_BARREL(false),
diff --git a/PhysicsAnalysis/JetTagging/JetTagMonitoring/JetTagMonitoring/JetTagMonitoring.h b/PhysicsAnalysis/JetTagging/JetTagMonitoring/JetTagMonitoring/JetTagMonitoring.h
index bab6fc68a18..a5eb179b030 100755
--- a/PhysicsAnalysis/JetTagging/JetTagMonitoring/JetTagMonitoring/JetTagMonitoring.h
+++ b/PhysicsAnalysis/JetTagging/JetTagMonitoring/JetTagMonitoring/JetTagMonitoring.h
@@ -24,6 +24,7 @@
 #include "GaudiKernel/ToolHandle.h"
 #include "ITrackToVertex/ITrackToVertex.h"
 #include "AthenaMonitoring/ManagedMonitorToolBase.h"
+#include "JetTagTools/TrackSelector.h"
 
 #include "xAODJet/Jet.h"
 #include "TrigDecisionTool/TrigDecisionTool.h" // added by SARA
@@ -37,9 +38,6 @@ class LWHist;
 namespace Trk {
   class VxCandidate;
 }
-namespace Analysis {
-  class TrackSelector;
-}
 
 /**
  * @brief Class for monitoring variables related to offline flavour tagging.
@@ -98,9 +96,9 @@ private:
     ServiceHandle<StoreGateSvc> m_storeGate;
 
 
-    ToolHandle< Analysis::TrackSelector > m_trackSelectorTool;
-    ToolHandle<Reco::ITrackToVertex> m_trackToVertexTool;
-    ToolHandle< Trig::TrigDecisionTool > m_trigDecTool; // added by SARA
+    ToolHandle< Analysis::TrackSelector > m_trackSelectorTool{this, "TrackSelectorTool", "Analysis::TrackSelector"};
+    ToolHandle<Reco::ITrackToVertex> m_trackToVertexTool{this, "TrackToVertexTool", "Reco::TrackToVertex"};
+    PublicToolHandle< Trig::TrigDecisionTool > m_trigDecTool{this, "TrigDecisionTool", "Trig::TrigDecisionTool/TrigDecisionTool"}; // added by SARA
     /* ToolHandle<InDet::IInDetTestBLayerTool> m_blayerTool; */
     bool m_histogramsCreated;
 
diff --git a/PhysicsAnalysis/JetTagging/JetTagMonitoring/src/JetTagMonitoring.cxx b/PhysicsAnalysis/JetTagging/JetTagMonitoring/src/JetTagMonitoring.cxx
index ac6164979cb..582c3dc1373 100755
--- a/PhysicsAnalysis/JetTagging/JetTagMonitoring/src/JetTagMonitoring.cxx
+++ b/PhysicsAnalysis/JetTagging/JetTagMonitoring/src/JetTagMonitoring.cxx
@@ -2,7 +2,6 @@
   Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
-//#include "ITrackToVertex/ITrackToVertex.h"
 #include "xAODJet/JetContainer.h"   
 #include "xAODJet/JetAttributes.h"
 #include "xAODBTagging/BTagging.h"
@@ -11,7 +10,6 @@
 #include "xAODMuon/MuonContainer.h"
 
 #include "JetTagMonitoring/JetTagMonitoring.h"
-#include "JetTagTools/TrackSelector.h"
 
 #include "xAODTracking/TrackParticle.h"
 #include "xAODTracking/TrackParticleContainer.h"    
@@ -68,9 +66,6 @@ namespace {
 JetTagMonitoring::JetTagMonitoring(const std::string & type, const std::string & name, const IInterface* parent) :
   ManagedMonitorToolBase(type, name, parent),
   m_storeGate( "StoreGateSvc", name ),
-  m_trackSelectorTool("Analysis::TrackSelector"),
-  m_trackToVertexTool("Reco::TrackToVertex"),
-  m_trigDecTool("Trig::TrigDecisionTool/TrigDecisionTool"), // added by SARA
   m_histogramsCreated(false),
   m_switch_off(false)
 {
diff --git a/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/TrackSelector.h b/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/TrackSelector.h
index 378d2492b1d..0c7201d9e75 100644
--- a/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/TrackSelector.h
+++ b/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/TrackSelector.h
@@ -10,6 +10,8 @@
 #include "GeoPrimitives/GeoPrimitives.h"
 #include "xAODTracking/TrackParticle.h"
 #include "xAODTracking/TrackParticleContainer.h"
+#include "ITrackToVertex/ITrackToVertex.h"
+
 #include <string>
 #include <bitset>
 
@@ -109,7 +111,7 @@ private:
   int m_ntrf;
   mutable std::atomic<int> m_ntrc[numCuts];
 
-  ToolHandle< Reco::ITrackToVertex > m_trackToVertexTool;
+  ToolHandle< Reco::ITrackToVertex > m_trackToVertexTool{this, "trackToVertexTool", "Reco::TrackToVertex"};
 
   std::bitset<numCuts> m_passedCuts;
 
diff --git a/PhysicsAnalysis/JetTagging/JetTagTools/src/TrackSelector.cxx b/PhysicsAnalysis/JetTagging/JetTagTools/src/TrackSelector.cxx
index 6d9200f5b6b..cee6040779a 100644
--- a/PhysicsAnalysis/JetTagging/JetTagTools/src/TrackSelector.cxx
+++ b/PhysicsAnalysis/JetTagging/JetTagTools/src/TrackSelector.cxx
@@ -12,7 +12,6 @@
 #include "CLHEP/GenericFunctions/CumulativeChiSquare.hh" 
 #include "GeoPrimitives/GeoPrimitives.h"
 #include "GaudiKernel/IToolSvc.h"
-#include "ITrackToVertex/ITrackToVertex.h"
 #include <TMath.h>
 #include <string>
 #include <bitset>
@@ -26,11 +25,10 @@ namespace Analysis {
 			       const std::string& name, const IInterface* parent) :
     AthAlgTool(type, name, parent),
     m_ntri(0),
-    m_ntrf(0),
-    m_trackToVertexTool("Reco::TrackToVertex", this) {
+    m_ntrf(0)
+  {
 
     declareInterface<TrackSelector>(this);
-    declareProperty("trackToVertexTool", m_trackToVertexTool);
     declareProperty("useBLayerHitPrediction", m_useBLayerHitPrediction = false);
     declareProperty("usePerigeeParameters", m_usePerigeeParameters = false);
     declareProperty("pTMin", m_pTMin = 1.*Gaudi::Units::GeV);
diff --git a/Reconstruction/RecoTools/TrackToVertex/src/TrackToVertex.cxx b/Reconstruction/RecoTools/TrackToVertex/src/TrackToVertex.cxx
index 14b557d20e2..ab072e6d8d5 100755
--- a/Reconstruction/RecoTools/TrackToVertex/src/TrackToVertex.cxx
+++ b/Reconstruction/RecoTools/TrackToVertex/src/TrackToVertex.cxx
@@ -27,11 +27,9 @@ const Amg::Vector3D Reco::TrackToVertex::s_origin(0.,0.,0.);
 // constructor
 Reco::TrackToVertex::TrackToVertex(const std::string& t, const std::string& n, const IInterface* p) :
   AthAlgTool(t,n,p),
-  m_extrapolator("Trk::Extrapolator/AtlasExtrapolator", this)
+  m_extrapolator{this, "Extrapolator", "Trk::Extrapolator/AtlasExtrapolator"}
 {
    declareInterface<ITrackToVertex>(this);
-   // the extrapolatr and the BeamCondSvc 
-   declareProperty("Extrapolator", m_extrapolator);
    declareProperty("ForceBeamSpotZero", m_ForceBeamSpotZero);
 }
 
diff --git a/Tracking/TrkExtrapolation/TrkExRungeKuttaPropagator/src/RungeKuttaPropagator.cxx b/Tracking/TrkExtrapolation/TrkExRungeKuttaPropagator/src/RungeKuttaPropagator.cxx
index 7f1c6d06c6e..d3de51ca871 100755
--- a/Tracking/TrkExtrapolation/TrkExRungeKuttaPropagator/src/RungeKuttaPropagator.cxx
+++ b/Tracking/TrkExtrapolation/TrkExRungeKuttaPropagator/src/RungeKuttaPropagator.cxx
@@ -52,7 +52,7 @@ StatusCode Trk::RungeKuttaPropagator::initialize()
       
   // Read handle for AtlasFieldCacheCondObj
   ATH_CHECK( m_fieldCondObjInputKey.initialize() );
-  ATH_MSG_INFO("initialize() init key: " << m_fieldCondObjInputKey.key());
+  ATH_MSG_DEBUG("initialize() init key: " << m_fieldCondObjInputKey.key());
 
   return StatusCode::SUCCESS;
 }
@@ -63,7 +63,7 @@ StatusCode Trk::RungeKuttaPropagator::initialize()
 
 StatusCode  Trk::RungeKuttaPropagator::finalize()
 {
-  ATH_MSG_INFO(name() <<" finalize() successful");
+  ATH_MSG_VERBOSE(name() <<" finalize() successful");
   return StatusCode::SUCCESS;
 }
 
diff --git a/Tracking/TrkExtrapolation/TrkExTools/TrkExTools/Extrapolator.h b/Tracking/TrkExtrapolation/TrkExTools/TrkExTools/Extrapolator.h
index 5a88d4c5e51..888d614d1fe 100755
--- a/Tracking/TrkExtrapolation/TrkExTools/TrkExTools/Extrapolator.h
+++ b/Tracking/TrkExtrapolation/TrkExTools/TrkExTools/Extrapolator.h
@@ -14,6 +14,7 @@
 #include "GaudiKernel/ToolHandle.h"
 
 // Trk
+#include "TrkExInterfaces/IPropagator.h"
 #include "TrkExInterfaces/IExtrapolator.h"
 #include "TrkExInterfaces/INavigator.h"
 #include "TrkExInterfaces/IMaterialEffectsUpdator.h"
@@ -759,12 +760,12 @@ VERBOSE : Method call sequence with values
     // unsigned int geoIDToDetOrder(Trk::GeometrySignature geoid) const;
 
     // --------------- Used Tools ----------------------------- //
-    ToolHandleArray<IPropagator> m_propagators;          //!<  Array of Propagators
-    ToolHandle<IPropagator> m_stepPropagator;            //!<  Array of Propagators
-    ToolHandle<INavigator> m_navigator;                  //!<  Navigator for TrackingGeometry and magnetic fiels acces
-    ToolHandleArray<IMaterialEffectsUpdator> m_updaters; //!<  Array of Material updaters
-    ToolHandleArray<IMultipleScatteringUpdator> m_msupdaters; //!<  Array of MultipleScattering updaters
-    ToolHandleArray<IEnergyLossUpdator> m_elossupdaters;      //!<  Array of EnergyLoss updaters
+    ToolHandleArray< IPropagator >              m_propagators{this, "Propagators", {}};                   //!<  Array of Propagators
+    ToolHandle< IPropagator >                   m_stepPropagator{this, "STEP_Propagator", "Trk::STEP_Propagator/AtlasSTEP_Propagator"};                //!<  Array of Propagators
+    ToolHandle< INavigator >                    m_navigator{this, "Navigator", "Trk::Navigator/AtlasNavigator"};                     //!<  Navigator for TrackingGeometry and magnetic fiels acces
+    ToolHandleArray< IMaterialEffectsUpdator >  m_updaters{this, "MaterialEffectsUpdators", {}};                      //!<  Array of Material updaters
+    ToolHandleArray< IMultipleScatteringUpdator >  m_msupdaters{this, "MultipleScatteringUpdators", {}};                 //!<  Array of MultipleScattering updaters
+    ToolHandleArray< IEnergyLossUpdator >       m_elossupdaters{this, "EnergyLossUpdators", {}};                 //!<  Array of EnergyLoss updaters
 
     // ---------------- For Extrapolation handling ------------ //
 
diff --git a/Tracking/TrkExtrapolation/TrkExTools/src/Extrapolator.cxx b/Tracking/TrkExtrapolation/TrkExTools/src/Extrapolator.cxx
index 54fab0f6354..1f43040b6d3 100755
--- a/Tracking/TrkExtrapolation/TrkExTools/src/Extrapolator.cxx
+++ b/Tracking/TrkExtrapolation/TrkExTools/src/Extrapolator.cxx
@@ -43,7 +43,6 @@ inline Trk::TrackParameters *cloneObj<Trk::TrackParameters>(const Trk::TrackPara
 }
 
 #include "TrkExTools/Extrapolator.h"
-#include "TrkExInterfaces/IPropagator.h"
 #include "TrkExInterfaces/IMultipleScatteringUpdator.h"
 #include "TrkExInterfaces/IEnergyLossUpdator.h"
 #include "TrkExUtils/IntersectionSolution.h"
@@ -93,12 +92,6 @@ bool      Trk::Extrapolator::Cache::s_reported        {};
 // constructor
 Trk::Extrapolator::Extrapolator(const std::string &t, const std::string &n, const IInterface *p) :
   AthAlgTool(t, n, p),
-  m_propagators(),
-  m_stepPropagator("Trk::STEP_Propagator/AtlasSTEP_Propagator"),
-  m_navigator("Trk::Navigator/AtlasNavigator"),
-  m_updaters(),
-  m_msupdaters(),
-  m_elossupdaters(),
   m_subPropagators(Trk::NumberOfSignatures),
   m_subupdaters(Trk::NumberOfSignatures),
   m_propNames(),
@@ -166,20 +159,14 @@ Trk::Extrapolator::Extrapolator(const std::string &t, const std::string &n, cons
   declareProperty("SkipInitialPostUpdate", m_skipInitialLayerUpdate);
   declareProperty("MaximalMethodSequence", m_maxMethodSequence);
   // propagation steering
-  declareProperty("Propagators", m_propagators);
   declareProperty("SubPropagators", m_propNames);
-  declareProperty("STEP_Propagator", m_stepPropagator);
   // material effects handling
   declareProperty("ApplyMaterialEffects", m_includeMaterialEffects);
   declareProperty("RequireMaterialDestinationHit", m_requireMaterialDestinationHit);
-  declareProperty("MaterialEffectsUpdators", m_updaters);
-  declareProperty("MultipleScatteringUpdators", m_msupdaters);
-  declareProperty("EnergyLossUpdators", m_elossupdaters);
   declareProperty("SubMEUpdators", m_updatNames);
   declareProperty("CacheLastMaterialLayer", m_cacheLastMatLayer);
   // general behavior navigation
   declareProperty("SearchLevelClosestParameters", m_searchLevel);
-  declareProperty("Navigator", m_navigator);
   // muon system specifics
   declareProperty("UseMuonMatApproximation", m_useMuonMatApprox);
   declareProperty("UseDenseVolumeDescription", m_useDenseVolumeDescription);
-- 
GitLab