From c09d27b50a39d38c122572fd0ad066634d1effd8 Mon Sep 17 00:00:00 2001
From: Tim Martin <Tim.Martin@cern.ch>
Date: Tue, 11 Dec 2018 21:49:13 +0100
Subject: [PATCH] WIP towards configurable trigger config tool

---
 .../TrigDecisionMaker/src/TrigDecisionMakerMT.cxx        | 8 ++++----
 .../TrigDecisionMaker/src/TrigDecisionMakerMT.h          | 3 +++
 .../TrigConfiguration/TrigConfigSvc/src/HLTConfigSvc.cxx | 1 +
 Trigger/TrigValidation/TrigUpgradeTest/share/checkESD.py | 9 +++------
 4 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/Trigger/TrigAnalysis/TrigDecisionMaker/src/TrigDecisionMakerMT.cxx b/Trigger/TrigAnalysis/TrigDecisionMaker/src/TrigDecisionMakerMT.cxx
index cb767d7cd24e..ac550daea4b6 100644
--- a/Trigger/TrigAnalysis/TrigDecisionMaker/src/TrigDecisionMakerMT.cxx
+++ b/Trigger/TrigAnalysis/TrigDecisionMaker/src/TrigDecisionMakerMT.cxx
@@ -33,8 +33,8 @@ using namespace TrigDec;
 
 TrigDecisionMakerMT::TrigDecisionMakerMT(const std::string &name, ISvcLocator *pSvcLocator)
   : ::AthReentrantAlgorithm(name, pSvcLocator),
-    m_trigConfigSvc("TrigConf::TrigConfigSvc/TrigConfigSvc", name),
-    m_lvl1Tool("HLT::Lvl1ResultAccessTool/Lvl1ResultAccessTool", this)
+    m_trigConfigSvc(m_trigConfigLocation, name),
+    m_lvl1Tool(m_lvl1ToolLocation, this)
 {}
 
 TrigDecisionMakerMT::~TrigDecisionMakerMT() {}
@@ -253,9 +253,9 @@ int32_t TrigDecisionMakerMT::getChainCounter(const TrigCompositeUtils::DecisionI
     ATH_MSG_ERROR("Unable to locate chain with hash:" << chainID << " in the TrigConf, the error reported was:" << chainName);
     return -1;
   }
-  const TrigConf::HLTChain* chain = m_trigConfigSvc->chainList()->chain(chainName);
+  const TrigConf::HLTChain* chain = m_trigConfigSvc->chains().chain(chainName);
   if (chain == nullptr) {
-    ATH_MSG_ERROR("Unable to fetch HLTChain object for chain with ID:'" << chainID << "' and name:'" << chainName << "' (number of chains:" << m_trigConfigSvc->chainList()->size() << ")");
+    ATH_MSG_ERROR("Unable to fetch HLTChain object for chain with ID:'" << chainID << "' and name:'" << chainName << "' (number of chains:" << m_trigConfigSvc->chains().size() << ")");
     return -1;        
   }
   return chain->chain_counter();
