CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PFTauViewRefMerger.cc
Go to the documentation of this file.
1 /* \class PFTauViewRefMerger
2  *
3  * Produces a RefVector of PFTaus from a different views of PFTau.
4  *
5  * Note that the collections must all come from the same original collection!
6  *
7  * Author: Evan K. Friis
8  *
9  */
10 #include <boost/foreach.hpp>
11 
14 
21 
23  public:
25  src_(cfg.getParameter<std::vector<edm::InputTag> >("src")) {
26  produces<reco::PFTauRefVector>();
27  }
28  private:
29  void produce(edm::Event & evt, const edm::EventSetup &) override {
30  std::auto_ptr<reco::PFTauRefVector> out(new reco::PFTauRefVector());
31  BOOST_FOREACH(const edm::InputTag& inputSrc, src_) {
33  evt.getByLabel(inputSrc, src);
34  reco::PFTauRefVector inputRefs =
35  reco::tau::castView<reco::PFTauRefVector>(src);
36  // Merge all the collections
37  BOOST_FOREACH(const reco::PFTauRef tau, inputRefs) {
38  out->push_back(tau);
39  }
40  }
41  evt.put(out);
42  }
43  std::vector<edm::InputTag> src_;
44 };
45 
tuple cfg
Definition: looper.py:293
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
PFTauViewRefMerger(const edm::ParameterSet &cfg)
std::vector< edm::InputTag > src_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:121
void produce(edm::Event &evt, const edm::EventSetup &) override
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:418
void push_back(value_type const &ref)
Add a Ref&lt;C, T&gt; to the RefVector.
Definition: RefVector.h:62