CMS 3D CMS Logo

MuonPacker.cc
Go to the documentation of this file.
2 
3 #include "GMTTokens.h"
4 #include "MuonPacker.h"
5 
6 namespace l1t {
7  namespace stage2 {
10  event.getByToken(static_cast<const CommonTokens*>(toks)->getMuonToken(), muons);
11 
12  PayloadMap payloadMap;
13 
14  for (int bx = muons->getFirstBX(); bx <= muons->getLastBX(); ++bx) {
15  packBx(payloadMap, muons, bx);
16  }
17 
18  Blocks blocks;
19  // push everything in the blocks vector
20  for (auto& kv : payloadMap) {
21  blocks.push_back(Block(kv.first, kv.second));
22  }
23  return blocks;
24  }
25 
27  // the first word in every BX and every block id is 0
28  for (unsigned int blkId = b1_; blkId < b1_ + 7; blkId += 2) {
29  payloadMap[blkId].push_back(0);
30  }
31 
32  unsigned int blkId = b1_;
33  auto mu{muons->begin(bx)};
34  uint32_t mu1_shared_word{0};
35  uint32_t mu2_shared_word{0};
36  uint32_t mu1_msw{0};
37  uint32_t mu2_msw{0};
38  uint32_t mu1_lsw{0};
39  uint32_t mu2_lsw{0};
40  // Slightly convoluted logic to account for the Run-3 muon readout record:
41  // To make space for displacement information we moved the raw
42  // (i.e. non-extrapolated) eta value to the second "spare" word
43  // in the block which we call "shared word". So the logic below
44  // needs to be aware if it is operating on the first or second
45  // muon in the block in order to place the eta value in the right
46  // place in the shared word. Additionally the logic needs to
47  // wait for the second muon in the block before filling the
48  // payload map because the shared word goes in first.
49  for (int muCtr = 1; muCtr <= 8; ++muCtr) {
50  if (mu != muons->end(bx)) {
52  *mu, mu2_shared_word, mu2_lsw, mu2_msw, fedId_, fwId_, 2 - (muCtr % 2));
53  ++mu;
54  }
55 
56  // If we're remaining in the current block the muon we just packed is the first one in the block.
57  // If not we add both muons to the payload map and go to the next block.
58  if (muCtr % 2 == 1) {
59  mu1_shared_word = mu2_shared_word;
60  mu1_lsw = mu2_lsw;
61  mu1_msw = mu2_msw;
62  } else {
63  payloadMap[blkId].push_back(mu1_shared_word | mu2_shared_word);
64  payloadMap[blkId].push_back(mu1_lsw);
65  payloadMap[blkId].push_back(mu1_msw);
66  payloadMap[blkId].push_back(mu2_lsw);
67  payloadMap[blkId].push_back(mu2_msw);
68 
69  blkId += 2;
70 
71  mu1_shared_word = 0;
72  mu1_lsw = 0;
73  mu1_msw = 0;
74  }
75  mu2_shared_word = 0;
76  mu2_lsw = 0;
77  mu2_msw = 0;
78  }
79  }
80  } // namespace stage2
81 } // namespace l1t
82 
l1t::Blocks
std::vector< Block > Blocks
Definition: Block.h:99
PDWG_BPHSkim_cff.muons
muons
Definition: PDWG_BPHSkim_cff.py:47
PackerFactory.h
amptDefaultParameters_cff.mu
mu
Definition: amptDefaultParameters_cff.py:16
l1GtPatternGenerator_cfi.bx
bx
Definition: l1GtPatternGenerator_cfi.py:18
l1t::stage2::GMTMuonPacker
Definition: MuonPacker.h:33
MuonPacker.h
l1t::stage2::MuonPacker::fedId_
unsigned fedId_
Definition: MuonPacker.h:26
edm::Handle
Definition: AssociativeIterator.h:50
l1t::stage2::MuonPacker::fwId_
unsigned fwId_
Definition: MuonPacker.h:25
l1t::stage2::MuonPacker::b1_
unsigned b1_
Definition: MuonPacker.h:16
DEFINE_L1T_PACKER
#define DEFINE_L1T_PACKER(type)
Definition: PackerFactory.h:23
l1t
delete x;
Definition: CaloConfig.h:22
l1t::stage2::GTMuonPacker
Definition: MuonPacker.h:29
l1t::PackerTokens
Definition: PackerTokens.h:10
SiStripSourceConfigTier0_cff.stage2
stage2
Definition: SiStripSourceConfigTier0_cff.py:71
l1t::MuonRawDigiTranslator::generatePackedDataWords
static void generatePackedDataWords(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)
Definition: MuonRawDigiTranslator.cc:180
event
Definition: event.py:1
edm::Event
Definition: Event.h:73
l1t::Block
Definition: Block.h:70
l1t::stage2::MuonPacker::packBx
void packBx(PayloadMap &payloadMap, const edm::Handle< MuonBxCollection > &muons, int bx)
Definition: MuonPacker.cc:26
gather_cfg.blocks
blocks
Definition: gather_cfg.py:90
l1t::stage2::MuonPacker::pack
Blocks pack(const edm::Event &, const PackerTokens *) override
Definition: MuonPacker.cc:8
GMTTokens.h
l1t::stage2::MuonPacker::PayloadMap
std::map< unsigned int, std::vector< uint32_t > > PayloadMap
Definition: MuonPacker.h:18