Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
9e55e7d
Add DQM booking helper functions to enable easier logarithmic booking
JanGerritSchulz Jul 27, 2026
b6a75fe
Add RefToBaseProd for vertex data formats
JanGerritSchulz Jul 27, 2026
6478631
Template the Vertex <-> TrackingVertex association data formats in or…
JanGerritSchulz Jul 27, 2026
d3c89d7
Implement function for determining the PdgId and pt of a TrackingVert…
JanGerritSchulz Jul 27, 2026
ce8589d
Enable VertexAssociation for secondary vertices
JanGerritSchulz Jul 28, 2026
280561b
Add VertexAssociatorEDProducer for creating the association maps for …
JanGerritSchulz Jul 28, 2026
f07691b
Add python configuration for base secondary vertex association
JanGerritSchulz Jul 28, 2026
ddd8833
Move plugins in Validation/RecoVertex into the plugins/ directory
JanGerritSchulz Jul 28, 2026
ded0dff
Create SVMonitoringBundle helpers class
JanGerritSchulz Jul 28, 2026
4d00849
Create SVResolutionBundle helpers class
JanGerritSchulz Jul 28, 2026
235d3c0
Create SVValidationStructs as internal structs representing simulated…
JanGerritSchulz Jul 28, 2026
8d829a6
Create SVTrackQualityBundle helpers class
JanGerritSchulz Jul 28, 2026
3809219
Create SVEfficiencyEligibility
JanGerritSchulz Jul 28, 2026
0644810
Implement a first version of a SecondaryVertexAnalyzerAlgo to DQM ana…
JanGerritSchulz Jul 28, 2026
ed063b8
Add corresponding SecondaryVertexAnalyzer plugin for SV validation
JanGerritSchulz Jul 28, 2026
4161a28
Move vertex associators in separate python config
JanGerritSchulz Jul 28, 2026
4e9399c
Add hlt SV associator configurations
JanGerritSchulz Jul 28, 2026
fd52711
Add HLTSecondaryVertexValidation sequence
JanGerritSchulz Jul 28, 2026
886df58
Add PostProcessor for secondary vertex validation
JanGerritSchulz Jul 28, 2026
3d11d57
Add HLT-specific configuation for SV validation post processing
JanGerritSchulz Jul 28, 2026
cc6c548
Include Secondary Vertex validation in central DQM validation for the…
JanGerritSchulz Jul 28, 2026
acac988
Propagate slight changes from vertex validation to track validation p…
JanGerritSchulz Jul 28, 2026
b7d0025
Fix header consistency in SVEfficiencyEligiblity
JanGerritSchulz Jul 28, 2026
ea96bdd
Fix vertex associator label in validation configs
JanGerritSchulz Jul 28, 2026
d8095f2
Move tpToRecoTrack associator for HLT general tracks to Validation/Re…
JanGerritSchulz Jul 28, 2026
9f1262c
Reduce log warnings for SV validation
JanGerritSchulz Aug 7, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
173 changes: 173 additions & 0 deletions DQMServices/Core/interface/DQMBookingHelpers.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
#ifndef DQMServices_Core_DQMBookingHelpers_h
#define DQMServices_Core_DQMBookingHelpers_h

// Package: DQMServices/Core
//
/**\file DQMBookingHelpers.h DQMServices/Core/interface/DQMBookingHelpers.h

Description: Utility functions for booking DQM histograms with non-standard
axis configurations, in particular logarithmic axis binning.

These supplement the standard DQMStore::IBooker interface, which
deliberately provides only plain ROOT-argument booking. Callers
that need log-scale axes can use these helpers to construct and
configure the underlying ROOT object before handing it to IBooker.

Motivation: The rebinXToLog / make1DIfLogX pattern was previously duplicated
across multiple validation packages (Validation/RecoTrack,
Validation/MuonIdentification, and others). Centralising it here
removes the duplication, ensures a single correct implementation
of the threading-safe booking pattern (see note below), and makes
log-scale booking discoverable for new DQM module authors.

Threading note:
rebinXToLog must be called before the histogram is registered with
IBooker, i.e. before book1D / book2D is called. Calling it after
booking (e.g. via getTH1()) is not thread-safe in stream-based
DQMEDAnalyzers because multiple streams may be booking
concurrently. The helpers below enforce the correct order by
constructing and configuring the ROOT object first, then passing
ownership to IBooker. See also:
https://github.com/cms-sw/cmssw/pull/29224

Usage:
#include "DQMServices/Core/interface/DQMBookingHelpers.h"
using namespace dqm::booking;

// 1D histogram with log X axis
auto h = book1DLogX(ibook, "name", "title;x;y", 50, 0.1, 1000.);

// 2D histogram, log X axis, called conditionally
auto h2 = book2DIfLogX(ibook, useLog, "name", "title", ...);
*/

