Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
92 commits
Select commit Hold shift + click to select a range
30207b9
L1TSC82ProngJetModel (#150)
henripetrow May 4, 2026
8f89e86
TM18 is now the default configuration for all serenity modules
cerminar Apr 30, 2026
1c4c42c
rebase NN vtx Emu to latest p2l1pfp
Chriisbrown May 5, 2026
91e2644
Format changes
Chriisbrown May 5, 2026
1c28e9c
Apply suggestion for printing model name from code review
Chriisbrown Jun 5, 2026
6752191
first copilot comments
Chriisbrown Jun 5, 2026
f9bf6f6
remove magic number bin iteration
Chriisbrown Jun 5, 2026
0ef68dc
Update path for including v0 NNvtx model for emulator in CC
Chriisbrown Jun 5, 2026
f087803
Attempt to use sizeof for HLS compilation
Chriisbrown Jun 6, 2026
c7013ce
Use correct namespace for cms-hls4ml model version
Chriisbrown Jun 6, 2026
55373d7
Use emulator model's input type
Chriisbrown Jun 6, 2026
d906940
add option for TM18 tdr regionizer
jmitrevs Jun 13, 2025
6c4f4a2
stapshot of work towards TM18 GCT
jmitrevs Oct 31, 2025
9c4d764
copy changes in Phase2L1ParticleFlow from 151x_bar_cl1_tm18_gct
jmitrevs Jan 6, 2026
027fede
make it compile
jmitrevs Jan 6, 2026
a83e599
first version with tdr_alt regionizer
jmitrevs Jan 11, 2026
ff9b97c
fix compilation issues
jmitrevs Jan 11, 2026
b4070ac
testing new EM and PF digi cluster collection for TMI18
pallabidas Jan 21, 2026
553b374
PR comments from Jovan and Gianluca
pallabidas Feb 2, 2026
afbd872
geometry fixes for EG and PF cluster digis
pallabidas Feb 8, 2026
17f6ec6
fix compilation
jmitrevs Feb 11, 2026
e025575
remove commented out code
jmitrevs Feb 12, 2026
b3775c0
snapshot of updating configuration
jmitrevs Feb 13, 2026
bfc5283
a few more configuration fixes
jmitrevs Feb 14, 2026
fd27e9f
updates to using alt tdr regionizer
jmitrevs Feb 16, 2026
064cc8b
varous bug fixes
jmitrevs Feb 17, 2026
6b164cc
update calo building--had commented out too much
jmitrevs Feb 17, 2026
88538ad
fix a number of logical vs physical and sorting bugs; still not fully…
jmitrevs Feb 19, 2026
46b7372
fix ieta vs iphi confusion
jmitrevs Feb 19, 2026
2168cc0
bug fix in calo cluster phi values, integrate PF/had clusters into La…
pallabidas Feb 23, 2026
b970074
Functioning version of TDR regionizer, but with lots of debug stateme…
jmitrevs Feb 25, 2026
6db9a05
re-enable most of the algorithms, remove extra printouts
jmitrevs Feb 25, 2026
1f38f80
fix tracker pattern file order configuration, extra debugging printouts
jmitrevs Feb 25, 2026
992cc9a
make calo_links function a member function
jmitrevs Feb 26, 2026
eb7bb33
Change all the tdr_alt back to tdr.
jmitrevs Feb 26, 2026
2eb2140
Changed mainly debug output, add tentative SR ordering (not verified)
jmitrevs Feb 27, 2026
18d4b0e
Swap slr3 and slr1 mapping to phi, switch to returning physical links
jmitrevs Mar 2, 2026
ba87280
minor fixes for pattern writer
jmitrevs Mar 2, 2026
0736331
fix output order of pattern files--was using map in the wrong direction
jmitrevs Mar 12, 2026
5ac38f3
add pt=0 throwout matching to how it's done in the firmware
jmitrevs Mar 13, 2026
4210663
update GCT converter emulation
jmitrevs Mar 13, 2026
d567f5f
add a divide by 0 catch for relative iso
jmitrevs Mar 15, 2026
7ec6762
fix relative iso for GCT EM clusters
jmitrevs Mar 18, 2026
958a942
update gct em converter emulaiton
jmitrevs Mar 18, 2026
137b5a4
model virtual fibers on one physical fiber "bundle" in emulation
jmitrevs Mar 20, 2026
f7c0165
fix pattern file configuration (and obsolete comment in source code)
jmitrevs Mar 26, 2026
e6415e6
updates for rel iso and hoe, rename TMI18 to TM18
pallabidas Mar 19, 2026
f28cbf9
change default value of fb
pallabidas Mar 23, 2026
3dd7522
update hoe for GCT tower
pallabidas Mar 26, 2026
c99313a
fix matching with pf input/output
jmitrevs Apr 9, 2026
a76cfcd
add egamma debug output
jmitrevs Apr 12, 2026
2be6f65
try to make egamma match
jmitrevs Apr 14, 2026
a215786
fix the pattern file writer
jmitrevs Apr 16, 2026
70ca310
fix egamma sort configuration
jmitrevs Apr 20, 2026
9fe43fd
PF cluster corrections
pallabidas Apr 30, 2026
9fa6fc3
corrections after EM corrections are applied
pallabidas May 2, 2026
1e6b558
scram code format changes
jmitrevs May 4, 2026
75fb582
fix copilot suggestions
jmitrevs May 5, 2026
ff65c30
initial attempt towards a working config
cerminar May 5, 2026
09cd981
Fix cluster reference
cerminar May 6, 2026
eece1ce
Fix handling of newly added data-members in copy and move operations
cerminar May 6, 2026
587dd93
Temporarily disable serenity barrel pattern files
cerminar May 6, 2026
3161093
add missing algorithm include (#27)
jmitrevs May 11, 2026
4910699
Fix eta conversion in digitization GCT EM cluster
cerminar May 12, 2026
60ef1e0
Fix relative isolation for EM clusters
cerminar May 15, 2026
d4cc97c
GCT EM correction file from Federica/Piero
pallabidas May 15, 2026
baccb75
Fix showershape rounding
cerminar May 19, 2026
6114a01
Temporary workaround for iso variable
cerminar May 19, 2026
8d467d1
Call L1Candidate constructor and fix eta for negative values
cerminar May 26, 2026
cfedaba
Improve workaround
cerminar May 26, 2026
2b6a0ad
Implement GT link as per interface document and adapt routing for new…
cerminar May 7, 2026
272d3ab
Remove debug verbosity
cerminar May 29, 2026
07f90d6
code format
cerminar May 29, 2026
2ca671b
updated hadronic corrections
pallabidas Jun 1, 2026
436db02
update tkele EM model
cerminar Jun 2, 2026
876f362
Foton WP now matches the suggestion of using looseTk WP.
cerminar Jun 5, 2026
405b103
Fix em pt for calibration
cerminar Jun 5, 2026
7c8b2c9
Make constant static
cerminar Jun 5, 2026
bb87eb3
Cleanup uneeded headers and includes
cerminar Jun 5, 2026
8641895
add missing CMS Exception header to TDR regionizer elements
jmitrevs Jun 5, 2026
44b23ca
automatic scram code-format checks
jmitrevs Jun 5, 2026
32c6722
update comments to be correct, remove unneeded include
jmitrevs Jun 5, 2026
3a4791c
Futher fix for GCT Had calibration
cerminar Jun 8, 2026
a2534f6
updated with calibration bugfix
pallabidas Jun 9, 2026
4d2ce58
corrections using pt02 as reference
pallabidas Jun 10, 2026
ee47009
tweak tkele EB WP
cerminar Jun 11, 2026
f16ec01
rounding to HW values
cerminar Jun 17, 2026
d585748
code-checks
cerminar Jun 18, 2026
5800c3d
Added EM barrel calibs & implementation of the tkele pt regression @ …
pviscone Jun 23, 2025
a9c75a9
add pset descriptions
cerminar Jun 17, 2026
d43a9d8
codeformat
cerminar Jun 22, 2026
8975514
codeformat NNVTX
cerminar Jun 22, 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
7 changes: 4 additions & 3 deletions DPGAnalysis/Phase2L1TNanoAOD/python/l1tPh2Nanotables_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,12 +394,13 @@
)

sc8JetTable = pfJetTable.clone(
src = 'l1tSC8PFL1PuppiCorrectedEmulator',
src = cms.InputTag('l1tSC82ProngJetProducer', 'l1tSC82ProngJets'),
name = "L1puppiJetSC8",
doc = "SeededCone 0.8 Puppi jet, origin: Correlator",
variables = cms.PSet(
pfJetTable.variables.clone(),
mass = Var("mass", float)
mass = Var("mass", float),
nprongTagScore = Var('getTagScore("nprong")', float)
)
)

Expand Down Expand Up @@ -580,7 +581,7 @@
# ## jets
sc4JetTable,
sc8JetTable,
sc4ExtJetTable,
sc4ExtJetTable,
sc4NGJetTable,
histoJetTable,
caloJetTable,
Expand Down
6 changes: 3 additions & 3 deletions DataFormats/L1TParticleFlow/interface/jets.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace l1ct {
// all possible tag categories (can be extended for new / separate taggers)
class JetTagClass {
public:
enum JetTagClassValue : uint8_t { b, c, uds, g, tau_p, tau_n, mu, e };
enum JetTagClassValue : uint8_t { b, c, uds, g, tau_p, tau_n, mu, e, nprong };
JetTagClass() = default;
JetTagClass(JetTagClassValue aJetTagClassValue) : value_(aJetTagClassValue) {}
JetTagClass(std::string aJetTagClassValueString) {
Expand Down Expand Up @@ -47,7 +47,7 @@ namespace l1ct {

// Define a separate class/struct for jet tag handling
struct JetTagClassHandler {
static const unsigned NTagFields = 8;
static const unsigned NTagFields = 9;
static const JetTagClass tagClassesDefault_[NTagFields];

JetTagClass tagClassesArray[NTagFields];
Expand Down Expand Up @@ -197,7 +197,7 @@ namespace l1ct {
j.v3.phi = CTtoGT_phi(hwPhi);
j.v3.eta = CTtoGT_eta(hwEta);
j.z0(l1ct::z0_t::width - 1, 0) = hwZ0(l1ct::z0_t::width - 1, 0);
j.hwNProngScore = 0;
j.hwNProngScore = hwTagScores[0]; // currently only one WideJet tagger
j.hwMassSq = CTtoGT_massSq(hwMassSq);

return j;
Expand Down
6 changes: 4 additions & 2 deletions DataFormats/L1TParticleFlow/src/jets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ const std::unordered_map<std::string, l1ct::JetTagClass::JetTagClassValue> l1ct:
{"tau_p", l1ct::JetTagClass::JetTagClassValue::tau_p},
{"tau_n", l1ct::JetTagClass::JetTagClassValue::tau_n},
{"mu", l1ct::JetTagClass::JetTagClassValue::mu},
{"e", l1ct::JetTagClass::JetTagClassValue::e}};
{"e", l1ct::JetTagClass::JetTagClassValue::e},
{"nprong", l1ct::JetTagClass::JetTagClassValue::nprong}};

const l1ct::JetTagClass l1ct::JetTagClassHandler::tagClassesDefault_[NTagFields] = {l1ct::JetTagClass("b"),
l1ct::JetTagClass("c"),
Expand All @@ -17,4 +18,5 @@ const l1ct::JetTagClass l1ct::JetTagClassHandler::tagClassesDefault_[NTagFields]
l1ct::JetTagClass("tau_p"),
l1ct::JetTagClass("tau_n"),
l1ct::JetTagClass("mu"),
l1ct::JetTagClass("e")};
l1ct::JetTagClass("e"),
l1ct::JetTagClass("nprong")};
45 changes: 45 additions & 0 deletions L1Trigger/Phase2L1ParticleFlow/interface/L1TSC82ProngJetID.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#ifndef L1TRIGGER_PHASE2L1PARTICLEFLOWS_L1TSC82ProngJetID_H
#define L1TRIGGER_PHASE2L1PARTICLEFLOWS_L1TSC82ProngJetID_H

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should L1TSC82ProngJetID be uppercase?

#include "DataFormats/L1TParticleFlow/interface/PFJet.h"
#include <memory>
#include <vector>

//HLS4ML compiled emulator modeling
#include "ap_fixed.h"
#include "hls4ml/emulator.h"

class L1TSC82ProngJetID {
public:
L1TSC82ProngJetID(const std::shared_ptr<hls4mlEmulator::Model> model, int iNParticles);

typedef ap_fixed<24, 12, AP_RND, AP_SAT, 0> inputtype;
typedef ap_ufixed<20, 10, AP_RND, AP_SAT, 0> prong_score;

void setNNVectorVar();
std::vector<float> EvaluateNNFixed();
Comment on lines +19 to +20

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could these be const?

std::vector<float> computeFixed(const l1t::PFJet &iJet);

private:
std::vector<inputtype> NNvectorVar_;
int fNParticles_;
std::unique_ptr<float[]> fPt_;
std::unique_ptr<float[]> fPt_rel_;
std::unique_ptr<float[]> fDEta_;
std::unique_ptr<float[]> fDPhi_;
std::unique_ptr<float[]> fPt_log_;
std::unique_ptr<float[]> fMass_;
std::unique_ptr<float[]> fZ0_;
std::unique_ptr<float[]> fDxy_;
std::unique_ptr<int[]> fIs_filled_;
std::unique_ptr<float[]> fPuppi_weight_;
std::unique_ptr<int[]> fEmID_;
std::unique_ptr<float[]> fQuality_;

std::unique_ptr<int[]> fCharge_;
std::unique_ptr<int[]> fId_;
std::shared_ptr<hls4mlEmulator::Model> modelRef_;

//bool isDebugEnabled_;
};
#endif
108 changes: 108 additions & 0 deletions L1Trigger/Phase2L1ParticleFlow/plugins/L1TSC82ProngJetModelProducer.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/stream/EDProducer.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/MakerMacros.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/Utilities/interface/InputTag.h"

#include "DataFormats/L1TParticleFlow/interface/PFJet.h"
#include "DataFormats/JetReco/interface/Jet.h"
#include "DataFormats/L1TParticleFlow/interface/PFCandidate.h"
#include "L1Trigger/Phase2L1ParticleFlow/interface/L1TSC82ProngJetID.h"
#include "DataFormats/Common/interface/ValueMap.h"

#include "DataFormats/L1Trigger/interface/VertexWord.h"

#include <cmath>
#include <vector>

#include <string>
#include "ap_fixed.h"
#include "hls4ml/emulator.h"

using namespace l1t;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you use l1t::name rather than using namespace l1t?


class L1TSC82ProngJetProducer : public edm::stream::EDProducer<> {
public:
explicit L1TSC82ProngJetProducer(const edm::ParameterSet&);
~L1TSC82ProngJetProducer() override = default;

static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);

private:
std::unique_ptr<L1TSC82ProngJetID> fJetId_;
void produce(edm::Event& iEvent, const edm::EventSetup& iSetup) override;

edm::EDGetTokenT<edm::View<l1t::PFJet>> const jets_;
double const fMinPt_;
double const fMaxEta_;
unsigned int const fMaxJets_;
int const fNParticles_;

hls4mlEmulator::ModelLoader loader;
std::shared_ptr<hls4mlEmulator::Model> model;
};

L1TSC82ProngJetProducer::L1TSC82ProngJetProducer(const edm::ParameterSet& cfg)
: jets_(consumes<edm::View<l1t::PFJet>>(cfg.getParameter<edm::InputTag>("jets"))),
fMinPt_(cfg.getParameter<double>("minPt")),
fMaxEta_(cfg.getParameter<double>("maxEta")),
fMaxJets_(cfg.getParameter<int>("maxJets")),
fNParticles_(cfg.getParameter<int>("nParticles")),
loader(hls4mlEmulator::ModelLoader(cfg.getParameter<std::string>("l1tSC82ProngJetModelPath"))) {
model = loader.load_model();
fJetId_ = std::make_unique<L1TSC82ProngJetID>(model, fNParticles_);
produces<l1t::PFJetCollection>("l1tSC82ProngJets");
}

void L1TSC82ProngJetProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) {
edm::Handle<edm::View<l1t::PFJet>> jets;
iEvent.getByToken(jets_, jets);
std::vector<l1t::PFJet> taggedJets;

for (const auto& srcjet : *jets) {
l1ct::Jet ctHWJet = l1ct::Jet::unpack(srcjet.encodedJet(l1t::PFJet::HWEncoding::CT));

if (srcjet.pt() < fMinPt_ || std::abs(srcjet.eta()) > fMaxEta_ || taggedJets.size() >= fMaxJets_) {
ctHWJet.clear();
continue;
}
std::vector<float> JetProngScore_float = fJetId_->computeFixed(srcjet);
l1gt::WideJet gtwHWJet = l1gt::WideJet::unpack(srcjet.getHWJetGTWide());

l1t::PFJet edmJet(
srcjet.pt(), srcjet.eta(), srcjet.phi(), srcjet.mass(), gtwHWJet.v3.pt.V, gtwHWJet.v3.eta.V, gtwHWJet.v3.phi.V);

std::vector<l1ct::JetTagClass> classes{l1ct::JetTagClass(l1ct::JetTagClass::JetTagClassValue::nprong)};

edmJet.addTagScores(JetProngScore_float, classes, 1.);
edmJet.setEncodedJet(l1t::PFJet::HWEncoding::CT, ctHWJet.pack());
edmJet.setEncodedJet(l1t::PFJet::HWEncoding::GTWide, gtwHWJet.pack());

std::vector<edm::Ptr<l1t::PFCandidate>> constituents;
std::for_each(srcjet.constituents().begin(), srcjet.constituents().end(), [&](auto constituent) {
edmJet.addConstituent(constituent);
});

taggedJets.push_back(edmJet);
}
std::sort(taggedJets.begin(), taggedJets.end(), [](l1t::PFJet a, l1t::PFJet b) { return (a.pt() > b.pt()); });

std::unique_ptr<l1t::PFJetCollection> taggedJetsCollection(new l1t::PFJetCollection);
taggedJetsCollection->swap(taggedJets);
iEvent.put(std::move(taggedJetsCollection), "l1tSC82ProngJets");
}

void L1TSC82ProngJetProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
edm::ParameterSetDescription desc;
desc.add<edm::InputTag>("jets", edm::InputTag("l1tSC8PFL1PuppiEmulator"));
desc.add<std::string>("l1tSC82ProngJetModelPath", std::string("L1TSC82ProngJetModel_v0"));
desc.add<double>("minPt", 0.);
desc.add<double>("maxEta", 5.);
desc.add<int>("maxJets", 16);
desc.add<int>("nParticles", 8);
descriptions.add("l1tSC82ProngJetProducer", desc);
}

#include "FWCore/Framework/interface/MakerMacros.h"
DEFINE_FWK_MODULE(L1TSC82ProngJetProducer);
14 changes: 4 additions & 10 deletions L1Trigger/Phase2L1ParticleFlow/python/l1ctLayer1_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,13 +213,10 @@
emulateCorrections = cms.bool(False), # NOTE: should switch this on for FW bit-wise agreement!
emInterpScenario = cms.string("allKeepHad"), # for all clusters, use EM intepretation to redefine the EM part of the energy
),
regionizerAlgo = cms.string("Multififo"),
regionizerAlgo = cms.string("BufferedFoldedMultififo"),
regionizerAlgoParameters = cms.PSet(
useAlsoVtxCoords = cms.bool(True),
nEndcaps = cms.uint32(2),
nClocks = cms.uint32(54),
nTkLinks = cms.uint32(2),
nCaloLinks = cms.uint32(3),
nClocks = cms.uint32(162),
nTrack = cms.uint32(30),
nCalo = cms.uint32(20),
nEmCalo = cms.uint32(10),
Expand Down Expand Up @@ -365,13 +362,10 @@
emulateCorrections = cms.bool(False), # NOTE: should switch this on for FW bit-wise agreement!
emInterpScenario = cms.string("allKeepHad"), # for all clusters, use EM intepretation to redefine the EM part of the energy
),
regionizerAlgo = cms.string("Multififo"),
regionizerAlgo = cms.string("BufferedFoldedMultififo"),
regionizerAlgoParameters = cms.PSet(
useAlsoVtxCoords = cms.bool(True),
nEndcaps = cms.uint32(2),
nClocks = cms.uint32(54),
nTkLinks = cms.uint32(0),
nCaloLinks = cms.uint32(3),
nClocks = cms.uint32(162),
nTrack = cms.uint32(0),
nCalo = cms.uint32(12),
nEmCalo = cms.uint32(12),
Expand Down
Loading