1 #include <unordered_map> 33 std::unordered_map<const l1t::PFCandidate *, l1t::PFClusterRef>
clusterRefMap_;
34 std::unordered_map<const l1t::PFCandidate *, l1t::PFTrackRef>
trackRefMap_;
35 std::unordered_map<const l1t::PFCandidate *, l1t::PFCandidate::MuonRef>
muonRefMap_;
38 void hwToEdm_(
const std::vector<l1ct::PuppiObjEmu> &hwOut, std::vector<l1t::PFCandidate> &edmOut)
const;
46 nInputFramesPerBX_(iConfig.getParameter<uint32_t>(
"nInputFramesPerBX")),
48 input_(linkConfigs_) {
49 produces<l1t::PFCandidateCollection>(
"Puppi");
50 produces<l1t::PFCandidateCollection>(
"TruncatedPuppi");
60 auto deregColl = std::make_unique<l1t::PFCandidateCollection>();
61 auto truncColl = std::make_unique<l1t::PFCandidateCollection>();
68 std::vector<l1ct::PuppiObjEmu> hwOut;
69 std::vector<l1t::PFCandidate> edmOut;
70 std::vector<l1ct::PuppiObjEmu> hwTruncOut;
71 std::vector<l1t::PFCandidate> edmTruncOut;
73 LogDebug(
"DeregionizerProducer") <<
"\nRegional Puppi Candidates";
74 for (
unsigned int iReg = 0, nReg =
src->nRegions(); iReg < nReg; ++iReg) {
78 float eta =
src->eta(iReg);
79 float phi =
src->phi(iReg);
80 LogDebug(
"DeregionizerProducer") <<
"\nRegion " << iReg <<
"\n" 81 <<
"Eta = " <<
eta <<
" and Phi = " <<
phi <<
"\n" 92 tempOutputRegion.
puppi.push_back(tempPuppi);
93 LogDebug(
"DeregionizerProducer") <<
"pt[" <<
i <<
"] = " << tempOutputRegion.
puppi.back().hwPt <<
", eta[" <<
i 94 <<
"] = " << tempOutputRegion.
puppi.back().floatEta() <<
", phi[" <<
i 95 <<
"] = " << tempOutputRegion.
puppi.back().floatPhi();
107 deregColl->swap(edmOut);
108 truncColl->swap(edmTruncOut);
115 std::vector<l1t::PFCandidate> &edmOut)
const {
116 for (
const auto &hwPuppi : hwOut) {
119 if (hwPuppi.hwId.charged()) {
120 if (hwPuppi.hwId.isMuon()) {
123 }
else if (hwPuppi.hwId.isElectron()) {
130 mass = hwPuppi.hwId.isPhoton() ? 0.0 : 0.5;
134 type, hwPuppi.intCharge(), p4, hwPuppi.floatPuppiW(), hwPuppi.intPt(), hwPuppi.intEta(), hwPuppi.intPhi());
135 if (hwPuppi.hwId.charged()) {
136 edmOut.back().setZ0(hwPuppi.floatZ0());
137 edmOut.back().setDxy(hwPuppi.floatDxy());
138 edmOut.back().setHwZ0(hwPuppi.hwZ0());
139 edmOut.back().setHwDxy(hwPuppi.hwDxy());
140 edmOut.back().setHwTkQuality(hwPuppi.hwTkQuality());
142 edmOut.back().setHwPuppiWeight(hwPuppi.hwPuppiW());
143 edmOut.back().setHwEmID(hwPuppi.hwEmID());
145 edmOut.back().setEncodedPuppi64(hwPuppi.pack().to_uint64());
154 throw cms::Exception(
"CorruptData") <<
"Invalid cluster pointer in PF candidate id " <<
p.intId() <<
" pt " 155 <<
p.floatPt() <<
" eta " <<
p.floatEta() <<
" phi " <<
p.floatPhi();
157 pf.setPFCluster(
match->second);
162 throw cms::Exception(
"CorruptData") <<
"Invalid track pointer in PF candidate id " <<
p.intId() <<
" pt " 163 <<
p.floatPt() <<
" eta " <<
p.floatEta() <<
" phi " <<
p.floatPhi();
170 throw cms::Exception(
"CorruptData") <<
"Invalid muon pointer in PF candidate id " <<
p.intId() <<
" pt " 171 <<
p.floatPt() <<
" eta " <<
p.floatEta() <<
" phi " <<
p.floatPhi();
180 desc.add<
unsigned int>(
"nPuppiFinalBuffer", 128);
181 desc.add<
unsigned int>(
"nPuppiPerClk", 6);
182 desc.add<
unsigned int>(
"nPuppiFirstBuffers", 12);
183 desc.add<
unsigned int>(
"nPuppiSecondBuffers", 32);
184 desc.add<
unsigned int>(
"nPuppiThirdBuffers", 64);
185 desc.add<
unsigned int>(
"nInputFramesPerBX", 9);
188 desc.addVPSet(
"linkConfigs", linkConfigDummyValidator);
189 descriptions.
add(
"DeregionizerProducer",
desc);
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
const unsigned int tmuxFactor_
l1ct::DeregionizerEmulator emulator_
void setAllowAnything()
allow any parameter label/value pairs
std::vector< uint32_t > nOutputFramesPerBX_
const l1t::PFCandidate * srcCand
void produce(edm::Event &, const edm::EventSetup &) override
std::unordered_map< const l1t::PFCandidate *, l1t::PFCandidate::MuonRef > muonRefMap_
std::vector< PuppiObjEmu > puppi
std::vector< uint32_t > nPuppiFramesPerRegion_
std::unordered_map< const l1t::PFCandidate *, l1t::PFTrackRef > trackRefMap_
void setRefs_(l1t::PFCandidate &pf, const l1ct::PuppiObjEmu &p) const
#define DEFINE_FWK_MODULE(type)
std::vector< std::vector< uint32_t > > outputRegions_
edm::ParameterSet config_
edm::EDGetTokenT< l1t::PFCandidateRegionalOutput > token_
void hwToEdm_(const std::vector< l1ct::PuppiObjEmu > &hwOut, std::vector< l1t::PFCandidate > &edmOut) const
l1t::RegionalOutput< l1t::PFCandidateCollection > PFCandidateRegionalOutput
void initFromBits(const ap_uint< BITWIDTH > &src)
const unsigned int nInputFramesPerBX_
void add(std::string const &label, ParameterSetDescription const &psetDescription)
std::vector< edm::ParameterSet > linkConfigs_
l1ct::DeregionizerInput input_
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
std::vector< uint32_t > nPuppiPerRegion_
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
std::vector< uint32_t > nLinksPuppi_
DeregionizerProducer(const edm::ParameterSet &)
~DeregionizerProducer() override
std::unordered_map< const l1t::PFCandidate *, l1t::PFClusterRef > clusterRefMap_
std::vector< uint32_t > boardOrder_
void run(std::vector< std::vector< std::vector< l1ct::PuppiObjEmu >>> in, std::vector< l1ct::PuppiObjEmu > &out, std::vector< l1ct::PuppiObjEmu > &truncated)