Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JetMETCorrections/Modules: Change return type of EDProducers. #21991

Merged
merged 1 commit into from
Jan 29, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
}