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
74 protected:
75 //Function that performs the actual initialization of the tool.
76 StatusCode configureToolFromMenu(const TrigConf::L1Menu& l1Menu) const;
77
79 {
80 TGCFlagDecision(const bool& F, const bool& C, const bool& H) {word = F + 2*C + 4*H;pass=false;}
81
82 //implement < operator so we can store this type in a set
83 bool operator<(const TGCFlagDecision& rhs) const {return word < rhs.word;}
84
85 unsigned word;
86 bool pass;
87 };
89 {
90 RPCFlagDecision(const bool& M) {word = M;pass=false;}
91
92 //implement < operator so we can store this type in a set
93 bool operator<(const RPCFlagDecision& rhs) const {return word < rhs.word;}
94
95 unsigned word;
96 bool pass;
97 };
98
99 bool isExcludedRPCROI(const TrigConf::L1ThrExtraInfo_MU& menuExtraInfo,
100 const std::string& rpcExclROIList,
101 unsigned roi,
102 unsigned sectorID,
103 bool isSideC) const;
104
105 bool getTGCDecision(const std::string& tgcFlags, bool F, bool C, bool H) const;
106 void makeTGCDecision(const std::string& tgcFlags, bool F, bool C, bool H) const;
107
108 bool getRPCDecision(const std::string& rpcFlags, bool M) const;
109 void makeRPCDecision(const std::string& rpcFlags, bool M) const;
110
111 void parseFlags(const std::string& flags) const;
112 std::vector<std::string> parseString(const std::string& str, const std::string& sep) 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 //buffered parsed TGC/RPC flags
119 mutable std::map<std::string, std::vector<std::vector<std::string> > > m_parsed_flags ATLAS_THREAD_SAFE{};
120
121 //buffered set of decisions for words that have been checked for each TGC/RPC flag
122 mutable std::map<std::string, std::set<TGCFlagDecision> > m_tgcFlag_decisions ATLAS_THREAD_SAFE{};
123 mutable std::map<std::string, std::set<RPCFlagDecision> > m_rpcFlag_decisions ATLAS_THREAD_SAFE{};
124
125 //configuration that toddle the L1menu loading sfrom xAOD as metadata or from det store
126 ServiceHandle<TrigConf::ITrigConfigSvc> m_configSvc{this, "TrigConfigSvc", "TrigConf::xAODConfigSvc"};
127 Gaudi::Property<bool> m_MenuFromxAOD {this, "MenuFromxAOD", false, "Flag to enable loading the L1 menu from xAOD as metadata instead of the detector store"};
128 mutable std::atomic<bool> m_isInitialized ATLAS_THREAD_SAFE{false};
129 mutable std::mutex m_mutex ATLAS_THREAD_SAFE{};
130 };
131
132}
133
134
135#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 makeTGCDecision(const std::string &tgcFlags, bool F, bool C, bool H) const
ServiceHandle< TrigConf::ITrigConfigSvc > m_configSvc
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
void makeRPCDecision(const std::string &rpcFlags, bool M) const
std::vector< std::string > parseString(const std::string &str, const std::string &sep) const
void parseFlags(const std::string &flags) const
std::map< std::string, std::vector< std::vector< std::string > > > m_parsed_flags ATLAS_THREAD_SAFE
virtual StatusCode initialize() override
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:28
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)