diff --git a/GaudiCoreSvc/src/MessageSvc/MessageSvcSink.cpp b/GaudiCoreSvc/src/MessageSvc/MessageSvcSink.cpp index 6b814e4b3ea32004181a9cc260975e16076277b9..4260c0576eec86f0d06d3d63a6e94baa8429ca3f 100644 --- a/GaudiCoreSvc/src/MessageSvc/MessageSvcSink.cpp +++ b/GaudiCoreSvc/src/MessageSvc/MessageSvcSink.cpp @@ -298,7 +298,10 @@ void Gaudi::Monitoring::MessageSvcSink::flush( bool ) { if ( binWriter != binRegistry.end() ) { auto index = binWriter->second.first; ++nbNonEmptyEntities[index]; - curLog[index] << "\n" << binWriter->second.second( name, ent, m_histoStringsWidth ); + std::string logLine = binWriter->second.second( name, ent, m_histoStringsWidth ); + if ( logLine.size() > 0 ) { + curLog[index] << "\n" << logLine; + } } else { // use json representation of the entity nlohmann::json const j = ent; @@ -311,21 +314,22 @@ void Gaudi::Monitoring::MessageSvcSink::flush( bool ) { bool isProfile = subtype.substr( 0, 15 ) == "WeightedProfile" || subtype.substr( 0, 7 ) == "Profile"; unsigned int index = ( isProfile ? 3 : 0 ) + d; auto title = j.at( "title" ).get<std::string>(); + std::string logLine{""}; switch ( d ) { case 1: - curLog[index] << "\n" - << Gaudi::Histograming::Sink::printHistogram1D( type, name, title, j, m_histoStringsWidth ); + logLine = Gaudi::Histograming::Sink::printHistogram1D( type, name, title, j, m_histoStringsWidth ); break; case 2: - curLog[index] << "\n" - << Gaudi::Histograming::Sink::printHistogram2D( type, name, title, j, m_histoStringsWidth ); + logLine = Gaudi::Histograming::Sink::printHistogram2D( type, name, title, j, m_histoStringsWidth ); break; case 3: - curLog[index] << "\n" - << Gaudi::Histograming::Sink::printHistogram3D( type, name, title, j, m_histoStringsWidth ); + logLine = Gaudi::Histograming::Sink::printHistogram3D( type, name, title, j, m_histoStringsWidth ); break; } - ++nbNonEmptyEntities[index]; + if ( logLine.size() > 0 ) { + curLog[index] << "\n" << logLine; + ++nbNonEmptyEntities[index]; + } } } else { // regular counter. Is current counter empty ? diff --git a/GaudiKernel/include/Gaudi/Histograming/Sink/Utils.h b/GaudiKernel/include/Gaudi/Histograming/Sink/Utils.h index 6734a87fabfeaa53f081da3b267801a4c8e96f31..9ba32bb52d0c5835391ea483d6af0395d28bc2d0 100644 --- a/GaudiKernel/include/Gaudi/Histograming/Sink/Utils.h +++ b/GaudiKernel/include/Gaudi/Histograming/Sink/Utils.h @@ -639,8 +639,7 @@ namespace Gaudi::Histograming::Sink { } std::string ftitle = detail::formatTitle( gaudiHisto.title(), stringsWidth - 2 ); if ( nEntries == 0 ) { - return fmt::format( fmt::runtime( detail::histo1DFormatting ), name, stringsWidth, stringsWidth, ftitle, - stringsWidth, detail::IntWithFixedWidth{}, 0.0, 0.0, 0.0, 0.0 ); + return ""; } Arithmetic meanX = sumX / nEntries; Arithmetic sigmaX2 = sum2X / nEntries - meanX * meanX;