19 return !
best(code,
weight) ? -999 : code.second;
28 for (
auto& rval_truth : rval.
m_truth) {
29 m_truth[rval_truth.first] += rval_truth.second;
52 if (rval.
m_truth.empty())
return;
56 Barcode maxweight_barcode(-1l, -1l);
57 for (
const auto & rval_truth : rval.
m_truth)
59 if (rval_truth.second > maxweight)
61 maxweight = rval_truth.second;
62 maxweight_barcode = rval_truth.first;
66 maximize(maxweight_barcode, maxweight);
76 size_t count = std::count_if(mt.
begin(), mt.
end(), [](
auto){return true;});
77 o <<
"FPGATrackSimMultiTruth (event index,barcode) <=> weight, entries: " <<
count <<
"\n";
79 if (
count == 0)
return o;
81 for (
auto& truth : mt)
82 o <<
" " << (truth.first).first <<
"," << (truth.first).second <<
" <=> " << truth.second <<
"\n";
89 if (!mt.
best(code, weight)) o <<
"N/A\n";
90 else o << code.first <<
"," << code.second <<
" " << weight <<
"\n";
std::ostream & operator<<(std::ostream &o, const FPGATrackSimMultiTruth &mt)
void add(const FPGATrackSimMultiTruth::Barcode &code, const FPGATrackSimMultiTruth::Weight &weight)
FPGATrackSimMultiTruth()=default
void maximize(const FPGATrackSimMultiTruth::Barcode &code, const FPGATrackSimMultiTruth::Weight &weight)
bool best(FPGATrackSimMultiTruth::Barcode &code, FPGATrackSimMultiTruth::Weight &weight) const
void assign_equal_normalization()
std::pair< unsigned long, unsigned long > Barcode
unsigned long best_barcode() const
FPGATrackSimMultiTruth::Weight weight(const FPGATrackSimMultiTruth::Barcode &code) const
int count(std::string s, const std::string ®x)
count how many occurances of a regx are in a string