CMS 3D CMS Logo

MuonPacker.cc
Go to the documentation of this file.
3 
5 #include "GMTTokens.h"
6 #include "MuonPacker.h"
7 
8 namespace l1t {
9  namespace stage2 {
12  event.getByToken(static_cast<const CommonTokens*>(toks)->getMuonToken(), muons);
13 
14  PayloadMap payloadMap;
15 
16  for (int i = muons->getFirstBX(); i <= muons->getLastBX(); ++i) {
17  // the first muon in every BX and every block id is 0
18  for (unsigned int blkId = b1_; blkId < b1_ + 7; blkId += 2) {
19  payloadMap[blkId].push_back(0);
20  payloadMap[blkId].push_back(0);
21  }
22 
23  unsigned int blkId = b1_;
24  int muCtr = 1;
25  for (auto mu = muons->begin(i); mu != muons->end(i) && muCtr <= 8; ++mu, ++muCtr) {
26  uint32_t msw = 0;
27  uint32_t lsw = 0;
28 
30 
31  payloadMap[blkId].push_back(lsw);
32  payloadMap[blkId].push_back(msw);
33 
34  // go to next block id after two muons
35  if (muCtr % 2 == 0) {
36  blkId += 2;
37  }
38  }
39 
40  // padding empty muons to reach 3 muons per block id per BX
41  for (auto& kv : payloadMap) {
42  while (kv.second.size() % 6 != 0) {
43  kv.second.push_back(0);
44  }
45  }
46  }
47 
48  Blocks blocks;
49  // push everything in the blocks vector
50  for (auto& kv : payloadMap) {
51  //cout << kv.first << ": " << kv.second.size() << kv.second[0] << "\n";
52  blocks.push_back(Block(kv.first, kv.second));
53  }
54  return blocks;
55  }
56  } // namespace stage2
57 } // namespace l1t
58 
l1t::Blocks
std::vector< Block > Blocks
Definition: Block.h:83
PDWG_BPHSkim_cff.muons
muons
Definition: PDWG_BPHSkim_cff.py:47
mps_fire.i
i
Definition: mps_fire.py:355
PackerFactory.h
MuonRawDigiTranslator.h
amptDefaultParameters_cff.mu
mu
Definition: amptDefaultParameters_cff.py:16
l1t::stage2::GMTMuonPacker
Definition: MuonPacker.h:23
MuonPacker.h
edm::Handle
Definition: AssociativeIterator.h:50
l1t::MuonRawDigiTranslator::generatePackedDataWords
static void generatePackedDataWords(const Muon &, uint32_t &, uint32_t &)
Definition: MuonRawDigiTranslator.cc:71
l1t::stage2::MuonPacker::b1_
unsigned b1_
Definition: MuonPacker.h:13
DEFINE_L1T_PACKER
#define DEFINE_L1T_PACKER(type)
Definition: PackerFactory.h:23
Event.h
l1t
delete x;
Definition: CaloConfig.h:22
l1t::stage2::GTMuonPacker
Definition: MuonPacker.h:19
l1t::PackerTokens
Definition: PackerTokens.h:10
SiStripSourceConfigTier0_cff.stage2
stage2
Definition: SiStripSourceConfigTier0_cff.py:71
event
Definition: event.py:1
edm::Event
Definition: Event.h:73
l1t::Block
Definition: Block.h:54
gather_cfg.blocks
blocks
Definition: gather_cfg.py:90
l1t::stage2::MuonPacker::pack
Blocks pack(const edm::Event &, const PackerTokens *) override
Definition: MuonPacker.cc:10
GMTTokens.h
l1t::stage2::MuonPacker::PayloadMap
std::map< unsigned int, std::vector< uint32_t > > PayloadMap
Definition: MuonPacker.h:16