CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
BMTFUnpackerOutput.cc
Go to the documentation of this file.
2 
3 #include "BMTFUnpackerOutput.h"
4 
5 namespace l1t
6 {
7  namespace stage2
8  {
10  {
11 
12  unsigned int blockId = block.header().getID();
13  LogDebug("L1T") << "Block ID: " << blockId << " size: " << block.header().getSize();
14 
15  auto payload = block.payload();
16 
17  //int nwords(2); //two words per muon
18  int nBX, firstBX, lastBX;
19  nBX = int(ceil(block.header().getSize()/6));
20 
21  getBXRange(nBX, firstBX, lastBX);
22  //if we want to use central BX, uncommect the two lines below
23  //firstBX=0;
24  //lastBX=0;
25  //LogDebug("L1T") << "BX override. Set firstBX = lastBX = 0";
26 
28  res = static_cast<BMTFCollections*>(coll)->getBMTFMuons();
29  res->setBXRange(firstBX, lastBX);
30 
31  LogDebug("L1T") << "nBX = " << nBX << " firstBX = " << firstBX << " lastBX = " << lastBX;
32 
33 
34  for(int ibx = firstBX; ibx <= lastBX; ibx++)
35  {
36  int ip(0);
37  for(unsigned int iw = 0; iw < block.header().getSize()/nBX; iw += 2)
38  {
39  uint32_t raw_first = payload[ip+(ibx+lastBX)*6];
40  ip++;
41  uint32_t raw_secnd = payload[ip+(ibx+lastBX)*6];
42  ip++;
43  if ( raw_first == 0 )
44  {
45  LogDebug("L1T") << "Raw data is zero";
46  continue;
47  }
48 
50  RegionalMuonRawDigiTranslator::fillRegionalMuonCand(muCand, raw_first, raw_secnd, block.amc().getAMCNumber() - 1, tftype::bmtf);
51  muCand.setLink(blockId/2);
52 
53  LogDebug("L1T") << "Pt = " << muCand.hwPt() << " eta: " << muCand.hwEta() << " phi: " << muCand.hwPhi();
54  res->push_back(ibx, muCand);
55 
56  }//for iw
57  }//for ibx
58 
59  return true;
60  }//unpack
61  }//ns stage2
62 }//ns lt1
63 
#define LogDebug(id)
void setLink(int link)
unsigned int getID() const
Definition: Block.h:22
virtual bool unpack(const Block &block, UnpackerCollections *coll) override
void getBXRange(int nbx, int &first, int &last)
Definition: Unpacker.cc:12
BlockHeader header() const
Definition: Block.h:56
std::vector< uint32_t > payload() const
Definition: Block.h:57
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))
unsigned int getSize() const
Definition: Block.h:23
void amc(const amc::Header &h)
Definition: Block.h:59
void push_back(int bx, T object)