Skip to content
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

[12_5_X] [L1T] Backport of: Phase-2, include missing collections in outputs #39451

Merged
merged 8 commits into from
Oct 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
26 changes: 4 additions & 22 deletions DataFormats/L1Trigger/interface/TkJetWord.h
Original file line number Diff line number Diff line change
@@ -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 <vector>
#include <ap_int.h>
#include <cassert>
Expand Down Expand Up @@ -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<kPtSize + 5, kPtMagSize + 5, AP_TRN, AP_SAT> pt_2 = pt;
ap_uint<kPtSize> 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() {}

Expand Down
44 changes: 44 additions & 0 deletions DataFormats/L1Trigger/src/TkJetWord.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// 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
2 changes: 2 additions & 0 deletions DataFormats/L1Trigger/src/classes_def.xml
Original file line number Diff line number Diff line change
Expand Up @@ -309,5 +309,7 @@
</class>
<class name="std::vector<l1t::TkJetWord>"/>
<class name="edm::Wrapper<std::vector<l1t::TkJetWord> >"/>
<class name="edm::Wrapper<l1t::TkJetWordCollection>"/>
<class name="std::bitset<70>"/>

</lcgdict>
15 changes: 15 additions & 0 deletions L1Trigger/Configuration/python/L1Trigger_EventContent_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -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_*_*',
Expand All @@ -194,6 +204,9 @@ def _appendPhase2Digis(obj):
'keep *_l1tPhase1JetProducer_*_*',
'keep *_l1tPhase1JetCalibrator_*_*',
'keep *_l1tPhase1JetSumsProducer_*_*',
'keep *_l1tPhase1JetProducer9x9_*_*',
'keep *_l1tPhase1JetCalibrator9x9_*_*',
'keep *_l1tPhase1JetSumsProducer9x9_*_*',
'keep *_l1tLayer1Barrel_*_*',
'keep *_l1tLayer1HGCal_*_*',
'keep *_l1tLayer1HGCalNoTK_*_*',
Expand All @@ -203,6 +216,8 @@ def _appendPhase2Digis(obj):
'keep *_l1tMETPFProducer_*_*',
'keep *_l1tNNTauProducer_*_*',
'keep *_l1tNNTauProducerPuppi_*_*',
'keep *_l1tHPSPFTauProducerPF_*_*',
'keep *_l1tHPSPFTauProducerPuppi_*_*',
'keep *_TTStubsFromPhase2TrackerDigis_*_*',
'keep *_TTClustersFromPhase2TrackerDigis_*_*',
'keep *_l1tTTTracksFromExtendedTrackletEmulation_*_*',
Expand Down
18 changes: 12 additions & 6 deletions L1Trigger/Configuration/python/SimL1Emulator_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@
l1tVertexFinderEmulator.VertexReconstruction.Algorithm = "fastHistoEmulation"
l1tVertexFinderEmulator.l1TracksInputTag = ("l1tGTTInputProducer","Level1TTTracksConverted")
_phase2_siml1emulator.add(l1tVertexFinder)
_phase2_siml1emulator.add(l1tVertexProducer)
_phase2_siml1emulator.add(l1tGTTInputProducer)
_phase2_siml1emulator.add(l1tGTTInputProducerExtended)
_phase2_siml1emulator.add(l1tVertexFinderEmulator)
Expand All @@ -150,14 +151,19 @@
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")
l1tTrackFastJets.L1PrimaryVertexTag = ("l1tVertexFinder", "l1vertices")
l1tTrackJetsExtended.L1PVertexCollection = ("l1tVertexFinder", "l1vertices")
#l1tTrackerEtMiss.L1VertexInputTag = ("l1tVertexFinder", "l1vertices")
#l1tTrackerEtMissExtended.L1VertexInputTag = ("l1tVertexFinder", "l1vertices")

from L1Trigger.L1TTrackMatch.l1tTrackSelectionProducer_cfi import *
_phase2_siml1emulator.add(l1tTrackSelectionProducer)
_phase2_siml1emulator.add(l1tTrackSelectionProducerExtended)

_phase2_siml1emulator.add(l1tTrackJets)
_phase2_siml1emulator.add(l1tTrackJetsExtended)
_phase2_siml1emulator.add(l1tTrackFastJets)

_phase2_siml1emulator.add(l1tTrackerEtMiss)
_phase2_siml1emulator.add(l1tTrackerHTMiss)

Expand All @@ -167,7 +173,7 @@
_phase2_siml1emulator.add(l1tTrackJetsExtendedEmulation)

from L1Trigger.L1TTrackMatch.l1tTrackerEmuEtMiss_cfi import *
l1tTrackerEmuEtMiss.L1VertexInputTag = ("L1VertexFinderEmulator","l1verticesEmulation")
l1tTrackerEmuEtMiss.L1VertexInputTag = ("l1tVertexFinderEmulator","l1verticesEmulation")
_phase2_siml1emulator.add(l1tTrackerEmuEtMiss)

