From df408a7198820b4d9fe4b2292b218e6db6e314da Mon Sep 17 00:00:00 2001
From: Peter Onyisi <ponyisi@utexas.edu>
Date: Fri, 26 Jun 2015 16:36:49 +0200
Subject: [PATCH] Fix bug breaking menu-aware monitoring recognition
 (AthenaMonitoring-02-01-23)

	* Fix bug breaking menu-aware monitoring recognition
	* tag AthenaMonitoring-02-01-23

2015-05-30 Peter Onyisi <ponyisi AT cern.ch>
	* Fully enable menu-aware monitoring
	* tag AthenaMonitoring-02-01-21

2015-05-22 Peter Onyisi <ponyisi AT cern.ch>
	* Remove some unnecessary INFO messages
	* tag AthenaMonitoring-02-01-20

2015-05-08 Peter Onyisi <ponyisi AT cern.ch>
	* Enable IDPerfmon+IDDiMuMon
	* Disable stream aware monitoring by default
	* tag AthenaMonitoring-02-01-19

2015-05-05 - Yuriy Ilchenko
	* Lumi methods return guard values if information invalid
	* tag AthenaMonitoring-02-01-18

...
(Long ChangeLog diff - truncated)
---
 .../AthenaMonitoring/ManagedMonitorToolBase.h |  1 +
 .../AthenaMonitoring/ManagedMonitorToolTest.h |  2 +
 Control/AthenaMonitoring/cmt/requirements     |  2 +-
 Control/AthenaMonitoring/python/DQMonFlags.py | 11 ++-
 .../share/DQMonFlagsConfig_jobOptions.py      |  5 +-
 .../share/DataQualitySteering_jobOptions.py   | 17 +++--
 .../share/ManagedMonitorToolTest.py           |  3 +-
 .../share/TrigDecTool_jobOptions.py           | 28 +++++++-
 .../AthenaMonitoring/src/AthenaMonManager.cxx |  6 +-
 .../src/ManagedMonitorToolBase.cxx            | 71 +++++++++++++++----
 .../src/ManagedMonitorToolTest.cxx            | 18 ++++-
 .../src/TriggerTranslatorSimple.cxx           |  9 ++-
 12 files changed, 142 insertions(+), 31 deletions(-)

diff --git a/Control/AthenaMonitoring/AthenaMonitoring/ManagedMonitorToolBase.h b/Control/AthenaMonitoring/AthenaMonitoring/ManagedMonitorToolBase.h
index e701e66c222..5da30d77d85 100755
--- a/Control/AthenaMonitoring/AthenaMonitoring/ManagedMonitorToolBase.h
+++ b/Control/AthenaMonitoring/AthenaMonitoring/ManagedMonitorToolBase.h
@@ -719,6 +719,7 @@ class ManagedMonitorToolBase : public AthAlgTool, virtual public IMonitorToolBas
 
       std::vector<std::string> m_vTrigChainNames, m_vTrigGroupNames;
       StatusCode parseList(const std::string&, std::vector<std::string>&);
+      void updateTriggersForGroups(std::vector<std::string>&);
 
       StatusCode registerMetadata(const std::string& streamName, const std::string& hName, const MonGroup& group);
 
diff --git a/Control/AthenaMonitoring/AthenaMonitoring/ManagedMonitorToolTest.h b/Control/AthenaMonitoring/AthenaMonitoring/ManagedMonitorToolTest.h
index 5c1c86fc8bf..12e2561cc66 100755
--- a/Control/AthenaMonitoring/AthenaMonitoring/ManagedMonitorToolTest.h
+++ b/Control/AthenaMonitoring/AthenaMonitoring/ManagedMonitorToolTest.h
@@ -55,6 +55,8 @@ class ManagedMonitorToolTest : public ManagedMonitorToolBase
       TH1*               m_managedHist_eventsBlock;
       TH1*               m_managedHist_run;
 
+      TH1*               m_Lumi;
+
       TGraph*            m_graph;
       TGraph*            m_managedGraph;
       TTree*             m_ntuple;
