-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Phase2 L1T: Correlator development for AR2026 #51093
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 2 commits
Commits
Show all changes
92 commits
Select commit
Hold shift + click to select a range
30207b9
L1TSC82ProngJetModel (#150)
henripetrow 8f89e86
TM18 is now the default configuration for all serenity modules
cerminar 1c4c42c
rebase NN vtx Emu to latest p2l1pfp
Chriisbrown 91e2644
Format changes
Chriisbrown 1c28e9c
Apply suggestion for printing model name from code review
Chriisbrown 6752191
first copilot comments
Chriisbrown f9bf6f6
remove magic number bin iteration
Chriisbrown 0ef68dc
Update path for including v0 NNvtx model for emulator in CC
Chriisbrown f087803
Attempt to use sizeof for HLS compilation
Chriisbrown c7013ce
Use correct namespace for cms-hls4ml model version
Chriisbrown 55373d7
Use emulator model's input type
Chriisbrown d906940
add option for TM18 tdr regionizer
jmitrevs 6c4f4a2
stapshot of work towards TM18 GCT
jmitrevs 9c4d764
copy changes in Phase2L1ParticleFlow from 151x_bar_cl1_tm18_gct
jmitrevs 027fede
make it compile
jmitrevs a83e599
first version with tdr_alt regionizer
jmitrevs ff9b97c
fix compilation issues
jmitrevs b4070ac
testing new EM and PF digi cluster collection for TMI18
pallabidas 553b374
PR comments from Jovan and Gianluca
pallabidas afbd872
geometry fixes for EG and PF cluster digis
pallabidas 17f6ec6
fix compilation
jmitrevs e025575
remove commented out code
jmitrevs b3775c0
snapshot of updating configuration
jmitrevs bfc5283
a few more configuration fixes
jmitrevs fd27e9f
updates to using alt tdr regionizer
jmitrevs 064cc8b
varous bug fixes
jmitrevs 6b164cc
update calo building--had commented out too much
jmitrevs 88538ad
fix a number of logical vs physical and sorting bugs; still not fully…
jmitrevs 46b7372
fix ieta vs iphi confusion
jmitrevs 2168cc0
bug fix in calo cluster phi values, integrate PF/had clusters into La…
pallabidas b970074
Functioning version of TDR regionizer, but with lots of debug stateme…
jmitrevs 6db9a05
re-enable most of the algorithms, remove extra printouts
jmitrevs 1f38f80
fix tracker pattern file order configuration, extra debugging printouts
jmitrevs 992cc9a
make calo_links function a member function
jmitrevs eb7bb33
Change all the tdr_alt back to tdr.
jmitrevs 2eb2140
Changed mainly debug output, add tentative SR ordering (not verified)
jmitrevs 18d4b0e
Swap slr3 and slr1 mapping to phi, switch to returning physical links
jmitrevs ba87280
minor fixes for pattern writer
jmitrevs 0736331
fix output order of pattern files--was using map in the wrong direction
jmitrevs 5ac38f3
add pt=0 throwout matching to how it's done in the firmware
jmitrevs 4210663
update GCT converter emulation
jmitrevs d567f5f
add a divide by 0 catch for relative iso
jmitrevs 7ec6762
fix relative iso for GCT EM clusters
jmitrevs 958a942
update gct em converter emulaiton
jmitrevs 137b5a4
model virtual fibers on one physical fiber "bundle" in emulation
jmitrevs f7c0165
fix pattern file configuration (and obsolete comment in source code)
jmitrevs e6415e6
updates for rel iso and hoe, rename TMI18 to TM18
pallabidas f28cbf9
change default value of fb
pallabidas 3dd7522
update hoe for GCT tower
pallabidas c99313a
fix matching with pf input/output
jmitrevs a76cfcd
add egamma debug output
jmitrevs 2be6f65
try to make egamma match
jmitrevs a215786
fix the pattern file writer
jmitrevs 70ca310
fix egamma sort configuration
jmitrevs 9fe43fd
PF cluster corrections
pallabidas 9fa6fc3
corrections after EM corrections are applied
pallabidas 1e6b558
scram code format changes
jmitrevs 75fb582
fix copilot suggestions
jmitrevs ff65c30
initial attempt towards a working config
cerminar 09cd981
Fix cluster reference
cerminar eece1ce
Fix handling of newly added data-members in copy and move operations
cerminar 587dd93
Temporarily disable serenity barrel pattern files
cerminar 3161093
add missing algorithm include (#27)
jmitrevs 4910699
Fix eta conversion in digitization GCT EM cluster
cerminar 60ef1e0
Fix relative isolation for EM clusters
cerminar d4cc97c
GCT EM correction file from Federica/Piero
pallabidas baccb75
Fix showershape rounding
cerminar 6114a01
Temporary workaround for iso variable
cerminar 8d467d1
Call L1Candidate constructor and fix eta for negative values
cerminar cfedaba
Improve workaround
cerminar 2b6a0ad
Implement GT link as per interface document and adapt routing for new…
cerminar 272d3ab
Remove debug verbosity
cerminar 07f90d6
code format
cerminar 2ca671b
updated hadronic corrections
pallabidas 436db02
update tkele EM model
cerminar 876f362
Foton WP now matches the suggestion of using looseTk WP.
cerminar 405b103
Fix em pt for calibration
cerminar 7c8b2c9
Make constant static
cerminar bb87eb3
Cleanup uneeded headers and includes
cerminar 8641895
add missing CMS Exception header to TDR regionizer elements
jmitrevs 44b23ca
automatic scram code-format checks
jmitrevs 32c6722
update comments to be correct, remove unneeded include
jmitrevs 3a4791c
Futher fix for GCT Had calibration
cerminar a2534f6
updated with calibration bugfix
pallabidas 4d2ce58
corrections using pt02 as reference
pallabidas ee47009
tweak tkele EB WP
cerminar f16ec01
rounding to HW values
cerminar d585748
code-checks
cerminar 5800c3d
Added EM barrel calibs & implementation of the tkele pt regression @ …
pviscone a9c75a9
add pset descriptions
cerminar d43a9d8
codeformat
cerminar 8975514
codeformat NNVTX
cerminar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
L1Trigger/Phase2L1ParticleFlow/interface/L1TSC82ProngJetID.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| #ifndef L1TRIGGER_PHASE2L1PARTICLEFLOWS_L1TSC82ProngJetID_H | ||
| #define L1TRIGGER_PHASE2L1PARTICLEFLOWS_L1TSC82ProngJetID_H | ||
|
|
||
| #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
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
108
L1Trigger/Phase2L1ParticleFlow/plugins/L1TSC82ProngJetModelProducer.cc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should L1TSC82ProngJetID be uppercase?