CMS 3D CMS Logo

BMTFUnpackerOutput.cc
Go to the documentation of this file.
2 
4 
5 #include "BMTFUnpackerOutput.h"
6 
7 namespace l1t
8 {
9  namespace stage2
10  {
11 
13  {
14  unsigned int blockId = block.header().getID();
15  LogDebug("L1T") << "Block ID: " << blockId << " size: " << block.header().getSize();
16 
17  //ZeroSupression Handler
18  BxBlocks bxBlocks;
19  bool ZS_enabled = (bool)((block.header().getFlags() >> 1) & 0x01);//getFlags() returns first 8-bits from the amc header
20  if (ZS_enabled)
21  bxBlocks = block.getBxBlocks((unsigned int)6, true);//it returnes 7-32bit bxBlocks originated from the amc13 Block
22  else
23  bxBlocks = 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  }
39  else {
40  res->setBXRange(-2, 2);
41  LogDebug("L1T") << "No BXs included in the given Block. Set the BXRange to be (-2,2).";
42  return true;
43  }
44 
45  LogDebug("L1T") << "nBX = " << nBX << " firstBX = " << firstBX << " lastBX = " << lastBX;
46 
47  int processor = block.amc().getBoardID() - 1;
48  if ( processor < 0 || processor > 11 )
49  {
50  edm::LogInfo ("l1t:stage2::BMTFUnpackerOutput::unpack") << "Processor found out of range so 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 (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  {
65  LogDebug("L1T") << "Raw data is zero";
66  continue;
67  }
68 
69  RegionalMuonCand muCand;
70  RegionalMuonRawDigiTranslator::fillRegionalMuonCand(muCand, raw_first, raw_secnd, processor, tftype::bmtf);
71 
72  if (muCand.hwQual() == 0)
73  continue;
74 
75  muCand.setLink(48 + processor); //the link corresponds to the uGMT input
76  if (isKalman) {
77  muCand.setHwPt2((raw_secnd >> 23) & 0xFF);
78  muCand.setHwDXY((raw_secnd >> 2) & 0x3);
79  LogDebug("L1T") << "Pt = " << muCand.hwPt() << " eta: " << muCand.hwEta() << " phi: " << muCand.hwPhi() << " diplacedPt = " << muCand.hwPt2();
80  }
81  else
82  LogDebug("L1T") << "Pt = " << muCand.hwPt() << " eta: " << muCand.hwEta() << " phi: " << muCand.hwPhi();
83 
84  res->push_back(ibx, muCand);
85 
86  }//for iw
87  }//for ibx
88 
89  return true;
90  }//unpack
91 
92  }//ns stage2
93 }//ns lt1
94 
#define LogDebug(id)
void setLink(int link)
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:21
bool unpack(const Block &block, UnpackerCollections *coll) override
void getBXRange(int nbx, int &first, int &last)
BlockHeader header() const
Definition: Block.h:59
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:68
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:47
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:22
void amc(const amc::Header &h)
Definition: Block.h:62
unsigned int getFlags() const
Definition: Block.h:24
const int hwPt2() const
Get second compressed pT (returned int * 1.0 = pT (GeV))
void push_back(int bx, T object)