diff --git a/Control/AthenaMonitoring/cmt/requirements b/Control/AthenaMonitoring/cmt/requirements
index 099fe8e5f17..4918e1c935a 100755
--- a/Control/AthenaMonitoring/cmt/requirements
+++ b/Control/AthenaMonitoring/cmt/requirements
@@ -22,7 +22,7 @@ use AthenaPoolUtilities   AthenaPoolUtilities-*    Database/AthenaPOOL
 use SGAudCore             SGAudCore-*              Control/SGMon
 use AtlasCORAL            AtlasCORAL-*             External
 use LWHists               LWHists-*                Tools
-
+use AtlasBoost            AtlasBoost-*             External
 # Specify required ROOT components for cmake (transparent to CMT)
 apply_pattern cmake_add_command command="find_package(ROOT COMPONENTS MathCore)"
 
diff --git a/Control/AthenaMonitoring/python/DQMonFlags.py b/Control/AthenaMonitoring/python/DQMonFlags.py
index 98d339b7828..914b99d1b2b 100644
--- a/Control/AthenaMonitoring/python/DQMonFlags.py
+++ b/Control/AthenaMonitoring/python/DQMonFlags.py
@@ -178,7 +178,7 @@ class doMuonTrackMon(JobProperty):
     """ Switch for muon track monitoring """
     statusOn=True
     allowedTypes=['bool']
-    StoredValue=False
+    StoredValue=True
 list+=[doMuonTrackMon]
 
 class doMuonAlignMon(JobProperty):
@@ -227,7 +227,7 @@ class doStreamAwareMon(JobProperty):
     """ Switch for stream-aware monitoring """
     statusOn=True
     allowedTypes=['bool']
-    StoredValue=True
+    StoredValue=False
 list+=[doStreamAwareMon]
 
 class monType(JobProperty):
@@ -349,6 +349,13 @@ class nameTrigDecTool(JobProperty):
     StoredValue  = 'monTrigDecTool'
 list+=[nameTrigDecTool]
 
+class nameTrigTransTool(JobProperty):
+    """ name of trigger translator tool """
+    statusOn     = True
+    allowedTypes = ['str']
+    StoredValue  = 'monTrigTransTool'
+list+=[nameTrigTransTool]
+
 class monToolPostExec(JobProperty):
     """ MonManager environment """
     statusOn     = True
