CMS 3D CMS Logo

CaloSummaryUnpacker.cc
Go to the documentation of this file.
3 
5 
6 #include "L1TObjectCollections.h"
7 
9 
10 #include "CaloSummaryUnpacker.h"
11 #include "GTSetup.h"
12 
13 #include <cmath>
14 
16  LogDebug("L1T") << "Block ID = " << block.header().getID() << " size = " << block.header().getSize();
17 
18  //Just a few things to help us handle the number of BXs
19  //Strictly, we should generally get five BXs, starting at -2, and going to 2
20  //With the central BX at 0. The frames count up from -2
21  int nBX = int(ceil(block.header().getSize() / nFramesPerEvent));
22  int firstBX = (nBX / 2) - nBX + 1;
23  int lastBX = nBX / 2;
24  int processedBXs = 0; //This will just help us keep track of what words we are grabbing
25 
26  auto res_ = static_cast<L1TObjectCollections*>(coll)->getCICADAScore();
27  res_->setBXRange(firstBX, lastBX);
28 
29  for (int bx = firstBX; bx <= lastBX; ++bx) {
30  unsigned short baseLocation = processedBXs * nFramesPerEvent;
31  const uint32_t* base = block.payload().data() + baseLocation;
32  //The take the first 4 bits of the first 4 words, and arrange them in order
33  uint32_t word = (cicadaBitsPattern & base[0]) >> 16 | (cicadaBitsPattern & base[1]) >> 20 |
34  (cicadaBitsPattern & base[2]) >> 24 | (cicadaBitsPattern & base[3]) >> 28;
35  //The score needs to be shifted 8 bits over the decimal point
36  float score = static_cast<float>(word) / 256.f;
37  res_->push_back(bx, score);
38  ++processedBXs; //index BXs
39  }
40 
41  return true;
42 }
43 
constexpr int32_t ceil(float num)
bool unpack(const Block &block, UnpackerCollections *coll) override
uint64_t word
double f[11][100]
static constexpr unsigned int cicadaBitsPattern
#define DEFINE_L1T_UNPACKER(type)
static constexpr unsigned int nFramesPerEvent
#define LogDebug(id)