#include "DQMServices/Core/interface/DQMStore.h"
#include "DQMServices/Core/interface/MonitorElement.h"

#include <memory>
#include <string>
#include <vector>

#include "TH1F.h"
#include "TH2F.h"
#include "TProfile.h"
#include "TMath.h"

namespace dqm {
namespace booking {

// =========================================================================
// Internal helpers — not part of the public interface
// =========================================================================

namespace detail {

/// Rebin the X axis of h to have logarithmically-spaced bin edges.
/// The axis min/max are interpreted as log10 values, consistent with
/// how TAxis stores them after a SetRangeUser call.
/// Must be called on the ROOT object BEFORE handing it to IBooker.
void rebinXToLog(TH1* h);

/// Rebin the Y axis of h to have logarithmically-spaced bin edges.
/// Must be called on the ROOT object BEFORE handing it to IBooker.
void rebinYToLog(TH1* h);

} // namespace detail

// =========================================================================
// Public booking helpers
// =========================================================================

using IBooker = dqm::reco::DQMStore::IBooker;
using ME = dqm::reco::MonitorElement;

// -------------------------------------------------------------------------
// 1D histograms
// -------------------------------------------------------------------------

/// Book a 1D histogram, applying log binning on the X axis if logx=true.
template <typename... Args>
inline ME* book1DIfLogX(IBooker& ibook, bool logx, Args&&... args) {
auto h = std::make_unique<TH1F>(std::forward<Args>(args)...);
if (logx)
detail::rebinXToLog(h.get());
const std::string name = h->GetName();
return ibook.book1D(name, h.release());
}

/// Book a 1D histogram with a logarithmic X axis.
template <typename... Args>
inline ME* book1DLogX(IBooker& ibook, Args&&... args) {
return book1DIfLogX(ibook, true, std::forward<Args>(args)...);
}

// -------------------------------------------------------------------------
// 2D histograms
// -------------------------------------------------------------------------

/// Book a 2D histogram, applying log binning on the X and Y axis if logx=true and logy=true.
template <typename... Args>
inline ME* book2DIfLogXIfLogY(IBooker& ibook, bool logx, bool logy, Args&&... args) {
auto h = std::make_unique<TH2F>(std::forward<Args>(args)...);
if (logx)
detail::rebinXToLog(h.get());
if (logy)
detail::rebinYToLog(h.get());
const std::string name = h->GetName();
return ibook.book2D(name, h.release());
}

/// Book a 2D histogram with a logarithmic X and Y axis.
template <typename... Args>
inline ME* book2DLogXLogY(IBooker& ibook, Args&&... args) {
return book2DIfLogXIfLogY(ibook, true, true, std::forward<Args>(args)...);
}

/// Book a 2D histogram, applying log binning on the X axis if logx=true.
template <typename... Args>
inline ME* book2DIfLogX(IBooker& ibook, bool logx, Args&&... args) {
return book2DIfLogXIfLogY(ibook, logx, false, std::forward<Args>(args)...);
}

/// Book a 2D histogram with a logarithmic X axis.
template <typename... Args>
inline ME* book2DLogX(IBooker& ibook, Args&&... args) {
return book2DIfLogX(ibook, true, std::forward<Args>(args)...);
}

/// Book a 2D histogram, applying log binning on the Y axis if logy=true.
template <typename... Args>
inline ME* book2DIfLogY(IBooker& ibook, bool logy, Args&&... args) {
return book2DIfLogXIfLogY(ibook, false, logy, std::forward<Args>(args)...);
}

/// Book a 2D histogram with a logarithmic Y axis.
template <typename... Args>
inline ME* book2DLogY(IBooker& ibook, Args&&... args) {
return book2DIfLogY(ibook, true, std::forward<Args>(args)...);
}

// -------------------------------------------------------------------------
// TProfile histograms
// -------------------------------------------------------------------------

/// Book a TProfile, applying log binning on the X axis if logx=true.
template <typename... Args>
inline ME* bookProfileIfLogX(IBooker& ibook, bool logx, Args&&... args) {
auto h = std::make_unique<TProfile>(std::forward<Args>(args)...);
if (logx)
detail::rebinXToLog(h.get());
const std::string name = h->GetName();
return ibook.bookProfile(name, h.release());
}

/// Book a TProfile with a logarithmic X axis.
template <typename... Args>
inline ME* bookProfileLogX(IBooker& ibook, Args&&... args) {
return bookProfileIfLogX(ibook, true, std::forward<Args>(args)...);
}

} // namespace booking
} // namespace dqm

