ATLAS Offline Software
Classes | Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
TrigCompositeUtils::AlgToChainTool Class Reference

Provide the reverse mapping: algorithm name to set of chain names. More...

#include <AlgToChainTool.h>

Inheritance diagram for TrigCompositeUtils::AlgToChainTool:
Collaboration diagram for TrigCompositeUtils::AlgToChainTool:

Classes

struct  ChainInfo
 

Public Member Functions

 AlgToChainTool (const std::string &type, const std::string &name, const IInterface *parent)
 
virtual ~AlgToChainTool ()
 
virtual StatusCode initialize () override
 
virtual StatusCode start () override
 
std::vector< std::string > getChainsForAlg (const std::string &algorithmName) const
 Request set of chains for given algorithm - static lookup (menu) More...
 
std::set< std::string > getActiveChainsForAlg (const std::string &algorithmName, const EventContext &context) const
 Request set of active chains for given algorithm - dynamic lookup (navigation) More...
 
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. More...
 
std::set< TrigCompositeUtils::DecisionIDretrieveActiveChains (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. More...
 
StatusCode getAllChains (std::vector< TrigConf::Chain > &) const
 Request all chains from the menu. More...
 
StatusCode getChainInfo (const EventContext &context, TrigCompositeUtils::DecisionID id, ChainInfo &info) const
 Retrieve chain information for gived chain id. More...
 
StatusCode getAllActiveSequences (const EventContext &context, std::map< std::string, std::string > &algToSeq)
 Retrieve algorithms and their active sequences. More...
 
void cacheSGKeys (const EventContext &context)
 Cache the StoreGate keys. More...
 
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & evtStore () const
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc. More...
 
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm. More...
 
virtual StatusCode sysStart () override
 Handle START transition. More...
 
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles. More...
 
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles. More...
 
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T > &t)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKey &hndl, const std::string &doc, const SG::VarHandleKeyType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleBase &hndl, const std::string &doc, const SG::VarHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKeyArray &hndArr, const std::string &doc, const SG::VarHandleKeyArrayType &)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc, const SG::NotHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc="none")
 Declare a new Gaudi property. More...
 
void updateVHKA (Gaudi::Details::PropertyBase &)
 
MsgStream & msg () const
 
MsgStream & msg (const MSG::Level lvl) const
 
bool msgLvl (const MSG::Level lvl) const
 

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution More...
 
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
 
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed. More...
 

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t
 

Private Member Functions

SG::ReadHandle< TrigCompositeUtils::DecisionContainergetDecisionFromStore (SmartIF< SGImplSvc > &eventStore, const std::string &key) const
 
std::string createCollectionName (const std::string &sequenceName) const
 
std::vector< std::string > readSGKeys (const EventContext &context) const
 Read the keys from StoreGate. More...
 
std::set< TrigCompositeUtils::DecisionIDretrieveActiveChainsForKeys (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. More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyArrayType &)
 specialization for handling Gaudi::Property<SG::VarHandleKeyArray> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleType &)
 specialization for handling Gaudi::Property<SG::VarHandleBase> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &t, const SG::NotHandleType &)
 specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray> More...
 

Private Attributes

SG::ReadHandleKey< TrigConf::HLTMenum_HLTMenuKey { this, "HLTTriggerMenu", "DetectorStore+HLTTriggerMenu", "HLT Menu" }
 
std::map< std::string, std::vector< TrigConf::Chain > > m_sequencerToChainMap
 
std::map< std::string, std::vector< std::string > > m_algToSequencersMap
 
std::vector< std::string > m_cachedEventStoreKeys
 
uint64_t m_cachedEventID
 
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default) More...
 
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default) More...
 
std::vector< SG::VarHandleKeyArray * > m_vhka
 
bool m_varHandleArraysDeclared
 

Detailed Description

Provide the reverse mapping: algorithm name to set of chain names.

Definition at line 26 of file AlgToChainTool.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ AlgToChainTool()

TrigCompositeUtils::AlgToChainTool::AlgToChainTool ( const std::string &  type,
const std::string &  name,
const IInterface *  parent 
)

Definition at line 9 of file AlgToChainTool.cxx.

12  : AthAlgTool (type, name, parent)
13  {}

