CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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_(edm::vector_transform(cfg.getParameter<std::vector<edm::InputTag> >("src"), [this](edm::InputTag const & tag){return consumes<reco::CandidateView>(tag);})) {
21  produces<std::vector<reco::CandidateBaseRef> >();
22  }
23 private:
24  void produce(edm::Event & evt, const edm::EventSetup &) override {
25  std::auto_ptr<std::vector<reco::CandidateBaseRef> > out(new std::vector<reco::CandidateBaseRef>);
26  for(std::vector<edm::EDGetTokenT<reco::CandidateView> >::const_iterator i = srcTokens_.begin(); i != srcTokens_.end(); ++i) {
28  evt.getByToken(*i, src);
29  for(size_t j = 0; j < src->size(); ++j)
30  out->push_back(src->refAt(j));
31  }
32  evt.put(out);
33  }
34  std::vector<edm::EDGetTokenT<reco::CandidateView> > srcTokens_;
35 };
36 
int i
Definition: DBlmapReader.cc:9
tuple cfg
Definition: looper.py:237
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:446
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
CandViewRefMerger(const edm::ParameterSet &cfg)
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_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:113
int j
Definition: DBlmapReader.cc:9
tuple out
Definition: dbtoconf.py:99
string const
Definition: compareJSON.py:14
void produce(edm::Event &evt, const edm::EventSetup &) override