From 6d11015b1c4421002944a594be0c247e839f89f2 Mon Sep 17 00:00:00 2001
From: Joerg Stelzer <joerg.stelzer@cern.ch>
Date: Tue, 15 Sep 2020 13:04:59 +0000
Subject: [PATCH] Configure L1TopoConfigSvc in MT setup

---
 .../TrigConfigSvc/python/TrigConfigSvcCfg.py  | 25 ++++++++++++++++++-
 .../TrigConfigSvc/src/L1TopoConfigSvc.cxx     |  6 ++---
 .../share/ref_RDOtoRDOTrig_mt1_build.ref      |  8 +++---
 .../python/Lvl1SimulationConfig.py            |  3 ++-
 4 files changed, 33 insertions(+), 9 deletions(-)

diff --git a/Trigger/TrigConfiguration/TrigConfigSvc/python/TrigConfigSvcCfg.py b/Trigger/TrigConfiguration/TrigConfigSvc/python/TrigConfigSvcCfg.py
index 21a01776c99..a796878589d 100644
--- a/Trigger/TrigConfiguration/TrigConfigSvc/python/TrigConfigSvcCfg.py
+++ b/Trigger/TrigConfiguration/TrigConfigSvc/python/TrigConfigSvcCfg.py
@@ -116,11 +116,34 @@ def generateL1Menu( flags ):
     return outfile
 
 
+# configuration of L1ConfigSvc
+@memoize
+def getL1TopoConfigSvc( flags ):
+    log = logging.getLogger('TrigConfigSvcCfg')
+    # configure config svc
+    TrigConf__L1TopoConfigSvc = CompFactory.getComp("TrigConf::L1TopoConfigSvc")
+    l1topoConfigSvc = TrigConf__L1TopoConfigSvc("L1TopoConfigSvc")
+
+    l1topoConfigSvc.ConfigSource = "XML"
+    from TriggerJobOpts.TriggerFlags import TriggerFlags
+    l1topoXMLFile = TriggerFlags.inputL1TopoConfigFile() if flags is None else flags.Trigger.LVL1TopoConfigFile
+    # check if file exists in this directory otherwise add the package to aid path resolution
+    # also a '/' in the file name indicates that no package needs to be added
+    import os.path
+    if not ( "/" in l1topoXMLFile or os.path.isfile(l1topoXMLFile) ):
+        l1topoXMLFile = "TriggerMenuMT/" + l1topoXMLFile
+    l1topoConfigSvc.XMLMenuFile = l1topoXMLFile
+    log.info( "Configured L1TopoConfigSvc with input file : %s", l1topoXMLFile )
+
+    from AthenaCommon.AppMgr import theApp
+    theApp.CreateSvc += [ "TrigConf::L1TopoConfigSvc/L1TopoConfigSvc" ]
+    return l1topoConfigSvc
+
+
 # configuration of L1ConfigSvc
 @memoize
 def getL1ConfigSvc( flags ):
     log = logging.getLogger('TrigConfigSvcCfg')
-    from AthenaCommon.Logging import log
     # generate menu file
     generatedFile = generateL1Menu( flags )
 
diff --git a/Trigger/TrigConfiguration/TrigConfigSvc/src/L1TopoConfigSvc.cxx b/Trigger/TrigConfiguration/TrigConfigSvc/src/L1TopoConfigSvc.cxx
index 335d3ac97bd..d1c21a57c7d 100644
--- a/Trigger/TrigConfiguration/TrigConfigSvc/src/L1TopoConfigSvc.cxx
+++ b/Trigger/TrigConfiguration/TrigConfigSvc/src/L1TopoConfigSvc.cxx
@@ -11,7 +11,7 @@ using namespace std;
 
 TrigConf::L1TopoConfigSvc::L1TopoConfigSvc(const string& name, ISvcLocator* pSvcLocator) : 
    base_class(name, pSvcLocator),
-   m_menu(new TXC::L1TopoMenu)
+   m_menu( nullptr )
 {
    base_class::declareCommonProperties();
 }
@@ -31,6 +31,8 @@ TrigConf::L1TopoConfigSvc::initialize() {
       return StatusCode::SUCCESS;
    }
 
+   m_menu = std::make_unique<TXC::L1TopoMenu>();
+
    CHECK(initStorageMgr());
    
    m_menu->setSMK( m_dbSMKey );
@@ -40,8 +42,6 @@ TrigConf::L1TopoConfigSvc::initialize() {
 
    CHECK(freeStorageMgr());
 
-   //   m_menu->print();
-
    return loadSuccess ? StatusCode::SUCCESS : StatusCode::FAILURE;
 }
 
