CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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, false);
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 
unsigned int getID() const
Definition: Block.h:43
bool unpack(const Block &block, UnpackerCollections *coll) override
void getBXRange(int nbx, int &first, int &last)
BlockHeader header() const
Definition: Block.h:85
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)
Log< level::Info, false > LogInfo
std::vector< BxBlock > BxBlocks
Definition: BxBlock.h:79
void setBXRange(int bxFirst, int bxLast)
BxBlocks getBxBlocks(unsigned int payloadWordsPerBx, bool bxHeader) const
Definition: Block.cc:40
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:44
static void fillRegionalMuonCand(RegionalMuonCand &mu, uint32_t raw_data_00_31, uint32_t raw_data_32_63, int proc, tftype tf, bool isKbmtf, bool useEmtfDisplacementInfo)
void amc(const amc::Header &h)
Definition: Block.h:88
unsigned int getFlags() const
Definition: Block.h:46
void push_back(int bx, T object)
const int hwPtUnconstrained() const
Get second compressed pT (returned int * 1.0 = pT (GeV))
#define LogDebug(id)