CMS 3D CMS Logo

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