ATLAS Offline Software
TrigCompositeUtilsRoot.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // See similar workaround the lack of CLID in standalone releases in TrigComposite_v1.h
7 
11 
13 
14 #include <unordered_map>
15 #include <regex>
16 #include <iomanip> // std::setfill
17 #include <mutex>
18 
19 static const SG::AuxElement::Accessor< std::vector<TrigCompositeUtils::DecisionID> > readWriteAccessor("decisions");
20 static const SG::AuxElement::ConstAccessor< std::vector<TrigCompositeUtils::DecisionID> > readOnlyAccessor("decisions");
21 
22 
23 
24 namespace TrigCompositeUtils {
25 
26  ANA_MSG_SOURCE (msgFindLink, "TrigCompositeUtils.findLink")
28 
29 
30  SG::WriteHandle<DecisionContainer> createAndStore( const SG::WriteHandleKey<DecisionContainer>& key, const EventContext& ctx ) {
32  auto data = std::make_unique<DecisionContainer>() ;
33  auto aux = std::make_unique<DecisionAuxContainer>() ;
34  data->setStore( aux.get() );
35  handle.record( std::move( data ), std::move( aux ) ).ignore();
36  return handle;
37  }
38 
40  auto data = std::make_unique<DecisionContainer>() ;
41  auto aux = std::make_unique<DecisionAuxContainer>() ;
42  data->setStore( aux.get() );
43  handle.record( std::move( data ), std::move( aux ) ).ignore();
44  }
45 
46  Decision* newDecisionIn ( DecisionContainer* dc, const std::string& name) {
47  Decision * x = new Decision;
48  dc->push_back( x );
49  if ( ! name.empty() ) {
50  x->setName( name );
51  }
52  return x;
53  }
54 
55  Decision* newDecisionIn ( DecisionContainer* dc, const Decision* dOld, const std::string& name, const EventContext& ctx ) {
56  Decision* dNew = newDecisionIn( dc, name );
57  linkToPrevious(dNew, dOld, ctx); // Sets up link to 'seed' collection, points to dOld
58  return dNew;
59  }
60 
62  std::vector<DecisionID>& decisions = readWriteAccessor( *d );
63  if ( decisions.size() == 0 or decisions.back() != id)
64  decisions.push_back( id );
65  }
66 
67  void decisionIDs( const Decision* d, DecisionIDContainer& destination ) {
68  const std::vector<DecisionID>& decisions = readOnlyAccessor( *d );
69  destination.insert( decisions.begin(), decisions.end() );
70  }
71 
72  const std::vector<DecisionID>& decisionIDs( const Decision* d ) {
73  return readOnlyAccessor( *d );
74  }
75 
76  std::vector<DecisionID>& decisionIDs( Decision* d ) {
77  return readWriteAccessor( *d );
78  }
79 
81  DecisionIDContainer srcIds;
82  decisionIDs( src, srcIds ); // Now stored in a set
83  insertDecisionIDs( srcIds, dest);
84  }
85 
87  DecisionIDContainer collateIDs;
88  // Decision are xAOD objects backed by a std::vector
89  // Here we use a std::set to de-duplicate IDs from src and dest before setting dest
90  decisionIDs( dest, collateIDs ); // Set operation 1. Get from dest
91  collateIDs.insert( src.begin(), src.end() ); // Set operation 2. Get from src
92  decisionIDs( dest ).clear(); // Clear target
93  // Copy from set to (ordered) vector
94  decisionIDs( dest ).insert( decisionIDs(dest).end(), collateIDs.begin(), collateIDs.end() );
95  }
96 
98  // Re-use above insertDecisionIDs method.
99  // This implicitly performs de-duplication
100  return insertDecisionIDs(dest, dest);
101  }
102 
103  bool allFailed( const Decision* d ) {
104  const std::vector<DecisionID>& decisions = readOnlyAccessor( *d );
105  return decisions.empty();
106  }
107 
109  for ( DecisionID id : readOnlyAccessor( *d ) ) {
110  if ( required.find( id ) != required.end() ) {
111  return true;
112  }
113  }
114  return false;
115  }
116 
117  bool passed( DecisionID id, const DecisionIDContainer& idSet ) {
118  return idSet.find( id ) != idSet.end();
119  }
120 
121 #if !defined(XAOD_STANDALONE) && !defined(XAOD_ANALYSIS) // Full athena
123  const DecisionContainer* container = dynamic_cast<const DecisionContainer*>( d->container() );
124  if( ! container ) {
125  throw std::runtime_error("TrigCompositeUtils::convertToElementLink Using convertToElementLink(d) requires that the Decision d is already in a container");
126  }
127  return ElementLink<DecisionContainer>(*container, d->index(), ctx);
128  }
129 #else // Analysis or Standalone
130  ElementLink<DecisionContainer> decisionToElementLink(const Decision* d, const EventContext&) {
131  const DecisionContainer* container = dynamic_cast<const DecisionContainer*>( d->container() );
132  if( ! container ) {
133  throw std::runtime_error("TrigCompositeUtils::convertToElementLink Using convertToElementLink(d) requires that the Decision d is already in a container");
134  }
135  return ElementLink<DecisionContainer>(*container, d->index());
136  }
137 #endif
138 
139  void linkToPrevious( Decision* d, const std::string& previousCollectionKey, size_t previousIndex ) {
140  ElementLink<DecisionContainer> seed = ElementLink<DecisionContainer>( previousCollectionKey, previousIndex );
141  if (!seed.isValid()) {
142  throw std::runtime_error("TrigCompositeUtils::linkToPrevious Invalid Decision Link key or index provided");
143  } else {
144  d->addObjectCollectionLink(seedString(), seed);
145  }
146  }
147 
148  void linkToPrevious( Decision* d, const Decision* dOld, const EventContext& ctx ) {
149  d->addObjectCollectionLink(seedString(), decisionToElementLink(dOld, ctx));
150  }
151 
152  bool hasLinkToPrevious( const Decision* d ) {
153  return d->hasObjectCollectionLinks( seedString() );
154  }
155 
156  const std::vector<ElementLink<DecisionContainer>> getLinkToPrevious( const Decision* d ) {
157  return d->objectCollectionLinks<DecisionContainer>( seedString() );
158  }
159 
160 
161  bool copyLinks(const Decision* src, Decision* dest) {
162  return dest->copyAllLinksFrom(src);
163  }
164 
165 
166  HLT::Identifier createLegName(const HLT::Identifier& chainIdentifier, size_t counter) {
167  const std::string& name = chainIdentifier.name();
168  if (!isChainId(name)) {
169  throw std::runtime_error("TrigCompositeUtils::createLegName chainIdentifier '"+chainIdentifier.name()+"' does not start 'HLT_'");
170  }
171  if (counter > 999) {
172  throw std::runtime_error("TrigCompositeUtils::createLegName Leg counters above 999 are invalid.");
173  }
174  std::stringstream legStringStream;
175  legStringStream << "leg" << std::setfill('0') << std::setw(3) << counter << "_" << name;
176  return HLT::Identifier( legStringStream.str() );
177  }
178 
179 
181  const std::string& name = legIdentifier.name();
182  if (isChainId(name)){
183  return legIdentifier;
184  } else if (isLegId(name)){
185  return HLT::Identifier(name.substr(7));
186  } else{
187  throw std::runtime_error("TrigCompositeUtils::getIDFromLeg legIdentifier '"+name+"' does not start with 'HLT_' or 'leg' ");
188  }
189  }
190 
191  int32_t getIndexFromLeg(const HLT::Identifier& legIdentifier) {
192  return getIndexFromLeg(legIdentifier.name());
193  }
194 
195  int32_t getIndexFromLeg(const std::string& name) {
196  if (isChainId(name)){
197  return 0;
198  } else if (!isLegId(name)) {
199  return -1;
200  }
201  return std::stoi( name.substr(3,3) );
202  }
203 
204  bool isLegId(const HLT::Identifier& legIdentifier) {
205  return isLegId(legIdentifier.name());
206  }
207 
208  bool isLegId(const std::string& name) {
209  return (name.rfind("leg", 0) != std::string::npos);
210  }
211 
212  bool isChainId(const HLT::Identifier& chainIdentifier) {
213  return isChainId(chainIdentifier.name());
214  }
215 
216  bool isChainId(const std::string& name) {
217  return (name.rfind("HLT_", 0) != std::string::npos);
218  }
219 
220 
221  const Decision* find( const Decision* start, const std::function<bool( const Decision* )>& filter ) {
222  if ( filter( start ) ) return start;
223 
224  if ( hasLinkToPrevious(start) ) {
225  const std::vector<ElementLink<DecisionContainer>> seeds = getLinkToPrevious(start);
226  for (const ElementLink<DecisionContainer>& seedEL : seeds) {
227  const Decision* result = find( *seedEL, filter );
228  if (result) return result;
229  }
230  }
231 
232  return nullptr;
233  }
234 
235  bool HasObject::operator()( const Decision* composite ) const {
236  return composite->hasObjectLink( m_name );
237  }
238 
239  bool HasObjectCollection::operator()( const Decision* composite ) const {
240  return composite->hasObjectCollectionLinks( m_name );
241  }
242 
244  return getTerminusNode(*container);
245  }
246 
247  const Decision* getTerminusNode(const DecisionContainer& container) {
248  return getNodeByName(container, summaryPassNodeName());
249  }
250 
252  return getNodeByName(container, summaryPassExpressNodeName());
253  }
254 
255  const Decision* getNodeByName(const DecisionContainer& container, const std::string& nodeName) {
256  const auto it = std::find_if(container.begin(), container.end(), [&nodeName](const Decision* d){return d->name()==nodeName;});
257  if (it==container.end()) {return nullptr;}
258  return *it;
259  }
260 
261  std::vector<const Decision*> getRejectedDecisionNodes(const asg::EventStoreType* eventStore,
262  const std::string& summaryCollectionKey,
263  const DecisionIDContainer& ids,
264  const std::set<std::string>& keysToIgnore) {
265 
266  // The following list contains all known summary store identifiers where the graph nodes are spread out over O(100s) or O(1000s)
267  // of different SG collections. This is the raw output from running the trigger online.
268  // When dealing with this, we need to query eventStore->keys in every event to obtain the full set of collections to process.
269  static const std::vector<std::string> knownDistributedSummaryStores{
270  "HLTNav_Summary",
271  "_HLTNav_Summary"
272  };
273 
274  // The following list contains all known summary store identifiers where all nodes from the graph have been compactified / condensed
275  // down into a single container. Here we just have to search this one container.
276  static const std::vector<std::string> knownCompactSummaryStores{"HLTNav_Summary_OnlineSlimmed",
277  "HLTNav_Summary_ESDSlimmed",
278  "HLTNav_Summary_AODSlimmed",
279  "HLTNav_Summary_DAODSlimmed",
280  "HLTNav_R2ToR3Summary"
281  };
282 
283  std::vector<std::string> keys; // The SG keys we will be exploring to find rejected decision nodes
284 
285  if (std::find(knownDistributedSummaryStores.cbegin(), knownDistributedSummaryStores.cend(), summaryCollectionKey) != knownDistributedSummaryStores.end() or summaryCollectionKey == "") {
286 
287  // If we have a distributed store then we need to query SG to find all keys.
288  // This should be a rare case now that we run compactification "online" (i.e. immediately after the trigger has executed)
289 #ifndef XAOD_STANDALONE
290  // The list of containers we need to read can change on a file-by-file basis (it depends on the SMK)
291  // Hence we query SG for all collections rather than maintain a large and ever changing ReadHandleKeyArray
292  eventStore->keys(static_cast<CLID>( ClassID_traits< DecisionContainer >::ID() ), keys);
293 #else
294  eventStore->event(); // Avoid unused warning
295  throw std::runtime_error("Cannot obtain rejected HLT features in AnalysisBase when reading from uncompactified navigation containers, run trigger navigation slimming first if you really need this.");
296 #endif
297 
298  } else if (std::find(knownCompactSummaryStores.cbegin(), knownCompactSummaryStores.cend(), summaryCollectionKey) != knownCompactSummaryStores.end()) {
299 
300  keys.push_back(summaryCollectionKey);
301 
302  } else {
303 
304  using namespace msgRejected;
305  ANA_MSG_WARNING("getRejectedDecisionNodes has not been told about final collection " << summaryCollectionKey << " please update this function. Assuming that it is already compact.");
306  // Safest to assume that this is a compact summary store
307  keys.push_back(summaryCollectionKey);
308 
309  }
310 
311  std::vector<const Decision*> output; // The return vector of identified nodes where one of the chains in 'ids' was rejected
312 
313  // Loop over each DecisionContainer,
314  for (const std::string& key : keys) {
315  // Get and check this container
316  if ( ! (key.starts_with( "HLTNav_") || key.starts_with("_HLTNav_")) ) {
317  continue; // Only concerned about the decision containers which make up the navigation, they have name prefix of HLTNav (or _HLTNav for transient-only mode)
318  }
319  if (keysToIgnore.count(key) == 1) {
320  continue; // Have been asked to not explore this SG container
321  }
323  if (!containerRH.isValid()) {
324  throw std::runtime_error("Unable to retrieve " + key + " from event store.");
325  }
326 
327  for (const Decision* d : *containerRH) {
328  if ( not (d->name() == hypoAlgNodeName() or d->name() == comboHypoAlgNodeName()) ) {
329  continue; // Only want Decision objects created by HypoAlgs or ComboHypoAlgs
330  }
331  const std::vector<ElementLink<DecisionContainer>> mySeeds = d->objectCollectionLinks<DecisionContainer>(seedString());
332  if (mySeeds.size() == 0) {
333  continue;
334  }
335  const bool allSeedsValid = std::all_of(mySeeds.begin(), mySeeds.end(), [](const ElementLink<DecisionContainer>& s) { return s.isValid(); });
336  if (!allSeedsValid) {
337  using namespace msgRejected;
338  ANA_MSG_WARNING("A Decision object in " << key << " has invalid seeds. "
339  << "The trigger navigation information is incomplete. Skipping this Decision object.");
340  continue;
341  }
342 
343  DecisionIDContainer activeChainsIntoThisDecision;
344  decisionIDs(*(mySeeds.at(0)), activeChainsIntoThisDecision); // Get list of active chains from the first parent
345  if (mySeeds.size() > 1) {
346  for (size_t i = 1; i < mySeeds.size(); ++i) {
347  // If there are more than one parent, we only want to keep the intersection of all of the seeds
348  DecisionIDContainer moreActiveChains;
349  decisionIDs(*(mySeeds.at(i)), moreActiveChains);
351  std::set_intersection(activeChainsIntoThisDecision.begin(), activeChainsIntoThisDecision.end(),
352  moreActiveChains.begin(), moreActiveChains.end(),
353  std::inserter(intersection, intersection.begin()));
354  activeChainsIntoThisDecision = intersection; // Update the output to only be the intersection and continue to any other seeds
355  }
356  }
357  // We now know what chains were active coming into this Decision (d) from ALL seeds
358  // This is the logic required for each HypoTool to have activated and checked if its chain passes
359  // So the size of activeChainsIntoThisDecision corresponds to the number of HypoTools which will have run
360  // What do we care about? A chain, or all chains?
361  DecisionIDContainer chainsToCheck;
362  if (ids.size() == 0) { // We care about *all* chains
363  chainsToCheck = activeChainsIntoThisDecision;
364  } else { // We care about specified chains
365  chainsToCheck = ids;
366  }
367  // We have found a rejected decision node *iff* a chainID to check is *not* present here
368  // I.e. the HypoTool for the chain returned a NEGATIVE decision
369  DecisionIDContainer activeChainsPassedByThisDecision;
370  decisionIDs(d, activeChainsPassedByThisDecision);
371  for (const DecisionID checkID : chainsToCheck) {
372  if (activeChainsPassedByThisDecision.find(checkID) == activeChainsPassedByThisDecision.end() && // I was REJECTED here ...
373  activeChainsIntoThisDecision.count(checkID) == 1) { // ... but PASSSED by all my inputs
374  output.push_back(d);
375  break;
376  }
377  }
378  }
379  }
380  return output;
381  }
382 
384  const Decision* comingFrom,
385  NavGraph& navGraph,
386  std::set<const Decision*>& fullyExploredFrom,
387  const DecisionIDContainer& ids,
388  const bool enforceDecisionOnNode) {
389 
390  // Does this Decision satisfy the chain requirement?
391  if (enforceDecisionOnNode && ids.size() != 0 && !isAnyIDPassing(node, ids)) {
392  return; // Stop propagating down this leg. It does not concern the chain with DecisionID = id
393  }
394 
395  // This Decision object is part of this path through the Navigation
396  navGraph.addNode(node, comingFrom);
397 
398 #if TRIGCOMPUTILS_ENABLE_EARLY_EXIT == 1
399  // Note we have to do this check here (after calling addNode) rather than just before calling recursiveGetDecisionsInternal
400  if (fullyExploredFrom.count(node) == 1) {
401  // We have fully explored this branch
402  return;
403  }
404 #endif
405 
406  // Continue to the path(s) by looking at this Decision object's seed(s)
407  if ( hasLinkToPrevious(node) ) {
408  // Do the recursion
410  const Decision* seedDecision = *(seed); // Dereference ElementLink
411  // Sending true as final parameter for enforceDecisionOnStartNode as we are recursing away from the supplied start node
412  recursiveGetDecisionsInternal(seedDecision, node, navGraph, fullyExploredFrom, ids, /*enforceDecisionOnNode*/ true);
413  }
414  }
415 
416  // Have fully explored down from this point
417  fullyExploredFrom.insert(node);
418 
419  return;
420  }
421 
423  NavGraph& navGraph,
424  const DecisionIDContainer& ids,
425  const bool enforceDecisionOnStartNode) {
426 
427  std::set<const Decision*> fullyExploredFrom;
428  // Note: we do not require navGraph to be an empty graph. We can extend it.
429  recursiveGetDecisionsInternal(start, /*comingFrom*/nullptr, navGraph, fullyExploredFrom, ids, enforceDecisionOnStartNode);
430 
431  return;
432  }
433 
434 
436  const bool keepOnlyFinalFeatures,
437  const bool removeEmptySteps,
438  const std::vector<std::string>& nodesToDrop)
439  {
440  std::set<NavGraphNode*> fullyExploredFrom;
441  for (NavGraphNode* finalNode : graph.finalNodes()) {
442  recursiveFlagForThinningInternal(finalNode, /*modeKeep*/true, fullyExploredFrom, keepOnlyFinalFeatures, removeEmptySteps, nodesToDrop);
443  }
444  }
445 
446 
448  bool modeKeep,
449  std::set<NavGraphNode*>& fullyExploredFrom,
450  const bool keepOnlyFinalFeatures,
451  const bool removeEmptySteps,
452  const std::vector<std::string>& nodesToDrop)
453  {
454 
455  // If modeKeep == true, then by default we are KEEPING the nodes as we walk up the navigation (towards L1),
456  // otherwise by default we are THINNING the nodes
457  bool keep = modeKeep;
458 
459  // The calls to node->node() here are going from the transient NavGraphNode
460  // to the underlying const Decision* from the input collection. Cache these in local stack vars for better readability.
461 
462  const Decision* const me = node->node();
463  const Decision* const myFirstParent = (node->seeds().size() ? node->seeds().at(0)->node() : nullptr);
464  const Decision* const myFirstChild = (node->children().size() ? node->children().at(0)->node() : nullptr);
465 
466  // KEEP Section: The following code blocks may override the modeKeep default by setting keep=True for this node.
467 
468  if (keepOnlyFinalFeatures) {
469  // Check if we have reached the first feature
470  if ( modeKeep == true && me->hasObjectLink(featureString()) ) {
471  // Just to be explicit, we keep this node
472  keep = true;
473 
474  // Special BLS case: The bphysics object is attached exceptionally at the ComboHypo.
475  // We want to keep going up one more level in this case to get the Feature node too (we save the 4-vec of the BPhys and both of the muons/electrons)
476  const bool specialBphysCase = (me->name() == comboHypoAlgNodeName());
477 
478  // Special R2->R3 case: We can get steps with dummy features, these feature links point back to the same node.
479  // First check again the feature, with an addition requirement on the feature CLID. Then check if the feature points back to the node.
480  const bool specialR2toR3Case = (me->hasObjectLink(featureString(), ClassID_traits<DecisionContainer>::ID()) && me->object<Decision>(featureString()) == me);
481 
482  // We change the default behaviour to be modeKeep = false (unless we want to explore up one more level for BLS's special case
483  // or to the next feature for the R2->R3 special case) such that by default we start to NOT flag all the parent nodes to be kept
484  if (!specialBphysCase && !specialR2toR3Case) {
485  modeKeep = false;
486  }
487  }
488  }
489 
490  // We always by default keep the initial node from the HLTSeeding, but this may be overridden below by nodesToDrop
491  if (me->name() == hltSeedingNodeName()) {
492  keep = true;
493  }
494 
495  // DROP Section: The following code blocks may override both the current modeKeep default and the above KEEP section by setting keep=False for this node.
496 
497  // Check also against NodesToDrop
498  for (const std::string& toDrop : nodesToDrop) {
499  if (me->name() == toDrop) {
500  keep = false;
501  break;
502  }
503  }
504 
505  // Check against RemoveEmptySteps
506  // The signature we look for here is a InputMaker node connected directly to a ComboHypo node
507  // The key thing to identify is NO intermediate Hypo node
508  // This structure is created in Steps where some chain legs are running reconstruction, but other legs are idle - either due to
509  // menu alignment, or due to the legs being of different length.
510  // For passed chains, there is little point keeping these CH and IM nodes on the idle legs. So we have the option of slimming them here.
511  // First for the ComboHypo ...
512  if (removeEmptySteps && me->name() == comboHypoAlgNodeName() && myFirstParent && myFirstParent->name() == inputMakerNodeName()) {
513  keep = false;
514  }
515  // ... and also for the InputMaker, with flipped logic.
516  if (removeEmptySteps && me->name() == inputMakerNodeName() && myFirstChild && myFirstChild->name() == comboHypoAlgNodeName()) {
517  keep = false;
518  }
519 
520  // Check against RemoveEmptySteps
521  // Check for the R2->R3 empty step case
522  if (removeEmptySteps
523  && me->name() == hypoAlgNodeName()
525  && me->object<Decision>(featureString()) == me)
526  {
527  keep = false;
528  }
529  // ... and also for the InputMaker
530  if (removeEmptySteps
531  && me->name() == inputMakerNodeName()
532  && myFirstChild
533  && myFirstChild->name() == hypoAlgNodeName()
535  && myFirstChild->object<Decision>(featureString()) == myFirstChild)
536  {
537  keep = false;
538  }
539 
540  // APPLICATION Section:
541 
542  if (keep) {
543  node->keep(); // Inform the node that it should NOT be thinned away.
544  }
545 
546  for (NavGraphNode* seed : node->seeds()) {
547 #if TRIGCOMPUTILS_ENABLE_EARLY_EXIT == 1
548  // NOTE: This code block cuts short the recursive graph exploration for any node which has already been fully-explored-from.
549  //
550  // If we are keeping final features, then processing each node exactly once is actually insufficient.
551  // This is because we may reach a node, X, with a feature which is penultimate/generally-non-final for some chain, A,
552  // but then later on we may follow Terminus->SummaryFilter->Hypothesis(X) for some chain, B, where this same
553  // feature from X _is_ the final-feature for chain B. Here we would not process node X again as we have already dealt with it.
554  // But we need to process it again as for chain B, modeKeep==true still and chain B wants to flag the node as keep().
555  //
556  // We only however need to force the exploration while we are in the mode where we are nominally keeping nodes (modeKeep == true).
557  // Once we have switched to dropping nodes by default, we should be OK to once again skip over nodes which we already processed.
558  // The only thing we should be keeping when modeKeep == false is the L1 node, any this is not dependent on path.
559  //
560  // See: ATR-28061
561  bool allowEarlyExit = true;
562  if (keepOnlyFinalFeatures) {
563  allowEarlyExit = (modeKeep == false);
564  }
565  if (allowEarlyExit && fullyExploredFrom.count(seed) == 1) {
566  // We have fully explored this branch
567  continue;
568  }
569 #endif
570  // Recursively call all the way up the graph to the initial nodes from the HLTSeeding
571  recursiveFlagForThinningInternal(seed, modeKeep, fullyExploredFrom, keepOnlyFinalFeatures, removeEmptySteps, nodesToDrop);
572  }
573 
574  // Have fully explored down from this point
575  fullyExploredFrom.insert(node);
576  }
577 
578  // Note: This version of the function recurses through a full navigation graph (initial input: Decision Object)
580  const std::string& linkName,
581  std::vector<sgkey_t>& keyVec,
582  std::vector<uint32_t>& clidVec,
583  std::vector<Decision::index_type>& indexVec,
584  std::vector<const Decision*>& sourceVec,
585  const unsigned int behaviour,
586  std::set<const Decision*>* fullyExploredFrom)
587  {
588  using namespace msgFindLink;
589 
590  // As the append vectors are user-supplied, perform some input validation.
591  if (keyVec.size() != clidVec.size() or clidVec.size() != indexVec.size()) {
592  ANA_MSG_WARNING("In typelessFindLinks, keyVec, clidVec, indexVec must all be the same size. Instead have:"
593  << keyVec.size() << ", " << clidVec.size() << ", " << indexVec.size());
594  return false;
595  }
596 
597  // Locate named links. Both collections of links and individual links are supported.
598  bool found = typelessFindLinksCommonLinkCollection(start, linkName, keyVec, clidVec, indexVec, sourceVec);
599 
600  // Early exit
601  if (found && behaviour == TrigDefs::lastFeatureOfType) {
602  return true;
603  }
604  // If not Early Exit, then recurse
606 #if TRIGCOMPUTILS_ENABLE_EARLY_EXIT == 1
607  if (fullyExploredFrom != nullptr) {
608  // We only need to recursively explore back from each node in the graph once.
609  // We can keep a record of nodes which we have already explored, these we can safely skip over.
610  if (fullyExploredFrom->count(*seed) == 1) {
611  continue;
612  }
613  }
614 #endif
615  found |= typelessFindLinks(*seed, linkName, keyVec, clidVec, indexVec, sourceVec, behaviour, fullyExploredFrom);
616  }
617  // Fully explored this node
618  if (fullyExploredFrom != nullptr) {
619  fullyExploredFrom->insert(start);
620  }
621  return found;
622  }
623 
624  // Note: This version of the function recurses through a sub-graph of the full navigation graph (initial input: NavGraphNode)
626  const std::string& linkName,
627  std::vector<sgkey_t>& keyVec,
628  std::vector<uint32_t>& clidVec,
629  std::vector<Decision::index_type>& indexVec,
630  std::vector<const Decision*>& sourceVec,
631  const unsigned int behaviour,
632  std::set<const Decision*>* fullyExploredFrom)
633  {
634  using namespace msgFindLink;
635 
636  // As the append vectors are user-supplied, perform some input validation.
637  if (keyVec.size() != clidVec.size() or clidVec.size() != indexVec.size()) {
638  ANA_MSG_WARNING("In typelessFindLinks, keyVec, clidVec, indexVec must all be the same size. Instead have:"
639  << keyVec.size() << ", " << clidVec.size() << ", " << indexVec.size());
640  return false;
641  }
642 
643  const Decision* start_decisionObject = start->node();
644  // Locate named links. Both collections of links and individual links are supported.
645  bool found = typelessFindLinksCommonLinkCollection(start_decisionObject, linkName, keyVec, clidVec, indexVec, sourceVec);
646 
647  // Early exit
648  if (found && behaviour == TrigDefs::lastFeatureOfType) {
649  return true;
650  }
651  // If not Early Exit, then recurse
652  for (const NavGraphNode* seed : start->seeds()) {
653 #if TRIGCOMPUTILS_ENABLE_EARLY_EXIT == 1
654  if (fullyExploredFrom != nullptr) {
655  // We only need to recursively explore back from each node in the graph once.
656  // We can keep a record of nodes which we have already explored, these we can safely skip over.
657  const Decision* seed_decisionObject = seed->node();
658  if (fullyExploredFrom->count(seed_decisionObject) == 1) {
659  continue;
660  }
661  }
662 #endif
663  found |= typelessFindLinks(seed, linkName, keyVec, clidVec, indexVec, sourceVec, behaviour, fullyExploredFrom);
664  }
665  // Fully explored this node
666  if (fullyExploredFrom != nullptr) {
667  fullyExploredFrom->insert(start_decisionObject);
668  }
669  return found;
670  }
671 
672 
674  const std::string& linkName,
675  std::vector<sgkey_t>& keyVec,
676  std::vector<uint32_t>& clidVec,
677  std::vector<Decision::index_type>& indexVec,
678  std::vector<const Decision*>& sourceVec)
679  {
680  bool found = false;
681  std::vector<sgkey_t> tmpKeyVec;
682  std::vector<uint32_t> tmpClidVec;
683  std::vector<Decision::index_type> tmpIndexVec;
684  if (start->hasObjectCollectionLinks(linkName)) {
685  found = start->typelessGetObjectCollectionLinks(linkName, tmpKeyVec, tmpClidVec, tmpIndexVec);
686  }
687  if (start->hasObjectLink(linkName)) {
688  sgkey_t tmpKey{0};
689  uint32_t tmpClid{0};
690  Decision::index_type tmpIndex{0};
691  found |= start->typelessGetObjectLink(linkName, tmpKey, tmpClid, tmpIndex);
692  tmpKeyVec.push_back(tmpKey);
693  tmpClidVec.push_back(tmpClid);
694  tmpIndexVec.push_back(tmpIndex);
695  }
696  // De-duplicate
697  for (size_t tmpi = 0; tmpi < tmpKeyVec.size(); ++tmpi) {
698  bool alreadyAdded = false;
699  const uint32_t tmpKey = tmpKeyVec.at(tmpi);
700  const uint32_t tmpClid = tmpClidVec.at(tmpi);
701  const Decision::index_type tmpIndex = tmpIndexVec.at(tmpi);
702  for (size_t veci = 0; veci < keyVec.size(); ++veci) {
703  if (SG::sgkeyEqual (keyVec.at(veci), tmpKey)
704  and clidVec.at(veci) == tmpClid
705  and indexVec.at(veci) == tmpIndex)
706  {
707  alreadyAdded = true;
708  break;
709  }
710  }
711  if (!alreadyAdded) {
712  keyVec.push_back( tmpKey );
713  clidVec.push_back( tmpClid );
714  indexVec.push_back( tmpIndex );
715  sourceVec.push_back( start );
716  }
717  }
718  return found;
719  }
720 
721 
722 
724  const std::string& linkName,
725  sgkey_t& key,
726  uint32_t& clid,
728  const Decision*& source,
729  const bool suppressMultipleLinksWarning)
730  {
731  using namespace msgFindLink;
732  // We use findLink in cases where there is only one link to be found, or if there are multiple then we
733  // only want the most recent.
734  // Hence we can supply TrigDefs::lastFeatureOfType. /--> parent3(link)
735  // We can still have more then one link found if there is a branch in the navigation. E.g. start --> parent1 --> parent2(link)
736  // If both parent2 and parent3 possessed an admissible ElementLink, then the warning below will trigger, and only one of the
737  // links will be returned (whichever of parent2 or parent3 happened to be the first seed of parent1).
738  std::vector<sgkey_t> keyVec;
739  std::vector<uint32_t> clidVec;
740  std::vector<Decision::index_type> indexVec;
741  std::vector<const Decision*> sourceVec;
742  std::set<const xAOD::TrigComposite*> fullyExploredFrom;
743 
744  const bool result = typelessFindLinks(start, linkName, keyVec, clidVec, indexVec, sourceVec, TrigDefs::lastFeatureOfType, &fullyExploredFrom);
745  if (!result) {
746  return false; // Nothing found
747  }
748 
749  if (keyVec.size() > 1 && !suppressMultipleLinksWarning) {
750  ANA_MSG_WARNING (keyVec.size() << " typeless links found for " << linkName
751  << " returning the first link, consider using findLinks.");
752  }
753  key = keyVec.at(0);
754  clid = clidVec.at(0);
755  index = indexVec.at(0);
756  source = sourceVec.at(0);
757  return true;
758  }
759 
760 
761  bool typelessFindLink(const NavGraph& subGraph,
762  const std::string& linkName,
763  sgkey_t& key,
764  uint32_t& clid,
766  const Decision*& source,
767  const bool suppressMultipleLinksWarning)
768  {
769  using namespace msgFindLink;
770  // Note: This function should be the same as its predecessor, just using a NavGraph to start rather than a Decision*
771  // As a result, it can search from more than one Decision* (the NavGraph may have more than one final node)
772  // but it will still warn if this results in more than one link being located.
773  std::vector<sgkey_t> keyVec;
774  std::vector<uint32_t> clidVec;
775  std::vector<Decision::index_type> indexVec;
776  std::vector<const Decision*> sourceVec;
777  std::set<const Decision*> fullyExploredFrom;
778 
779  bool result = false;
780  for (const NavGraphNode* finalNode : subGraph.finalNodes()) {
781  result |= typelessFindLinks(finalNode, linkName, keyVec, clidVec, indexVec, sourceVec, TrigDefs::lastFeatureOfType, &fullyExploredFrom);
782  }
783 
784  if (!result) {
785  return false; // Nothing found
786  }
787 
788  if (keyVec.size() > 1 && !suppressMultipleLinksWarning) {
789  ANA_MSG_WARNING (keyVec.size() << " typeless links found for " << linkName
790  << " returning the first link, consider using findLinks.");
791  }
792  key = keyVec.at(0);
793  clid = clidVec.at(0);
794  index = indexVec.at(0);
795  source = sourceVec.at(0);
796  return true;
797  }
798 
799 
801  const std::string& chainName,
802  const std::vector<LinkInfo<xAOD::IParticleContainer>>& features,
803  const std::vector<std::size_t>& legMultiplicities,
804  const std::function<bool(const std::vector<LinkInfo<xAOD::IParticleContainer>>&)>& filter)
805  {
807  combinations.reserve(legMultiplicities.size());
808  if (legMultiplicities.size() == 1)
809  combinations.addLeg(legMultiplicities.at(0), features);
810  else
811  for (std::size_t legIdx = 0; legIdx < legMultiplicities.size(); ++legIdx)
812  {
813  // Skip any that will not provide IParticle features
814  if (legMultiplicities[legIdx] == 0)
815  continue;
817  std::vector<LinkInfo<xAOD::IParticleContainer>> legFeatures;
818  for (const LinkInfo<xAOD::IParticleContainer>& info : features)
819  if (passed(legID.numeric(), info.decisions))
820  legFeatures.push_back(info);
821  combinations.addLeg(legMultiplicities.at(legIdx), std::move(legFeatures));
822  }
823  return combinations;
824  }
825 
826 
828  const std::string& chainName,
829  const std::vector<LinkInfo<xAOD::IParticleContainer>>& features,
830  const std::vector<std::size_t>& legMultiplicities,
832  {
833  return buildCombinations(chainName, features, legMultiplicities, getFilter(filter));
834  }
835 
837  const std::string& chainName,
838  const std::vector<LinkInfo<xAOD::IParticleContainer>>& features,
839  const TrigConf::HLTChain *chainInfo,
840  const std::function<bool(const std::vector<LinkInfo<xAOD::IParticleContainer>>&)>& filter)
841  {
842  return buildCombinations(chainName, features, chainInfo->leg_multiplicities(), filter);
843  }
844 
846  const std::string& chainName,
847  const std::vector<LinkInfo<xAOD::IParticleContainer>>& features,
848  const TrigConf::HLTChain *chainInfo,
850  {
851  return buildCombinations(chainName, features, chainInfo, getFilter(filter));
852  }
853 
854 
855  std::string dump( const Decision* tc, const std::function< std::string( const Decision* )>& printerFnc ) {
856  std::string ret;
857  ret += printerFnc( tc );
858  if ( hasLinkToPrevious(tc) ) {
859  const std::vector<ElementLink<DecisionContainer>> seeds = getLinkToPrevious(tc);
860  for (const ElementLink<DecisionContainer>& seedEL : seeds) {
861  ret += " -> " + dump( *seedEL, printerFnc );
862  }
863  }
864  return ret;
865  }
866 
867 
868  const std::string& initialRoIString() {
870  }
871 
872  const std::string& initialRecRoIString() {
874  }
875 
876  const std::string& roiString() {
877  return Decision::s_roiString;
878  }
879 
880  const std::string& viewString() {
881  return Decision::s_viewString;
882  }
883 
884  const std::string& featureString() {
886  }
887 
888  const std::string& seedString() {
889  return Decision::s_seedString;
890  }
891 
892  const std::string& hltSeedingNodeName(){
894  }
895 
896  const std::string& filterNodeName(){
898  }
899 
900  const std::string& inputMakerNodeName(){
902  }
903 
904  const std::string& hypoAlgNodeName(){
906  }
907 
908  const std::string& comboHypoAlgNodeName(){
910  }
911 
912  const std::string& summaryFilterNodeName(){
914  }
915 
916  const std::string& summaryPassNodeName(){
918  }
919 
920  const std::string& summaryPassExpressNodeName(){
922  }
923 
924  const std::string& summaryPrescaledNodeName(){
926  }
927 
928 }
929 
grepfile.info
info
Definition: grepfile.py:38
WriteHandle.h
Handle class for recording to StoreGate.
TrigCompositeUtils::summaryPrescaledNodeName
const std::string & summaryPrescaledNodeName()
Definition: TrigCompositeUtilsRoot.cxx:924
TrigCompositeUtils::buildCombinations
Combinations buildCombinations(const std::string &chainName, const std::vector< LinkInfo< xAOD::IParticleContainer >> &features, const std::vector< std::size_t > &legMultiplicities, const std::function< bool(const std::vector< LinkInfo< xAOD::IParticleContainer >> &)> &filter)
Produce the combinations for a set of features.
Definition: TrigCompositeUtilsRoot.cxx:800
TrigCompositeUtils::summaryFilterNodeName
const std::string & summaryFilterNodeName()
Definition: TrigCompositeUtilsRoot.cxx:912
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
TrigCompositeUtils::find
const Decision * find(const Decision *start, const std::function< bool(const Decision *)> &filter)
traverses Decision object links for another Decision object fulfilling the prerequisite specified by ...
Definition: TrigCompositeUtilsRoot.cxx:221
get_generator_info.result
result
Definition: get_generator_info.py:21
TrigCompositeUtils::DecisionID
unsigned int DecisionID
Definition: TrigComposite_v1.h:27
SG
Forward declaration.
Definition: CaloCellPacker_400_500.h:32
TrigCompositeUtils::DecisionContainer
xAOD::TrigCompositeContainer DecisionContainer
Definition: Event/xAOD/xAODTrigger/xAODTrigger/TrigCompositeContainer.h:21
TrigCompositeUtils::passed
bool passed(DecisionID id, const DecisionIDContainer &idSet)
checks if required decision ID is in the set of IDs in the container
Definition: TrigCompositeUtilsRoot.cxx:117
TrigCompositeUtils::recursiveGetDecisions
void recursiveGetDecisions(const Decision *start, NavGraph &navGraph, const DecisionIDContainer &ids, const bool enforceDecisionOnStartNode)
Search back in time from "node" and locate all paths back through Decision objects for a given chain.
Definition: TrigCompositeUtilsRoot.cxx:422
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
TrigCompositeUtils.h
TrigCompositeUtils::summaryPassExpressNodeName
const std::string & summaryPassExpressNodeName()
Definition: TrigCompositeUtilsRoot.cxx:920
HLT::Identifier::numeric
TrigCompositeUtils::DecisionID numeric() const
numeric ID
Definition: TrigCompositeUtils/TrigCompositeUtils/HLTIdentifier.h:47
TrigCompositeUtils::hltSeedingNodeName
const std::string & hltSeedingNodeName()
Definition: TrigCompositeUtilsRoot.cxx:892
SG::Accessor
Helper class to provide type-safe access to aux data.
Definition: Control/AthContainers/AthContainers/Accessor.h:68
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
TrigCompositeUtils::HasObjectCollection::operator()
bool operator()(const Decision *) const
checks if the arg Decision object has link collection of name specified at construction
Definition: TrigCompositeUtilsRoot.cxx:239
WriteCellNoiseToCool.src
src
Definition: WriteCellNoiseToCool.py:513
TrigCompositeUtils::newDecisionIn
Decision * newDecisionIn(DecisionContainer *dc, const std::string &name)
Helper method to create a Decision object, place it in the container and return a pointer to it.
Definition: TrigCompositeUtilsRoot.cxx:46
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
index
Definition: index.py:1
hist_file_dump.d
d
Definition: hist_file_dump.py:137
TrigCompositeUtils::NavGraph::finalNodes
const std::vector< NavGraphNode * > & finalNodes() const
Get all final nodes.
Definition: NavGraph.cxx:100
TrigCompositeUtils::hypoAlgNodeName
const std::string & hypoAlgNodeName()
Definition: TrigCompositeUtilsRoot.cxx:904
TrigCompositeUtils::addDecisionID
void addDecisionID(DecisionID id, Decision *d)
Appends the decision (given as ID) to the decision object.
Definition: TrigCompositeUtilsRoot.cxx:61
mergePhysValFiles.start
start
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:14
xAOD::TrigComposite_v1::hasObjectLink
bool hasObjectLink(const std::string &name, const CLID clid=CLID_NULL) const
Check if a link to an object with a given name and type exists. CLID_NULL to not check type.
Definition: TrigComposite_v1.cxx:246
skel.it
it
Definition: skel.GENtoEVGEN.py:396
xAOD::TrigComposite_v1::object
const OBJECT * object(const std::string &name) const
Get a bare pointer with the requested name.
xAOD::TrigComposite_v1::s_featureString
static const std::string s_featureString
Constant used to identify a feature.
Definition: TrigComposite_v1.h:254
TrigCompositeUtils::typelessFindLinksCommonLinkCollection
bool typelessFindLinksCommonLinkCollection(const Decision *start, const std::string &linkName, std::vector< sgkey_t > &keyVec, std::vector< uint32_t > &clidVec, std::vector< Decision::index_type > &indexVec, std::vector< const Decision * > &sourceVec)
Common functionality shared by both typelessFindLinks interfaces Returns true if at least one link wa...
Definition: TrigCompositeUtilsRoot.cxx:673
TrigCompositeUtils::insertDecisionIDs
void insertDecisionIDs(const Decision *src, Decision *dest)
Appends the decision IDs of src to the dest decision object.
Definition: TrigCompositeUtilsRoot.cxx:80
TrigCompositeUtils::comboHypoAlgNodeName
const std::string & comboHypoAlgNodeName()
Definition: TrigCompositeUtilsRoot.cxx:908
TrigCompositeUtils::createAndStore
SG::WriteHandle< DecisionContainer > createAndStore(const SG::WriteHandleKey< DecisionContainer > &key, const EventContext &ctx)
Creates and right away records the DecisionContainer with the key.
Definition: TrigCompositeUtilsRoot.cxx:30
TrigCompositeUtils::NavGraph::addNode
void addNode(const Decision *node, const Decision *comingFrom=nullptr)
Add a new NavGraphNode which shadows the xAOD Decision object "node" from the full navigation graph.
Definition: NavGraph.cxx:78
TrigCompositeUtils::initialRecRoIString
const std::string & initialRecRoIString()
Definition: TrigCompositeUtilsRoot.cxx:872
perfmonmt-printer.dest
dest
Definition: perfmonmt-printer.py:189
SG::ConstAccessor
Helper class to provide constant type-safe access to aux data.
Definition: ConstAccessor.h:55
xAOD::TrigComposite_v1::s_seedString
static const std::string s_seedString
Constant used to identify a seed (parent)
Definition: TrigComposite_v1.h:256
xAOD::TrigComposite_v1::hasObjectCollectionLinks
bool hasObjectCollectionLinks(const std::string &collectionName, const CLID clid=CLID_NULL) const
Check if links exist to a collection of objects with given name and type. CLID_NULL to not check type...
Definition: TrigComposite_v1.cxx:275
xAOD::TrigComposite_v1::s_initialRoIString
static const std::string s_initialRoIString
Constant used to identify an initial ROI from L1.
Definition: TrigComposite_v1.h:246
TrigCompositeUtils::recursiveFlagForThinningInternal
void recursiveFlagForThinningInternal(NavGraphNode *node, bool modeKeep, std::set< NavGraphNode * > &fullyExploredFrom, const bool keepOnlyFinalFeatures, const bool removeEmptySteps, const std::vector< std::string > &nodesToDrop)
Used by recursiveFlagForThinning.
Definition: TrigCompositeUtilsRoot.cxx:447
const
bool const RAWDATA *ch2 const
Definition: LArRodBlockPhysicsV0.cxx:560
TrigConf::HLTChain
HLT chain configuration information.
Definition: TrigConfHLTData/TrigConfHLTData/HLTChain.h:35
StoreGateSvc::keys
void keys(std::vector< std::string > &vkeys, bool includeAlias=false, bool onlyValid=true) const
provide list of all StoreGate keys associated with an object.
x
#define x
TrigCompositeUtils::HasObject::m_name
std::string m_name
Definition: TrigCompositeUtils/TrigCompositeUtils/TrigCompositeUtils.h:285
intersection
std::vector< std::string > intersection(std::vector< std::string > &v1, std::vector< std::string > &v2)
Definition: compareFlatTrees.cxx:25
TrigConf::HLTChain::leg_multiplicities
const std::vector< size_t > & leg_multiplicities() const
Definition: TrigConfHLTData/TrigConfHLTData/HLTChain.h:82
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
TrigCompositeUtils::HasObjectCollection::m_name
std::string m_name
Definition: TrigCompositeUtils/TrigCompositeUtils/TrigCompositeUtils.h:303
xAOD::TrigComposite_v1::s_hypoAlgNodeNameString
static const std::string s_hypoAlgNodeNameString
Constant used to identify a navigation graph node as being from a Hypo Alg.
Definition: TrigComposite_v1.h:265
covarianceTool.filter
filter
Definition: covarianceTool.py:514
TrigCompositeUtils::HasObject::operator()
bool operator()(const Decision *) const
checks if the arg TC has link of name specified at construction
Definition: TrigCompositeUtilsRoot.cxx:235
TrigCompositeUtils::FilterType
FilterType
Definition: IPartCombItr.h:22
xAOD::TrigComposite_v1::s_summaryPassNodeNameString
static const std::string s_summaryPassNodeNameString
Constant used to identify the single terminus graph node the end point of all chains which accept the...
Definition: TrigComposite_v1.h:273
TrigCompositeUtils::getTerminusNode
const Decision * getTerminusNode(SG::ReadHandle< DecisionContainer > &container)
Definition: TrigCompositeUtilsRoot.cxx:243
ClassID_traits::ID
static const CLID & ID()
the CLID of T
Definition: Control/AthenaKernel/AthenaKernel/ClassID_traits.h:50
StoreGateSvc
The Athena Transient Store API.
Definition: StoreGateSvc.h:125
xAOD::TrigComposite_v1::s_comboHypoAlgNodeNameString
static const std::string s_comboHypoAlgNodeNameString
Constant used to identify a navigation graph node as being from a Combo Hypo Alg.
Definition: TrigComposite_v1.h:267
lumiFormat.i
int i
Definition: lumiFormat.py:85
TrigCompositeUtils::getRejectedDecisionNodes
std::vector< const Decision * > getRejectedDecisionNodes(const asg::EventStoreType *eventStore, const std::string &summaryCollectionKey, const DecisionIDContainer &ids, const std::set< std::string > &keysToIgnore)
Query all DecisionCollections in the event store, locate all Decision nodes in the graph where an obj...
Definition: TrigCompositeUtilsRoot.cxx:261
TrigCompositeUtils::initialRoIString
const std::string & initialRoIString()
Definition: TrigCompositeUtilsRoot.cxx:868
ReadCalibFromCool.keep
keep
Definition: ReadCalibFromCool.py:85
TrigCompositeUtils::getLinkToPrevious
const std::vector< ElementLink< DecisionContainer > > getLinkToPrevious(const Decision *d)
returns links to previous decision object 'seed'
Definition: TrigCompositeUtilsRoot.cxx:156
TrigCompositeUtils::typelessFindLinks
bool typelessFindLinks(const Decision *start, const std::string &linkName, std::vector< sgkey_t > &keyVec, std::vector< uint32_t > &clidVec, std::vector< Decision::index_type > &indexVec, std::vector< const Decision * > &sourceVec, const unsigned int behaviour, std::set< const Decision * > *fullyExploredFrom)
search back the TC links for the object of type T linked to the one of TC (recursively) Returns the l...
Definition: TrigCompositeUtilsRoot.cxx:579
TrigCompositeUtils::getExpressTerminusNode
const Decision * getExpressTerminusNode(const DecisionContainer &container)
Returns the express-accept navigation node from a collection or nullptr if missing.
Definition: TrigCompositeUtilsRoot.cxx:251
xAOD::TrigComposite_v1::s_filterNodeNameString
static const std::string s_filterNodeNameString
Constant used to identify a navigation graph node as being from a Filter.
Definition: TrigComposite_v1.h:261
IParticleContainer.h
ClassID_traits
Default, invalid implementation of ClassID_traits.
Definition: Control/AthenaKernel/AthenaKernel/ClassID_traits.h:40
ANA_MSG_WARNING
#define ANA_MSG_WARNING(xmsg)
Macro printing warning messages.
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:292
TrigCompositeUtils::copyLinks
bool copyLinks(const Decision *src, Decision *dest)
copy all links from src to dest TC objects
Definition: TrigCompositeUtilsRoot.cxx:161
TrigCompositeUtils::decisionToElementLink
ElementLink< DecisionContainer > decisionToElementLink(const Decision *d, const EventContext &ctx)
Takes a raw pointer to a Decision and returns an ElementLink to the Decision.
Definition: TrigCompositeUtilsRoot.cxx:122
xAOD::TrigComposite_v1::s_summaryFilterNodeNameString
static const std::string s_summaryFilterNodeNameString
Constant used to identify a navigation graph node as being from a final Filter created by the Decisio...
Definition: TrigComposite_v1.h:270
TrigCompositeUtils::NavGraph
Structure to hold a transient Directed Acyclic Graph (DAG) structure. NavGraph is populated from,...
Definition: NavGraph.h:111
node::node
node()
Definition: memory_hooks-stdcmalloc.h:76
TrigCompositeUtils::Combinations
Definition: Combinations.h:18
xAOD::TrigComposite_v1
Class used to describe composite objects in the HLT.
Definition: TrigComposite_v1.h:52
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
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
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
xAOD::decisions
decisions
Definition: TrigComposite_v1.cxx:101
xAOD::TrigComposite_v1::s_hltSeedingNodeNameString
static const std::string s_hltSeedingNodeNameString
Constant used to identify a navigation graph node as being from the HLTSeeding.
Definition: TrigComposite_v1.h:259
perfmonmt-printer.required
required
Definition: perfmonmt-printer.py:184
merge.output
output
Definition: merge.py:17
TrigCompositeUtils::featureString
const std::string & featureString()
Definition: TrigCompositeUtilsRoot.cxx:884
TrigCompositeUtils::isChainId
bool isChainId(const HLT::Identifier &chainIdentifier)
Recognise whether the HLT identifier corresponds to a whole chain.
Definition: TrigCompositeUtilsRoot.cxx:212
ANA_MSG_SOURCE
#define ANA_MSG_SOURCE(NAME, TITLE)
the source code part of ANA_MSG_SOURCE
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:133
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
python.subdetectors.mmg.ids
ids
Definition: mmg.py:8
ReadHandle.h
Handle class for reading from StoreGate.
TrigCompositeUtils::Decision
xAOD::TrigComposite Decision
Definition: Event/xAOD/xAODTrigger/xAODTrigger/TrigComposite.h:20
xAOD::TrigComposite_v1::index_type
uint32_t index_type
Definition: TrigComposite_v1.h:56
xAOD::TrigComposite_v1::s_initialRecRoIString
static const std::string s_initialRecRoIString
Constant used to identify an initial HLT ROI derived from L1.
Definition: TrigComposite_v1.h:248
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
TrigCompositeUtils::summaryPassNodeName
const std::string & summaryPassNodeName()
Definition: TrigCompositeUtilsRoot.cxx:916
TrigCompositeUtils::getFilter
std::function< bool(const std::vector< LinkInfo< xAOD::IParticleContainer >> &)> getFilter(FilterType filter)
Get a lambda corresponding to the specified FilterType enum.
Definition: IPartCombItr.cxx:69
TrigCompositeUtils::createLegName
HLT::Identifier createLegName(const HLT::Identifier &chainIdentifier, size_t counter)
Generate the HLT::Identifier which corresponds to a specific leg of a given chain.
Definition: TrigCompositeUtilsRoot.cxx:166
TrigCompositeUtils::hasLinkToPrevious
bool hasLinkToPrevious(const Decision *d)
checks if there is at least one 'seed' link to previous object
Definition: TrigCompositeUtilsRoot.cxx:152
python.combo.combinations
def combinations(items, n)
Definition: combo.py:85
TrigCompositeUtils::filterNodeName
const std::string & filterNodeName()
Definition: TrigCompositeUtilsRoot.cxx:896
xAOD::TrigComposite_v1::name
const std::string & name() const
Get a human-readable name for the object.
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
TrigCompositeUtils::linkToPrevious
void linkToPrevious(Decision *d, const std::string &previousCollectionKey, size_t previousIndex)
Links to the previous object, location of previous 'seed' decision supplied by hand.
Definition: TrigCompositeUtilsRoot.cxx:139
TrigCompositeUtils::seedString
const std::string & seedString()
Definition: TrigCompositeUtilsRoot.cxx:888
TrigCompositeUtils::isLegId
bool isLegId(const HLT::Identifier &legIdentifier)
Recognise whether the chain ID is a leg ID.
Definition: TrigCompositeUtilsRoot.cxx:204
TrigCompositeUtils::LinkInfo< xAOD::IParticleContainer >
TrigCompositeUtils::getIndexFromLeg
int32_t getIndexFromLeg(const HLT::Identifier &legIdentifier)
Extract the numeric index of a leg identifier.
Definition: TrigCompositeUtilsRoot.cxx:191
TrigCompositeUtils::DecisionIDContainer
std::set< DecisionID > DecisionIDContainer
Definition: TrigComposite_v1.h:28
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
CondAlgsOpts.found
int found
Definition: CondAlgsOpts.py:101
TrigCompositeUtils::sgkey_t
SG::sgkey_t sgkey_t
Definition: TrigCompositeUtils/TrigCompositeUtils/TrigCompositeUtils.h:45
TrigCompositeUtils::NavGraphNode
Transient utility class to represent a node in a graph (m_decisionObject), and a vector of edges (m_f...
Definition: NavGraph.h:20
python.TriggerAPI.TriggerAPISession.chainName
chainName
Definition: TriggerAPISession.py:426
TrigCompositeUtils::allFailed
bool allFailed(const Decision *d)
return true if there is no positive decision stored
Definition: TrigCompositeUtilsRoot.cxx:103
TrigCompositeUtils::decisionIDs
void decisionIDs(const Decision *d, DecisionIDContainer &destination)
Extracts DecisionIDs stored in the Decision object.
Definition: TrigCompositeUtilsRoot.cxx:67
HLT::Identifier::name
std::string name() const
reports human redable name if it is enabled or, empty string
Definition: HLTIdentifier.cxx:14
TrigCompositeUtils::recursiveFlagForThinning
void recursiveFlagForThinning(NavGraph &graph, const bool keepOnlyFinalFeatures, const bool removeEmptySteps, const std::vector< std::string > &nodesToDrop)
Used by trigger navigation thinning.
Definition: TrigCompositeUtilsRoot.cxx:435
TrigCompositeUtils::dump
std::string dump(const Decision *tc, const std::function< std::string(const Decision *)> &printerFnc)
Prints the Decision object including the linked seeds @warnign expensive call.
Definition: TrigCompositeUtilsRoot.cxx:855
TrigCompositeUtils
Definition: Event/xAOD/xAODTrigger/xAODTrigger/TrigComposite.h:19
TrigCompositeUtils::roiString
const std::string & roiString()
Definition: TrigCompositeUtilsRoot.cxx:876
xAOD::TrigComposite_v1::s_viewString
static const std::string s_viewString
Constant used to identify a view.
Definition: TrigComposite_v1.h:252
copySelective.source
string source
Definition: copySelective.py:32
TrigCompositeUtils::getNodeByName
const Decision * getNodeByName(const DecisionContainer &container, const std::string &nodeName)
Returns the navigation node with a given name from a collection or nullptr if missing.
Definition: TrigCompositeUtilsRoot.cxx:255
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
xAOD::TrigComposite_v1::s_inputMakerNodeNameString
static const std::string s_inputMakerNodeNameString
Constant used to identify a navigation graph node as being from a Input Maker.
Definition: TrigComposite_v1.h:263
xAOD::TrigComposite_v1::s_summaryPrescaledNodeNameString
static const std::string s_summaryPrescaledNodeNameString
Constant used to identify the single prescaled graph node.
Definition: TrigComposite_v1.h:279
TrigCompositeUtils::uniqueDecisionIDs
void uniqueDecisionIDs(Decision *dest)
Make unique list of decision IDs of dest Decision object.
Definition: TrigCompositeUtilsRoot.cxx:97
xAOD::TrigComposite_v1::s_summaryPassExpressNodeNameString
static const std::string s_summaryPassExpressNodeNameString
Constant used to identify the single express-accept graph node.
Definition: TrigComposite_v1.h:276
test_pyathena.counter
counter
Definition: test_pyathena.py:15
set_intersection
Set * set_intersection(Set *set1, Set *set2)
Perform an intersection of two sets.
TrigCompositeUtils::isAnyIDPassing
bool isAnyIDPassing(const Decision *d, const DecisionIDContainer &required)
Checks if any of the DecisionIDs passed in arg required is availble in Decision object.
Definition: TrigCompositeUtilsRoot.cxx:108
TrigCompositeUtils::viewString
const std::string & viewString()
Definition: TrigCompositeUtilsRoot.cxx:880
SG::sgkeyEqual
constexpr bool sgkeyEqual(const sgkey_t a, const sgkey_t b)
Compare two sgkeys for equality.
Definition: CxxUtils/CxxUtils/sgkey_t.h:39
node
Definition: memory_hooks-stdcmalloc.h:74
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
AuxElement.h
Base class for elements of a container that can have aux data.
TrigCompositeUtils::inputMakerNodeName
const std::string & inputMakerNodeName()
Definition: TrigCompositeUtilsRoot.cxx:900
TrigCompositeUtils::recursiveGetDecisionsInternal
void recursiveGetDecisionsInternal(const Decision *node, const Decision *comingFrom, NavGraph &navGraph, std::set< const Decision * > &fullyExploredFrom, const DecisionIDContainer &ids, const bool enforceDecisionOnNode)
Used by recursiveGetDecisions.
Definition: TrigCompositeUtilsRoot.cxx:383
xAOD::TrigComposite_v1::s_roiString
static const std::string s_roiString
Constant used to identify an (explicitly) updated HLT ROI.
Definition: TrigComposite_v1.h:250
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37
TrigCompositeUtils::typelessFindLink
bool typelessFindLink(const Decision *start, const std::string &linkName, sgkey_t &key, uint32_t &clid, Decision::index_type &index, const Decision *&source, const bool suppressMultipleLinksWarning)
Perform a recursive search for ElementLinks of any time and name 'linkName', starting from Decision o...
Definition: TrigCompositeUtilsRoot.cxx:723