diff --git a/Control/AthenaMonitoringKernel/python/GenericMonitoringTool.py b/Control/AthenaMonitoringKernel/python/GenericMonitoringTool.py index 59bfc66dbd89178c6f64740a39e73a328aa347d9..31b426156ff4e355bb1bb0a606ca34c8e5980105 100644 --- a/Control/AthenaMonitoringKernel/python/GenericMonitoringTool.py +++ b/Control/AthenaMonitoringKernel/python/GenericMonitoringTool.py @@ -484,6 +484,11 @@ def defineHistogram(flags, varname, type='TH1F', path=None, assert type not in ['TEfficiency', 'TTree', 'TGraph'],'only default merge defined for non-histogram objects' settings['merge'] = merge + # LB histograms always need to be published online (ADHI-4947) + if settings['kLBNHistoryDepth']>0 and _isOnline(flags): + settings['kAlwaysCreate'] = True + log.debug('Setting kAlwaysCreate for lumiblock histogram "%s"', varname) + # Check that kLBNHistoryDepth and kLive are both non-negative assert settings['kLBNHistoryDepth']>=0, f'Histogram "{alias}" has invalid kLBNHistoryDepth.' assert settings['kLive']>=0, f'Histogram "{alias}" has invalid kLive.' diff --git a/Control/AthenaMonitoringKernel/test/test_defineHistogram.py b/Control/AthenaMonitoringKernel/test/test_defineHistogram.py index 920c3504f1c96ab362d5b64acbd0f97fbcfd0d50..0ebc782a3f7dd0290b808acfa566b876691e722c 100644 --- a/Control/AthenaMonitoringKernel/test/test_defineHistogram.py +++ b/Control/AthenaMonitoringKernel/test/test_defineHistogram.py @@ -154,6 +154,12 @@ class Test( unittest.TestCase ): true = '{"alias": "var", "allvars": ["var"], "convention": "", "merge": "", "path": "EXPERT", "title": "var", "treeDef": "", "type": "TH1F", "weight": "", "cutMask": "", "xarray": [], "xbins": 100, "xlabels": [], "xmax": 1.0, "xmin": 0.0, "xvar": "var", "yarray": [], "ybins": 0.0, "ylabels": [], "ymax": 0.0, "ymin": 0.0, "yvar": "", "zbins": 0.0, "zlabels": [], "zmax": 0.0, "zmin": 0.0, "zvar": "", "Sumw2": false, "kLBNHistoryDepth": 0, "kAddBinsDynamically": false, "kRebinAxes": false, "kCanRebin": false, "kVec": false, "kVecUO": false, "kCumulative": false, "kLive": 1, "kAlwaysCreate": false}' self.assertEqual(json.loads(check), json.loads(true)) + def test_LBN( self ): + flags = initConfigFlags() + flags.Common.isOnline = True + check = defineHistogram(flags, 'var', path='EXPERT', opt='kLBNHistoryDepth=1') + self.assertEqual(json.loads(check)['kAlwaysCreate'], True) + def test_badAlias( self ): flags = initConfigFlags() check = defineHistogram(flags, 'var;alias;more')