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  {
12  {
13  unsigned int blockId = block.header().getID();
14  LogDebug("L1T") << "Block ID: " << blockId << " size: " << block.header().getSize();
15 
16  //ZeroSupression Handler
17  BxBlocks bxBlocks;
18  bool ZS_enabled = (bool)((block.header().getFlags() >> 1) & 0x01);//getFlags() returns first 8-bits from the amc header
19  if (ZS_enabled)
20  bxBlocks = block.getBxBlocks((unsigned int)6, true);//it returnes 7-32bit bxBlocks originated from the amc13 Block
21  else
22  bxBlocks = block.getBxBlocks((unsigned int)6, false);//it returnes 6-32bit bxBlocks originated from the amc13 Block
23 
25  res = static_cast<BMTFCollections*>(coll)->getBMTFMuons();
26  //BxBlocks changed the format of the blocks
27  int firstBX = 0, lastBX = 0;
28  int nBX = 0;
29  if (!bxBlocks.empty()) {
30  nBX = bxBlocks[0].header().getTotalBx();//how many BX included in the BxBlock before Suppression
31  getBXRange(nBX, firstBX, lastBX);
32  res->setBXRange(firstBX, lastBX);
33  }
34  else {
35  res->setBXRange(-2, 2);
36  LogDebug("L1T") << "No BXs included in the given Block. Set the BXRange to be (-2,2).";
37  return true;
38  }
39 
40  LogDebug("L1T") << "nBX = " << nBX << " firstBX = " << firstBX << " lastBX = " << lastBX;
41 
42  int processor = block.amc().getBoardID() - 1;
43  if ( processor < 0 || processor > 11 )
44  {
45  edm::LogInfo ("l1t:stage2::BMTFUnpackerOutput::unpack") << "Processor found out of range so it will be calculated by the old way";
46  if ( block.amc().getAMCNumber()%2 != 0 )
47  processor = block.amc().getAMCNumber()/2 ;
48  else
49  processor = 6 + (block.amc().getAMCNumber()/2 -1);
50  }
51 
52  for (auto bxBlock : bxBlocks) {
53  int ibx = bxBlock.header().getBx();
54 
55  for (auto iw = 0; iw < 6; iw+=2) {
56  uint32_t raw_first = bxBlock.payload()[iw];//payload[ip+(ibx+lastBX)*6];
57  uint32_t raw_secnd = bxBlock.payload()[iw+1];//payload[ip+(ibx+lastBX)*6];
58  if ( raw_first == 0 )
59  {
60  LogDebug("L1T") << "Raw data is zero";
61  continue;
62  }
63 
64  RegionalMuonCand muCand;
65  RegionalMuonRawDigiTranslator::fillRegionalMuonCand(muCand, raw_first, raw_secnd, processor, tftype::bmtf);
66  muCand.setLink(48 + processor); //the link corresponds to the uGMT input
67 
68  LogDebug("L1T") << "Pt = " << muCand.hwPt() << " eta: " << muCand.hwEta() << " phi: " << muCand.hwPhi();
69 
70  if ( muCand.hwQual() != 0 ) {
71  res->push_back(ibx, muCand);
72  }
73 
74  }//for iw
75  }//for ibx
76 
77  return true;
78  }//unpack
79  }//ns stage2
80 }//ns lt1
81 
#define LogDebug(id)
void setLink(int link)
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)
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
void push_back(int bx, T object)