CMS 3D CMS Logo

TauUnpacker.cc
Go to the documentation of this file.
3 
5 
6 #include "L1TObjectCollections.h"
7 
9 #include "TauUnpacker.h"
10 
11 namespace l1t {
12  namespace stage2 {
13  TauUnpacker::TauUnpacker() : TauCopy_(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() / demux::nOutputFramePerBX));
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)->getTaus(TauCopy_);
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 Tau cands filling collection
37  for (int bx = firstBX; bx <= lastBX; bx++) {
38  for (unsigned iTau = 0; iTau < demux::nTauPerLink && iTau < block.header().getSize(); iTau++) {
39  int iFrame = (bx - firstBX) * demux::nOutputFramePerBX + iTau;
40 
41  uint32_t raw_data = block.payload().at(iFrame);
42 
43  if (raw_data == 0)
44  continue;
45 
46  l1t::Tau tau = l1t::Tau();
47 
48  tau.setHwPt(raw_data & 0x1FF);
49 
50  if (tau.hwPt() == 0)
51  continue;
52 
53  int abs_eta = (raw_data >> 9) & 0x7F;
54  if ((raw_data >> 16) & 0x1) {
55  tau.setHwEta(-1 * (128 - abs_eta));
56  } else {
57  tau.setHwEta(abs_eta);
58  }
59 
60  tau.setHwPhi((raw_data >> 17) & 0xFF);
61  tau.setHwIso((raw_data >> 25) & 0x3); // 2 bits
62  tau.setHwQual((raw_data >> 27) & 0x7); // Assume 3 bits for now? leaves 3 spare bits
63  // tau.setHwQual((raw_data >> 26) & 0x7); // Assume 3 bits for now? leaves 3 spare bits
64 
65  LogDebug("L1T") << "Tau: eta " << tau.hwEta() << " phi " << tau.hwPhi() << " pT " << tau.hwPt() << " iso "
66  << tau.hwIso() << " qual " << tau.hwQual();
67 
69 
70  res_->push_back(bx, tau);
71  }
72  }
73 
74  return true;
75  }
76  } // namespace stage2
77 } // namespace l1t
78 
CaloTools.h
MessageLogger.h
L1TStage2Layer2Constants.h
metsig::tau
Definition: SignAlgoResolutions.h:49
L1TRate_Offline_cfi.Tau
Tau
Definition: L1TRate_Offline_cfi.py:43
l1t::CaloTools::p4Demux
static math::PtEtaPhiMLorentzVector p4Demux(l1t::L1Candidate *)
Definition: CaloTools.cc:317
l1t::stage2::TauUnpacker::TauCopy_
unsigned int TauCopy_
Definition: TauUnpacker.h:15
l1t::stage2::layer2::demux::nTauPerLink
const unsigned int nTauPerLink
Definition: L1TStage2Layer2Constants.cc:13
RPCBxOrConfig_cff.firstBX
firstBX
Definition: RPCBxOrConfig_cff.py:5
simKBmtfDigis_cfi.bx
bx
Definition: simKBmtfDigis_cfi.py:55
l1t::Tau
Definition: Tau.h:20
reco::ceil
constexpr int32_t ceil(float num)
Definition: constexpr_cmath.h:7
TauUnpacker.h
l1t::stage2::TauUnpacker::unpack
bool unpack(const Block &block, UnpackerCollections *coll) override
Definition: TauUnpacker.cc:15
UnpackerFactory.h
l1t::stage2::TauUnpacker
Definition: TauUnpacker.h:8
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:670
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
l1t::UnpackerCollections
Definition: UnpackerCollections.h:9
L1TObjectCollections.h
l1t::stage2::TauUnpacker::TauUnpacker
TauUnpacker()
Definition: TauUnpacker.cc:13
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:54