From 27e1a852f0e6d4352b67128100a4f9885e603fef Mon Sep 17 00:00:00 2001 From: Sunanda Date: Thu, 9 Jul 2020 20:05:37 +0200 Subject: [PATCH 1/3] Fix error reported from static analyzer --- Geometry/HGCalCommonData/src/HGCalDDDConstants.cc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Geometry/HGCalCommonData/src/HGCalDDDConstants.cc b/Geometry/HGCalCommonData/src/HGCalDDDConstants.cc index 4885c699d55ff..20bf2d15083bf 100644 --- a/Geometry/HGCalCommonData/src/HGCalDDDConstants.cc +++ b/Geometry/HGCalCommonData/src/HGCalDDDConstants.cc @@ -1315,16 +1315,19 @@ std::pair HGCalDDDConstants::waferTypeRotation( int layer, int waferU, int waferV, bool fromFile, bool debug) const { int type(HGCalTypes::WaferOut), rotn(0); int wl = HGCalWaferIndex::waferIndex(layer, waferU, waferV); + bool endOfList(true); if (fromFile && (waferFileSize() > 0)) { auto itr = hgpar_->waferInfoMap_.find(wl); - if (itr != hgpar_->waferInfoMap_.end()) { + endOfList = (itr != hgpar_->waferInfoMap_.end()); + if (endOfList) { type = (itr->second).part; rotn = (itr->second).orient; } } else { auto itr = hgpar_->waferTypes_.find(wl); if ((mode_ == HGCalGeometryMode::Hexagon8) || (mode_ == HGCalGeometryMode::Hexagon8Full)) { - if (itr != hgpar_->waferTypes_.end()) { + endOfList = (itr != hgpar_->waferTypes_.end()); + if (endOfList) { if ((itr->second).second < HGCalWaferMask::k_OffsetRotation) { rotn = (itr->second).second; if ((itr->second).first == HGCalGeomTools::k_allCorners) { @@ -1346,8 +1349,8 @@ std::pair HGCalDDDConstants::waferTypeRotation( #ifdef EDM_ML_DEBUG if (debug) edm::LogVerbatim("HGCalGeom") << "waferTypeRotation: Layer " << layer << " Wafer " << waferU << ":" << waferV - << " Index " << std::hex << wl << std::dec << ":" - << (itr != hgpar_->waferTypes_.end()) << " Type " << type << " Rotation " << rotn; + << " Index " << std::hex << wl << std::dec << ":" << endOfList << " Type " << type + << " Rotation " << rotn; #endif return std::make_pair(type, rotn); } From 66c629a1cca65a429e94fde47d47784b47faba54 Mon Sep 17 00:00:00 2001 From: Sunanda Date: Thu, 9 Jul 2020 20:34:45 +0200 Subject: [PATCH 2/3] Code check --- Geometry/HGCalCommonData/src/HGCalDDDConstants.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Geometry/HGCalCommonData/src/HGCalDDDConstants.cc b/Geometry/HGCalCommonData/src/HGCalDDDConstants.cc index 20bf2d15083bf..4eb97c2228ce8 100644 --- a/Geometry/HGCalCommonData/src/HGCalDDDConstants.cc +++ b/Geometry/HGCalCommonData/src/HGCalDDDConstants.cc @@ -1350,7 +1350,7 @@ std::pair HGCalDDDConstants::waferTypeRotation( if (debug) edm::LogVerbatim("HGCalGeom") << "waferTypeRotation: Layer " << layer << " Wafer " << waferU << ":" << waferV << " Index " << std::hex << wl << std::dec << ":" << endOfList << " Type " << type - << " Rotation " << rotn; + << " Rotation " << rotn; #endif return std::make_pair(type, rotn); } From aad2eae44e5a6fa5b1b558606006c64bf5f3f75a Mon Sep 17 00:00:00 2001 From: Sunanda Date: Thu, 9 Jul 2020 23:56:40 +0200 Subject: [PATCH 3/3] change Name of Variable --- Geometry/HGCalCommonData/src/HGCalDDDConstants.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Geometry/HGCalCommonData/src/HGCalDDDConstants.cc b/Geometry/HGCalCommonData/src/HGCalDDDConstants.cc index 4eb97c2228ce8..808af3af8fd03 100644 --- a/Geometry/HGCalCommonData/src/HGCalDDDConstants.cc +++ b/Geometry/HGCalCommonData/src/HGCalDDDConstants.cc @@ -1315,19 +1315,19 @@ std::pair HGCalDDDConstants::waferTypeRotation( int layer, int waferU, int waferV, bool fromFile, bool debug) const { int type(HGCalTypes::WaferOut), rotn(0); int wl = HGCalWaferIndex::waferIndex(layer, waferU, waferV); - bool endOfList(true); + bool withinList(true); if (fromFile && (waferFileSize() > 0)) { auto itr = hgpar_->waferInfoMap_.find(wl); - endOfList = (itr != hgpar_->waferInfoMap_.end()); - if (endOfList) { + withinList = (itr != hgpar_->waferInfoMap_.end()); + if (withinList) { type = (itr->second).part; rotn = (itr->second).orient; } } else { auto itr = hgpar_->waferTypes_.find(wl); if ((mode_ == HGCalGeometryMode::Hexagon8) || (mode_ == HGCalGeometryMode::Hexagon8Full)) { - endOfList = (itr != hgpar_->waferTypes_.end()); - if (endOfList) { + withinList = (itr != hgpar_->waferTypes_.end()); + if (withinList) { if ((itr->second).second < HGCalWaferMask::k_OffsetRotation) { rotn = (itr->second).second; if ((itr->second).first == HGCalGeomTools::k_allCorners) { @@ -1349,7 +1349,7 @@ std::pair HGCalDDDConstants::waferTypeRotation( #ifdef EDM_ML_DEBUG if (debug) edm::LogVerbatim("HGCalGeom") << "waferTypeRotation: Layer " << layer << " Wafer " << waferU << ":" << waferV - << " Index " << std::hex << wl << std::dec << ":" << endOfList << " Type " << type + << " Index " << std::hex << wl << std::dec << ":" << withinList << " Type " << type << " Rotation " << rotn; #endif return std::make_pair(type, rotn);