Skip to content
Merged
17 changes: 17 additions & 0 deletions offline/packages/trackbase/ActsTrackFittingAlgorithm.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,23 @@ namespace Acts
{
class TrackingGeometry;
}
struct MaterialSurfaceSelector
{
std::vector<const Acts::Surface*> surfaces = {};

/// @param surface is the test surface
void operator()(const Acts::Surface* surface)
{
if (surface->surfaceMaterial() != nullptr)
{
if (std::find(surfaces.begin(), surfaces.end(), surface) ==
surfaces.end())
{
surfaces.push_back(surface);
}
}
}
};
Comment on lines +30 to +46

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Confirm <algorithm> is not directly included and std::find is the only dependency on it.
fd -e h -e hpp 'ActsTrackFittingAlgorithm' --exec sh -c '
  echo "== {} ==";
  grep -nE "`#include` <algorithm>" "{}" || echo "NO direct <algorithm> include";
  grep -nE "std::(find|sort|count|copy|transform)\b" "{}"
'

Repository: sPHENIX-Collaboration/coresoftware

Length of output: 242


Add #include <algorithm> for std::find in MaterialSurfaceSelector

offline/packages/trackbase/ActsTrackFittingAlgorithm.h uses std::find(...) in MaterialSurfaceSelector::operator() but doesn’t include <algorithm>, so it’s relying on transitive includes.

🛠️ Proposed fix
 `#include` <functional>
 `#include` <memory>
 `#include` <vector>
+#include <algorithm>


class ActsTrackFittingAlgorithm final
{
Expand Down
17 changes: 0 additions & 17 deletions offline/packages/trackreco/PHActsTrkFitter.h
Original file line number Diff line number Diff line change
Expand Up @@ -295,23 +295,6 @@ class PHActsTrkFitter : public SubsysReco

std::vector<const Acts::Surface*> m_materialSurfaces = {};

struct MaterialSurfaceSelector
{
std::vector<const Acts::Surface*> surfaces = {};

/// @param surface is the test surface
void operator()(const Acts::Surface* surface)
{
if (surface->surfaceMaterial() != nullptr)
{
if (std::find(surfaces.begin(), surfaces.end(), surface) ==
surfaces.end())
{
surfaces.push_back(surface);
}
}
}
};
};

#endif
Loading