Skip to content

Commit

Permalink
Merge pull request #46255 from iarspider/iarspider-llvman-fastsim
Browse files Browse the repository at this point in the history
[LLVM Analyzer][FastSim] Cleanup dead assignments reported by llvm analyzer
  • Loading branch information
cmsbuild authored Oct 28, 2024
2 parents 6a819df + e0e61b1 commit 52219c0
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 22 deletions.
33 changes: 14 additions & 19 deletions FastSimulation/CTPPSFastGeometry/src/CTPPSToFDetector.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "FastSimulation/CTPPSFastGeometry/interface/CTPPSToFDetector.h"
#include <algorithm>
#include <cmath>

CTPPSToFDetector::CTPPSToFDetector(
Expand Down Expand Up @@ -81,27 +82,21 @@ void CTPPSToFDetector::AddHit(double x, double y, double tof) {
nADC_[cellid].push_back(1);
}
int CTPPSToFDetector::findCellId(double x, double y) {
int y_idx, x_idx;
// first, get the row number
unsigned int i;
unsigned int start_idx = 0;
unsigned int end_idx = cellRow_.size();
for (i = 0; i < cellRow_.size(); i++) {
if (y >= cellRow_.at(i).first && y <= cellRow_.at(i).second)
break;
}
if (i >= cellRow_.size())
auto it = std::find_if(
cellRow_.begin(), cellRow_.end(), [y](const auto& cell) { return y >= cell.first && y <= cell.second; });

if (it == cellRow_.end())
return 0;
y_idx = i + 1;
start_idx = 0;
end_idx = cellColumn_.size();
for (i = start_idx; i < end_idx; i++) {
if (x <= cellColumn_.at(i).first && x > cellColumn_.at(i).second)
break;
}
if (i >= end_idx)

unsigned int y_idx = std::distance(cellRow_.begin(), it) + 1;

it = std::find_if(
cellColumn_.begin(), cellColumn_.end(), [x](const auto& cell) { return x <= cell.first && x > cell.second; });

if (it == cellColumn_.end())
return 0;
x_idx = i + 1 - start_idx;

unsigned int x_idx = std::distance(cellColumn_.begin(), it) + 1;
return 100 * y_idx + x_idx;
}
bool CTPPSToFDetector::get_CellCenter(int cell_id, double& x, double& y) {
Expand Down
2 changes: 1 addition & 1 deletion FastSimulation/CaloGeometryTools/src/CrystalWindowMap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ bool CrystalWindowMap::getCrystalWindow(unsigned iq, std::vector<unsigned>& cw)
bool CrystalWindowMap::getCrystalWindow(unsigned iq, const std::vector<unsigned>* cw) const {
if (iq < size_) // iq >= 0, since iq is unsigned
{
cw = &myNeighbours_[iq];
[[clang::suppress]] cw = &(myNeighbours_[iq]);
return true;
} else
return false;
Expand Down
1 change: 0 additions & 1 deletion FastSimulation/ShowerDevelopment/src/HDShower.cc
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,6 @@ void HDShower::makeSteps(int nsteps) {
if (est < 0.) {
LogInfo("FastCalorimetry") << "*** FamosHDShower::makeSteps "
<< " - negative step energy !!!" << std::endl;
est = 0.;
break;
}

Expand Down
1 change: 0 additions & 1 deletion FastSimulation/ShowerDevelopment/src/HFShower.cc
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,6 @@ void HFShower::makeSteps(int nsteps) {
if (est < 0.) {
LogDebug("FastCalorimetry") << "*** FamosHFShower::makeSteps "
<< " - negative step energy !!!" << std::endl;
est = 0.;
break;
}

Expand Down

0 comments on commit 52219c0

Please sign in to comment.