diff --git a/Control/AthenaMonitoring/share/DQMonFlagsConfig_jobOptions.py b/Control/AthenaMonitoring/share/DQMonFlagsConfig_jobOptions.py
index 11afe7e0e8a..621a2a9d003 100644
--- a/Control/AthenaMonitoring/share/DQMonFlagsConfig_jobOptions.py
+++ b/Control/AthenaMonitoring/share/DQMonFlagsConfig_jobOptions.py
@@ -238,8 +238,9 @@ if (not rec.doJetMissingETTag() or (rec.readRDO() and not jobproperties.JetRecFl
 if (not rec.doTau()):
    DQMonFlags.doTauMon=False
 
-if (not recAlgs.doMissingET()):
-   DQMonFlags.doMissingEtMon=False
+# covered now by doJetMissingETTag
+# if (not recAlgs.doMissingET()):
+#    DQMonFlags.doMissingEtMon=False
 
 #
 # Stream Aware Monitoring
diff --git a/Control/AthenaMonitoring/share/DataQualitySteering_jobOptions.py b/Control/AthenaMonitoring/share/DataQualitySteering_jobOptions.py
index 4eff722bf08..5499101d87b 100644
--- a/Control/AthenaMonitoring/share/DataQualitySteering_jobOptions.py
+++ b/Control/AthenaMonitoring/share/DataQualitySteering_jobOptions.py
@@ -7,7 +7,6 @@
 # disable InDetPerformanceMonitoring, JetMonitoring until further notice 
 # - PUEO 20140401
 TRTELEMON=False
-IDPERFMON=False
 
 local_logger = logging.getLogger('DataQualitySteering_jobOptions')
 
@@ -101,7 +100,7 @@ if DQMonFlags.doMonitoring():
    #----------------#
    # ID performance #
    #----------------#
-   if DQMonFlags.doInDetPerfMon() and IDPERFMON:
+   if DQMonFlags.doInDetPerfMon():
       try:
          include("InDetPerformanceMonitoring/IDPerfMon_jobOptions.py")
          IDPerfMonManager = topSequence.IDPerfMonManager
@@ -235,6 +234,7 @@ if DQMonFlags.doMonitoring():
    # Post-setup configuration #
    #--------------------------#
    monToolSet_after = set(ToolSvc.getChildren())
+   local_logger.debug('DQ Post-Setup Configuration')
    for tool in monToolSet_after-monToolSet_before:
       # if we have the FilterTools attribute, assume this is in fact a
       # monitoring tool
@@ -242,13 +242,16 @@ if DQMonFlags.doMonitoring():
       if globalflags.DataSource.get_Value() == 'geant4' or not DQMonFlags.enableLumiAccess():
          if 'EnableLumi' in dir(tool):
             tool.EnableLumi = False
-      if DQMonFlags.monToolPostExec():
-         local_logger.debug('DQ Post-Setup Configuration')
-         postprocfunc = eval(DQMonFlags.monToolPostExec())
-         if hasattr(tool, 'FilterTools'):
+      if hasattr(tool, 'FilterTools'):
+         # give all the tools the trigger translator
+         if DQMonFlags.useTrigger():
+            tool.TriggerTranslatorTool = monTrigTransTool
+
+         if DQMonFlags.monToolPostExec():
+            postprocfunc = eval(DQMonFlags.monToolPostExec())
             local_logger.debug('Applying postexec transform to  ===> %s', tool)
             postprocfunc(tool)
-         del postprocfunc
+            del postprocfunc
 
    del monToolSet_before, monToolSet_after
 
diff --git a/Control/AthenaMonitoring/share/ManagedMonitorToolTest.py b/Control/AthenaMonitoring/share/ManagedMonitorToolTest.py
index 98d9af1d2e1..0bc1d4fc600 100755
--- a/Control/AthenaMonitoring/share/ManagedMonitorToolTest.py
+++ b/Control/AthenaMonitoring/share/ManagedMonitorToolTest.py
@@ -5,7 +5,8 @@ globalflags.InputFormat = 'pool'
 
 from AthenaCommon.AthenaCommonFlags import athenaCommonFlags as af
 af.FilesInput = [
-"/afs/cern.ch/user/y/yuraic/testarea/test_lumi/data/data12_8TeV.00211670.express_express.merge.ESD.r4065_p1278_tid01070414_00/ESD.01070414._000034.pool.root.1"
+"/afs/cern.ch/user/y/yuraic/test_CaloMonitoring/test_CaloMon/myAOD_JetTauEtmiss_0.AOD.pool.root"
+#"/afs/cern.ch/user/y/yuraic/testarea/test_lumi/data/data12_8TeV.00211670.express_express.merge.ESD.r4065_p1278_tid01070414_00/ESD.01070414._000034.pool.root.1"
 #"root://eosatlas//eos/atlas/atlasdatadisk/data12_8TeV/ESD/r4065/data12_8TeV.00204955.express_express.recon.ESD.r4065_tid01034439_00/ESD.01034439._000461.pool.root.1"
 ]
 
diff --git a/Control/AthenaMonitoring/share/TrigDecTool_jobOptions.py b/Control/AthenaMonitoring/share/TrigDecTool_jobOptions.py
index fab955df3c9..4933f86038e 100644
--- a/Control/AthenaMonitoring/share/TrigDecTool_jobOptions.py
+++ b/Control/AthenaMonitoring/share/TrigDecTool_jobOptions.py
@@ -32,8 +32,32 @@ if DQMonFlags.useTrigger():
       ToolSvc += monTrigDecTool
 
    tdt_local_logger.info('Scheduling the trigger translator')
+   # Look up all monitoring menu lists, shove into trigger translator
+   # pass them in as joined strings, unpack in tool
+   from TrigHLTMonitoring.HLTMonTriggerList import HLTMonTriggerList
+   tdt_local_hltconfig = HLTMonTriggerList()
+   import collections
+   tdt_mapping = {}
+   for tdt_menu, tdt_menu_item in tdt_local_hltconfig.__dict__.items():
+      if not isinstance(tdt_menu_item, collections.Iterable): continue
+      # work around possibly buggy category items
+      if isinstance(tdt_menu_item, basestring): 
+         tdt_local_logger.debug('String, not list: %s' % tdt_menu)
+         tdt_menu_item = [tdt_menu_item]
+      if len([_ for _ in tdt_menu_item if not (_.startswith('HLT_') or _.startswith('L1'))]) != 0:
+         tdt_local_logger.debug('Bad formatting: %s' % tdt_menu)
+      patched_names = []
+      tdt_menu_item = [_ if (_.startswith('HLT_') or _.startswith('L1_')) else 'HLT_' + _
+                       for _ in tdt_menu_item]
+      tdt_mapping[tdt_menu] = ','.join(tdt_menu_item)
+         
+   for k, v in tdt_mapping.items():
+      tdt_local_logger.info('Category %s resolves to %s' % (k, v))
+
    from AthenaMonitoring.AthenaMonitoringConf import TriggerTranslatorToolSimple
-   monTrigTransTool = TriggerTranslatorToolSimple()
+   monTrigTransTool = TriggerTranslatorToolSimple(
+      name = DQMonFlags.nameTrigTransTool(),
+      triggerMapping = tdt_mapping)
    ToolSvc += monTrigTransTool
 
-del tdt_local_logger
+del tdt_local_logger, tdt_local_hltconfig, tdt_mapping
diff --git a/Control/AthenaMonitoring/src/AthenaMonManager.cxx b/Control/AthenaMonitoring/src/AthenaMonManager.cxx
index 6ff2beb0a2d..4f40bd905e7 100755
--- a/Control/AthenaMonitoring/src/AthenaMonManager.cxx
+++ b/Control/AthenaMonitoring/src/AthenaMonManager.cxx
@@ -884,7 +884,11 @@ writeAndResetLWHist( const std::string& key, const std::string& streamName )
                 lwhist->setOwnsROOTHisto(true);//Since we deregistered
 
                 //LWHistAthMonWrapper::deleteLWHist(lwhist);
-                LWHistAthMonWrapper::removeCustomData(lwhist);
+                // Yuriy: commented out this line to make the code properly place  histograms
+                // in the offline environament; It has been a bug after I fixed online environment
+                // with a new approach; Basically inherited from writeAndDeletLWHist(...)
+                //LWHistAthMonWrapper::removeCustomData(lwhist);
+
                 lwhist->Reset();
 
                 lwhist=0;
diff --git a/Control/AthenaMonitoring/src/ManagedMonitorToolBase.cxx b/Control/AthenaMonitoring/src/ManagedMonitorToolBase.cxx
index 2002d02e0c3..735ec29367b 100755
--- a/Control/AthenaMonitoring/src/ManagedMonitorToolBase.cxx
+++ b/Control/AthenaMonitoring/src/ManagedMonitorToolBase.cxx
@@ -692,6 +692,9 @@ initialize()
             msg(MSG::WARNING) << "Error parsing the trigger chain list, using empty list" << endreq;
             m_vTrigChainNames.clear();
          }
+	 if (!m_trigTranslator.empty()) {
+	   updateTriggersForGroups(m_vTrigChainNames);
+	 }
       }
       else {
 	ATH_MSG_DEBUG("  --> trigger chain list empty");
@@ -703,6 +706,9 @@ initialize()
             msg(MSG::WARNING) << "Error parsing the trigger group names list, using empty list" << endreq;
             m_vTrigGroupNames.clear();
          }
