CMS 3D CMS Logo

FixedGridRhoProducer.cc
Go to the documentation of this file.
4 
5 using namespace std;
6 
8  pfCandidatesTag_ = iConfig.getParameter<edm::InputTag>("pfCandidatesTag");
9  string etaRegion = iConfig.getParameter<string>("EtaRegion");
10  if (etaRegion == "Central")
11  myEtaRegion = FixedGridEnergyDensity::Central;
12  else if (etaRegion == "Forward")
13  myEtaRegion = FixedGridEnergyDensity::Forward;
14  else if (etaRegion == "All")
15  myEtaRegion = FixedGridEnergyDensity::All;
16  else {
17  edm::LogWarning("FixedGridRhoProducer")
18  << "Wrong EtaRegion parameter: " << etaRegion << ". Using EtaRegion = Central";
19  myEtaRegion = FixedGridEnergyDensity::Central;
20  }
21  produces<double>();
22 
23  input_pfcoll_token_ = consumes<reco::PFCandidateCollection>(pfCandidatesTag_);
24 }
25 
27 
30  iEvent.getByToken(input_pfcoll_token_, pfColl);
31 
32  algo = new FixedGridEnergyDensity(pfColl.product());
33 
34  double result = algo->fixedGridRho(myEtaRegion);
35  iEvent.put(std::make_unique<double>(result));
36 
37  delete algo;
38 }
39 
void produce(edm::Event &, const edm::EventSetup &) override
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
T const * product() const
Definition: Handle.h:70
int iEvent
Definition: GenABIO.cc:224
FixedGridRhoProducer(const edm::ParameterSet &iConfig)
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
Log< level::Warning, false > LogWarning