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") myEtaRegion = FixedGridEnergyDensity::Central;
11  else if (etaRegion=="Forward") myEtaRegion = FixedGridEnergyDensity::Forward;
12  else if (etaRegion=="All") myEtaRegion = FixedGridEnergyDensity::All;
13  else {
14  edm::LogWarning("FixedGridRhoProducer") << "Wrong EtaRegion parameter: " << etaRegion << ". Using EtaRegion = Central";
15  myEtaRegion = FixedGridEnergyDensity::Central;
16  }
17  produces<double>();
18 
19  input_pfcoll_token_ = consumes<reco::PFCandidateCollection>(pfCandidatesTag_);
20 
21 }
22 
24 
26 
28  iEvent.getByToken(input_pfcoll_token_, pfColl);
29 
30  algo = new FixedGridEnergyDensity(pfColl.product());
31 
32  double result = algo->fixedGridRho(myEtaRegion);
33  iEvent.put(std::make_unique<double>(result));
34 
35  delete algo;
36 
37 }
38 
T getParameter(std::string const &) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
int iEvent
Definition: GenABIO.cc:230
FixedGridRhoProducer(const edm::ParameterSet &iConfig)
T const * product() const
Definition: Handle.h:81
virtual void produce(edm::Event &, const edm::EventSetup &)