 |
ATLAS Offline Software
|
#include <TrigThresholdDecisionTool.h>
|
| TrigThresholdDecisionTool (const std::string &type, const std::string &name, const IInterface *parent) |
|
virtual StatusCode | initialize () override |
|
virtual StatusCode | start () override |
|
virtual uint64_t | getPattern (const EventContext &ctx, const xAOD::MuonRoI &roi, const ThrVec &menuThresholds, const TrigConf::L1ThrExtraInfoBase &menuExtraInfo) const override |
|
virtual uint64_t | getPattern (uint32_t dataWord, const ThrVec &menuThresholds, const TrigConf::L1ThrExtraInfoBase &menuExtraInfo) const |
|
virtual std::vector< std::pair< std::shared_ptr< TrigConf::L1Threshold >, bool > > | getThresholdDecisions (uint32_t dataWord, const EventContext &eventContext) const override |
|
virtual std::vector< std::pair< std::shared_ptr< TrigConf::L1Threshold >, bool > > | getThresholdDecisions (uint32_t dataWord, const ThrVec &menuThresholds, const TrigConf::L1ThrExtraInfoBase &menuExtraInfo) const override |
|
virtual std::pair< std::string, double > | getMinThresholdNameAndValue (const std::vector< std::pair< std::shared_ptr< TrigConf::L1Threshold >, bool > > &decisions, const double &eta=0) const override |
|
|
StatusCode | configureToolFromMenu (const TrigConf::L1Menu &l1Menu) const |
|
bool | isExcludedRPCROI (const TrigConf::L1ThrExtraInfo_MU &menuExtraInfo, const std::string &rpcExclROIList, unsigned roi, unsigned sectorID, bool isSideC) const |
|
bool | getTGCDecision (const std::string &tgcFlags, bool F, bool C, bool H) const |
|
void | makeTGCDecision (const std::string &tgcFlags, bool F, bool C, bool H) const |
|
bool | getRPCDecision (const std::string &rpcFlags, bool M) const |
|
void | makeRPCDecision (const std::string &rpcFlags, bool M) const |
|
void | parseFlags (const std::string &flags) const |
|
std::vector< std::string > | parseString (const std::string &str, const std::string &sep) const |
|
std::string | getShapedFlags (const std::string &flags) const |
|
|
ToolHandle< LVL1::ITrigT1MuonRecRoiTool > | m_rpcTool {this, "RPCRecRoiTool", "LVL1::TrigT1RPCRecRoiTool/LVL1__TrigT1RPCRecRoiTool", "Tool to get the eta/phi coordinates in the RPC"} |
|
ToolHandle< LVL1::ITrigT1MuonRecRoiTool > | m_tgcTool {this, "TGCRecRoiTool", "LVL1::TrigT1TGCRecRoiTool/LVL1__TrigT1TGCRecRoiTool", "Tool to get the eta/phi coordinates in the TGC"} |
|
std::map< std::string, std::vector< std::vector< std::string > > > m_parsed_flags | ATLAS_THREAD_SAFE {} |
|
std::map< std::string, std::set< TGCFlagDecision > > m_tgcFlag_decisions | ATLAS_THREAD_SAFE {} |
|
std::map< std::string, std::set< RPCFlagDecision > > m_rpcFlag_decisions | ATLAS_THREAD_SAFE {} |
|
ServiceHandle< TrigConf::ITrigConfigSvc > | m_configSvc {this, "TrigConfigSvc", "TrigConf::xAODConfigSvc"} |
|
Gaudi::Property< bool > | m_MenuFromxAOD {this, "MenuFromxAOD", false, "Flag to enable loading the L1 menu from xAOD as metadata instead of the detector store"} |
|
std::atomic< bool > m_isInitialized | ATLAS_THREAD_SAFE {false} |
|
std::mutex m_mutex | ATLAS_THREAD_SAFE {} |
|
Definition at line 40 of file TrigThresholdDecisionTool.h.
◆ TrigThresholdDecisionTool()
LVL1::TrigThresholdDecisionTool::TrigThresholdDecisionTool |
( |
const std::string & |
type, |
|
|
const std::string & |
name, |
|
|
const IInterface * |
parent |
|
) |
| |
◆ configureToolFromMenu()
StatusCode LVL1::TrigThresholdDecisionTool::configureToolFromMenu |
( |
const TrigConf::L1Menu & |
l1Menu | ) |
const |
|
protected |
Definition at line 52 of file TrigThresholdDecisionTool.cxx.
54 std::lock_guard guard{m_mutex};
55 if (m_isInitialized) {
56 return StatusCode::SUCCESS;
59 m_parsed_flags.clear();
60 m_tgcFlag_decisions.clear();
61 m_rpcFlag_decisions.clear();
64 std::optional<ThrVecRef> menuThresholds = getMenuThresholds(l1Menu);
67 for (
const std::shared_ptr<TrigConf::L1Threshold>& thrBase : menuThresholds.value().get()) {
92 m_isInitialized =
true;
93 return StatusCode::SUCCESS;
◆ getMinThresholdNameAndValue()
std::pair< std::string, double > LVL1::TrigThresholdDecisionTool::getMinThresholdNameAndValue |
( |
const std::vector< std::pair< std::shared_ptr< TrigConf::L1Threshold >, bool > > & |
decisions, |
|
|
const double & |
eta = 0 |
|
) |
| const |
|
overridevirtual |
Definition at line 254 of file TrigThresholdDecisionTool.cxx.
259 throw std::runtime_error(
"Error configuring the TrigThresholdDecisionTool from metadata!");
264 std::string thrName=
"";
267 for (
unsigned idec=0;idec<
decisions.size();++idec) {
269 std::shared_ptr<TrigConf::L1Threshold_MU>
thr = std::static_pointer_cast<TrigConf::L1Threshold_MU>(
decisions[idec].
first);
270 if(std::abs(
eta)<1.05){
271 thrValTmp =
thr->ptBarrel();
274 thrValTmp =
thr->ptEndcap();
276 if (thrValTmp > thrVal)
279 thrName =
thr->name();
282 return std::make_pair(thrName, thrVal);
◆ getPattern() [1/2]
◆ getPattern() [2/2]
Definition at line 103 of file TrigThresholdDecisionTool.cxx.
109 throw std::runtime_error(
"Error configuring the TrigThresholdDecisionTool from metadata!");
119 else roiTool = &(*m_tgcTool);
125 unsigned roi, sectorID;
139 bool F=
false,
C=
false,
H=
false, M=
false;
152 for (
const std::shared_ptr<TrigConf::L1Threshold>& thrBase : menuThresholds) {
158 if (
thr->region().find(
"ALL") == std::string::npos &&
159 thr->region().find(
"BA") == std::string::npos)
continue;
163 if (
isExcludedRPCROI(muThrExtraInfo,
thr->rpcExclROIList(), roi, sectorID, isSideC))
continue;
165 if (ptword >=
thr->idxBarrel()) {
175 if (
thr->region().find(
"ALL") == std::string::npos &&
176 thr->region().find(
"EC") == std::string::npos)
continue;
178 if (ptword >=
thr->idxEndcap()) {
185 if (
thr->region().find(
"ALL") == std::string::npos &&
186 thr->region().find(
"FW") == std::string::npos)
continue;
188 if (ptword >=
thr->idxForward()) {
199 thresholdsPattern |= (1
ull <<
thr->mapping());
204 return thresholdsPattern;
◆ getRPCDecision()
bool LVL1::TrigThresholdDecisionTool::getRPCDecision |
( |
const std::string & |
rpcFlags, |
|
|
bool |
M |
|
) |
| const |
|
protected |
Definition at line 365 of file TrigThresholdDecisionTool.cxx.
368 RPCFlagDecision decision(M);
369 auto previous_decisions = m_rpcFlag_decisions.find(rpcFlags);
370 if (previous_decisions == m_rpcFlag_decisions.end())
return false;
372 auto previous_decision_itr = previous_decisions->second.find(decision);
373 if (previous_decision_itr != previous_decisions->second.end())
return previous_decision_itr->pass;
◆ getShapedFlags()
std::string LVL1::TrigThresholdDecisionTool::getShapedFlags |
( |
const std::string & |
flags | ) |
const |
|
protected |
Definition at line 452 of file TrigThresholdDecisionTool.cxx.
454 std::string shapedFlags =
flags;
455 shapedFlags.erase(std::remove_if(shapedFlags.begin(),shapedFlags.end(),::isspace),shapedFlags.end());
456 std::vector<std::string> vec_ors =
parseString(shapedFlags,
"|");
457 std::set<std::string> set_ors;
458 for(
const auto& ors : vec_ors){
459 std::vector<std::string> vec_ands =
parseString(ors,
"&");
460 std::set<std::string> set_ands;
461 for(
const auto& ands : vec_ands){
462 set_ands.insert(ands);
465 for(
const auto& ands : set_ands){
469 std::string bb =
aa.substr(0,
aa.size()-1);
473 for(
const auto& ors : set_ors){
477 std::string bb =
aa.substr(0,
aa.size()-1);
◆ getTGCDecision()
bool LVL1::TrigThresholdDecisionTool::getTGCDecision |
( |
const std::string & |
tgcFlags, |
|
|
bool |
F, |
|
|
bool |
C, |
|
|
bool |
H |
|
) |
| const |
|
protected |
Definition at line 318 of file TrigThresholdDecisionTool.cxx.
321 TGCFlagDecision decision(F,C,H);
322 auto previous_decisions = m_tgcFlag_decisions.find(tgcFlags);
323 if (previous_decisions == m_tgcFlag_decisions.end())
return false;
325 auto previous_decision_itr = previous_decisions->second.find(decision);
326 if (previous_decision_itr != previous_decisions->second.end())
return previous_decision_itr->pass;
◆ getThresholdDecisions() [1/2]
std::vector< std::pair< std::shared_ptr< TrigConf::L1Threshold >, bool > > LVL1::TrigThresholdDecisionTool::getThresholdDecisions |
( |
uint32_t |
dataWord, |
|
|
const EventContext & |
eventContext |
|
) |
| const |
|
overridevirtual |
Definition at line 208 of file TrigThresholdDecisionTool.cxx.
214 if (!m_isInitialized){
216 throw std::runtime_error(
"Error configuring the TrigThresholdDecisionTool from metadata!");
222 l1Menu = l1MenuHandle.
cptr();
225 std::optional<ThrVecRef> menuThresholds = getMenuThresholds(*l1Menu);
226 std::optional<ExtraInfoRef> menuExtraInfo = getMenuThresholdExtraInfo(*l1Menu);
◆ getThresholdDecisions() [2/2]
Definition at line 232 of file TrigThresholdDecisionTool.cxx.
238 throw std::runtime_error(
"Error configuring the TrigThresholdDecisionTool from metadata!");
245 std::vector<std::pair<std::shared_ptr<TrigConf::L1Threshold>,
bool> > threshold_decisions;
246 threshold_decisions.resize(menuThresholds.size());
247 for (
const std::shared_ptr<TrigConf::L1Threshold>&
thr : menuThresholds) {
248 const bool decision =
pattern & (1 <<
thr->mapping());
249 threshold_decisions[
thr->mapping()] = std::make_pair(
thr, decision);
251 return threshold_decisions;
◆ initialize()
StatusCode LVL1::TrigThresholdDecisionTool::initialize |
( |
| ) |
|
|
overridevirtual |
◆ isExcludedRPCROI()
bool LVL1::TrigThresholdDecisionTool::isExcludedRPCROI |
( |
const TrigConf::L1ThrExtraInfo_MU & |
menuExtraInfo, |
|
|
const std::string & |
rpcExclROIList, |
|
|
unsigned |
roi, |
|
|
unsigned |
sectorID, |
|
|
bool |
isSideC |
|
) |
| const |
|
protected |
Definition at line 285 of file TrigThresholdDecisionTool.cxx.
290 if (rpcExclROIList !=
"")
292 const std::map<std::string, std::vector<unsigned int> >& exclList = menuExtraInfo.
exclusionList(rpcExclROIList);
293 if (exclList.size() != 0)
296 std::stringstream sectorName;
298 int sectorNumber=sectorID;
299 if (isSideC) sectorNumber += 32;
300 if (sectorNumber < 10) sectorName <<
"0";
301 sectorName << sectorNumber;
304 auto exclROIs = exclList.find(sectorName.str());
305 if (exclROIs != exclList.end())
307 for (
auto roi_itr=exclROIs->second.begin();roi_itr!=exclROIs->second.end();roi_itr++)
309 if (*roi_itr == roi)
return true;
◆ makeRPCDecision()
void LVL1::TrigThresholdDecisionTool::makeRPCDecision |
( |
const std::string & |
rpcFlags, |
|
|
bool |
M |
|
) |
| const |
|
protected |
Definition at line 377 of file TrigThresholdDecisionTool.cxx.
380 RPCFlagDecision decision(M);
381 auto previous_decisions = &m_rpcFlag_decisions[rpcFlags];
382 auto previous_decision_itr = previous_decisions->find(decision);
383 if (previous_decision_itr != previous_decisions->end())
return;
384 else if (rpcFlags ==
"") {
386 previous_decisions->insert(decision);
392 bool passedFlags =
false;
393 const std::vector<std::vector<std::string> >* vec_flags = &m_parsed_flags[rpcFlags];
394 for (
auto or_itr = vec_flags->begin();or_itr!=vec_flags->end();or_itr++)
397 bool passedAnd =
true;
398 for (
auto and_itr = or_itr->begin();and_itr!=or_itr->end();and_itr++)
400 if (*and_itr ==
"M") passedAnd = passedAnd && M;
402 passedFlags = passedFlags || passedAnd;
405 decision.pass = passedFlags;
406 previous_decisions->insert(decision);
◆ makeTGCDecision()
void LVL1::TrigThresholdDecisionTool::makeTGCDecision |
( |
const std::string & |
tgcFlags, |
|
|
bool |
F, |
|
|
bool |
C, |
|
|
bool |
H |
|
) |
| const |
|
protected |
Definition at line 330 of file TrigThresholdDecisionTool.cxx.
333 TGCFlagDecision decision(F,C,H);
334 auto previous_decisions = &m_tgcFlag_decisions[tgcFlags];
335 auto previous_decision_itr = previous_decisions->find(decision);
336 if (previous_decision_itr != previous_decisions->end())
return;
337 else if (tgcFlags ==
"") {
339 previous_decisions->insert(decision);
345 bool passedFlags =
false;
346 const std::vector<std::vector<std::string> >* vec_flags = &m_parsed_flags[tgcFlags];
347 for (
auto or_itr = vec_flags->begin();or_itr!=vec_flags->end();or_itr++)
350 bool passedAnd =
true;
351 for (
auto and_itr = or_itr->begin();and_itr!=or_itr->end();and_itr++)
353 if (*and_itr ==
"F") passedAnd = passedAnd &&
F;
354 else if (*and_itr ==
"C") passedAnd = passedAnd &&
C;
355 else if (*and_itr ==
"H") passedAnd = passedAnd &&
H;
357 passedFlags = passedFlags || passedAnd;
360 decision.pass = passedFlags;
361 previous_decisions->insert(decision);
◆ parseFlags()
void LVL1::TrigThresholdDecisionTool::parseFlags |
( |
const std::string & |
flags | ) |
const |
|
protected |
Definition at line 410 of file TrigThresholdDecisionTool.cxx.
414 if (m_parsed_flags.find(
flags) == m_parsed_flags.end())
417 std::vector<std::vector<std::string> > vec_flags;
418 for (
unsigned ior=0;ior<vec_ors.size();ior++)
420 vec_flags.push_back(
parseString(vec_ors[ior],
"&"));
422 m_parsed_flags[
flags] = std::move(vec_flags);
◆ parseString()
std::vector< std::string > LVL1::TrigThresholdDecisionTool::parseString |
( |
const std::string & |
str, |
|
|
const std::string & |
sep |
|
) |
| const |
|
protected |
◆ start()
StatusCode LVL1::TrigThresholdDecisionTool::start |
( |
| ) |
|
|
overridevirtual |
◆ ATLAS_THREAD_SAFE [1/5]
std::map<std::string, std::vector<std::vector<std::string> > > m_parsed_flags LVL1::TrigThresholdDecisionTool::ATLAS_THREAD_SAFE {} |
|
mutableprotected |
◆ ATLAS_THREAD_SAFE [2/5]
std::map<std::string, std::set<TGCFlagDecision> > m_tgcFlag_decisions LVL1::TrigThresholdDecisionTool::ATLAS_THREAD_SAFE {} |
|
mutableprotected |
◆ ATLAS_THREAD_SAFE [3/5]
std::map<std::string, std::set<RPCFlagDecision> > m_rpcFlag_decisions LVL1::TrigThresholdDecisionTool::ATLAS_THREAD_SAFE {} |
|
mutableprotected |
◆ ATLAS_THREAD_SAFE [4/5]
std::atomic<bool> m_isInitialized LVL1::TrigThresholdDecisionTool::ATLAS_THREAD_SAFE {false} |
|
mutableprotected |
◆ ATLAS_THREAD_SAFE [5/5]
std::mutex m_mutex LVL1::TrigThresholdDecisionTool::ATLAS_THREAD_SAFE {} |
|
mutableprotected |
◆ m_configSvc
◆ m_MenuFromxAOD
Gaudi::Property<bool> LVL1::TrigThresholdDecisionTool::m_MenuFromxAOD {this, "MenuFromxAOD", false, "Flag to enable loading the L1 menu from xAOD as metadata instead of the detector store"} |
|
protected |
◆ m_rpcTool
◆ m_tgcTool
The documentation for this class was generated from the following files:
bool passed(DecisionID id, const DecisionIDContainer &idSet)
checks if required decision ID is in the set of IDs in the container
const_pointer_type cptr()
Dereference the pointer.
Scalar eta() const
pseudorapidity method
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
virtual bool isValid() override final
Can the handle be successfully dereferenced?
uint32_t roiWord() const
The "raw" RoI word describing the muon candidate.