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

Phase2-hgx253 Fix error reported from static analyzer #30623

Merged
merged 3 commits into from
Jul 11, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fix error reported from static analyzer
  • Loading branch information
Sunanda committed Jul 9, 2020
commit 27e1a852f0e6d4352b67128100a4f9885e603fef
11 changes: 7 additions & 4 deletions Geometry/HGCalCommonData/src/HGCalDDDConstants.cc
Original file line number Diff line number Diff line change
@@ -1315,16 +1315,19 @@ std::pair<int, int> 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());
Copy link
Contributor

Choose a reason for hiding this comment

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

Am I reading this line correctly? endOfList is true if the end of the list has NOT been reached? Isn't that backwards? Am I missing something?

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<int, int> 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);
}