#endif // DQMServices_Core_DQMBookingHelpers_h
38 changes: 38 additions & 0 deletions DQMServices/Core/src/DQMBookingHelpers.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#include "DQMServices/Core/interface/DQMBookingHelpers.h"

namespace dqm {
namespace booking {

// =========================================================================
// Internal helpers — not part of the public interface
// =========================================================================

namespace {
// Resets the bin edges for a given axis to log10 scale.
void rebinAxisToLog(TAxis* axis) {
const int bins = axis->GetNbins();
const double from = TMath::Log10(axis->GetXmin());
const double to = TMath::Log10(axis->GetXmax());
const double width = (to - from) / bins;
std::vector<double> new_bins(bins + 1, 0.0);
for (int i = 0; i <= bins; ++i)
new_bins[i] = TMath::Power(10, from + i * width);
axis->Set(bins, new_bins.data());
}
} // namespace

namespace detail {

void rebinXToLog(TH1* h) {
TAxis* axis = h->GetXaxis();
rebinAxisToLog(axis);
}

void rebinYToLog(TH1* h) {
TAxis* axis = h->GetYaxis();
rebinAxisToLog(axis);
}

} // namespace detail
} // namespace booking
} // namespace dqm
1 change: 1 addition & 0 deletions DataFormats/Candidate/src/classes_def.xml
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@
<class name="edm::reftobase::RefVectorHolder<reco::CompositeCandidateRefVector>" />

