CMS 3D CMS Logo

BMTFUnpackerOutput.cc
Go to the documentation of this file.
3 #include "BMTFUnpackerOutput.h"
4 
5 namespace l1t {
6  namespace stage2 {
7 
9  unsigned int blockId = block.header().getID();
10  LogDebug("L1T") << "Block ID: " << blockId << " size: " << block.header().getSize();
11 
12  //ZeroSupression Handler
13  BxBlocks bxBlocks;
14  bool ZS_enabled =
15  (bool)((block.header().getFlags() >> 1) & 0x01); //getFlags() returns first 8-bits from the amc header
16  if (ZS_enabled)
17  bxBlocks =
18  block.getBxBlocks((unsigned int)6, true); //it returnes 7-32bit bxBlocks originated from the amc13 Block
19  else
20  bxBlocks =
21  block.getBxBlocks((unsigned int)6, false); //it returnes 6-32bit bxBlocks originated from the amc13 Block
22 
23  edm::LogInfo("L1T") << "Will use the setup:"
24  << " ZS_enabled->" << ZS_enabled << " isTriggeringAlgo->" << isTriggeringAlgo << " isKalman->"
25  << isKalman;
26 
28  if (isTriggeringAlgo)
29  res = static_cast<BMTFCollections *>(coll)->getBMTFMuons();
30  else
31  res = static_cast<BMTFCollections *>(coll)->getBMTF2Muons();
32 
33  //BxBlocks changed the format of the blocks
34  int firstBX = 0, lastBX = 0;
35  int nBX = 0;
36  if (!bxBlocks.empty()) {
37  nBX = bxBlocks[0].header().getTotalBx(); //how many BX included in the BxBlock before Suppression
38  getBXRange(nBX, firstBX, lastBX);
39  res->setBXRange(firstBX, lastBX);
40  } else {
41  res->setBXRange(-2, 2);
42  LogDebug("L1T") << "No BXs included in the given Block. Set the BXRange to be (-2,2).";
43  return true;
44  }
45 
46  LogDebug("L1T") << "nBX = " << nBX << " firstBX = " << firstBX << " lastBX = " << lastBX;
47 
48  int processor = block.amc().getBoardID() - 1;
49  if (processor < 0 || processor > 11) {
50  edm::LogInfo("L1T") << "Processor found out of range, it will be calculated by the old way";
51  if (block.amc().getAMCNumber() % 2 != 0)
52  processor = block.amc().getAMCNumber() / 2;
53  else
54  processor = 6 + (block.amc().getAMCNumber() / 2 - 1);
55  }
56 
57  for (const auto &bxBlock : bxBlocks) {
58  int ibx = bxBlock.header().getBx();
59 
60  for (auto iw = 0; iw < 6; iw += 2) {
61  uint32_t raw_first = bxBlock.payload()[iw]; //payload[ip+(ibx+lastBX)*6];
62  uint32_t raw_secnd = bxBlock.payload()[iw + 1]; //payload[ip+(ibx+lastBX)*6];
63  if (raw_first == 0) {
64  LogDebug("L1T") << "Raw data is zero";
65  continue;
66  }
67 
68  RegionalMuonCand muCand;
70  muCand, raw_first, raw_secnd, processor, tftype::bmtf, isKalman);
71 
72  if (muCand.hwPt() == 0) {
73  continue;
74  }
75 
76  if (isKalman) {
77  LogDebug("L1T") << "Pt = " << muCand.hwPt() << " eta: " << muCand.hwEta() << " phi: " << muCand.hwPhi()
78  << " diplacedPt = " << muCand.hwPtUnconstrained();
79  } else {
80  LogDebug("L1T") << "Pt = " << muCand.hwPt() << " eta: " << muCand.hwEta() << " phi: " << muCand.hwPhi();
81  }
82 
83  res->push_back(ibx, muCand);
84 
85  } //for iw
86  } //for ibx
87 
88  return true;
89  } //unpack
90 
91  } // namespace stage2
92 } // namespace l1t
93 
l1t::bmtf
Definition: RegionalMuonCandFwd.h:8
RegionalMuonRawDigiTranslator.h
electrons_cff.bool
bool
Definition: electrons_cff.py:393
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:8
l1t::stage2::BMTFUnpackerOutput
Definition: BMTFUnpackerOutput.h:9
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
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:223
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:70
l1t::RegionalMuonCand
Definition: RegionalMuonCand.h:8
l1t::BxBlocks
std::vector< BxBlock > BxBlocks
Definition: BxBlock.h:79