Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:35:03

0001 #include "RecoJets/JetProducers/plugins/FixedGridRhoProducerFastjet.h"
0002 #include "FWCore/Framework/interface/Event.h"
0003 #include "DataFormats/Common/interface/View.h"
0004 #include "FWCore/Framework/interface/MakerMacros.h"
0005 #include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h"
0006 
0007 using namespace std;
0008 
0009 FixedGridRhoProducerFastjet::FixedGridRhoProducerFastjet(const edm::ParameterSet& iConfig)
0010     : bge_(iConfig.getParameter<double>("maxRapidity"), iConfig.getParameter<double>("gridSpacing")) {
0011   pfCandidatesTag_ = iConfig.getParameter<edm::InputTag>("pfCandidatesTag");
0012   produces<double>();
0013 
0014   input_pfcoll_token_ = consumes<edm::View<reco::Candidate> >(pfCandidatesTag_);
0015 }
0016 
0017 FixedGridRhoProducerFastjet::~FixedGridRhoProducerFastjet() {}
0018 
0019 void FixedGridRhoProducerFastjet::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) {
0020   edm::Handle<edm::View<reco::Candidate> > pfColl;
0021   iEvent.getByToken(input_pfcoll_token_, pfColl);
0022   std::vector<fastjet::PseudoJet> inputs;
0023   for (edm::View<reco::Candidate>::const_iterator ibegin = pfColl->begin(), iend = pfColl->end(), i = ibegin; i != iend;
0024        ++i) {
0025     inputs.push_back(fastjet::PseudoJet(i->px(), i->py(), i->pz(), i->energy()));
0026   }
0027   bge_.set_particles(inputs);
0028   iEvent.put(std::make_unique<double>(bge_.rho()));
0029 }
0030 
0031 DEFINE_FWK_MODULE(FixedGridRhoProducerFastjet);