+	 if (!m_trigTranslator.empty()) {
+	   updateTriggersForGroups(m_vTrigChainNames);
+	 }
       }
       else {
 	ATH_MSG_DEBUG("  --> trigger group list empty");
@@ -912,13 +918,14 @@ fillHists()
       (!m_useTrigger
        || (m_vTrigChainNames.size()>0 && trigChainsArePassed(m_vTrigChainNames))
        || (m_vTrigGroupNames.size()>0 && trigChainsArePassed(m_vTrigGroupNames))) ) {
+     ATH_MSG_DEBUG("Passed trigger, presumably");
       d->benchPreFillHistograms();
       StatusCode sc3 = fillHistograms();
       m_haveClearedLastEventBlock = true;
       d->benchPostFillHistograms();
       sc3.setChecked();
       ++m_nEvents;
-   }
+   } else { ATH_MSG_DEBUG("Failed trigger, presumably"); }
 
    ++m_nEventsIgnoreTrigger;
    if( newLumiBlock && (m_nEventsIgnoreTrigger != 1) ) {
@@ -1410,12 +1417,12 @@ StatusCode ManagedMonitorToolBase::regHist( LWHist* h, const MonGroup& group )
       return StatusCode::FAILURE;
 
    if (!m_bookHistogramsInitial) {
-           ATH_MSG_INFO("Yura: very first time");
+           ATH_MSG_DEBUG("Yura: very first time");
 	   if ( (group.histo_mgmt() & ATTRIB_UNMANAGED) == 0 ) {
 
-               ATH_MSG_INFO("Yura: we have managed histograms");
+               ATH_MSG_DEBUG("Yura: we have managed histograms");
 	       if (m_supportedIntervalsForRebooking.count(group.interval())) {
-                       ATH_MSG_INFO("        Yura: adding histogram" << h->GetName());
+                       ATH_MSG_DEBUG("        Yura: adding histogram" << h->GetName());
 		       m_templateLWHistograms[group.interval()].push_back( MgmtParams<LWHist>(h, group) );
 	       } else {
 		       ATH_MSG_ERROR("Attempt to book managed histogram " << h->GetName() << " with invalid interval type " << intervalEnumToString(group.interval()));
@@ -1771,7 +1778,9 @@ lbAverageInteractionsPerCrossing()
     if ( m_hasRetrievedLumiTool ) {
         return m_lumiTool->lbAverageInteractionsPerCrossing();
     } else {
-        ATH_MSG_FATAL("! Luminosity tool has been disabled ! lbAverageInteractionsPerCrossing() can't work properly! ");
+        //ATH_MSG_FATAL("! Luminosity tool has been disabled ! lbAverageInteractionsPerCrossing() can't work properly! ");
+        ATH_MSG_DEBUG("Warning: lbAverageInteractionsPerCrossing() - luminosity tools are not retrieved or turned on (i.e. EnableLumi = False)");
+        return -1.0;
     }
     return -0.0;
 }
@@ -1789,7 +1798,9 @@ lbInteractionsPerCrossing()
 
         return instmu;
     } else {
-        ATH_MSG_FATAL("! Luminosity tool has been disabled ! lbInteractionsPerCrossing() can't work properly! ");
+        //ATH_MSG_FATAL("! Luminosity tool has been disabled ! lbInteractionsPerCrossing() can't work properly! ");
+        ATH_MSG_DEBUG("Warning: lbInteractionsPerCrossing() - luminosity tools are not retrieved or turned on (i.e. EnableLumi = False)");
+        return -1.0;
     }
     return -0.0;
 }
@@ -1802,7 +1813,9 @@ lbAverageLuminosity()
     if ( m_hasRetrievedLumiTool ) {
         return m_lumiTool->lbAverageLuminosity();
     } else {
-        ATH_MSG_FATAL("! Luminosity tool has been disabled ! lbAverageLuminosity() can't work properly! ");
+        //ATH_MSG_FATAL("! Luminosity tool has been disabled ! lbAverageLuminosity() can't work properly! ");
+        ATH_MSG_DEBUG("Warning: lbAverageLuminosity() - luminosity tools are not retrieved or turned on (i.e. EnableLumi = False)");
+        return -1.0;
     }
     return -0.0;
 }
