Skip to content
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
19 changes: 16 additions & 3 deletions DataFormats/L1TParticleFlow/interface/PFJet.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#include "DataFormats/L1Trigger/interface/L1Candidate.h"
#include "DataFormats/L1TParticleFlow/interface/PFCandidate.h"
#include "DataFormats/Common/interface/Ptr.h"
#include "DataFormats/L1TParticleFlow/interface/jets.h"
#include "DataFormats/L1TParticleFlow/interface/gt_datatypes.h"

namespace l1t {

Expand Down Expand Up @@ -38,13 +40,24 @@ namespace l1t {
edm::Ptr<l1t::PFCandidate> daughterPtr(size_type i) const { return constituents_[i]; }

// Get and set the encodedJet_ bits. The Jet is encoded in 128 bits as a 2-element array of uint64_t
std::array<uint64_t, 2> encodedJet() { return encodedJet_; }
void setEncodedJet(std::array<uint64_t, 2> jet) { encodedJet_ = jet; }
// We store encodings both for Correlator internal usage and for Global Trigger
enum class HWEncoding { CT, GT };
typedef std::array<uint64_t, 2> PackedJet;
const PackedJet& encodedJet(const HWEncoding encoding = HWEncoding::GT) const {
return encodedJet_[static_cast<int>(encoding)];
}
void setEncodedJet(const HWEncoding encoding, const PackedJet jet) {
encodedJet_[static_cast<int>(encoding)] = jet;
}

// Accessors to HW objects with ap_* types from encoded words
l1gt::Jet getHWJetGT() const { return l1gt::Jet::unpack(encodedJet(HWEncoding::GT)); }
l1ct::Jet getHWJetCT() const { return l1ct::Jet::unpack(encodedJet(HWEncoding::CT)); }

private:
float rawPt_;
Constituents constituents_;
std::array<uint64_t, 2> encodedJet_ = {{0, 0}};
std::array<PackedJet, 2> encodedJet_ = {{{{0, 0}}, {{0, 0}}}};
};

typedef std::vector<l1t::PFJet> PFJetCollection;
Expand Down
2 changes: 1 addition & 1 deletion DataFormats/L1TParticleFlow/interface/sums.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ namespace l1ct {
sum.valid = (hwPt != 0) || (hwSumPt != 0);
sum.vector_pt = CTtoGT_pt(hwPt);
sum.vector_phi = CTtoGT_phi(hwPhi);
sum.scalar_pt = CTtoGT_phi(hwSumPt);
sum.scalar_pt = CTtoGT_pt(hwSumPt);
return sum;
}
};
Expand Down
3 changes: 2 additions & 1 deletion DataFormats/L1TParticleFlow/src/classes_def.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
<class name="l1t::RegionalOutput<l1t::PFCandidateCollection>" />
<class name="edm::Wrapper<l1t::RegionalOutput<l1t::PFCandidateCollection>>" />

<class name="l1t::PFJet" ClassVersion="5">
<class name="l1t::PFJet" ClassVersion="6">
<version ClassVersion="6" checksum="2599349078"/>
<version ClassVersion="5" checksum="2270932343"/>
<version ClassVersion="4" checksum="1424452548"/>
<version ClassVersion="3" checksum="133342988"/>
Expand Down
13 changes: 7 additions & 6 deletions L1Trigger/Phase2L1ParticleFlow/plugins/L1MHtPFProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ void L1MhtPfProducer::produce(edm::StreamID, edm::Event& iEvent, const edm::Even
std::vector<l1ct::Jet> L1MhtPfProducer::convertEDMToHW(std::vector<l1t::PFJet> edmJets) const {
std::vector<l1ct::Jet> hwJets;
std::for_each(edmJets.begin(), edmJets.end(), [&](l1t::PFJet jet) {
l1ct::Jet hwJet = l1ct::Jet::unpack(jet.encodedJet());
l1ct::Jet hwJet = jet.getHWJetCT();
hwJets.push_back(hwJet);
});
return hwJets;
Expand All @@ -75,17 +75,18 @@ std::vector<l1t::EtSum> L1MhtPfProducer::convertHWToEDM(l1ct::Sum hwSums) const
std::vector<l1t::EtSum> edmSums;

reco::Candidate::PolarLorentzVector htVector;
htVector.SetPt(hwSums.hwSumPt.to_double());
l1gt::Sum gtSum = hwSums.toGT();
htVector.SetPt(l1gt::Scales::floatPt(gtSum.scalar_pt));
htVector.SetPhi(0);
htVector.SetEta(0);

reco::Candidate::PolarLorentzVector mhtVector;
mhtVector.SetPt(hwSums.hwPt.to_double());
mhtVector.SetPhi(l1ct::Scales::floatPhi(hwSums.hwPhi));
mhtVector.SetPt(l1gt::Scales::floatPt(gtSum.vector_pt));
mhtVector.SetPhi(l1gt::Scales::floatPhi(gtSum.vector_phi));
mhtVector.SetEta(0);

l1t::EtSum ht(htVector, l1t::EtSum::EtSumType::kTotalHt);
l1t::EtSum mht(mhtVector, l1t::EtSum::EtSumType::kMissingHt);
l1t::EtSum ht(htVector, l1t::EtSum::EtSumType::kTotalHt, gtSum.scalar_pt.bits_to_uint64());
l1t::EtSum mht(mhtVector, l1t::EtSum::EtSumType::kMissingHt, gtSum.vector_pt.bits_to_uint64(), 0, gtSum.vector_phi);

edmSums.push_back(ht);
edmSums.push_back(mht);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,8 @@ std::vector<l1t::PFJet> L1SeedConePFJetProducer::convertHWToEDM(
gtJet.v3.pt.V,
gtJet.v3.eta.V,
gtJet.v3.phi.V);
edmJet.setEncodedJet(jet.toGT().pack());
edmJet.setEncodedJet(l1t::PFJet::HWEncoding::CT, jet.pack());
edmJet.setEncodedJet(l1t::PFJet::HWEncoding::GT, jet.toGT().pack());
// get back the references to the constituents
std::vector<edm::Ptr<l1t::PFCandidate>> constituents;
std::for_each(jet.constituents.begin(), jet.constituents.end(), [&](auto constituent) {
Expand Down
2 changes: 1 addition & 1 deletion L1Trigger/Phase2L1ParticleFlow/python/l1pfJetMet_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
phase2_hgcalV11.toModify(_correctedJets, correctorFile = "L1Trigger/Phase2L1ParticleFlow/data/jecs/jecs_20220308.root")

from L1Trigger.Phase2L1ParticleFlow.l1tMHTPFProducer_cfi import l1tMHTPFProducer
l1tSCPFL1PuppiCorrectedEmulatorMHT = l1tMHTPFProducer.clone()
l1tSCPFL1PuppiCorrectedEmulatorMHT = l1tMHTPFProducer.clone(jets = 'l1tSCPFL1PuppiCorrectedEmulator')

L1TPFJetsTask = cms.Task(
l1tLayer2Deregionizer, l1tSCPFL1PF, l1tSCPFL1Puppi, l1tSCPFL1PuppiEmulator, l1tSCPFL1PuppiCorrectedEmulator, l1tSCPFL1PuppiCorrectedEmulatorMHT
Expand Down