CMS 3D CMS Logo

PhysCandPacker.cc
Go to the documentation of this file.
3 
4 #include "CaloTokens.h"
5 #include "PhysCandPacker.h"
6 
7 template <typename T, typename F>
8 l1t::Blocks process(unsigned int id1, unsigned int id2, const BXVector<T>& coll, F filter) {
9  std::vector<uint32_t> load[2];
10 
11  for (int i = coll.getFirstBX(); i <= coll.getLastBX(); ++i) {
12  uint16_t jetbit[4] = {0, 0, 0, 0};
13  int n = 0;
14  for (auto j = coll.begin(i); j != coll.end(i) && n < 4; ++j) {
15  if (!filter(*j))
16  continue;
17  //std::cout << j->hwPt() << " @ " << j->hwEta() << ", " << j->hwPhi() << " > " << j->hwQual() << " > " << j->hwIso() << std::endl;
18  jetbit[n++] = std::min(j->hwPt(), 0x3F) | (abs(j->hwEta()) & 0x7) << 6 | ((j->hwEta() >> 3) & 0x1) << 9 |
19  (j->hwPhi() & 0x1F) << 10;
20  }
21  uint32_t word0 = (jetbit[0] & 0xFFFF);
22  uint32_t word1 = (jetbit[1] & 0xFFFF);
23  uint32_t word2 = (jetbit[2] & 0xFFFF);
24  uint32_t word3 = (jetbit[3] & 0xFFFF);
25 
26  load[0].push_back(word0);
27  load[0].push_back(word2);
28 
29  load[1].push_back(word1);
30  load[1].push_back(word3);
31  }
32 
33  return {l1t::Block(id1, load[0]), l1t::Block(id2, load[1])};
34 }
35 
36 namespace l1t {
37  namespace stage1 {
40  event.getByToken(static_cast<const CaloTokens*>(toks)->getEGammaToken(), egammas);
41 
42  return process(85, 87, *egammas, [](const l1t::EGamma& eg) -> bool { return eg.hwIso() == 1; });
43  }
44 
47  event.getByToken(static_cast<const CaloTokens*>(toks)->getEGammaToken(), egammas);
48 
49  return process(89, 91, *egammas, [](const l1t::EGamma& eg) -> bool { return eg.hwIso() == 0; });
50  }
51 
54  event.getByToken(static_cast<const CaloTokens*>(toks)->getJetToken(), jets);
55 
56  return process(77, 79, *jets, [](const l1t::Jet& jet) -> bool { return !(jet.hwQual() & 2); });
57  }
58 
61  event.getByToken(static_cast<const CaloTokens*>(toks)->getJetToken(), jets);
62 
63  return process(81, 83, *jets, [](const l1t::Jet& jet) -> bool { return jet.hwQual() & 2; });
64  }
65 
68  event.getByToken(static_cast<const CaloTokens*>(toks)->getTauToken(), taus);
69 
70  return process(101, 103, *taus, [](const l1t::Tau& tau) -> bool { return true; });
71  }
72 
75  event.getByToken(static_cast<const CaloTokens*>(toks)->getIsoTauToken(), taus);
76 
77  return process(105, 107, *taus, [](const l1t::Tau& tau) -> bool { return true; });
78  }
79  } // namespace stage1
80 } // namespace l1t
81 
l1t::Blocks
std::vector< Block > Blocks
Definition: Block.h:83
CaloTokens.h
mps_fire.i
i
Definition: mps_fire.py:355
PackerFactory.h
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
metsig::tau
Definition: SignAlgoResolutions.h:49
l1t::stage1::IsoEGammaPacker::pack
Blocks pack(const edm::Event &, const PackerTokens *) override
Definition: PhysCandPacker.cc:38
l1t::stage1::TauPacker::pack
Blocks pack(const edm::Event &, const PackerTokens *) override
Definition: PhysCandPacker.cc:66
min
T min(T a, T b)
Definition: MathUtil.h:58
Tau3MuMonitor_cff.taus
taus
Definition: Tau3MuMonitor_cff.py:7
globals_cff.id1
id1
Definition: globals_cff.py:32
singleTopDQM_cfi.jets
jets
Definition: singleTopDQM_cfi.py:42
edm::Handle
Definition: AssociativeIterator.h:50
l1t::stage1::CentralJetPacker
Definition: PhysCandPacker.h:18
l1t::stage1::ForwardJetPacker
Definition: PhysCandPacker.h:23
F
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
Definition: blowfish.cc:163
BXVector
Definition: BXVector.h:15
BXVector::getFirstBX
int getFirstBX() const
l1t::Tau
Definition: Tau.h:20
testProducerWithPsetDescEmpty_cfi.x1
x1
Definition: testProducerWithPsetDescEmpty_cfi.py:33
l1t::stage1::IsoEGammaPacker
Definition: PhysCandPacker.h:8
l1t::stage1::ForwardJetPacker::pack
Blocks pack(const edm::Event &, const PackerTokens *) override
Definition: PhysCandPacker.cc:59
svgfig.load
def load(fileName)
Definition: svgfig.py:547
BXVector::begin
const_iterator begin(int bx) const
ALCARECOTkAlBeamHalo_cff.filter
filter
Definition: ALCARECOTkAlBeamHalo_cff.py:27
l1t::Jet
Definition: Jet.h:20
l1t::stage1::NonIsoEGammaPacker
Definition: PhysCandPacker.h:13
DEFINE_L1T_PACKER
#define DEFINE_L1T_PACKER(type)
Definition: PackerFactory.h:23
BXVector::end
const_iterator end(int bx) const
Event.h
l1t
delete x;
Definition: CaloConfig.h:22
l1t::stage1::CentralJetPacker::pack
Blocks pack(const edm::Event &, const PackerTokens *) override
Definition: PhysCandPacker.cc:52
l1t::EGamma
Definition: EGamma.h:20
l1t::stage1::NonIsoEGammaPacker::pack
Blocks pack(const edm::Event &, const PackerTokens *) override
Definition: PhysCandPacker.cc:45
l1t::PackerTokens
Definition: PackerTokens.h:10
l1t::stage1::IsoTauPacker
Definition: PhysCandPacker.h:33
l1t::stage1::IsoTauPacker::pack
Blocks pack(const edm::Event &, const PackerTokens *) override
Definition: PhysCandPacker.cc:73
PhysCandPacker.h
l1t::stage1::TauPacker
Definition: PhysCandPacker.h:28
metsig::jet
Definition: SignAlgoResolutions.h:47
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
globals_cff.id2
id2
Definition: globals_cff.py:33
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
event
Definition: event.py:1
edm::Event
Definition: Event.h:73
l1t::Block
Definition: Block.h:54
BXVector::getLastBX
int getLastBX() const
process
l1t::Blocks process(unsigned int id1, unsigned int id2, const BXVector< T > &coll, F filter)
Definition: PhysCandPacker.cc:8
l1t::L1Candidate::hwIso
int hwIso() const
Definition: L1Candidate.h:39