From 678f06850c3393432a238ef27c90b5e392c9e7fd Mon Sep 17 00:00:00 2001
From: Frank Winklmeier <frank.winklmeier@cern.ch>
Date: Thu, 23 Sep 2021 10:53:11 +0200
Subject: [PATCH] TrigT1CTMonitoring: remove online monitoring config and
 cleanup

The `isOnline` specific CTP monitoring configuration is definitely
broken and likely not used. Just remove all code and print an error
message. Also delete some other obsolete files.
---
 .../RecExCond/share/RecExCommon_flags.py      |   4 -
 .../TrigT1/TrigT1CTMonitoring/CMakeLists.txt  |   1 -
 .../python/TrigT1CTMonitoringConfig.py        |  35 -----
 .../TrigT1CTMonitoring/share/CTPFlags.py      |   6 -
 ...MonitoringJobOptions_forRecExCommission.py | 131 +-----------------
 5 files changed, 6 insertions(+), 171 deletions(-)
 delete mode 100644 Trigger/TrigT1/TrigT1CTMonitoring/python/TrigT1CTMonitoringConfig.py
 delete mode 100644 Trigger/TrigT1/TrigT1CTMonitoring/share/CTPFlags.py

diff --git a/Reconstruction/RecExample/RecExCond/share/RecExCommon_flags.py b/Reconstruction/RecExample/RecExCond/share/RecExCommon_flags.py
index 6b1b99e7cc05..3d9111ce9e2e 100755
--- a/Reconstruction/RecExample/RecExCond/share/RecExCommon_flags.py
+++ b/Reconstruction/RecExample/RecExCond/share/RecExCommon_flags.py
@@ -673,10 +673,6 @@ if rec.Commissioning():
        from MuonCnvExample.MuonCalibFlags import muonCalibFlags
 
                
-   from AthenaMonitoring.DQMonFlags import DQMonFlags
-   if rec.doESD() and DQMonFlags.doCTPMon() and rec.doTrigger():
-      include("TrigT1CTMonitoring/CTPFlags.py")
-
    # FIXME obsolete flags (should be removed)!!!
    # ------------------------------------
    # import GlobalFlags from RecExCommon
diff --git a/Trigger/TrigT1/TrigT1CTMonitoring/CMakeLists.txt b/Trigger/TrigT1/TrigT1CTMonitoring/CMakeLists.txt
index ca80d051d4cf..09190a553f85 100644
--- a/Trigger/TrigT1/TrigT1CTMonitoring/CMakeLists.txt
+++ b/Trigger/TrigT1/TrigT1CTMonitoring/CMakeLists.txt
@@ -15,6 +15,5 @@ atlas_add_component( TrigT1CTMonitoring
    LINK_LIBRARIES ${COOL_LIBRARIES} ${CORAL_LIBRARIES} ${ROOT_LIBRARIES} AthenaBaseComps AthenaMonitoringLib AthenaPoolUtilities CoraCool xAODEventInfo GaudiKernel LWHists MuonDigitContainer MuonRDO MuonTrigCoinData TrigConfData TrigConfInterfaces TrigConfL1Data TrigT1CaloEventLib TrigT1Interfaces TrigT1Result )
 
 # Install files from the package:
-atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
 atlas_install_joboptions( share/*.py )
 atlas_install_scripts( scripts/*.py )
diff --git a/Trigger/TrigT1/TrigT1CTMonitoring/python/TrigT1CTMonitoringConfig.py b/Trigger/TrigT1/TrigT1CTMonitoring/python/TrigT1CTMonitoringConfig.py
deleted file mode 100644
index 3c22b021ad05..000000000000
--- a/Trigger/TrigT1/TrigT1CTMonitoring/python/TrigT1CTMonitoringConfig.py
+++ /dev/null
@@ -1,35 +0,0 @@
-# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
-
-## get a handle to the ApplicationManager
-from AthenaCommon.AppMgr import theApp
-## get a handle to the default top-level algorithm sequence
-from AthenaCommon.AlgSequence import AlgSequence
-topSequence = AlgSequence()
-## get a handle to the ServiceManager
-from AthenaCommon.AppMgr import ServiceMgr as svcMgr
-#---------------------------------------------------------------
-# CTP / MuCTPI bytestream conversion
-#---------------------------------------------------------------
-
-if not hasattr( svcMgr, "THistSvc" ):
-  from GaudiSvc.GaudiSvcConf import THistSvc
-  svcMgr += THistSvc()
-#svcMgr.THistSvc.Output = ["file1 DATAFILE='HistFile.root' OPT='RECREATE'"];
-
-if not hasattr( theApp.Dlls, "RootHistCnv" ):
-  theApp.Dlls += [ "RootHistCnv" ]
-  theApp.HistogramPersistency = "ROOT"
-
-if not hasattr( svcMgr, "THistSvc" ):
-  from GaudiSvc.GaudiSvcConf import THistSvc
-  svcMgr += THistSvc()
-#svcMgr.THistSvc.Output = ["file1 DATAFILE='HistFile.root' OPT='RECREATE'"];
-
-if not hasattr( theApp.Dlls, "RootHistCnv" ):
-  theApp.Dlls += [ "RootHistCnv" ]
-  theApp.HistogramPersistency = "ROOT"
-
-# if not hasattr( topSequence, "TrigT1CTMonitoring__BSMonitoring" ):
-#   from TrigT1CTMonitoring.TrigT1CTMonitoringConf import TrigT1CTMonitoring__BSMonitoring
-#   CTMonAlg = TrigT1CTMonitoring__BSMonitoring()
-#   topSequence += CTMonAlg
diff --git a/Trigger/TrigT1/TrigT1CTMonitoring/share/CTPFlags.py b/Trigger/TrigT1/TrigT1CTMonitoring/share/CTPFlags.py
deleted file mode 100644
index a55979e53e0b..000000000000
--- a/Trigger/TrigT1/TrigT1CTMonitoring/share/CTPFlags.py
+++ /dev/null
@@ -1,6 +0,0 @@
-include.block("TrigT1CTMonitoring/CTPFlags.py")
-class CTPFlags:
-   doCTRIO=True
-   doCTRDO=True
-   doMuRIO=True
-   doMuRDO=True
diff --git a/Trigger/TrigT1/TrigT1CTMonitoring/share/TrigT1CTMonitoringJobOptions_forRecExCommission.py b/Trigger/TrigT1/TrigT1CTMonitoring/share/TrigT1CTMonitoringJobOptions_forRecExCommission.py
index bae11c6e370a..5a06966af3aa 100644
--- a/Trigger/TrigT1/TrigT1CTMonitoring/share/TrigT1CTMonitoringJobOptions_forRecExCommission.py
+++ b/Trigger/TrigT1/TrigT1CTMonitoring/share/TrigT1CTMonitoringJobOptions_forRecExCommission.py
@@ -19,7 +19,8 @@ from AthenaCommon.Logging import logging
 ctpmonlog = logging.getLogger("CTPMonitoringSetup")
 
 from AthenaCommon.AppMgr import ServiceMgr as svcMgr
-from AthenaCommon.Constants import *
+from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
+from RecExConfig.RecFlags import rec
 
 LHCFillStateAvailable=False
 UsedFillStateCoolFolderName="/LHC/DCS/FILLSTATE"
@@ -44,130 +45,13 @@ topSequence = AlgSequence()
 #---------------------------------------------------------------
 # Central-Trigger Monitoring
 #---------------------------------------------------------------
-from TrigT1CTMonitoring.TrigT1CTMonitoringConfig import *
-## get a handle on the ToolSvc
-from AthenaCommon.AppMgr import ToolSvc as toolSvc
 from TrigT1CTMonitoring.TrigT1CTMonitoringConf import TrigT1CTMonitoring__BSMonitoring as BSMon
 from AthenaMonitoring.AthenaMonitoringConf import AthenaMonManager
 
 #-----------ONLINE CODE---------------------
 if athenaCommonFlags.isOnline():
-    ctpmonlog.info("Setting up CTP/MUCTPI BS monitoring for online")
-    #from TrigServices.TrigServicesConf import TrigMonTHistSvc
-    #THistSvc = TrigMonTHistSvc("THistSvc") 
-    #svcMgr += THistSvc 
-    doHist=True
-    InputDir = "."
-    OutputDir="."
-    FilePreFix = [ "MonTest"]
-    RootHistFileName = 'HistFile.root'
-    
-    ## add an AthenaMonManager algorithm to the list of algorithms to be ran
-    if not hasattr(topSequence,"PrimaryManager"):
-        topSequence += AthenaMonManager( "PrimaryManager" )
-    ## AthenaMonManager is the Algorithm that manages many classes inheriting
-    ## from ManagedMonitorToolBase
-    CTmonMan = topSequence.PrimaryManager
-
-    theApp.Dlls += [ "TrigT1CTMonitoring" ]
-    
-    CTmonMan.AthenaMonTools += [ "TrigT1CTMonitoring__BSMonitoring/BSMon" ]
-
-    ## FILEKEY must match that given to THistSvc
-    CTmonMan.FileKey = "GLOBAL"
-
-    DetDescrVersion="ATLAS-DC3-05" # 11.0.42 files 
-    AllAlgs = False # if false, all algorithms are switched off by defaults 
-
-
-    from AthenaCommon.GlobalFlags import GlobalFlags
-    GlobalFlags.DataSource.set_data()
-    GlobalFlags.InputFormat.set_bytestream()
-    GlobalFlags.DetGeo.set_atlas()
-    
-    from AthenaCommon.DetFlags import DetFlags
-    
-    DetFlags.detdescr.all_setOn()
-    DetFlags.geometry.all_setOn()
-    DetFlags.ID_setOff()
-    DetFlags.Calo_setOff() 
-    DetFlags.Truth_setOff()
-    #switch on/off detectors
-
-    DetFlags.Muon_setOn()
-    #DetFlags.Muon_setOff()
-
-    DetFlags.LVL1_setOn()
-    DetFlags.pileup.all_setOff()
-    DetFlags.simulate.all_setOff()
-    DetFlags.digitize.all_setOff()
-    DetFlags.makeRIO.all_setOff()
-    DetFlags.writeBS.all_setOff()
-    DetFlags.readRDOBS.all_setOff()
-    DetFlags.readRIOBS.all_setOff()
-    DetFlags.readRIOPool.all_setOff()
-    DetFlags.writeRIOPool.all_setOff()
-    DetFlags.writeRDOPool.all_setOff()
-    DetFlags.readRDOBS.LVL1_setOn()
-    DetFlags.readRIOBS.LVL1_setOn()
-    DetFlags.Print()
-    GlobalFlags.Print()
-    
-    #--------------------------------------------------------------
-    # GeoModel stuff:
-    #--------------------------------------------------------------
-    include( "AtlasGeoModel/SetGeometryVersion.py" )
-    include( "AtlasGeoModel/GeoModelInit.py" )
-
-    #--------------------------------------------------------------
-    # 
-    #--------------------------------------------------------------
-    include( "AmdcAth/AmdcAth_jobOptions.py" )
-    include( "AtlasGeoModel/MuonGeoModel.py" )
-
-    # Cabling and geometry of muon detectors
-    from RPCgeometry.RPCgeometryConfig import RPCgeometryConfig
-    from RPCcabling.RPCcablingConfig import RPCcablingConfig
-    RPCcablingSvc = RPCcablingConfig()
-    RPCcablingSvc.ConfFileName = "LVL1conf.data"
-    RPCcablingSvc.CorrFileName = "LVL1corr.data"
-    
-    from MDTcabling.MDTcablingConfig import MDTcablingConfig
-    MDTcablingSvc = MDTcablingConfig()
-    MDTcablingSvc.RODfile    = "RODmap.data"
-    from TGCcabling.TGCcablingConfig import TGCcablingConfig
-    
-    CTmonMan.Environment = "online"
-    CTmonMan.ManualDataTypeSetup = False
-    CTmonMan.DataType            = "cosmics"
-    CTmonMan.ManualRunLBSetup    = False
-    CTmonMan.Run                 = 1
-    CTmonMan.LumiBlock           = 1
-    
-    #---------------------------------------------------------------
-    # LVL1 configuration
-    #---------------------------------------------------------------
-    ctpmonlog.info("will setup LVL1ConfigSvc and add instance to ServiceMgr")
-    from TrigConfigSvc.TrigConfigSvcConfig import LVL1ConfigSvc
-    LVL1ConfigSvc = LVL1ConfigSvc('LVL1ConfigSvc')
-    LVL1ConfigSvc.ConfigSource = "XML"
-    LVL1ConfigSvc.XMLFile = "L1MenuM5.xml"
-    LVL1ConfigSvc.CreateLegacyObjects = True
-    LVL1ConfigSvc.DumpTTVmap = False
-    svcMgr += LVL1ConfigSvc
-    theApp.CreateSvc += [ "TrigConf::LVL1ConfigSvc/LVL1ConfigSvc" ]
-
-    from AthenaConfiguration.AllConfigFlags import ConfigFlags
-    svcMgr.ToolSvc += BSMon( ProcessMuctpiData=True,
-                            ProcessMuctpiDataRIO=True,
-                            ProcessCTPData=True,
-                            ProcessRoIBResult=True,
-                            InclusiveTriggerThresholds=True,
-                            FillStateCoolFolderName=UsedFillStateCoolFolderName )
-
-    printfunc (topSequence)
-    printfunc (svcMgr)
-
+    # fwinkl 09/2021: removed online-specific code as it was certainly broken and likely unused
+    ctpmonlog.error("Setting up CTP/MUCTPI BS monitoring for online currently not supported")
 
 #-----------OFFLINE CODE---------------------
 else:
@@ -183,10 +67,9 @@ else:
         #svcMgr.DSConfigSvc.readLVL1Thr=True
         #svcMgr.DSConfigSvc.readLVL1BG=True
 
-        from AthenaConfiguration.AllConfigFlags import ConfigFlags
         # Wrap everything in a sequence which will force algs to execute in order, even in MT mode
         from AthenaCommon.AlgSequence import AthSequencer
-        CTPMonSeq=CfgMgr.AthSequencer('CTPMonSeq')
+        CTPMonSeq=AthSequencer('CTPMonSeq')
 
         from TrigT1MuctpiPhase1.TrigT1MuctpiPhase1Config import L1MuctpiPhase1_on_Data
         CTPMonSeq += L1MuctpiPhase1_on_Data()
@@ -209,7 +92,7 @@ else:
         try:
             CTPMonSeq.CTPSimulation.HistPath = histbase
         except AttributeError as ex:
-            printfunc (ex," ignore for now")
+            print (ex," ignore for now")
             import traceback
             traceback.print_exc()
 
@@ -221,8 +104,6 @@ else:
                             DataType            = DQMonFlags.monManDataType() )
     CTPMonSeq += monMan
 
-    theApp.Dlls += [ "TrigT1CTMonitoring" ]
-    
     # check if global muons are on
     if not rec.doMuon:
         if 'IS_SIMULATION' not in metadata['eventTypes']:
-- 
GitLab