ATLAS Offline Software
AlgToChainTool.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef TrigCompositeUtils_AlgToChainTool_h
6 #define TrigCompositeUtils_AlgToChainTool_h
7 
8 #ifndef XAOD_STANDALONE
9 
10 #include <string>
11 #include <set>
12 #include <vector>
13 #include <map>
14 
17 #include "TrigConfData/HLTMenu.h"
18 
19 
20 namespace TrigCompositeUtils {
21 
26  class AlgToChainTool : public AthAlgTool {
27  public:
28  // Helper struct to save chain info
29  struct ChainInfo {
31  std::string name;
32  std::vector<std::string> groups;
33  bool isPassRaw;
34  };
35 
36  AlgToChainTool(const std::string& type, const std::string& name, const IInterface* parent);
37 
38  virtual ~AlgToChainTool();
39 
40  virtual StatusCode initialize() override;
41 
42  virtual StatusCode start() override;
43 
45  std::vector<std::string> getChainsForAlg(const std::string& algorithmName) const;
46 
48  std::set<std::string> getActiveChainsForAlg(const std::string& algorithmName, const EventContext& context) const;
49 
51  StatusCode getChainsForAllAlgs(const EventContext& context, std::map<std::string, std::set<std::string>>& algToChain) const;
52 
54  std::set<TrigCompositeUtils::DecisionID> retrieveActiveChains(const EventContext& context, const std::string& collectionName = "") const;
55 
57  StatusCode getAllChains(std::vector<TrigConf::Chain>&) const;
58 
60  StatusCode getChainInfo(const EventContext& context, TrigCompositeUtils::DecisionID id, ChainInfo& info) const;
61 
63  StatusCode getAllActiveSequences(const EventContext& context, std::map<std::string, std::string>& algToSeq);
64 
66  void cacheSGKeys(const EventContext& context);
67 
68  private:
69  SG::ReadHandle<TrigCompositeUtils::DecisionContainer> getDecisionFromStore(SmartIF<SGImplSvc>& eventStore, const std::string& key) const;
70 
71  SG::ReadHandleKey<TrigConf::HLTMenu> m_HLTMenuKey{ this, "HLTTriggerMenu", "DetectorStore+HLTTriggerMenu", "HLT Menu" };
72 
73  std::map<std::string, std::vector<TrigConf::Chain>> m_sequencerToChainMap;
74  std::map<std::string, std::vector<std::string>> m_algToSequencersMap;
75 
76  std::vector<std::string> m_cachedEventStoreKeys;
78 
79  // Based on the sequence name create the first part of the name of collection from the decision store
80  std::string createCollectionName(const std::string& sequenceName) const;
81 
83  std::vector<std::string> readSGKeys(const EventContext& context) const;
84 
86  std::set<TrigCompositeUtils::DecisionID> retrieveActiveChainsForKeys(const EventContext& context, const std::string& collectionName, const std::vector<std::string>& keys) const;
87  };
88 }
89 
90 #endif // XAOD_STANDALONE
91 
92 #endif // TrigCompositeUtils_AlgToChainTool_h
grepfile.info
info
Definition: grepfile.py:38
TrigCompositeUtils::AlgToChainTool::m_cachedEventID
uint64_t m_cachedEventID
Definition: AlgToChainTool.h:77
TrigCompositeUtils::AlgToChainTool::getChainsForAllAlgs
StatusCode getChainsForAllAlgs(const EventContext &context, std::map< std::string, std::set< std::string >> &algToChain) const
Request set of chains for all algorithms in the menu.
Definition: AlgToChainTool.cxx:212
TrigCompositeUtils::DecisionID
unsigned int DecisionID
Definition: TrigComposite_v1.h:27
TrigCompositeUtils::AlgToChainTool::ChainInfo::id
TrigCompositeUtils::DecisionID id
Definition: AlgToChainTool.h:30
TrigCompositeUtils::AlgToChainTool::cacheSGKeys
void cacheSGKeys(const EventContext &context)
Cache the StoreGate keys.
Definition: AlgToChainTool.cxx:150
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
AthenaPoolTestRead.sequenceName
sequenceName
Definition: AthenaPoolTestRead.py:23
SG::ReadHandleKey< TrigConf::HLTMenu >
TrigCompositeUtils::AlgToChainTool::ChainInfo::groups
std::vector< std::string > groups
Definition: AlgToChainTool.h:32
TrigCompositeUtils::AlgToChainTool::m_HLTMenuKey
SG::ReadHandleKey< TrigConf::HLTMenu > m_HLTMenuKey
Definition: AlgToChainTool.h:71
TrigCompositeUtils::AlgToChainTool::initialize
virtual StatusCode initialize() override
Definition: AlgToChainTool.cxx:19
TrigCompositeUtils.h
TrigCompositeUtils::AlgToChainTool::~AlgToChainTool
virtual ~AlgToChainTool()
Definition: AlgToChainTool.cxx:16
TrigCompositeUtils::AlgToChainTool::m_algToSequencersMap
std::map< std::string, std::vector< std::string > > m_algToSequencersMap
Definition: AlgToChainTool.h:74
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
AthAlgTool.h
test_pyathena.parent
parent
Definition: test_pyathena.py:15
xAOD::uint64_t
uint64_t
Definition: EventInfo_v1.cxx:123
TrigCompositeUtils::AlgToChainTool::getChainInfo
StatusCode getChainInfo(const EventContext &context, TrigCompositeUtils::DecisionID id, ChainInfo &info) const
Retrieve chain information for gived chain id.
Definition: AlgToChainTool.cxx:239
TrigCompositeUtils::AlgToChainTool::ChainInfo
Definition: AlgToChainTool.h:29
TrigCompositeUtils::AlgToChainTool::createCollectionName
std::string createCollectionName(const std::string &sequenceName) const
Definition: AlgToChainTool.cxx:292
TrigCompositeUtils::AlgToChainTool::getAllChains
StatusCode getAllChains(std::vector< TrigConf::Chain > &) const
Request all chains from the menu.
Definition: AlgToChainTool.cxx:57
TrigCompositeUtils::AlgToChainTool::retrieveActiveChains
std::set< TrigCompositeUtils::DecisionID > retrieveActiveChains(const EventContext &context, const std::string &collectionName="") const
Read the cached or non cached SG kays and request set of chains for given navigation collection.
Definition: AlgToChainTool.cxx:166
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
TrigCompositeUtils::AlgToChainTool
Provide the reverse mapping: algorithm name to set of chain names.
Definition: AlgToChainTool.h:26
TrigCompositeUtils::AlgToChainTool::getAllActiveSequences
StatusCode getAllActiveSequences(const EventContext &context, std::map< std::string, std::string > &algToSeq)
Retrieve algorithms and their active sequences.
Definition: AlgToChainTool.cxx:112
TrigCompositeUtils::AlgToChainTool::getDecisionFromStore
SG::ReadHandle< TrigCompositeUtils::DecisionContainer > getDecisionFromStore(SmartIF< SGImplSvc > &eventStore, const std::string &key) const
Definition: AlgToChainTool.cxx:278
TrigCompositeUtils::AlgToChainTool::m_sequencerToChainMap
std::map< std::string, std::vector< TrigConf::Chain > > m_sequencerToChainMap
Definition: AlgToChainTool.h:73
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
TrigCompositeUtils::AlgToChainTool::start
virtual StatusCode start() override
Definition: AlgToChainTool.cxx:26
TrigCompositeUtils::AlgToChainTool::ChainInfo::isPassRaw
bool isPassRaw
Definition: AlgToChainTool.h:33
TrigCompositeUtils::AlgToChainTool::AlgToChainTool
AlgToChainTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: AlgToChainTool.cxx:9
TrigCompositeUtils
Definition: Event/xAOD/xAODTrigger/xAODTrigger/TrigComposite.h:19
HLTMenu.h
TrigCompositeUtils::AlgToChainTool::retrieveActiveChainsForKeys
std::set< TrigCompositeUtils::DecisionID > retrieveActiveChainsForKeys(const EventContext &context, const std::string &collectionName, const std::vector< std::string > &keys) const
Request set of chains for given navigation collection and list of StoreGate keys.
Definition: AlgToChainTool.cxx:177
TrigCompositeUtils::AlgToChainTool::getChainsForAlg
std::vector< std::string > getChainsForAlg(const std::string &algorithmName) const
Request set of chains for given algorithm - static lookup (menu)
Definition: AlgToChainTool.cxx:68
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:798
TrigCompositeUtils::AlgToChainTool::ChainInfo::name
std::string name
Definition: AlgToChainTool.h:31
TrigCompositeUtils::AlgToChainTool::getActiveChainsForAlg
std::set< std::string > getActiveChainsForAlg(const std::string &algorithmName, const EventContext &context) const
Request set of active chains for given algorithm - dynamic lookup (navigation)
Definition: AlgToChainTool.cxx:90
AthAlgTool
Definition: AthAlgTool.h:26
TrigCompositeUtils::AlgToChainTool::m_cachedEventStoreKeys
std::vector< std::string > m_cachedEventStoreKeys
Definition: AlgToChainTool.h:76
TrigCompositeUtils::AlgToChainTool::readSGKeys
std::vector< std::string > readSGKeys(const EventContext &context) const
Read the keys from StoreGate.
Definition: AlgToChainTool.cxx:158
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37