15 auto const bmtfToken =
static_cast<const GMTTokens*
>(toks)->getRegionalMuonCandTokenBMTF();
16 auto const omtfToken =
static_cast<const GMTTokens*
>(toks)->getRegionalMuonCandTokenOMTF();
17 auto const emtfToken =
static_cast<const GMTTokens*
>(toks)->getRegionalMuonCandTokenEMTF();
20 std::pair<int, int>
const bmtfMuonBx =
getMuons(bmtfObjMap,
event, bmtfToken);
21 std::pair<int, int>
const omtfMuonBx =
getMuons(omtfObjMap,
event, omtfToken);
22 std::pair<int, int>
const emtfMuonBx =
getMuons(emtfObjMap,
event, emtfToken);
25 std::pair<int, int> emtfMuonShowerBx{0, 0};
27 auto const emtfShowerToken =
static_cast<const GMTTokens*
>(toks)->getRegionalMuonShowerTokenEMTF();
34 packTF(bmtfObjMap, bmtfMuonBx.first, bmtfMuonBx.second, 0, 0,
blocks);
35 packTF(omtfObjMap, omtfMuonBx.first, omtfMuonBx.second, 0, 0,
blocks);
36 packTF(emtfObjMap, emtfMuonBx.first, emtfMuonBx.second, emtfMuonShowerBx.first, emtfMuonShowerBx.second,
blocks);
46 event.getByToken(tfShowerToken, muonShowers);
47 for (
int bx = muonShowers->getFirstBX();
bx <= muonShowers->getLastBX(); ++
bx) {
48 for (
auto muShower = muonShowers->begin(
bx); muShower != muonShowers->end(
bx); ++muShower) {
49 objMap[
bx][muShower->link()].shower = *muShower;
52 return std::make_pair(muonShowers->getFirstBX(), muonShowers->getLastBX());
59 event.getByToken(tfToken,
muons);
62 objMap[
bx][
mu->link()].mus.push_back(*
mu);
65 return std::make_pair(
muons->getFirstBX(),
muons->getLastBX());
69 const int firstMuonBx,
71 const int firstMuonShowerBx,
72 const int lastMuonShowerBx,
74 const auto firstBx{
std::min(firstMuonShowerBx, firstMuonBx)};
75 const auto lastBx{
std::max(lastMuonShowerBx, lastMuonBx)};
76 const auto nBx{lastBx - firstBx + 1};
81 for (
int bx{firstBx};
bx < lastBx + 1; ++
bx, ++bxCtr) {
82 if (objMap.count(
bx) > 0) {
83 for (
const auto& linkMap : objMap.at(
bx)) {
84 const auto linkTimes2{linkMap.first * 2};
85 const auto gmtObjects{linkMap.second};
88 if (payloadMap.count(linkTimes2) == 0) {
93 while (payloadMap[linkTimes2].size() < bxCtr *
wordsPerBx_) {
94 payloadMap[linkTimes2].push_back(0);
99 if (gmtObjects.mus.size() > 3) {
100 edm::LogError(
"L1T") <<
"Muon collection for link " << linkMap.first <<
" has " << gmtObjects.mus.size()
101 <<
" entries, but 3 is the maximum!";
104 std::array<uint32_t, 6>
buf{};
106 for (
const auto&
mu : gmtObjects.mus) {
113 buf.at(frameIdx++) = lsw;
114 buf.at(frameIdx++) = msw;
120 payloadMap[linkTimes2].insert(
121 payloadMap[linkTimes2].end(), std::move_iterator(
buf.begin()), std::move_iterator(
buf.end()));
126 for (
auto& kv : payloadMap) {
127 while (kv.second.size() < (bxCtr + 1) *
wordsPerBx_) {
128 kv.second.push_back(0);
134 for (
auto& kv : payloadMap) {
std::pair< int, int > getMuons(GMTObjectMap &objMap, const edm::Event &event, const edm::EDGetTokenT< RegionalMuonCandBxCollection > &tfToken)
std::map< unsigned int, std::vector< uint32_t > > PayloadMap
bool useEmtfDisplacementInfo_
bool useEmtfNominalTightShowers_
Log< level::Error, false > LogError
static void generatePackedShowerPayload(const RegionalMuonShower &shower, std::array< uint32_t, 6 > &payload, bool useEmtfNominalTightShowers, bool useEmtfLooseShowers)
bool useEmtfLooseShowers_
static void generatePackedDataWords(const RegionalMuonCand &mu, uint32_t &raw_data_00_31, uint32_t &raw_data_32_63, bool isKbmtf, bool useEmtfDisplacementInfo)
void packTF(const GMTObjectMap &objMap, int firstMuonBx, int lastMuonBx, int firstMuonShowerBx, int lastMuonShowerBx, Blocks &)
std::vector< Block > Blocks
static constexpr size_t wordsPerBx_
std::pair< int, int > getMuonShowers(GMTObjectMap &objMap, const edm::Event &event, const edm::EDGetTokenT< RegionalMuonShowerBxCollection > &tfShowerToken)
std::map< size_t, std::map< size_t, GMTObjects > > GMTObjectMap
#define DEFINE_L1T_PACKER(type)
Blocks pack(const edm::Event &, const PackerTokens *) override