File indexing completed on 2024-06-28 02:36:16
0001 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0002 #include "EventFilter/L1TRawToDigi/plugins/UnpackerFactory.h"
0003
0004 #include "L1Trigger/L1TCalorimeter/interface/CaloTools.h"
0005
0006 #include "L1TObjectCollections.h"
0007
0008 #include "DataFormats/L1CaloTrigger/interface/CICADA.h"
0009
0010 #include "CaloSummaryUnpacker.h"
0011 #include "GTSetup.h"
0012
0013 #include <cmath>
0014
0015 bool l1t::stage2::CaloSummaryUnpacker::unpack(const Block& block, UnpackerCollections* coll) {
0016 LogDebug("L1T") << "Block ID = " << block.header().getID() << " size = " << block.header().getSize();
0017
0018
0019
0020
0021 int nBX = int(ceil(block.header().getSize() / nFramesPerEvent));
0022 int firstBX = (nBX / 2) - nBX + 1;
0023 int lastBX = nBX / 2;
0024 int processedBXs = 0;
0025
0026 auto res_ = static_cast<L1TObjectCollections*>(coll)->getCICADAScore();
0027 res_->setBXRange(firstBX, lastBX);
0028
0029 for (int bx = firstBX; bx <= lastBX; ++bx) {
0030 unsigned short baseLocation = processedBXs * nFramesPerEvent;
0031 const uint32_t* base = block.payload().data() + baseLocation;
0032
0033 uint32_t word = (cicadaBitsPattern & base[0]) >> 16 | (cicadaBitsPattern & base[1]) >> 20 |
0034 (cicadaBitsPattern & base[2]) >> 24 | (cicadaBitsPattern & base[3]) >> 28;
0035
0036 float score = static_cast<float>(word) / 256.f;
0037 res_->push_back(bx, score);
0038 ++processedBXs;
0039 }
0040
0041 return true;
0042 }
0043
0044 DEFINE_L1T_UNPACKER(l1t::stage2::CaloSummaryUnpacker);