Skip to content
Closed
Show file tree
Hide file tree
Changes from all 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
7 changes: 7 additions & 0 deletions DataFormats/L1TCalorimeterPhase2/interface/CaloPFCluster.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,35 @@ namespace l1tp2 {
CaloPFCluster()
: l1t::L1Candidate(),
clusterEt_(0.),
ecalEt_(0.),
clusterIEta_(-99),
clusterIPhi_(-99),
clusterEta_(-99.),
clusterPhi_(-99.) {}

CaloPFCluster(const PolarLorentzVector& p4,
float clusterEt,
float ecalEt,
int clusterIEta,
int clusterIPhi,
float clusterEta,
float clusterPhi)
: l1t::L1Candidate(p4),
clusterEt_(clusterEt),
ecalEt_(ecalEt),
clusterIEta_(clusterIEta),
clusterIPhi_(clusterIPhi),
clusterEta_(clusterEta),
clusterPhi_(clusterPhi) {}

inline float clusterEt() const { return clusterEt_; };
inline float ecalEt() const { return ecalEt_; };
inline int clusterIEta() const { return clusterIEta_; };
inline int clusterIPhi() const { return clusterIPhi_; };
inline float clusterEta() const { return clusterEta_; };
inline float clusterPhi() const { return clusterPhi_; };
void setClusterEt(float clusterEtIn) { clusterEt_ = clusterEtIn; };
void setEcalEt(float ecalEtIn) { ecalEt_ = ecalEtIn; };
void setClusterIEta(int clusterIEtaIn) { clusterIEta_ = clusterIEtaIn; };
void setClusterIPhi(int clusterIPhiIn) { clusterIPhi_ = clusterIPhiIn; };
void setClusterEta(float clusterEtaIn) { clusterEta_ = clusterEtaIn; };
Expand All @@ -46,6 +51,8 @@ namespace l1tp2 {
private:
// ET
float clusterEt_;
// ECAL ET
float ecalEt_;
// GCT ieta
int clusterIEta_;
// GCT iphi
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#ifndef DataFormats_L1TCalorimeterPhase2_DigitizedCaloToCorrelatorTM18_h
#define DataFormats_L1TCalorimeterPhase2_DigitizedCaloToCorrelatorTM18_h

#include <ap_int.h>
#include <variant>
#include <vector>
#include "DataFormats/L1TCalorimeterPhase2/interface/GCTEmDigiCluster.h"
#include "DataFormats/L1TCalorimeterPhase2/interface/GCTHadDigiCluster.h"

namespace l1tp2 {

typedef std::variant<std::monostate, l1tp2::GCTEmDigiCluster, l1tp2::GCTHadDigiCluster> GCTDigiCluster;
typedef std::vector<l1tp2::GCTDigiCluster> GCTDigiClusterLink;

class DigitizedCaloToCorrelatorTM18 {
private:
// Data (to remove)
ap_uint<64> CardData[162];

GCTDigiClusterLink CardLink;

public:
DigitizedCaloToCorrelatorTM18() {
for (int i = 0; i < 162; i++) {
CardData[i] = 0;
}
}
DigitizedCaloToCorrelatorTM18(ap_uint<64> data[162], GCTDigiClusterLink link) {
for (int i = 0; i < 162; i++) {
CardData[i] = data[i];
}
CardLink = link;
}

const ap_uint<64>* dataCard() const { return CardData; }
const GCTDigiClusterLink& linkCard() const { return CardLink; }
};

// Collection typedef
// this represents both the EM and PF clusters from a single GCT card in one link
typedef std::vector<l1tp2::DigitizedCaloToCorrelatorTM18> DigitizedCaloToCorrelatorCollectionTM18;

} // namespace l1tp2

#endif
148 changes: 44 additions & 104 deletions DataFormats/L1TCalorimeterPhase2/interface/DigitizedClusterCorrelator.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,49 +20,16 @@ namespace l1tp2 {
static constexpr float ETA_RANGE_ONE_SIDE = 1.4841; // barrel goes from (-1.4841, +1.4841)
static constexpr float LSB_ETA = ((2 * ETA_RANGE_ONE_SIDE) / (n_towers_eta * n_crystals_in_tower)); // (2.8 / 170)
static constexpr float LSB_PHI = ((2 * M_PI) / (3 * n_towers_phi * n_crystals_in_tower)); // (2 pi * 360)
static constexpr float PHI_RANGE_PER_SLR_DEGREES = 120;

static constexpr unsigned int n_bits_pt = 12; // 12 bits allocated for pt
static constexpr unsigned int n_bits_unused_start = 63; // unused bits start at bit 63

// "top" of the correlator card #0 in GCT coordinates is iPhi tower index 24
static constexpr int correlatorCard0_tower_iphi_offset = 24;
static constexpr int correlatorCard0_tower_iphi_offset = 68;
// same but for correlator cards #1 and 2 (cards wrap around phi = 180 degrees):
static constexpr int correlatorCard1_tower_iphi_offset = 48;
static constexpr int correlatorCard2_tower_iphi_offset = 0;

// Private member functions to perform digitization
ap_uint<12> digitizePt(float pt_f) {
float maxPt_f = (std::pow(2, n_bits_pt) - 1) * LSB_PT;
// If pT exceeds the maximum (extremely unlikely), saturate the value
if (pt_f >= maxPt_f) {
return (ap_uint<12>)0xFFF;
}

return (ap_uint<12>)(pt_f / LSB_PT);
}

ap_uint<8> digitizeIEtaCr(unsigned int iEtaCr) { return (ap_uint<8>)iEtaCr; }

ap_uint<7> digitizeIPhiCr(unsigned int iPhiCr) { return (ap_uint<7>)iPhiCr; }

// To-do: HoE is not defined for clusters
ap_uint<4> digitizeHoE(unsigned int hoe) { return (ap_uint<4>)hoe; }
ap_uint<2> digitizeHoeFlag(unsigned int hoeFlag) { return (ap_uint<2>)hoeFlag; }

ap_uint<3> digitizeIso(unsigned int iso) { return (ap_uint<3>)iso; }
ap_uint<2> digitizeIsoFlag(unsigned int isoFlag) { return (ap_uint<2>)isoFlag; }

// To-do: fb: no information yet
ap_uint<6> digitizeFb(unsigned int fb) { return (ap_uint<6>)fb; }

// To-do: timing: no information yet
ap_uint<5> digitizeTiming(unsigned int timing) { return (ap_uint<5>)timing; }

// Shape: shower shape working point
ap_uint<2> digitizeShapeFlag(unsigned int shapeFlag) { return (ap_uint<2>)shapeFlag; }

// TO-DO: Brems: was brems applied (NOT STORED YET IN GCT)
ap_uint<2> digitizeBrems(unsigned int brems) { return (ap_uint<2>)brems; }
static constexpr int correlatorCard1_tower_iphi_offset = 20;
static constexpr int correlatorCard2_tower_iphi_offset = 44;

public:
DigitizedClusterCorrelator() { clusterData = 0x0; }
Expand All @@ -71,45 +38,20 @@ namespace l1tp2 {

// Constructor from digitized inputs
DigitizedClusterCorrelator(ap_uint<12> pt,
ap_uint<8> etaCr,
ap_uint<7> phiCr,
ap_uint<4> hoe,
ap_uint<2> hoeFlag,
ap_uint<3> iso,
ap_uint<2> isoFlag,
ap_uint<6> fb,
ap_uint<7> eta,
ap_int<7> phi,
ap_uint<6> hoe,
ap_uint<6> iso,
ap_uint<6> shape,
ap_uint<3> wp,
ap_uint<5> timing,
ap_uint<2> shapeFlag,
ap_uint<2> brems,
int iGCTCard,
bool fullydigitizedInputs) {
(void)fullydigitizedInputs;
clusterData = ((ap_uint<64>)pt) | (((ap_uint<64>)etaCr) << 12) | (((ap_uint<64>)phiCr) << 20) |
(((ap_uint<64>)hoe) << 27) | (((ap_uint<64>)hoeFlag) << 31) | (((ap_uint<64>)iso) << 36) |
(((ap_uint<64>)isoFlag) << 38) | (((ap_uint<64>)fb) << 44) | (((ap_uint<64>)timing) << 49) |
(((ap_uint<64>)shapeFlag << 51)) | (((ap_uint<64>)brems << 53));
idxGCTCard = iGCTCard;
}

// Constructor from float inputs
DigitizedClusterCorrelator(float pt_f,
unsigned int iEtaCr,
unsigned int iPhiCr,
unsigned int hoe,
unsigned int hoeFlag,
unsigned int iso,
unsigned int isoFlag,
unsigned int fb,
unsigned int timing,
unsigned int shapeFlag,
unsigned int brems,
ap_uint<10> spare,
int iGCTCard) {
clusterData = (((ap_uint<64>)digitizePt(pt_f)) | ((ap_uint<64>)digitizeIEtaCr(iEtaCr) << 12) |
((ap_uint<64>)digitizeIPhiCr(iPhiCr) << 20) | ((ap_uint<64>)digitizeHoE(hoe) << 27) |
((ap_uint<64>)digitizeHoeFlag(hoeFlag) << 31) | ((ap_uint<64>)digitizeIso(iso) << 36) |
((ap_uint<64>)digitizeIsoFlag(isoFlag) << 38) | ((ap_uint<64>)digitizeFb(fb) << 44) |
((ap_uint<64>)digitizeTiming(timing) << 49) | ((ap_uint<64>)digitizeShapeFlag(shapeFlag) << 51) |
((ap_uint<64>)digitizeBrems(brems) << 53));
clusterData = ((ap_uint<64>)pt) | (((ap_uint<64>)eta) << 12) | (((ap_uint<64>)(phi & 0x7F)) << 19) |
(((ap_uint<64>)hoe) << 26) | (((ap_uint<64>)iso) << 32) | (((ap_uint<64>)shape) << 38) |
(((ap_uint<64>)wp) << 44) | (((ap_uint<64>)timing) << 47) | (((ap_uint<64>)brems) << 52) |
(((ap_uint<64>)spare) << 54);
idxGCTCard = iGCTCard;
}

Expand All @@ -121,49 +63,39 @@ namespace l1tp2 {
float ptFloat() const { return (pt() * ptLSB()); }

// crystal eta in the correlator region (LSB: 2.8/170)
ap_uint<8> eta() const { return ((clusterData >> 12) & 0xFF); } // (eight 1's) 0b11111111 = 0xFF
ap_uint<7> eta() const { return ((clusterData >> 12) & 0x7F); } // (seven 1's) 0b11111111 = 0x7F

// crystal phi in the correlator region (LSB: 2pi/360)
ap_uint<7> phi() const { return ((clusterData >> 20) & 0x7F); } // (seven 1's) 0b1111111 = 0x7F
ap_int<7> phi() const { return ((clusterData >> 19) & 0x7F); }

// HoE value and flag: not defined yet in the emulator
ap_uint<4> hoe() const { return ((clusterData >> 27) & 0xF); } // (four 1's) 0b1111 = 0xF
ap_uint<2> hoeFlag() const { return ((clusterData >> 31) & 0x3); } // (two 1's) 0b11 = 0x3
ap_uint<6> hoe() const { return ((clusterData >> 26) & 0x3F); }

// Raw isolation sum: not saved in the emulator
ap_uint<3> iso() const { return ((clusterData >> 36) & 0x7); }
ap_uint<6> iso() const { return ((clusterData >> 32) & 0x3F); } // raw isolation sum

// iso flag: two bits, least significant bit is the standalone WP (true or false), second bit is the looseTk WP (true or false)
// e.g. 0b01 : standalone iso flag passed, loose Tk iso flag did not pass
ap_uint<2> isoFlags() const { return ((clusterData >> 38) & 0x3); } // (two 1's) 0b11 = 0x3
bool passes_iso() const { return (isoFlags() & 0x1); } // standalone iso WP
bool passes_looseTkiso() const { return (isoFlags() & 0x2); } // loose Tk iso WP
ap_uint<6> shape() const { return ((clusterData >> 38) & 0x3F); } // et2x5/et5x5

// fb and timing: not saved in the current emulator
ap_uint<6> fb() const { return ((clusterData >> 44) & 0x3F); }
ap_uint<5> timing() const { return ((clusterData >> 49) & 0x1F); }
ap_uint<3> wp() const { return ((clusterData >> 44) & 0x7); } // encoded standaloneWP, looseL1TkMatchWP, photonWP

// shower shape shape flag: two bits, least significant bit is the standalone WP, second bit is the looseTk WP
// e.g. 0b01 : standalone shower shape flag passed, loose Tk shower shape flag did not pass
ap_uint<2> shapeFlags() const { return ((clusterData >> 51) & 0x3); }

bool passes_ss() const { return (shapeFlags() & 0x1); } // standalone shower shape WP
bool passes_looseTkss() const { return (shapeFlags() & 0x2); } // loose Tk shower shape WP
// timing: not saved in the current emulator
ap_uint<5> timing() const { return ((clusterData >> 47) & 0x1F); }

// brems: not saved in the current emulator
ap_uint<2> brems() const { return ((clusterData >> 53) & 0x3); }
ap_uint<2> brems() const { return ((clusterData >> 52) & 0x3); }

ap_uint<10> spare() const { return ((clusterData >> 54) & 0x3FF); }

// which GCT card (0, 1, or 2)
unsigned int cardNumber() const { return idxGCTCard; }

const int unusedBitsStart() const { return n_bits_unused_start; }

// Other checks
bool passNullBitsCheck(void) const { return ((data() >> unusedBitsStart()) == 0x0); }

// Get real eta (does not depend on card number). crystal iEta = 0 starts at real eta -1.4841.
// Get real eta (does not depend on card number)
// LSB_ETA/2 is to add half a crystal width to get the center of the crystal in eta
float realEta() const { return (float)((-1 * ETA_RANGE_ONE_SIDE) + (eta() * LSB_ETA) + (LSB_ETA / 2)); }
float realEta() const {
float tmpeta = (eta() * LSB_ETA) + (LSB_ETA / 2);
if ((spare() & 0x4) == 0)
tmpeta = -((eta() * LSB_ETA) + (LSB_ETA / 2));
return tmpeta;
}

// Get real phi (uses card number).
float realPhi() const {
Expand All @@ -176,10 +108,18 @@ namespace l1tp2 {
} else if (cardNumber() == 2) {
offset_tower = correlatorCard2_tower_iphi_offset;
}
int thisPhi = (phi() + (offset_tower * n_crystals_in_tower));
// crystal iPhi = 0 starts at real phi = -180 degrees

int tmpphi = (phi() + PHI_RANGE_PER_SLR_DEGREES / 4);
bool wrapped = !((spare() & 0x2) == 0);
if (wrapped) {
tmpphi += PHI_RANGE_PER_SLR_DEGREES / 2;
}
int thisPhi = (tmpphi + (offset_tower * n_crystals_in_tower));
if (thisPhi > 180)
thisPhi -= 360; // range between -180 to 180 degrees

// LSB_PHI/2 is to add half a crystal width to get the center of the crystal in phi
return (float)((-1 * M_PI) + (thisPhi * LSB_PHI) + (LSB_PHI / 2));
return (float)((thisPhi * LSB_PHI) + (LSB_PHI / 2));
}
};

Expand Down
Loading