Skip to content

Commit

Permalink
Merge pull request #21991 from gartung/JetMETCorrections-Modules-retu…
Browse files Browse the repository at this point in the history
…rntype

JetMETCorrections/Modules: Change return type of EDProducers.
  • Loading branch information
cmsbuild authored Jan 29, 2018
2 parents 7f4bc8e + 1ae065a commit ef381de
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 19 deletions.
3 changes: 1 addition & 2 deletions JetMETCorrections/Modules/interface/JetCorrectionESChain.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,9 @@ class JetCorrectionESChain : public edm::ESProducer {
JetCorrectionESChain(edm::ParameterSet const& fParameters);
~JetCorrectionESChain() override;

std::shared_ptr<JetCorrector> produce(JetCorrectionsRecord const& );
std::unique_ptr<JetCorrector> produce(JetCorrectionsRecord const& );

private:
std::vector <std::string> mCorrectors;
std::shared_ptr<JetCorrector> mChainCorrector;
};
#endif
4 changes: 2 additions & 2 deletions JetMETCorrections/Modules/interface/JetCorrectionESProducer.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ class JetCorrectionESProducer : public edm::ESProducer

~JetCorrectionESProducer() override {}

std::shared_ptr<JetCorrector> produce(JetCorrectionsRecord const& iRecord)
std::unique_ptr<JetCorrector> produce(JetCorrectionsRecord const& iRecord)
{
edm::ESHandle<JetCorrectorParametersCollection> JetCorParColl;
iRecord.get(mAlgo,JetCorParColl);
JetCorrectorParameters const& JetCorPar = (*JetCorParColl)[mLevel];
return std::make_shared<Corrector>(JetCorPar, mParameterSet);
return std::make_unique<Corrector>(JetCorPar, mParameterSet);
}
};
#endif
8 changes: 4 additions & 4 deletions JetMETCorrections/Modules/interface/JetResolutionESProducer.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ class JetResolutionESProducer : public edm::ESProducer

~JetResolutionESProducer() override {}

std::shared_ptr<JME::JetResolution> produce(JetResolutionRcd const& iRecord) {
std::unique_ptr<JME::JetResolution> produce(JetResolutionRcd const& iRecord) {

// Get object from record
edm::ESHandle<JME::JetResolutionObject> jerObjectHandle;
iRecord.get(m_label, jerObjectHandle);

// Convert this object to a JetResolution object
JME::JetResolutionObject const& jerObject = (*jerObjectHandle);
return std::make_shared<JME::JetResolution>(jerObject);
return std::make_unique<JME::JetResolution>(jerObject);
}
};

Expand All @@ -57,15 +57,15 @@ class JetResolutionScaleFactorESProducer : public edm::ESProducer

~JetResolutionScaleFactorESProducer() override {}

std::shared_ptr<JME::JetResolutionScaleFactor> produce(JetResolutionScaleFactorRcd const& iRecord) {
std::unique_ptr<JME::JetResolutionScaleFactor> produce(JetResolutionScaleFactorRcd const& iRecord) {

// Get object from record
edm::ESHandle<JME::JetResolutionObject> jerObjectHandle;
iRecord.get(m_label, jerObjectHandle);

// Convert this object to a JetResolution object
JME::JetResolutionObject const& jerObject = (*jerObjectHandle);
return std::make_shared<JME::JetResolutionScaleFactor>(jerObject);
return std::make_unique<JME::JetResolutionScaleFactor>(jerObject);
}
};
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class QGLikelihoodESProducer : public edm::ESProducer{
QGLikelihoodESProducer(const edm::ParameterSet&);
~QGLikelihoodESProducer() override{};

std::shared_ptr<QGLikelihoodObject> produce(const QGLikelihoodRcd&);
std::unique_ptr<QGLikelihoodObject> produce(const QGLikelihoodRcd&);
void setIntervalFor(const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &, edm::ValidityInterval &);

private:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class QGLikelihoodSystematicsESProducer : public edm::ESProducer{
QGLikelihoodSystematicsESProducer(const edm::ParameterSet&);
~QGLikelihoodSystematicsESProducer() override{};

std::shared_ptr<QGLikelihoodSystematicsObject> produce(const QGLikelihoodSystematicsRcd&);
std::unique_ptr<QGLikelihoodSystematicsObject> produce(const QGLikelihoodSystematicsRcd&);
void setIntervalFor(const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &, edm::ValidityInterval &);
private:
std::string mAlgo;
Expand Down
9 changes: 4 additions & 5 deletions JetMETCorrections/Modules/src/JetCorrectionESChain.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
#include <algorithm>

JetCorrectionESChain::JetCorrectionESChain(edm::ParameterSet const& fParameters)
: mCorrectors (fParameters.getParameter < std::vector<std::string> > ("correctors")),
mChainCorrector (new ChainedJetCorrector ())
: mCorrectors (fParameters.getParameter < std::vector<std::string> > ("correctors"))
{
std::string label(fParameters.getParameter<std::string>("@module_label"));
if (std::find(mCorrectors.begin(), mCorrectors.end(), label) != mCorrectors.end()) {
Expand All @@ -27,13 +26,13 @@ JetCorrectionESChain::JetCorrectionESChain(edm::ParameterSet const& fParameters)

JetCorrectionESChain::~JetCorrectionESChain() {}

std::shared_ptr<JetCorrector> JetCorrectionESChain::produce(JetCorrectionsRecord const& fRecord) {
ChainedJetCorrector* corrector = dynamic_cast<ChainedJetCorrector*>(&*mChainCorrector);
std::unique_ptr<JetCorrector> JetCorrectionESChain::produce(JetCorrectionsRecord const& fRecord) {
std::unique_ptr<ChainedJetCorrector> corrector{ new ChainedJetCorrector};
corrector->clear ();
for (size_t i = 0; i < mCorrectors.size(); ++i) {
edm::ESHandle <JetCorrector> handle;
fRecord.get(mCorrectors[i], handle);
corrector->push_back(&*handle);
}
return mChainCorrector;
return corrector;
}
4 changes: 2 additions & 2 deletions JetMETCorrections/Modules/src/QGLikelihoodESProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ void QGLikelihoodESProducer::setIntervalFor(const edm::eventsetup::EventSetupRec
}

// Produce the data
std::shared_ptr<QGLikelihoodObject> QGLikelihoodESProducer::produce(const QGLikelihoodRcd& iRecord){
std::unique_ptr<QGLikelihoodObject> QGLikelihoodESProducer::produce(const QGLikelihoodRcd& iRecord){
edm::ESHandle<QGLikelihoodObject> qglObj;
iRecord.get(mAlgo, qglObj);

return std::make_shared<QGLikelihoodObject>(*qglObj);
return std::make_unique<QGLikelihoodObject>(*qglObj);
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ void QGLikelihoodSystematicsESProducer::setIntervalFor(const edm::eventsetup::Ev
}

// Produce the data
std::shared_ptr<QGLikelihoodSystematicsObject> QGLikelihoodSystematicsESProducer::produce(const QGLikelihoodSystematicsRcd& iRecord){
std::unique_ptr<QGLikelihoodSystematicsObject> QGLikelihoodSystematicsESProducer::produce(const QGLikelihoodSystematicsRcd& iRecord){
edm::ESHandle<QGLikelihoodSystematicsObject> qglObj;
iRecord.get(mAlgo, qglObj);

return std::make_shared<QGLikelihoodSystematicsObject>(*qglObj);
return std::make_unique<QGLikelihoodSystematicsObject>(*qglObj);
}

0 comments on commit ef381de

Please sign in to comment.