Skip to content
Open
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
db7e90b
Update L1T MET and Add JUMP algorithm
Jun 13, 2025
070951d
Apply code checks and format
JunwonTomOh Jun 13, 2025
104769c
Fix the code to read the factors from cms-data
JunwonTomOh Aug 21, 2025
9a8ce18
Modified the JUMP emulator
JunwonTomOh Sep 1, 2025
88d6bf5
Apply code format
JunwonTomOh Sep 1, 2025
af82bf2
Change emulators to define the json file directory
JunwonTomOh Sep 9, 2025
935b8cd
Merge pull request #1 from JunwonTomOh/l1met_jump
JunwonTomOh Nov 17, 2025
b64fd73
Modified Scaler on L1 MET Phi calculation
JunwonTomOh Nov 17, 2025
e2f6964
Add json files for met temporary
JunwonTomOh Nov 17, 2025
08fb352
Modified met json file path for hls emulator
JunwonTomOh Nov 17, 2025
cdd06bb
Delete L1 MET json files
JunwonTomOh Nov 18, 2025
970fea8
Add L1 MET json files
JunwonTomOh Nov 18, 2025
b471b87
Apply code-checks and code-format
JunwonTomOh Nov 18, 2025
e199113
Delete L1 MET JSON files
JunwonTomOh Nov 18, 2025
4fc43a7
Add L1 MET JSON files
JunwonTomOh Nov 18, 2025
9376488
Update L1Trigger/Phase2L1ParticleFlow/plugins/L1JUMPProducer.cc
JunwonTomOh Jan 28, 2026
eae69d1
Update L1Trigger/Phase2L1ParticleFlow/data/met/l1met_ptphi2pxpy_poly2…
JunwonTomOh Jan 28, 2026
345e2ae
Update L1Trigger/Phase2L1ParticleFlow/python/l1tJUMPProducer_cfi.py
JunwonTomOh Jan 28, 2026
8100227
Update L1Trigger/Phase2L1ParticleFlow/interface/jetmet/L1PFMetEmulator.h
JunwonTomOh Jan 28, 2026
53d4297
Update L1Trigger/Phase2L1ParticleFlow/interface/jetmet/L1PFJUMPEmulat…
JunwonTomOh Jan 28, 2026
977384f
Update L1Trigger/Phase2L1ParticleFlow/plugins/L1JUMPProducer.cc
JunwonTomOh Jan 28, 2026
c48d5dd
Update L1Trigger/Phase2L1ParticleFlow/plugins/L1JUMPProducer.cc
JunwonTomOh Jan 28, 2026
304856b
Update L1Trigger/Phase2L1ParticleFlow/interface/jetmet/L1PFJUMPEmulat…
JunwonTomOh Jan 28, 2026
f96846d
Update L1Trigger/Phase2L1ParticleFlow/interface/jetmet/L1PFMetEmulator.h
JunwonTomOh Jan 28, 2026
818f479
Update L1Trigger/Phase2L1ParticleFlow/interface/jetmet/L1PFJUMPEmulat…
JunwonTomOh Jan 28, 2026
6e7350a
Update L1Trigger/Phase2L1ParticleFlow/plugins/L1JUMPProducer.cc
JunwonTomOh Jan 28, 2026
ae37b5d
Update L1Trigger/Phase2L1ParticleFlow/plugins/L1JUMPProducer.cc
JunwonTomOh Jan 30, 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
27 changes: 27 additions & 0 deletions L1Trigger/Phase2L1ParticleFlow/data/met/l1jump_jer_v1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"version": 1,
"description": "JUMP L1 jet resolution: σ(pT)[GeV] = a(ηbin)·pT + b(ηbin); |η| bins at [1.3, 1.7, 2.5, 3.0]; used to build dPx,dPy for MET update.",
"eta_bins": 4,
"eta_edges": [
1.3,
1.7,
2.5,
3.0
],
"eta": {
"par0": [
0,
0.073,
0.247,
0.128,
0.091
],
"par1": [
0,
12.322,
6.061,
10.944,
12.660
]
}
}
136 changes: 136 additions & 0 deletions L1Trigger/Phase2L1ParticleFlow/data/met/l1met_ptphi2pxpy_poly2_v1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
{
"version": 1,
"description": "L1METEmu 2nd-order polynomial coefficients for cos/sin; 16 phi bins over [-pi, pi]; phi_edges in radians.",
"phi_bins": 16,
"phi_edges": [
-1.0,
-0.875,
-0.75,
-0.625,
-0.5,
-0.375,
-0.25,
-0.125,
0.0,
0.125,
0.25,
0.375,
0.5,
0.625,
0.75,
0.875,
1.0
],
"cos": {
"par0": [
-1.00007,
-0.924181,
-0.707596,
-0.382902,
-0.000618262,
0.382137,
0.707056,
0.923708,
1.00007,
0.924181,
0.707594,
0.383285,
0.000188727,
-0.382139,
-0.706719,
-0.923708
],
"par1": [
9.164680268990924e-06,
0.0017064607695524156,
0.0031441321076514446,
0.004079929656016374,
0.004437063290882583,
0.004095969231842202,
0.0031107221424451436,
0.001689531075808071,
-9.161756842493832e-06,
-0.001706456406229286,
-0.003143961938049376,
-0.004103015998697129,
-0.004411145151490469,
-0.0040958165155326525,
-0.0031310072316764474,
-0.001689531075808071
],
"par2": [
9.319674765430664e-06,
7.871694899063284e-06,
5.222989318251642e-06,
2.0256106486379287e-06,
-1.9299417402361656e-06,
-5.35167113952279e-06,
-7.740062096537953e-06,
-9.348822844786505e-06,
-9.319674765430664e-06,
-7.871694899063284e-06,
-5.225331064666252e-06,
-1.780776301343235e-06,
1.6556927733433181e-06,
5.3495197789955455e-06,
7.954684107366423e-06,
9.348822844786505e-06
]
},
"sin": {
"par0": [
0.000524872,
-0.382229,
-0.706791,
-0.923959,
-1.00008,
-0.924156,
-0.707264,
-0.383199,
-0.000525527,
0.382228,
0.706792,
0.923752,
1.00013,
0.924155,
0.707535,
0.3832
],
"par1": [
-0.004431478237276202,
-0.00409041472149773,
-0.0031267268116859314,
-0.00167440343451641,
9.741773386162849e-06,
0.0017049641497188307,
0.00312406082125351,
0.0040978672774037465,
0.004431478237276202,
0.00409041472149773,
0.0031266351819002015,
0.0016868781753450394,
-1.249302315254411e-05,
-0.001704846339994321,
-0.003140405829698437,
-0.0040978672774037465
],
"par2": [
1.870674613498914e-06,
5.292404012785538e-06,
7.909829192302831e-06,
9.188746390688592e-06,
9.313525301268721e-06,
7.887020962996302e-06,
5.435897856093815e-06,
1.8358587462761668e-06,
-1.870668901922293e-06,
-5.292404012785538e-06,
-7.908420336736317e-06,
-9.320836119343602e-06,
-9.284396260501616e-06,
-7.88869635880513e-06,
-5.262894200243701e-06,
-1.835864457852788e-06
]
}
}
154 changes: 154 additions & 0 deletions L1Trigger/Phase2L1ParticleFlow/interface/jetmet/L1PFJUMPEmulator.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
#ifndef L1Trigger_Phase2L1ParticleFlow_JUMPEmulator_h
#define L1Trigger_Phase2L1ParticleFlow_JUMPEmulator_h

