diff --git a/Control/AthenaMonitoring/python/ExampleMonitorAlgorithm.py b/Control/AthenaMonitoring/python/ExampleMonitorAlgorithm.py index fb5c16d2efac5a4d0bc94e4e8822af582eaa3fb8..c41366416bc1231bb09da3f468f5f51992425859 100644 --- a/Control/AthenaMonitoring/python/ExampleMonitorAlgorithm.py +++ b/Control/AthenaMonitoring/python/ExampleMonitorAlgorithm.py @@ -79,6 +79,8 @@ def ExampleMonitoringConfig(inputFlags): path='ToRuleThemAll',xbins=40,xmin=0.0,xmax=80.0) myGroup.defineHistogram('lb', title='Luminosity Block;lb;Events', path='ToFindThem',xbins=1000,xmin=-0.5,xmax=999.5,weight='testweight') + myGroup.defineHistogram('random;random2', title='LB;x;Events', + path='ToBringThemAll',xbins=30,xmin=0,xmax=1,opt='kLBNHistoryDepth=10') myGroup.defineHistogram('random', title='title;x;y',path='ToBringThemAll', xbins=[0,.1,.2,.4,.8,1.6]) myGroup.defineHistogram('random,pT', type='TH2F', title='title;x;y',path='ToBringThemAll', diff --git a/Control/AthenaMonitoring/share/test_unit_ExampleMonitorAlgorithm.ref b/Control/AthenaMonitoring/share/test_unit_ExampleMonitorAlgorithm.ref index 825a5aff71da852f67904041287bc24fa277c443..0c725ce1863dcc959e9d3298eb350686408ce2ff 100644 --- a/Control/AthenaMonitoring/share/test_unit_ExampleMonitorAlgorithm.ref +++ b/Control/AthenaMonitoring/share/test_unit_ExampleMonitorAlgorithm.ref @@ -1,10 +1,11 @@ TH1F /run_311321/top/run: 4000554 uncompressed, 17768 on file (hash 2879974139) TEfficiency /run_311321/OneRing/AndInTheDarkness/random_vs_pT_vs_pT_passed: 21034 uncompressed, 1551 on file (hash 3769596744) -TTree /run_311321/OneRing/BindThem/testtree: 2979 uncompressed, 857 on file (hash 3604726262) +TTree /run_311321/OneRing/BindThem/testtree: 2979 uncompressed, 856 on file (hash 3604726262) TEfficiency /run_311321/OneRing/AndInTheDarkness/pT_vs_pT_passed: 2965 uncompressed, 684 on file (hash 3294946318) TH2F /run_311321/OneRing/ToBringThemAll/pT_vs_random: 909 uncompressed, 426 on file (hash 552182390) TH1F /run_311321/OneRing/ToFindThem/lb: 12574 uncompressed, 387 on file (hash 3672452440) TH1F /run_311321/OneRing/AndInTheDarkness/pT_with_cut: 759 uncompressed, 356 on file (hash 3784147481) +TH1F /run_311321/OneRing/ToBringThemAll/random2: 668 uncompressed, 315 on file (hash 2041017371) TH1F /run_311321/OneRing/ToRuleThemAll/lumiPerBCID_merge: 748 uncompressed, 304 on file (hash 1181712869) TH1F /run_311321/OneRing/ToBringThemAll/random: 613 uncompressed, 298 on file (hash 1269065538) TH1F /run_311321/OneRing/ToRuleThemAll/lumiPerBCID: 742 uncompressed, 297 on file (hash 3154673526) diff --git a/Control/AthenaMonitoringKernel/AthenaMonitoringKernel/GenericMonitoringTool.h b/Control/AthenaMonitoringKernel/AthenaMonitoringKernel/GenericMonitoringTool.h index 946db53bc492caeb9ba24951c087cf0c503af5bf..6bd37a0fbec68b6220fc1bc88eed5a2f9717d0fa 100644 --- a/Control/AthenaMonitoringKernel/AthenaMonitoringKernel/GenericMonitoringTool.h +++ b/Control/AthenaMonitoringKernel/AthenaMonitoringKernel/GenericMonitoringTool.h @@ -78,6 +78,7 @@ private: Gaudi::Property<std::string> m_histoPath { this, "HistPath", {}, "Directory for histograms [name of parent if not set]" }; Gaudi::Property<std::vector<std::string> > m_histograms { this, "Histograms", {}, "Definitions of histograms"}; Gaudi::Property<bool> m_explicitBooking { this, "ExplicitBooking", false, "Do not create histograms automatically in initialize but wait until the method book is called." }; + Gaudi::Property<bool> m_failOnEmpty { this, "FailOnEmpty", true, "Fail in initialize() if no histograms defined" }; std::unordered_map<std::string, std::vector<std::shared_ptr<Monitored::HistogramFiller>>> m_fillerMap; //!< map from variables to fillers mutable std::mutex m_fillMutex; diff --git a/Control/AthenaMonitoringKernel/src/GenericMonitoringTool.cxx b/Control/AthenaMonitoringKernel/src/GenericMonitoringTool.cxx index 77dadc9eecd213d9f38123ddef57aabfd37a2c42..15bc0bb6aef566f0192a28dfbfb613a6ada3d87f 100644 --- a/Control/AthenaMonitoringKernel/src/GenericMonitoringTool.cxx +++ b/Control/AthenaMonitoringKernel/src/GenericMonitoringTool.cxx @@ -85,7 +85,7 @@ StatusCode GenericMonitoringTool::book() { ATH_MSG_DEBUG( "Monitoring for variable " << def.name << " prepared" ); } - if ( fillers.empty() ) { + if ( fillers.empty() && m_failOnEmpty ) { std::string hists; for (const auto &h : m_histograms) hists += (h+","); ATH_MSG_ERROR("No monitored variables created based on histogram definition: [" << hists <<