Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #include "RecoJets/JetProducers/plugins/FixedGridRhoProducer.h"
0002 #include "FWCore/Framework/interface/Event.h"
0003 #include "FWCore/Framework/interface/MakerMacros.h"
0004 
0005 using namespace std;
0006 
0007 FixedGridRhoProducer::FixedGridRhoProducer(const edm::ParameterSet& iConfig) {
0008   pfCandidatesTag_ = iConfig.getParameter<edm::InputTag>("pfCandidatesTag");
0009   string etaRegion = iConfig.getParameter<string>("EtaRegion");
0010   if (etaRegion == "Central")
0011     myEtaRegion = FixedGridEnergyDensity::Central;
0012   else if (etaRegion == "Forward")
0013     myEtaRegion = FixedGridEnergyDensity::Forward;
0014   else if (etaRegion == "All")
0015     myEtaRegion = FixedGridEnergyDensity::All;
0016   else {
0017     edm::LogWarning("FixedGridRhoProducer")
0018         << "Wrong EtaRegion parameter: " << etaRegion << ". Using EtaRegion = Central";
0019     myEtaRegion = FixedGridEnergyDensity::Central;
0020   }
0021   produces<double>();
0022 
0023   input_pfcoll_token_ = consumes<reco::PFCandidateCollection>(pfCandidatesTag_);
0024 }
0025 
0026 FixedGridRhoProducer::~FixedGridRhoProducer() {}
0027 
0028 void FixedGridRhoProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) {
0029   edm::Handle<reco::PFCandidateCollection> pfColl;
0030   iEvent.getByToken(input_pfcoll_token_, pfColl);
0031 
0032   algo = new FixedGridEnergyDensity(pfColl.product());
0033 
0034   double result = algo->fixedGridRho(myEtaRegion);
0035   iEvent.put(std::make_unique<double>(result));
0036 
0037   delete algo;
0038 }
0039 
0040 DEFINE_FWK_MODULE(FixedGridRhoProducer);