ATLAS Offline Software
Run2ToRun3TrigNavConverterV2.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include <boost/functional/hash.hpp>
6 #include <GaudiKernel/StatusCode.h>
7 #include "AthLinks/ElementLinkVector.h"
16 #include "SpecialCases.h"
17 
18 namespace TCU = TrigCompositeUtils;
19 
20 // helper class
22 {
23  teIDs.push_back(te->getId());
24 }
25 
26 // find if proxy is a child of other proxies, also follows to children of the children etc...
27 bool ConvProxy::isChild(const ConvProxy* other ) const {
28  for ( auto c: children ) {
29  if (other == c)
30  return true;
31  if ( c->isChild(other) )
32  return true;
33  }
34  return false;
35 }
36 
37 bool ConvProxy::isParent(const ConvProxy* other ) const {
38  for ( auto c: parents ) {
39  if (other == c)
40  return true;
41  if ( c->isParent(other) )
42  return true;
43  }
44  return false;
45 }
46 
47 
49 {
50  if (this == other)
51  return false; // no merging with self
52  // never merge children with parents
53  if ( isChild(other) )
54  return false;
55  if ( isParent(other) )
56  return false;
57  return true;
58 }
59 
61 {
62  if (other == this)
63  {
64  return;
65  }
66  // copy over chains
67  runChains.insert(other->runChains.begin(), other->runChains.end());
68  passChains.insert(other->passChains.begin(), other->passChains.end());
69  teIDs.push_back(other->te->getId());
70  /* the intention of the code below is following.
71  Intial structure like is like this (the line is always bidirectional):
72  P1 P2 P3 <- parents
73  | | /
74  T1 T2 <- "this" and "other"
75  | |
76  C1 C2 <- children
77  1) Lets assume that the first proxies we treat are B1 & B2 ath they are mergable. The resulting structure should look like this:
78  P1 P2 P3
79  |/__/
80  T1 T2
81  |\
82  C1 C2
83 
84  */
85  auto add = [](ConvProxy *toadd, std::set<ConvProxy *> &coll)
86  {
87  if (std::find(coll.begin(), coll.end(), toadd) == coll.end())
88  {
89  coll.insert(toadd);
90  }
91  };
92 
93  auto remove = [](ConvProxy *torem, std::set<ConvProxy *> &coll)
94  {
95  auto place = std::find(coll.begin(), coll.end(), torem);
96  if (place != coll.end())
97  {
98  coll.erase(place);
99  }
100  };
101 
102  // this is T <-> C connection
103  for (auto otherChild : other->children)
104  {
105  add(otherChild, children);
106  add(this, otherChild->parents);
107  }
108  // this is T <-> P connection rewiring
109  for (auto otherParent : other->parents)
110  {
111  add(otherParent, parents);
112  add(this, otherParent->children);
113  }
114 
115  // now need to remove links back to the "other"
116  for (auto otherParent : other->parents)
117  {
118  remove(other, otherParent->children);
119  }
120 
121  for (auto otherChild : other->children)
122  {
123  remove(other, otherChild->parents);
124  }
125  other->children.clear();
126  other->parents.clear();
127 }
128 
129 std::string ConvProxy::description() const
130 {
131  std::string ret;
132  ret += " N parents: " + std::to_string(parents.size());
133  ret += " N children: " + std::to_string(children.size());
134  std::ostringstream os;
135  for ( auto c: children )
136  os << c << " ";
137  ret += " ptrs: " + os.str();
138  ret += " feaHash: " + std::to_string(feaHash);
139  ret += " N run chains: " + std::to_string(runChains.size());
140  return ret;
141 }
142 
143 // the algorithm
144 Run2ToRun3TrigNavConverterV2::Run2ToRun3TrigNavConverterV2(const std::string &name, ISvcLocator *pSvcLocator) : AthReentrantAlgorithm(name, pSvcLocator)
145 {
146 }
147 
149 {
150 }
151 
153 {
154  ATH_CHECK(m_trigOutputNavKey.initialize());
155  ATH_CHECK(m_tdt.empty() != m_trigNavKey.key().empty()); // either of the two has to be enabled but not both
156  if (!m_tdt.empty())
157  {
158  ATH_CHECK(m_tdt.retrieve());
159  ATH_MSG_INFO("Will use Trigger Navigation from TrigDecisionTool");
160  }
161  else
162  {
164  ATH_MSG_INFO("Will use Trigger Navigation decoded from TrigNavigation object");
165  }
166 
167  if (!m_chainsToSave.empty()) {
168  ATH_MSG_DEBUG("Will only save features for these chains " << m_chainsToSave);
169  }
170 
171  ATH_CHECK(m_configSvc.retrieve());
172  ATH_CHECK(m_clidSvc.retrieve());
173 
174  // configured collections can be either just type name, or type#key
175  // decoding takes this into account, if only the type is configured then empty string is places in the decoded lookup map
176  // else CLID + a name is placed
177 
178  for (const auto &name : m_collectionsToSave)
179  {
180  std::string typeName = name;
181  std::string collName;
182  size_t delimeterIndex = name.find('#');
183  if (delimeterIndex != std::string::npos)
184  {
185  typeName = name.substr(0, delimeterIndex);
186  collName = name.substr(delimeterIndex + 1);
187  }
188  CLID id{0};
189  ATH_CHECK(m_clidSvc->getIDOfTypeName(typeName, id));
190  ATH_MSG_DEBUG("Will be linking collection type " << typeName << " name (empty==all) " << collName);
191  if ( collName.empty() )
192  m_collectionsToSaveDecoded[id]; // creates empty set
193  else
194  m_collectionsToSaveDecoded[id].insert(collName);
195  }
196 
197  for (const auto &name : m_roisToSave)
198  {
199  m_setRoiName.push_back(name);
200  }
201 
202  // sanity check, i.e. if there is at least one entry w/o the coll name no other entries are needed for a given clid
203  for (auto [clid, keysSet] : m_collectionsToSaveDecoded)
204  {
205  if (keysSet.size() > 1 and keysSet.count("") != 0)
206  {
207  ATH_MSG_ERROR("Bad configuration for CLID " << clid << " requested saving of all (empty coll name configures) collections, yet there are also specific keys");
208  return StatusCode::FAILURE;
209  }
210 
211  }
212 
213  bool anyChainBad=false;
214  for ( auto chain: m_chainsToSave ) {
215  if ( chain.find('*') != std::string::npos or chain.find('|') != std::string::npos ) {
216  ATH_MSG_ERROR("Supplied chain name: " << chain << " contains wildcard characters, this is not supported by the conversion tool");
217  anyChainBad=true;
218  }
219  }
220  if ( anyChainBad ) {
221  ATH_MSG_ERROR("Supplied chain names contain wildcard characters, this is not supported by the conversion tool");
222  return StatusCode::FAILURE;
223  }
224  if ( m_chainsToSave.empty() ) {
225  ATH_MSG_INFO("No chains list supplied, the conversion will occur for all chains");
226  }
227 
228  ATH_CHECK(m_clidSvc->getIDOfTypeName("TrigRoiDescriptor", m_roIDescriptorCLID));
229  ATH_CHECK(m_clidSvc->getIDOfTypeName("TrigRoiDescriptorCollection", m_roIDescriptorCollectionCLID));
230  ATH_CHECK(m_clidSvc->getIDOfTypeName("xAOD::TrigRingerRings", m_TrigRingerRingsCLID));
231  ATH_CHECK(m_clidSvc->getIDOfTypeName("xAOD::TrigRingerRingsContainer", m_TrigRingerRingsContainerCLID));
232  ATH_CHECK(m_clidSvc->getIDOfTypeName("xAOD::TrigEMCluster", m_TrigEMClusterCLID));
233  ATH_CHECK(m_clidSvc->getIDOfTypeName("xAOD::TrigEMClusterContainer", m_TrigEMClusterContainerCLID));
234  ATH_CHECK(m_clidSvc->getIDOfTypeName("xAOD::CaloCluster", m_CaloClusterCLID));
235  ATH_CHECK(m_clidSvc->getIDOfTypeName("xAOD::CaloClusterContainer", m_CaloClusterContainerCLID));
236  ATH_CHECK(m_clidSvc->getIDOfTypeName("xAOD::TrackParticleContainer", m_TrackParticleContainerCLID));
237  ATH_CHECK(m_clidSvc->getIDOfTypeName("xAOD::TauTrackContainer", m_TauTrackContainerCLID));
238 
239  return StatusCode::SUCCESS;
240 }
241 
243 {
244  return StatusCode::SUCCESS;
245 }
246 
247 StatusCode Run2ToRun3TrigNavConverterV2::execute(const EventContext &context) const
248 {
249  {
250  // configuration reading could not be done before the event loop
251  // it needs to be done only once though
252  std::scoped_lock lock(m_configUpdateMutex);
253  if (m_allTEIdsToChains.empty())
255  }
256 
257  ConvProxySet_t convProxies;
258  HLT::StandaloneNavigation standaloneNav; // needed to keep TEs around, so it is out of the scope where it is filled and referenced
259  const HLT::TrigNavStructure *run2NavigationPtr = nullptr;
260  if (!m_trigNavKey.key().empty())
261  {
262  SG::ReadHandle navReadHandle(m_trigNavKey, context);
263  ATH_CHECK(navReadHandle.isValid());
264  standaloneNav.deserialize(navReadHandle->serialized());
265  run2NavigationPtr = &standaloneNav;
266  }
267  else
268  {
269  run2NavigationPtr = m_tdt->ExperimentalAndExpertMethods().getNavigation();
270  }
271 
272  ATH_CHECK(mirrorTEsStructure(convProxies, *run2NavigationPtr));
273  // printProxies(convProxies, [](auto ){ return true;},
274  // {m_chainIdsPrinter});
275 
276  if (m_doSelfValidation)
277  ATH_CHECK(allProxiesConnected(convProxies));
278 
280  // printProxies(convProxies, [](auto ){ return true;},
281  // {m_chainIdsPrinter});
282 
283  ATH_CHECK(cureUnassociatedProxies(convProxies));
284  ATH_MSG_DEBUG("Proxies to chains mapping done");
285 
286  ATH_CHECK(removeTopologicalProxies(convProxies));
287 
288  if (not m_chainsToSave.empty())
289  {
290  ATH_CHECK(removeUnassociatedProxies(convProxies));
291  printProxies(convProxies, [](auto ){ return true;},
293  ATH_MSG_DEBUG("Removed proxies to chains that are not converted, remaining number of elements " << convProxies.size());
294  }
295  if (m_doSelfValidation)
296  {
297  ATH_CHECK(allProxiesHaveChain(convProxies));
298  }
299  if (m_doCompression)
300  {
301  ATH_CHECK(doCompression(convProxies, *run2NavigationPtr));
302  // printProxies(convProxies, [](auto ){ return true;},
303  // {m_chainIdsPrinter});
304 
305  }
306 
308  auto decisionOutput = outputNavigation.ptr();
309  TrigCompositeUtils::newDecisionIn(decisionOutput, TCU::summaryPassNodeName()); // we rely on the fact that the 1st element is the top
310 
311  if (m_doLinkFeatures)
312  {
313  ATH_CHECK(fillRelevantFeatures(convProxies, *run2NavigationPtr));
314  ATH_CHECK(fillRelevantRois(convProxies, *run2NavigationPtr));
315  ATH_CHECK(fillRelevantTracks(convProxies));
316  ATH_MSG_DEBUG("Features to link found");
317  }
318 
319  ATH_CHECK(createIMHNodes(convProxies, *decisionOutput, context));
320  if (m_doSelfValidation)
321  {
323  }
324 
325  ATH_CHECK(createL1Nodes(convProxies, *decisionOutput, context));
326  ATH_CHECK(linkFeaNode(convProxies, *decisionOutput, *run2NavigationPtr, context));
327  ATH_CHECK(linkRoiNode(convProxies, *run2NavigationPtr));
328  ATH_CHECK(linkTrkNode(convProxies, *run2NavigationPtr));
329  ATH_CHECK(createSFNodes(convProxies, *decisionOutput, m_finalTEIdsToChains, context));
330  ATH_CHECK(updateTerminusNode(*decisionOutput, context));
331  ATH_MSG_DEBUG("Conversion done, from " << convProxies.size() << " elements to " << decisionOutput->size() << " elements");
332 
333  printProxies(convProxies, [](auto ){ return true;},
335  ATH_MSG_DEBUG("Resulting nodes");
336  size_t index = 0;
337  for ( auto o: *decisionOutput) {
338  ATH_MSG_DEBUG("Index: " << index << " " << *o);
339  index++;
340  }
341 
342  // dispose temporaries
343  for (auto proxy : convProxies)
344  {
345  delete proxy;
346  }
347 
348  return StatusCode::SUCCESS;
349 }
350 
352  // chains of configs structure
353  // A B
354  // \/
355  // C
356  // where C is the output TE of sequence consuming A & B
357  // sometimes there are an additional leafs
358  // C
359  // |
360  // D
361  if ( not std::regex_match(ptrChain->name(), SpecialCases::isTopo) ) return 0;
362  size_t stepToConsider = 0;
363  const size_t sigsSize = ptrChain->signatures().size();
364  if ( sigsSize < 2 ) return 0;
365  for ( size_t step = sigsSize-1; step > 1; step --) {
366  if ( (ptrChain->signatures()[step-1])->outputTEs().size() == 2 and (ptrChain->signatures()[step])->outputTEs().size() == 1 ) {
367  stepToConsider = step;
368  break;
369  }
370  }
371  if ( stepToConsider == 0 ) return 0; // not a topo
372 
373  //counting is right, need to see now if TEs are connected
374  auto finalTE = (ptrChain->signatures()[stepToConsider])->outputTEs()[0];
375  auto preFinalTEs = (ptrChain->signatures()[stepToConsider-1])->outputTEs();
376 
377  auto finalSeq = m_configSvc->sequences().getSequence(finalTE->id());
378  std::set<HLT::te_id_type> tesInSeq;
379  std::set<HLT::te_id_type> tesInChain;
380 
381  for ( auto te: finalSeq->inputTEs()) {
382  tesInSeq.insert(te->id());
383  }
384 
385  for ( auto te: preFinalTEs) {
386  tesInChain.insert(te->id());
387  }
388 
389  if (tesInSeq == tesInChain) {
390  return stepToConsider;
391  }
392  return 0;
393 }
394 
396 {
397 
398  ATH_CHECK(not m_configSvc->chains().empty());
399 
400  // obtain map output TE -> input TE via sequences
401  for (auto ptrChain : m_configSvc->chains())
402  {
403  std::string chainName = ptrChain->name();
404 
405 
406  if (not m_chainsToSave.empty())
407  {
408  auto found = std::find(m_chainsToSave.begin(), m_chainsToSave.end(), chainName);
409  if (found == m_chainsToSave.end())
410  {
411  continue;
412  }
413  }
414 
415  if (std::regex_match(chainName, SpecialCases::bjetMuChain )) {
416  ATH_CHECK(bjetMuChainConfigDecoder(allTEs, finalTEs, ptrChain));
417  continue;
418  }
419 
420  // hack for etcut chains
421  // if we ever need to generalise that it should be moved to separate function
422  std::map<HLT::te_id_type, HLT::te_id_type> etcutReplacementTEs;
423  auto etcutReplacement = [&etcutReplacementTEs](HLT::te_id_type in) { auto out = etcutReplacementTEs.find(in); return (out == etcutReplacementTEs.end() ? in : out->second ); };
424  if ( chainName.find("etcut") != std::string::npos ) {
425  std::set<size_t> positionsOfEtCutLegs;
426  // use heuristics to mention
427  if( std::regex_match(chainName, SpecialCases::egammaDiEtcut) ) {
428  ATH_MSG_DEBUG("EtCut chains hack, chain with two etcut legs ");
429  positionsOfEtCutLegs.insert({0, 1});
430  } else if ( std::regex_match(chainName, SpecialCases::egammaCombinedWithEtcut) ) {
431  ATH_MSG_DEBUG("EtCut chains hack, egamma chain with second etcut leg ");
432  positionsOfEtCutLegs.insert({1});
433  } else if ( std::regex_match(chainName, SpecialCases::egammaEtcut) ) {
434  ATH_MSG_DEBUG("EtCut chains hack, single leg egamma chain");
435  positionsOfEtCutLegs.insert({0});
436  }
437 
438  // pilot pass to fill the replacement map
439  std::map<size_t, HLT::te_id_type> positionToDesiredIDmap;
440  for (auto ptrHLTSignature : ptrChain->signatures()) {
441  size_t position = 0;
442  for (auto ptrHLTTE : ptrHLTSignature->outputTEs()) {
443  if (positionsOfEtCutLegs.count(position) and positionToDesiredIDmap.find(position) != positionToDesiredIDmap.end() ) {
444  etcutReplacementTEs[ptrHLTTE->id()] = positionToDesiredIDmap[position];
445  ATH_MSG_DEBUG("EtCut chains hack, TE " << ptrHLTTE->name() << " will be replaced by: " << TrigConf::HLTUtils::hash2string(positionToDesiredIDmap[position]));
446  } else {
447  if ( ptrHLTTE->name().find("calocalib") != std::string::npos and positionsOfEtCutLegs.count(position) ) { // we have final TE for this leg
448  positionToDesiredIDmap[position] = ptrHLTTE->id();
449  }
450  }
451  position++;
452  }
453  }
454  }
455 
456  // chains with a single leg
458  ATH_MSG_DEBUG(" CHAIN name " << chainName << " CHAIN Id " << chainId);
459  for (auto ptrHLTSignature : ptrChain->signatures()) {
460  for (auto ptrHLTTE : ptrHLTSignature->outputTEs()) {
461  unsigned int teId = etcutReplacement(ptrHLTTE->id());
462  allTEs[teId].insert(chainId);
463  if (ptrHLTSignature == ptrChain->signatures().back()) {
464  finalTEs[teId].insert(chainId);
465  ATH_MSG_DEBUG("TE will be used to mark final chain decision " << ptrHLTTE->name() << " chain " << chainName );
466  }
467  }
468  }
469  // chains with a multiple legs
471 
472  // dirty hacks for failing chains parsing
473  if(std::regex_match(chainName, SpecialCases::gammaXeChain))
474  multiplicities={1,1};
475 
476  if ( multiplicities.size() > 1 ) {
477  ATH_MSG_DEBUG(" this " << (is2LegTopoChain(ptrChain) ? "is": "is not") << " topological chain");
478  // the chain structure (in terms of multiplicities) may change along the way
479  // we'll assign legs only to these TEs of the steps that have identical multiplicity pattern
480  // e.g. for the chain: HLT_2g25_loose_g20 the multiplicities are: [2, 1]
481 
482  // hack for HLT.*tau.*xe.* case
483  if (std::regex_match(chainName, SpecialCases::tauXeChain)) {
484  std::vector<size_t> mult_hack; // type mismatch with ChainNameParser::multiplicities
485  if (multiplicities.size()==3) mult_hack={1,1};
486  else if (multiplicities.size()==2) mult_hack={1};
487  ptrChain->set_leg_multiplicities(mult_hack); // HLTChain needs vector<size_t>
488  }
489 
490  // hack for mu2MunoL1Special
491  if (std::regex_match(chainName, SpecialCases::mu2MunoL1Special)) {
492  std::vector<size_t> mult_hack;
493  if (multiplicities.size()==3) mult_hack={1,1};
494  else if (multiplicities.size()==2) mult_hack={2}; // HLT_mu11_nomucomb_2mu4noL1_nscan03_L1MU11_2MU6
495  ptrChain->set_leg_multiplicities(mult_hack);
496  }
497 
498  ATH_MSG_DEBUG("CHAIN " << chainName << " needs legs: " << multiplicities );
499  std::vector<unsigned int> teIdsLastHealthyStepIds;
500 
501  for (auto ptrHLTSignature : ptrChain->signatures())
502  {
503  std::vector<int> teCounts;
504  std::vector<unsigned int> teIds;
505  unsigned int lastSeenId = 0;
506  for (auto ptrHLTTE : ptrHLTSignature->outputTEs())
507  {
508  if ( lastSeenId != ptrHLTTE->id()) {
509  teCounts.push_back(1);
510  teIds.push_back(ptrHLTTE->id());
511  } else {
512  teCounts.back()++;
513  }
514  lastSeenId = ptrHLTTE->id();
515  }
516 
517  ATH_MSG_DEBUG("TE multiplicities seen in this step " << teCounts);
518  bool multiplicityCounts = multiplicities == teCounts;
519  // hack for HLT.*tau.*xe.* case
520  if(std::regex_match(chainName, SpecialCases::tauXeChain)) multiplicityCounts = true;
521  if ( multiplicityCounts ) {
522  teIdsLastHealthyStepIds = teIds;
523  ATH_MSG_DEBUG("There is a match, will assign chain leg IDs to TEs " << teCounts << " " << teIds);
524  for ( size_t legNumber = 0; legNumber < teIds.size(); ++ legNumber){
525  HLT::Identifier chainLegId = TrigCompositeUtils::createLegName(chainId, legNumber);
526  allTEs[etcutReplacement(teIds[legNumber])].insert(chainLegId);
527  }
528  }
529  }
530  for ( size_t legNumber = 0; legNumber < teIdsLastHealthyStepIds.size(); ++ legNumber ) {
531  HLT::Identifier chainLegId = TrigCompositeUtils::createLegName(chainId, legNumber);
532 
533  ATH_MSG_DEBUG("created leg id " << chainLegId << " that will replace TE ID " << etcutReplacement(teIdsLastHealthyStepIds[legNumber]));
534  finalTEs[etcutReplacement(teIdsLastHealthyStepIds[legNumber])].insert(chainLegId);
535  }
536  }
537  }
538  ATH_MSG_DEBUG("Recognised " << allTEs.size() << " kinds of TEs and among them " << finalTEs.size() << " final types");
539  return StatusCode::SUCCESS;
540 }
541 
543  HLT::Identifier chainId = HLT::Identifier(ptrChain->name());
544 
545  std::vector<unsigned int> muons;
546  std::vector<unsigned int> jets;
547  bool switchedTojets =false;
548  for (auto ptrHLTSignature : ptrChain->signatures()) {
549  for (auto ptrHLTTE : ptrHLTSignature->outputTEs()) {
550  if ( ptrHLTTE->name().find("_mu") == std::string::npos ) {
551  switchedTojets = true;
552  }
553 
554  if ( switchedTojets)
555  jets.push_back(ptrHLTTE->id());
556  else
557  muons.push_back(ptrHLTTE->id());
558  }
559  }
560  ATH_CHECK(not muons.empty());
561  ATH_CHECK(not jets.empty());
562  std::reverse(std::begin(muons), std::end(muons));
564  finalTEs[muons[0]].insert(TrigCompositeUtils::createLegName(chainId, 0));
565  finalTEs[muons[0]].insert(chainId);
566  finalTEs[jets[0]].insert(TrigCompositeUtils::createLegName(chainId, 1));
567  finalTEs[jets[0]].insert(chainId);
568 
569  for ( size_t index = 0; index < std::min(muons.size(), jets.size()); ++index)
570  {
571  allTEs[muons[index]].insert(TrigCompositeUtils::createLegName(chainId, 0));
572  allTEs[muons[index]].insert(chainId);
573  allTEs[jets[index]].insert(TrigCompositeUtils::createLegName(chainId, 1));
574  allTEs[jets[index]].insert(chainId);
575  }
576  return StatusCode::SUCCESS;
577 }
578 
579 
580 
582 {
583 
584  // iterate over the TEs, for each make the ConvProxy and build connections
585  std::map<const HLT::TriggerElement *, ConvProxy *> teToProxy;
586  ATH_MSG_DEBUG("TrigNavStructure with " << run2Nav.getAllTEs().size() << " TEs acquired");
587  for (auto te : run2Nav.getAllTEs())
588  {
589  // skip event seed node
591  continue;
592  auto proxy = new ConvProxy(te);
593  convProxies.insert(proxy);
594  teToProxy[te] = proxy;
595  // add linking
596  for (auto predecessor : HLT::TrigNavStructure::getDirectPredecessors(te))
597  {
598  ConvProxy *predecessorProxy = teToProxy[predecessor];
599  if (predecessorProxy != nullptr)
600  { // because we skip some
601  proxy->parents.insert(predecessorProxy);
602  predecessorProxy->children.insert(proxy);
603  }
604  }
605  }
606 
607  if (m_doSelfValidation)
608  {
609  int counter = -1;
610  for (auto proxy : convProxies)
611  {
612  counter++;
613  ATH_MSG_DEBUG("Proxy " << counter << " " << proxy->description() << "ptr " << proxy);
614  for (auto p : proxy->children)
615  ATH_MSG_DEBUG("Child ptr " << p);
616  for (auto p : proxy->parents)
617  ATH_MSG_DEBUG("Parent ptr " << p);
618 
619  for (auto p : proxy->parents)
620  {
621  for (auto pp : p->parents)
622  {
623  if (pp == proxy)
624  {
625  ATH_MSG_WARNING("Weird, proxy is in parents list of parents");
626  }
627  }
628  }
629  for (auto c : proxy->children)
630  {
631  for (auto cc : c->children)
632  {
633  if (cc == proxy)
634  {
635  ATH_MSG_WARNING("Weird, proxy is in children list of children");
636  }
637  }
638  }
639  }
640  }
641 
642  ATH_MSG_DEBUG("Created " << convProxies.size() << " proxy objects");
643  return StatusCode::SUCCESS;
644 }
645 
646 
648  std::function<bool(const ConvProxy*)> selector,
649  const std::vector<std::function<void(const ConvProxy*)>>& printers) const {
650  ATH_MSG_DEBUG("Printing proxies");
651  ATH_MSG_DEBUG("" );
652  for ( auto p: proxies) {
653  if ( selector(p) ){
654  ATH_MSG_DEBUG("Proxy " << p->description() );
655  for (auto& printer: printers) {
656  printer(p);
657  }
658  ATH_MSG_DEBUG("" );
659  }
660  }
661 }
662 
664 {
665 
666  for (auto &ptrConvProxy : convProxies)
667  {
668  auto teId = ptrConvProxy->te->getId();
669  bool teActive = ptrConvProxy->te->getActiveState();
670  auto iter = allTEs.find(teId);
671  if (iter != allTEs.end())
672  {
673  ptrConvProxy->runChains.insert(iter->second.begin(), iter->second.end());
674  if (teActive)
675  {
676  ptrConvProxy->passChains.insert(iter->second.begin(), iter->second.end());
677  }
678  }
679 
680  for (auto &objTeIdToChain : allTEs)
681  {
682  if (teId == objTeIdToChain.first)
683  {
684  for (auto &chainId : objTeIdToChain.second)
685  {
686  (ptrConvProxy->runChains).insert(chainId);
687  }
688  break;
689  }
690  }
691  }
692  return StatusCode::SUCCESS;
693 }
694 
696 {
697  // propagate up (towards L1) chain IDs if they are not in proxies
698  // technically each proxy looks at the children proxies and inserts from it all unseen chains
699  // procedure is repeated until, no single proxy needs an update (tedious - we may be smarter in future)
700 
701  while (true)
702  {
703  size_t numberOfUpdates = 0;
704  for (auto p : convProxies)
705  {
706  for (auto child : p->children)
707  {
708  size_t startSize = p->runChains.size();
709  p->runChains.insert(std::begin(child->runChains), std::end(child->runChains));
710 
711  if (startSize != p->runChains.size())
712  { // some chain needed to be inserted
713  numberOfUpdates++;
714  // if update was need, it means set of chains that passed need update as well
715  p->passChains.insert(std::begin(child->runChains), std::end(child->runChains));
716  }
717  }
718  }
719  ATH_MSG_DEBUG("Needed to propagate chains from " << numberOfUpdates << " child(ren)");
720  if (numberOfUpdates == 0)
721  {
722  break;
723  }
724  }
725  return StatusCode::SUCCESS;
726 }
727 
729 {
730  // remove proxies that have no chains
731  for (auto i = std::begin(convProxies); i != std::end(convProxies);)
732  {
733  if ((*i)->runChains.empty())
734  {
735  ConvProxy *toDel = *i;
736  // remove it from parents/children
737  for (auto parent : toDel->parents)
738  {
739  parent->children.erase(toDel);
740  }
741  for (auto child : toDel->children)
742  {
743  child->parents.erase(toDel);
744  }
745  delete toDel;
746  i = convProxies.erase(i);
747  }
748  else
749  {
750  ++i;
751  }
752  }
753  ATH_MSG_DEBUG("After eliminating proxies not associated to chainsof intereset left with " << convProxies.size());
754  return StatusCode::SUCCESS;
755 }
756 
758 {
759 
760  ATH_CHECK(collapseFeaturesProxies(convProxies, run2Nav));
762  if (m_doSelfValidation)
763  {
764  ATH_CHECK(allProxiesHaveChain(convProxies));
765  ATH_CHECK(allProxiesConnected(convProxies));
766  }
767  ATH_MSG_DEBUG("Compression done");
768 
769  return StatusCode::SUCCESS;
770 }
771 
772 template <typename MAP>
774 {
775  // collapse proxies based on the mapping in the map argument(generic) and clean proxiesSet
776  std::vector<ConvProxy *> todelete;
777  for (auto &[key, proxies] : keyToProxyMap)
778  {
779  if (proxies.size() > 1)
780  {
781  ATH_MSG_DEBUG("Merging " << proxies.size() << " similar proxies");
782  for (auto p : proxies)
783  {
784  if (p->mergeAllowed(*proxies.begin()))
785  {
786  (*proxies.begin())->merge(p);
787  todelete.push_back(p);
788  }
789  // TODO consider scanning proxies another time if merge is not allowed, it may be allowed with other proxies here
790  }
791  }
792  }
793  for (auto proxy : todelete)
794  {
795  convProxies.erase(proxy);
796  delete proxy;
797  }
798  // remove from proxies set all elements that are now unassociated (remember to delete after)
799  return StatusCode::SUCCESS;
800 }
801 
803 {
804 
805  const size_t beforeCount = convProxies.size();
806  std::map<uint64_t, ConvProxySet_t> feaToProxyMap;
807  for (auto proxy : convProxies)
808  {
809  proxy->feaHash = feaToHash(proxy->te->getFeatureAccessHelpers(), proxy->te, run2Nav);
810  if (proxy->feaHash != ConvProxy::MissingFEA)
811  feaToProxyMap[proxy->feaHash].insert(proxy);
812 
813  ATH_MSG_VERBOSE("TE " << TrigConf::HLTUtils::hash2string(proxy->te->getId()) << " FEA hash " << proxy->feaHash);
814  for (const HLT::TriggerElement::FeatureAccessHelper& fea : proxy->te->getFeatureAccessHelpers())
815  {
816  ATH_MSG_VERBOSE("FEA: " << fea);
817  }
818  }
819 
820  for (auto [feaHash, proxies] : feaToProxyMap)
821  {
822  auto first = *proxies.begin();
823  for (auto p : proxies)
824  {
825  if (filterFEAs(first->te->getFeatureAccessHelpers(), run2Nav) !=
826  filterFEAs(p->te->getFeatureAccessHelpers(), run2Nav))
827  {
828  ATH_MSG_ERROR("Proxies grouped by FEA hash have actually distinct features (specific FEAs are different)");
829  for (auto id: p->passChains ) ATH_MSG_ERROR("... chain id for this proxy " << id);
830  ATH_MSG_ERROR(".... TE id of this proxy: " << TrigConf::HLTUtils::hash2string(p->te->getId()));
831  for ( auto fea: first->te->getFeatureAccessHelpers() ) {
832  ATH_MSG_ERROR("FEA1 " << fea);
833  }
834  for ( auto fea: p->te->getFeatureAccessHelpers() ) {
835  ATH_MSG_ERROR("FEA2 " << fea);
836  }
837 
838  return StatusCode::FAILURE;
839  }
840  }
841  }
842 
843 
844  ATH_CHECK(collapseProxies(convProxies, feaToProxyMap));
845  ATH_MSG_DEBUG("Proxies with features collapsing reduces size from " << beforeCount << " to " << convProxies.size());
846 
847  return StatusCode::SUCCESS;
848 }
849 
851 {
852  // merge proxies bases on the parent child relation (this has to run after feature based collapsing)
853  struct ParentChildCharacteristics
854  {
855  ConvProxy *parent = nullptr;
856  ConvProxy *child = nullptr;
857  size_t distanceFromParent = 0;
858  bool operator<(const ParentChildCharacteristics &rhs) const
859  {
860  if (parent != rhs.parent)
861  return parent < rhs.parent;
862  if (child != rhs.child)
863  return child < rhs.child;
864  return distanceFromParent < rhs.distanceFromParent;
865  }
866  };
867  const size_t beforeCount = convProxies.size();
868  std::map<ParentChildCharacteristics, ConvProxySet_t> groupedProxies;
869  for (auto proxy : convProxies)
870  {
871  if (proxy->feaHash == ConvProxy::MissingFEA)
872  {
873  ATH_MSG_VERBOSE("Featureless proxy to deal with: " << proxy->description());
874  /* the canonical case
875  merged parent
876  / | | \
877  C1 C2 C3 C4 <-- proxies to merge
878  \ | | /
879  merged child
880  */
881  auto hasSomeFeatures = [](const ConvProxy* p){ return p->feaHash != ConvProxy::MissingFEA; };
882  if (proxy->children.size() == 1 and
883  std::all_of(proxy->children.begin(), proxy->children.end(), hasSomeFeatures ) and
884  proxy->parents.size() == 1 and
885  std::all_of(proxy->parents.begin(), proxy->parents.end(), hasSomeFeatures )
886  )
887  {
888  ATH_MSG_VERBOSE("Proxy to possibly merge: " << proxy->description());
889  groupedProxies[{*(proxy->parents.begin()), *(proxy->children.begin()), 0}].insert(proxy);
890  // TODO expand it to cover longer featureless sequences
891  }
892  else
893  {
894  ATH_MSG_VERBOSE("Featureless proxy in noncanonical situation " << proxy->description());
895  ATH_MSG_VERBOSE("parents ");
896  for (auto pp : proxy->parents)
897  {
898  ATH_MSG_VERBOSE(pp->description());
899  }
900  ATH_MSG_VERBOSE("children ");
901  for (auto cp : proxy->children)
902  {
903  ATH_MSG_VERBOSE(cp->description());
904  }
905  }
906  }
907  }
908 
909  ATH_CHECK(collapseProxies(convProxies, groupedProxies));
910  ATH_MSG_DEBUG("Proxies without features collapsing reduces size from " << beforeCount << " to " << convProxies.size());
911  return StatusCode::SUCCESS;
912 }
913 
915 {
916  for (auto i = std::begin(convProxies); i != std::end(convProxies);)
917  {
918  if ((*i)->parents.size() > 1)
919  {
920  ConvProxy *toDel = *i;
921  // remove it from parents/children
922  for (auto parent : toDel->parents)
923  {
924  parent->children.erase(toDel);
925  }
926  for (auto child : toDel->children)
927  {
928  child->parents.erase(toDel);
929  }
930  delete toDel;
931  i = convProxies.erase(i);
932  }
933  else
934  {
935  ++i;
936  }
937  }
938  return StatusCode::SUCCESS;
939 }
940 
942 {
943  // from all FEAs of the associated TE pick those objects that are to be linked
944  for (auto &proxy : convProxies)
945  {
946  if (proxy->te != nullptr)
947  {
948 
949  for (HLT::TriggerElement::FeatureAccessHelper helper : proxy->te->getFeatureAccessHelpers())
950  {
951  auto [sgKey, sgCLID, sgName] = getSgKey(run2Nav, helper);
952  if (sgKey != 0)
953  {
954  if (feaToSave(helper, sgName))
955  {
956  proxy->features.push_back(helper);
957  }
958  }
959  }
960  }
961  }
962 
963  return StatusCode::SUCCESS;
964 }
965 
967 {
968 
969  // ordered_sorter
970  auto ordered_sorter = [&setRoiName = std::as_const(m_setRoiName)](const std::string &left, const std::string &right) -> bool
971  {
972  return std::find(cbegin(setRoiName), cend(setRoiName), left) < std::find(cbegin(setRoiName), cend(setRoiName), right);
973  };
974 
975  std::map<std::string, HLT::TriggerElement::FeatureAccessHelper, decltype(ordered_sorter)> mp(ordered_sorter);
976 
977  for (auto &proxy : convProxies)
978  {
979  // TODO need check & handling of case when there is more RoIs, now overwriting
980  if (HLT::TrigNavStructure::getRoINodes(proxy->te).size() > 1)
981  ATH_MSG_DEBUG("Several RoIs pointing to a proxy, taking latest one for now");
982 
983  mp.clear();
984 
985  for (const HLT::TriggerElement::FeatureAccessHelper& helper : proxy->te->getFeatureAccessHelpers())
986  {
987  auto [sgKey, sgCLID, sgName] = getSgKey(run2Nav, helper);
988  if (std::find(m_setRoiName.begin(), m_setRoiName.end(), sgName) == m_setRoiName.end())
989  {
990  // do not filter continue;
991  continue;
992  }
993  mp[sgName] = helper;
994  }
995 
996  std::transform(cbegin(mp), cend(mp), back_inserter(proxy->rois),
997  [](const std::map<std::string, HLT::TriggerElement::FeatureAccessHelper>::value_type &p)
998  { return p.second; });
999  }
1000 
1001  // roiPropagator
1002  std::set<const ConvProxy*> visited;
1003  std::function<void(std::set<ConvProxy *> &, const std::vector<HLT::TriggerElement::FeatureAccessHelper> &)>
1004  roiPropagator = [&](std::set<ConvProxy *> &convProxyChildren, const std::vector<HLT::TriggerElement::FeatureAccessHelper> &roiParent)
1005  {
1006  for (auto &proxyChild : convProxyChildren)
1007  {
1008  if ( visited.count(proxyChild) == 1 ) {
1009  continue;
1010  }
1011  visited.insert(proxyChild);
1012  if (proxyChild->rois.empty())
1013  { // no roi update, copy from parent
1014  proxyChild->rois = roiParent;
1015  if (proxyChild->children.empty() == false)
1016  {
1017  roiPropagator(proxyChild->children, roiParent);
1018  }
1019  }
1020  }
1021  };
1022 
1023  for (auto &proxy : convProxies)
1024  {
1025  roiPropagator(proxy->children, proxy->rois);
1026  }
1027 
1028  return StatusCode::SUCCESS;
1029 }
1030 
1032 {
1033  for (auto &proxy : convProxies)
1034  {
1035  for (HLT::TriggerElement::FeatureAccessHelper helper : proxy->te->getFeatureAccessHelpers())
1036  {
1037  if (helper.getCLID() == m_TrackParticleContainerCLID || helper.getCLID() == m_TauTrackContainerCLID)
1038  {
1039  proxy->tracks.push_back(helper);
1040  }
1041  }
1042  }
1043 
1044  return StatusCode::SUCCESS;
1045 }
1046 
1048 {
1049  for (auto &proxy : convProxies)
1050  {
1052  for (auto chainId : proxy->runChains)
1053  {
1054  TrigCompositeUtils::addDecisionID(chainId, proxy->imNode);
1055  }
1057  for (auto chainId : proxy->passChains)
1058  {
1059  TrigCompositeUtils::addDecisionID(chainId, proxy->hNode.back());
1060  }
1061 
1062  TrigCompositeUtils::linkToPrevious(proxy->hNode.front(), proxy->imNode, context); // H low IM up
1063  }
1064  // connecting current IM to all Hs in parent proxies
1065  for (auto &proxy : convProxies)
1066  {
1067  for (auto &parentProxy : proxy->parents)
1068  {
1069  TrigCompositeUtils::linkToPrevious(proxy->imNode, parentProxy->hNode.front(), context); // IM low H up (in parent)
1070  }
1071  }
1072  ATH_MSG_DEBUG("IM & H nodes made, output nav elements " << decisions.size());
1073  return StatusCode::SUCCESS;
1074 }
1075 
1077  const TEIdToChainsMap_t &terminalIds, const EventContext &context) const
1078 {
1079  // make node & link it properly
1080  auto makeSingleSFNode = [&decisions, &context](auto lastDecisionNode, auto chainIds, TrigCompositeUtils::DecisionID idStore = 0)
1081  {
1083  sfNode->setName("SF");
1084  TrigCompositeUtils::linkToPrevious(decisions.at(0), sfNode, context);
1085  TrigCompositeUtils::linkToPrevious(sfNode, lastDecisionNode, context);
1086  for (auto chainId : chainIds)
1087  {
1088  if (idStore == 0)
1089  {
1090  TrigCompositeUtils::addDecisionID(chainId, sfNode);
1092  }
1093  else if (chainId.numeric() == idStore)
1094  {
1095  TrigCompositeUtils::addDecisionID(chainId, sfNode);
1097  }
1098  }
1099  return sfNode;
1100  };
1101  auto makeSFNodes = [makeSingleSFNode](auto proxy, TrigCompositeUtils::DecisionID idToStore = 0)
1102  {
1103  if (proxy->hNode.empty())
1104  { // nothing has passed, so link to the IM node
1105  // TODO make sure it needs to be done like that
1106  makeSingleSFNode(proxy->imNode, proxy->runChains, idToStore);
1107  }
1108  else
1109  {
1110  // makeSFNode(proxy->hNode[0], TCU::decisionIDs(proxy->hNode[0])); // not using passChains as there may be additional filtering
1111  for (auto &hNode : proxy->hNode)
1112  {
1113  makeSingleSFNode(hNode, proxy->passChains, idToStore); // using passChains
1114  }
1115  }
1116  };
1117 
1118  for (auto proxy : convProxies)
1119  {
1120  // associate terminal nodes to filter nodes,
1121  if (proxy->children.empty())
1122  { // the H modes are terminal
1123  makeSFNodes(proxy);
1124  }
1125  else
1126  {
1127  // likely need more iterations
1128  // nonterminal nodes that are nevertheless terminal for a given chain
1129  std::vector<TCU::DecisionID> toRetain;
1130  for (auto teId : proxy->teIDs)
1131  {
1132  auto whereInMap = terminalIds.find(teId);
1133  if (whereInMap != terminalIds.end())
1134  {
1135  toRetain.insert(toRetain.end(), whereInMap->second.begin(), whereInMap->second.end());
1136  }
1137  }
1138  for (auto chainIdstore : toRetain)
1139  {
1140  makeSFNodes(proxy, chainIdstore);
1141  }
1142  }
1143  }
1144  // associate all nodes designated as final one with the filter nodes
1145 
1146  ATH_MSG_DEBUG("SF nodes made, output nav elements " << decisions.size());
1147  return StatusCode::SUCCESS;
1148 }
1149 
1151 {
1152  // Check that only ChainIDs (not LegIDs) are present in the terminus "HLTPassRaw" node.
1153  // Check that only chains which pass the event are included.
1154  TCU::Decision* terminus = decisions.at(0);
1155  ATH_CHECK( terminus->name() == TCU::summaryPassNodeName() );
1156  TCU::DecisionIDContainer currentIDs;
1157  TCU::DecisionIDContainer filteredIDs;
1158  TCU::decisionIDs(terminus, currentIDs); // Extract, std::vector -> std::set
1159  for (const TCU::DecisionID id : currentIDs)
1160  {
1161  const TCU::DecisionID idToCheck = ( TCU::isLegId(id) ? TCU::getIDFromLeg( HLT::Identifier(id) ).numeric() : id );
1162  const std::string chainName = HLT::Identifier(idToCheck).name();
1163  // Sanity check
1164  if (!m_chainsToSave.empty())
1165  {
1166  if (std::find(m_chainsToSave.begin(), m_chainsToSave.end(), chainName) == m_chainsToSave.end())
1167  {
1168  ATH_MSG_ERROR("Navigation information for chain " << chainName << " in "
1169  << TCU::summaryPassNodeName() << " but this chain wasn't on the list of chains to save");
1170  return StatusCode::FAILURE;
1171  }
1172  }
1173  if (m_tdt->isPassed(chainName))
1174  {
1175  filteredIDs.insert(idToCheck);
1176  }
1177  }
1178  terminus->setDecisions( std::vector<TCU::DecisionID>() ); // decisions.clear(), but via the xAOD setter function
1179  TCU::insertDecisionIDs(filteredIDs, terminus); // Insert, std::set -> std::vector
1180  ATH_MSG_VERBOSE("After filtering out leg IDs and checking isPassed, "
1181  "the terminus node goes from " << currentIDs.size() << " to " << filteredIDs.size() << " chain IDs.");
1182  if (msgLvl(MSG::VERBOSE))
1183  {
1184  for (const TCU::DecisionID id : filteredIDs)
1185  {
1186  ATH_MSG_VERBOSE(" -- Retained passing ID: " << HLT::Identifier(id));
1187  }
1188  }
1189  return StatusCode::SUCCESS;
1190 }
1191 
1193  const EventContext &context) const
1194 {
1195 
1196  auto makeL1Node = [&decisions, &context](auto firstDecisionNode, auto chainIds)
1197  {
1199  L1Node->setName(TrigCompositeUtils::hltSeedingNodeName()); // L1
1200  for (auto chainId : chainIds)
1201  {
1202  TrigCompositeUtils::addDecisionID(chainId, L1Node);
1203  }
1204  TrigCompositeUtils::linkToPrevious(firstDecisionNode, L1Node, context); // IM -> L1
1205 
1206  return L1Node;
1207  };
1208 
1209  for (auto &proxy : convProxies)
1210  {
1211  // associate initial node to filter nodes,
1212  if (proxy->parents.empty())
1213  { // the IM node is initial
1214  proxy->l1Node = makeL1Node(proxy->imNode, TCU::decisionIDs(proxy->imNode)); // not using passChains as there may be additional filtering
1215  }
1216  }
1217 
1218  ATH_MSG_DEBUG("L1 nodes made, output nav elements ");
1219  return StatusCode::SUCCESS;
1220 }
1221 
1223 {
1224  size_t feaCount{0};
1225  if (proxy.features.empty())
1226  { // no features
1227  ++feaCount;
1228  }
1229  for (const auto &fea : proxy.features)
1230  {
1231  if (fea.getIndex().objectsBegin() == fea.getIndex().objectsEnd())
1232  {
1233  ++feaCount;
1234  }
1235  for (auto n = fea.getIndex().objectsBegin(); n < fea.getIndex().objectsEnd(); ++n)
1236  {
1237  ++feaCount;
1238  }
1239  }
1240  // 1 means a deafult H node created is enough, no need to expand H nodes
1241  return feaCount;
1242 }
1243 
1245 {
1246  // from all FEAs of the associated TE pick those objects that are to be linked
1247  for (const auto &proxy : convProxies)
1248  {
1249  auto feaN = getFeaSize(*proxy);
1250  if (feaN > 1)
1251  { // expand for more H nodes and connect them
1252  while (--feaN)
1253  {
1255  for (auto chainId : proxy->passChains) // adding hash values of active chains to expanded H nodes
1256  {
1257  TrigCompositeUtils::addDecisionID(chainId, proxy->hNode.back());
1258  }
1259  // connecting to upeer IM node
1260  TrigCompositeUtils::linkToPrevious(proxy->hNode.back(), proxy->imNode, context); // H low IM up
1261  // connecting created H to IM in children proxies
1262  for (auto &childProxy : proxy->children)
1263  {
1264  TrigCompositeUtils::linkToPrevious(childProxy->imNode, proxy->hNode.back(), context); // IM child H up (just created))
1265  }
1266  }
1267  }
1268 
1269  if (proxy->features.empty())
1270  { // no features attached, self link
1272  proxy->hNode.front()->setObjectLink<xAOD::TrigCompositeContainer>(TrigCompositeUtils::featureString(), linkToSelf);
1273  }
1274 
1275  auto hNodeIter = proxy->hNode.begin();
1276  for (auto &fea : proxy->features)
1277  {
1278  auto [sgKey, sgCLID, sgName] = getSgKey(run2Nav, fea);
1279  // link to itself when lined collection has size 0
1280  if (fea.getIndex().objectsBegin() == fea.getIndex().objectsEnd())
1281  {
1283  (*hNodeIter)->setObjectLink<xAOD::TrigCompositeContainer>(TrigCompositeUtils::featureString(), linkToSelf);
1284  ++hNodeIter;
1285  }
1286  for (auto n = fea.getIndex().objectsBegin(); n < fea.getIndex().objectsEnd(); ++n)
1287  {
1288  // connecting feature
1289  (*hNodeIter)->typelessSetObjectLink(TrigCompositeUtils::featureString(), sgKey, sgCLID, n, n + 1);
1290  ++hNodeIter;
1291  }
1292  }
1293  }
1294 
1295  return StatusCode::SUCCESS;
1296 }
1297 
1299 {
1300  // from all Rois of the associated TE pick those objects that are to be linked
1301  for (auto &proxy : convProxies)
1302  {
1303  for (auto &roi : proxy->rois)
1304  {
1305  auto [sgKey, sgCLID, sgName] = getSgKey(run2Nav, roi);
1306  if (proxy->l1Node)
1307  {
1308  proxy->l1Node->typelessSetObjectLink(TrigCompositeUtils::initialRoIString(), sgKey, sgCLID, roi.getIndex().objectsBegin());
1309  }
1310  if (proxy->rois.empty() == false)
1311  {
1312  proxy->imNode->typelessSetObjectLink(TrigCompositeUtils::roiString(), sgKey, sgCLID, roi.getIndex().objectsBegin());
1313  }
1314  }
1315  }
1316 
1317  return StatusCode::SUCCESS;
1318 }
1319 
1321 {
1322  for (auto &proxy : convProxies)
1323  {
1324  for (auto &trk : proxy->tracks)
1325  {
1326  if (proxy->imNode->hasObjectLink(TrigCompositeUtils::roiString()))
1327  {
1328  try
1329  {
1331  if (ROIElementLink.isValid())
1332  {
1334  auto [sgKey, sgCLID, sgName] = getSgKey(run2Nav, trk);
1335  if (sgCLID == m_TrackParticleContainerCLID || sgCLID == m_TauTrackContainerCLID)
1336  {
1337  const char *tName = sgCLID == m_TrackParticleContainerCLID ? "TEMP_TRACKS" : "TEMP_TAU_TRACKS";
1338  auto d = std::make_unique<TrigCompositeUtils::Decision>();
1339  d->makePrivateStore();
1340  d->typelessSetObjectLink(tName, sgKey, sgCLID, trk.getIndex().objectsBegin());
1341  if (sgCLID == m_TrackParticleContainerCLID)
1342  {
1343  for (const ElementLink<xAOD::TrackParticleContainer> &track : d->objectCollectionLinks<xAOD::TrackParticleContainer>(tName))
1344  {
1345  if (track.isValid())
1346  {
1347  const xAOD::TrackParticle *t = *track;
1348  viewBookkeeper(*t) = ROIElementLink;
1349  }
1350  }
1351  }
1352  if (m_includeTauTrackFeatures == false && sgCLID == m_TauTrackContainerCLID)
1353  {
1354  for (const ElementLink<xAOD::TauTrackContainer> &track : d->objectCollectionLinks<xAOD::TauTrackContainer>(tName))
1355  {
1356  if (track.isValid())
1357  {
1358  const xAOD::TauTrack_v1 *t = *track;
1359  viewBookkeeper(*t) = ROIElementLink;
1360  }
1361  }
1362  }
1363  }
1364  }
1365  } catch (SG::ExcBadForwardLink&) {
1366  ATH_MSG_WARNING("Unable to create an ElementLink into a container with no entries");
1367  }
1368  }
1369  }
1370  }
1371 
1372  return StatusCode::SUCCESS;
1373 }
1374 
1375 // does not need to be a method, so kept as local
1377 {
1378  CLID thePassBitsCLID = ClassID_traits<xAOD::TrigPassBits>::ID();
1379  CLID thePassBitsContCLID = ClassID_traits<xAOD::TrigPassBitsContainer>::ID();
1380 
1381  return fea.getCLID() == thePassBitsCLID or fea.getCLID() == thePassBitsContCLID;
1382 }
1383 
1384 std::vector<HLT::TriggerElement::FeatureAccessHelper> Run2ToRun3TrigNavConverterV2::filterFEAs(const std::vector<HLT::TriggerElement::FeatureAccessHelper> &feaVector, const HLT::TrigNavStructure &navigationDecoder) const {
1385  std::vector<HLT::TriggerElement::FeatureAccessHelper> out;
1386  for (auto fea : feaVector)
1387  {
1388  if (feaToSkip(fea))
1389  {
1390  ATH_MSG_VERBOSE("Skipping in FEA hash calculation");
1391  continue;
1392  }
1393 
1394  auto [sgKey, sgCLID, sgName] = getSgKey(navigationDecoder, fea);
1395 
1396  if (sgKey == 0)
1397  {
1398  ATH_MSG_VERBOSE("Skipping unrecorded (missing in SG) FEA hash calculation - name in SG: " << sgName << " FEA " << fea);
1399  continue;
1400  }
1401  out.push_back(fea);
1402  }
1403  return out;
1404 }
1405 
1406 uint64_t Run2ToRun3TrigNavConverterV2::feaToHash(const std::vector<HLT::TriggerElement::FeatureAccessHelper> &feaVector, const HLT::TriggerElement *te_ptr, const HLT::TrigNavStructure &navigationDecoder) const
1407 {
1408  // FEA vectors hashing
1409  ATH_MSG_VERBOSE("Calculating FEA hash");
1410  uint64_t hash = 0;
1411  for (auto fea : filterFEAs(feaVector, navigationDecoder))
1412  {
1413  ATH_MSG_VERBOSE("Including FEA in hash CLID: " << fea.getCLID() << " te Id: " << te_ptr->getId());
1414  boost::hash_combine(hash, fea.getCLID());
1415  boost::hash_combine(hash, fea.getIndex().subTypeIndex());
1416  boost::hash_combine(hash, fea.getIndex().objectsBegin());
1417  boost::hash_combine(hash, fea.getIndex().objectsEnd());
1418  }
1419  ATH_MSG_VERBOSE("Obtained FEA hash " << hash);
1420  return hash;
1421 }
1422 
1424 {
1425  auto iter = m_collectionsToSaveDecoded.find(fea.getCLID());
1426  if (iter != m_collectionsToSaveDecoded.end())
1427  {
1428  if ( iter->second.empty() )
1429  return true; // feature accepted for saving
1430  ATH_MSG_DEBUG("fea to save CLID: " << fea.getCLID() << ", sgName: " << sgName << " " <<iter->second.size() << " " << iter->second.empty() );
1431  return iter->second.contains(sgName);
1432  }
1433 
1434  return false;
1435 }
1436 
1437 
1438 
1440 {
1441  auto [sgKey, sgCLID, sgName] = getSgKey(run2Nav, roi);
1442  if (std::find(m_setRoiName.begin(), m_setRoiName.end(), sgName) != m_setRoiName.end())
1443  {
1444  return true;
1445  }
1446 
1447  return false;
1448 }
1449 
1451 {
1452  for (auto p : proxies)
1453  {
1454  if (p->runChains.empty())
1455  {
1456  ATH_MSG_ERROR("Proxy with no chains");
1457  return StatusCode::FAILURE;
1458  }
1459  }
1460  ATH_MSG_DEBUG("CHECK OK, no proxies w/o a chain");
1461  return StatusCode::SUCCESS;
1462 }
1463 
1465 {
1466  for (auto p : proxies)
1467  {
1468  if (p->children.empty() and p->parents.empty() and not p->runChains.empty())
1469  {
1470  ATH_MSG_ERROR("Orphanted proxy N chains run:" << p->runChains.size());
1471  return StatusCode::FAILURE;
1472  }
1473  }
1474  ATH_MSG_DEBUG("CHECK OK, no orphanted proxies");
1475  return StatusCode::SUCCESS;
1476 }
1477 
1479 {
1480  ATH_MSG_DEBUG("CHECK OK, no excessive number of H nodes per proxy");
1481  return StatusCode::SUCCESS;
1482 }
1483 
1485 {
1486  // build map of all links to H nodes from IMs and FS
1487  std::set<const TrigCompositeUtils::Decision *> linkedHNodes;
1488  for (auto d : decisions)
1489  {
1490  if (d->name() == "IM" or d->name() == "FS")
1491  {
1492  for (auto el : TCU::getLinkToPrevious(d))
1493  {
1494  linkedHNodes.insert(*el); // dereferences to bare pointer
1495  }
1496  }
1497  }
1498  for (auto d : decisions)
1499  {
1500  if (d->name() == "H")
1501  {
1502  if (linkedHNodes.count(d) == 0)
1503  {
1504  ATH_MSG_ERROR("Orphaned H node");
1505  return StatusCode::FAILURE;
1506  }
1507  }
1508  }
1509  ATH_MSG_DEBUG("CHECK OK, all H modes are connected");
1510 
1511  return StatusCode::SUCCESS;
1512 }
1513 
1514 std::tuple<uint32_t, CLID, std::string> Run2ToRun3TrigNavConverterV2::getSgKey(const HLT::TrigNavStructure &navigationDecoder, const HLT::TriggerElement::FeatureAccessHelper &helper) const
1515 {
1516  const std::string hltLabel = navigationDecoder.label(helper.getCLID(), helper.getIndex().subTypeIndex());
1517 
1518  const CLID saveCLID = [&](const CLID &clid)
1519  {
1520  if (clid == m_roIDescriptorCLID)
1522  if (clid == m_TrigEMClusterCLID)
1524  if (clid == m_TrigRingerRingsCLID)
1526  return clid;
1527  }(helper.getCLID());
1528 
1529  std::string type_name;
1530  if (m_clidSvc->getTypeNameOfID(saveCLID, type_name).isFailure())
1531  {
1532  return {0, 0, ""};
1533  }
1534 
1535  const auto sgStringKey = HLTNavDetails::formatSGkey("HLT", type_name, hltLabel);
1536  const bool isAvailable = evtStore()->contains(saveCLID, sgStringKey);
1537  ATH_MSG_DEBUG(" Objects presence " << helper << " " << sgStringKey << (isAvailable ? " present" : " absent"));
1538  if (!isAvailable)
1539  {
1540  return {0, saveCLID, ""};
1541  }
1542 
1543  return {evtStore()->stringToKey(sgStringKey, saveCLID), saveCLID, hltLabel}; // sgKey, sgCLID, sgName
1544 }
Run2ToRun3TrigNavConverterV2::fillRelevantTracks
StatusCode fillRelevantTracks(ConvProxySet_t &convProxies) const
Definition: Run2ToRun3TrigNavConverterV2.cxx:1031
operator<
bool operator<(const DataVector< T > &a, const DataVector< T > &b)
Vector ordering relation.
Run2ToRun3TrigNavConverterV2::m_roIDescriptorCLID
CLID m_roIDescriptorCLID
Definition: Run2ToRun3TrigNavConverterV2.h:174
SpecialCases::mu2MunoL1Special
const std::regex mu2MunoL1Special
Definition: SpecialCases.h:36
Run2ToRun3TrigNavConverterV2::collapseProxies
StatusCode collapseProxies(ConvProxySet_t &, MAP &) const
Definition: Run2ToRun3TrigNavConverterV2.cxx:773
Run2ToRun3TrigNavConverterV2::m_trigNavKey
SG::ReadHandleKey< xAOD::TrigNavigation > m_trigNavKey
Definition: Run2ToRun3TrigNavConverterV2.h:79
TrigConf::TrigConfData::name
const std::string & name() const
Definition: TrigConfData.h:22
Run2ToRun3TrigNavConverterV2::fillRelevantRois
StatusCode fillRelevantRois(ConvProxySet_t &convProxies, const HLT::TrigNavStructure &run2Nav) const
Definition: Run2ToRun3TrigNavConverterV2.cxx:966
Run2ToRun3TrigNavConverterV2::createL1Nodes
StatusCode createL1Nodes(const ConvProxySet_t &convProxies, xAOD::TrigCompositeContainer &decisions, const EventContext &context) const
Definition: Run2ToRun3TrigNavConverterV2.cxx:1192
ChainNameParser.h
ConvProxy::merge
void merge(ConvProxy *other)
Definition: Run2ToRun3TrigNavConverterV2.cxx:60
StateLessPT_NewConfig.proxy
proxy
Definition: StateLessPT_NewConfig.py:392
Run2ToRun3TrigNavConverterV2::initialize
virtual StatusCode initialize() override
Definition: Run2ToRun3TrigNavConverterV2.cxx:152
runLayerRecalibration.chain
chain
Definition: runLayerRecalibration.py:175
TrigCompositeUtils::DecisionID
unsigned int DecisionID
Definition: TrigComposite_v1.h:27
Run2ToRun3TrigNavConverterV2::~Run2ToRun3TrigNavConverterV2
virtual ~Run2ToRun3TrigNavConverterV2() override
Definition: Run2ToRun3TrigNavConverterV2.cxx:148
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
ConvProxy::runChains
std::set< HLT::Identifier > runChains
Definition: Run2ToRun3TrigNavConverterV2.h:45
Run2ToRun3TrigNavConverterV2::Run2ToRun3TrigNavConverterV2
Run2ToRun3TrigNavConverterV2(const std::string &name, ISvcLocator *pSvcLocator)
Definition: Run2ToRun3TrigNavConverterV2.cxx:144
HLT::TrigNavStructure::label
std::string label(class_id_type clid, const index_or_label_type &sti_or_label) const
Definition: TrigNavStructure.cxx:775
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
Run2ToRun3TrigNavConverterV2::linkRoiNode
StatusCode linkRoiNode(ConvProxySet_t &convProxies, const HLT::TrigNavStructure &run2Nav) const
Definition: Run2ToRun3TrigNavConverterV2.cxx:1298
Run2ToRun3TrigNavConverterV2::updateTerminusNode
StatusCode updateTerminusNode(xAOD::TrigCompositeContainer &, const EventContext &context) const
Definition: Run2ToRun3TrigNavConverterV2.cxx:1150
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
Run2ToRun3TrigNavConverterV2::allProxiesConnected
StatusCode allProxiesConnected(const ConvProxySet_t &) const
Definition: Run2ToRun3TrigNavConverterV2.cxx:1464
hist_file_dump.d
d
Definition: hist_file_dump.py:137
xAOD::teId
teId
Definition: L2StandAloneMuon_v1.cxx:323
TrigCompositeUtils::hypoAlgNodeName
const std::string & hypoAlgNodeName()
Definition: TrigCompositeUtilsRoot.cxx:904
Run2ToRun3TrigNavConverterV2::m_configSvc
ServiceHandle< TrigConf::IHLTConfigSvc > m_configSvc
Definition: Run2ToRun3TrigNavConverterV2.h:81
Run2ToRun3TrigNavConverterV2::m_configUpdateMutex
std::mutex m_configUpdateMutex
Definition: Run2ToRun3TrigNavConverterV2.h:96
Run2ToRun3TrigNavConverterV2::removeUnassociatedProxies
StatusCode removeUnassociatedProxies(ConvProxySet_t &) const
Definition: Run2ToRun3TrigNavConverterV2.cxx:728
TrigCompositeUtils::addDecisionID
void addDecisionID(DecisionID id, Decision *d)
Appends the decision (given as ID) to the decision object.
Definition: TrigCompositeUtilsRoot.cxx:61
Run2ToRun3TrigNavConverterV2::getSgKey
std::tuple< uint32_t, CLID, std::string > getSgKey(const HLT::TrigNavStructure &navigationDecoder, const HLT::TriggerElement::FeatureAccessHelper &helper) const
Definition: Run2ToRun3TrigNavConverterV2.cxx:1514
ConvProxy::MissingFEA
static const uint64_t MissingFEA
Definition: Run2ToRun3TrigNavConverterV2.h:47
SpecialCases::bjetMuChain
const std::regex bjetMuChain
Definition: SpecialCases.h:38
Run2ToRun3TrigNavConverterV2::m_collectionsToSave
Gaudi::Property< std::vector< std::string > > m_collectionsToSave
Definition: Run2ToRun3TrigNavConverterV2.h:90
PlotCalibFromCool.begin
begin
Definition: PlotCalibFromCool.py:94
python.TrigCompositeUtils.isLegId
def isLegId(chainName)
Definition: DecisionHandling/python/TrigCompositeUtils.py:18
HLT::TriggerElement::getId
te_id_type getId() const
reset internals.
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:43
Run2ToRun3TrigNavConverterV2::m_trigOutputNavKey
SG::WriteHandleKey< xAOD::TrigCompositeContainer > m_trigOutputNavKey
Definition: Run2ToRun3TrigNavConverterV2.h:93
Run2ToRun3TrigNavConverterV2::bjetMuChainConfigDecoder
StatusCode bjetMuChainConfigDecoder(TEIdToChainsMap_t &allTES, TEIdToChainsMap_t &finalTEs, const TrigConf::HLTChain *ptrChain) const
Definition: Run2ToRun3TrigNavConverterV2.cxx:542
HLT::TriggerElement::FeatureAccessHelper::getCLID
class_id_type getCLID() const
Class ID of object.
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:208
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
Run2ToRun3TrigNavConverterV2.h
SpecialCases.h
TrigCompositeUtils::insertDecisionIDs
void insertDecisionIDs(const Decision *src, Decision *dest)
Appends the decision IDs of src to the dest decision object.
Definition: TrigCompositeUtilsRoot.cxx:80
Run2ToRun3TrigNavConverterV2::m_roisToSave
Gaudi::Property< std::vector< std::string > > m_roisToSave
Definition: Run2ToRun3TrigNavConverterV2.h:91
AthCommonMsg< Gaudi::Algorithm >::msgLvl
bool msgLvl(const MSG::Level lvl) const
Definition: AthCommonMsg.h:30
Run2ToRun3TrigNavConverterV2::m_TrigRingerRingsCLID
CLID m_TrigRingerRingsCLID
Definition: Run2ToRun3TrigNavConverterV2.h:176
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
Run2ToRun3TrigNavConverterV2::m_setRoiName
std::vector< std::string > m_setRoiName
Definition: Run2ToRun3TrigNavConverterV2.h:172
TrigConf::HLTChain::signatures
const std::vector< HLTSignature * > & signatures() const
Definition: TrigConfHLTData/TrigConfHLTData/HLTChain.h:109
xAOD::TrigComposite_v1::setDecisions
void setDecisions(const std::vector< TrigCompositeUtils::DecisionID > &decisions)
Set positive HLT chain decisions associated with this TrigComposite. Navigation use.
Run2ToRun3TrigNavConverterV2::m_collectionsToSaveDecoded
std::map< CLID, std::set< std::string > > m_collectionsToSaveDecoded
Definition: Run2ToRun3TrigNavConverterV2.h:170
HLTNavDetails::formatSGkey
std::string formatSGkey(const std::string &prefix, const std::string &containername, const std::string &label)
declaration of formatting function.
Definition: Holder.cxx:122
Run2ToRun3TrigNavConverterV2::m_TauTrackContainerCLID
CLID m_TauTrackContainerCLID
Definition: Run2ToRun3TrigNavConverterV2.h:183
Run2ToRun3TrigNavConverterV2::m_tdt
PublicToolHandle< Trig::TrigDecisionTool > m_tdt
Definition: Run2ToRun3TrigNavConverterV2.h:80
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
TrigConf::HLTChain
HLT chain configuration information.
Definition: TrigConfHLTData/TrigConfHLTData/HLTChain.h:35
Run2ToRun3TrigNavConverterV2::m_chainIdsPrinter
std::function< void(const ConvProxy *)> m_chainIdsPrinter
Definition: Run2ToRun3TrigNavConverterV2.h:149
Run2ToRun3TrigNavConverterV2::m_allTEIdsToChains
TEIdToChainsMap_t m_allTEIdsToChains
Definition: Run2ToRun3TrigNavConverterV2.h:97
HLT::TrigNavStructure
Definition: TrigNavStructure.h:40
SpecialCases::egammaDiEtcut
const std::regex egammaDiEtcut
Definition: SpecialCases.h:30
SpecialCases::gammaXeChain
const std::regex gammaXeChain
Definition: SpecialCases.h:29
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
ConvProxy::children
std::set< ConvProxy * > children
Definition: Run2ToRun3TrigNavConverterV2.h:43
DeMoUpdate.reverse
reverse
Definition: DeMoUpdate.py:563
ExpressionParsing::isAvailable
bool isAvailable(const T_Aux &cont, SG::auxid_t auxid)
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:83
Run2ToRun3TrigNavConverterV2::feaToHash
uint64_t feaToHash(const std::vector< HLT::TriggerElement::FeatureAccessHelper > &feaVector, const HLT::TriggerElement *te_ptr, const HLT::TrigNavStructure &navigationDecoder) const
returns true if this particular feature is to be saved (linked)
Definition: Run2ToRun3TrigNavConverterV2.cxx:1406
Run2ToRun3TrigNavConverterV2::m_roIDescriptorCollectionCLID
CLID m_roIDescriptorCollectionCLID
Definition: Run2ToRun3TrigNavConverterV2.h:175
runBeamSpotCalibration.helper
helper
Definition: runBeamSpotCalibration.py:112
PixelModuleFeMask_create_db.remove
string remove
Definition: PixelModuleFeMask_create_db.py:83
ClassID_traits::ID
static const CLID & ID()
the CLID of T
Definition: Control/AthenaKernel/AthenaKernel/ClassID_traits.h:50
AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
Run2ToRun3TrigNavConverterV2::createSFNodes
StatusCode createSFNodes(const ConvProxySet_t &, xAOD::TrigCompositeContainer &, const TEIdToChainsMap_t &finalTEs, const EventContext &context) const
Definition: Run2ToRun3TrigNavConverterV2.cxx:1076
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
Run2ToRun3TrigNavConverterV2::filterFEAs
std::vector< HLT::TriggerElement::FeatureAccessHelper > filterFEAs(const std::vector< HLT::TriggerElement::FeatureAccessHelper > &feaVector, const HLT::TrigNavStructure &navigationDecoder) const
< both method skip TrigPassBits
Definition: Run2ToRun3TrigNavConverterV2.cxx:1384
HLTUtils.h
Run2ToRun3TrigNavConverterV2::extractTECtoChainMapping
StatusCode extractTECtoChainMapping(TEIdToChainsMap_t &allTES, TEIdToChainsMap_t &finalTEs) const
Definition: Run2ToRun3TrigNavConverterV2.cxx:395
HLT::TrigNavStructure::getDirectPredecessors
static const std::vector< TriggerElement * > & getDirectPredecessors(const TriggerElement *te)
returns list of direct predecessors (nodes seeding me)
Definition: TrigNavStructure.cxx:120
SG::Decorator
Helper class to provide type-safe access to aux data.
Definition: Decorator.h:59
TrigPassBitsContainer.h
ConvProxy::teIDs
std::vector< HLT::te_id_type > teIDs
Definition: Run2ToRun3TrigNavConverterV2.h:41
lumiFormat.i
int i
Definition: lumiFormat.py:85
TrigCompositeUtils::initialRoIString
const std::string & initialRoIString()
Definition: TrigCompositeUtilsRoot.cxx:868
TrigCompositeUtils::getLinkToPrevious
const std::vector< ElementLink< DecisionContainer > > getLinkToPrevious(const Decision *d)
returns links to previous decision object 'seed'
Definition: TrigCompositeUtilsRoot.cxx:156
ClassID_traits.h
a traits class that associates a CLID to a type T It also detects whether T inherits from Gaudi DataO...
beamspotman.n
n
Definition: beamspotman.py:731
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
SG::WriteHandle::ptr
pointer_type ptr()
Dereference the pointer.
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
SpecialCases::isTopo
const std::regex isTopo
Definition: SpecialCases.h:33
HLT::TriggerElement
TriggerElement is the basic ingreedient of the interface between HLT algorithms and the navigation It...
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:27
ConvProxy::description
std::string description() const
Definition: Run2ToRun3TrigNavConverterV2.cxx:129
Types.h
TriggerElement.h
Run2ToRun3TrigNavConverterV2::linkTrkNode
StatusCode linkTrkNode(ConvProxySet_t &convProxies, const HLT::TrigNavStructure &run2Nav) const
Definition: Run2ToRun3TrigNavConverterV2.cxx:1320
Run2ToRun3TrigNavConverterV2::createIMHNodes
StatusCode createIMHNodes(ConvProxySet_t &, xAOD::TrigCompositeContainer &, const EventContext &) const
Definition: Run2ToRun3TrigNavConverterV2.cxx:1047
ConvProxy::passChains
std::set< HLT::Identifier > passChains
Definition: Run2ToRun3TrigNavConverterV2.h:46
Amg::transform
Amg::Vector3D transform(Amg::Vector3D &v, Amg::Transform3D &tr)
Transform a point from a Trasformation3D.
Definition: GeoPrimitivesHelpers.h:156
Run2ToRun3TrigNavConverterV2::m_includeTauTrackFeatures
Gaudi::Property< bool > m_includeTauTrackFeatures
Definition: Run2ToRun3TrigNavConverterV2.h:87
Run2ToRun3TrigNavConverterV2::m_TrigEMClusterContainerCLID
CLID m_TrigEMClusterContainerCLID
Definition: Run2ToRun3TrigNavConverterV2.h:179
TEIdToChainsMap_t
std::map< HLT::te_id_type, std::set< HLT::Identifier > > TEIdToChainsMap_t
Definition: Run2ToRun3TrigNavConverterV2.h:61
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
test_pyathena.parent
parent
Definition: test_pyathena.py:15
plotIsoValidation.el
el
Definition: plotIsoValidation.py:197
xAOD::uint64_t
uint64_t
Definition: EventInfo_v1.cxx:123
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
add
bool add(const std::string &hname, TKey *tobj)
Definition: fastadd.cxx:55
xAOD::TrigComposite_v1
Class used to describe composite objects in the HLT.
Definition: TrigComposite_v1.h:52
ConvProxy::ConvProxy
ConvProxy(const HLT::TriggerElement *te)
Definition: Run2ToRun3TrigNavConverterV2.cxx:21
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
HLT::Identifier
Definition: TrigCompositeUtils/TrigCompositeUtils/HLTIdentifier.h:20
CLID
uint32_t CLID
The Class ID type.
Definition: Event/xAOD/xAODCore/xAODCore/ClassID_traits.h:47
ReadFromCoolCompare.os
os
Definition: ReadFromCoolCompare.py:231
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
xAOD::decisions
decisions
Definition: TrigComposite_v1.cxx:101
Run2ToRun3TrigNavConverterV2::removeTopologicalProxies
StatusCode removeTopologicalProxies(ConvProxySet_t &) const
Definition: Run2ToRun3TrigNavConverterV2.cxx:914
Run2ToRun3TrigNavConverterV2::noUnconnectedHNodes
StatusCode noUnconnectedHNodes(const xAOD::TrigCompositeContainer &) const
Definition: Run2ToRun3TrigNavConverterV2.cxx:1484
SpecialCases::egammaEtcut
const std::regex egammaEtcut
Definition: SpecialCases.h:31
min
#define min(a, b)
Definition: cfImp.cxx:40
TrigCompositeUtils::featureString
const std::string & featureString()
Definition: TrigCompositeUtilsRoot.cxx:884
ChainNameParser::multiplicities
std::vector< int > multiplicities(const std::string &chain)
Definition: ChainNameParser.cxx:202
ConvProxy::isParent
bool isParent(const ConvProxy *other) const
Definition: Run2ToRun3TrigNavConverterV2.cxx:37
Run2ToRun3TrigNavConverterV2::collapseFeaturesProxies
StatusCode collapseFeaturesProxies(ConvProxySet_t &convProxies, const HLT::TrigNavStructure &run2Nav) const
Definition: Run2ToRun3TrigNavConverterV2.cxx:802
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:220
Run2ToRun3TrigNavConverterV2::m_finalTEIdsToChains
TEIdToChainsMap_t m_finalTEIdsToChains
Definition: Run2ToRun3TrigNavConverterV2.h:97
HLT::StandaloneNavigation
Definition: StandaloneNavigation.h:14
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
Run2ToRun3TrigNavConverterV2::m_doCompression
Gaudi::Property< bool > m_doCompression
Definition: Run2ToRun3TrigNavConverterV2.h:85
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition: GeometryDefs.h:34
ConvProxySet_t
std::set< ConvProxy * > ConvProxySet_t
Definition: Run2ToRun3TrigNavConverterV2.h:60
TrigConf::HLTUtils::hash2string
static const std::string hash2string(HLTHash, const std::string &category="TE")
hash function translating identifiers into names (via internal dictionary)
Run2ToRun3TrigNavConverterV2::associateChainsToProxies
StatusCode associateChainsToProxies(ConvProxySet_t &, const TEIdToChainsMap_t &) const
Definition: Run2ToRun3TrigNavConverterV2.cxx:663
TrigCompositeUtils::summaryPassNodeName
const std::string & summaryPassNodeName()
Definition: TrigCompositeUtilsRoot.cxx:916
LArNewCalib_PedestalAutoCorr.cp
cp
Definition: LArNewCalib_PedestalAutoCorr.py:185
Run2ToRun3TrigNavConverterV2::m_doLinkFeatures
Gaudi::Property< bool > m_doLinkFeatures
Definition: Run2ToRun3TrigNavConverterV2.h:86
Run2ToRun3TrigNavConverterV2::execute
virtual StatusCode execute(const EventContext &context) const override
Definition: Run2ToRun3TrigNavConverterV2.cxx:247
Run2ToRun3TrigNavConverterV2::getFeaSize
std::size_t getFeaSize(const ConvProxy &) const
Definition: Run2ToRun3TrigNavConverterV2.cxx:1222
Run2ToRun3TrigNavConverterV2::numberOfHNodesPerProxyNotExcessive
StatusCode numberOfHNodesPerProxyNotExcessive(const ConvProxySet_t &) const
Definition: Run2ToRun3TrigNavConverterV2.cxx:1478
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
Run2ToRun3TrigNavConverterV2::allProxiesHaveChain
StatusCode allProxiesHaveChain(const ConvProxySet_t &) const
Definition: Run2ToRun3TrigNavConverterV2.cxx:1450
HLT::TrigNavStructure::getRoINodes
static const std::vector< TriggerElement * > & getRoINodes(const TriggerElement *somenode)
gets all RoI type nodes seeding indirectly this TriggerElement
Definition: TrigNavStructure.cxx:73
Run2ToRun3TrigNavConverterV2::fillRelevantFeatures
StatusCode fillRelevantFeatures(ConvProxySet_t &convProxies, const HLT::TrigNavStructure &run2Nav) const
Definition: Run2ToRun3TrigNavConverterV2.cxx:941
Run2ToRun3TrigNavConverterV2::feaToSave
bool feaToSave(const HLT::TriggerElement::FeatureAccessHelper &fea, const std::string &sgName) const
Definition: Run2ToRun3TrigNavConverterV2.cxx:1423
xAOD::TrigComposite_v1::name
const std::string & name() const
Get a human-readable name for the object.
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
HLT::TrigNavStructure::getAllTEs
std::vector< TriggerElement * > & getAllTEs()
access needed by slimming tools.
Definition: TrigNavStructure.cxx:376
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
DeMoScan.index
string index
Definition: DeMoScan.py:364
Run2ToRun3TrigNavConverterV2::collapseFeaturelessProxies
StatusCode collapseFeaturelessProxies(ConvProxySet_t &) const
Definition: Run2ToRun3TrigNavConverterV2.cxx:850
Run2ToRun3TrigNavConverterV2::m_CaloClusterCLID
CLID m_CaloClusterCLID
Definition: Run2ToRun3TrigNavConverterV2.h:180
HLT::TrigNavStructure::isInitialNode
static bool isInitialNode(const TriggerElement *te)
queries if node is an initial one
Definition: TrigNavStructure.cxx:501
TrigCompositeUtils::DecisionIDContainer
std::set< DecisionID > DecisionIDContainer
Definition: TrigComposite_v1.h:28
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
Run2ToRun3TrigNavConverterV2::roiToSave
bool roiToSave(const HLT::TrigNavStructure &run2Nav, const HLT::TriggerElement::FeatureAccessHelper &fea) const
Definition: Run2ToRun3TrigNavConverterV2.cxx:1439
python.selector.AtlRunQuerySelectorLhcOlc.selector
selector
Definition: AtlRunQuerySelectorLhcOlc.py:611
CondAlgsOpts.found
int found
Definition: CondAlgsOpts.py:101
CaloCondBlobAlgs_fillNoiseFromASCII.hash
dictionary hash
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:109
HLT::TriggerElement::FeatureAccessHelper
the FeatureAccessHelper is a class used to keep track of features attached to this TE.
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:192
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
TrigRoiDescriptorCollection
Definition: TrigRoiDescriptorCollection.h:21
xAOD::TauTrack_v1
Definition: TauTrack_v1.h:27
HLT::StandaloneNavigation::deserialize
virtual bool deserialize(const std::vector< uint32_t > &input)
Definition: StandaloneNavigation.cxx:88
HLTSequenceList.h
Run2ToRun3TrigNavConverterV2::is2LegTopoChain
size_t is2LegTopoChain(const TrigConf::HLTChain *ptrChain) const
Definition: Run2ToRun3TrigNavConverterV2.cxx:351
DeMoScan.first
bool first
Definition: DeMoScan.py:536
Run2ToRun3TrigNavConverterV2::mirrorTEsStructure
StatusCode mirrorTEsStructure(ConvProxySet_t &, const HLT::TrigNavStructure &run2Nav) const
Definition: Run2ToRun3TrigNavConverterV2.cxx:581
python.TriggerAPI.TriggerAPISession.chainName
chainName
Definition: TriggerAPISession.py:426
Run2ToRun3TrigNavConverterV2::finalize
virtual StatusCode finalize() override
Definition: Run2ToRun3TrigNavConverterV2.cxx:242
Run2ToRun3TrigNavConverterV2::m_clidSvc
ServiceHandle< IClassIDSvc > m_clidSvc
Definition: Run2ToRun3TrigNavConverterV2.h:82
TrigCompositeUtils::decisionIDs
void decisionIDs(const Decision *d, DecisionIDContainer &destination)
Extracts DecisionIDs stored in the Decision object.
Definition: TrigCompositeUtilsRoot.cxx:67
Run2ToRun3TrigNavConverterV2::doCompression
StatusCode doCompression(ConvProxySet_t &convProxies, const HLT::TrigNavStructure &run2Nav) const
Definition: Run2ToRun3TrigNavConverterV2.cxx:757
python.utility.LHE.merge
def merge(input_file_pattern, output_file)
Merge many input LHE files into a single output file.
Definition: LHE.py:29
HLT::Identifier::name
std::string name() const
reports human redable name if it is enabled or, empty string
Definition: HLTIdentifier.cxx:14
Run2ToRun3TrigNavConverterV2::m_CaloClusterContainerCLID
CLID m_CaloClusterContainerCLID
Definition: Run2ToRun3TrigNavConverterV2.h:181
ConvProxy
Definition: Run2ToRun3TrigNavConverterV2.h:34
LArCellBinning.step
step
Definition: LArCellBinning.py:158
TrigCompositeUtils
Definition: Event/xAOD/xAODTrigger/xAODTrigger/TrigComposite.h:19
feaToSkip
bool feaToSkip(const HLT::TriggerElement::FeatureAccessHelper &fea)
Definition: Run2ToRun3TrigNavConverterV2.cxx:1376
ReadCalibFromCool.typeName
typeName
Definition: ReadCalibFromCool.py:477
SpecialCases::tauXeChain
const std::regex tauXeChain
Definition: SpecialCases.h:37
Run2ToRun3TrigNavConverterV2::printProxies
void printProxies(const ConvProxySet_t &proxies, std::function< bool(const ConvProxy *)> selector=[](const ConvProxy *){return true;}, const std::vector< std::function< void(const ConvProxy *)>> &printers={}) const
Definition: Run2ToRun3TrigNavConverterV2.cxx:647
TrigCompositeUtils::roiString
const std::string & roiString()
Definition: TrigCompositeUtilsRoot.cxx:876
ConvProxy::mergeAllowed
bool mergeAllowed(const ConvProxy *other) const
Definition: Run2ToRun3TrigNavConverterV2.cxx:48
ConvProxy::feaHash
uint64_t feaHash
Definition: Run2ToRun3TrigNavConverterV2.h:48
Run2ToRun3TrigNavConverterV2::linkFeaNode
StatusCode linkFeaNode(ConvProxySet_t &convProxies, xAOD::TrigCompositeContainer &, const HLT::TrigNavStructure &run2Nav, const EventContext &context) const
Definition: Run2ToRun3TrigNavConverterV2.cxx:1244
defineDB.jets
list jets
Definition: JetTagCalibration/share/defineDB.py:24
Run2ToRun3TrigNavConverterV2::m_TrigRingerRingsContainerCLID
CLID m_TrigRingerRingsContainerCLID
Definition: Run2ToRun3TrigNavConverterV2.h:177
Run2ToRun3TrigNavConverterV2::cureUnassociatedProxies
StatusCode cureUnassociatedProxies(ConvProxySet_t &) const
Definition: Run2ToRun3TrigNavConverterV2.cxx:695
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::track
@ track
Definition: TrackingPrimitives.h:512
xAOD::TrackParticle_v1
Class describing a TrackParticle.
Definition: TrackParticle_v1.h:43
python.Constants.VERBOSE
int VERBOSE
Definition: Control/AthenaCommon/python/Constants.py:14
Run2ToRun3TrigNavConverterV2::m_teIDPrinter
std::function< void(const ConvProxy *)> m_teIDPrinter
Definition: Run2ToRun3TrigNavConverterV2.h:150
ConvProxy::parents
std::set< ConvProxy * > parents
Definition: Run2ToRun3TrigNavConverterV2.h:44
test_pyathena.counter
counter
Definition: test_pyathena.py:15
SG::AllowEmpty
@ AllowEmpty
Definition: StoreGate/StoreGate/VarHandleKey.h:30
Run2ToRun3TrigNavConverterV2::m_TrigEMClusterCLID
CLID m_TrigEMClusterCLID
Definition: Run2ToRun3TrigNavConverterV2.h:178
python.compressB64.c
def c
Definition: compressB64.py:93
Run2ToRun3TrigNavConverterV2::m_chainsToSave
Gaudi::Property< std::vector< std::string > > m_chainsToSave
Definition: Run2ToRun3TrigNavConverterV2.h:89
Run2ToRun3TrigNavConverterV2::m_TrackParticleContainerCLID
CLID m_TrackParticleContainerCLID
Definition: Run2ToRun3TrigNavConverterV2.h:182
SpecialCases::egammaCombinedWithEtcut
const std::regex egammaCombinedWithEtcut
Definition: SpecialCases.h:32
ConvProxy::isChild
bool isChild(const ConvProxy *other) const
Definition: Run2ToRun3TrigNavConverterV2.cxx:27
TrigCompositeUtils::inputMakerNodeName
const std::string & inputMakerNodeName()
Definition: TrigCompositeUtilsRoot.cxx:900
python.handimod.cc
int cc
Definition: handimod.py:523
Run2ToRun3TrigNavConverterV2::m_doSelfValidation
Gaudi::Property< bool > m_doSelfValidation
Definition: Run2ToRun3TrigNavConverterV2.h:84
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37
HLT::te_id_type
uint32_t te_id_type
Definition: Trigger/TrigEvent/TrigNavStructure/TrigNavStructure/Types.h:11