@@ -1815,7 +1828,9 @@ lbLuminosityPerBCID()
     if ( m_hasRetrievedLumiTool ) {
         return m_lumiTool->lbLuminosityPerBCID();
     } else {
-        ATH_MSG_FATAL("! Luminosity tool has been disabled ! lbLuminosityPerBCID() can't work properly! ");
+        //ATH_MSG_FATAL("! Luminosity tool has been disabled ! lbLuminosityPerBCID() can't work properly! ");
+        ATH_MSG_DEBUG("Warning: lbLuminosityPerBCID() - luminosity tools are not retrieved or turned on (i.e. EnableLumi = False)");
+        return -1.0;
     }
     return -0.0;
 }
@@ -1832,7 +1847,9 @@ lbAverageLivefraction()
     if ( m_hasRetrievedLumiTool ) {
         return m_liveTool->lbAverageLivefraction();
     } else {
-        ATH_MSG_FATAL("! Luminosity tool has been disabled ! lbAverageLivefraction() can't work properly! ");
+        //ATH_MSG_FATAL("! Luminosity tool has been disabled ! lbAverageLivefraction() can't work properly! ");
+        ATH_MSG_DEBUG("Warning: lbAverageLivefraction() - luminosity tools are not retrieved or turned on (i.e. EnableLumi = False)");
+        return -1.0;
     }
     return -0.0;
 }
