Skip to content

Commit

Permalink
clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaminhuth committed Oct 6, 2023
1 parent ef11bbe commit e32ce2d
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ class TrackFindingAlgorithm final : public IAlgorithm {

mutable std::atomic<size_t> m_nTotalSeeds{0};
mutable std::atomic<size_t> m_nFailedSeeds{0};

mutable std::mutex m_mutex;
mutable std::vector<unsigned> m_nTracksPerSeeds;
mutable std::vector<unsigned> m_nSelTracksPerSeeds;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class TrackFindingFromPrototrackAlgorithm final : public IAlgorithm {

/// Magnetic field
std::shared_ptr<const Acts::MagneticFieldProvider> magneticField;

/// Additional tag to distinguish loggers
std::string tag = "";
};
Expand All @@ -79,14 +79,14 @@ class TrackFindingFromPrototrackAlgorithm final : public IAlgorithm {
/// @return a process code to steer the algorithm flow
ActsExamples::ProcessCode execute(
const ActsExamples::AlgorithmContext& ctx) const final;

ActsExamples::ProcessCode finalize() override;

const Config& config() const { return m_cfg; }

private:
Config m_cfg;

mutable std::mutex m_mutex;
mutable std::vector<unsigned> m_nTracksPerSeeds;

Expand Down
19 changes: 12 additions & 7 deletions Examples/Algorithms/TrackFinding/src/TrackFindingAlgorithm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,19 +218,24 @@ ActsExamples::ProcessCode ActsExamples::TrackFindingAlgorithm::finalize() {
ACTS_INFO("- failed seeds: " << m_nFailedSeeds);
ACTS_INFO("- failure ratio: " << static_cast<double>(m_nFailedSeeds) /
m_nTotalSeeds);

namespace ba = boost::accumulators;
using Accumulator = ba::accumulator_set<float, ba::features< ba::tag::sum, ba::tag::mean, ba::tag::variance > >;

using Accumulator = ba::accumulator_set<
float, ba::features<ba::tag::sum, ba::tag::mean, ba::tag::variance>>;

Accumulator totalAcc;
std::for_each(m_nTracksPerSeeds.begin(), m_nTracksPerSeeds.end(), [&](auto v){ totalAcc(static_cast<float>(v)); });
std::for_each(m_nTracksPerSeeds.begin(), m_nTracksPerSeeds.end(),
[&](auto v) { totalAcc(static_cast<float>(v)); });
ACTS_INFO("- total number tracks: " << ba::sum(totalAcc));
ACTS_INFO("- avg tracks per seed: " << ba::mean(totalAcc) << " +- " << std::sqrt(ba::variance(totalAcc)));
ACTS_INFO("- avg tracks per seed: " << ba::mean(totalAcc) << " +- "
<< std::sqrt(ba::variance(totalAcc)));

Accumulator selAcc;
std::for_each(m_nSelTracksPerSeeds.begin(), m_nSelTracksPerSeeds.end(), [&](auto v){ selAcc(static_cast<float>(v)); });
std::for_each(m_nSelTracksPerSeeds.begin(), m_nSelTracksPerSeeds.end(),
[&](auto v) { selAcc(static_cast<float>(v)); });
ACTS_INFO("- total number tracks (selected only): " << ba::sum(selAcc));
ACTS_INFO("- avg tracks per seed (selected only): " << ba::mean(selAcc) << " +- " << std::sqrt(ba::variance(selAcc)));
ACTS_INFO("- avg tracks per seed (selected only): "
<< ba::mean(selAcc) << " +- " << std::sqrt(ba::variance(selAcc)));

// Memory statistics
auto memoryStatistics =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ ActsExamples::ProcessCode TrackFindingFromPrototrackAlgorithm::execute(

std::size_t nSeed = 0;
std::size_t nFailed = 0;

std::vector<std::size_t> nTracksPerSeeds;
nTracksPerSeeds.reserve(initialParameters.size());

Expand Down Expand Up @@ -160,12 +160,12 @@ ActsExamples::ProcessCode TrackFindingFromPrototrackAlgorithm::execute(
auto& tracksForSeed = result.value();

nTracksPerSeeds.push_back(tracksForSeed.size());

for (auto& track : tracksForSeed) {
seedNumber(track) = nSeed;
}
}

{
std::lock_guard<std::mutex> guard(m_mutex);

Expand Down Expand Up @@ -198,16 +198,19 @@ ActsExamples::ProcessCode TrackFindingFromPrototrackAlgorithm::execute(

ActsExamples::ProcessCode TrackFindingFromPrototrackAlgorithm::finalize() {
assert(std::distance(m_nTracksPerSeeds.begin(), m_nTracksPerSeeds.end()) > 0);

ACTS_INFO("TrackFindingFromPrototracksAlgorithm statistics:");
namespace ba = boost::accumulators;
using Accumulator = ba::accumulator_set<float, ba::features< ba::tag::sum, ba::tag::mean, ba::tag::variance > >;

using Accumulator = ba::accumulator_set<
float, ba::features<ba::tag::sum, ba::tag::mean, ba::tag::variance>>;

Accumulator totalAcc;
std::for_each(m_nTracksPerSeeds.begin(), m_nTracksPerSeeds.end(), [&](auto v){ totalAcc(static_cast<float>(v)); });
std::for_each(m_nTracksPerSeeds.begin(), m_nTracksPerSeeds.end(),
[&](auto v) { totalAcc(static_cast<float>(v)); });
ACTS_INFO("- total number tracks: " << ba::sum(totalAcc));
ACTS_INFO("- avg tracks per seed: " << ba::mean(totalAcc) << " +- " << std::sqrt(ba::variance(totalAcc)));

ACTS_INFO("- avg tracks per seed: " << ba::mean(totalAcc) << " +- "
<< std::sqrt(ba::variance(totalAcc)));

return {};
}

Expand Down
10 changes: 5 additions & 5 deletions Plugins/ExaTrkX/src/BoostTrackBuilding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@ std::vector<std::vector<int>> BoostTrackBuilding::operator()(
};

using Graph =
boost::adjacency_list<boost::vecS, // edge list
boost::vecS, // vertex list
boost::undirectedS, // directedness
boost::no_property, // property of vertices
EdgeProperty // property of edges
boost::adjacency_list<boost::vecS, // edge list
boost::vecS, // vertex list
boost::undirectedS, // directedness
boost::no_property, // property of vertices
EdgeProperty // property of edges
>;

Graph g(numSpacepoints);
Expand Down

0 comments on commit e32ce2d

Please sign in to comment.