◆ ~AlgToChainTool()

TrigCompositeUtils::AlgToChainTool::~AlgToChainTool ( )
virtual

Definition at line 16 of file AlgToChainTool.cxx.

16 {}

Member Function Documentation

◆ cacheSGKeys()

void TrigCompositeUtils::AlgToChainTool::cacheSGKeys ( const EventContext &  context)

Cache the StoreGate keys.

Definition at line 150 of file AlgToChainTool.cxx.

150  {
151  if (m_cachedEventID != context.eventID().event_number()){
152  ATH_MSG_INFO("Caching the event store keys for event " << context.eventID().event_number());
154  m_cachedEventID = context.eventID().event_number();
155  }
156 }

◆ createCollectionName()

std::string TrigCompositeUtils::AlgToChainTool::createCollectionName ( const std::string &  sequenceName) const
private

Definition at line 292 of file AlgToChainTool.cxx.

292  {
293  std::string filterName = "HLTNav_F" + sequenceName + "__";
294 
295  if (filterName.find("Trig") != std::string::npos){
296  filterName.replace(filterName.find("Trig"), 4, "");
297  }
298 
299  return filterName;
300 }

◆ declareGaudiProperty() [1/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleKeyArrayType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKeyArray>

Definition at line 170 of file AthCommonDataStore.h.

172  {
173  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
174  hndl.value(),
175  hndl.documentation());
176 
177  }

◆ declareGaudiProperty() [2/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleKeyType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158  {
159  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
160  hndl.value(),
161  hndl.documentation());
162 
163  }

◆ declareGaudiProperty() [3/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleBase>

Definition at line 184 of file AthCommonDataStore.h.

186  {
187  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
188  hndl.value(),
189  hndl.documentation());
190  }

◆ declareGaudiProperty() [4/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  t,
const SG::NotHandleType  
)
inlineprivateinherited

specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray>

Definition at line 199 of file AthCommonDataStore.h.

200  {
201  return PBASE::declareProperty(t);
202  }

