CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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:
30  explicit RecoTauPiZeroFlattener(const edm::ParameterSet &pset);
32  void produce(edm::Event& evt, const edm::EventSetup& es);
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  std::auto_ptr<std::vector<reco::RecoTauPiZero> > output(
60  new std::vector<reco::RecoTauPiZero>());
61 
62  // Loop over the jets and append the pizeros for each jet to our output
63  // collection.
64  BOOST_FOREACH(reco::PFJetRef jetRef, jets) {
65  const std::vector<reco::RecoTauPiZero>& pizeros = (*piZeroAssoc)[jetRef];
66  output->reserve(output->size() + pizeros.size());
67  output->insert(output->end(), pizeros.begin(), pizeros.end());
68  }
69 
70  evt.put(output);
71 }
72 
T getParameter(std::string const &) const
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:94
vector< PseudoJet > jets
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
void produce(edm::Event &evt, const edm::EventSetup &es)
RecoTauPiZeroFlattener(const edm::ParameterSet &pset)