38 if(clean_trigger.size() > 3 && clean_trigger.rfind(
"L1_", 0) == 0) {
39 clean_trigger =
"L1" + clean_trigger.substr(3);
42 std::vector<std::string> sections;
43 for (
auto&& subrange : std::views::split(
m_trigger,
'_')) sections.emplace_back(subrange.begin(), subrange.end());
45 std::regex tau_rgx(
"^(\\d*)tau(\\d+)$");
46 std::regex elec_rgx(
"^(\\d*)e(\\d+)$");
47 std::regex muon_rgx(
"^(\\d*)mu(\\d+)$");
48 std::regex gamma_rgx(
"^(\\d*)g(\\d+)$");
49 std::regex jet_rgx(
"^(\\d*)j(\\d+)$");
50 std::regex met_rgx(
"^xe(\\d+)$");
51 std::regex noalg_rgx(
"^noalg$");
52 std::regex l1_rgx(
"^L1.*$");
53 std::regex l1_tau_rgx(
"(\\d*)(e|j|c|)TAU(\\d+)(L|M|T|HL|HM|HT|H|IM|I|)");
54 std::regex l1_toposeparate_rgx(
"^(\\d{0,2})(DETA|DPHI)(\\d{0,2})$");
55 std::regex topo_rgx(
"^.*(invm|dR|deta|dphi)AB.*$");
56 std::regex ditauomni_rgx(
"^ditauOmni(\\d)+Trk(\\d)+$");
57 std::vector<std::regex*> all_regexes = {&tau_rgx, &elec_rgx, &muon_rgx, &gamma_rgx, &jet_rgx, &met_rgx, &l1_rgx, &ditauomni_rgx};
59 std::regex tau_type_rgx(
"^(ptonly|tracktwoMVA|tracktwoMVABDT|tracktwoLLP|trackLRT)$");
60 std::regex tau_ID_rgx(
"^(perf|idperf|veryloose.*|loose.*|medium.*|tight.*)$");
63 std::regex_token_iterator<std::string::iterator> rend;
66 std::vector<std::string> leg;
67 for(
size_t i = 0; i < sections.size(); i++) {
68 leg.push_back(sections[i]);
70 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 if(std::regex_match(leg[0],
match, tau_rgx)) {
73 size_t multiplicity =
match[1].str() ==
"" ? 1 : std::stoi(
match[1].
str());
77 auto itr = find_if(leg.begin(), leg.end(), [tau_type_rgx](
const std::string& s) { return std::regex_match(s, tau_type_rgx); });
78 std::string
type = itr != leg.end() ? *itr :
"tracktwoMVA";
81 itr = find_if(leg.begin(), leg.end(), [tau_ID_rgx](
const std::string& s) { return std::regex_match(s, tau_ID_rgx); });
82 std::string tau_id = itr != leg.end() ? *itr :
"";
83 if(tau_id.starts_with(
"veryloose")) tau_id = tau_id.substr(9);
84 else if(tau_id.starts_with(
"loose")) tau_id = tau_id.substr(5);
85 else if(tau_id.starts_with(
"medium")) tau_id = tau_id.substr(6);
86 else if(tau_id.starts_with(
"tight")) tau_id = tau_id.substr(5);
90 if(
type ==
"tracktwoMVA") tau_id =
"DeepSet";
91 if(
type ==
"tracktwoLLP" ||
type ==
"trackLRT") tau_id =
"RNNLLP";
95 if(tau_id ==
"DS") tau_id =
"DeepSet";
96 else if(tau_id ==
"GNT") tau_id =
"GNTau";
98 for(
size_t j = 0; j < multiplicity; j++) {
103 }
else if(std::regex_match(leg[0],
match, elec_rgx)) {
104 size_t multiplicity =
match[1].str() ==
"" ? 1 : std::stoi(
match[1].
str());
107 }
else if(std::regex_match(leg[0],
match, muon_rgx)) {
108 size_t multiplicity =
match[1].str() ==
"" ? 1 : std::stoi(
match[1].
str());
111 }
else if(std::regex_match(leg[0],
match, gamma_rgx)) {
112 size_t multiplicity =
match[1].str() ==
"" ? 1 : std::stoi(
match[1].
str());
115 }
else if(std::regex_match(leg[0],
match, jet_rgx)) {
116 size_t multiplicity =
match[1].str() ==
"" ? 1 : std::stoi(
match[1].
str());
119 }
else if(std::regex_match(leg[0],
match, met_rgx)) {
122 }
else if(std::regex_match(leg[0],
match, noalg_rgx)) {
124 }
else if (std::regex_match(leg[0],
match, ditauomni_rgx)) {
126 }
else if(std::regex_match(leg[0], l1_rgx)){
127 for(
size_t j = 0; j < leg.size(); j++) {
128 if(std::regex_match(leg[j], topo_rgx))
continue;
131 if(leg[j].
find(
'-') != std::string::npos || std::regex_match(leg[j], l1_toposeparate_rgx)) {
134 if(leg[0] ==
"L1TAU60" && leg[j] ==
"DR-TAU12ITAU12I") leg[j] =
"TAU12IM";
135 else if(leg.size() == 1 && (leg[0] ==
"L1DR-TAU20ITAU12I" || leg[0] ==
"L1DR-TAU20ITAU12I-J25")) {
137 leg[0] =
"L1TAU20IM";
138 leg.push_back(
"TAU12IM");
144 m_L1Items.push_back(j == 0 ? leg[j].substr(2, leg[j].size()) : leg[j]);
159 std::regex_token_iterator<std::string::iterator> rgx_iter(
m_L1Item.begin(),
m_L1Item.end(), l1_tau_rgx);
160 while(rgx_iter != rend) {
161 std::string s = *rgx_iter;
162 std::regex_match(s,
match, l1_tau_rgx);
163 size_t multiplicity =
match[1].str() ==
"" ? 1 : std::stoi(
match[1].
str());
164 std::string item_type =
match[2].str();
166 std::string item_isolation =
match[4].str();
169 if(remove_L1_phase1_thresholds && (item_type ==
"e" || item_type ==
"j" || item_type ==
"c"))
threshold = -1;
171 for(
size_t j = 0; j < multiplicity; j++) {