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  namespace stage2 {
10  int board_id = (int)board();
11 
12  auto muonToken = static_cast<const BMTFTokens*>(toks)->getOutputMuonToken();
13 
14  Blocks blocks;
15 
16  const int bmtfBlockID = 123;
17 
19  event.getByToken(muonToken, muons);
20 
21  for (auto imu = muons->begin(); imu != muons->end(); imu++) {
22  if (imu->processor() + 1 == board_id) {
23  uint32_t firstWord(0), lastWord(0);
25  payloadMap_[bmtfBlockID].push_back(firstWord); //imu->link()*2+1
26  payloadMap_[bmtfBlockID].push_back(lastWord); //imu->link()*2+1
27  }
28  } //imu
29 
30  //in case less than 3 muons have been found by the processor
31  if (payloadMap_[bmtfBlockID].size() < 6) {
32  unsigned int initialSize = payloadMap_[bmtfBlockID].size();
33 
34  for (unsigned int j = 0; j < 3 - initialSize / 2; j++) {
35  payloadMap_[bmtfBlockID].push_back(0);
36  uint32_t nullMuon_word2 = 0 | ((65532 & 0xFFFF) << 3) | ((2 & 0x3) << 0);
37  payloadMap_[bmtfBlockID].push_back(nullMuon_word2);
38  }
39  } else if (payloadMap_[bmtfBlockID].size() < 30 && payloadMap_[bmtfBlockID].size() > 6) {
40  unsigned int initialSize = payloadMap_[bmtfBlockID].size();
41 
42  for (unsigned int j = 0; j < 15 - 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 
49  Block block(bmtfBlockID, payloadMap_[bmtfBlockID]);
50 
51  blocks.push_back(block);
52 
53  /*
54  //debug from here
55  std::cout << "block id : " << block.header().getID() << std::endl;
56 
57  std::cout << "payload created : " << std::endl;
58  for (auto &word : block.payload())
59  std::cout << std::bitset<32>(word).to_string() << std::endl;
60  //debug up to here
61  */
62 
63  return blocks;
64  }
65 
66  } // namespace stage2
67 } // namespace l1t
l1t::Blocks
std::vector< Block > Blocks
Definition: Block.h:83
PDWG_BPHSkim_cff.muons
muons
Definition: PDWG_BPHSkim_cff.py:47
edm::Handle
Definition: AssociativeIterator.h:50
l1t::stage2::BMTFPackerOutput::payloadMap_
std::map< unsigned int, std::vector< uint32_t > > payloadMap_
Definition: BMTFPackerOutput.h:14
l1t::stage2::BMTFPackerOutput::pack
Blocks pack(const edm::Event &, const PackerTokens *) override
Definition: BMTFPackerOutput.cc:9
BMTFPackerOutput.h
l1t::stage2::BMTFPackerOutput
Definition: BMTFPackerOutput.h:11
l1t::RegionalMuonRawDigiTranslator::generatePackedDataWords
static void generatePackedDataWords(const RegionalMuonCand &mu, uint32_t &raw_data_00_31, uint32_t &raw_data_32_63, bool isKalman)
Definition: RegionalMuonRawDigiTranslator.cc:99
l1tSummaryGtStage2Digis_cfi.muonToken
muonToken
Definition: l1tSummaryGtStage2Digis_cfi.py:16
DEFINE_L1T_PACKER
#define DEFINE_L1T_PACKER(type)
Definition: PackerFactory.h:23
l1t
delete x;
Definition: CaloConfig.h:22
createfilelist.int
int
Definition: createfilelist.py:10
groupFilesInBlocks.block
block
Definition: groupFilesInBlocks.py:150
l1t::PackerTokens
Definition: PackerTokens.h:10
SiStripSourceConfigTier0_cff.stage2
stage2
Definition: SiStripSourceConfigTier0_cff.py:71
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
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::Packer::board
unsigned board()
Definition: Packer.h:18
l1t::stage2::BMTFPackerOutput::isKalman_
bool isKalman_
Definition: BMTFPackerOutput.h:19
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443