CMS 3D CMS Logo

GlobalExtBlkUnpacker.cc
Go to the documentation of this file.
3 
4 #include "GTCollections.h"
5 #include "GlobalExtBlkUnpacker.h"
6 
7 namespace l1t {
8  namespace stage2 {
10  LogDebug("L1T") << "Block ID = " << block.header().getID() << " size = " << block.header().getSize();
11 
12  unsigned int wdPerBX = 6; //should this be configured someplace else?
13  int nBX = int(ceil(
14  block.header().getSize() /
15  6.)); // FOR GT Not sure what we have here...put at 6 because of 6 frames. Since there are 12 EGamma objects reported per event (see CMS IN-2013/005)
16 
17  // Find the central, first and last BXs
18  int firstBX = -(ceil((double)nBX / 2.) - 1);
19  int lastBX;
20  if (nBX % 2 == 0) {
21  lastBX = ceil((double)nBX / 2.);
22  } else {
23  lastBX = ceil((double)nBX / 2.) - 1;
24  }
25 
26  auto res_ = static_cast<GTCollections*>(coll)->getExts();
27  res_->setBXRange(firstBX, lastBX);
28 
29  LogDebug("L1T") << "nBX = " << nBX << " first BX = " << firstBX << " lastBX = " << lastBX;
30 
31  // Loop over multiple BX and then number of EG cands filling collection
32  int numBX = 0; //positive int to count BX
33  for (int bx = firstBX; bx <= lastBX; bx++) {
34  // If this is the first block, instantiate GlobalExt so it is there to fill from mult. blocks
35  if (block.header().getID() == 24) {
36  LogDebug("L1T") << "Creating GT External Block for BX =" << bx;
37  GlobalExtBlk tExt = GlobalExtBlk();
38  res_->push_back(bx, tExt);
39  }
40 
41  //fetch from collection
42  GlobalExtBlk ext = res_->at(bx, 0);
43 
44  //Determine offset of algorithm bits based on block.ID
45  // ID=24 offset = 0; ID=26 offset=64; ID=28 offset=128=2*64; ID=30 offset=3*64=192
46  int extOffset = ((block.header().getID() - 24) / 2) * 64;
47 
48  for (unsigned int wd = 0; wd < wdPerBX; wd++) {
49  uint32_t raw_data = block.payload()[wd + numBX * wdPerBX];
50  LogDebug("L1T") << " payload word " << wd << " 0x" << hex << raw_data;
51 
52  if (wd < 2) {
53  for (unsigned int bt = 0; bt < 32; bt++) {
54  int val = ((raw_data >> bt) & 0x1);
55  int extBit = bt + wd * 32 + extOffset;
56  if (val == 1)
57  ext.setExternalDecision(extBit, true);
58  }
59  }
60  }
61 
62  // Put the object back into place (Must be better way???)
63  res_->set(bx, 0, ext);
64 
65  //ext.print(std::cout);
66  numBX++;
67  }
68 
69  return true;
70  }
71  } // namespace stage2
72 } // namespace l1t
73 
ext
Definition: memstream.h:15
MessageLogger.h
LumiConstants::numBX
static const unsigned int numBX
Definition: LumiConstants.h:8
RPCBxOrConfig_cff.firstBX
firstBX
Definition: RPCBxOrConfig_cff.py:5
simKBmtfDigis_cfi.bx
bx
Definition: simKBmtfDigis_cfi.py:55
GTCollections.h
testProducerWithPsetDescEmpty_cfi.x1
x1
Definition: testProducerWithPsetDescEmpty_cfi.py:33
reco::ceil
constexpr int32_t ceil(float num)
Definition: constexpr_cmath.h:7
UnpackerFactory.h
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:670
l1t
delete x;
Definition: CaloConfig.h:22
createfilelist.int
int
Definition: createfilelist.py:10
GlobalExtBlk
Definition: GlobalExtBlk.h:34
groupFilesInBlocks.block
block
Definition: groupFilesInBlocks.py:150
SiStripSourceConfigTier0_cff.stage2
stage2
Definition: SiStripSourceConfigTier0_cff.py:71
GlobalExtBlkUnpacker.h
heppy_batch.val
val
Definition: heppy_batch.py:351
l1t::stage2::GlobalExtBlkUnpacker
Definition: GlobalExtBlkUnpacker.h:8
l1t::UnpackerCollections
Definition: UnpackerCollections.h:9
RPCBxOrConfig_cff.lastBX
lastBX
Definition: RPCBxOrConfig_cff.py:4
DEFINE_L1T_UNPACKER
#define DEFINE_L1T_UNPACKER(type)
Definition: UnpackerFactory.h:23
l1t::stage2::GlobalExtBlkUnpacker::unpack
bool unpack(const Block &block, UnpackerCollections *coll) override
Definition: GlobalExtBlkUnpacker.cc:9
l1t::Block
Definition: Block.h:54