ATLAS Offline Software
TrigThresholdDecisionTool.h
Go to the documentation of this file.
1 // This file is really -*- C++ -*-.
2 
3 /*
4  Copyright (C) 2002-2022 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"
17 
20 
22 #include "xAODTrigger/MuonRoI.h"
24 
25 #include <map>
26 #include <vector>
27 #include <string>
28 #include <memory>
29 #include <utility>
30 
31 namespace LVL1 {
32 
33  namespace MURoIThresholdsToolParams {
34  extern const char ContainerName[];
35  extern const char ThresholdType[];
37  }
38 
39  class TrigThresholdDecisionTool : public extends<MURoIThresholdsToolParams::BaseClass, ITrigThresholdDecisionTool>
40  {
41  public:
42 
43  TrigThresholdDecisionTool(const std::string& type,
44  const std::string& name,
45  const IInterface* parent);
46 
47  virtual StatusCode initialize() override;
48  virtual StatusCode start() override;
49 
50  virtual uint64_t getPattern(const xAOD::MuonRoI& roi,
51  const ThrVec& menuThresholds,
52  const TrigConf::L1ThrExtraInfoBase& menuExtraInfo) const override;
53 
54  virtual uint64_t getPattern(uint32_t dataWord,
55  const ThrVec& menuThresholds,
56  const TrigConf::L1ThrExtraInfoBase& menuExtraInfo) const;
57 
58  virtual
59  std::vector<std::pair<std::shared_ptr<TrigConf::L1Threshold>, bool> >
61  const EventContext& eventContext) const override;
62  virtual
63  std::vector<std::pair<std::shared_ptr<TrigConf::L1Threshold>, bool> >
65  const ThrVec& menuThresholds,
66  const TrigConf::L1ThrExtraInfoBase& menuExtraInfo) const override;
67 
68  virtual
69  std::pair<std::string, double> getMinThresholdNameAndValue(const std::vector<std::pair<std::shared_ptr<TrigConf::L1Threshold>, bool> >& decisions,
70  const double& eta = 0) const override;
71 
72  protected:
73 
75  {
76  TGCFlagDecision(const bool& F, const bool& C, const bool& H) {word = F + 2*C + 4*H;pass=false;}
77 
78  //implement < operator so we can store this type in a set
79  bool operator<(const TGCFlagDecision& rhs) const {return word < rhs.word;}
80 
81  unsigned word;
82  bool pass;
83  };
85  {
86  RPCFlagDecision(const bool& M) {word = M;pass=false;}
87 
88  //implement < operator so we can store this type in a set
89  bool operator<(const RPCFlagDecision& rhs) const {return word < rhs.word;}
90 
91  unsigned word;
92  bool pass;
93  };
94 
95  bool isExcludedRPCROI(const TrigConf::L1ThrExtraInfo_MU& menuExtraInfo,
96  const std::string& rpcExclROIList,
97  unsigned roi,
98  unsigned sectorID,
99  bool isSideC) const;
100 
101  bool getTGCDecision(const std::string& tgcFlags, bool F, bool C, bool H) const;
102  void makeTGCDecision(const std::string& tgcFlags, bool F, bool C, bool H);
103 
104  bool getRPCDecision(const std::string& rpcFlags, bool M) const;
105  void makeRPCDecision(const std::string& rpcFlags, bool M);
106 
107  void parseFlags(const std::string& flags);
108  std::vector<std::string> parseString(const std::string& str, const std::string& sep) const;
109  std::string getShapedFlags(const std::string& flags) const;
110 
111  ToolHandle<LVL1::ITrigT1MuonRecRoiTool> m_rpcTool{this, "RPCRecRoiTool", "LVL1::TrigT1RPCRecRoiTool/LVL1__TrigT1RPCRecRoiTool", "Tool to get the eta/phi coordinates in the RPC"};
112  ToolHandle<LVL1::ITrigT1MuonRecRoiTool> m_tgcTool{this, "TGCRecRoiTool", "LVL1::TrigT1TGCRecRoiTool/LVL1__TrigT1TGCRecRoiTool", "Tool to get the eta/phi coordinates in the TGC"};
113 
114  //buffered parsed TGC/RPC flags
115  std::map<std::string, std::vector<std::vector<std::string> > > m_parsed_flags;
116 
117  //buffered set of decisions for words that have been checked for each TGC/RPC flag
118  std::map<std::string, std::set<TGCFlagDecision> > m_tgcFlag_decisions;
119  std::map<std::string, std::set<RPCFlagDecision> > m_rpcFlag_decisions;
120  };
121 
122 }
123 
124 
125 #endif
LVL1::TrigThresholdDecisionTool::RPCFlagDecision::RPCFlagDecision
RPCFlagDecision(const bool &M)
Definition: TrigThresholdDecisionTool.h:86
TrigConf::L1ThrExtraInfo_MU
Definition: L1ThrExtraInfo.h:655
LVL1::TrigThresholdDecisionTool::getThresholdDecisions
virtual std::vector< std::pair< std::shared_ptr< TrigConf::L1Threshold >, bool > > getThresholdDecisions(uint32_t dataWord, const EventContext &eventContext) const override
Definition: TrigThresholdDecisionTool.cxx:182
LVL1::TrigThresholdDecisionTool::m_parsed_flags
std::map< std::string, std::vector< std::vector< std::string > > > m_parsed_flags
Definition: TrigThresholdDecisionTool.h:115
LVL1::TrigThresholdDecisionTool::RPCFlagDecision
Definition: TrigThresholdDecisionTool.h:85
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
AthenaPoolTestRead.flags
flags
Definition: AthenaPoolTestRead.py:8
MuonRoIContainer.h
LVL1::MURoIThresholdsToolParams::ThresholdType
const char ThresholdType[]
Definition: TrigThresholdDecisionTool.cxx:12
LVL1::MURoIThresholdsToolParams::ContainerName
const char ContainerName[]
Definition: TrigThresholdDecisionTool.cxx:11
LVL1::TrigThresholdDecisionTool::getMinThresholdNameAndValue
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
Definition: TrigThresholdDecisionTool.cxx:209
LVL1::TrigThresholdDecisionTool::initialize
virtual StatusCode initialize() override
Definition: TrigThresholdDecisionTool.cxx:20
ITrigThresholdDecisionTool.h
LVL1::TrigThresholdDecisionTool::parseString
std::vector< std::string > parseString(const std::string &str, const std::string &sep) const
Definition: TrigThresholdDecisionTool.cxx:367
TrigConf::L1ThrExtraInfoBase
L1 extra information for certain threshold types.
Definition: L1ThresholdBase.h:72
LVL1
eFexTowerBuilder creates xAOD::eFexTowerContainer from supercells (LATOME) and triggerTowers (TREX) i...
Definition: ICMMCPHitsCnvTool.h:18
L1Threshold.h
LVL1::TrigThresholdDecisionTool::TGCFlagDecision::operator<
bool operator<(const TGCFlagDecision &rhs) const
Definition: TrigThresholdDecisionTool.h:79
LVL1::TrigThresholdDecisionTool::parseFlags
void parseFlags(const std::string &flags)
Definition: TrigThresholdDecisionTool.cxx:351
H
#define H(x, y, z)
Definition: MD5.cxx:114
LVL1::TrigThresholdDecisionTool::RPCFlagDecision::pass
bool pass
Definition: TrigThresholdDecisionTool.h:92
LVL1::TrigThresholdDecisionTool::m_rpcTool
ToolHandle< LVL1::ITrigT1MuonRecRoiTool > m_rpcTool
Definition: TrigThresholdDecisionTool.h:111
LVL1::TrigThresholdDecisionTool::TGCFlagDecision::TGCFlagDecision
TGCFlagDecision(const bool &F, const bool &C, const bool &H)
Definition: TrigThresholdDecisionTool.h:76
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
LVL1::TrigThresholdDecisionTool::makeRPCDecision
void makeRPCDecision(const std::string &rpcFlags, bool M)
Definition: TrigThresholdDecisionTool.cxx:318
xAOD::MuonRoI_v1
Class describing a LVL1 muon region of interest.
Definition: MuonRoI_v1.h:29
test_pyathena.parent
parent
Definition: test_pyathena.py:15
xAOD::uint64_t
uint64_t
Definition: EventInfo_v1.cxx:123
LVL1::TrigThresholdDecisionTool::getRPCDecision
bool getRPCDecision(const std::string &rpcFlags, bool M) const
Definition: TrigThresholdDecisionTool.cxx:306
ITrigT1MuonRecRoiTool.h
LVL1::TrigThresholdDecisionTool::TGCFlagDecision
Definition: TrigThresholdDecisionTool.h:75
LVL1::TrigThresholdDecisionTool::getShapedFlags
std::string getShapedFlags(const std::string &flags) const
Definition: TrigThresholdDecisionTool.cxx:393
LVL1::TrigThresholdDecisionTool::start
virtual StatusCode start() override
Definition: TrigThresholdDecisionTool.cxx:32
LVL1::TrigThresholdDecisionTool
Definition: TrigThresholdDecisionTool.h:40
LVL1::TrigThresholdDecisionTool::isExcludedRPCROI
bool isExcludedRPCROI(const TrigConf::L1ThrExtraInfo_MU &menuExtraInfo, const std::string &rpcExclROIList, unsigned roi, unsigned sectorID, bool isSideC) const
Definition: TrigThresholdDecisionTool.cxx:226
xAOD::decisions
decisions
Definition: TrigComposite_v1.cxx:101
LVL1::TrigThresholdDecisionTool::m_tgcTool
ToolHandle< LVL1::ITrigT1MuonRecRoiTool > m_tgcTool
Definition: TrigThresholdDecisionTool.h:112
TrigConf::name
Definition: HLTChainList.h:35
grepfile.sep
sep
Definition: grepfile.py:38
RoIThresholdsTool
Definition: IRoIThresholdsTool.h:22
IRoIThresholdsTool.h
LVL1::TrigThresholdDecisionTool::makeTGCDecision
void makeTGCDecision(const std::string &tgcFlags, bool F, bool C, bool H)
Definition: TrigThresholdDecisionTool.cxx:271
LVL1::TrigThresholdDecisionTool::RPCFlagDecision::word
unsigned word
Definition: TrigThresholdDecisionTool.h:91
LVL1::TrigThresholdDecisionTool::TGCFlagDecision::word
unsigned word
Definition: TrigThresholdDecisionTool.h:81
LVL1::TrigThresholdDecisionTool::getTGCDecision
bool getTGCDecision(const std::string &tgcFlags, bool F, bool C, bool H) const
Definition: TrigThresholdDecisionTool.cxx:259
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
LVL1::TrigThresholdDecisionTool::RPCFlagDecision::operator<
bool operator<(const RPCFlagDecision &rhs) const
Definition: TrigThresholdDecisionTool.h:89
MuonRoI.h
F
#define F(x, y, z)
Definition: MD5.cxx:112
LVL1::TrigThresholdDecisionTool::getPattern
virtual uint64_t getPattern(const xAOD::MuonRoI &roi, const ThrVec &menuThresholds, const TrigConf::L1ThrExtraInfoBase &menuExtraInfo) const override
Definition: TrigThresholdDecisionTool.cxx:78
LVL1::TrigThresholdDecisionTool::m_tgcFlag_decisions
std::map< std::string, std::set< TGCFlagDecision > > m_tgcFlag_decisions
Definition: TrigThresholdDecisionTool.h:118
str
Definition: BTagTrackIpAccessor.cxx:11
LVL1::TrigThresholdDecisionTool::TGCFlagDecision::pass
bool pass
Definition: TrigThresholdDecisionTool.h:82
LVL1::TrigThresholdDecisionTool::TrigThresholdDecisionTool
TrigThresholdDecisionTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: TrigThresholdDecisionTool.cxx:15
L1Menu.h
LVL1::TrigThresholdDecisionTool::m_rpcFlag_decisions
std::map< std::string, std::set< RPCFlagDecision > > m_rpcFlag_decisions
Definition: TrigThresholdDecisionTool.h:119
L1ThrExtraInfo.h