CMS 3D CMS Logo

RecoTauPiZeroFlattener.cc
Go to the documentation of this file.
1 /*
2  * =====================================================================================
3  * Filename: RecoTauPiZeroFlattener.cc
4  *
5  * Description: Produce a plain vector<RecoTauPizero> from the the PiZeros in
6  * a JetPiZeroAssociation associated to the input jets.
7  * Created: 10/31/2010 12:33:41
8  *
9  * Author: Evan K. Friis (UC Davis), evan.klose.friis@cern.ch
10  * =====================================================================================
11  */
12 
13 #include <boost/foreach.hpp>
14 #include <algorithm>
15 
21 
25 
27 
29  public:
32  void produce(edm::Event& evt, const edm::EventSetup& es) override;
33  private:
36 };
37 
39  jetSrc_ = pset.getParameter<edm::InputTag>("jetSrc");
40  piZeroSrc_ = pset.getParameter<edm::InputTag>("piZeroSrc");
41  produces<std::vector<reco::RecoTauPiZero> >();
42 }
43 
44 void
46  // Get the jet input collection via a view of Candidates
48  evt.getByLabel(jetSrc_, jetView);
49 
50  // Convert to a vector of PFJetRefs
52  reco::tau::castView<reco::PFJetRefVector>(jetView);
53 
54  // Get the pizero input collection
56  evt.getByLabel(piZeroSrc_, piZeroAssoc);
57 
58  // Create output collection
59  auto output = std::make_unique<std::vector<reco::RecoTauPiZero>>();
60 
61  // Loop over the jets and append the pizeros for each jet to our output
62  // collection.
63  BOOST_FOREACH(reco::PFJetRef jetRef, jets) {
64  const std::vector<reco::RecoTauPiZero>& pizeros = (*piZeroAssoc)[jetRef];
65  output->reserve(output->size() + pizeros.size());
66  output->insert(output->end(), pizeros.begin(), pizeros.end());
67  }
68 
69  evt.put(std::move(output));
70 }
71 
T getParameter(std::string const &) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:137
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
void produce(edm::Event &evt, const edm::EventSetup &es) override
vector< PseudoJet > jets
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:535
RecoTauPiZeroFlattener(const edm::ParameterSet &pset)
def move(src, dest)
Definition: eostools.py:510