CMS 3D CMS Logo

L1TPFCandMultiMerger.cc
Go to the documentation of this file.
2 
9 #include <vector>
10 
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 
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 
37 
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  }
47  }
48 }
49 
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
int iEvent
Definition: GenABIO.cc:224
int np
Definition: AMPTWrapper.h:43
ii
Definition: cuy.py:589
std::vector< std::string > instances_
L1TPFCandMultiMerger(const edm::ParameterSet &)
std::vector< edm::EDGetTokenT< std::vector< l1t::PFCandidate > > > tokens_
def move(src, dest)
Definition: eostools.py:511