ATLAS Offline Software
Loading...
Searching...
No Matches
TrigThresholdDecisionTool.h
Go to the documentation of this file.
1// This file is really -*- C++ -*-.
2
3/*
4 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
5*/
6
7#ifndef TRIGT1MUCTPIPHASE1_TRIGTHRESHOLDECISIONTOOL_H
8#define TRIGT1MUCTPIPHASE1_TRIGTHRESHOLDECISIONTOOL_H
9
10/*
11 Tool to help perform decision about trigger threshold given ROI data
12*/
13
16#include "TrigConfData/L1Menu.h"
18
21
23#include "xAODTrigger/MuonRoI.h"
25
26#include <map>
27#include <vector>
28#include <string>
29#include <memory>
30#include <utility>
31
32namespace LVL1 {
33
35 extern const char ContainerName[];
36 extern const char ThresholdType[];
38 }
39
40 class TrigThresholdDecisionTool : public extends<MURoIThresholdsToolParams::BaseClass, ITrigThresholdDecisionTool>
41 {
42 public:
43
44 TrigThresholdDecisionTool(const std::string& type,
45 const std::string& name,
46 const IInterface* parent);
47
48 virtual StatusCode initialize() override;
49 virtual StatusCode start() override;
50
51 virtual uint64_t getPattern(const EventContext& ctx,
52 const xAOD::MuonRoI& roi,
53 const ThrVec& menuThresholds,
54 const TrigConf::L1ThrExtraInfoBase& menuExtraInfo) const override;
55
56 virtual uint64_t getPattern(uint32_t dataWord,
57 const ThrVec& menuThresholds,
58 const TrigConf::L1ThrExtraInfoBase& menuExtraInfo) const;
59
60 virtual
61 std::vector<std::pair<std::shared_ptr<TrigConf::L1Threshold>, bool> >
62 getThresholdDecisions(uint32_t dataWord,
63 const EventContext& eventContext) const override;
64 virtual
65 std::vector<std::pair<std::shared_ptr<TrigConf::L1Threshold>, bool> >
66 getThresholdDecisions(uint32_t dataWord,
67 const ThrVec& menuThresholds,
68 const TrigConf::L1ThrExtraInfoBase& menuExtraInfo) const override;
69
70 virtual
71 std::pair<std::string, double> getMinThresholdNameAndValue(const std::vector<std::pair<std::shared_ptr<TrigConf::L1Threshold>, bool> >& decisions,
72 const double& eta = 0) const override;
73 using parsedFlagsMap = std::unordered_map<std::string, std::vector<std::vector<std::string_view> > >;
74
75 protected:
76 //Function that performs the actual initialization of the tool.
77 StatusCode configureToolFromMenu(const TrigConf::L1Menu& l1Menu) const;
78
80 {
81 TGCFlagDecision(const bool& F, const bool& C, const bool& H) {word = F + 2*C + 4*H;pass=false;}
82
83 //implement < operator so we can store this type in a set
84 bool operator<(const TGCFlagDecision& rhs) const {return word < rhs.word;}
85
86 unsigned word;
87 bool pass;
88 };
90 {
91 RPCFlagDecision(const bool& M) {word = M;pass=false;}
92
93 //implement < operator so we can store this type in a set
94 bool operator<(const RPCFlagDecision& rhs) const {return word < rhs.word;}
95
96 unsigned word;
97 bool pass;
98 };
99
100 bool isExcludedRPCROI(const TrigConf::L1ThrExtraInfo_MU& menuExtraInfo,
101 const std::string& rpcExclROIList,
102 unsigned roi,
103 unsigned sectorID,
104 bool isSideC) const;
105
106 bool getTGCDecision(const std::string& tgcFlags, bool F, bool C, bool H) const;
107 void makeTGCDecision(const std::string& tgcFlags, bool F, bool C, bool H, const parsedFlagsMap& parsed_flags) const;
108
109 bool getRPCDecision(const std::string& rpcFlags, bool M) const;
110 void makeRPCDecision(const std::string& rpcFlags, bool M, const parsedFlagsMap& parsed_flags) const;
111
112 void parseFlags(const std::string& flags, parsedFlagsMap& parsed_flags) const;
113 std::string getShapedFlags(const std::string& flags) const;
114
115 ToolHandle<LVL1::ITrigT1MuonRecRoiTool> m_rpcTool{this, "RPCRecRoiTool", "LVL1::TrigT1RPCRecRoiTool/LVL1__TrigT1RPCRecRoiTool", "Tool to get the eta/phi coordinates in the RPC"};
116 ToolHandle<LVL1::ITrigT1MuonRecRoiTool> m_tgcTool{this, "TGCRecRoiTool", "LVL1::TrigT1TGCRecRoiTool/LVL1__TrigT1TGCRecRoiTool", "Tool to get the eta/phi coordinates in the TGC"};
117
118
119 //buffered set of decisions for words that have been checked for each TGC/RPC flag
120 mutable std::map<std::string, std::set<TGCFlagDecision> > m_tgcFlag_decisions ATLAS_THREAD_SAFE{};
121 mutable std::map<std::string, std::set<RPCFlagDecision> > m_rpcFlag_decisions ATLAS_THREAD_SAFE{};
122
123 //configuration that toddle the L1menu loading sfrom xAOD as metadata or from det store
124 ServiceHandle<TrigConf::ITrigConfigSvc> m_configSvc{this, "TrigConfigSvc", "TrigConf::xAODConfigSvc"};
125 Gaudi::Property<bool> m_MenuFromxAOD {this, "MenuFromxAOD", false, "Flag to enable loading the L1 menu from xAOD as metadata instead of the detector store"};
126 mutable std::atomic<bool> m_isInitialized ATLAS_THREAD_SAFE{false};
127 mutable std::mutex m_mutex ATLAS_THREAD_SAFE{};
128 };
129
130}
131
132
133#endif
Scalar eta() const
pseudorapidity method
#define F(x, y, z)
Definition MD5.cxx:112
#define H(x, y, z)
Definition MD5.cxx:114
bool getTGCDecision(const std::string &tgcFlags, bool F, bool C, bool H) const
ToolHandle< LVL1::ITrigT1MuonRecRoiTool > m_tgcTool
std::string getShapedFlags(const std::string &flags) const
virtual uint64_t getPattern(const EventContext &ctx, const xAOD::MuonRoI &roi, const ThrVec &menuThresholds, const TrigConf::L1ThrExtraInfoBase &menuExtraInfo) const override
bool isExcludedRPCROI(const TrigConf::L1ThrExtraInfo_MU &menuExtraInfo, const std::string &rpcExclROIList, unsigned roi, unsigned sectorID, bool isSideC) const
virtual std::vector< std::pair< std::shared_ptr< TrigConf::L1Threshold >, bool > > getThresholdDecisions(uint32_t dataWord, const EventContext &eventContext) const override
void parseFlags(const std::string &flags, parsedFlagsMap &parsed_flags) const
void makeRPCDecision(const std::string &rpcFlags, bool M, const parsedFlagsMap &parsed_flags) const
std::unordered_map< std::string, std::vector< std::vector< std::string_view > > > parsedFlagsMap
ServiceHandle< TrigConf::ITrigConfigSvc > m_configSvc
void makeTGCDecision(const std::string &tgcFlags, bool F, bool C, bool H, const parsedFlagsMap &parsed_flags) const
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
ToolHandle< LVL1::ITrigT1MuonRecRoiTool > m_rpcTool
virtual StatusCode initialize() override
std::map< std::string, std::set< TGCFlagDecision > > m_tgcFlag_decisions ATLAS_THREAD_SAFE
TrigThresholdDecisionTool(const std::string &type, const std::string &name, const IInterface *parent)
bool getRPCDecision(const std::string &rpcFlags, bool M) const
L1 menu configuration.
Definition L1Menu.h:29
L1 extra information for certain threshold types.
struct color C
RoIThresholdsTool< xAOD::MuonRoI, xAOD::MuonRoIContainer, ContainerName, ThresholdType > BaseClass
eFexTowerBuilder creates xAOD::eFexTowerContainer from supercells (LATOME) and triggerTowers (TREX) i...
MuonRoI_v1 MuonRoI
Definition MuonRoI.h:15
TGCFlagDecision(const bool &F, const bool &C, const bool &H)