33 ap_uint<64> encodeLayer1(
const EGIsoObjEmu &egiso)
const;
36 std::vector<ap_uint<64>> encodeLayer1(
const std::vector<EGIsoObjEmu> &
photons)
const;
37 std::vector<ap_uint<64>> encodeLayer1(
const std::vector<EGIsoEleObjEmu> &
electrons)
const;
39 std::vector<ap_uint<64>> encodeLayer1EgObjs(
unsigned int nObj,
40 const std::vector<EGIsoObjEmu> &
photons,
41 const std::vector<EGIsoEleObjEmu> &
electrons)
const;
45 void endJob()
override;
64 for (
const auto &conf : confs) {
65 const auto &producer_tag = conf.getParameter<
edm::InputTag>(
"pfProducer");
66 tokensAndChannels_.push_back(std::make_pair(
67 prod->consumes<
T>(
edm::InputTag(producer_tag.label(), producer_tag.instance(), producer_tag.process())),
68 conf.getParameter<std::vector<int>>(
"channels")));
83 std::map<l1t::demo::LinkId, std::pair<l1t::demo::ChannelSpec, std::vector<size_t>>> channelSpecs;
85 for (
const auto &channelConf : conf.
getParameter<std::vector<edm::ParameterSet>>(
"channels")) {
86 unsigned int inTMUX = channelConf.getParameter<uint32_t>(
"TMUX");
87 unsigned int eventGap =
88 inTMUX *
nFramesPerBX - channelConf.getParameter<uint32_t>(
"nWords");
90 std::vector<uint32_t> chns = channelConf.getParameter<std::vector<uint32_t>>(
"channels");
92 channelConf.getParameter<uint32_t>(
"id")}] =
94 std::vector<size_t>(std::begin(chns), std::end(chns)));
97 dataWriter_ = std::make_unique<l1t::demo::BoardDataWriter>(
109 void flush() { dataWriter_->flush(); }
115 template <
class TT,
class T>
119 std::unique_ptr<TT> &
out)
const {
121 for (
const auto &tokenAndChannel :
instance.tokensAndChannels()) {
123 populate(
out,
handle, tokenAndChannel.second, refRemapper);
134 for (std::size_t ix = 0; ix <
out->size(); ix++) {
139 template <
class TT,
class T>
142 const std::vector<int> &
links,
145 for (
unsigned int iBoard = 0, nBoard =
in->nRegions(); iBoard < nBoard; ++iBoard) {
147 int linkID =
links[iBoard];
152 convertToEmu(
obj, refRemapper,
out->at(linkID));
159 const std::vector<int> &
links,
162 for (
int bx =
in->getFirstBX();
bx <=
in->getLastBX();
bx++) {
163 for (
auto egee_itr =
in->begin(
bx); egee_itr !=
in->end(
bx); egee_itr++) {
164 out->push_back(
bx, *egee_itr);
173 template <
class Tout,
class Tin>
177 const std::vector<Tin> emulated)
const {
178 auto egobjs = std::make_unique<Tout>();
179 for (
const auto &emu : emulated) {
182 auto obj = convertFromEmu(emu, refRemapper);
183 egobjs->push_back(
obj);
212 tkEGInstanceLabel_(conf.getParameter<
std::
string>(
"egStaInstanceLabel")),
213 tkEmInstanceLabel_(conf.getParameter<
std::
string>(
"tkEmInstanceLabel")),
214 tkEleInstanceLabel_(conf.getParameter<
std::
string>(
"tkEleInstanceLabel")),
218 l2EgPuppiIsoAlgo_(conf.getParameter<
edm::
ParameterSet>(
"puppiIsoParametersTkEm")),
219 l2ElePuppiIsoAlgo_(conf.getParameter<
edm::
ParameterSet>(
"puppiIsoParametersTkEle")),
220 doInPtrn_(conf.getParameter<
bool>(
"writeInPattern")),
221 doOutPtrn_(conf.getParameter<
bool>(
"writeOutPattern")),
223 outPtrnWrt_(nullptr) {
240 ret(EGIsoObjEmu::BITWIDTH, 0) = egiso.
pack();
245 ap_uint<128>
ret = 0;
246 ret(EGIsoEleObjEmu::BITWIDTH, 0) = egiso.
pack();
251 std::vector<ap_uint<64>>
ret;
253 for (
const auto &phot :
photons) {
260 std::vector<ap_uint<64>>
ret;
264 ret.push_back(eleword(63, 0));
265 ret.push_back(eleword(127, 64));
271 const std::vector<EGIsoObjEmu> &
photons,
272 const std::vector<EGIsoEleObjEmu> &
electrons)
const {
273 std::vector<ap_uint<64>>
ret;
275 encoded_photons.resize(nObj, {0});
277 encoded_eles.resize(2 * nObj, {0});
279 std::copy(encoded_photons.begin(), encoded_photons.end(), std::back_inserter(
ret));
280 std::copy(encoded_eles.begin(), encoded_eles.end(), std::back_inserter(
ret));
288 auto outEgs = std::make_unique<BXVector<l1t::EGamma>>();
299 for (
unsigned int ibrd = 0; ibrd <
boards->size(); ibrd++) {
307 std::vector<EGIsoObjEmu> out_photons_emu;
308 std::vector<EGIsoEleObjEmu> out_eles_emu;
343 auto refEg = tkele.
EGRef();
346 refEg = newref->second;
366 auto refEg = tkem.
EGRef();
369 refEg = newref->second;
384 for (
const auto &l1PFCand : l1PFCands) {
386 obj.initFromBits(l1PFCand.encodedPuppi64());
387 puppiObjs.emplace_back(
obj);
394 const auto gteg = egiso.
toGT();
400 egiso.
floatRelIso(l1ct::EGIsoObjEmu::IsoType::TkIso),
401 egiso.
floatRelIso(l1ct::EGIsoObjEmu::IsoType::TkIsoPV));
403 tkem.setPFIsol(egiso.
floatRelIso(l1ct::EGIsoObjEmu::IsoType::PfIso));
404 tkem.setPFIsolPV(egiso.
floatRelIso(l1ct::EGIsoObjEmu::IsoType::PfIsoPV));
405 tkem.setPuppiIsol(egiso.
floatRelIso(l1ct::EGIsoObjEmu::IsoType::PuppiIso));
406 tkem.setEgBinaryWord(gteg.pack());
414 const auto gteg = egele.
toGT();
421 egele.
floatRelIso(l1ct::EGIsoEleObjEmu::IsoType::TkIso));
423 tkele.setPFIsol(egele.
floatRelIso(l1ct::EGIsoEleObjEmu::IsoType::PfIso));
424 tkele.setPuppiIsol(egele.
floatRelIso(l1ct::EGIsoEleObjEmu::IsoType::PuppiIso));
425 tkele.setEgBinaryWord(gteg.pack());
426 tkele.setIdScore(egele.
idScore);
std::unique_ptr< l1t::demo::BoardDataWriter > dataWriter_
std::vector< ap_uint< 64 > > encodeLayer2EgObjs(const std::vector< EGIsoObjEmu > &photons, const std::vector< EGIsoEleObjEmu > &electrons) const
std::string tkEGInstanceLabel_
float floatPhi(phi_t phi)
T getParameter(std::string const &) const
void convertToPuppi(const l1t::PFCandidateCollection &l1PFCands, l1ct::PuppiObjs &puppiObjs) const
l1gt::Electron toGT() const
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
Logical ID for link within any given time slice (e.g. ["tracks", 0] -> ["tracks", 17] for links from ...
float floatEta(eta_t eta)
void setHwIso(IsoType type, iso_t value)
double pt() const final
transverse momentum
BXVector< edm::Ref< BXVector< l1t::EGamma > > > oldRefs
void merge(const PFInstanceInputs< T > &instance, edm::Event &iEvent, RefRemapper &refRemapper, std::unique_ptr< TT > &out) const
void remapRefs(edm::Event &iEvent, std::unique_ptr< BXVector< l1t::EGamma >> &out, RefRemapper &refRemapper) const
const l1t::PFTrack * srcTrack
static PFTauRenderPlugin instance
ret
prodAgent to be discontinued
std::vector< l1t::PFCandidate > PFCandidateCollection
void remapRefs(edm::Event &iEvent, std::unique_ptr< TT > &out, RefRemapper &refRemapper) const
PatternWriter(const edm::ParameterSet &conf)
ap_uint< BITWIDTH > pack() const
std::vector< PuppiObj > PuppiObjs
std::unique_ptr< PatternWriter > outPtrnWrt_
FileFormat parseFileFormat(const std::string &)
std::vector< EGIsoEleObjEmu > egelectron
const l1t::PFCluster * srcCluster
void add(const LinkId &, const std::vector< ap_uint< 64 >> &)
std::unique_ptr< T, impl::DeviceDeleter > unique_ptr
const edm::Ref< EGammaBxCollection > & EGRef() const
edm::EDGetTokenT< std::vector< l1t::PFCandidate > > pfObjsToken_
float floatRelIso(IsoType type) const
float floatRelIso(IsoType type) const
void run(const std::vector< l1ct::OutputBoard > &in, std::vector< EGIsoObjEmu > &out_photons, std::vector< EGIsoEleObjEmu > &out_eles) const
PFInstanceInputs< l1t::TkElectronRegionalOutput > tkEleInputs_
~L1TCtL2EgProducer() override
ap_uint< 64 > encodeLayer1(const EGIsoObjEmu &egiso) const
ap_uint< N > egBinaryWord() const
void setHwIso(IsoType type, iso_t value)
void putEgObjects(edm::Event &iEvent, const RefRemapper &refRemapper, const std::string &label, const std::vector< Tin > emulated) const
ap_uint< BITWIDTH > pack() const
void initFromBits(const ap_uint< BITWIDTH > &src)
unsigned int nInputBoards() const
PFInstanceInputs< l1t::TkEmRegionalOutput > tkEmInputs_
l1gt::Photon toGT() const
#define DEFINE_FWK_MODULE(type)
l1ct::L2EgSorterEmulator l2egsorter
void populate(std::unique_ptr< T > &out, const edm::Handle< TT > &in, const std::vector< int > &links, RefRemapper &refRemapper) const
unsigned int nInputObjPerBoard() const
std::string tkEleInstanceLabel_
void populate(std::unique_ptr< BXVector< l1t::EGamma >> &out, const edm::Handle< BXVector< l1t::EGamma >> &in, const std::vector< int > &links, RefRemapper &refRemapper) const
Class to store the L1 Track Trigger tracks.
std::unique_ptr< PatternWriter > inPtrnWrt_
void initFromBits(const ap_uint< BITWIDTH > &src)
math::XYZTLorentzVector LorentzVector
Lorentz vector.
std::vector< EGIsoObjEmu > egphoton
l1ct::L1EGPuppiIsoAlgo l2ElePuppiIsoAlgo_
l1t::TkEm convertFromEmu(const l1ct::EGIsoObjEmu &emu, const RefRemapper &refRemapper) const
const edm::Ptr< L1TTTrackType > & trkPtr() const
const l1t::PFCluster * srcCluster
L1TCtL2EgProducer(const edm::ParameterSet &)
std::map< edm::Ref< BXVector< l1t::EGamma > >, edm::Ref< BXVector< l1t::EGamma > > > old2newRefMap
l1ct::L2EgEncoderEmulator l2encoder
std::vector< ap_uint< 64 > > encodeLayer1EgObjs(unsigned int nObj, const std::vector< EGIsoObjEmu > &photons, const std::vector< EGIsoEleObjEmu > &electrons) const
PFInstanceInputs< BXVector< l1t::EGamma > > tkEGInputs_
std::vector< std::pair< edm::Ref< l1t::EGammaBxCollection >, edm::Ptr< L1TTTrackType > > > origRefAndPtr
void run(const EGIsoObjsEmu &l1EGs, const PuppiObjs &l1PFCands, EGIsoObjsEmu &outL1EGs, z0_t z0=0) const
Class representing information phase-2 ATCA I/O data corresponding to a single event, with logical channel IDs (essentially string-uint pairs, e.g. tracks-0 to tracks-17).
void addEvent(const l1t::demo::EventData &eventData)
TTTrack< Ref_Phase2TrackerDigi_ > L1TTTrackType
void push_back(int bx, T object)
void convertToEmu(const l1t::TkElectron &tkele, RefRemapper &refRemapper, l1ct::OutputBoard &boarOut) const
l1ct::L1EGPuppiIsoAlgo l2EgPuppiIsoAlgo_
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
std::string tkEmInstanceLabel_