10 namespace MURoIThresholdsToolParams {
16 const std::string&
name,
29 return StatusCode::SUCCESS;
34 ATH_MSG_DEBUG(
"==========================================" );
35 ATH_MSG_DEBUG(
"Start for Phase1 TrigThresholdDecisionTool" );
36 ATH_MSG_DEBUG(
"==========================================" );
44 std::optional<ThrVecRef> menuThresholds = getMenuThresholds(*l1Menu);
47 for (
const std::shared_ptr<TrigConf::L1Threshold>& thrBase : menuThresholds.value().get()) {
48 std::shared_ptr<TrigConf::L1Threshold_MU> thr = std::static_pointer_cast<TrigConf::L1Threshold_MU>(thrBase);
75 return StatusCode::SUCCESS;
79 const ThrVec& menuThresholds,
85 const ThrVec& menuThresholds,
93 else roiTool = &(*m_tgcTool);
99 unsigned roi, sectorID;
113 bool F=
false, C=
false,
H=
false, M=
false;
126 for (
const std::shared_ptr<TrigConf::L1Threshold>& thrBase : menuThresholds) {
127 std::shared_ptr<TrigConf::L1Threshold_MU> thr = std::static_pointer_cast<TrigConf::L1Threshold_MU>(thrBase);
132 if (thr->
region().find(
"ALL") == std::string::npos &&
133 thr->
region().find(
"BA") == std::string::npos)
continue;
149 if (thr->
region().find(
"ALL") == std::string::npos &&
150 thr->
region().find(
"EC") == std::string::npos)
continue;
159 if (thr->
region().find(
"ALL") == std::string::npos &&
160 thr->
region().find(
"FW") == std::string::npos)
continue;
173 thresholdsPattern |= (1 << thr->
mapping());
178 return thresholdsPattern;
181 std::vector<std::pair<std::shared_ptr<TrigConf::L1Threshold>,
bool> >
183 const EventContext& eventContext)
const {
186 std::optional<ThrVecRef> menuThresholds = getMenuThresholds(*l1Menu);
187 std::optional<ExtraInfoRef> menuExtraInfo = getMenuThresholdExtraInfo(*l1Menu);
192 std::vector<std::pair<std::shared_ptr<TrigConf::L1Threshold>,
bool> >
194 const ThrVec& menuThresholds,
200 std::vector<std::pair<std::shared_ptr<TrigConf::L1Threshold>,
bool> > threshold_decisions;
201 threshold_decisions.resize(menuThresholds.size());
202 for (
const std::shared_ptr<TrigConf::L1Threshold>& thr : menuThresholds) {
203 const bool decision =
pattern & (1 << thr->mapping());
204 threshold_decisions[thr->mapping()] = std::make_pair(thr, decision);
206 return threshold_decisions;
212 std::string thrName=
"";
214 double thrVal=999999999999;
215 for (
unsigned idec=0;idec<
decisions.size();++idec) {
217 std::shared_ptr<TrigConf::L1Threshold> thr =
decisions[idec].first;
221 thrName = thr->
name();
225 if (thrVal==999999999999) thrVal=0;
226 return std::make_pair(thrName, thrVal);
230 const std::string& rpcExclROIList,
232 const unsigned sectorID,
233 const bool isSideC)
const {
234 if (rpcExclROIList !=
"")
236 const std::map<std::string, std::vector<unsigned int> >& exclList = menuExtraInfo.
exclusionList(rpcExclROIList);
237 if (exclList.size() != 0)
240 std::stringstream sectorName;
242 int sectorNumber=sectorID;
243 if (isSideC) sectorNumber += 32;
244 if (sectorNumber < 10) sectorName <<
"0";
245 sectorName << sectorNumber;
248 auto exclROIs = exclList.find(sectorName.str());
249 if (exclROIs != exclList.end())
251 for (
auto roi_itr=exclROIs->second.begin();roi_itr!=exclROIs->second.end();roi_itr++)
253 if (*roi_itr == roi)
return true;
269 auto previous_decision_itr = previous_decisions->second.find(decision);
270 if (previous_decision_itr != previous_decisions->second.end())
return previous_decision_itr->pass;
279 auto previous_decision_itr = previous_decisions->find(decision);
280 if (previous_decision_itr != previous_decisions->end())
return;
281 else if (tgcFlags ==
"") {
283 previous_decisions->insert(decision);
289 bool passedFlags =
false;
290 const std::vector<std::vector<std::string> >* vec_flags = &
m_parsed_flags[tgcFlags];
291 for (
auto or_itr = vec_flags->begin();or_itr!=vec_flags->end();or_itr++)
294 bool passedAnd =
true;
295 for (
auto and_itr = or_itr->begin();and_itr!=or_itr->end();and_itr++)
297 if (*and_itr ==
"F") passedAnd = passedAnd &&
F;
298 else if (*and_itr ==
"C") passedAnd = passedAnd && C;
299 else if (*and_itr ==
"H") passedAnd = passedAnd &&
H;
301 passedFlags = passedFlags || passedAnd;
304 decision.
pass = passedFlags;
305 previous_decisions->insert(decision);
316 auto previous_decision_itr = previous_decisions->second.find(decision);
317 if (previous_decision_itr != previous_decisions->second.end())
return previous_decision_itr->pass;
326 auto previous_decision_itr = previous_decisions->find(decision);
327 if (previous_decision_itr != previous_decisions->end())
return;
328 else if (rpcFlags ==
"") {
330 previous_decisions->insert(decision);
336 bool passedFlags =
false;
337 const std::vector<std::vector<std::string> >* vec_flags = &
m_parsed_flags[rpcFlags];
338 for (
auto or_itr = vec_flags->begin();or_itr!=vec_flags->end();or_itr++)
341 bool passedAnd =
true;
342 for (
auto and_itr = or_itr->begin();and_itr!=or_itr->end();and_itr++)
344 if (*and_itr ==
"M") passedAnd = passedAnd && M;
346 passedFlags = passedFlags || passedAnd;
349 decision.
pass = passedFlags;
350 previous_decisions->insert(decision);
361 std::vector<std::vector<std::string> > vec_flags;
362 for (
unsigned ior=0;ior<vec_ors.size();ior++)
364 vec_flags.push_back(
parseString(vec_ors[ior],
"&"));
372 std::vector<std::string>
parsed;
376 if (
str.find(
sep) == std::string::npos)
384 if (
str.find(
sep,
pos) == std::string::npos)
389 std::string sub =
str.substr(
pos, newPos-
pos);
398 std::string shapedFlags =
flags;
399 shapedFlags.erase(std::remove_if(shapedFlags.begin(),shapedFlags.end(),::isspace),shapedFlags.end());
400 std::vector<std::string> vec_ors =
parseString(shapedFlags,
"|");
401 std::set<std::string> set_ors;
402 for(
const auto& ors : vec_ors){
403 std::vector<std::string> vec_ands =
parseString(ors,
"&");
404 std::set<std::string> set_ands;
405 for(
const auto& ands : vec_ands){
406 set_ands.insert(ands);
409 for(
const auto& ands : set_ands){
413 std::string bb =
aa.substr(0,
aa.size()-1);
417 for(
const auto& ors : set_ors){
421 std::string bb =
aa.substr(0,
aa.size()-1);