CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
GlobalAlgBlkPacker.cc
Go to the documentation of this file.
3 
4 #include "GTTokens.h"
5 #include "GlobalAlgBlkPacker.h"
6 
7 namespace l1t {
8  namespace stage2 {
11  event.getByToken(static_cast<const GTTokens*>(toks)->getAlgToken(), algs);
12 
13  unsigned int wdPerBX = 6; //should this be configured someplace else?
14 
15  Blocks res;
16 
17  for (int blk = 0; blk < 9; blk++) {
18  unsigned int blkID = blk * 2 + 33;
19 
20  unsigned int algOffset = (2 * blk + 1) / 2;
21  algOffset = (algOffset % 3) * 192;
22 
23  //vector of words
24  std::vector<uint32_t> load;
25 
26  for (int i = algs->getFirstBX(); i <= algs->getLastBX(); ++i) {
27  for (auto j = algs->begin(i); j != algs->end(i); ++j) {
28  for (unsigned int wd = 0; wd < wdPerBX; wd++) {
29  uint32_t word = 0;
30 
31  if ((blk + 1) % 3 > 0 || wd < 4) {
32  unsigned int startAlg = wd * 32 + algOffset;
33  for (unsigned bt = 0; bt < 32; bt++) {
34  if (blk < 3) {
35  if (j->getAlgoDecisionInitial(bt + startAlg))
36  word |= (0x1 << bt);
37  } else if (blk < 6) {
38  if (j->getAlgoDecisionInterm(bt + startAlg))
39  word |= (0x1 << bt);
40  } else {
41  if (j->getAlgoDecisionFinal(bt + startAlg))
42  word |= (0x1 << bt);
43  }
44  }
45 
46  } else if (blk == 2 && (wd == 4 || wd == 5)) {
47  //putting hashed values of the menu name and firmware uuid into record.
48  if (wd == 4)
49  word |= (j->getL1MenuUUID() & 0xFFFFFFFF);
50  if (wd == 5)
51  word |= (j->getL1FirmwareUUID() & 0xFFFFFFFF);
52 
53  } else if (blk == 8) {
54  if (wd == 4) {
55  if (j->getFinalOR())
56  word |= (0x1 << 16);
57  if (j->getFinalORVeto())
58  word |= (0x1 << 8);
59  if (j->getFinalORPreVeto())
60  word |= (0x1 << 0);
61  } else if (wd == 5) {
62  word |= (j->getPreScColumn() & 0xFF);
63  }
64  } //if on blk
65 
66  load.push_back(word);
67  } //loop over words
68 
69  } //end loop over alg objects.(trivial one per BX)
70 
71  } //end loop over bx
72 
73  res.push_back(Block(blkID, load));
74 
75  } //loop over blks
76 
77  return res;
78  }
79  } // namespace stage2
80 } // namespace l1t
81 
Blocks pack(const edm::Event &, const PackerTokens *) override
uint64_t word
def load
Definition: svgfig.py:547
std::vector< Block > Blocks
Definition: Block.h:99
#define DEFINE_L1T_PACKER(type)
Definition: PackerFactory.h:23