CMS 3D CMS Logo

BMTFPackerOutput.cc
Go to the documentation of this file.
1 #include "BMTFPackerOutput.h"
2 #include <vector>
3 
4 // Implementation
5 namespace l1t {
6  namespace stage2 {
8  int board_id = (int)board();
9 
10  auto muonToken = static_cast<const BMTFTokens*>(toks)->getOutputMuonToken();
11 
12  Blocks blocks;
13  const int bmtfBlockID = 123;
14  edm::LogInfo("L1T-BMTFPackerOutput") << "Will use setup:"
15  << " isKalman->" << isKalman_;
16 
18  event.getByToken(muonToken, muons);
19 
20  for (auto imu = muons->begin(); imu != muons->end(); imu++) {
21  if (imu->processor() + 1 == board_id) {
22  uint32_t firstWord(0), lastWord(0);
23  RegionalMuonRawDigiTranslator::generatePackedDataWords(*imu, firstWord, lastWord, isKalman_, false);
24  payloadMap_[bmtfBlockID].push_back(firstWord); //imu->link()*2+1
25  payloadMap_[bmtfBlockID].push_back(lastWord); //imu->link()*2+1
26  }
27  } //imu
28 
29  //in case less than 3 muons have been found by the processor
30  if (payloadMap_[bmtfBlockID].size() < 6) {
31  unsigned int initialSize = payloadMap_[bmtfBlockID].size();
32 
33  for (unsigned int j = 0; j < 3 - initialSize / 2; j++) {
34  payloadMap_[bmtfBlockID].push_back(0);
35  uint32_t nullMuon_word2 = 0 | ((65532 & 0xFFFF) << 3) | ((2 & 0x3) << 0);
36  payloadMap_[bmtfBlockID].push_back(nullMuon_word2);
37  }
38  } else if (payloadMap_[bmtfBlockID].size() < 30 && payloadMap_[bmtfBlockID].size() > 6) {
39  unsigned int initialSize = payloadMap_[bmtfBlockID].size();
40 
41  for (unsigned int j = 0; j < 15 - initialSize / 2; j++) {
42  payloadMap_[bmtfBlockID].push_back(0);
43  uint32_t nullMuon_word2 = 0 | ((65532 & 0xFFFF) << 3) | ((2 & 0x3) << 0);
44  payloadMap_[bmtfBlockID].push_back(nullMuon_word2);
45  }
46  }
47 
48  Block block(bmtfBlockID, payloadMap_[bmtfBlockID]);
49 
50  blocks.push_back(block);
51 
52  return blocks;
53  }
54 
55  } // namespace stage2
56 } // namespace l1t
Blocks pack(const edm::Event &, const PackerTokens *) override
delete x;
Definition: CaloConfig.h:22
muons
the two sets of parameters below are mutually exclusive, depending if RECO or ALCARECO is used the us...
Definition: DiMuonV_cfg.py:212
static void generatePackedDataWords(const RegionalMuonCand &mu, uint32_t &raw_data_00_31, uint32_t &raw_data_32_63, bool isKbmtf, bool useEmtfDisplacementInfo)
std::vector< Block > Blocks
Definition: Block.h:99
Log< level::Info, false > LogInfo
#define DEFINE_L1T_PACKER(type)
Definition: PackerFactory.h:23
unsigned board()
Definition: Packer.h:18
std::map< unsigned int, std::vector< uint32_t > > payloadMap_
Definition: event.py:1