10 std::pair<int, int> muonBx =
getMuons(gmtObjMap,
event, static_cast<const CommonTokens*>(toks)->getMuonToken());
11 std::pair<int, int> muonShowerBx{0, 0};
13 muonShowerBx =
getMuonShowers(gmtObjMap,
event, static_cast<const CommonTokens*>(toks)->getMuonShowerToken());
18 packBx(gmtObjMap, muonBx.first, muonBx.second, muonShowerBx.first, muonShowerBx.second, payloadMap);
22 for (
auto& kv : payloadMap) {
32 event.getByToken(showerToken, muonShowers);
33 for (
int bx = muonShowers->getFirstBX();
bx <= muonShowers->getLastBX(); ++
bx) {
34 if (muonShowers->size(
bx) > 0) {
35 objMap[
bx].shower = muonShowers->at(
bx, 0);
38 return std::make_pair(muonShowers->getFirstBX(), muonShowers->getLastBX());
49 objMap[
bx].mus.push_back(*
mu);
52 return std::make_pair(
muons->getFirstBX(),
muons->getLastBX());
56 const int firstMuonBx,
58 const int firstMuonShowerBx,
59 const int lastMuonShowerBx,
61 const auto firstBx{
std::min(firstMuonShowerBx, firstMuonBx)};
62 const auto lastBx{
std::max(lastMuonShowerBx, lastMuonBx)};
64 for (
int bx{firstBx};
bx < lastBx + 1; ++
bx) {
66 for (
unsigned int blkId =
b1_; blkId <
b1_ + 7; blkId += 2) {
67 payloadMap[blkId].push_back(0);
70 unsigned int blkId =
b1_;
71 uint32_t mu1_shared_word{0};
72 uint32_t mu2_shared_word{0};
77 auto mu{objMap.at(
bx).mus.begin()};
78 std::array<uint32_t, 4> showerWords{
89 for (
int muCtr = 1; muCtr <= 8; ++muCtr) {
90 if (
mu != objMap.at(
bx).mus.end()) {
92 *
mu, mu2_shared_word, mu2_lsw, mu2_msw,
fedId_,
fwId_, 2 - (muCtr % 2));
99 mu1_shared_word = mu2_shared_word;
102 mu1_msw |= showerWords.at(muCtr / 2);
104 payloadMap[blkId].push_back(mu1_shared_word | mu2_shared_word);
105 payloadMap[blkId].push_back(mu1_lsw);
106 payloadMap[blkId].push_back(mu1_msw);
107 payloadMap[blkId].push_back(mu2_lsw);
108 payloadMap[blkId].push_back(mu2_msw);
std::pair< int, int > getMuons(GMTOutputObjectMap &objMap, const edm::Event &event, const edm::EDGetTokenT< MuonBxCollection > &muonToken)
std::map< size_t, GMTObjects > GMTOutputObjectMap
std::map< unsigned int, std::vector< uint32_t > > PayloadMap
void packBx(const GMTOutputObjectMap &objMap, int firstMuonBx, int lastMuonBx, int firstMuonShowerBx, int lastMuonShowerBx, PayloadMap &payloadMap)
Blocks pack(const edm::Event &, const PackerTokens *) override
std::vector< Block > Blocks
static void generatePackedMuonDataWords(const Muon &mu, uint32_t &raw_data_spare, uint32_t &raw_data_00_31, uint32_t &raw_data_32_63, int fedId, int fwId, int muInBx)
#define DEFINE_L1T_PACKER(type)
static std::array< uint32_t, 4 > getPackedShowerDataWords(const MuonShower &shower, int fedId, int fwId)
std::pair< int, int > getMuonShowers(GMTOutputObjectMap &objMap, const edm::Event &event, const edm::EDGetTokenT< MuonShowerBxCollection > &showerToken)