diff --git a/Trigger/TrigAnalysis/TrigDecisionMaker/src/TrigDecisionMakerMT.h b/Trigger/TrigAnalysis/TrigDecisionMaker/src/TrigDecisionMakerMT.h
index 3557fa18841a..c2fc910ab880 100644
--- a/Trigger/TrigAnalysis/TrigDecisionMaker/src/TrigDecisionMakerMT.h
+++ b/Trigger/TrigAnalysis/TrigDecisionMaker/src/TrigDecisionMakerMT.h
@@ -111,7 +111,10 @@ namespace TrigDec {
 
     // Tools & services
     ServiceHandle<TrigConf::ITrigConfigSvc> m_trigConfigSvc; //!< handle to the full (L1 & HLT) trigger config service
+    Gaudi::Property<std::string> m_trigConfigLocation{this, "TrigConfigLocation", "TrigConf::TrigConfigSvc/TrigConfigSvc", "Trigger configuration service to fetch"};
+
     ToolHandle<HLT::ILvl1ResultAccessTool> m_lvl1Tool;  //!< tool to ease the access to the L1 results (RoIs, items, etc)
+    Gaudi::Property<std::string> m_lvl1ToolLocation{this, "Lvl1ToolLocation", "HLT::Lvl1ResultAccessTool/Lvl1ResultAccessTool", "L1 tool to fetch"};
 
     // Input keys configuration
     SG::ReadHandleKey<TrigCompositeUtils::DecisionContainer> m_HLTSummaryKeyIn {this, "HLTSummary", "HLTSummary", "HLT summary container Key"};
diff --git a/Trigger/TrigConfiguration/TrigConfigSvc/src/HLTConfigSvc.cxx b/Trigger/TrigConfiguration/TrigConfigSvc/src/HLTConfigSvc.cxx
index 6dd174efcf57..94ff46cc8b11 100644
--- a/Trigger/TrigConfiguration/TrigConfigSvc/src/HLTConfigSvc.cxx
+++ b/Trigger/TrigConfiguration/TrigConfigSvc/src/HLTConfigSvc.cxx
@@ -148,6 +148,7 @@ HLTConfigSvc::initialize() {
          m_HLTFrame.theHLTChainList().addHLTChain( chain );
          ATH_MSG_INFO(" RUN 3 TESTING MODE! Adding dummy chain with hash:" << chain->chain_hash_id() << " : " << chainName << " [" << chainCounter << "] <- " << chainSeed); 
       }
+      ATH_MSG_INFO(" RUN 3 TESTING MODE! Total number of chains: " << chains().size()); 
 
       return StatusCode::SUCCESS;
 
diff --git a/Trigger/TrigValidation/TrigUpgradeTest/share/checkESD.py b/Trigger/TrigValidation/TrigUpgradeTest/share/checkESD.py
index 2140a7487858..9509101c72ed 100644
--- a/Trigger/TrigValidation/TrigUpgradeTest/share/checkESD.py
+++ b/Trigger/TrigValidation/TrigUpgradeTest/share/checkESD.py
@@ -12,11 +12,6 @@ checker.doDumpxAODTrackParticle         = True
 checker.doDumpTrigCompsiteNavigation    = True
 checker.doDumpAllTrigComposite          = True
 checker.doDumpStoreGate                 = True
-# this list was obtained by: checkxAOD.py myESD.pool.root  | grep Composite | tr -s " "| cut -d" " -f10 | awk '{print "\""$1"\""}' | tr "\n" "," > f
-# Note that this is superseded by checker.doDumpAllTrigComposite.
-# tcContainers  =  [ "FilteredEMRoIDecisions", "L2CaloLinks", "L2ElectronLinks", "EgammaCaloDecisions", "FilteredEgammaCaloDecisions", "filterCaloRoIsAlg",  "ElectronL2Decisions", "MuonL2Decisions", "METRoIDecisions", "MURoIDecisions", "HLTChainsResult", "JRoIDecisions", "MonitoringSummaryStep1", "RerunEMRoIDecisions", "RerunMURoIDecisions", "TAURoIDecisions", "EMRoIDecisions"  ]
-# for container in tcContainers:
-#  checker.dumpTrigCompositeContainers += [ "remap_" + container ]
 
 from AthenaCommon.AppMgr import topSequence
 
@@ -30,11 +25,13 @@ topSequence += checker
 from TrigDecisionMaker.TrigDecisionMakerConfig import TrigDecisionMakerMT
 topSequence+=TrigDecisionMakerMT()
 topSequence.TrigDecMakerMT.OutputLevel = DEBUG
+# topSequence.TrigDecMakerMT.TrigConfigLocation = "TrigConf::TrigConfigSvc/TrigConfigSvc"
+
 # Note that for now we don't properly configure the trigger configuration service
 from TrigConfigSvc.TrigConfigSvcConfig import HLTConfigSvc
 theApp.Dlls += [ "TrigConfigSvc" ]
 theApp.CreateSvc += [ "TrigConf::HLTConfigSvc/HLTConfigSvc" ]
-ServiceMgr += HLTConfigSvc()
+ServiceMgr += HLTConfigSvc("HLTConfigSvc")
 ServiceMgr.HLTConfigSvc.ConfigSource   = "RUN3_DUMMY"
 ServiceMgr.HLTConfigSvc.OutputLevel    = VERBOSE
 print ServiceMgr.HLTConfigSvc
-- 
GitLab