CMS 3D CMS Logo

JetUnpacker.cc
Go to the documentation of this file.
3 
5 
6 #include "L1TObjectCollections.h"
7 
9 #include "JetUnpacker.h"
10 
11 namespace l1t {
12  namespace stage2 {
13  JetUnpacker::JetUnpacker() : JetCopy_(0) {}
14 
16  using namespace l1t::stage2::layer2;
17 
18  LogDebug("L1T") << "Block ID = " << block.header().getID() << " size = " << block.header().getSize();
19 
20  int nBX = int(ceil(block.header().getSize() / (double)demux::nOutputFramePerBX)); // 6 frames per BX
21 
22  // Find the first and last BXs
23  int firstBX = -(ceil((double)nBX / 2.) - 1);
24  int lastBX;
25  if (nBX % 2 == 0) {
26  lastBX = ceil((double)nBX / 2.);
27  } else {
28  lastBX = ceil((double)nBX / 2.) - 1;
29  }
30 
31  auto res_ = static_cast<L1TObjectCollections*>(coll)->getJets(JetCopy_);
32  res_->setBXRange(firstBX, lastBX);
33 
34  LogDebug("L1T") << "nBX = " << nBX << " first BX = " << firstBX << " lastBX = " << lastBX;
35 
36  // Loop over multiple BX and then number of jets filling jet collection
37  for (int bx = firstBX; bx <= lastBX; bx++) {
38  for (unsigned iJet = 0; iJet < demux::nJetPerLink && iJet < block.header().getSize(); iJet++) {
39  int iFrame = (bx - firstBX) * demux::nOutputFramePerBX + iJet;
40  uint32_t raw_data = block.payload().at(iFrame);
41 
42  if (raw_data == 0)
43  continue;
44 
45  l1t::Jet jet = l1t::Jet();
46 
47  jet.setHwPt(raw_data & 0x7FF);
48 
49  if (jet.hwPt() == 0)
50  continue;
51 
52  int abs_eta = (raw_data >> 11) & 0x7F;
53  if ((raw_data >> 18) & 0x1) {
54  jet.setHwEta(-1 * (128 - abs_eta));
55  } else {
56  jet.setHwEta(abs_eta);
57  }
58 
59  jet.setHwPhi((raw_data >> 19) & 0xFF);
60  jet.setHwQual((raw_data >> 27) & 0x7); // Assume 3 bits for now? Leaves 2 bits spare
61 
62  LogDebug("L1T") << "Jet: eta " << jet.hwEta() << " phi " << jet.hwPhi() << " pT " << jet.hwPt() << " qual "
63  << jet.hwQual() << " bx " << bx;
64 
66 
67  res_->push_back(bx, jet);
68  }
69  }
70 
71  return true;
72  }
73  } // namespace stage2
74 } // namespace l1t
75 
l1t::stage2::JetUnpacker
Definition: JetUnpacker.h:8
l1t::stage2::JetUnpacker::JetUnpacker
JetUnpacker()
Definition: JetUnpacker.cc:13
JetUnpacker.h
CaloTools.h
MessageLogger.h
L1TStage2Layer2Constants.h
l1t::CaloTools::p4Demux
static math::PtEtaPhiMLorentzVector p4Demux(l1t::L1Candidate *)
Definition: CaloTools.cc:317
l1GtPatternGenerator_cfi.bx
bx
Definition: l1GtPatternGenerator_cfi.py:18
l1t::stage2::layer2::demux::nJetPerLink
const unsigned int nJetPerLink
Definition: L1TStage2Layer2Constants.cc:14
RPCBxOrConfig_cff.firstBX
firstBX
Definition: RPCBxOrConfig_cff.py:5
l1t::stage2::JetUnpacker::unpack
bool unpack(const Block &block, UnpackerCollections *coll) override
Definition: JetUnpacker.cc:15
reco::ceil
constexpr int32_t ceil(float num)
Definition: constexpr_cmath.h:7
L1TRate_cfi.Jet
Jet
Definition: L1TRate_cfi.py:43
UnpackerFactory.h
l1t::Jet
Definition: Jet.h:20
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:223
l1t
delete x;
Definition: CaloConfig.h:22
l1t::stage2::layer2
Definition: L1TStage2Layer2Constants.h:8
createfilelist.int
int
Definition: createfilelist.py:10
groupFilesInBlocks.block
block
Definition: groupFilesInBlocks.py:150
l1t::stage2::layer2::mp::nOutputFramePerBX
const unsigned int nOutputFramePerBX
Definition: L1TStage2Layer2Constants.cc:9
SiStripSourceConfigTier0_cff.stage2
stage2
Definition: SiStripSourceConfigTier0_cff.py:71
metsig::jet
Definition: SignAlgoResolutions.h:47
l1t::UnpackerCollections
Definition: UnpackerCollections.h:9
L1TObjectCollections.h
RPCBxOrConfig_cff.lastBX
lastBX
Definition: RPCBxOrConfig_cff.py:4
DEFINE_L1T_UNPACKER
#define DEFINE_L1T_UNPACKER(type)
Definition: UnpackerFactory.h:23
l1t::Block
Definition: Block.h:70
l1t::stage2::JetUnpacker::JetCopy_
unsigned int JetCopy_
Definition: JetUnpacker.h:15