from L1Trigger.L1TTrackMatch.l1tTrackerEmuHTMiss_cfi import *
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ l1t::EtSum Phase1L1TJetSumsProducer::computeMHT(const edm::Handle<std::vector<re
void Phase1L1TJetSumsProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
edm::ParameterSetDescription desc;
desc.add<edm::InputTag>("inputJetCollectionTag",
edm::InputTag("Phase1L1TJetCalibrator", "Phase1L1TJetFromPfCandidates"));
edm::InputTag("l1tPhase1JetCalibrator", "Phase1L1TJetFromPfCandidates"));
desc.add<std::vector<double> >("sinPhi");
desc.add<std::vector<double> >("cosPhi");
desc.add<unsigned int>("nBinsPhi", 72);
Expand Down
2 changes: 1 addition & 1 deletion L1Trigger/L1CaloTrigger/python/Phase1L1TJets_9x9_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
)

l1tPhase1JetSumsProducer9x9 = l1tPhase1JetSumsProducer.clone(
inputJetCollectionTag = ("Phase1L1TJetCalibrator9x9", "Phase1L1TJetFromPfCandidates"),
inputJetCollectionTag = ("l1tPhase1JetCalibrator9x9", "Phase1L1TJetFromPfCandidates"),
)

L1TPhase1JetsSequence9x9 = cms.Sequence(
Expand Down
6 changes: 3 additions & 3 deletions L1Trigger/L1TTrackMatch/plugins/L1TrackSelectionProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -599,10 +599,10 @@ void L1TrackSelectionProducer::produce(edm::StreamID, edm::Event& iEvent, const
void L1TrackSelectionProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
//L1TrackSelectionProducer
edm::ParameterSetDescription desc;
desc.add<edm::InputTag>("l1TracksInputTag", edm::InputTag("TTTracksFromTrackletEmulation", "Level1TTTracks"));
desc.addOptional<edm::InputTag>("l1VerticesInputTag", edm::InputTag("L1VertexFinder", "l1vertices"));
desc.add<edm::InputTag>("l1TracksInputTag", edm::InputTag("l1tTTTracksFromTrackletEmulation", "Level1TTTracks"));
desc.addOptional<edm::InputTag>("l1VerticesInputTag", edm::InputTag("l1tVertexFinder", "l1vertices"));
desc.addOptional<edm::InputTag>("l1VerticesEmulationInputTag",
edm::InputTag("L1VertexFinderEmulator", "l1verticesEmulation"));
edm::InputTag("l1tVertexFinderEmulator", "l1verticesEmulation"));
desc.add<std::string>("outputCollectionName", "Level1TTTracksSelected");
{
edm::ParameterSetDescription descCutSet;
Expand Down
4 changes: 2 additions & 2 deletions L1Trigger/Phase2L1Taus/plugins/HPSPFTauProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ void HPSPFTauProducer::fillDescriptions(edm::ConfigurationDescriptions& descript
desc.add<double>("minSeedJetPt", 30.0);
desc.add<double>("maxChargedRelIso", 1.0);
desc.add<double>("minSeedChargedPFCandPt", 5.0);
desc.add<edm::InputTag>("srcL1PFCands", edm::InputTag("l1ctLayer1", "PF"));
desc.add<edm::InputTag>("srcL1PFCands", edm::InputTag("l1tLayer1", "PF"));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a bug, or the bug is in the master instead?

Copy link
Contributor

@srimanob srimanob Oct 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems this line will be overwritten by
https://github.com/cms-sw/cmssw/blob/master/L1Trigger/Phase2L1Taus/python/HPSPFTauProducerPF_cfi.py#L5
srcL1PFCands = "l1tLayer1:PF",

However, let's @cms-sw/l1-l2 confirms.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems this line will be overwritten by https://github.com/cms-sw/cmssw/blob/master/L1Trigger/Phase2L1Taus/python/HPSPFTauProducerPF_cfi.py#L5 srcL1PFCands = "l1tLayer1:PF",

Sure, it is overwritten.
But it changes the default.
Can we have the correct default in both master and backports?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree. Let's spend a little time to clean up things.

In addition, I see few places in master that still use l1ctLayer1 which I assume them to change to l1tLayer1
https://github.com/cms-sw/cmssw/search?q=l1ctLayer1

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is correct. I will make a bug-fix PR to master.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR to master with the fixes: #39704

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes: #39705

desc.add<double>("stripSizeEta", 0.05);
desc.add<double>("maxLeadChargedPFCandEta", 2.4);
desc.add<double>("deltaRCleaning", 0.4);
Expand All @@ -230,7 +230,7 @@ void HPSPFTauProducer::fillDescriptions(edm::ConfigurationDescriptions& descript
desc.add<double>("maxSeedChargedPFCandEta", 2.4);
desc.add<bool>("applyPreselection", false);
desc.add<double>("isolationConeSize", 0.4);
desc.add<edm::InputTag>("srcL1Vertices", edm::InputTag("L1VertexFinderEmulator", "l1verticesEmulation"));
desc.add<edm::InputTag>("srcL1Vertices", edm::InputTag("l1tVertexFinderEmulator", "l1verticesEmulation"));
desc.add<double>("maxChargedIso", 1000.0);
{
edm::ParameterSetDescription psd0;
Expand Down