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 <algorithm>
14 
20 
24 
26 
28  public:
31  void produce(edm::Event& evt, const edm::EventSetup& es) override;
32  private:
35 };
36 
38  jetSrc_ = pset.getParameter<edm::InputTag>("jetSrc");
39  piZeroSrc_ = pset.getParameter<edm::InputTag>("piZeroSrc");
40  produces<std::vector<reco::RecoTauPiZero> >();
41 }
42 
43 void
45  // Get the jet input collection via a view of Candidates
47  evt.getByLabel(jetSrc_, jetView);
48 
49  // Convert to a vector of PFJetRefs
51  reco::tau::castView<reco::PFJetRefVector>(jetView);
52 
53  // Get the pizero input collection
55  evt.getByLabel(piZeroSrc_, piZeroAssoc);
56 
57  // Create output collection
58  auto output = std::make_unique<std::vector<reco::RecoTauPiZero>>();
59 
60  // Loop over the jets and append the pizeros for each jet to our output
61  // collection.
62  for(auto const& jetRef : jets) {
63  const std::vector<reco::RecoTauPiZero>& pizeros = (*piZeroAssoc)[reco::JetBaseRef(jetRef)];
64  output->reserve(output->size() + pizeros.size());
65  output->insert(output->end(), pizeros.begin(), pizeros.end());
66  }
67 
68  evt.put(std::move(output));
69 }
70 
T getParameter(std::string const &) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:125
void produce(edm::Event &evt, const edm::EventSetup &es) override
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
vector< PseudoJet > jets
edm::RefToBase< Jet > JetBaseRef
Definition: JetCollection.h:13
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:480
RecoTauPiZeroFlattener(const edm::ParameterSet &pset)
def move(src, dest)
Definition: eostools.py:511