EventFilter
L1TRawToDigi
plugins
implementations_stage2
TauPacker.cc
Go to the documentation of this file.
1
#include "
FWCore/Framework/interface/Event.h
"
2
#include "
EventFilter/L1TRawToDigi/plugins/PackerFactory.h
"
3
4
#include "
CaloTokens.h
"
5
6
#include "
L1TStage2Layer2Constants.h
"
7
#include "
TauPacker.h
"
8
9
namespace
l1t
{
10
namespace
stage2
{
11
Blocks
TauPacker::pack
(
const
edm::Event
&
event
,
const
PackerTokens
* toks) {
12
edm::Handle<TauBxCollection>
taus
;
13
event
.getByToken(static_cast<const CommonTokens*>(toks)->getTauToken(),
taus
);
14
15
std::vector<uint32_t> load1, load2;
16
17
int
nBx = 0;
18
for
(
int
i
=
taus
->getFirstBX();
i
<=
taus
->getLastBX(); ++
i
) {
19
for
(
auto
j
=
taus
->begin(
i
);
j
!=
taus
->end(
i
); ++
j
) {
20
uint32_t packed_eta =
abs
(
j
->hwEta()) & 0x7F;
21
if
(
j
->hwEta() < 0) {
22
packed_eta = (128 - packed_eta) | 1 << 7;
23
}
24
25
uint32_t
word
=
std::min
(
j
->hwPt(), 0x1FF) | packed_eta << 9 | (
j
->hwPhi() & 0xFF) << 17 |
26
(
j
->hwIso() & 0x3) << 25 |
//two bits for tau isolation
27
(
j
->hwQual() & 0x7) << 27;
28
29
// Depending on the number, push onto appropriate link
30
if
(load1.size() - nBx *
l1t::stage2::layer2::demux::nTauPerLink
<
l1t::stage2::layer2::demux::nTauPerLink
)
31
load1.push_back(
word
);
32
else
33
load2.push_back(
word
);
34
}
35
36
// push zeroes if not enough taus must do this for each BX and each link
37
while
(load1.size() - nBx *
l1t::stage2::layer2::demux::nOutputFramePerBX
<
38
l1t::stage2::layer2::demux::nOutputFramePerBX
)
39
load1.push_back(0);
40
while
(load2.size() - nBx *
l1t::stage2::layer2::demux::nOutputFramePerBX
<
41
l1t::stage2::layer2::demux::nOutputFramePerBX
)
42
load2.push_back(0);
43
44
nBx++;
45
}
46
47
return
{
Block
(
b1_
, load1),
Block
(
b2_
, load2)};
48
}
49
}
// namespace stage2
50
}
// namespace l1t
51
52
DEFINE_L1T_PACKER
(
l1t::stage2::GTTauPacker
);
53
DEFINE_L1T_PACKER
(
l1t::stage2::CaloTauPacker
);
l1t::Blocks
std::vector< Block > Blocks
Definition:
Block.h:83
l1t::stage2::layer2::demux::nOutputFramePerBX
const unsigned int nOutputFramePerBX
Definition:
L1TStage2Layer2Constants.cc:11
CaloTokens.h
mps_fire.i
i
Definition:
mps_fire.py:355
PackerFactory.h
L1TStage2Layer2Constants.h
min
T min(T a, T b)
Definition:
MathUtil.h:58
Tau3MuMonitor_cff.taus
taus
Definition:
Tau3MuMonitor_cff.py:7
l1t::stage2::TauPacker::b1_
int b1_
Definition:
TauPacker.h:12
l1t::stage2::layer2::demux::nTauPerLink
const unsigned int nTauPerLink
Definition:
L1TStage2Layer2Constants.cc:13
edm::Handle
Definition:
AssociativeIterator.h:50
word
uint64_t word
Definition:
CTPPSTotemDataFormatter.cc:29
l1t::stage2::TauPacker::b2_
int b2_
Definition:
TauPacker.h:12
DEFINE_L1T_PACKER
#define DEFINE_L1T_PACKER(type)
Definition:
PackerFactory.h:23
Event.h
l1t
delete x;
Definition:
CaloConfig.h:22
l1t::stage2::CaloTauPacker
Definition:
TauPacker.h:19
l1t::PackerTokens
Definition:
PackerTokens.h:10
SiStripSourceConfigTier0_cff.stage2
stage2
Definition:
SiStripSourceConfigTier0_cff.py:71
funct::abs
Abs< T >::type abs(const T &t)
Definition:
Abs.h:22
TauPacker.h
l1t::stage2::TauPacker::pack
Blocks pack(const edm::Event &, const PackerTokens *) override
Definition:
TauPacker.cc:11
l1t::stage2::GTTauPacker
Definition:
TauPacker.h:15
dqmiolumiharvest.j
j
Definition:
dqmiolumiharvest.py:66
event
Definition:
event.py:1
edm::Event
Definition:
Event.h:73
l1t::Block
Definition:
Block.h:54
Generated for CMSSW Reference Manual by
1.8.16