From 12120fed838af9f3d338acf2f38edb59c5ec1775 Mon Sep 17 00:00:00 2001
From: Susumu Oda <susumu.oda@cern.ch>
Date: Tue, 5 May 2020 11:38:52 +0000
Subject: [PATCH] Disable muon in SCTLorentzMonAlg.py test

---
 .../share/Run3DQTestingDriver.py              |  15 ++-
 .../SCT_Monitoring/python/SCTLorentzMonAlg.py |  14 +--
 .../python/TrackSummaryToolWorkaround.py      |  10 +-
 .../python/TrackSummaryToolWorkaround.py      | 110 ------------------
 4 files changed, 29 insertions(+), 120 deletions(-)
 delete mode 100644 InnerDetector/InDetMonitoring/TRTMonitoringRun3/python/TrackSummaryToolWorkaround.py

diff --git a/Control/AthenaMonitoring/share/Run3DQTestingDriver.py b/Control/AthenaMonitoring/share/Run3DQTestingDriver.py
index 251ff59a5a3..9842008ee26 100755
--- a/Control/AthenaMonitoring/share/Run3DQTestingDriver.py
+++ b/Control/AthenaMonitoring/share/Run3DQTestingDriver.py
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 #
-#  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+#  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 #
 
 '''@file DQTestingDriver.py
@@ -63,6 +63,19 @@ if __name__=='__main__':
         log.info('Executing preExec: %s', args.preExec)
         exec(args.preExec)
 
+    if hasattr(ConfigFlags, "DQ") and hasattr(ConfigFlags.DQ, "Steering") and hasattr(ConfigFlags, "Detector"):
+        if hasattr(ConfigFlags.DQ.Steering, "InDet"):
+            if ((ConfigFlags.DQ.Steering.InDet, "doAlignMon") and ConfigFlags.DQ.Steering.InDet.doAlignMon) or \
+               ((ConfigFlags.DQ.Steering.InDet, "doGlobalMon") and ConfigFlags.DQ.Steering.InDet.doGlobalMon) or \
+               ((ConfigFlags.DQ.Steering.InDet, "doPerfMon") and ConfigFlags.DQ.Steering.InDet.doPerfMon):
+                ConfigFlags.Detector.GeometryID = True
+        if hasattr(ConfigFlags.DQ.Steering, "doPixelMon") and ConfigFlags.DQ.Steering.doPixelMon:
+            ConfigFlags.Detector.GeometryPixel = True
+        if hasattr(ConfigFlags.DQ.Steering, "doSCTMon") and ConfigFlags.DQ.Steering.doSCTMon:
+            ConfigFlags.Detector.GeometrySCT = True
+        if hasattr(ConfigFlags.DQ.Steering, "doTRTMon") and ConfigFlags.DQ.Steering.doTRTMon:
+            ConfigFlags.Detector.GeometryTRT = True
+            
     log.info('FINAL CONFIG FLAGS SETTINGS FOLLOW')
     ConfigFlags.dump()
         
diff --git a/InnerDetector/InDetMonitoring/SCT_Monitoring/python/SCTLorentzMonAlg.py b/InnerDetector/InDetMonitoring/SCT_Monitoring/python/SCTLorentzMonAlg.py
index e8a051b1df7..d9d46d2e8a0 100644
--- a/InnerDetector/InDetMonitoring/SCT_Monitoring/python/SCTLorentzMonAlg.py
+++ b/InnerDetector/InDetMonitoring/SCT_Monitoring/python/SCTLorentzMonAlg.py
@@ -1,5 +1,5 @@
 #
-#  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+#  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 #
 
 '''@file SCTLorentzMonAlg.py
@@ -52,8 +52,10 @@ def SCTLorentzMonAlgConfig(inputFlags):
 
 
     # set up geometry / conditions
-    from AtlasGeoModel.AtlasGeoModelConfig import AtlasGeometryCfg
-    result.merge(AtlasGeometryCfg(inputFlags))
+    from BeamPipeGeoModel.BeamPipeGMConfig import BeamPipeGeometryCfg
+    result.merge(BeamPipeGeometryCfg(inputFlags))
+    from AtlasGeoModel.InDetGMConfig import InDetGeometryCfg
+    result.merge(InDetGeometryCfg(inputFlags))
 
     # # Then, add a tool that doesn't have its own configuration function. In
     # # this example, no accumulator is returned, so no merge is necessary.
@@ -118,10 +120,10 @@ if __name__ == "__main__":
     ConfigFlags.Input.isMC = True
     ConfigFlags.Output.HISTFileName = 'SCTLorentzMonOutput.root'
     ConfigFlags.GeoModel.Align.Dynamic = False
-    ConfigFlags.Detector.GeometryID = True
     ConfigFlags.Detector.GeometryPixel = True
     ConfigFlags.Detector.GeometrySCT = True
     ConfigFlags.Detector.GeometryTRT = True
