diff --git a/Hlt/Hlt1Conf/tests/options/test_allen_decreports.py b/Hlt/Hlt1Conf/tests/options/test_allen_decreports.py index 48798c538190bff85989846bc9767358c6e2680a..251072279c5191f02b4093905200d01d2a853458 100644 --- a/Hlt/Hlt1Conf/tests/options/test_allen_decreports.py +++ b/Hlt/Hlt1Conf/tests/options/test_allen_decreports.py @@ -17,6 +17,7 @@ between the two is considered a failure. The options dump is used to configure the HltANNSvc for the job ran by this script. """ from __future__ import print_function +import re import argparse from collections import defaultdict from Configurables import (ApplicationMgr, HistogramPersistencySvc, @@ -29,19 +30,17 @@ from Moore.config import setup_ann_service, get_allen_hlt1_decision_ids def get_counts_from_log(f): """Return the decisions of each line as extracted from a log file.""" + logre = re.compile( + r' \|\*"Selected by (Hlt1.*Decision)"\s*\|\s*(\d+) \|\s*(\d+) \|') counts = {} with open(f) as f: - for line in (l for l in f if "Selected by" in l): - columns = line.split() - hlt_line = columns[2].replace('"', '') - count = int(columns[6]) - counts[hlt_line] = count - f.seek(0) - for line in (l for l in f if "LAZY_AND: allen" in l): - columns = line.split() - hlt_line = columns[1] - count = int(columns[3].replace("Sum=", "")) - counts[hlt_line] = count + for line in f: + m = re.match(logre, line) + if m: + hlt_line = m.group(1) + count = int(m.group(3)) + counts[hlt_line] = count + return counts