Skip to content

Commit

Permalink
Merge pull request #31289 from makortel/consumesGeometry
Browse files Browse the repository at this point in the history
Migrate Geometry from setConsumes() to type-deducing consumes()
  • Loading branch information
cmsbuild authored Sep 3, 2020
2 parents 84e158c + 18b4c4b commit af81ead
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 26 deletions.
6 changes: 4 additions & 2 deletions Geometry/CSCGeometryBuilder/plugins/CSCGeometryESModule.cc
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,11 @@ CSCGeometryESModule::CSCGeometryESModule(const edm::ParameterSet& p)
debugV_ = p.getUntrackedParameter<bool>("debugV", false);

if (fromDDD_) {
cc.setConsumes(cpvToken_).setConsumes(mdcToken_);
cpvToken_ = cc.consumes();
mdcToken_ = cc.consumes();
} else if (fromDD4hep_) {
cc.setConsumes(cpvTokendd4hep_).setConsumes(mdcToken_);
cpvTokendd4hep_ = cc.consumes();
mdcToken_ = cc.consumes();
} else {
rigToken_ = cc.consumesFrom<RecoIdealGeometry, CSCRecoGeometryRcd>(edm::ESInputTag{});
rdpToken_ = cc.consumesFrom<CSCRecoDigiParameters, CSCRecoDigiParametersRcd>(edm::ESInputTag{});
Expand Down
14 changes: 8 additions & 6 deletions Geometry/GEMGeometryBuilder/plugins/GEMGeometryESModule.cc
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,18 @@ GEMGeometryESModule::GEMGeometryESModule(const edm::ParameterSet& p)
alignmentsLabel_(p.getParameter<std::string>("alignmentsLabel")) {
auto cc = setWhatProduced(this);
if (fromDDD_) {
cc.setConsumes(cpvToken_).setConsumes(mdcToken_);
cpvToken_ = cc.consumes();
mdcToken_ = cc.consumes();
} else if (fromDD4hep_) {
cc.setConsumes(dd4hepcpvToken_).setConsumes(mdcToken_);
dd4hepcpvToken_ = cc.consumes();
mdcToken_ = cc.consumes();
} else {
cc.setConsumes(riggemToken_);
riggemToken_ = cc.consumes();
}
if (applyAlignment_) {
cc.setConsumes(globalPositionToken_, edm::ESInputTag{"", alignmentsLabel_})
.setConsumes(alignmentsToken_, edm::ESInputTag{"", alignmentsLabel_})
.setConsumes(alignmentErrorsToken_, edm::ESInputTag{"", alignmentsLabel_});
globalPositionToken_ = cc.consumes(edm::ESInputTag{"", alignmentsLabel_});
alignmentsToken_ = cc.consumes(edm::ESInputTag{"", alignmentsLabel_});
alignmentErrorsToken_ = cc.consumes(edm::ESInputTag{"", alignmentsLabel_});
}
}

Expand Down
8 changes: 5 additions & 3 deletions Geometry/GEMGeometryBuilder/plugins/ME0GeometryESModule.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,13 @@ ME0GeometryESModule::ME0GeometryESModule(const edm::ParameterSet& p) {
fromDD4hep_ = p.getParameter<bool>("fromDD4hep");
auto cc = setWhatProduced(this);
if (fromDDD_) {
cc.setConsumes(cpvToken_).setConsumes(mdcToken_);
cpvToken_ = cc.consumes();
mdcToken_ = cc.consumes();
} else if (fromDD4hep_) {
cc.setConsumes(dd4hepcpvToken_).setConsumes(mdcToken_);
dd4hepcpvToken_ = cc.consumes();
mdcToken_ = cc.consumes();
} else {
cc.setConsumes(rigme0Token_);
rigme0Token_ = cc.consumes();
}
}

Expand Down
7 changes: 3 additions & 4 deletions Geometry/MuonNumbering/plugins/MuonNumberingInitialization.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,11 @@ class MuonNumberingInitialization : public edm::ESProducer {
ReturnType produce(const MuonNumberingRecord&);

private:
edm::ESGetToken<DDCompactView, IdealGeometryRecord> geomToken_;
const edm::ESGetToken<DDCompactView, IdealGeometryRecord> geomToken_;
};

MuonNumberingInitialization::MuonNumberingInitialization(const edm::ParameterSet&) {
setWhatProduced(this).setConsumes(geomToken_);
}
MuonNumberingInitialization::MuonNumberingInitialization(const edm::ParameterSet&)
: geomToken_{setWhatProduced(this).consumes()} {}

MuonNumberingInitialization::ReturnType MuonNumberingInitialization::produce(const MuonNumberingRecord& iRecord) {
edm::ESTransientHandle<DDCompactView> pDD = iRecord.getTransientHandle(geomToken_);
Expand Down
8 changes: 5 additions & 3 deletions Geometry/RPCGeometryBuilder/plugins/RPCGeometryESModule.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,13 @@ RPCGeometryESModule::RPCGeometryESModule(const edm::ParameterSet& p)
auto cc = setWhatProduced(this);

if (fromDDD_) {
cc.setConsumes(idealGeomToken_).setConsumes(dddConstantsToken_);
idealGeomToken_ = cc.consumes();
dddConstantsToken_ = cc.consumes();
} else if (fromDD4hep_) {
cc.setConsumes(idealDD4hepGeomToken_).setConsumes(dddConstantsToken_);
idealDD4hepGeomToken_ = cc.consumes();
dddConstantsToken_ = cc.consumes();
} else {
cc.setConsumes(recoIdealToken_);
recoIdealToken_ = cc.consumes();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,12 @@ class TrackerParametersESModule : public edm::ESProducer {
ReturnType produce(const PTrackerParametersRcd&);

private:
edm::ESGetToken<DDCompactView, IdealGeometryRecord> geomToken_;
const edm::ESGetToken<DDCompactView, IdealGeometryRecord> geomToken_;
};

TrackerParametersESModule::TrackerParametersESModule(const edm::ParameterSet&) {
TrackerParametersESModule::TrackerParametersESModule(const edm::ParameterSet&)
: geomToken_{setWhatProduced(this).consumes()} {
edm::LogInfo("TRACKER") << "TrackerParametersESModule::TrackerParametersESModule";

setWhatProduced(this).setConsumes(geomToken_);
}

TrackerParametersESModule::~TrackerParametersESModule() {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,12 @@ class TrackerParametersESProducer : public edm::ESProducer {
ReturnType produce(const PTrackerParametersRcd&);

private:
edm::ESGetToken<cms::DDCompactView, IdealGeometryRecord> geomToken_;
const edm::ESGetToken<cms::DDCompactView, IdealGeometryRecord> geomToken_;
};

TrackerParametersESProducer::TrackerParametersESProducer(const edm::ParameterSet&) {
TrackerParametersESProducer::TrackerParametersESProducer(const edm::ParameterSet&)
: geomToken_(setWhatProduced(this).consumes()) {
edm::LogInfo("TRACKER") << "TrackerParametersESProducer::TrackerParametersESProducer";

setWhatProduced(this).setConsumes(geomToken_);
}

TrackerParametersESProducer::~TrackerParametersESProducer() {}
Expand Down

0 comments on commit af81ead

Please sign in to comment.