+    ConfigFlags.Detector.GeometryMuon = False
     ConfigFlags.lock()
 
     # Initialize configuration object, add accumulator, merge, and run.
@@ -130,10 +132,6 @@ if __name__ == "__main__":
     cfg = MainServicesSerialCfg()
     cfg.merge(PoolReadCfg(ConfigFlags))
 
-    from AtlasGeoModel.AtlasGeoModelConfig import AtlasGeometryCfg
-    geoCfg=AtlasGeometryCfg(ConfigFlags)
-    cfg.merge(geoCfg)
-
     sctLorentzMonAcc = SCTLorentzMonAlgConfig(ConfigFlags)
     cfg.merge(sctLorentzMonAcc)
 
diff --git a/InnerDetector/InDetMonitoring/SCT_Monitoring/python/TrackSummaryToolWorkaround.py b/InnerDetector/InDetMonitoring/SCT_Monitoring/python/TrackSummaryToolWorkaround.py
index 26ede2d435b..4719887d4af 100644
--- a/InnerDetector/InDetMonitoring/SCT_Monitoring/python/TrackSummaryToolWorkaround.py
+++ b/InnerDetector/InDetMonitoring/SCT_Monitoring/python/TrackSummaryToolWorkaround.py
@@ -1,5 +1,5 @@
 #
