Skip to content

Commit

Permalink
fixup! Test
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenswat committed Mar 21, 2023
1 parent e9b0626 commit 5ad3ab2
Showing 1 changed file with 23 additions and 32 deletions.
55 changes: 23 additions & 32 deletions performance/include/traccc/efficiency/nseed_performance_writer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,31 +21,31 @@

using namespace Acts::UnitLiterals;


namespace traccc {
template<typename IdIt>
std::optional<std::size_t> get_particle_if_uniform(IdIt begin, IdIt end) {
std::set<std::size_t> rem(begin->begin(), begin->end());

for (IdIt i = begin + 1; i != end; ++i) {
std::set<std::size_t> old_rem(rem);
std::multiset<std::size_t> cnt;

for (auto e1 : old_rem) {
auto e2 = std::find(i->cbegin(), i->cend(), e1);
auto e3 = std::find(rem.cbegin(), rem.cend(), e1);
for (IdIt i = begin; i != end; ++i) {
for (std::size_t j : *i) {
cnt.insert(j);
}
}

if (e2 == i->cend()) {
rem.erase(e3);
}
for (std::size_t i : cnt) {
if (cnt.count(i) == 3) {
return {i};
}
}

if (rem.size() > 1) {
std::cout << "Oops??" << std::endl;
} else if (rem.size() == 1) {
return {*rem.cbegin()};
} else {
return {};
for (std::size_t i : cnt) {
if (cnt.count(i) == 2) {
return {i};
}
}

return {};
}

class nseed_performance_writer {
Expand Down Expand Up @@ -89,37 +89,28 @@ class nseed_performance_writer {
return ptc_ids;
});

for (const std::vector<std::size_t> & v : particle_ids) {
std::cout << ev << "," << seed_id;

for (std::size_t q : v) {
std::cout << q << ",";
}

std::cout << std::endl;
}

_stats.total_seeds++;

std::optional<std::size_t> particle_id = get_particle_if_uniform(particle_ids.cbegin(), particle_ids.cend());
std::optional<std::size_t> pid = get_particle_if_uniform(particle_ids.cbegin(), particle_ids.cend());

if (particle_id) {
if (pid) {
_stats.true_seeds++;

matched_tracks.insert(*particle_id);
matched_tracks.insert(*pid);
} else {
_stats.false_seeds++;
}

write_seed_row(ev, seed_id++, s->size(), particle_id);
write_seed_row(ev, seed_id++, s->size(), pid);
}

for (const auto & [pid, ptc] : em.ptc_map) {
if (ptc.charge != 0 && getter::perp(ptc.mom) >= _config.pt_cut) {
const scalar t_eta = eta(ptc.mom);

if (ptc.charge != 0 && getter::perp(ptc.mom) >= _config.pt_cut && std::abs(t_eta) <= 2.7f) {
if (matched_tracks.count(pid) > 0) {
_stats.matched_tracks++;
} else {
std::cout << "Unmatched track " << pid << std::endl;
_stats.unmatched_tracks++;
}

Expand Down

0 comments on commit 5ad3ab2

Please sign in to comment.