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  const EventContext& ctx,
387  std::set<const Decision*>& fullyExploredFrom,
388  const DecisionIDContainer& ids,
389  const bool enforceDecisionOnNode) {
390 
391  // Does this Decision satisfy the chain requirement?
392  if (enforceDecisionOnNode && ids.size() != 0 && !isAnyIDPassing(node, ids)) {
393  return; // Stop propagating down this leg. It does not concern the chain with DecisionID = id
394  }
395 
396  // This Decision object is part of this path through the Navigation
397  navGraph.addNode(node, ctx, comingFrom);
398 
399 #if TRIGCOMPUTILS_ENABLE_EARLY_EXIT == 1
400  // Note we have to do this check here (after calling addNode) rather than just before calling recursiveGetDecisionsInternal
401  if (fullyExploredFrom.count(node) == 1) {
402  // We have fully explored this branch
403  return;
404  }
405 #endif
406 
407  // Continue to the path(s) by looking at this Decision object's seed(s)
408  if ( hasLinkToPrevious(node) ) {
409  // Do the recursion
411  const Decision* seedDecision = *(seed); // Dereference ElementLink
412  // Sending true as final parameter for enforceDecisionOnStartNode as we are recursing away from the supplied start node
413  recursiveGetDecisionsInternal(seedDecision, node, navGraph, ctx, fullyExploredFrom, ids, /*enforceDecisionOnNode*/ true);
414  }
415  }
416 
417  // Have fully explored down from this point
418  fullyExploredFrom.insert(node);
419 
420  return;
421  }
422 
424  NavGraph& navGraph,
425  const EventContext& ctx,
426  const DecisionIDContainer& ids,
427  const bool enforceDecisionOnStartNode) {
428 
429  std::set<const Decision*> fullyExploredFrom;
430  // Note: we do not require navGraph to be an empty graph. We can extend it.
431  recursiveGetDecisionsInternal(start, /*comingFrom*/nullptr, navGraph, ctx, fullyExploredFrom, ids, enforceDecisionOnStartNode);
432 
433  return;
434  }
435 
436 
438  const bool keepOnlyFinalFeatures,
439  const bool removeEmptySteps,
440  const std::vector<std::string>& nodesToDrop)
441  {
442  std::set<NavGraphNode*> fullyExploredFrom;
443  for (NavGraphNode* finalNode : graph.finalNodes()) {
444  recursiveFlagForThinningInternal(finalNode, /*modeKeep*/true, fullyExploredFrom, keepOnlyFinalFeatures, removeEmptySteps, nodesToDrop);
445  }
446  }
447 
448 
450  bool modeKeep,
451  std::set<NavGraphNode*>& fullyExploredFrom,
452  const bool keepOnlyFinalFeatures,
453  const bool removeEmptySteps,
454  const std::vector<std::string>& nodesToDrop)
455  {
456 
457  // If modeKeep == true, then by default we are KEEPING the nodes as we walk up the navigation (towards L1),
458  // otherwise by default we are THINNING the nodes
459  bool keep = modeKeep;
460 
461  // The calls to node->node() here are going from the transient NavGraphNode
462  // to the underlying const Decision* from the input collection. Cache these in local stack vars for better readability.
463 
464  const Decision* const me = node->node();
465  const Decision* const myFirstParent = (node->seeds().size() ? node->seeds().at(0)->node() : nullptr);
466  const Decision* const myFirstChild = (node->children().size() ? node->children().at(0)->node() : nullptr);
467 
468  // KEEP Section: The following code blocks may override the modeKeep default by setting keep=True for this node.
469 
470  if (keepOnlyFinalFeatures) {
471  // Check if we have reached the first feature
472  if ( modeKeep == true && me->hasObjectLink(featureString()) ) {
473  // Just to be explicit, we keep this node
474  keep = true;
475 
476  // Special BLS case: The bphysics object is attached exceptionally at the ComboHypo.
477  // 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)
478  const bool specialBphysCase = (me->name() == comboHypoAlgNodeName());
479 
480  // Special R2->R3 case: We can get steps with dummy features, these feature links point back to the same node.
481  // First check again the feature, with an addition requirement on the feature CLID. Then check if the feature points back to the node.
482  const bool specialR2toR3Case = (me->hasObjectLink(featureString(), ClassID_traits<DecisionContainer>::ID()) && me->object<Decision>(featureString()) == me);
483 
484  // We change the default behaviour to be modeKeep = false (unless we want to explore up one more level for BLS's special case
485  // 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
486  if (!specialBphysCase && !specialR2toR3Case) {
487  modeKeep = false;
488  }
489  }
490  }
491 
492  // We always by default keep the initial node from the HLTSeeding, but this may be overridden below by nodesToDrop
493  if (me->name() == hltSeedingNodeName()) {
494  keep = true;
495  }
496 
497  // 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.
498 
499  // Check also against NodesToDrop
500  for (const std::string& toDrop : nodesToDrop) {
501  if (me->name() == toDrop) {
502  keep = false;
503  break;
504  }
505  }
506 
507  // Check against RemoveEmptySteps
508  // The signature we look for here is a InputMaker node connected directly to a ComboHypo node
509  // The key thing to identify is NO intermediate Hypo node
510  // This structure is created in Steps where some chain legs are running reconstruction, but other legs are idle - either due to
511  // menu alignment, or due to the legs being of different length.
512  // 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.
513  // First for the ComboHypo ...
514  if (removeEmptySteps && me->name() == comboHypoAlgNodeName() && myFirstParent && myFirstParent->name() == inputMakerNodeName()) {
515  keep = false;
516  }
517  // ... and also for the InputMaker, with flipped logic.
518  if (removeEmptySteps && me->name() == inputMakerNodeName() && myFirstChild && myFirstChild->name() == comboHypoAlgNodeName()) {
519  keep = false;
520  }
521 
522  // Check against RemoveEmptySteps
523  // Check for the R2->R3 empty step case
524  if (removeEmptySteps
525  && me->name() == hypoAlgNodeName()
527  && me->object<Decision>(featureString()) == me)
528  {
529  keep = false;
530  }
531  // ... and also for the InputMaker
532  if (removeEmptySteps
533  && me->name() == inputMakerNodeName()
534  && myFirstChild
535  && myFirstChild->name() == hypoAlgNodeName()
537  && myFirstChild->object<Decision>(featureString()) == myFirstChild)
538  {
539  keep = false;
540  }
541 
542  // APPLICATION Section:
543 
544  if (keep) {
545  node->keep(); // Inform the node that it should NOT be thinned away.
546  }
547 
548  for (NavGraphNode* seed : node->seeds()) {
549 #if TRIGCOMPUTILS_ENABLE_EARLY_EXIT == 1
550  // NOTE: This code block cuts short the recursive graph exploration for any node which has already been fully-explored-from.
551  //
552  // If we are keeping final features, then processing each node exactly once is actually insufficient.
553  // This is because we may reach a node, X, with a feature which is penultimate/generally-non-final for some chain, A,
554  // but then later on we may follow Terminus->SummaryFilter->Hypothesis(X) for some chain, B, where this same
555  // 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.
556  // But we need to process it again as for chain B, modeKeep==true still and chain B wants to flag the node as keep().
557  //
558  // We only however need to force the exploration while we are in the mode where we are nominally keeping nodes (modeKeep == true).
559  // Once we have switched to dropping nodes by default, we should be OK to once again skip over nodes which we already processed.
560  // The only thing we should be keeping when modeKeep == false is the L1 node, any this is not dependent on path.
561  //
562  // See: ATR-28061
563  bool allowEarlyExit = true;
564  if (keepOnlyFinalFeatures) {
565  allowEarlyExit = (modeKeep == false);
566  }
567  if (allowEarlyExit && fullyExploredFrom.count(seed) == 1) {
568  // We have fully explored this branch
569  continue;
570  }
571 #endif
572  // Recursively call all the way up the graph to the initial nodes from the HLTSeeding
573  recursiveFlagForThinningInternal(seed, modeKeep, fullyExploredFrom, keepOnlyFinalFeatures, removeEmptySteps, nodesToDrop);
574  }
575 
576  // Have fully explored down from this point
577  fullyExploredFrom.insert(node);
578  }
579 
580  // Note: This version of the function recurses through a full navigation graph (initial input: Decision Object)
582  const std::string& linkName,
583  std::vector<sgkey_t>& keyVec,
584  std::vector<uint32_t>& clidVec,
585  std::vector<uint16_t>& indexVec,
586  std::vector<const Decision*>& sourceVec,
587  const unsigned int behaviour,
588  std::set<const Decision*>* fullyExploredFrom)
589  {
590  using namespace msgFindLink;
591 
592  // As the append vectors are user-supplied, perform some input validation.
593  if (keyVec.size() != clidVec.size() or clidVec.size() != indexVec.size()) {
594  ANA_MSG_WARNING("In typelessFindLinks, keyVec, clidVec, indexVec must all be the same size. Instead have:"
595  << keyVec.size() << ", " << clidVec.size() << ", " << indexVec.size());
596  return false;
597  }
598 
599  // Locate named links. Both collections of links and individual links are supported.
600  bool found = typelessFindLinksCommonLinkCollection(start, linkName, keyVec, clidVec, indexVec, sourceVec);
601 
602  // Early exit
603  if (found && behaviour == TrigDefs::lastFeatureOfType) {
604  return true;
605  }
606  // If not Early Exit, then recurse
608 #if TRIGCOMPUTILS_ENABLE_EARLY_EXIT == 1
609  if (fullyExploredFrom != nullptr) {
610  // We only need to recursively explore back from each node in the graph once.
611  // We can keep a record of nodes which we have already explored, these we can safely skip over.
612  if (fullyExploredFrom->count(*seed) == 1) {
613  continue;
614  }
615  }
616 #endif
617  found |= typelessFindLinks(*seed, linkName, keyVec, clidVec, indexVec, sourceVec, behaviour, fullyExploredFrom);
618  }
619  // Fully explored this node
620  if (fullyExploredFrom != nullptr) {
621  fullyExploredFrom->insert(start);
622  }
623  return found;
624  }
625 
626  // Note: This version of the function recurses through a sub-graph of the full navigation graph (initial input: NavGraphNode)
628  const std::string& linkName,
629  std::vector<sgkey_t>& keyVec,
630  std::vector<uint32_t>& clidVec,
631  std::vector<uint16_t>& indexVec,
632  std::vector<const Decision*>& sourceVec,
633  const unsigned int behaviour,
634  std::set<const Decision*>* fullyExploredFrom)
635  {
636  using namespace msgFindLink;
637 
638  // As the append vectors are user-supplied, perform some input validation.
639  if (keyVec.size() != clidVec.size() or clidVec.size() != indexVec.size()) {
640  ANA_MSG_WARNING("In typelessFindLinks, keyVec, clidVec, indexVec must all be the same size. Instead have:"
641  << keyVec.size() << ", " << clidVec.size() << ", " << indexVec.size());
642  return false;
643  }
644 
645  const Decision* start_decisionObject = start->node();
646  // Locate named links. Both collections of links and individual links are supported.
647  bool found = typelessFindLinksCommonLinkCollection(start_decisionObject, linkName, keyVec, clidVec, indexVec, sourceVec);
648 
649  // Early exit
650  if (found && behaviour == TrigDefs::lastFeatureOfType) {
651  return true;
652  }
653  // If not Early Exit, then recurse
654  for (const NavGraphNode* seed : start->seeds()) {
655 #if TRIGCOMPUTILS_ENABLE_EARLY_EXIT == 1
656  if (fullyExploredFrom != nullptr) {
657  // We only need to recursively explore back from each node in the graph once.
658  // We can keep a record of nodes which we have already explored, these we can safely skip over.
659  const Decision* seed_decisionObject = seed->node();
660  if (fullyExploredFrom->count(seed_decisionObject) == 1) {
661  continue;
662  }
663  }
664 #endif
665  found |= typelessFindLinks(seed, linkName, keyVec, clidVec, indexVec, sourceVec, behaviour, fullyExploredFrom);
666  }
667  // Fully explored this node
668  if (fullyExploredFrom != nullptr) {
669  fullyExploredFrom->insert(start_decisionObject);
670  }
671  return found;
672  }
673 
674 
676  const std::string& linkName,
677  std::vector<sgkey_t>& keyVec,
678  std::vector<uint32_t>& clidVec,
679  std::vector<uint16_t>& indexVec,
680  std::vector<const Decision*>& sourceVec)
681  {
682  bool found = false;
683  std::vector<sgkey_t> tmpKeyVec;
684  std::vector<uint32_t> tmpClidVec;
685  std::vector<uint16_t> tmpIndexVec;
686  if (start->hasObjectCollectionLinks(linkName)) {
687  found = start->typelessGetObjectCollectionLinks(linkName, tmpKeyVec, tmpClidVec, tmpIndexVec);
688  }
689  if (start->hasObjectLink(linkName)) {
690  sgkey_t tmpKey{0};
691  uint32_t tmpClid{0};
692  uint16_t tmpIndex{0};
693  found |= start->typelessGetObjectLink(linkName, tmpKey, tmpClid, tmpIndex);
694  tmpKeyVec.push_back(tmpKey);
695  tmpClidVec.push_back(tmpClid);
696  tmpIndexVec.push_back(tmpIndex);
697  }
698  // De-duplicate
699  for (size_t tmpi = 0; tmpi < tmpKeyVec.size(); ++tmpi) {
700  bool alreadyAdded = false;
701  const uint32_t tmpKey = tmpKeyVec.at(tmpi);
702  const uint32_t tmpClid = tmpClidVec.at(tmpi);
703  const uint16_t tmpIndex = tmpIndexVec.at(tmpi);
704  for (size_t veci = 0; veci < keyVec.size(); ++veci) {
705  if (SG::sgkeyEqual (keyVec.at(veci), tmpKey)
706  and clidVec.at(veci) == tmpClid
707  and indexVec.at(veci) == tmpIndex)
708  {
709  alreadyAdded = true;
710  break;
711  }
712  }
713  if (!alreadyAdded) {
714  keyVec.push_back( tmpKey );
715  clidVec.push_back( tmpClid );
716  indexVec.push_back( tmpIndex );
717  sourceVec.push_back( start );
718  }
719  }
720  return found;
721  }
722 
723 
724 
726  const std::string& linkName,
727  sgkey_t& key,
728  uint32_t& clid,
729  uint16_t& index,
730  const Decision*& source,
731  const bool suppressMultipleLinksWarning)
732  {
733  using namespace msgFindLink;
734  // We use findLink in cases where there is only one link to be found, or if there are multiple then we
735  // only want the most recent.
736  // Hence we can supply TrigDefs::lastFeatureOfType. /--> parent3(link)
737  // We can still have more then one link found if there is a branch in the navigation. E.g. start --> parent1 --> parent2(link)
738  // If both parent2 and parent3 possessed an admissible ElementLink, then the warning below will trigger, and only one of the
739  // links will be returned (whichever of parent2 or parent3 happened to be the first seed of parent1).
740  std::vector<sgkey_t> keyVec;
741  std::vector<uint32_t> clidVec;
742  std::vector<uint16_t> indexVec;
743  std::vector<const Decision*> sourceVec;
744  std::set<const xAOD::TrigComposite*> fullyExploredFrom;
745 
746  const bool result = typelessFindLinks(start, linkName, keyVec, clidVec, indexVec, sourceVec, TrigDefs::lastFeatureOfType, &fullyExploredFrom);
747  if (!result) {
748  return false; // Nothing found
749  }
750 
751  if (keyVec.size() > 1 && !suppressMultipleLinksWarning) {
752  ANA_MSG_WARNING (keyVec.size() << " typeless links found for " << linkName
753  << " returning the first link, consider using findLinks.");
754  }
755  key = keyVec.at(0);
756  clid = clidVec.at(0);
757  index = indexVec.at(0);
758  source = sourceVec.at(0);
759  return true;
760  }
761 
762 
763  bool typelessFindLink(const NavGraph& subGraph,
764  const std::string& linkName,
765  sgkey_t& key,
766  uint32_t& clid,
767  uint16_t& index,
768  const Decision*& source,
769  const bool suppressMultipleLinksWarning)
770  {
771  using namespace msgFindLink;
772  // Note: This function should be the same as its predecessor, just using a NavGraph to start rather than a Decision*
773  // As a result, it can search from more than one Decision* (the NavGraph may have more than one final node)
774  // but it will still warn if this results in more than one link being located.
775  std::vector<sgkey_t> keyVec;
776  std::vector<uint32_t> clidVec;
777  std::vector<uint16_t> indexVec;
778  std::vector<const Decision*> sourceVec;
779  std::set<const Decision*> fullyExploredFrom;
780 
781  bool result = false;
782  for (const NavGraphNode* finalNode : subGraph.finalNodes()) {
783  result |= typelessFindLinks(finalNode, linkName, keyVec, clidVec, indexVec, sourceVec, TrigDefs::lastFeatureOfType, &fullyExploredFrom);
784  }
785 
786  if (!result) {
787  return false; // Nothing found
788  }
789 
790  if (keyVec.size() > 1 && !suppressMultipleLinksWarning) {
791  ANA_MSG_WARNING (keyVec.size() << " typeless links found for " << linkName
792  << " returning the first link, consider using findLinks.");
793  }
794  key = keyVec.at(0);
795  clid = clidVec.at(0);
796  index = indexVec.at(0);
797  source = sourceVec.at(0);
798  return true;
799  }
800 
801 
803  const std::string& chainName,
804  const std::vector<LinkInfo<xAOD::IParticleContainer>>& features,
805  const std::vector<std::size_t>& legMultiplicities,
806  const std::function<bool(const std::vector<LinkInfo<xAOD::IParticleContainer>>&)>& filter)
807  {
809  combinations.reserve(legMultiplicities.size());
810  if (legMultiplicities.size() == 1)
811  combinations.addLeg(legMultiplicities.at(0), features);
812  else
813  for (std::size_t legIdx = 0; legIdx < legMultiplicities.size(); ++legIdx)
814  {
815  // Skip any that will not provide IParticle features
816  if (legMultiplicities[legIdx] == 0)
817  continue;
819  std::vector<LinkInfo<xAOD::IParticleContainer>> legFeatures;
820  for (const LinkInfo<xAOD::IParticleContainer>& info : features)
821  if (passed(legID.numeric(), info.decisions))
822  legFeatures.push_back(info);
823  combinations.addLeg(legMultiplicities.at(legIdx), std::move(legFeatures));
824  }
825  return combinations;
826  }
827 
828 
830  const std::string& chainName,
831  const std::vector<LinkInfo<xAOD::IParticleContainer>>& features,
832  const std::vector<std::size_t>& legMultiplicities,
834  {
835  return buildCombinations(chainName, features, legMultiplicities, getFilter(filter));
836  }
837 
839  const std::string& chainName,
840  const std::vector<LinkInfo<xAOD::IParticleContainer>>& features,
841  const TrigConf::HLTChain *chainInfo,
842  const std::function<bool(const std::vector<LinkInfo<xAOD::IParticleContainer>>&)>& filter)
843  {
844  return buildCombinations(chainName, features, chainInfo->leg_multiplicities(), filter);
845  }
846 
848  const std::string& chainName,
849  const std::vector<LinkInfo<xAOD::IParticleContainer>>& features,
850  const TrigConf::HLTChain *chainInfo,
852  {
853  return buildCombinations(chainName, features, chainInfo, getFilter(filter));
854  }
855 
856 
857  std::string dump( const Decision* tc, const std::function< std::string( const Decision* )>& printerFnc ) {
858  std::string ret;
859  ret += printerFnc( tc );
860  if ( hasLinkToPrevious(tc) ) {
861  const std::vector<ElementLink<DecisionContainer>> seeds = getLinkToPrevious(tc);
862  for (const ElementLink<DecisionContainer>& seedEL : seeds) {
863  ret += " -> " + dump( *seedEL, printerFnc );
864  }
865  }
866  return ret;
867  }
868 
869 
870  const std::string& initialRoIString() {
872  }
873 
874  const std::string& initialRecRoIString() {
876  }
877 
878  const std::string& roiString() {
879  return Decision::s_roiString;
880  }
881 
882  const std::string& viewString() {
883  return Decision::s_viewString;
884  }
885 
886  const std::string& featureString() {
888  }
889 
890  const std::string& seedString() {
891  return Decision::s_seedString;
892  }
893 
894  const std::string& hltSeedingNodeName(){
896  }
897 
898  const std::string& filterNodeName(){
900  }
901 
902  const std::string& inputMakerNodeName(){
904  }
905 
906  const std::string& hypoAlgNodeName(){
908  }
909 
910  const std::string& comboHypoAlgNodeName(){
912  }
913 
914  const std::string& summaryFilterNodeName(){
916  }
917 
918  const std::string& summaryPassNodeName(){
920  }
921 
922  const std::string& summaryPassExpressNodeName(){
924  }
925 
926  const std::string& summaryPrescaledNodeName(){
928  }
929 
930 }
931 
grepfile.info
info
Definition: grepfile.py:38
WriteHandle.h
Handle class for recording to StoreGate.
TrigCompositeUtils::summaryPrescaledNodeName
const std::string & summaryPrescaledNodeName()
Definition: TrigCompositeUtilsRoot.cxx:926
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:802
TrigCompositeUtils::summaryFilterNodeName
const std::string & summaryFilterNodeName()
Definition: TrigCompositeUtilsRoot.cxx:914
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
TrigCompositeUtils::recursiveGetDecisionsInternal
void recursiveGetDecisionsInternal(const Decision *node, const Decision *comingFrom, NavGraph &navGraph, const EventContext &ctx, std::set< const Decision * > &fullyExploredFrom, const DecisionIDContainer &ids, const bool enforceDecisionOnNode)
Used by recursiveGetDecisions.
Definition: TrigCompositeUtilsRoot.cxx:383
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
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
TrigCompositeUtils.h
TrigCompositeUtils::typelessFindLink
bool typelessFindLink(const Decision *start, const std::string &linkName, sgkey_t &key, uint32_t &clid, uint16_t &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:725
TrigCompositeUtils::summaryPassExpressNodeName
const std::string & summaryPassExpressNodeName()
Definition: TrigCompositeUtilsRoot.cxx:922
HLT::Identifier::numeric
TrigCompositeUtils::DecisionID numeric() const
numeric ID
Definition: TrigCompositeUtils/TrigCompositeUtils/HLTIdentifier.h:47
TrigCompositeUtils::hltSeedingNodeName
const std::string & hltSeedingNodeName()
Definition: TrigCompositeUtilsRoot.cxx:894
SG::Accessor
Helper class to provide type-safe access to aux data.
Definition: Control/AthContainers/AthContainers/Accessor.h:66
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::hypoAlgNodeName
const std::string & hypoAlgNodeName()
Definition: TrigCompositeUtilsRoot.cxx:906
TrigCompositeUtils::typelessFindLinksCommonLinkCollection
bool typelessFindLinksCommonLinkCollection(const Decision *start, const std::string &linkName, std::vector< sgkey_t > &keyVec, std::vector< uint32_t > &clidVec, std::vector< uint16_t > &indexVec, std::vector< const Decision * > &sourceVec)
Common functionality shared by both typelessFindLinks interfaces Returns true if at least one link wa...
Definition: TrigCompositeUtilsRoot.cxx:675
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:226
skel.it
it
Definition: skel.GENtoEVGEN.py:423
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:253
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:910
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::initialRecRoIString
const std::string & initialRecRoIString()
Definition: TrigCompositeUtilsRoot.cxx:874
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:54
xAOD::TrigComposite_v1::s_seedString
static const std::string s_seedString
Constant used to identify a seed (parent)
Definition: TrigComposite_v1.h:255
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:257
xAOD::TrigComposite_v1::s_initialRoIString
static const std::string s_initialRoIString
Constant used to identify an initial ROI from L1.
Definition: TrigComposite_v1.h:245
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:449
const
bool const RAWDATA *ch2 const
Definition: LArRodBlockPhysicsV0.cxx:562
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
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:264
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:272
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:128
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:88
TrigCompositeUtils::typelessFindLinks
bool typelessFindLinks(const Decision *start, const std::string &linkName, std::vector< sgkey_t > &keyVec, std::vector< uint32_t > &clidVec, std::vector< uint16_t > &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:581
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:266
lumiFormat.i
int i
Definition: lumiFormat.py:92
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:870
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::getExpressTerminusNode
const Decision * getExpressTerminusNode(const DecisionContainer &container)
Returns the express-accept navigation node from a collection or nullptr if missing.
Definition: TrigCompositeUtilsRoot.cxx:251
ret
T ret(T t)
Definition: rootspy.cxx:260
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:260
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:269
TrigCompositeUtils::NavGraph
Structure to hold a transient Directed Acyclic Graph (DAG) structure. NavGraph is populated from,...
Definition: NavGraph.h:98
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:81
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:258
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:886
TrigCompositeUtils::NavGraph::addNode
void addNode(const Decision *node, const EventContext &ctx, const Decision *comingFrom=nullptr)
Add a new NavGraphNode which shadows the xAOD Decision object "node" from the full navigation graph.
Definition: NavGraph.cxx:79
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:192
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::s_initialRecRoIString
static const std::string s_initialRecRoIString
Constant used to identify an initial HLT ROI derived from L1.
Definition: TrigComposite_v1.h:247
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:918
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:898
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:890
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::NavGraph::finalNodes
std::vector< NavGraphNode * > finalNodes() const
Get all final nodes.
Definition: NavGraph.cxx:99
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:353
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:437
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:857
TrigCompositeUtils
Definition: Event/xAOD/xAODTrigger/xAODTrigger/TrigComposite.h:19
TrigCompositeUtils::roiString
const std::string & roiString()
Definition: TrigCompositeUtilsRoot.cxx:878
xAOD::TrigComposite_v1::s_viewString
static const std::string s_viewString
Constant used to identify a view.
Definition: TrigComposite_v1.h:251
TrigCompositeUtils::recursiveGetDecisions
void recursiveGetDecisions(const Decision *start, NavGraph &navGraph, const EventContext &ctx, 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:423
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:790
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:262
xAOD::TrigComposite_v1::s_summaryPrescaledNodeNameString
static const std::string s_summaryPrescaledNodeNameString
Constant used to identify the single prescaled graph node.
Definition: TrigComposite_v1.h:278
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:275
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
TrigConf::HLTChain::leg_multiplicities
const std::vector< size_t > leg_multiplicities() const
Definition: TrigConfHLTData/TrigConfHLTData/HLTChain.h:82
TrigCompositeUtils::viewString
const std::string & viewString()
Definition: TrigCompositeUtilsRoot.cxx:882
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:902
xAOD::TrigComposite_v1::s_roiString
static const std::string s_roiString
Constant used to identify an (explicitly) updated HLT ROI.
Definition: TrigComposite_v1.h:249
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37