From e6d49f52c3fef2c4c83478bb8be8fe8c44919233 Mon Sep 17 00:00:00 2001 From: Benjamin Date: Thu, 8 Sep 2022 22:29:01 +0200 Subject: [PATCH] Updating L1 Emulation to run and save Tk objects --- DataFormats/L1Trigger/interface/TkJetWord.h | 26 ++--------- DataFormats/L1Trigger/src/TkJetWord.cc | 43 +++++++++++++++++++ DataFormats/L1Trigger/src/classes_def.xml | 2 + .../python/L1Trigger_EventContent_cff.py | 10 +++++ .../Configuration/python/SimL1Emulator_cff.py | 1 + 5 files changed, 60 insertions(+), 22 deletions(-) create mode 100644 DataFormats/L1Trigger/src/TkJetWord.cc diff --git a/DataFormats/L1Trigger/interface/TkJetWord.h b/DataFormats/L1Trigger/interface/TkJetWord.h index 2813b8728f4f9..a4f12dd57b627 100644 --- a/DataFormats/L1Trigger/interface/TkJetWord.h +++ b/DataFormats/L1Trigger/interface/TkJetWord.h @@ -1,6 +1,9 @@ #ifndef FIRMWARE_TkJetWord_h #define FIRMWARE_TkJetWord_h +// Class to store the 96-bit TkJet word for L1 Track Trigger. +// Author: Emily MacDonald, updated by Benjamin Radburn-Smith (September 2022) + #include #include #include @@ -61,28 +64,7 @@ namespace l1t { public: // ----------Constructors -------------------------- TkJetWord() {} - TkJetWord(pt_t pt, glbeta_t eta, glbphi_t phi, z0_t z0, nt_t nt, nx_t nx, tkjetunassigned_t unassigned) { - std::string word = ""; - word.append(TkJetBitWidths::kUnassignedSize - (unassigned.to_string().length() - 2), '0'); - word = word + (unassigned.to_string().substr(2, unassigned.to_string().length() - 2)); - word.append(TkJetBitWidths::kXtSize - (nx.to_string().length() - 2), '0'); - word = word + (nx.to_string().substr(2, nx.to_string().length() - 2)); - word.append(TkJetBitWidths::kNtSize - (nt.to_string().length() - 2), '0'); - word = word + (nt.to_string().substr(2, nt.to_string().length() - 2)); - word.append(TkJetBitWidths::kZ0Size - (z0.to_string().length() - 2), '0'); - word = word + (z0.to_string().substr(2, z0.to_string().length() - 2)); - word.append(TkJetBitWidths::kGlbPhiSize - (phi.to_string().length() - 2), '0'); - word = word + (phi.to_string().substr(2, phi.to_string().length() - 2)); - word.append(TkJetBitWidths::kGlbEtaSize - (eta.to_string().length() - 2), '0'); - word = word + (eta.to_string().substr(2, eta.to_string().length() - 2)); - ap_ufixed pt_2 = pt; - ap_uint pt_temp = pt_2 << 5; - word.append(TkJetBitWidths::kPtSize - (pt_temp.to_string().length() - 2), '0'); - word = word + (pt_temp.to_string().substr(2, pt_temp.to_string().length() - 2)); - - tkjetword_bs_t tmp(word); - tkJetWord_ = tmp; - } + TkJetWord(pt_t pt, glbeta_t eta, glbphi_t phi, z0_t z0, nt_t nt, nx_t nx, tkjetunassigned_t unassigned); ~TkJetWord() {} diff --git a/DataFormats/L1Trigger/src/TkJetWord.cc b/DataFormats/L1Trigger/src/TkJetWord.cc new file mode 100644 index 0000000000000..0903ef7d8e835 --- /dev/null +++ b/DataFormats/L1Trigger/src/TkJetWord.cc @@ -0,0 +1,43 @@ +// Class to store the 96-bit TkJet word for L1 Track Trigger. +// Author: Benjamin Radburn-Smith (September 2022) + +#include "DataFormats/L1Trigger/interface/TkJetWord.h" + +namespace l1t { + TkJetWord::TkJetWord(pt_t pt, glbeta_t eta, glbphi_t phi, z0_t z0, nt_t nt, nx_t nx, tkjetunassigned_t unassigned) { + setTkJetWord(pt, eta, phi, z0, nt, nx, unassigned); + } + + void TkJetWord::setTkJetWord(pt_t pt, glbeta_t eta, glbphi_t phi, z0_t z0, nt_t nt, nx_t nx, tkjetunassigned_t unassigned) { + // pack the TkJet word + unsigned int offset = 0; + for (unsigned int b = offset; b < (offset + TkJetBitWidths::kPtSize); b++) { + tkJetWord_.set(b, pt[b - offset]); + } + offset += TkJetBitWidths::kPtSize; + for (unsigned int b = offset; b < (offset + TkJetBitWidths::kGlbEtaSize); b++) { + tkJetWord_.set(b, eta[b - offset]); + } + offset += TkJetBitWidths::kGlbEtaSize; + for (unsigned int b = offset; b < (offset + TkJetBitWidths::kGlbPhiSize); b++) { + tkJetWord_.set(b, phi[b - offset]); + } + offset += TkJetBitWidths::kGlbPhiSize; + for (unsigned int b = offset; b < (offset + TkJetBitWidths::kZ0Size); b++) { + tkJetWord_.set(b, z0[b - offset]); + } + offset += TkJetBitWidths::kZ0Size; + for (unsigned int b = offset; b < (offset + TkJetBitWidths::kNtSize); b++) { + tkJetWord_.set(b, nt[b - offset]); + } + offset += TkJetBitWidths::kNtSize; + for (unsigned int b = offset; b < (offset + TkJetBitWidths::kXtSize); b++) { + tkJetWord_.set(b, nx[b - offset]); + } + offset += TkJetBitWidths::kXtSize; + for (unsigned int b = offset; b < (offset + TkJetBitWidths::kUnassignedSize); b++) { + tkJetWord_.set(b, unassigned[b - offset]); + } + } + +} //namespace l1t \ No newline at end of file diff --git a/DataFormats/L1Trigger/src/classes_def.xml b/DataFormats/L1Trigger/src/classes_def.xml index 045c3669354b9..d005e9754df75 100644 --- a/DataFormats/L1Trigger/src/classes_def.xml +++ b/DataFormats/L1Trigger/src/classes_def.xml @@ -303,5 +303,7 @@ + + diff --git a/L1Trigger/Configuration/python/L1Trigger_EventContent_cff.py b/L1Trigger/Configuration/python/L1Trigger_EventContent_cff.py index 2557d1a3ba189..dc63de5bf6669 100644 --- a/L1Trigger/Configuration/python/L1Trigger_EventContent_cff.py +++ b/L1Trigger/Configuration/python/L1Trigger_EventContent_cff.py @@ -178,6 +178,16 @@ def _appendPhase2Digis(obj): 'keep *_L1EGammaClusterEmuProducer_*_*', 'keep *_L1VertexFinder_*_*', 'keep *_L1VertexFinderEmulator_*_*', + 'keep *_L1TrackJets_*_*', + 'keep *_L1TrackJetsExtended_*_*', + 'keep *_L1TrackFastJets_*_*', + 'keep *_L1TrackerEtMiss_*_*', + 'keep *_L1TrackerHTMiss_*_*', + 'keep *_L1TrackJetsEmulation_*_*', + 'keep *_L1TrackJetsExtendedEmulation_*_*', + 'keep *_L1TrackerEmuEtMiss_*_*', + 'keep *_L1TrackerEmuHTMiss_*_*', + 'keep *_L1TrackerEmuHTMissExtended_*_*', 'keep *_L1TowerCalibration_*_*', 'keep *_L1CaloJet_*_*', 'keep *_L1CaloJetHTT_*_*', diff --git a/L1Trigger/Configuration/python/SimL1Emulator_cff.py b/L1Trigger/Configuration/python/SimL1Emulator_cff.py index b117f24b5cb9c..b037412d51886 100644 --- a/L1Trigger/Configuration/python/SimL1Emulator_cff.py +++ b/L1Trigger/Configuration/python/SimL1Emulator_cff.py @@ -152,6 +152,7 @@ # make the input tags consistent with the choice L1VertexFinder above L1TrackJets.L1PVertexCollection = cms.InputTag("L1VertexFinder", L1VertexFinder.l1VertexCollectionName.value()) L1TrackJetsExtended.L1PVertexCollection = cms.InputTag("L1VertexFinder", L1VertexFinder.l1VertexCollectionName.value()) +L1TrackFastJets.L1PrimaryVertexTag = ("L1VertexFinder", L1VertexFinder.l1VertexCollectionName.value()) L1TrackerEtMiss.L1VertexInputTag = cms.InputTag("L1VertexFinder", L1VertexFinder.l1VertexCollectionName.value()) L1TrackerEtMissExtended.L1VertexInputTag = cms.InputTag("L1VertexFinder", L1VertexFinder.l1VertexCollectionName.value()) _phase2_siml1emulator.add(L1TrackJets)