CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
CandViewRefMerger.cc
Go to the documentation of this file.
1 /* \class CandViewRefMerger
2  *
3  * Producer of merged references to Candidates
4  *
5  * \author: Luca Lista, INFN
6  *
7  */
8 
16 
18 public:
20  : srcTokens_(
21  edm::vector_transform(cfg.getParameter<std::vector<edm::InputTag> >("src"),
22  [this](edm::InputTag const& tag) { return consumes<reco::CandidateView>(tag); })) {
23  produces<std::vector<reco::CandidateBaseRef> >();
24  }
25 
26 private:
27  void produce(edm::StreamID, edm::Event& evt, const edm::EventSetup&) const override {
28  std::unique_ptr<std::vector<reco::CandidateBaseRef> > out(new std::vector<reco::CandidateBaseRef>);
29  for (std::vector<edm::EDGetTokenT<reco::CandidateView> >::const_iterator i = srcTokens_.begin();
30  i != srcTokens_.end();
31  ++i) {
33  evt.getByToken(*i, src);
34  for (size_t j = 0; j < src->size(); ++j)
35  out->push_back(src->refAt(j));
36  }
37  evt.put(std::move(out));
38  }
39  std::vector<edm::EDGetTokenT<reco::CandidateView> > srcTokens_;
40 };
41 
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
CandViewRefMerger(const edm::ParameterSet &cfg)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:528
auto vector_transform(std::vector< InputType > const &input, Function predicate) -> std::vector< typename std::remove_cv< typename std::remove_reference< decltype(predicate(input.front()))>::type >::type >
Definition: transform.h:11
std::vector< edm::EDGetTokenT< reco::CandidateView > > srcTokens_
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
HLT enums.
void produce(edm::StreamID, edm::Event &evt, const edm::EventSetup &) const override
def move(src, dest)
Definition: eostools.py:511