Skip to content

Commit

Permalink
revert sonarcloud const
Browse files Browse the repository at this point in the history
  • Loading branch information
AJPfleger committed Sep 7, 2024
1 parent 25128d1 commit 9a85f65
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ class ModuleClusters {

std::vector<ModuleValue> createCellCollection();
void merge();
ModuleValue squash(const std::vector<ModuleValue>& values);
ModuleValue squash(std::vector<ModuleValue>& values);
std::vector<std::size_t> nonGeoEntries(
const std::vector<Acts::BoundIndices>& indices);
std::vector<Acts::BoundIndices>& indices);
std::vector<std::vector<ModuleValue>> mergeParameters(
std::vector<ModuleValue> values);
};
Expand Down
15 changes: 8 additions & 7 deletions Examples/Algorithms/Digitization/src/ModuleClusters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,11 @@ void ModuleClusters::merge() {

// ATTN: returns vector of index into `indices'
std::vector<std::size_t> ModuleClusters::nonGeoEntries(
const std::vector<Acts::BoundIndices>& indices) {
std::vector<Acts::BoundIndices>& indices) {
std::vector<std::size_t> retv;
for (std::size_t i = 0; i < indices.size(); i++) {
if (!rangeContainsValue(m_geoIndices, indices.at(i))) {
auto idx = indices.at(i);
if (!rangeContainsValue(m_geoIndices, idx)) {
retv.push_back(i);
}
}
Expand Down Expand Up @@ -222,14 +223,14 @@ std::vector<std::vector<ModuleValue>> ModuleClusters::mergeParameters(
return retv;
}

ModuleValue ModuleClusters::squash(const std::vector<ModuleValue>& values) {
ModuleValue ModuleClusters::squash(std::vector<ModuleValue>& values) {
ModuleValue mval;
Acts::ActsScalar tot = 0;
Acts::ActsScalar tot2 = 0;
std::vector<Acts::ActsScalar> weights;

// First, start by computing cell weights
for (const ModuleValue& other : values) {
for (ModuleValue& other : values) {
if (std::holds_alternative<Cluster::Cell>(other.value)) {
weights.push_back(std::get<Cluster::Cell>(other.value).activation);
} else {
Expand All @@ -241,7 +242,7 @@ ModuleValue ModuleClusters::squash(const std::vector<ModuleValue>& values) {

// Now, go over the non-geometric indices
for (std::size_t i = 0; i < values.size(); i++) {
const ModuleValue& other = values.at(i);
ModuleValue& other = values.at(i);
for (std::size_t j = 0; j < other.paramIndices.size(); j++) {
auto idx = other.paramIndices.at(j);
if (!rangeContainsValue(m_geoIndices, idx)) {
Expand Down Expand Up @@ -274,7 +275,7 @@ ModuleValue ModuleClusters::squash(const std::vector<ModuleValue>& values) {
std::size_t b1max = 0;

for (std::size_t i = 0; i < values.size(); i++) {
const ModuleValue& other = values.at(i);
ModuleValue& other = values.at(i);
if (!std::holds_alternative<Cluster::Cell>(other.value)) {
continue;
}
Expand Down Expand Up @@ -324,7 +325,7 @@ ModuleValue ModuleClusters::squash(const std::vector<ModuleValue>& values) {
mval.value = std::move(clus);

// Finally do the hit association
for (const ModuleValue& other : values) {
for (ModuleValue& other : values) {
mval.sources.merge(other.sources);
}

Expand Down

0 comments on commit 9a85f65

Please sign in to comment.