<class name="reco::VertexCompositeCandidateCollection" />
<class name="edm::RefToBaseProd<reco::VertexCompositePtrCandidate>" />
<class name="edm::Wrapper<reco::VertexCompositeCandidateCollection>" />
<class name="edm::reftobase::Holder<reco::io_v1::Candidate, reco::VertexCompositeCandidateRef>" />
<class name="edm::reftobase::RefHolder<reco::VertexCompositeCandidateRef>" />
Expand Down
1 change: 1 addition & 0 deletions DataFormats/VertexReco/src/classes_def.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<class name="edm::refhelper::FindUsingAdvance<vector<reco::io_v1::Vertex>,reco::io_v1::Vertex>"/>
<class name="edm::Ref<std::vector<reco::io_v1::Vertex>, reco::io_v1::Vertex, edm::refhelper::FindUsingAdvance<std::vector<reco::io_v1::Vertex>, reco::io_v1::Vertex> >" />
<class name="edm::RefProd<std::vector<reco::io_v1::Vertex> >" />
<class name="edm::RefToBaseProd<reco::io_v1::Vertex>" />
<class name="edm::RefVector<std::vector<reco::io_v1::Vertex>, reco::io_v1::Vertex, edm::refhelper::FindUsingAdvance<std::vector<reco::io_v1::Vertex>, reco::io_v1::Vertex> >" />
<class name="reco::NuclearInteraction" ClassVersion="3">
<version ClassVersion="3" checksum="508061808"/>
Expand Down
2 changes: 2 additions & 0 deletions HLTriggerOffline/Common/python/HLTValidationHarvest_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from HLTriggerOffline.SMP.HLTSMPPostVal_cff import *
from Validation.RecoTrack.HLTpostProcessorTracker_cfi import *
from Validation.RecoVertex.HLTpostProcessorVertex_cfi import *
from Validation.RecoVertex.HLTSecondaryVertexPostProcessor_cff import *
#from HLTriggerOffline.Common.PostProcessorExample_cfi import *
from HLTriggerOffline.Common.HLTValidationQT_cff import *
from HLTriggerOffline.Btag.HltBtagPostValidation_cff import *
Expand All @@ -24,6 +25,7 @@
postProcessorHLTtrackingSequence
+postProcessorHLTvertexing
+postProcessorHLTvertexingReconstructableSim
+HLTSecondaryVertexPostProcessorSequence
+HLTMuonPostVal
+HLTTauPostVal
+EgammaPostVal
Expand Down
2 changes: 2 additions & 0 deletions HLTriggerOffline/Common/python/HLTValidation_cff.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from Validation.RecoTrack.HLTmultiTrackValidator_cff import *
from Validation.RecoVertex.HLTmultiPVvalidator_cff import *
from Validation.RecoVertex.HLTSecondaryVertexValidation_cff import *
from HLTriggerOffline.Muon.HLTMuonVal_cff import *
from HLTriggerOffline.Tau.Validation.HLTTauValidation_cff import *
from HLTriggerOffline.Egamma.EgammaValidationAutoConf_cff import *
Expand Down Expand Up @@ -54,6 +55,7 @@
hltassociation = cms.Sequence(
hltMultiTrackValidation
+hltMultiPVValidation
+HLTSecondaryVertexValidation
+egammaSelectors
+ExoticaValidationProdSeq
+hltMultiTrackValidationGsfTracks
Expand Down
20 changes: 16 additions & 4 deletions SimDataFormats/Associations/interface/VertexAssociation.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifndef SimDataFormats_Associations_VertexAssociation_h
#define SimDataFormats_Associations_VertexAssociation_h

#include "DataFormats/Candidate/interface/VertexCompositePtrCandidate.h"
#include "DataFormats/Common/interface/AssociationMap.h"
#include "DataFormats/Common/interface/OneToManyWithQualityGeneric.h"
#include "DataFormats/Common/interface/View.h"
Expand All @@ -10,10 +11,21 @@
#include "SimDataFormats/TrackingAnalysis/interface/TrackingVertexContainer.h"

namespace reco {
typedef edm::AssociationMap<edm::OneToManyWithQuality<TrackingVertexCollection, edm::View<reco::Vertex>, double>>
VertexSimToRecoCollection;
typedef edm::AssociationMap<edm::OneToManyWithQuality<edm::View<reco::Vertex>, TrackingVertexCollection, double>>
VertexRecoToSimCollection;

template <typename T_VertexColl>
using VertexSimToRecoCollectionT =
edm::AssociationMap<edm::OneToManyWithQuality<TrackingVertexCollection, T_VertexColl, double>>;

using VertexSimToRecoCollection = VertexSimToRecoCollectionT<edm::View<reco::Vertex>>;
using VertexSimToRecoCollectionCPC = VertexSimToRecoCollectionT<edm::View<reco::VertexCompositePtrCandidate>>;

template <typename T_VertexColl>
using VertexRecoToSimCollectionT =
edm::AssociationMap<edm::OneToManyWithQuality<T_VertexColl, TrackingVertexCollection, double>>;

using VertexRecoToSimCollection = VertexRecoToSimCollectionT<edm::View<reco::Vertex>>;
using VertexRecoToSimCollectionCPC = VertexRecoToSimCollectionT<edm::View<reco::VertexCompositePtrCandidate>>;

} // namespace reco

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,15 @@
#include "DataFormats/Common/interface/Uninitialized.h"

namespace reco {
template <typename VertexCollection>
class VertexToTrackingVertexAssociator {
public:
using VertexType = typename VertexCollection::value_type;
using SimToRecoCollection = VertexToTrackingVertexAssociatorBaseImpl<VertexCollection>::SimToRecoCollection;
using RecoToSimCollection = VertexToTrackingVertexAssociatorBaseImpl<VertexCollection>::RecoToSimCollection;

#ifndef __GCCXML__
VertexToTrackingVertexAssociator(std::unique_ptr<reco::VertexToTrackingVertexAssociatorBaseImpl>);
VertexToTrackingVertexAssociator(std::unique_ptr<reco::VertexToTrackingVertexAssociatorBaseImpl<VertexCollection>>);
#endif
VertexToTrackingVertexAssociator() = delete;
explicit VertexToTrackingVertexAssociator(edm::Uninitialized) noexcept {};
Expand All @@ -25,21 +30,21 @@ namespace reco {
// ---------- const member functions ---------------------
/// compare reco to sim the handle of reco::Vertex and TrackingVertex
/// collections
reco::VertexRecoToSimCollection associateRecoToSim(const edm::Handle<edm::View<reco::Vertex>> &vCH,
const edm::Handle<TrackingVertexCollection> &tVCH) const {
RecoToSimCollection associateRecoToSim(const edm::Handle<edm::View<VertexType>> &vCH,
const edm::Handle<TrackingVertexCollection> &tVCH) const {
return m_impl->associateRecoToSim(vCH, tVCH);
}

/// compare reco to sim the handle of reco::Vertex and TrackingVertex
/// collections
reco::VertexSimToRecoCollection associateSimToReco(const edm::Handle<edm::View<reco::Vertex>> &vCH,
const edm::Handle<TrackingVertexCollection> &tVCH) const {
SimToRecoCollection associateSimToReco(const edm::Handle<edm::View<VertexType>> &vCH,
const edm::Handle<TrackingVertexCollection> &tVCH) const {
return m_impl->associateSimToReco(vCH, tVCH);
}

private:
// ---------- member data --------------------------------
std::unique_ptr<VertexToTrackingVertexAssociatorBaseImpl> m_impl;
std::unique_ptr<VertexToTrackingVertexAssociatorBaseImpl<VertexCollection>> m_impl;
};
} // namespace reco

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,30 @@
#include "SimDataFormats/Associations/interface/VertexAssociation.h"

namespace reco {
template <typename VertexCollection>
class VertexToTrackingVertexAssociatorBaseImpl {
public:
using VertexType = typename VertexCollection::value_type;
// association maps for templated Vertex <-> TrackingVertex
using SimToRecoCollection =
edm::AssociationMap<edm::OneToManyWithQuality<TrackingVertexCollection, edm::View<VertexType>, double>>;
using RecoToSimCollection =
edm::AssociationMap<edm::OneToManyWithQuality<edm::View<VertexType>, TrackingVertexCollection, double>>;

/// Constructor
VertexToTrackingVertexAssociatorBaseImpl();
/// Destructor
virtual ~VertexToTrackingVertexAssociatorBaseImpl();

/// compare reco to sim the handle of reco::Vertex and TrackingVertex
/// compare reco to sim the handle of Vertex and TrackingVertex
/// collections
virtual reco::VertexRecoToSimCollection associateRecoToSim(
const edm::Handle<edm::View<reco::Vertex>> &vCH, const edm::Handle<TrackingVertexCollection> &tVCH) const = 0;
virtual RecoToSimCollection associateRecoToSim(const edm::Handle<edm::View<VertexType>> &,
const edm::Handle<TrackingVertexCollection> &) const = 0;

/// compare reco to sim the handle of reco::Vertex and TrackingVertex
/// compare sim to reco the handle of Vertex and TrackingVertex
/// collections
virtual reco::VertexSimToRecoCollection associateSimToReco(
const edm::Handle<edm::View<reco::Vertex>> &vCH, const edm::Handle<TrackingVertexCollection> &tVCH) const = 0;
virtual SimToRecoCollection associateSimToReco(const edm::Handle<edm::View<VertexType>> &,
const edm::Handle<TrackingVertexCollection> &) const = 0;
};
} // namespace reco

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#include "SimDataFormats/Associations/interface/VertexToTrackingVertexAssociator.h"

reco::VertexToTrackingVertexAssociator::VertexToTrackingVertexAssociator(
std::unique_ptr<reco::VertexToTrackingVertexAssociatorBaseImpl> iImpl)
template <typename VertexCollection>
reco::VertexToTrackingVertexAssociator<VertexCollection>::VertexToTrackingVertexAssociator(
std::unique_ptr<reco::VertexToTrackingVertexAssociatorBaseImpl<VertexCollection>> iImpl)
: m_impl{std::move(iImpl)} {}

template class reco::VertexToTrackingVertexAssociator<std::vector<reco::Vertex>>;
template class reco::VertexToTrackingVertexAssociator<std::vector<reco::VertexCompositePtrCandidate>>;
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#include "SimDataFormats/Associations/interface/VertexToTrackingVertexAssociatorBaseImpl.h"

reco::VertexToTrackingVertexAssociatorBaseImpl::VertexToTrackingVertexAssociatorBaseImpl() {}
template <typename VertexCollection>
reco::VertexToTrackingVertexAssociatorBaseImpl<VertexCollection>::VertexToTrackingVertexAssociatorBaseImpl() {}

reco::VertexToTrackingVertexAssociatorBaseImpl::~VertexToTrackingVertexAssociatorBaseImpl() {}
template <typename VertexCollection>
reco::VertexToTrackingVertexAssociatorBaseImpl<VertexCollection>::~VertexToTrackingVertexAssociatorBaseImpl() {}

template class reco::VertexToTrackingVertexAssociatorBaseImpl<std::vector<reco::Vertex>>;
template class reco::VertexToTrackingVertexAssociatorBaseImpl<std::vector<reco::VertexCompositePtrCandidate>>;
Loading