From 17beca27e9f9b9fb262c0363d66299fbc35172a8 Mon Sep 17 00:00:00 2001 From: Marco Clemencic Date: Tue, 11 Nov 2025 09:34:02 +0100 Subject: [PATCH] VertexCompare: fix handling of overflow bin in names and titles Fix formatHistoTitle to properly handle the overflow case and introduce formatHistoName to produce a better name for the overflow histograms. Replace inline fmt::format calls for dx/dy/dz names with the new helper. --- Tr/TrackMonitors/src/VertexCompare.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Tr/TrackMonitors/src/VertexCompare.cpp b/Tr/TrackMonitors/src/VertexCompare.cpp index 948de750374..9aaa5016ae5 100644 --- a/Tr/TrackMonitors/src/VertexCompare.cpp +++ b/Tr/TrackMonitors/src/VertexCompare.cpp @@ -41,7 +41,13 @@ using VertexType = Vertices::value_type; namespace { constexpr auto ntrack_bins = std::array{ 3.5, 15.5, 30.5, 45.5, 58.5, 70.5 }; std::string formatHistoTitle( std::string_view title, std::size_t idx ) { - return fmt::format( "{}, ntracks > {} & {} {} & {} {}", title, ntrack_bins[idx] ); + } + std::string formatHistoName( std::string_view title, std::size_t idx ) { + return idx < ntrack_bins.size() - 1 ? fmt::format( "{}_Monitoring_ntracks_bin{}", title, idx ) + : fmt::format( "{}_Monitoring_ntracks_overflow", title ); } } // namespace @@ -266,15 +272,15 @@ private: MonitoringHistos( const VertexCompare* owner ) : m_histo_nTracksBins_dx{ owner, - []( size_t idx ) { return fmt::format( "dx_Monitoring_ntracks_bin{}", idx ); }, + []( size_t idx ) { return formatHistoName( "dx", idx ); }, []( size_t idx ) { return formatHistoTitle( "dx, mm", idx ); }, { 50, -0.15, 0.15 } } , m_histo_nTracksBins_dy{ owner, - []( size_t idx ) { return fmt::format( "dy_Monitoring_ntracks_bin{}", idx ); }, + []( size_t idx ) { return formatHistoName( "dy", idx ); }, []( size_t idx ) { return formatHistoTitle( "dy, mm", idx ); }, { 50, -0.15, 0.15 } } , m_histo_nTracksBins_dz{ owner, - []( size_t idx ) { return fmt::format( "dz_Monitoring_ntracks_bin{}", idx ); }, + []( size_t idx ) { return formatHistoName( "dz", idx ); }, []( size_t idx ) { return formatHistoTitle( "dz, mm", idx ); }, { 50, -1.5, 1.5 } } , m_histo_pullx_Monitoring{ owner, "pullx_Monitoring", "pull x", { 20, -5, 5 } } -- GitLab