CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
tuple result
Definition: mps_fire.py:311
int iEvent
Definition: GenABIO.cc:224
FixedGridRhoProducer(const edm::ParameterSet &iConfig)
T const * product() const
Definition: Handle.h:70
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
Log< level::Warning, false > LogWarning