diff --git a/Trigger/TrigValidation/TrigAnalysisTest/share/ref_RDOtoRDOTrig_mt1_build.ref b/Trigger/TrigValidation/TrigAnalysisTest/share/ref_RDOtoRDOTrig_mt1_build.ref
index c348c227621..ef6d417dee7 100644
--- a/Trigger/TrigValidation/TrigAnalysisTest/share/ref_RDOtoRDOTrig_mt1_build.ref
+++ b/Trigger/TrigValidation/TrigAnalysisTest/share/ref_RDOtoRDOTrig_mt1_build.ref
@@ -752,14 +752,14 @@ TrigSignatureMoniMT                                 INFO HLT_tau35_mediumRNN_tra
 TrigSignatureMoniMT                                 INFO -- #2456480859 Events         14         14         11         10         4          -          -          -          -          -          -          -          -          -          4
 TrigSignatureMoniMT                                 INFO -- #2456480859 Features                             20         14         4          -          -          -          -          -          -          -          -          -
 TrigSignatureMoniMT                                 INFO HLT_tau35_mediumRNN_tracktwoMVA_tau25_mediumRNN_tracktwoMVA_L1DR-TAU20ITAU12I-J25 #1794354861
-TrigSignatureMoniMT                                 INFO -- #1794354861 Events         0          0          0          0          0          -          -          -          -          -          -          -          -          -          0
-TrigSignatureMoniMT                                 INFO -- #1794354861 Features                             0          0          0          -          -          -          -          -          -          -          -          -
+TrigSignatureMoniMT                                 INFO -- #1794354861 Events         6          6          6          3          0          -          -          -          -          -          -          -          -          -          0
+TrigSignatureMoniMT                                 INFO -- #1794354861 Features                             15         6          0          -          -          -          -          -          -          -          -          -
 TrigSignatureMoniMT                                 INFO HLT_tau80_medium1_tracktwo_L1TAU60 #598963338
 TrigSignatureMoniMT                                 INFO -- #598963338 Events          5          5          4          2          1          -          -          -          -          -          -          -          -          -          1
 TrigSignatureMoniMT                                 INFO -- #598963338 Features                              5          2          1          -          -          -          -          -          -          -          -          -
 TrigSignatureMoniMT                                 INFO HLT_tau80_mediumRNN_tracktwoMVA_tau35_mediumRNN_tracktwoMVA_L1TAU60_DR-TAU20ITAU12I #1075975502
-TrigSignatureMoniMT                                 INFO -- #1075975502 Events         0          0          0          0          0          -          -          -          -          -          -          -          -          -          0
-TrigSignatureMoniMT                                 INFO -- #1075975502 Features                             0          0          0          -          -          -          -          -          -          -          -          -
+TrigSignatureMoniMT                                 INFO -- #1075975502 Events         3          3          2          0          0          -          -          -          -          -          -          -          -          -          0
+TrigSignatureMoniMT                                 INFO -- #1075975502 Features                             6          0          0          -          -          -          -          -          -          -          -          -
 TrigSignatureMoniMT                                 INFO HLT_tau80_mediumRNN_tracktwoMVA_tau60_mediumRNN_tracktwoMVA_L1TAU60_2TAU40 #400305971
 TrigSignatureMoniMT                                 INFO -- #400305971 Events          3          3          2          0          0          -          -          -          -          -          -          -          -          -          0
 TrigSignatureMoniMT                                 INFO -- #400305971 Features                              5          0          0          -          -          -          -          -          -          -          -          -
diff --git a/Trigger/TriggerCommon/TriggerJobOpts/python/Lvl1SimulationConfig.py b/Trigger/TriggerCommon/TriggerJobOpts/python/Lvl1SimulationConfig.py
index 5a4a0512108..87f82bf65fc 100644
--- a/Trigger/TriggerCommon/TriggerJobOpts/python/Lvl1SimulationConfig.py
+++ b/Trigger/TriggerCommon/TriggerJobOpts/python/Lvl1SimulationConfig.py
@@ -26,8 +26,9 @@ def Lvl1SimulationSequence( flags = None ):
     TriggerFlags.readLVL1configFromXML = True
     TriggerFlags.outputLVL1configFile = None
     log.info("setting up LVL1ConfigSvc, including the menu generation")
-    from TrigConfigSvc.TrigConfigSvcCfg import getL1ConfigSvc
+    from TrigConfigSvc.TrigConfigSvcCfg import getL1ConfigSvc, getL1TopoConfigSvc
     svcMgr += conf2toConfigurable(getL1ConfigSvc(flags))
+    svcMgr += conf2toConfigurable(getL1TopoConfigSvc(flags))
 
     ##################################################
     # Calo
-- 
GitLab