From 5fb7903ea2f067af9db1cb4636987d390e7bd8c0 Mon Sep 17 00:00:00 2001 From: Sebastien Wertz Date: Thu, 27 Oct 2022 16:07:15 +0200 Subject: [PATCH] fix matching between pat trigger objects and L1 objects --- PhysicsTools/NanoAOD/plugins/TriggerObjectTableProducer.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/PhysicsTools/NanoAOD/plugins/TriggerObjectTableProducer.cc b/PhysicsTools/NanoAOD/plugins/TriggerObjectTableProducer.cc index e13d8edcdaa9a..e0e7ebcd80ec6 100644 --- a/PhysicsTools/NanoAOD/plugins/TriggerObjectTableProducer.cc +++ b/PhysicsTools/NanoAOD/plugins/TriggerObjectTableProducer.cc @@ -121,6 +121,8 @@ void TriggerObjectTableProducer::produce(edm::Event &iEvent, const edm::EventSet for (const auto &sel : sels_) { if (sel.match(obj) && (sel.skipObjectsNotPassingQualityBits ? (int(sel.qualityBits(obj)) > 0) : true)) { selected.emplace_back(&obj, &sel); + // cave canem: the object will be taken by whichever selection it matches first, so it + // depends on the order of the selections in the VPSet break; } } @@ -254,6 +256,7 @@ void TriggerObjectTableProducer::produce(edm::Event &iEvent, const edm::EventSet const auto &seed = l1obj.first; float dr2 = deltaR2(seed, obj); if (dr2 < best && sel.l1cut(seed)) { + best = dr2; l1pt[i] = seed.pt(); l1iso[i] = l1obj.second; l1charge[i] = seed.charge(); @@ -266,6 +269,7 @@ void TriggerObjectTableProducer::produce(edm::Event &iEvent, const edm::EventSet const auto &seed = l1obj.first; float dr2 = deltaR2(seed, obj); if (dr2 < best && sel.l1cut_2(seed)) { + best = dr2; l1pt_2[i] = seed.pt(); } } @@ -275,6 +279,7 @@ void TriggerObjectTableProducer::produce(edm::Event &iEvent, const edm::EventSet for (const auto &seed : *src) { float dr2 = deltaR2(seed, obj); if (dr2 < best && sel.l2cut(seed)) { + best = dr2; l2pt[i] = seed.pt(); } }