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:
19  explicit CandViewRefMerger(const edm::ParameterSet& cfg) :
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  reco::CandidateBaseRefVector refs = src->refVector();
30  for(reco::CandidateBaseRefVector::const_iterator j = refs.begin(); j != refs.end(); ++j)
31  out->push_back(*j);
32  }
33  evt.put(out);
34  }
35  std::vector<edm::EDGetTokenT<reco::CandidateView> > srcTokens_;
36 };
37 
int i
Definition: DBlmapReader.cc:9
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
CandViewRefMerger(const edm::ParameterSet &cfg)
const_iterator end() const
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:116
int j
Definition: DBlmapReader.cc:9
tuple out
Definition: dbtoconf.py:99
string const
Definition: compareJSON.py:14
const_iterator begin() const
void produce(edm::Event &evt, const edm::EventSetup &) override