CMS 3D CMS Logo

BMTFPackerOutput.cc
Go to the documentation of this file.
1 #include "BMTFPackerOutput.h"
2 
3 #include <vector>
4 //#include <bitset>//debug
5 
6 // Implementation
7 namespace l1t
8 {
9  namespace stage2
10  {
12  {
13 
14  int board_id = (int)board();
15 
16  auto muonToken = static_cast<const BMTFTokens*>(toks)->getOutputMuonToken();
17 
18  Blocks blocks;
19 
20  const int bmtfBlockID = 123;
21 
23  event.getByToken(muonToken, muons);
24 
25  for (auto imu = muons->begin(); imu != muons->end(); imu++)
26  {
27 
28  if (imu->processor()+1 == board_id){
29  uint32_t firstWord(0), lastWord(0);
31  payloadMap_[bmtfBlockID].push_back(firstWord); //imu->link()*2+1
32  payloadMap_[bmtfBlockID].push_back(lastWord); //imu->link()*2+1
33  }
34  }//imu
35 
36 
37  //in case less than 3 muons have been found by the processor
38  if (payloadMap_[bmtfBlockID].size() < 6)
39  {
40  unsigned int initialSize = payloadMap_[bmtfBlockID].size();
41 
42  for(unsigned int j = 0; j < 3-initialSize/2; j++){
43  payloadMap_[bmtfBlockID].push_back(0);
44  uint32_t nullMuon_word2 = 0 | ( (65532 & 0xFFFF) << 3 ) | ( (2 & 0x3) << 0 );
45  payloadMap_[bmtfBlockID].push_back(nullMuon_word2);
46  }
47  }
48  else if (payloadMap_[bmtfBlockID].size() < 30 && payloadMap_[bmtfBlockID].size() > 6)
49  {
50  unsigned int initialSize = payloadMap_[bmtfBlockID].size();
51 
52  for(unsigned int j = 0; j < 15-initialSize/2; j++){
53  payloadMap_[bmtfBlockID].push_back(0);
54  uint32_t nullMuon_word2 = 0 | ( (65532 & 0xFFFF) << 3 ) | ( (2 & 0x3) << 0 );
55  payloadMap_[bmtfBlockID].push_back(nullMuon_word2);
56  }
57  }
58 
59 
60 
61  Block block(bmtfBlockID, payloadMap_[bmtfBlockID]);
62 
63  blocks.push_back(block);
64 
65 
66  /*
67  //debug from here
68  std::cout << "block id : " << block.header().getID() << std::endl;
69 
70  std::cout << "payload created : " << std::endl;
71  for (auto &word : block.payload())
72  std::cout << std::bitset<32>(word).to_string() << std::endl;
73  //debug up to here
74  */
75 
76 
77  return blocks;
78  }
79 
80  }//ns stage2
81 }//ns l1t
size
Write out results.
static void generatePackedDataWords(const RegionalMuonCand &, uint32_t &, uint32_t &)
Blocks pack(const edm::Event &, const PackerTokens *) override
delete x;
Definition: CaloConfig.h:22
std::vector< Block > Blocks
Definition: Block.h:72
#define DEFINE_L1T_PACKER(type)
Definition: PackerFactory.h:22
unsigned board()
Definition: Packer.h:18
std::map< unsigned int, std::vector< uint32_t > > payloadMap_
Definition: event.py:1