CMS 3D CMS Logo

CMSSW_4_4_3_patch1/src/RecoJets/JetProducers/plugins/FixedGridRhoProducer.cc

Go to the documentation of this file.
00001 #include "RecoJets/JetProducers/plugins/FixedGridRhoProducer.h"
00002 #include "FWCore/Framework/interface/Event.h"
00003 #include "FWCore/Framework/interface/MakerMacros.h"
00004 
00005 using namespace std;
00006 
00007 FixedGridRhoProducer::FixedGridRhoProducer(const edm::ParameterSet& iConfig) {
00008   pfCandidatesTag_ = iConfig.getParameter<edm::InputTag>("pfCandidatesTag");
00009   string etaRegion = iConfig.getParameter<string>("EtaRegion");
00010   if (etaRegion=="Central") myEtaRegion = FixedGridEnergyDensity::Central;
00011   else if (etaRegion=="Forward") myEtaRegion = FixedGridEnergyDensity::Forward;
00012   else if (etaRegion=="All") myEtaRegion = FixedGridEnergyDensity::All;
00013   else {
00014     edm::LogWarning("FixedGridRhoProducer") << "Wrong EtaRegion parameter: " << etaRegion << ". Using EtaRegion = Central";  
00015     myEtaRegion = FixedGridEnergyDensity::Central;
00016   }
00017   produces<double>();
00018 }
00019 
00020 FixedGridRhoProducer::~FixedGridRhoProducer(){} 
00021 
00022 void FixedGridRhoProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) {
00023 
00024    edm::Handle<reco::PFCandidateCollection> pfColl;
00025    iEvent.getByLabel(pfCandidatesTag_,pfColl);
00026 
00027    algo = new FixedGridEnergyDensity(pfColl.product());
00028 
00029    double result = algo->fixedGridRho(myEtaRegion);
00030    std::auto_ptr<double> output(new double(result));
00031    iEvent.put(output);
00032 
00033    delete algo;
00034  
00035 }
00036 
00037 DEFINE_FWK_MODULE(FixedGridRhoProducer);