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

CalibTracker/SiStripESProducers: ESProducers update to return unique_ptr. #22062

Merged
merged 3 commits into from Feb 3, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -29,7 +29,7 @@ class SiStripApvGainFakeESSource : public edm::ESProducer, public edm::EventSetu

void setIntervalFor( const edm::eventsetup::EventSetupRecordKey&, const edm::IOVSyncValue& iov, edm::ValidityInterval& iValidity ) override;

typedef std::shared_ptr<SiStripApvGain> ReturnType;
typedef std::unique_ptr<SiStripApvGain> ReturnType;
ReturnType produce(const SiStripApvGainRcd&);

private:
Expand Down Expand Up @@ -71,7 +71,7 @@ SiStripApvGainFakeESSource::produce(const SiStripApvGainRcd& iRecord)
{
using namespace edm::es;

std::shared_ptr<SiStripApvGain> apvGain{new SiStripApvGain};
std::unique_ptr<SiStripApvGain> apvGain{new SiStripApvGain};
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please change to

auto apvGain = std::make_unique<SiStripApvGain>();


SiStripDetInfoFileReader reader{m_file.fullPath()};

Expand Down
Expand Up @@ -29,7 +29,7 @@ class SiStripBackPlaneCorrectioNFakeESSource : public edm::ESProducer, public ed

void setIntervalFor( const edm::eventsetup::EventSetupRecordKey&, const edm::IOVSyncValue& iov, edm::ValidityInterval& iValidity ) override;

typedef std::shared_ptr<SiStripBackPlaneCorrection> ReturnType;
typedef std::unique_ptr<SiStripBackPlaneCorrection> ReturnType;
ReturnType produce(const SiStripBackPlaneCorrectionRcd&);

private:
Expand Down Expand Up @@ -67,7 +67,7 @@ SiStripBackPlaneCorrectioNFakeESSource::produce(const SiStripBackPlaneCorrection
edm::ESHandle<TrackerTopology> tTopo;
iRecord.getRecord<TrackerTopologyRcd>().get(tTopo);

std::shared_ptr<SiStripBackPlaneCorrection> backPlaneCorrection{new SiStripBackPlaneCorrection};
std::unique_ptr<SiStripBackPlaneCorrection> backPlaneCorrection = std::make_unique<SiStripBackPlaneCorrection>();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use auto


SiStripDetInfoFileReader reader{m_file.fullPath()};

Expand Down
Expand Up @@ -30,7 +30,7 @@ class SiStripBadModuleConfigurableFakeESSource : public edm::ESProducer, public

void setIntervalFor( const edm::eventsetup::EventSetupRecordKey&, const edm::IOVSyncValue& iov, edm::ValidityInterval& iValidity ) override;

typedef std::shared_ptr<SiStripBadStrip> ReturnType;
typedef std::unique_ptr<SiStripBadStrip> ReturnType;
ReturnType produce(const SiStripBadModuleRcd&);

private:
Expand Down Expand Up @@ -73,7 +73,7 @@ SiStripBadModuleConfigurableFakeESSource::produce(const SiStripBadModuleRcd& iRe
edm::ESHandle<TrackerTopology> tTopo;
iRecord.getRecord<TrackerTopologyRcd>().get(tTopo);

std::shared_ptr<SiStripQuality> quality{new SiStripQuality};
std::unique_ptr<SiStripQuality> quality = std::make_unique<SiStripQuality>();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use auto


SiStripDetInfoFileReader reader{m_file.fullPath()};

Expand Down
Expand Up @@ -29,7 +29,7 @@ class SiStripBaseDelayFakeESSource : public edm::ESProducer, public edm::EventSe

void setIntervalFor( const edm::eventsetup::EventSetupRecordKey&, const edm::IOVSyncValue& iov, edm::ValidityInterval& iValidity ) override;

typedef std::shared_ptr<SiStripBaseDelay> ReturnType;
typedef std::unique_ptr<SiStripBaseDelay> ReturnType;
ReturnType produce(const SiStripBaseDelayRcd&);

private:
Expand Down Expand Up @@ -64,7 +64,7 @@ SiStripBaseDelayFakeESSource::produce(const SiStripBaseDelayRcd& iRecord)
{
using namespace edm::es;

std::shared_ptr<SiStripBaseDelay> baseDelay{new SiStripBaseDelay};
std::unique_ptr<SiStripBaseDelay> baseDelay = std::make_unique<SiStripBaseDelay>();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use auto


SiStripDetInfoFileReader reader{m_file.fullPath()};

Expand Down
Expand Up @@ -29,7 +29,7 @@ class SiStripConfObjectFakeESSource : public edm::ESProducer, public edm::EventS

void setIntervalFor( const edm::eventsetup::EventSetupRecordKey&, const edm::IOVSyncValue& iov, edm::ValidityInterval& iValidity ) override;

typedef std::shared_ptr<SiStripConfObject> ReturnType;
typedef std::unique_ptr<SiStripConfObject> ReturnType;
ReturnType produce(const SiStripConfObjectRcd&);

private:
Expand Down Expand Up @@ -61,7 +61,7 @@ SiStripConfObjectFakeESSource::produce(const SiStripConfObjectRcd& iRecord)
{
using namespace edm::es;

std::shared_ptr<SiStripConfObject> confObject{new SiStripConfObject};
std::unique_ptr<SiStripConfObject> confObject = std::make_unique<SiStripConfObject>();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use auto


for ( const auto& param : m_parameters ) {
const std::string paramType{param.getParameter<std::string>("ParameterType")};
Expand Down
Expand Up @@ -29,7 +29,7 @@ class SiStripLatencyFakeESSource : public edm::ESProducer, public edm::EventSetu

void setIntervalFor( const edm::eventsetup::EventSetupRecordKey&, const edm::IOVSyncValue& iov, edm::ValidityInterval& iValidity ) override;

typedef std::shared_ptr<SiStripLatency> ReturnType;
typedef std::unique_ptr<SiStripLatency> ReturnType;
ReturnType produce(const SiStripLatencyRcd&);

private:
Expand Down Expand Up @@ -64,7 +64,7 @@ SiStripLatencyFakeESSource::produce(const SiStripLatencyRcd& iRecord)
{
using namespace edm::es;

std::shared_ptr<SiStripLatency> latency{new SiStripLatency};
std::unique_ptr<SiStripLatency> latency = std::make_unique<SiStripLatency>();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use auto


SiStripDetInfoFileReader reader{m_file.fullPath()};
const auto& detInfos = reader.getAllData();
Expand Down
Expand Up @@ -38,7 +38,7 @@ class SiStripLorentzAngleFakeESSource : public edm::ESProducer, public edm::Even

void setIntervalFor( const edm::eventsetup::EventSetupRecordKey&, const edm::IOVSyncValue& iov, edm::ValidityInterval& iValidity ) override;

typedef std::shared_ptr<SiStripLorentzAngle> ReturnType;
typedef std::unique_ptr<SiStripLorentzAngle> ReturnType;
ReturnType produce(const SiStripLorentzAngleRcd&);

private:
Expand Down Expand Up @@ -169,7 +169,7 @@ SiStripLorentzAngleFakeESSource::produce(const SiStripLorentzAngleRcd& iRecord)
edm::ESHandle<TrackerTopology> tTopo;
iRecord.getRecord<TrackerTopologyRcd>().get(tTopo);

std::shared_ptr<SiStripLorentzAngle> lorentzAngle{new SiStripLorentzAngle};
std::unique_ptr<SiStripLorentzAngle> lorentzAngle = std::make_unique<SiStripLorentzAngle>();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use auto


SiStripDetInfoFileReader reader{m_file.fullPath()};

Expand Down
Expand Up @@ -33,7 +33,7 @@ class SiStripNoisesFakeESSource : public edm::ESProducer, public edm::EventSetup

void setIntervalFor( const edm::eventsetup::EventSetupRecordKey&, const edm::IOVSyncValue& iov, edm::ValidityInterval& iValidity ) override;

typedef std::shared_ptr<SiStripNoises> ReturnType;
typedef std::unique_ptr<SiStripNoises> ReturnType;
ReturnType produce(const SiStripNoisesRcd&);

private:
Expand Down Expand Up @@ -98,7 +98,7 @@ SiStripNoisesFakeESSource::produce(const SiStripNoisesRcd& iRecord)
edm::ESHandle<TrackerTopology> tTopo;
iRecord.getRecord<TrackerTopologyRcd>().get(tTopo);

std::shared_ptr<SiStripNoises> noises{new SiStripNoises};
std::unique_ptr<SiStripNoises> noises = std::make_unique<SiStripNoises>();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use auto


SiStripDetInfoFileReader reader{m_file.fullPath()};

Expand Down
Expand Up @@ -29,7 +29,7 @@ class SiStripPedestalsFakeESSource : public edm::ESProducer, public edm::EventSe

void setIntervalFor( const edm::eventsetup::EventSetupRecordKey&, const edm::IOVSyncValue& iov, edm::ValidityInterval& iValidity ) override;

typedef std::shared_ptr<SiStripPedestals> ReturnType;
typedef std::unique_ptr<SiStripPedestals> ReturnType;
ReturnType produce(const SiStripPedestalsRcd&);

private:
Expand Down Expand Up @@ -64,7 +64,7 @@ SiStripPedestalsFakeESSource::produce(const SiStripPedestalsRcd& iRecord)
{
using namespace edm::es;

std::shared_ptr<SiStripPedestals> pedestals{new SiStripPedestals};
std::unique_ptr<SiStripPedestals> pedestals = std::make_unique<SiStripPedestals>();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use auto


SiStripDetInfoFileReader reader{m_file.fullPath()};

Expand Down
Expand Up @@ -66,7 +66,7 @@ SiStripThresholdFakeESSource::produce(const SiStripThresholdRcd& iRecord)
{
using namespace edm::es;

std::shared_ptr<SiStripThreshold> threshold{new SiStripThreshold};
std::shared_ptr<SiStripThreshold> threshold = std::make_shared<SiStripThreshold>();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The title of this PR is to move to unique_ptr. Can you quickly explain, why this is not extended to all conditions?


SiStripDetInfoFileReader reader{m_file.fullPath()};

Expand Down
Expand Up @@ -32,9 +32,9 @@ SiStripBackPlaneCorrectionDepESProducer::SiStripBackPlaneCorrectionDepESProducer
}


std::shared_ptr<SiStripBackPlaneCorrection> SiStripBackPlaneCorrectionDepESProducer::produce(const SiStripBackPlaneCorrectionDepRcd& iRecord)
std::unique_ptr<SiStripBackPlaneCorrection> SiStripBackPlaneCorrectionDepESProducer::produce(const SiStripBackPlaneCorrectionDepRcd& iRecord)
{
std::shared_ptr<SiStripBackPlaneCorrection> siStripBPC;
std::unique_ptr<SiStripBackPlaneCorrection> siStripBPC;
edm::LogInfo("SiStripBackPlaneCorrectionDepESProducer") << "Producer called" << std::endl;

std::string latencyRecordName = getLatency.getParameter<std::string>("record");
Expand All @@ -61,7 +61,7 @@ std::shared_ptr<SiStripBackPlaneCorrection> SiStripBackPlaneCorrectionDepESProdu
if ( backPlaneCorrectionRecordName == "SiStripBackPlaneCorrectionRcd"){
edm::ESHandle<SiStripBackPlaneCorrection> siStripBackPlaneCorrection;
iRecord.getRecord<SiStripBackPlaneCorrectionRcd>().get(backPlaneCorrectionLabel, siStripBackPlaneCorrection);
siStripBPC = std::make_shared<SiStripBackPlaneCorrection>(*(siStripBackPlaneCorrection.product()));
siStripBPC = std::make_unique<SiStripBackPlaneCorrection>(*(siStripBackPlaneCorrection.product()));
} else edm::LogError("SiStripBackPlaneCorrectionDepESProducer") << "[SiStripBackPlaneCorrectionDepESProducer::produce] No Lorentz Angle Record found " << std::endl;


Expand Down
Expand Up @@ -23,7 +23,7 @@ class SiStripBackPlaneCorrectionDepESProducer : public edm::ESProducer {
SiStripBackPlaneCorrectionDepESProducer(const edm::ParameterSet&);
~SiStripBackPlaneCorrectionDepESProducer() override{};

std::shared_ptr<SiStripBackPlaneCorrection> produce(const SiStripBackPlaneCorrectionDepRcd&);
std::unique_ptr<SiStripBackPlaneCorrection> produce(const SiStripBackPlaneCorrectionDepRcd&);

private:

Expand Down
Expand Up @@ -47,7 +47,7 @@ class SiStripBadModuleFedErrESSource : public edm::ESProducer, public edm::Event

void setIntervalFor( const edm::eventsetup::EventSetupRecordKey&, const edm::IOVSyncValue& iov, edm::ValidityInterval& iValidity ) override;

typedef std::shared_ptr<SiStripBadStrip> ReturnType;
typedef std::unique_ptr<SiStripBadStrip> ReturnType;
ReturnType produce( const SiStripBadModuleFedErrRcd& );

private:
Expand Down Expand Up @@ -125,7 +125,7 @@ SiStripBadModuleFedErrESSource::produce(const SiStripBadModuleFedErrRcd& iRecord
edm::ESHandle<SiStripFedCabling> cabling;
iRecord.getRecord<SiStripFedCablingRcd>().get(cabling);

std::shared_ptr<SiStripQuality> quality{new SiStripQuality};
std::unique_ptr<SiStripQuality> quality = std::make_unique<SiStripQuality>();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use auto


DQMStore* dqmStore = edm::Service<DQMStore>().operator->();
if ( m_readFlag ) { // open requested file
Expand Down
Expand Up @@ -33,10 +33,10 @@ SiStripDelayESProducer::SiStripDelayESProducer(const edm::ParameterSet& iConfig)
}


std::shared_ptr<SiStripDelay> SiStripDelayESProducer::produce(const SiStripDelayRcd& iRecord)
std::unique_ptr<SiStripDelay> SiStripDelayESProducer::produce(const SiStripDelayRcd& iRecord)
{
edm::LogInfo("SiStripDelayESProducer") << "produce called" << std::endl;
auto delay = std::make_shared<SiStripDelay>();
auto delay = std::make_unique<SiStripDelay>();
delay->clear();

edm::ESHandle<SiStripBaseDelay> baseDelay;
Expand Down
Expand Up @@ -22,7 +22,7 @@ class SiStripDelayESProducer : public edm::ESProducer {
SiStripDelayESProducer(const edm::ParameterSet&);
~SiStripDelayESProducer() override{};

std::shared_ptr<SiStripDelay> produce(const SiStripDelayRcd&);
std::unique_ptr<SiStripDelay> produce(const SiStripDelayRcd&);

private:

Expand Down
Expand Up @@ -34,9 +34,9 @@ SiStripLorentzAngleDepESProducer::SiStripLorentzAngleDepESProducer(const edm::Pa
}


std::shared_ptr<SiStripLorentzAngle> SiStripLorentzAngleDepESProducer::produce(const SiStripLorentzAngleDepRcd& iRecord)
std::unique_ptr<SiStripLorentzAngle> SiStripLorentzAngleDepESProducer::produce(const SiStripLorentzAngleDepRcd& iRecord)
{
std::shared_ptr<SiStripLorentzAngle> siStripLA;
std::unique_ptr<SiStripLorentzAngle> siStripLA;
edm::LogInfo("SiStripLorentzAngleDepESProducer") << "Producer called" << std::endl;

std::string latencyRecordName = getLatency.getParameter<std::string>("record");
Expand Down
Expand Up @@ -23,7 +23,7 @@ class SiStripLorentzAngleDepESProducer : public edm::ESProducer {
SiStripLorentzAngleDepESProducer(const edm::ParameterSet&);
~SiStripLorentzAngleDepESProducer() override{};

std::shared_ptr<SiStripLorentzAngle> produce(const SiStripLorentzAngleDepRcd&);
std::unique_ptr<SiStripLorentzAngle> produce(const SiStripLorentzAngleDepRcd&);

private:

Expand Down
Expand Up @@ -34,9 +34,9 @@ SiStripQualityESProducer::SiStripQualityESProducer(const edm::ParameterSet& iCon
}


std::shared_ptr<SiStripQuality> SiStripQualityESProducer::produce(const SiStripQualityRcd& iRecord)
std::unique_ptr<SiStripQuality> SiStripQualityESProducer::produce(const SiStripQualityRcd& iRecord)
{
auto quality = std::make_shared<SiStripQuality>();
auto quality = std::make_unique<SiStripQuality>();
edm::LogInfo("SiStripQualityESProducer") << "produce called" << std::endl;

quality->clear();
Expand Down
Expand Up @@ -22,7 +22,7 @@ class SiStripQualityESProducer : public edm::ESProducer {
SiStripQualityESProducer(const edm::ParameterSet&);
~SiStripQualityESProducer() override{};

std::shared_ptr<SiStripQuality> produce(const SiStripQualityRcd&);
std::unique_ptr<SiStripQuality> produce(const SiStripQualityRcd&);

private:

Expand Down