@@ -1848,7 +1865,9 @@ livefractionPerBCID()
     if ( m_hasRetrievedLumiTool ) {
         return m_liveTool->livefractionPerBCID();
     } else {
-        ATH_MSG_FATAL("! Luminosity tool has been disabled ! livefractionPerBCID() can't work properly! ");
+        //ATH_MSG_FATAL("! Luminosity tool has been disabled ! livefractionPerBCID() can't work properly! ");
+        ATH_MSG_DEBUG("Warning: livefractionPerBCID() - luminosity tools are not retrieved or turned on (i.e. EnableLumi = False)");
+        return -1.0;
     }
     return -0.0;
 }
@@ -1861,7 +1880,9 @@ lbLumiWeight()
     if ( m_hasRetrievedLumiTool ) {
         return (lbAverageLuminosity()*lbDuration())*lbAverageLivefraction();
     } else{
-        ATH_MSG_FATAL("! Luminosity tool has been disabled ! lbLumiWeight() can't work properly! ");
+        //ATH_MSG_FATAL("! Luminosity tool has been disabled ! lbLumiWeight() can't work properly! ");
+        ATH_MSG_DEBUG("Warning: lbLumiWeight() - luminosity tools are not retrieved or turned on (i.e. EnableLumi = False)");
+        return -1.0;
     }
     return -0.0;
 }
@@ -1875,7 +1896,9 @@ lbDuration()
     if ( m_hasRetrievedLumiTool ) {
         return m_lumiTool->lbDuration();
     } else {
-        ATH_MSG_FATAL("! Luminosity tool has been disabled ! lbDuration() can't work properly! ");
+        //ATH_MSG_FATAL("! Luminosity tool has been disabled ! lbDuration() can't work properly! ");
+        ATH_MSG_DEBUG("Warning: lbDuration() - luminosity tools are not retrieved or turned on (i.e. EnableLumi = False)");
+        return -1.0;
     }
     return -0.0;
 }
@@ -2171,6 +2194,30 @@ parseList(const std::string& line, std::vector<std::string>& result) {
    return StatusCode::SUCCESS;
 }
 
+void
+ManagedMonitorToolBase::
+updateTriggersForGroups(std::vector<std::string>& vTrigChainNames) {
+  for (size_t i = 0; i < vTrigChainNames.size(); ++i) {
+    std::string& thisName = vTrigChainNames[i];
+    if (thisName.substr(0, 9) == "CATEGORY_") {
+      ATH_MSG_DEBUG("Found a trigger category: " << thisName << ". We will unpack it.");
+      std::vector<std::string> triggers = m_trigTranslator->translate(thisName.substr(9,std::string::npos));
+      std::ostringstream oss;
+      oss << "(";
+      for (size_t itrig = 0; itrig < triggers.size(); ++itrig) {
+	if (itrig != 0) { 
+	  oss << "|";
+	}
+	oss << triggers[itrig];
+      }
+      oss << ")";
+      // replace with new value
+      std::string newval = oss.str();
+      ATH_MSG_DEBUG("Replaced with " << newval);
+      vTrigChainNames[i] = newval;
+    }
+  }
+}
 
 ManagedMonitorToolBase::StreamNameFcn*
 ManagedMonitorToolBase::
