37def MapKeysDict(target_version):
38
39
40
41
42
43 with open(find_datafile('TrigGlobalEfficiencyCorrection/MapKeys.cfg'), 'r') as file:
44 file_content = file.read()
45
46
47 lines = file_content.strip().
split(
'\n')
48
49
50 trigger_dict = {}
51
52
53 current_version = None
54 in_target_version = False
55
56 for line in lines:
57
58 line = line.strip()
59
60
61 if not line or line.startswith('#'):
62 continue
63
64
65 if line.startswith("[VERSION]"):
66 current_version = line.replace(
"[VERSION]",
"").
strip()
67 in_target_version = target_version in current_version
68 continue
69
70
71 if in_target_version:
72 parts = line.split()
73 if len(parts) < 3:
74 continue
75 key = f"{parts[0]}_{parts[1]}"
76 values = parts[2:]
77 trigger_dict[key] = values
78
79 return trigger_dict
std::vector< std::string > split(const std::string &s, const std::string &t=":")