◆ declareProperty() [1/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleBase hndl,
const std::string &  doc,
const SG::VarHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleBase. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 245 of file AthCommonDataStore.h.

249  {
250  this->declare(hndl.vhKey());
251  hndl.vhKey().setOwner(this);
252 
253  return PBASE::declareProperty(name,hndl,doc);
254  }

◆ declareProperty() [2/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleKey hndl,
const std::string &  doc,
const SG::VarHandleKeyType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleKey. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 221 of file AthCommonDataStore.h.

225  {
226  this->declare(hndl);
227  hndl.setOwner(this);
228 
229  return PBASE::declareProperty(name,hndl,doc);
230  }

◆ declareProperty() [3/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleKeyArray hndArr,
const std::string &  doc,
const SG::VarHandleKeyArrayType  
)
inlineinherited

Definition at line 259 of file AthCommonDataStore.h.

263  {
264 
265  // std::ostringstream ost;
266  // ost << Algorithm::name() << " VHKA declareProp: " << name
267  // << " size: " << hndArr.keys().size()
268  // << " mode: " << hndArr.mode()
269  // << " vhka size: " << m_vhka.size()
270  // << "\n";
271  // debug() << ost.str() << endmsg;
272 
273  hndArr.setOwner(this);
274  m_vhka.push_back(&hndArr);
275 
276  Gaudi::Details::PropertyBase* p = PBASE::declareProperty(name, hndArr, doc);
277  if (p != 0) {
278  p->declareUpdateHandler(&AthCommonDataStore<PBASE>::updateVHKA, this);
279  } else {
280  ATH_MSG_ERROR("unable to call declareProperty on VarHandleKeyArray "
281  << name);
282  }
283 
284  return p;
285 
286  }

◆ declareProperty() [4/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc,
const SG::NotHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This is the generic version, for types that do not derive from SG::VarHandleKey. It just forwards to the base class version of declareProperty.

Definition at line 333 of file AthCommonDataStore.h.

337  {
338  return PBASE::declareProperty(name, property, doc);
339  }

◆ declareProperty() [5/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc = "none" 
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This dispatches to either the generic declareProperty or the one for VarHandle/Key/KeyArray.

Definition at line 352 of file AthCommonDataStore.h.

355  {
356  typedef typename SG::HandleClassifier<T>::type htype;
357  return declareProperty (name, property, doc, htype());
358  }

◆ declareProperty() [6/6]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T > &  t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145  {
146  typedef typename SG::HandleClassifier<T>::type htype;
148  }

◆ detStore()

const ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

95 { return m_detStore; }

◆ evtStore() [1/2]

ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

85 { return m_evtStore; }

◆ evtStore() [2/2]

const ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( ) const
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 90 of file AthCommonDataStore.h.

90 { return m_evtStore; }

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase &  ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ getActiveChainsForAlg()

std::set< std::string > TrigCompositeUtils::AlgToChainTool::getActiveChainsForAlg ( const std::string &  algorithmName,
const EventContext &  context 
) const

Request set of active chains for given algorithm - dynamic lookup (navigation)

Definition at line 90 of file AlgToChainTool.cxx.

90  {
91 
92  std::set<std::string> allActiveChains;
93  try {
94  for ( const std::string& sequenceName : m_algToSequencersMap.at(algorithmName) ) {
95 
96  std::string filterName = createCollectionName(sequenceName);
97  std::set<TrigCompositeUtils::DecisionID> activeChainsInSequence = retrieveActiveChains(context, filterName);
98 
99  for ( const TrigCompositeUtils::DecisionID& id : activeChainsInSequence ) {
100  allActiveChains.insert( HLT::Identifier(id).name() );
101  }
102  }
103 
104  } catch ( const std::out_of_range & ex ) {
105  ATH_MSG_DEBUG ( "Algorithm " << algorithmName << " is not part of the menu!" );
106  }
107 
108  return allActiveChains;
109 }

◆ getAllActiveSequences()

StatusCode TrigCompositeUtils::AlgToChainTool::getAllActiveSequences ( const EventContext &  context,
std::map< std::string, std::string > &  algToSeq 
)

Retrieve algorithms and their active sequences.

Definition at line 112 of file AlgToChainTool.cxx.

112  {
113 
114  // Retrieve EventStore and keys if not cached
115  IProxyDict* storeProxy = Atlas::getExtendedEventContext(context).proxy();
116  SmartIF<SGImplSvc> eventStore (storeProxy);
117  if (m_cachedEventID != context.eventID().event_number()){
118  ATH_MSG_INFO("Caching the event store keys for event " << context.eventID().event_number());
120  m_cachedEventID = context.eventID().event_number();
121  }
122 
124  ATH_CHECK( hltMenuHandle.isValid() );
125  for (const auto& sequence : hltMenuHandle->sequencers()) {
126  std::string filterName = createCollectionName(sequence.first);
127 
128  // Optimize
129  auto foundKey = std::find_if(m_cachedEventStoreKeys.begin(), m_cachedEventStoreKeys.end(), [&](const std::string& key) {
130  return key.starts_with( filterName);
131  });
132 
133  if (foundKey != m_cachedEventStoreKeys.end() ){
134  // Check if sequence passed - if at least one DecisionObject was produced
135  for ( const TrigCompositeUtils::Decision* d : *getDecisionFromStore(eventStore, *foundKey) ) {
136  if (!d->decisions().empty()){
137  // Save algorithm to active sequence mapping
138  for (const std::string& alg : sequence.second) {
139  algToSeq[alg.substr(alg.find('/') + 1, alg.size())] = sequence.first;
140  }
141  break;
142  }
143  }
144  }
145  }
146 
147  return StatusCode::SUCCESS;
148 }

◆ getAllChains()

StatusCode TrigCompositeUtils::AlgToChainTool::getAllChains ( std::vector< TrigConf::Chain > &  chainNames) const

Request all chains from the menu.

Definition at line 57 of file AlgToChainTool.cxx.

57  {
59  ATH_CHECK( hltMenuHandle.isValid() );
60 
61  for ( const TrigConf::Chain& chain : *hltMenuHandle ) {
62  chainNames.push_back(chain);
63  }
64  return StatusCode::SUCCESS;
65 }

◆ getChainInfo()

StatusCode TrigCompositeUtils::AlgToChainTool::getChainInfo ( const EventContext &  context,
TrigCompositeUtils::DecisionID  id,
ChainInfo info 
) const

Retrieve chain information for gived chain id.

Definition at line 239 of file AlgToChainTool.cxx.

239  {
241  ATH_CHECK( hltMenuHandle.isValid() );
242 
243  HLT::Identifier id = HLT::Identifier(decId);
245  id = getIDFromLeg(id);
246  }
247 
248  info.id = id;
249 
250  // Find chain with given id
251  TrigConf::HLTMenu::const_iterator chain = std::find_if(hltMenuHandle->begin(), hltMenuHandle->end(),
252  [&id](const TrigConf::Chain& c) {return c.namehash() == id;}
253  );
254 
255  if(chain == hltMenuHandle->end()){
256  ATH_MSG_WARNING("Chain " << id << " not found in the menu!");
257  info.name = id.name();
258  return StatusCode::SUCCESS;
259  }
260 
261  info.name = (*chain).name();
262  info.groups = (*chain).groups();
263 
264  // Check if chain passed - is in HLTPassRaw collection
265  IProxyDict* storeProxy = Atlas::getExtendedEventContext(context).proxy();
266  SmartIF<SGImplSvc> eventStore (storeProxy);
268 
271  TrigCompositeUtils::decisionIDs( passRaw, chainsID );
272  info.isPassRaw = std::find(chainsID.begin(), chainsID.end(), id) != chainsID.end();
273 
274  return StatusCode::SUCCESS;
275 }

◆ getChainsForAlg()

std::vector< std::string > TrigCompositeUtils::AlgToChainTool::getChainsForAlg ( const std::string &  algorithmName) const

Request set of chains for given algorithm - static lookup (menu)

Definition at line 68 of file AlgToChainTool.cxx.

68  {
69  std::vector<std::string> result;
70 
71  try {
72  for ( const std::string& sequencer : m_algToSequencersMap.at(algorithmName) ) {
73  try {
74  for (const TrigConf::Chain& chain : m_sequencerToChainMap.at(sequencer)){
75  result.push_back(chain.name());
76  }
77  }
78  catch ( const std::out_of_range & ex ) {
79  ATH_MSG_DEBUG ( "Sequence " << sequencer << " is not part of the menu!" );
80  }
81  }
82  } catch ( const std::out_of_range & ex ) {
83  ATH_MSG_DEBUG ( "Algorithm " << algorithmName << " is not part of the menu!" );
84  }
85 
86  return result;
87 }

◆ getChainsForAllAlgs()

StatusCode TrigCompositeUtils::AlgToChainTool::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 at line 212 of file AlgToChainTool.cxx.

212  {
213 
214  // Look for chains which were active for any of the algorithms of the sequence
215  std::map<std::string, std::set<TrigCompositeUtils::DecisionID>> seqToActiveChains;
216  for (const auto& sequence : m_sequencerToChainMap) {
217  // Look for associated filters names with the sequence
218  std::string filterName = createCollectionName(sequence.first);
219  seqToActiveChains[sequence.first] = retrieveActiveChains(context, filterName);
220  }
221 
222  for (const auto& algSeqPair : m_algToSequencersMap){
223  std::set<std::string> activeChains;
224  for (const std::string& sequenceName : algSeqPair.second){
225  // Save all active chains per sequences that algorithm was executed
226  for (TrigCompositeUtils::DecisionID chainId : seqToActiveChains.at(sequenceName)){
227  activeChains.insert(HLT::Identifier(chainId).name());
228  }
229  }
230 
231  algToChain[algSeqPair.first] = activeChains;
232  }
233 
234  return StatusCode::SUCCESS;
235 }

◆ getDecisionFromStore()

SG::ReadHandle< TrigCompositeUtils::DecisionContainer > TrigCompositeUtils::AlgToChainTool::getDecisionFromStore ( SmartIF< SGImplSvc > &  eventStore,
const std::string &  key 
) const
private

Definition at line 278 of file AlgToChainTool.cxx.

278  {
279  SG::DataProxy* dp = eventStore->proxy(
281 
283  if ( !dc.isValid() ) {
284  ATH_MSG_WARNING("Failed to retrieve " << key << " from event store.");
286  }
287 
288  return dc;
289 }

◆ initialize()

StatusCode TrigCompositeUtils::AlgToChainTool::initialize ( )
overridevirtual

Definition at line 19 of file AlgToChainTool.cxx.

19  {
21 
22  return StatusCode::SUCCESS;
23 }

◆ inputHandles()

virtual std::vector<Gaudi::DataHandle*> AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ msg() [1/2]

MsgStream& AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24  {
25  return this->msgStream();
26  }

◆ msg() [2/2]

MsgStream& AthCommonMsg< AlgTool >::msg ( const MSG::Level  lvl) const
inlineinherited

Definition at line 27 of file AthCommonMsg.h.

27  {
28  return this->msgStream(lvl);
29  }

◆ msgLvl()

bool AthCommonMsg< AlgTool >::msgLvl ( const MSG::Level  lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30  {
31  return this->msgLevel(lvl);
32  }

◆ outputHandles()

virtual std::vector<Gaudi::DataHandle*> AthCommonDataStore< AthCommonMsg< AlgTool > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ readSGKeys()

std::vector< std::string > TrigCompositeUtils::AlgToChainTool::readSGKeys ( const EventContext &  context) const
private

Read the keys from StoreGate.

Definition at line 158 of file AlgToChainTool.cxx.

158  {
159  std::vector<std::string> keys;
160  IProxyDict* storeProxy = Atlas::getExtendedEventContext(context).proxy();
161  SmartIF<SGImplSvc> eventStore (storeProxy);
162  eventStore->keys(static_cast<CLID>( ClassID_traits<TrigCompositeUtils::DecisionContainer>::ID() ), keys);
163  return keys;
164 }

◆ renounce()

std::enable_if_t<std::is_void_v<std::result_of_t<decltype(&T::renounce)(T)> > && !std::is_base_of_v<SG::VarHandleKeyArray, T> && std::is_base_of_v<Gaudi::DataHandle, T>, void> AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T &  h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381  {
382  h.renounce();
383  PBASE::renounce (h);
384  }

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364  {
365  handlesArray.renounce();
366  }

◆ retrieveActiveChains()

std::set< TrigCompositeUtils::DecisionID > TrigCompositeUtils::AlgToChainTool::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 at line 166 of file AlgToChainTool.cxx.

166  {
167 
168  if (m_cachedEventID == context.eventID().event_number()) {
169  return retrieveActiveChainsForKeys(context, collectionName, m_cachedEventStoreKeys);
170  } else {
171  const std::vector<std::string> keys = readSGKeys(context);
172  return retrieveActiveChainsForKeys(context, collectionName, keys);
173  }
174 }

◆ retrieveActiveChainsForKeys()

std::set< TrigCompositeUtils::DecisionID > TrigCompositeUtils::AlgToChainTool::retrieveActiveChainsForKeys ( const EventContext &  context,
const std::string &  collectionName,
const std::vector< std::string > &  keys 
) const
private

Request set of chains for given navigation collection and list of StoreGate keys.

Definition at line 177 of file AlgToChainTool.cxx.

177  {
178  std::set<TrigCompositeUtils::DecisionID> activeChainsID;
179 
180  // Retrieve EventStore and keys if not cached
181  IProxyDict* storeProxy = Atlas::getExtendedEventContext(context).proxy();
182  SmartIF<SGImplSvc> eventStore (storeProxy);
183 
184  // Retrieve active chains name hashes
185  for ( const std::string& key : keys ) {
186 
187  // Look for given collection
188  if ( !collectionName.empty() && (!key.starts_with( collectionName)) ){
189  continue;
190  }
191 
192  // Get data from any nav collection
193  if( collectionName.empty() && (!key.starts_with( "HLTNav") || key == "HLTNav_Summary") ) {
194  continue;
195  }
196 
197  for ( const TrigCompositeUtils::Decision* d : *getDecisionFromStore(eventStore, key) ) {
199  TrigCompositeUtils::decisionIDs( d, chainsID );
200 
201  // Save the active chains IDs
202  for (TrigCompositeUtils::DecisionID id : chainsID){
203  activeChainsID.insert(TrigCompositeUtils::getIDFromLeg(id));
204  }
205  }
206  }
207 
208  return activeChainsID;
209 }

◆ start()

StatusCode TrigCompositeUtils::AlgToChainTool::start ( )
overridevirtual

Definition at line 26 of file AlgToChainTool.cxx.

26  {
28  ATH_CHECK( hltMenuHandle.isValid() );
29  m_sequencerToChainMap.clear();
30  m_algToSequencersMap.clear();
31 
32  // Fill the maps
33  for ( const TrigConf::Chain& chain : *hltMenuHandle ) {
34  for ( const std::string& sequencer : chain.sequencers() ) {
35  // Skip empty steps = empty sequencers in the list
36  if (sequencer.empty()) continue;
37  m_sequencerToChainMap[sequencer].push_back(chain);
38  }
39  }
40 
41  for ( const auto& sequencer : hltMenuHandle->sequencers() ) {
42  for ( const std::string& algorithm : sequencer.second ) {
43  // PassFilter is for empty steps - will never be associated with a chain
44  if (algorithm.starts_with( "PassFilter")) continue;
45 
46  // Save just second part of algorithm ex. RoRSeqFilter/FFastCaloElectron -> FFastCaloElectron
47  m_algToSequencersMap[algorithm.substr(algorithm.find('/') + 1)]
48  .push_back(sequencer.first);
49  }
50  }
51 
52  m_cachedEventID = 0; // Revet the cache identifier
53 
54  return StatusCode::SUCCESS;
55 }

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in DerivationFramework::CfAthAlgTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and asg::AsgMetadataTool.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase &  )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308  {
309  // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310  // << " size: " << m_vhka.size() << endmsg;
311  for (auto &a : m_vhka) {
312  std::vector<SG::VarHandleKey*> keys = a->keys();
313  for (auto k : keys) {
314  k->setOwner(this);
315  }
316  }
317  }

Member Data Documentation

◆ m_algToSequencersMap

std::map<std::string, std::vector<std::string> > TrigCompositeUtils::AlgToChainTool::m_algToSequencersMap
private

Definition at line 74 of file AlgToChainTool.h.

◆ m_cachedEventID

uint64_t TrigCompositeUtils::AlgToChainTool::m_cachedEventID
private

Definition at line 77 of file AlgToChainTool.h.

◆ m_cachedEventStoreKeys

std::vector<std::string> TrigCompositeUtils::AlgToChainTool::m_cachedEventStoreKeys
private

Definition at line 76 of file AlgToChainTool.h.

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_HLTMenuKey

SG::ReadHandleKey<TrigConf::HLTMenu> TrigCompositeUtils::AlgToChainTool::m_HLTMenuKey { this, "HLTTriggerMenu", "DetectorStore+HLTTriggerMenu", "HLT Menu" }
private

Definition at line 71 of file AlgToChainTool.h.

◆ m_sequencerToChainMap

std::map<std::string, std::vector<TrigConf::Chain> > TrigCompositeUtils::AlgToChainTool::m_sequencerToChainMap
private

Definition at line 73 of file AlgToChainTool.h.

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files:
grepfile.info
info
Definition: grepfile.py:38
TrigCompositeUtils::AlgToChainTool::m_cachedEventID
uint64_t m_cachedEventID
Definition: AlgToChainTool.h:77
TileDCSDataPlotter.dp
dp
Definition: TileDCSDataPlotter.py:840
algorithm
std::string algorithm
Definition: hcg.cxx:82
SGout2dot.alg
alg
Definition: SGout2dot.py:243
get_generator_info.result
result
Definition: get_generator_info.py:21
runLayerRecalibration.chain
chain
Definition: runLayerRecalibration.py:175
TrigCompositeUtils::DecisionID
unsigned int DecisionID
Definition: TrigComposite_v1.h:27
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
AthCommonDataStore::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
hist_file_dump.d
d
Definition: hist_file_dump.py:137
AthenaPoolTestRead.sequenceName
sequenceName
Definition: AthenaPoolTestRead.py:23
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
Definition: AthCommonDataStore.h:390
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
std::vector< SG::VarHandleKeyArray * > m_vhka
Definition: AthCommonDataStore.h:398
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
IProxyDict
A proxy dictionary.
Definition: AthenaKernel/AthenaKernel/IProxyDict.h:47
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
IDTPMcnv.htype
htype
Definition: IDTPMcnv.py:27
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition: ReadCondHandle.h:270
Atlas::getExtendedEventContext
const ExtendedEventContext & getExtendedEventContext(const EventContext &ctx)
Retrieve an extended context from a context object.
Definition: ExtendedEventContext.cxx:32
TrigCompositeUtils::getTerminusNode
const Decision * getTerminusNode(SG::ReadHandle< DecisionContainer > &container)
Definition: TrigCompositeUtilsRoot.cxx:243
TrigCompositeUtils::AlgToChainTool::m_HLTMenuKey
SG::ReadHandleKey< TrigConf::HLTMenu > m_HLTMenuKey
Definition: AlgToChainTool.h:71
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
AthCommonDataStore
Definition: AthCommonDataStore.h:52
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
TrigCompositeUtils::AlgToChainTool::m_algToSequencersMap
std::map< std::string, std::vector< std::string > > m_algToSequencersMap
Definition: AlgToChainTool.h:74
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
ClassID_traits
Default, invalid implementation of ClassID_traits.
Definition: Control/AthenaKernel/AthenaKernel/ClassID_traits.h:40
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
xAOD::TrigComposite_v1
Class used to describe composite objects in the HLT.
Definition: TrigComposite_v1.h:52
TrigCompositeUtils::AlgToChainTool::createCollectionName
std::string createCollectionName(const std::string &sequenceName) const
Definition: AlgToChainTool.cxx:292
CLID
uint32_t CLID
The Class ID type.
Definition: Event/xAOD/xAODCore/xAODCore/ClassID_traits.h:47
HLT::Identifier
Definition: TrigCompositeUtils/TrigCompositeUtils/HLTIdentifier.h:20
TrigConf::HLTMenu::begin
const_iterator begin() const
Begin of the HLT chains list.
Definition: HLTMenu.cxx:51
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
AthAlgTool::AthAlgTool
AthAlgTool()
Default constructor:
SG::VarHandleKeyArray::renounce
virtual void renounce()=0
TrigConf::ConstIter
Forward iterator over an iterable of type V returning an object of type T.
Definition: ConstIter.h:32
SG::HandleClassifier::type
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
Definition: HandleClassifier.h:54
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:220
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:221
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
TrigConf::HLTMenu::sequencers
std::map< std::string, std::vector< std::string > > sequencers() const
Accessor to the sequencers.
Definition: HLTMenu.cxx:80
TrigCompositeUtils::isLegId
bool isLegId(const HLT::Identifier &legIdentifier)
Recognise whether the chain ID is a leg ID.
Definition: TrigCompositeUtilsRoot.cxx:204
a
TList * a
Definition: liststreamerinfos.cxx:10
TrigCompositeUtils::DecisionIDContainer
std::set< DecisionID > DecisionIDContainer
Definition: TrigComposite_v1.h:28
h
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
TrigCompositeUtils::decisionIDs
void decisionIDs(const Decision *d, DecisionIDContainer &destination)
Extracts DecisionIDs stored in the Decision object.
Definition: TrigCompositeUtilsRoot.cxx:67
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:623
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
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:798
TrigCompositeUtils::getIDFromLeg
HLT::Identifier getIDFromLeg(const HLT::Identifier &legIdentifier)
Generate the HLT::Identifier which corresponds to the chain name from the leg name.
Definition: TrigCompositeUtilsRoot.cxx:180
TrigCompositeUtils::AlgToChainTool::m_cachedEventStoreKeys
std::vector< std::string > m_cachedEventStoreKeys
Definition: AlgToChainTool.h:76
TrigConf::Chain
HLT chain configuration.
Definition: TrigConfData/TrigConfData/HLTChain.h:18
SG::DataProxy
Definition: DataProxy.h:44
python.compressB64.c
def c
Definition: compressB64.py:93
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
TrigConf::HLTMenu::end
const_iterator end() const
End of the HLT chains list.
Definition: HLTMenu.cxx:57
TrigCompositeUtils::AlgToChainTool::readSGKeys
std::vector< std::string > readSGKeys(const EventContext &context) const
Read the keys from StoreGate.
Definition: AlgToChainTool.cxx:158
fitman.k
k
Definition: fitman.py:528
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37