CMS 3D CMS Logo

BMTFUnpackerOutput.cc
Go to the documentation of this file.
2 
4 
5 #include "BMTFUnpackerOutput.h"
6 
7 namespace l1t {
8  namespace stage2 {
9 
11  unsigned int blockId = block.header().getID();
12  LogDebug("L1T") << "Block ID: " << blockId << " size: " << block.header().getSize();
13 
14  //ZeroSupression Handler
15  BxBlocks bxBlocks;
16  bool ZS_enabled =
17  (bool)((block.header().getFlags() >> 1) & 0x01); //getFlags() returns first 8-bits from the amc header
18  if (ZS_enabled)
19  bxBlocks =
20  block.getBxBlocks((unsigned int)6, true); //it returnes 7-32bit bxBlocks originated from the amc13 Block
21  else
22  bxBlocks =
23  block.getBxBlocks((unsigned int)6, false); //it returnes 6-32bit bxBlocks originated from the amc13 Block
24 
26  if (isTriggeringAlgo)
27  res = static_cast<BMTFCollections *>(coll)->getBMTFMuons();
28  else
29  res = static_cast<BMTFCollections *>(coll)->getBMTF2Muons();
30 
31  //BxBlocks changed the format of the blocks
32  int firstBX = 0, lastBX = 0;
33  int nBX = 0;
34  if (!bxBlocks.empty()) {
35  nBX = bxBlocks[0].header().getTotalBx(); //how many BX included in the BxBlock before Suppression
36  getBXRange(nBX, firstBX, lastBX);
37  res->setBXRange(firstBX, lastBX);
38  } else {
39  res->setBXRange(-2, 2);
40  LogDebug("L1T") << "No BXs included in the given Block. Set the BXRange to be (-2,2).";
41  return true;
42  }
43 
44  LogDebug("L1T") << "nBX = " << nBX << " firstBX = " << firstBX << " lastBX = " << lastBX;
45 
46  int processor = block.amc().getBoardID() - 1;
47  if (processor < 0 || processor > 11) {
48  edm::LogInfo("l1t:stage2::BMTFUnpackerOutput::unpack")
49  << "Processor found out of range so it will be calculated by the old way";
50  if (block.amc().getAMCNumber() % 2 != 0)
51  processor = block.amc().getAMCNumber() / 2;
52  else
53  processor = 6 + (block.amc().getAMCNumber() / 2 - 1);
54  }
55 
56  for (auto bxBlock : bxBlocks) {
57  int ibx = bxBlock.header().getBx();
58 
59  for (auto iw = 0; iw < 6; iw += 2) {
60  uint32_t raw_first = bxBlock.payload()[iw]; //payload[ip+(ibx+lastBX)*6];
61  uint32_t raw_secnd = bxBlock.payload()[iw + 1]; //payload[ip+(ibx+lastBX)*6];
62  if (raw_first == 0) {
63  LogDebug("L1T") << "Raw data is zero";
64  continue;
65  }
66 
67  RegionalMuonCand muCand;
69  muCand, raw_first, raw_secnd, processor, tftype::bmtf, isKalman);
70 
71  if (muCand.hwPt() == 0) {
72  continue;
73  }
74 
75  if (isKalman) {
76  LogDebug("L1T") << "Pt = " << muCand.hwPt() << " eta: " << muCand.hwEta() << " phi: " << muCand.hwPhi()
77  << " diplacedPt = " << muCand.hwPtUnconstrained();
78  } else {
79  LogDebug("L1T") << "Pt = " << muCand.hwPt() << " eta: " << muCand.hwEta() << " phi: " << muCand.hwPhi();
80  }
81 
82  res->push_back(ibx, muCand);
83 
84  } //for iw
85  } //for ibx
86 
87  return true;
88  } //unpack
89 
90  } // namespace stage2
91 } // namespace l1t
92 
l1t::bmtf
Definition: RegionalMuonCandFwd.h:8
RegionalMuonRawDigiTranslator.h
electrons_cff.bool
bool
Definition: electrons_cff.py:372
l1t::RegionalMuonCand::hwPhi
const int hwPhi() const
Get compressed local phi (returned int * 2*pi/576 = local phi in rad)
Definition: RegionalMuonCand.h:167
l1t::stage2::BMTFUnpackerOutput::isKalman
bool isKalman
Definition: BMTFUnpackerOutput.h:27
l1t::stage2::BMTFUnpackerOutput::unpack
bool unpack(const Block &block, UnpackerCollections *coll) override
Definition: BMTFUnpackerOutput.cc:10
l1t::stage2::BMTFUnpackerOutput
Definition: BMTFUnpackerOutput.h:9
edm::LogInfo
Definition: MessageLogger.h:254
RPCBxOrConfig_cff.firstBX
firstBX
Definition: RPCBxOrConfig_cff.py:5
l1t::RegionalMuonCand::hwEta
const int hwEta() const
Get compressed eta (returned int * 0.010875 = eta)
Definition: RegionalMuonCand.h:169
BXVector< RegionalMuonCand >
l1t::RegionalMuonCand::hwPt
const int hwPt() const
Get compressed pT (returned int * 0.5 = pT (GeV))
Definition: RegionalMuonCand.h:161
UnpackerFactory.h
l1t::RegionalMuonRawDigiTranslator::fillRegionalMuonCand
static void fillRegionalMuonCand(RegionalMuonCand &mu, uint32_t raw_data_00_31, uint32_t raw_data_32_63, int proc, tftype tf, bool isKalman)
Definition: RegionalMuonRawDigiTranslator.cc:4
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:670
l1t
delete x;
Definition: CaloConfig.h:22
l1t::RegionalMuonCand::hwPtUnconstrained
const int hwPtUnconstrained() const
Get second compressed pT (returned int * 1.0 = pT (GeV))
Definition: RegionalMuonCand.h:163
groupFilesInBlocks.block
block
Definition: groupFilesInBlocks.py:150
res
Definition: Electron.h:6
SiStripSourceConfigTier0_cff.stage2
stage2
Definition: SiStripSourceConfigTier0_cff.py:71
BMTFUnpackerOutput.h
l1t::UnpackerCollections
Definition: UnpackerCollections.h:9
RPCBxOrConfig_cff.lastBX
lastBX
Definition: RPCBxOrConfig_cff.py:4
l1t::stage2::BMTFUnpackerOutput::isTriggeringAlgo
bool isTriggeringAlgo
Definition: BMTFUnpackerOutput.h:26
DEFINE_L1T_UNPACKER
#define DEFINE_L1T_UNPACKER(type)
Definition: UnpackerFactory.h:23
l1t::getBXRange
void getBXRange(int nbx, int &first, int &last)
Definition: UnpackerFactory.cc:12
l1t::Block
Definition: Block.h:54
l1t::RegionalMuonCand
Definition: RegionalMuonCand.h:8
l1t::BxBlocks
std::vector< BxBlock > BxBlocks
Definition: BxBlock.h:79