Skip to content

Commit

Permalink
HcalRecAlgoESProducer: Remove shared_ptr class member and add copy of…
Browse files Browse the repository at this point in the history
… iConfig.

The copy of iConfig is used to create the shared_ptr in the produce method.
  • Loading branch information
gartung committed Jan 26, 2018
1 parent 432568f commit 308f996
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions RecoLocalCalo/HcalRecAlgos/plugins/HcalRecAlgoESProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ class HcalRecAlgoESProducer : public edm::ESProducer {

static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);

typedef std::shared_ptr<HcalSeverityLevelComputer> ReturnType;
typedef std::unique_ptr<HcalSeverityLevelComputer> ReturnType;

ReturnType produce(const HcalSeverityLevelComputerRcd&);
private:
// ----------member data ---------------------------
ReturnType myComputer;
const edm::ParameterSet mConfig;
};

//
Expand All @@ -64,14 +64,13 @@ class HcalRecAlgoESProducer : public edm::ESProducer {
//
// constructors and destructor
//
HcalRecAlgoESProducer::HcalRecAlgoESProducer(const edm::ParameterSet& iConfig)
HcalRecAlgoESProducer::HcalRecAlgoESProducer(const edm::ParameterSet& iConfig): mConfig(iConfig)
{
//the following line is needed to tell the framework what
// data is being produced
setWhatProduced(this);

//now do what ever other initialization is needed
myComputer = std::make_shared<HcalSeverityLevelComputer>(iConfig);
}


Expand All @@ -93,8 +92,7 @@ HcalRecAlgoESProducer::ReturnType
HcalRecAlgoESProducer::produce(const HcalSeverityLevelComputerRcd& iRecord)
{
using namespace edm::es;

return myComputer ;
return std::make_unique<HcalSeverityLevelComputer>(mConfig);
}

void HcalRecAlgoESProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
Expand Down

0 comments on commit 308f996

Please sign in to comment.