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;
63 for (
const auto &conf : confs) {
64 const auto &producer_tag = conf.getParameter<
edm::InputTag>(
"pfProducer");
65 tokensAndChannels_.push_back(std::make_pair(
66 prod->consumes<
T>(
edm::InputTag(producer_tag.label(), producer_tag.instance(), producer_tag.process())),
67 conf.getParameter<std::vector<int>>(
"channels")));
82 std::map<l1t::demo::LinkId, std::pair<l1t::demo::ChannelSpec, std::vector<size_t>>> channelSpecs;
84 for (
const auto &channelConf : conf.
getParameter<std::vector<edm::ParameterSet>>(
"channels")) {
85 unsigned int inTMUX = channelConf.getParameter<uint32_t>(
"TMUX");
86 unsigned int eventGap =
87 inTMUX *
nFramesPerBX - channelConf.getParameter<uint32_t>(
"nWords");
89 std::vector<uint32_t> chns = channelConf.getParameter<std::vector<uint32_t>>(
"channels");
91 channelConf.getParameter<uint32_t>(
"id")}] =
93 std::vector<size_t>(std::begin(chns),
std::end(chns)));
96 dataWriter_ = std::make_unique<l1t::demo::BoardDataWriter>(
107 void flush() { dataWriter_->flush(); }
113 template <
class TT,
class T>
117 std::unique_ptr<TT> &
out)
const {
119 for (
const auto &tokenAndChannel :
instance.tokensAndChannels()) {
121 populate(
out,
handle, tokenAndChannel.second, refRemapper);
132 for (std::size_t ix = 0; ix <
out->size(); ix++) {
137 template <
class TT,
class T>
140 const std::vector<int> &
links,
143 for (
unsigned int iBoard = 0, nBoard =
in->nRegions(); iBoard < nBoard; ++iBoard) {
145 int linkID =
links[iBoard];
150 convertToEmu(
obj, refRemapper,
out->at(linkID));
157 const std::vector<int> &
links,
160 for (
int bx =
in->getFirstBX();
bx <=
in->getLastBX();
bx++) {
161 for (
auto egee_itr =
in->begin(
bx); egee_itr !=
in->end(
bx); egee_itr++) {
162 out->push_back(
bx, *egee_itr);
171 template <
class Tout,
class Tin>
175 const std::vector<Tin> emulated)
const {
176 auto egobjs = std::make_unique<Tout>();
177 for (
const auto &emu : emulated) {
180 auto obj = convertFromEmu(emu, refRemapper);
181 egobjs->push_back(
obj);
207 tkEGInstanceLabel_(conf.getParameter<
std::
string>(
"egStaInstanceLabel")),
208 tkEmInstanceLabel_(conf.getParameter<
std::
string>(
"tkEmInstanceLabel")),
209 tkEleInstanceLabel_(conf.getParameter<
std::
string>(
"tkEleInstanceLabel")),
212 doInPtrn_(conf.getParameter<
bool>(
"writeInPattern")),
213 doOutPtrn_(conf.getParameter<
bool>(
"writeOutPattern")),
215 outPtrnWrt_(nullptr) {
232 ret(EGIsoObjEmu::BITWIDTH, 0) = egiso.
pack();
237 ap_uint<128>
ret = 0;
238 ret(EGIsoEleObjEmu::BITWIDTH, 0) = egiso.
pack();
243 std::vector<ap_uint<64>>
ret;
245 for (
const auto &phot :
photons) {
252 std::vector<ap_uint<64>>
ret;
256 ret.push_back(eleword(63, 0));
257 ret.push_back(eleword(127, 64));
263 const std::vector<EGIsoObjEmu> &
photons,
264 const std::vector<EGIsoEleObjEmu> &
electrons)
const {
265 std::vector<ap_uint<64>>
ret;
267 encoded_photons.resize(nObj, {0});
269 encoded_eles.resize(2 * nObj, {0});
271 std::copy(encoded_photons.begin(), encoded_photons.end(), std::back_inserter(
ret));
272 std::copy(encoded_eles.begin(), encoded_eles.end(), std::back_inserter(
ret));
280 auto outEgs = std::make_unique<BXVector<l1t::EGamma>>();
291 for (
unsigned int ibrd = 0; ibrd <
boards->size(); ibrd++) {
299 std::vector<EGIsoObjEmu> out_photons_emu;
300 std::vector<EGIsoEleObjEmu> out_eles_emu;
328 auto refEg = tkele.
EGRef();
331 refEg = newref->second;
349 auto refEg = tkem.
EGRef();
352 refEg = newref->second;
368 const auto gteg = egiso.
toGT();
374 egiso.
floatRelIso(l1ct::EGIsoObjEmu::IsoType::TkIso),
375 egiso.
floatRelIso(l1ct::EGIsoObjEmu::IsoType::TkIsoPV));
377 tkem.setPFIsol(egiso.
floatRelIso(l1ct::EGIsoObjEmu::IsoType::PfIso));
378 tkem.setPFIsolPV(egiso.
floatRelIso(l1ct::EGIsoObjEmu::IsoType::PfIsoPV));
379 tkem.setEgBinaryWord(gteg.pack());
387 const auto gteg = egele.
toGT();
394 egele.
floatRelIso(l1ct::EGIsoEleObjEmu::IsoType::TkIso));
396 tkele.setPFIsol(egele.
floatRelIso(l1ct::EGIsoEleObjEmu::IsoType::PfIso));
397 tkele.setEgBinaryWord(gteg.pack());
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
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
void remapRefs(edm::Event &iEvent, std::unique_ptr< TT > &out, RefRemapper &refRemapper) const
PatternWriter(const edm::ParameterSet &conf)
ap_uint< BITWIDTH > pack() const
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
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
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
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
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
std::string tkEmInstanceLabel_