-#  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+#  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 #
 
 '''@file TrackingConfigurationWorkaround.py
@@ -107,4 +107,12 @@ def TrackSummaryToolWorkaround(flags):
                                                   PixelToTPIDTool        = None)
     result.setPrivateTools(InDetTrackSummaryTool)
     ############################## WORKAROUND (END) ############################
+
+    # To run job only with ID
+    if hasattr(flags, "Detector") and hasattr(flags.Detector, "GeometryMuon") and hasattr(flags.Detector, "GeometryID"):
+        TrkEventCnvSuperTool = CompFactory.Trk.EventCnvSuperTool(name = "EventCnvSuperTool",
+                                                                 DoMuons = flags.Detector.GeometryMuon,
+                                                                 DoID = flags.Detector.GeometryID)
+        result.addPublicTool(TrkEventCnvSuperTool)
+
     return result
diff --git a/InnerDetector/InDetMonitoring/TRTMonitoringRun3/python/TrackSummaryToolWorkaround.py b/InnerDetector/InDetMonitoring/TRTMonitoringRun3/python/TrackSummaryToolWorkaround.py
deleted file mode 100644
index 26ede2d435b..00000000000
--- a/InnerDetector/InDetMonitoring/TRTMonitoringRun3/python/TrackSummaryToolWorkaround.py
+++ /dev/null
@@ -1,110 +0,0 @@
-#
-#  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
-#
-
-'''@file TrackingConfigurationWorkaround.py
-@author Peter Onyisi
-@date 2019-12-17
-@brief Centralize the DQ workarounds for setting up ID tracking tools in new-style config, until this is provided centrally
-'''
-
-def TrackSummaryToolWorkaround(flags):
-    from AthenaConfiguration.ComponentFactory import CompFactory
-    from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
-    result = ComponentAccumulator()
-    ############################## WORKAROUND (START) ##########################
-    ############################## TO RUN TRACKSUMMARYTOOL #####################
-
-    # Taken from InnerDetector/InDetDigitization/PixelDigitization/python/PixelDigitizationConfigNew.py
-    from PixelConditionsAlgorithms.PixelConditionsConfig import PixelConfigCondAlgCfg
-    result.merge(PixelConfigCondAlgCfg(flags,
-                                    UseCalibConditions=True,
-                                    UseDeadmapConditions=True,
-                                    UseDCSStateConditions=False,
-                                    UseDCSStatusConditions=False,
-                                    UseDCSHVConditions=True,
-                                    UseDCSTemperatureConditions=True,
-                                    UseTDAQConditions=False))
-
-    from PixelConditionsTools.PixelConditionsSummaryConfig import PixelConditionsSummaryCfg
-    InDetPixelConditionsSummaryTool = result.popToolsAndMerge(PixelConditionsSummaryCfg(flags))
-
-    # Taken from Tracking/TrkConfig/python/AtlasExtrapolatorConfig.py
-    # AtlasExtrapolatorConfig can give only private extrapolator. We need public extrapolator.
-    from TrkConfig.AtlasTrackingGeometrySvcConfig import TrackingGeometrySvcCfg
-    trackGeomCfg = TrackingGeometrySvcCfg(flags)
-    geom_svc = trackGeomCfg.getPrimary() 
-    geom_svc.GeometryBuilder.Compactify = False ######## To avoid crash ########
-    result.merge(trackGeomCfg)
-    from MagFieldServices.MagFieldServicesConfig import MagneticFieldSvcCfg
-    result.merge(MagneticFieldSvcCfg(flags))
-    AtlasNavigator = CompFactory.Trk.Navigator(name = 'AtlasNavigator')
-    AtlasNavigator.TrackingGeometrySvc = geom_svc
-    result.addPublicTool(AtlasNavigator) 
-
-    # Taken from InnerDetector/InDetExample/InDetRecExample/share/InDetRecLoadTools.py
-    InDetPropagator = CompFactory.Trk.RungeKuttaPropagator(name = 'InDetPropagator')
-    InDetPropagator.AccuracyParameter = 0.0001
-    InDetPropagator.MaxStraightLineStep = .004
-    result.addPublicTool(InDetPropagator)
-    InDetMaterialUpdator = CompFactory.Trk.MaterialEffectsUpdator(name = "InDetMaterialEffectsUpdator")
-    result.addPublicTool(InDetMaterialUpdator)
-    InDetSubPropagators = []
-    InDetSubUpdators    = []
-    # -------------------- set it depending on the geometry ----------------------------------------------------
-    # default for ID is (Rk,Mat)
-    InDetSubPropagators += [ InDetPropagator.name ]
-    InDetSubUpdators    += [ InDetMaterialUpdator.name ]
-    # default for Calo is (Rk,MatLandau)
-    InDetSubPropagators += [ InDetPropagator.name ]
-    InDetSubUpdators    += [ InDetMaterialUpdator.name ]
-    # default for MS is (STEP,Mat)
-    #InDetSubPropagators += [ InDetStepPropagator.name ]
-    InDetSubUpdators    += [ InDetMaterialUpdator.name ]
-    #from TrkExTools.TrkExToolsConf import Trk__Extrapolator
-    InDetExtrapolator = CompFactory.Trk.Extrapolator(name                    = 'InDetExtrapolator',
-                                          Propagators             = [ InDetPropagator ],
-                                          MaterialEffectsUpdators = [ InDetMaterialUpdator ],
-                                          Navigator               = AtlasNavigator,
-                                          SubPropagators          = InDetSubPropagators,
-                                          SubMEUpdators           = InDetSubUpdators)
-    result.addPublicTool(InDetExtrapolator)
-    InDetTestPixelLayerTool = CompFactory.InDet.InDetTestPixelLayerTool(name = "InDetTestPixelLayerTool",
-                                                             PixelSummaryTool = InDetPixelConditionsSummaryTool,
-                                                             CheckActiveAreas=True,
-                                                             CheckDeadRegions=True,
-                                                             CheckDisabledFEs=True)
-    result.addPublicTool(InDetTestPixelLayerTool)
-    InDetHoleSearchTool = CompFactory.InDet.InDetTrackHoleSearchTool(name = "InDetHoleSearchTool",
-                                                          Extrapolator = InDetExtrapolator,
-                                                          PixelSummaryTool = InDetPixelConditionsSummaryTool,
-                                                          usePixel      = flags.Detector.GeometryPixel,
-                                                          useSCT        = flags.Detector.GeometrySCT,
-                                                          CountDeadModulesAfterLastHit = True,
-                                                          PixelLayerTool = InDetTestPixelLayerTool)
-    result.addPublicTool(InDetHoleSearchTool)
-    InDetPrdAssociationTool = CompFactory.InDet.InDetPRD_AssociationToolGangedPixels(name                           = "InDetPrdAssociationTool",
-                                                                          PixelClusterAmbiguitiesMapName = "PixelClusterAmbiguitiesMap",
-                                                                          SetupCorrect                   = True,
-                                                                          addTRToutliers                 = True)
-    result.addPublicTool(InDetPrdAssociationTool)
-    InDetTrackSummaryHelperTool = CompFactory.InDet.InDetTrackSummaryHelperTool(name            = "InDetSummaryHelper",
-                                                                     AssoTool        = InDetPrdAssociationTool,
-                                                                     PixelToTPIDTool = None,
-                                                                     TestBLayerTool  = None,
-                                                                     RunningTIDE_Ambi = True,
-                                                                     DoSharedHits    = False,
-                                                                     HoleSearch      = InDetHoleSearchTool,
-                                                                     usePixel        = flags.Detector.GeometryPixel,
-                                                                     useSCT          = flags.Detector.GeometrySCT,
-                                                                     useTRT          = flags.Detector.GeometryTRT)
-    InDetTrackSummaryTool = CompFactory.Trk.TrackSummaryTool(name = "InDetTrackSummaryTool",
-                                                  InDetSummaryHelperTool = InDetTrackSummaryHelperTool,
-                                                  doSharedHits           = False,
-                                                  doHolesInDet           = True,
-                                                  TRT_ElectronPidTool    = None,
-                                                  TRT_ToT_dEdxTool       = None,
-                                                  PixelToTPIDTool        = None)
-    result.setPrivateTools(InDetTrackSummaryTool)
-    ############################## WORKAROUND (END) ############################
-    return result
-- 
GitLab