diff --git a/Control/AthenaMonitoring/src/ManagedMonitorToolTest.cxx b/Control/AthenaMonitoring/src/ManagedMonitorToolTest.cxx
index f4e095d8eae..866cde61a70 100755
--- a/Control/AthenaMonitoring/src/ManagedMonitorToolTest.cxx
+++ b/Control/AthenaMonitoring/src/ManagedMonitorToolTest.cxx
@@ -48,6 +48,7 @@ ManagedMonitorToolTest( const std::string & type, const std::string & name,
    , m_managedHist_lumiBlock(0)
    , m_managedHist_eventsBlock(0)
    , m_managedHist_run(0)
+   , m_Lumi(0)
    , m_graph(0)
    , m_managedGraph(0)
    , m_ntuple(0)
@@ -179,9 +180,12 @@ bookHistograms( )
    m_managedHist2_lowStat = new TH1F ( "managedHist2_lowStat", "Managed Histogram, regHist Example 2; interval: lowStat", 5, 0.0, 5.0 );
 
    m_managedHist_lumiBlock  = new TH1F( "managedHist_lumiBlock", "Managed Histogram; interval: lumiBlock", 5, 0.0, 5.0 );
-   m_managedHist_eventsBlock  = new TH1F( "managedHist_eventsBlock", "Managed Histogram; interval: lumiBlock", 5, 0.0, 5.0 );
+   m_managedHist_eventsBlock  = new TH1F( "managedHist_eventsBlock", "Managed Histogram; interval: eventBlock", 5, 0.0, 5.0 );
    m_managedHist_run  = new TH1F( "managedHist0_run", "Managed Histogram; interval: run", 5, 0.0, 5.0 );
 
+   // Create luminosity histogram 
+   m_Lumi = new TH1F( "Avg_mu", "Average number of interactions", 100, 0, 100 );
+
    // Create MonGroup object for managing managed histograns from same group
    MonGroup managed_booking_lowStat( this, "Managed/Histograms", lowStat );   // to be re-booked every lowStat interval
 
@@ -202,6 +206,9 @@ bookHistograms( )
    MonGroup managed_eventsBlock(this, "Managed/Histograms", eventsBlock);    // to re-booked every eventsBlock
    regHist( m_managedHist_eventsBlock, managed_eventsBlock ).ignore();
 
+   // Register luminosity histogram
+   regHist( m_Lumi, managed_eventsBlock).ignore();
+
    MonGroup managed_booking_run( this, "Managed/Histograms", run);   // to be re-booked every run 
    regHist( m_managedHist_run, managed_booking_run ).ignore();
 
@@ -240,6 +247,15 @@ StatusCode
 ManagedMonitorToolTest::
 fillHistograms()
 {
+      // Fill average mu per bunch crossing
+      double lumiPerBCID = lbAverageInteractionsPerCrossing();
+      if (lumiPerBCID < 0) {
+          // no luminosity information or EnableLumi is set to False in the config
+          ATH_MSG_INFO("No luminosity information available or EnableLumi = False");
+      } else {
+         m_Lumi->Fill(lumiPerBCID);
+      }
+
    
       std::vector<TH1*>::const_iterator ensembleEnd = m_ensembles.end();
       for( std::vector<TH1*>::const_iterator i = m_ensembles.begin(); i != ensembleEnd; ++i ) {
diff --git a/Control/AthenaMonitoring/src/TriggerTranslatorSimple.cxx b/Control/AthenaMonitoring/src/TriggerTranslatorSimple.cxx
index 475bc92b7c5..6559a93e215 100644
--- a/Control/AthenaMonitoring/src/TriggerTranslatorSimple.cxx
+++ b/Control/AthenaMonitoring/src/TriggerTranslatorSimple.cxx
@@ -3,6 +3,8 @@
 */
 
 #include "AthenaMonitoring/TriggerTranslatorSimple.h"
+#include "boost/algorithm/string/split.hpp"
+#include "boost/algorithm/string/classification.hpp"
 
 TriggerTranslatorToolSimple::TriggerTranslatorToolSimple(const std::string& type,
 					     const std::string& name,
@@ -19,12 +21,15 @@ StatusCode TriggerTranslatorToolSimple::initialize() {
   std::vector<std::string> junk;
   //m_trigmap[""] = junk;
   for(const auto item : m_trigmap_property) {
-    std::cout << "Key " << item.first << " Value " << item.second << std::endl;
+    ATH_MSG_DEBUG( "Key " << item.first << " Value " << item.second << std::endl );
+    std::vector<std::string> triggers;
+    boost::split(triggers, item.second, boost::is_any_of(","));
+    m_trigmap[item.first] = triggers;
   }
   return StatusCode::SUCCESS;
 }
 
 
 const std::vector<std::string> TriggerTranslatorToolSimple::translate(const std::string& key) {
-  return m_trigmap[""];
+  return m_trigmap.at(key);
 }
-- 
GitLab