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 0fd97a17634f2..6b4f9444aaf04 100644 --- a/DataFormats/L1Trigger/src/classes_def.xml +++ b/DataFormats/L1Trigger/src/classes_def.xml @@ -309,5 +309,7 @@ + + diff --git a/L1Trigger/Configuration/python/L1Trigger_EventContent_cff.py b/L1Trigger/Configuration/python/L1Trigger_EventContent_cff.py index f2c5c54f439c9..02cb8b640241f 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 *_l1tEGammaClusterEmuProducer_*_*', 'keep *_l1tVertexFinder_*_*', 'keep *_l1tVertexFinderEmulator_*_*', + 'keep *_l1tTrackJets_*_*', + 'keep *_l1tTrackJetsExtended_*_*', + 'keep *_l1tTrackFastJets_*_*', + 'keep *_l1tTrackerEtMiss_*_*', + 'keep *_l1tTrackerHTMiss_*_*', + 'keep *_l1tTrackJetsEmulation_*_*', + 'keep *_l1tTrackJetsExtendedEmulation_*_*', + 'keep *_l1tTrackerEmuEtMiss_*_*', + 'keep *_l1tTrackerEmuHTMiss_*_*', + 'keep *_l1tTrackerEmuHTMissExtended_*_*', 'keep *_l1tTowerCalibration_*_*', 'keep *_l1tCaloJet_*_*', 'keep *_l1tCaloJetHTT_*_*', diff --git a/L1Trigger/Configuration/python/SimL1Emulator_cff.py b/L1Trigger/Configuration/python/SimL1Emulator_cff.py index e2474fe8a7304..ec92157ec8e37 100644 --- a/L1Trigger/Configuration/python/SimL1Emulator_cff.py +++ b/L1Trigger/Configuration/python/SimL1Emulator_cff.py @@ -150,14 +150,14 @@ from L1Trigger.L1TTrackMatch.l1tTrackerEtMiss_cfi import * from L1Trigger.L1TTrackMatch.l1tTrackerHTMiss_cfi import * # make the input tags consistent with the choice L1VertexFinder above -l1tTrackJets.L1PVertexCollection = ("L1VertexFinder", "l1vertices") -l1tTrackJetsExtended.L1PVertexCollection = ("L1VertexFinder", "l1vertices") -#L1TrackerEtMiss.L1VertexInputTag = ("L1VertexFinder", "l1vertices") -#L1TrackerEtMissExtended.L1VertexInputTag = ("L1VertexFinder", "l1vertices") +l1tTrackJets.L1PVertexCollection = ("l1tVertexFinder", "l1vertices") +L1TrackFastJets.L1PrimaryVertexTag = ("l1tVertexFinder", "l1vertices") +l1tTrackJetsExtended.L1PVertexCollection = ("l1tVertexFinder", "l1vertices") +l1tTrackerEtMiss.L1VertexInputTag = ("l1tVertexFinder", "l1vertices") +l1tTrackerEtMissExtended.L1VertexInputTag = ("l1tVertexFinder", "l1vertices") _phase2_siml1emulator.add(l1tTrackJets) _phase2_siml1emulator.add(l1tTrackJetsExtended) _phase2_siml1emulator.add(l1tTrackFastJets) - _phase2_siml1emulator.add(l1tTrackerEtMiss) _phase2_siml1emulator.add(l1tTrackerHTMiss)