L1Trigger
Phase2L1ParticleFlow
plugins
L1TPFCandMultiMerger.cc
Go to the documentation of this file.
1
#include "
DataFormats/L1TParticleFlow/interface/PFCandidate.h
"
2
3
#include "
FWCore/Framework/interface/global/EDProducer.h
"
4
#include "
FWCore/Framework/interface/Event.h
"
5
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
6
#include "
FWCore/Utilities/interface/transform.h
"
7
#include "
FWCore/Utilities/interface/InputTag.h
"
8
#include "
DataFormats/Common/interface/CloneTrait.h
"
9
#include <vector>
10
11
class
L1TPFCandMultiMerger
:
public
edm::global::EDProducer
<> {
12
public
:
13
explicit
L1TPFCandMultiMerger
(
const
edm::ParameterSet
&);
14
~L1TPFCandMultiMerger
()
override
;
15
16
private
:
17
void
produce
(
edm::StreamID
,
edm::Event
&,
const
edm::EventSetup
&)
const override
;
18
19
std::vector<std::string>
instances_
;
20
std::vector<edm::EDGetTokenT<std::vector<l1t::PFCandidate>>>
tokens_
;
21
};
22
23
L1TPFCandMultiMerger::L1TPFCandMultiMerger
(
const
edm::ParameterSet
& iConfig)
24
: instances_(iConfig.getParameter<
std
::vector<
std
::
string
>>(
"labelsToMerge"
)) {
25
const
std::vector<edm::InputTag>&
pfProducers
= iConfig.
getParameter
<std::vector<edm::InputTag>>(
"pfProducers"
);
26
tokens_
.reserve(
instances_
.size() *
pfProducers
.size());
27
for
(
unsigned
int
ii
= 0, ni =
instances_
.size();
ii
< ni; ++
ii
) {
28
for
(
const
edm::InputTag
&
tag
:
pfProducers
) {
29
tokens_
.push_back(
30
consumes
<std::vector<l1t::PFCandidate>>(
edm::InputTag
(
tag
.label(),
instances_
[
ii
],
tag
.process())));
31
}
32
produces<std::vector<l1t::PFCandidate>>(
instances_
[
ii
]);
33
}
34
}
35
36
L1TPFCandMultiMerger::~L1TPFCandMultiMerger
() {}
37
38
void
L1TPFCandMultiMerger::produce
(
edm::StreamID
,
edm::Event
&
iEvent
,
const
edm::EventSetup
&)
const
{
39
edm::Handle<std::vector<l1t::PFCandidate>
>
handle
;
40
for
(
unsigned
int
ii
= 0, it = 0, ni =
instances_
.size(),
np
=
tokens_
.size() / ni;
ii
< ni; ++
ii
) {
41
auto
out
= std::make_unique<std::vector<l1t::PFCandidate>>();
42
for
(
unsigned
int
ip = 0; ip <
np
; ++ip, ++it) {
43
iEvent
.getByToken(
tokens_
[it],
handle
);
44
out
->insert(
out
->end(),
handle
->begin(),
handle
->end());
45
}
46
iEvent
.put(
std::move
(
out
),
instances_
[
ii
]);
47
}
48
}
49
50
#include "
FWCore/Framework/interface/MakerMacros.h
"
51
DEFINE_FWK_MODULE
(
L1TPFCandMultiMerger
);
edm::StreamID
Definition:
StreamID.h:30
L1TPFCandMultiMerger::produce
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
Definition:
L1TPFCandMultiMerger.cc:38
PFCandidate.h
patZpeak.handle
handle
Definition:
patZpeak.py:23
np
int np
Definition:
AMPTWrapper.h:43
L1TPFCandMultiMerger::tokens_
std::vector< edm::EDGetTokenT< std::vector< l1t::PFCandidate > > > tokens_
Definition:
L1TPFCandMultiMerger.cc:20
edm::Handle
Definition:
AssociativeIterator.h:50
L1TPFCandMultiMerger::~L1TPFCandMultiMerger
~L1TPFCandMultiMerger() override
Definition:
L1TPFCandMultiMerger.cc:36
MakerMacros.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition:
MakerMacros.h:16
CloneTrait.h
GlobalPosition_Frontier_DevDB_cff.tag
tag
Definition:
GlobalPosition_Frontier_DevDB_cff.py:11
L1TPFCandMultiMerger::instances_
std::vector< std::string > instances_
Definition:
L1TPFCandMultiMerger.cc:19
L1TPFCandMultiMerger::L1TPFCandMultiMerger
L1TPFCandMultiMerger(const edm::ParameterSet &)
Definition:
L1TPFCandMultiMerger.cc:23
edm::global::EDProducer
Definition:
EDProducer.h:32
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition:
ParameterSet.h:36
Event.h
iEvent
int iEvent
Definition:
GenABIO.cc:224
l1ParticleFlow_cff.pfProducers
pfProducers
Definition:
l1ParticleFlow_cff.py:291
edm::EventSetup
Definition:
EventSetup.h:57
InputTag.h
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
eostools.move
def move(src, dest)
Definition:
eostools.py:511
std
Definition:
JetResolutionObject.h:76
transform.h
L1TPFCandMultiMerger
Definition:
L1TPFCandMultiMerger.cc:11
MillePedeFileConverter_cfg.out
out
Definition:
MillePedeFileConverter_cfg.py:31
ParameterSet.h
edm::EDConsumerBase::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition:
EDConsumerBase.h:126
EDProducer.h
edm::Event
Definition:
Event.h:73
cuy.ii
ii
Definition:
cuy.py:590
edm::InputTag
Definition:
InputTag.h:15
Generated for CMSSW Reference Manual by
1.8.16