From 575e3366b192acbb377a63657158519e9e63f0bc Mon Sep 17 00:00:00 2001 From: Ivan Razumov Date: Sat, 17 Aug 2024 12:44:42 +0200 Subject: [PATCH 1/2] Avoid Wdangling-reference warning in CalibTracker submodules --- CalibTracker/SiStripCommon/plugins/TkDetMapESProducer.cc | 3 ++- .../plugins/fake/SiStripBackPlaneCorrectionFakeESSource.cc | 3 ++- .../plugins/fake/SiStripHashedDetIdFakeESSource.cc | 3 ++- .../plugins/fake/SiStripLorentzAngleFakeESSource.cc | 3 ++- .../SiStripQuality/plugins/SiStripQualityHotStripIdentifier.cc | 3 ++- 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/CalibTracker/SiStripCommon/plugins/TkDetMapESProducer.cc b/CalibTracker/SiStripCommon/plugins/TkDetMapESProducer.cc index 1ac35d6026675..f634d29508a81 100644 --- a/CalibTracker/SiStripCommon/plugins/TkDetMapESProducer.cc +++ b/CalibTracker/SiStripCommon/plugins/TkDetMapESProducer.cc @@ -294,7 +294,8 @@ namespace { } // namespace std::unique_ptr TkDetMapESProducer::produce(const TrackerTopologyRcd& tTopoRcd) { - const auto& geomDet = tTopoRcd.getRecord().get(geomDetToken_); + const auto& geomDetRcd = tTopoRcd.getRecord(); + const auto& geomDet = geomDetRcd.get(geomDetToken_); const auto TkDetIdList = TrackerGeometryUtils::getSiStripDetIds(geomDet); const auto& tTopo = tTopoRcd.get(tTopoToken_); diff --git a/CalibTracker/SiStripESProducers/plugins/fake/SiStripBackPlaneCorrectionFakeESSource.cc b/CalibTracker/SiStripESProducers/plugins/fake/SiStripBackPlaneCorrectionFakeESSource.cc index cef3b4a83774c..cf089d0f24a20 100644 --- a/CalibTracker/SiStripESProducers/plugins/fake/SiStripBackPlaneCorrectionFakeESSource.cc +++ b/CalibTracker/SiStripESProducers/plugins/fake/SiStripBackPlaneCorrectionFakeESSource.cc @@ -65,7 +65,8 @@ SiStripBackPlaneCorrectionFakeESSource::ReturnType SiStripBackPlaneCorrectionFak const SiStripBackPlaneCorrectionRcd& iRecord) { using namespace edm::es; - const auto& geomDet = iRecord.getRecord().get(m_geomDetToken); + const auto& geomDetRcd = iRecord.getRecord(); + const auto& geomDet = geomDetRcd.get(m_geomDetToken); const auto& tTopo = iRecord.get(m_tTopoToken); auto backPlaneCorrection = std::make_unique(); diff --git a/CalibTracker/SiStripESProducers/plugins/fake/SiStripHashedDetIdFakeESSource.cc b/CalibTracker/SiStripESProducers/plugins/fake/SiStripHashedDetIdFakeESSource.cc index a82168bc842d4..39793a014c857 100644 --- a/CalibTracker/SiStripESProducers/plugins/fake/SiStripHashedDetIdFakeESSource.cc +++ b/CalibTracker/SiStripESProducers/plugins/fake/SiStripHashedDetIdFakeESSource.cc @@ -31,7 +31,8 @@ std::unique_ptr SiStripHashedDetIdFakeESSource::produce(cons edm::LogVerbatim("HashedDetId") << "[SiStripHashedDetIdFakeESSource::" << __func__ << "]" << " Building \"fake\" hashed DetId map from IdealGeometry"; - const auto& geomDet = record.getRecord().get(geomDetToken_); + const auto& geomDetRcd = record.getRecord(); + const auto& geomDet = geomDetRcd.get(geomDetToken_); const std::vector dets = TrackerGeometryUtils::getSiStripDetIds(geomDet); edm::LogVerbatim("HashedDetId") << "[SiStripHashedDetIdFakeESSource::" << __func__ << "]" diff --git a/CalibTracker/SiStripESProducers/plugins/fake/SiStripLorentzAngleFakeESSource.cc b/CalibTracker/SiStripESProducers/plugins/fake/SiStripLorentzAngleFakeESSource.cc index 920cf6df72dbd..5c1710758a318 100644 --- a/CalibTracker/SiStripESProducers/plugins/fake/SiStripLorentzAngleFakeESSource.cc +++ b/CalibTracker/SiStripESProducers/plugins/fake/SiStripLorentzAngleFakeESSource.cc @@ -183,7 +183,8 @@ SiStripLorentzAngleFakeESSource::ReturnType SiStripLorentzAngleFakeESSource::pro const SiStripLorentzAngleRcd& iRecord) { using namespace edm::es; - const auto& geomDet = iRecord.getRecord().get(m_geomDetToken); + const auto& geomDetRcd = iRecord.getRecord(); + const auto& geomDet = geomDetRcd.get(m_geomDetToken); const auto& tTopo = iRecord.get(m_tTopoToken); auto lorentzAngle = std::make_unique(); diff --git a/CalibTracker/SiStripQuality/plugins/SiStripQualityHotStripIdentifier.cc b/CalibTracker/SiStripQuality/plugins/SiStripQualityHotStripIdentifier.cc index ebb3c0a177d1f..fdbdcf6b0e27d 100644 --- a/CalibTracker/SiStripQuality/plugins/SiStripQualityHotStripIdentifier.cc +++ b/CalibTracker/SiStripQuality/plugins/SiStripQualityHotStripIdentifier.cc @@ -167,7 +167,8 @@ void SiStripQualityHotStripIdentifier::resetHistos() { void SiStripQualityHotStripIdentifier::bookHistos() { edm::LogInfo("SiStripQualityHotStripIdentifier") << " [SiStripQualityHotStripIdentifier::bookHistos] " << std::endl; char hname[1024]; - for (const auto& it : SiStripDetInfoFileReader::read(fp_.fullPath()).getAllData()) { + const auto info = SiStripDetInfoFileReader::read(fp_.fullPath()); + for (const auto& it : info.getAllData()) { sprintf(hname, "h_%d", it.first); auto ref = ClusterPositionHistoMap.find(it.first); if (ref == ClusterPositionHistoMap.end()) { From a3b77c7291e95d9b9e81f3c928f0b1b64854de0e Mon Sep 17 00:00:00 2001 From: iarspider Date: Sun, 18 Aug 2024 03:37:41 -0700 Subject: [PATCH 2/2] Update CalibTracker/SiStripQuality/plugins/SiStripQualityHotStripIdentifier.cc Co-authored-by: Andrea Perrotta --- .../SiStripQuality/plugins/SiStripQualityHotStripIdentifier.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CalibTracker/SiStripQuality/plugins/SiStripQualityHotStripIdentifier.cc b/CalibTracker/SiStripQuality/plugins/SiStripQualityHotStripIdentifier.cc index fdbdcf6b0e27d..fb9d9c0a0a1ca 100644 --- a/CalibTracker/SiStripQuality/plugins/SiStripQualityHotStripIdentifier.cc +++ b/CalibTracker/SiStripQuality/plugins/SiStripQualityHotStripIdentifier.cc @@ -167,7 +167,7 @@ void SiStripQualityHotStripIdentifier::resetHistos() { void SiStripQualityHotStripIdentifier::bookHistos() { edm::LogInfo("SiStripQualityHotStripIdentifier") << " [SiStripQualityHotStripIdentifier::bookHistos] " << std::endl; char hname[1024]; - const auto info = SiStripDetInfoFileReader::read(fp_.fullPath()); + const SiStripDetInfo& info = SiStripDetInfoFileReader::read(fp_.fullPath()); for (const auto& it : info.getAllData()) { sprintf(hname, "h_%d", it.first); auto ref = ClusterPositionHistoMap.find(it.first);