35{
37
38
39 if(clean_trigger.size() > 3 && clean_trigger.rfind("L1_", 0) == 0) {
40 clean_trigger = "L1" + clean_trigger.substr(3);
41 }
42
43 std::vector<std::string> sections;
44 for (
auto&& subrange : std::views::split(
m_trigger,
'_')) sections.emplace_back(subrange.begin(), subrange.end());
45
46 std::regex tau_rgx("^(\\d*)tau(\\d+)$");
47 std::regex elec_rgx("^(\\d*)e(\\d+)$");
48 std::regex muon_rgx("^(\\d*)mu(\\d+)$");
49 std::regex gamma_rgx("^(\\d*)g(\\d+)$");
50 std::regex jet_rgx("^(\\d*)j(\\d+)$");
51 std::regex met_rgx("^xe(\\d+)$");
52 std::regex noalg_rgx("^noalg$");
53 std::regex l1_rgx("^L1.*$");
54 std::regex l1_tau_rgx("(\\d*)(e|j|c|)TAU(\\d+)(L|M|T|HL|HM|HT|H|IM|I|)");
55 std::regex l1_toposeparate_rgx("^(\\d{0,2})(DETA|DPHI)(\\d{0,2})$");
56 std::regex topo_rgx("^.*(invm|dR|deta|dphi)AB.*$");
57 std::regex ditauomni_rgx("^ditauOmni(\\d)+Trk(\\d)+$");
58 std::vector<std::regex*> all_regexes = {&tau_rgx, &elec_rgx, &muon_rgx, &gamma_rgx, &jet_rgx, &met_rgx, &l1_rgx, &ditauomni_rgx};
59
60 std::regex tau_type_rgx("^(ptonly|tracktwoMVA|tracktwoMVABDT|tracktwoLLP|trackLRT)$");
61 std::regex tau_ID_rgx("^(idperf|noperf|perfcore|perfiso|perf|veryloose.*|loose.*|medium.*|tight.*)$");
62
64 std::regex_token_iterator<std::string::iterator> rend;
65
66
67 std::vector<std::string>
leg;
68 for(
size_t i = 0;
i < sections.size();
i++) {
69 leg.push_back(sections[i]);
70
71 if(i == sections.size() - 1 || (std::any_of(all_regexes.begin(), all_regexes.end(), [§ions, i](const std::regex* rgx) { return std::regex_match(sections[i+1], *rgx); }))) {
72
73 if(std::regex_match(leg[0],
match, tau_rgx)) {
74 size_t multiplicity =
match[1].str() ==
"" ? 1 : std::stoi(
match[1].
str());
76
77
78 auto itr = find_if(
leg.begin(),
leg.end(), [tau_type_rgx](
const std::string& s) { return std::regex_match(s, tau_type_rgx); });
79 std::string
type = itr !=
leg.end() ? *itr :
"tracktwoMVA";
80
81
82 itr = find_if(
leg.begin(),
leg.end(), [tau_ID_rgx](
const std::string& s) { return std::regex_match(s, tau_ID_rgx); });
83 std::string tau_id = itr !=
leg.end() ? *itr :
"";
84 if(tau_id.starts_with("veryloose")) tau_id = tau_id.substr(9);
85 else if(tau_id.starts_with("loose")) tau_id = tau_id.substr(5);
86 else if(tau_id.starts_with("medium")) tau_id = tau_id.substr(6);
87 else if(tau_id.starts_with("tight")) tau_id = tau_id.substr(5);
88
89
90 if(tau_id.starts_with("var")) {
92
93
94 while(i < tau_id.size() && std::isdigit(
static_cast<unsigned char>(tau_id[i])))
i++;
95
96 tau_id = tau_id.substr(i);
97 }
98
99
100 if(tau_id.starts_with("pc")) tau_id = tau_id.substr(2);
101 else if(tau_id.starts_with("pi")) tau_id = tau_id.substr(2);
102 else if(tau_id.starts_with("np")) tau_id = tau_id.substr(2);
103
104
105 if(tau_id == "RNN") {
106 if(type == "tracktwoMVA") tau_id = "DeepSet";
107 if(type == "tracktwoLLP" || type == "trackLRT") tau_id = "RNNLLP";
108 }
109
110
111 if(tau_id == "DS") tau_id = "DeepSet";
112 else if(tau_id == "GNT") tau_id = "GNTau";
113
114 for(
size_t j = 0;
j < multiplicity;
j++) {
118 }
119 }
else if(std::regex_match(leg[0],
match, elec_rgx)) {
120 size_t multiplicity =
match[1].str() ==
"" ? 1 : std::stoi(
match[1].
str());
122 for(
size_t j = 0;
j < multiplicity;
j++)
m_HLTElecThr.push_back(threshold);
123 }
else if(std::regex_match(leg[0],
match, muon_rgx)) {
124 size_t multiplicity =
match[1].str() ==
"" ? 1 : std::stoi(
match[1].
str());
126 for(
size_t j = 0;
j < multiplicity;
j++)
m_HLTMuonThr.push_back(threshold);
127 }
else if(std::regex_match(leg[0],
match, gamma_rgx)) {
128 size_t multiplicity =
match[1].str() ==
"" ? 1 : std::stoi(
match[1].
str());
130 for(
size_t j = 0;
j < multiplicity;
j++)
m_HLTGammaThr.push_back(threshold);
131 }
else if(std::regex_match(leg[0],
match, jet_rgx)) {
132 size_t multiplicity =
match[1].str() ==
"" ? 1 : std::stoi(
match[1].
str());
134 for(
size_t j = 0;
j < multiplicity;
j++)
m_HLTJetThr.push_back(threshold);
135 }
else if(std::regex_match(leg[0],
match, met_rgx)) {
138 }
else if(std::regex_match(leg[0],
match, noalg_rgx)) {
140 }
else if (std::regex_match(leg[0],
match, ditauomni_rgx)) {
142 } else if(std::regex_match(leg[0], l1_rgx)){
143 for(
size_t j = 0;
j <
leg.size();
j++) {
144 if(std::regex_match(leg[j], topo_rgx)) continue;
145
146
147 if(leg[j].
find(
'-') != std::string::npos || std::regex_match(leg[j], l1_toposeparate_rgx)) {
148
149
150 if(leg[0] ==
"L1TAU60" && leg[j] ==
"DR-TAU12ITAU12I")
leg[
j] =
"TAU12IM";
151 else if(
leg.size() == 1 && (leg[0] ==
"L1DR-TAU20ITAU12I" || leg[0] ==
"L1DR-TAU20ITAU12I-J25")) {
152
153 leg[0] =
"L1TAU20IM";
154 leg.push_back(
"TAU12IM");
155
156 }
157 else continue;
158 }
159
160 m_L1Items.push_back(j == 0 ? leg[j].substr(2, leg[j].size()) : leg[j]);
161 }
162 }
163
164
166 }
167 }
168
170
173
174
175 std::regex_token_iterator<std::string::iterator> rgx_iter(
m_L1Item.begin(),
m_L1Item.end(), l1_tau_rgx);
176 while(rgx_iter != rend) {
177 const std::string &
s = *rgx_iter;
178 if (std::regex_match(s,
match, l1_tau_rgx)){
179 size_t multiplicity =
match[1].str() ==
"" ? 1 : std::stoi(
match[1].
str());
180 std::string item_type =
match[2].str();
182 std::string item_isolation =
match[4].str();
183
184
185 if(remove_L1_phase1_thresholds && (item_type ==
"e" || item_type ==
"j" || item_type ==
"c"))
threshold = -1;
186
187 for(
size_t j = 0;
j < multiplicity;
j++) {
193 }
194 }
195 rgx_iter++;
196 }
197
199 }
200}
std::string find(const std::string &s)
return a remapped string
bool match(std::string s1, std::string s2)
match the individual directories of two strings
float j(const xAOD::IParticle &, const xAOD::TrackMeasurementValidation &hit, const Eigen::Matrix3d &jab_inv)