CMS 3D CMS Logo

JetCorrectionESChain.cc
Go to the documentation of this file.
1 //
2 // Original Author: Fedor Ratnikov
3 // Created: Dec. 28, 2006
4 //
5 //
6 
13 
14 #include <algorithm>
15 
17  : mCorrectors (fParameters.getParameter < std::vector<std::string> > ("correctors"))
18 {
19  std::string label(fParameters.getParameter<std::string>("@module_label"));
20  if (std::find(mCorrectors.begin(), mCorrectors.end(), label) != mCorrectors.end()) {
21  throw cms::Exception("Recursion is not allowed")
22  << "JetCorrectionESChain: corrector " << label << " is chained to itself";
23  }
24  setWhatProduced(this, label);
25 }
26 
28 
29 std::unique_ptr<JetCorrector> JetCorrectionESChain::produce(JetCorrectionsRecord const& fRecord) {
30  std::unique_ptr<ChainedJetCorrector> corrector{ new ChainedJetCorrector};
31  corrector->clear ();
32  for (size_t i = 0; i < mCorrectors.size(); ++i) {
34  fRecord.get(mCorrectors[i], handle);
35  corrector->push_back(&*handle);
36  }
37  return corrector;
38 }
T getParameter(std::string const &) const
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:124
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
PRODUCT const & get(ESGetToken< PRODUCT, T > const &iToken) const
std::unique_ptr< JetCorrector > produce(JetCorrectionsRecord const &)
char const * label
std::vector< std::string > mCorrectors
JetCorrectionESChain(edm::ParameterSet const &fParameters)