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()) {
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) {
132 if (thr->region().find(
"ALL") == std::string::npos &&
133 thr->region().find(
"BA") == std::string::npos)
continue;
137 if (
isExcludedRPCROI(muThrExtraInfo, thr->rpcExclROIList(), roi, sectorID, isSideC))
continue;
139 if (ptword >= thr->idxBarrel()) {
149 if (thr->region().find(
"ALL") == std::string::npos &&
150 thr->region().find(
"EC") == std::string::npos)
continue;
152 if (ptword >= thr->idxEndcap()) {
159 if (thr->region().find(
"ALL") == std::string::npos &&
160 thr->region().find(
"FW") == std::string::npos)
continue;
162 if (ptword >= thr->idxForward()) {
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 for (
unsigned idec=0;idec<
decisions.size();++idec) {
216 std::shared_ptr<TrigConf::L1Threshold> thr =
decisions[idec].first;
220 thrName = thr->
name();
223 return std::make_pair(thrName, thrVal);
227 const std::string& rpcExclROIList,
229 const unsigned sectorID,
230 const bool isSideC)
const {
231 if (rpcExclROIList !=
"")
233 const std::map<std::string, std::vector<unsigned int> >& exclList = menuExtraInfo.
exclusionList(rpcExclROIList);
234 if (exclList.size() != 0)
237 std::stringstream sectorName;
239 int sectorNumber=sectorID;
240 if (isSideC) sectorNumber += 32;
241 if (sectorNumber < 10) sectorName <<
"0";
242 sectorName << sectorNumber;
245 auto exclROIs = exclList.find(sectorName.str());
246 if (exclROIs != exclList.end())
248 for (
auto roi_itr=exclROIs->second.begin();roi_itr!=exclROIs->second.end();roi_itr++)
250 if (*roi_itr == roi)
return true;
266 auto previous_decision_itr = previous_decisions->second.find(decision);
267 if (previous_decision_itr != previous_decisions->second.end())
return previous_decision_itr->pass;
276 auto previous_decision_itr = previous_decisions->find(decision);
277 if (previous_decision_itr != previous_decisions->end())
return;
278 else if (tgcFlags ==
"") {
280 previous_decisions->insert(decision);
286 bool passedFlags =
false;
287 const std::vector<std::vector<std::string> >* vec_flags = &
m_parsed_flags[tgcFlags];
288 for (
auto or_itr = vec_flags->begin();or_itr!=vec_flags->end();or_itr++)
291 bool passedAnd =
true;
292 for (
auto and_itr = or_itr->begin();and_itr!=or_itr->end();and_itr++)
294 if (*and_itr ==
"F") passedAnd = passedAnd &&
F;
295 else if (*and_itr ==
"C") passedAnd = passedAnd && C;
296 else if (*and_itr ==
"H") passedAnd = passedAnd &&
H;
298 passedFlags = passedFlags || passedAnd;
301 decision.
pass = passedFlags;
302 previous_decisions->insert(decision);
313 auto previous_decision_itr = previous_decisions->second.find(decision);
314 if (previous_decision_itr != previous_decisions->second.end())
return previous_decision_itr->pass;
323 auto previous_decision_itr = previous_decisions->find(decision);
324 if (previous_decision_itr != previous_decisions->end())
return;
325 else if (rpcFlags ==
"") {
327 previous_decisions->insert(decision);
333 bool passedFlags =
false;
334 const std::vector<std::vector<std::string> >* vec_flags = &
m_parsed_flags[rpcFlags];
335 for (
auto or_itr = vec_flags->begin();or_itr!=vec_flags->end();or_itr++)
338 bool passedAnd =
true;
339 for (
auto and_itr = or_itr->begin();and_itr!=or_itr->end();and_itr++)
341 if (*and_itr ==
"M") passedAnd = passedAnd && M;
343 passedFlags = passedFlags || passedAnd;
346 decision.
pass = passedFlags;
347 previous_decisions->insert(decision);
358 std::vector<std::vector<std::string> > vec_flags;
359 for (
unsigned ior=0;ior<vec_ors.size();ior++)
361 vec_flags.push_back(
parseString(vec_ors[ior],
"&"));
369 std::vector<std::string>
parsed;
373 if (
str.find(
sep) == std::string::npos)
381 if (
str.find(
sep,
pos) == std::string::npos)
386 std::string sub =
str.substr(
pos, newPos-
pos);
395 std::string shapedFlags =
flags;
396 shapedFlags.erase(std::remove_if(shapedFlags.begin(),shapedFlags.end(),::isspace),shapedFlags.end());
397 std::vector<std::string> vec_ors =
parseString(shapedFlags,
"|");
398 std::set<std::string> set_ors;
399 for(
const auto& ors : vec_ors){
400 std::vector<std::string> vec_ands =
parseString(ors,
"&");
401 std::set<std::string> set_ands;
402 for(
const auto& ands : vec_ands){
403 set_ands.insert(ands);
406 for(
const auto& ands : set_ands){
410 std::string bb =
aa.substr(0,
aa.size()-1);
414 for(
const auto& ors : set_ors){
418 std::string bb =
aa.substr(0,
aa.size()-1);