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  auto payload = block.payload();
17 
18  //int nwords(2); //two words per muon
19  int nBX, firstBX, lastBX;
20  nBX = int(ceil(block.header().getSize()/6));
21 
22  getBXRange(nBX, firstBX, lastBX);
23  //if we want to use central BX, uncommect the two lines below
24  //firstBX=0;
25  //lastBX=0;
26  //LogDebug("L1T") << "BX override. Set firstBX = lastBX = 0";
27 
29  res = static_cast<BMTFCollections*>(coll)->getBMTFMuons();
30  res->setBXRange(firstBX, lastBX);
31 
32  LogDebug("L1T") << "nBX = " << nBX << " firstBX = " << firstBX << " lastBX = " << lastBX;
33 
34  int processor = block.amc().getBoardID() - 1;
35  if ( processor < 0 || processor > 11 )
36  {
37  edm::LogInfo ("l1t:stage2::BMTFUnpackerOutput::unpack") << "Processor found out of range so it will be calculated by the old way";
38  if ( block.amc().getAMCNumber()%2 != 0 )
39  processor = block.amc().getAMCNumber()/2 ;
40  else
41  processor = 6 + (block.amc().getAMCNumber()/2 -1);
42  }
43 
44  for(int ibx = firstBX; ibx <= lastBX; ibx++)
45  {
46  int ip(0);
47  for(unsigned int iw = 0; iw < block.header().getSize()/nBX; iw += 2)
48  {
49  uint32_t raw_first = payload[ip+(ibx+lastBX)*6];
50  ip++;
51  uint32_t raw_secnd = payload[ip+(ibx+lastBX)*6];
52  ip++;
53  if ( raw_first == 0 )
54  {
55  LogDebug("L1T") << "Raw data is zero";
56  continue;
57  }
58 
60  RegionalMuonRawDigiTranslator::fillRegionalMuonCand(muCand, raw_first, raw_secnd, processor, tftype::bmtf);
61  muCand.setLink(48 + processor); //the link corresponds to the uGMT input
62 
63  LogDebug("L1T") << "Pt = " << muCand.hwPt() << " eta: " << muCand.hwEta() << " phi: " << muCand.hwPhi();
64  if ( muCand.hwQual() != 0 )
65  {
66  res->push_back(ibx, muCand);
67  }
68 
69  }//for iw
70  }//for ibx
71 
72  return true;
73  }//unpack
74  }//ns stage2
75 }//ns lt1
76 
#define LogDebug(id)
void setLink(int link)
const std::vector< uint32_t > & payload() const
Definition: Block.h:60
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
static void fillRegionalMuonCand(RegionalMuonCand &, uint32_t, uint32_t, int, tftype)
void setBXRange(int bxFirst, int bxLast)
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
void push_back(int bx, T object)