#include "DataFormats/L1TParticleFlow/interface/jets.h"
#include "DataFormats/L1TParticleFlow/interface/sums.h"
#include "DataFormats/L1TParticleFlow/interface/layer1_emulator.h"

#include "L1Trigger/Phase2L1ParticleFlow/interface/dbgPrintf.h"
#include "L1Trigger/Phase2L1ParticleFlow/interface/jetmet/L1PFMetEmulator.h"

#include "FWCore/Utilities/interface/FileInPath.h"
#include "FWCore/Utilities/interface/Exception.h"
#include "nlohmann/json.hpp"

#include <vector>
#include <numeric>
#include <array>
#include <fstream>
#include <algorithm>
#include <cmath>
#include "ap_int.h"
#include "ap_fixed.h"

namespace L1JUMPEmu {
/*
Emulator for the JUMP Algorithm
DPS Note publicly available on CDS: CMS DP-2025/023
JUMP: Jet Uncertainty-aware MET Prediction
- Approximate L1 Jet energy resolution by pT, eta value
- Apply the estimated resolution to MET
*/
struct JER_param {
std::vector<ap_fixed<11, 1>> par0; // eta.par0 (slope)
std::vector<ap_fixed<8, 5>> par1; // eta.par1 (offset)
std::vector<L1METEmu::eta_t> edges; // |eta| boundaries in HW scale
unsigned int eta_bins = 0;
};

struct JER_Path {
std::string path = "L1Trigger/Phase2L1ParticleFlow/data/met/l1jump_jer_v1.json";
};

inline JER_Path& jer_path_config() {
static JER_Path jump_p;
return jump_p;
}

inline void SetJERFile(std::string jump_p) { jer_path_config().path = std::move(jump_p); }

inline const JER_param& Get_jer_param() {
static JER_param P = []() {
JER_param t{};
std::string path = jer_path_config().path;

#ifdef CMSSW_GIT_HASH
edm::FileInPath f(path);
std::ifstream in(f.fullPath());
if (!in) {
throw cms::Exception("FileNotFound") << f.fullPath();
}
#else
path = "l1jump_jer_v1.json"; // For HLS Emulator
std::ifstream in(path);
if (!in) {
throw std::runtime_error(std::string("File not found: ") + path);
}
#endif

nlohmann::json j;
in >> j;

unsigned int N = j["eta_bins"].get<unsigned int>();
t.eta_bins = N;

t.par0.resize(N + 1);
t.par1.resize(N + 1);
t.edges.resize(N);

for (unsigned int i = 0; i < N + 1; ++i) {
t.par0[i] = ap_fixed<11, 1>(j["eta"]["par0"][i].get<double>());
t.par1[i] = ap_fixed<8, 5>(j["eta"]["par1"][i].get<double>());
}
for (unsigned int i = 0; i < N; ++i) {
t.edges[i] = l1ct::Scales::makeGlbEta(j["eta_edges"][i].get<double>());
}
return t;
}();
return P;
}

inline void Get_dPt(const l1ct::Jet jet, L1METEmu::proj2_t& dPx_2, L1METEmu::proj2_t& dPy_2) {
/*
L1 Jet Energy Resolution parameterization
- Fitted σ(pT)/pT as a function of jet pT in each η region (detector boundary at η≈1.3, 1.7, 2.5, 3.0)
- Derived from simulated QCD multijet samples to calculate detector‐dependent resolution
- σ(pT) ≈ eta_par0[i] * pT + eta_par1[i]
*/

const auto& J = Get_jer_param();

L1METEmu::eta_t abseta = abs(jet.hwEta.to_float());
unsigned int etabin = 0;
for (unsigned int i = 0; i < J.eta_bins; i++) {
if (abseta < J.edges[i]) {
etabin = i + 1;
break;
}
}

dPx_2 = 0;
dPy_2 = 0;
l1ct::Sum jet_resolution;
jet_resolution.hwPt = J.par0[etabin] * jet.hwPt + J.par1[etabin];
jet_resolution.hwPhi = jet.hwPhi;
L1METEmu::Particle_xy dpt_xy = L1METEmu::Get_xy(jet_resolution.hwPt, jet_resolution.hwPhi);

dPx_2 = dpt_xy.hwPx * dpt_xy.hwPx;
dPy_2 = dpt_xy.hwPy * dpt_xy.hwPy;
}

inline void Met_dPt(const std::vector<l1ct::Jet>& jets, L1METEmu::proj2_t& dPx_2, L1METEmu::proj2_t& dPy_2) {
L1METEmu::proj2_t each_dPx2 = 0;
L1METEmu::proj2_t each_dPy2 = 0;

L1METEmu::proj2_t sum_dPx2 = 0;
L1METEmu::proj2_t sum_dPy2 = 0;

for (unsigned int i = 0; i < jets.size(); i++) {
Get_dPt(jets[i], each_dPx2, each_dPy2);
sum_dPx2 += each_dPx2;
sum_dPy2 += each_dPy2;
}

dPx_2 = sum_dPx2;
dPy_2 = sum_dPy2;
}
} // namespace L1JUMPEmu

inline void JUMP_emu(const l1ct::Sum& inMet, const std::vector<l1ct::Jet>& jets, l1ct::Sum& outMet) {
L1METEmu::Particle_xy inMet_xy = L1METEmu::Get_xy(inMet.hwPt, inMet.hwPhi);

L1METEmu::proj2_t dPx_2;
L1METEmu::proj2_t dPy_2;
L1JUMPEmu::Met_dPt(jets, dPx_2, dPy_2);

L1METEmu::Particle_xy outMet_xy;
outMet_xy.hwPx = (inMet_xy.hwPx > 0) ? inMet_xy.hwPx + L1METEmu::proj2_t(sqrt(dPx_2.to_float()))
: inMet_xy.hwPx - L1METEmu::proj2_t(sqrt(dPx_2.to_float()));
outMet_xy.hwPy = (inMet_xy.hwPy > 0) ? inMet_xy.hwPy + L1METEmu::proj2_t(sqrt(dPy_2.to_float()))
: inMet_xy.hwPy - L1METEmu::proj2_t(sqrt(dPy_2.to_float()));
L1METEmu::pxpy_to_ptphi(outMet_xy, outMet);
}

#endif
Loading
Loading