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;
68  RegionalMuonRawDigiTranslator::fillRegionalMuonCand(muCand, raw_first, raw_secnd, processor, tftype::bmtf);
69 
70  if (muCand.hwQual() == 0)
71  continue;
72 
73  muCand.setLink(48 + processor); //the link corresponds to the uGMT input
74  if (isKalman) {
75  muCand.setHwPt2((raw_secnd >> 23) & 0xFF);
76  muCand.setHwDXY((raw_secnd >> 2) & 0x3);
77  LogDebug("L1T") << "Pt = " << muCand.hwPt() << " eta: " << muCand.hwEta() << " phi: " << muCand.hwPhi()
78  << " diplacedPt = " << muCand.hwPt2();
79  } else
80  LogDebug("L1T") << "Pt = " << muCand.hwPt() << " eta: " << muCand.hwEta() << " phi: " << muCand.hwPhi();
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 
#define LogDebug(id)
void setHwPt2(int bits)
Set compressed second displaced pT as transmitted by hardware LSB = 1.0 (8 bits)
unsigned int getID() const
Definition: Block.h:27
bool unpack(const Block &block, UnpackerCollections *coll) override
void getBXRange(int nbx, int &first, int &last)
BlockHeader header() const
Definition: Block.h:69
delete x;
Definition: CaloConfig.h:22
Definition: Electron.h:6
const int hwQual() const
Get quality code.
const int hwEta() const
Get compressed eta (returned int * 0.010875 = eta)
const int hwPhi() const
Get compressed local phi (returned int * 2*pi/576 = local phi in rad)
void setHwDXY(int bits)
Set compressed impact parameter with respect to beamspot (4 bits)
JetCorrectorParametersCollection coll
Definition: classes.h:10
std::vector< BxBlock > BxBlocks
Definition: BxBlock.h:79
static void fillRegionalMuonCand(RegionalMuonCand &, uint32_t, uint32_t, int, tftype)
void setBXRange(int bxFirst, int bxLast)
BxBlocks getBxBlocks(unsigned int payloadWordsPerBx, bool bxHeader) const
Definition: Block.cc:42
const int hwPt() const
Get compressed pT (returned int * 0.5 = pT (GeV))
#define DEFINE_L1T_UNPACKER(type)
unsigned int getSize() const
Definition: Block.h:28
void amc(const amc::Header &h)
Definition: Block.h:72
unsigned int getFlags() const
Definition: Block.h:30
const int hwPt2() const
Get second compressed pT (returned int * 1.0 = pT (GeV))
void push_back(int bx, T object)