ATLAS Offline Software
Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Attributes | Private Attributes | Static Private Attributes | List of all members
HLT::TrigNavStructure Class Referenceabstract

#include <TrigNavStructure.h>

Inheritance diagram for HLT::TrigNavStructure:
Collaboration diagram for HLT::TrigNavStructure:

Public Member Functions

virtual ~TrigNavStructure ()
 
virtual void reset (bool inFinalize=false)
 resets all the navigation, goes to the factory and asks to withdraw all produced objects More...
 
TriggerElementgetInitialNode ()
 gets initial node, if node is not there then it is created on fly More...
 
const TriggerElementgetInitialNode () const
 
TriggerElementaddRoINode (TriggerElement *initial)
 gets RoI node (attached to initial) More...
 
TriggerElementaddNode (TriggerElement *seed, unsigned int id)
 adds nodes seeded form the one given as an argument, More...
 
TriggerElementaddNode (std::vector< TriggerElement * > &seeds, unsigned int id, bool ghost=false, bool nofwd=false)
 adds node which is seeded from several other Needed by Topological algorithms More...
 
void printASCIIArt (std::string &str, const TriggerElement *te=0, int offset=0) const
 pretty printing of the navigational structure (heavy) More...
 
bool serializeTEs (std::vector< uint32_t > &output) const
 method serizlizes the navigation structure More...
 
bool deserializeTEs (std::vector< uint32_t >::const_iterator &start, unsigned int totalSize)
 
virtual bool serialize (std::vector< uint32_t > &) const =0
 method serizlizes entire navigation More...
 
virtual bool deserialize (const std::vector< uint32_t > &)=0
 
TriggerElement::FeatureAccessHelper getFeature (const TriggerElement *te, class_id_type clid, const index_or_label_type &index_or_label) const
 typeless feature access metod More...
 
TriggerElement::FeatureAccessHelper getFeatureRecursively (const TriggerElement *startTE, class_id_type clid, const index_or_label_type &index_or_label, const TriggerElement *&sourceTE) const
 recursive search for features the function is similar to the above butif th features is not found at the startTE the search descends the structure of TEs until it is found. More...
 
void getAllRoIThresholdTEs (std::vector< TriggerElement * > &output) const
 The query returns a vector of all TriggerElements that represent a LVL1 RoI threshold. More...
 
void getAll (std::vector< TriggerElement * > &output, const bool activeOnly=true) const
 The query returning a collection of all TriggerElements. More...
 
std::vector< TriggerElement * > & getAllTEs ()
 access needed by slimming tools. More...
 
const std::vector< TriggerElement * > & getAllTEs () const
 access needed by slimming tools. More...
 
void getAllOfType (const te_id_type id, std::vector< TriggerElement * > &output, const bool activeOnly=true) const
 The query returning a collection of all TriggerElements if name is given. More...
 
unsigned int countAllOfType (const te_id_type id, const bool activeOnly=true) const
 The query counting a collection of all TriggerElement of a given type. More...
 
bool propagateDeactivation (const TrigNavStructure *nav)
 propagates deactivation of TE state This finction should be used after Trigger is rerurn on L2 and then the reruning on L2 is required. More...
 
bool combine (std::vector< unsigned int > &types, std::vector< std::vector< TriggerElement * > > &output, unsigned int maxResults=1000, bool onlyActive=true)
 For Algorithms: return all the possible n-tuples of TE* objects (te0, te1..., ten) More...
 
bool overlaps (const TriggerElement *t1, const TriggerElement *t2) const
 Check overlap between trigger elements (pointer equality or RoI overlap) More...
 
bool overlaps (const TriggerElement *t1, const std::vector< TriggerElement * > &teVec) const
 Check overlap between a TE and a vector of TEs, using the method above. More...
 
bool getTopologicallySpannedBy (const TriggerElement *te, const std::vector< unsigned int > &types, std::vector< const TriggerElement * > &children, const bool activeOnly=true) const
 gets the TEs whose predecessors were used to built a given topological TE More...
 
unsigned int copyAllFeatures (const TriggerElement *sourceTE, TriggerElement *destTE)
 gets all features from the sourceTE and copies a reference (FeatureAccessHelper) to the destTE More...
 
const BaseHoldergetHolder (const TriggerElement::FeatureAccessHelper &fea) const
 
sub_index_type subType (class_id_type clid, const index_or_label_type &sti_or_label) const
 
std::string label (class_id_type clid, const index_or_label_type &sti_or_label) const
 
virtual bool getFeatureAccessors (const TriggerElement *te, class_id_type clid, const index_or_label_type &index_or_label, bool only_single_feature, TriggerElement::FeatureVec &features, bool travel_backward_recursively, const TriggerElement *&source=m_unspecifiedTE, std::string &sourcelabel=m_unspecifiedLabel) const
 

Static Public Member Functions

static const std::vector< TriggerElement * > & getRoINodes (const TriggerElement *somenode)
 gets all RoI type nodes seeding indirectly this TriggerElement More...
 
static const std::vector< TriggerElement * > & getDirectPredecessors (const TriggerElement *te)
 returns list of direct predecessors (nodes seeding me) More...
 
static const std::vector< TriggerElement * > & getDirectSuccessors (const TriggerElement *te)
 returns list of direct predecessors (nodes I seed) More...
 
static const TriggerElementgetSuccessor (const TriggerElement *te, unsigned int id)
 returns successor of given type beeing seeded from this TE More...
 
static bool isInitialNode (const TriggerElement *te)
 queries if node is an initial one More...
 
static bool isRoINode (const TriggerElement *te)
 queries if node is an RoI type one More...
 
static bool isTerminalNode (const TriggerElement *te)
 queries if node is terminal (no more TriggerElement are seeded by it) More...
 
static bool haveCommonRoI (const TriggerElement *te1, const TriggerElement *te2)
 does this 2 share RoI More...
 
static bool haveDistinctRoI (const TriggerElement *te1, const TriggerElement *te2)
 inversion of haveCommonRoI More...
 
static bool haveAllCommonRoIs (const HLT::TriggerElement *te1, const HLT::TriggerElement *te2)
 
static bool haveCommonSeed (const TriggerElement *te1, const TriggerElement *te2)
 checks that there is any common predecessor of two TriggerElements More...
 
static bool haveDistinctSeed (const TriggerElement *te1, const TriggerElement *te2)
 inversion of haveCommonSeed
More...
 
static bool increasingOrderByTEId (const TriggerElement *te1, const TriggerElement *te2)
 for sorting TriggerElements according to their id More...
 
static bool decreasingOrderByTEId (const TriggerElement *te1, const TriggerElement *te2)
 
static bool hasIdFromTheSet (const TriggerElement *te, std::vector< unsigned int > ids)
 simple helper More...
 
static bool isNotActive (const TriggerElement *te)
 helper for the STL More...
 
static bool isTopological (const TriggerElement *te)
 
static bool isCompatibleTree (const TriggerElement *te1, const TriggerElement *te2)
 check compatibility of 2 navigation structures More...
 

Protected Member Functions

virtual bool getFeatureAccessorsSingleTE (const TriggerElement *te, class_id_type clid, const index_or_label_type &index_or_label, bool only_single_feature, TriggerElement::FeatureVec &features, const TriggerElement *&source, std::string &sourcelabel) const
 
bool matchFeature (const TriggerElement::FeatureAccessHelper &fea, class_id_type clid, const index_or_label_type &index_or_label) const
 
void fillSameRoIRelation (TriggerElement *roi, TriggerElement *te)
 rebuilds the sameRoIRelation between trigger elements (used internally by deserialize) More...
 
bool addOneLevel (std::vector< std::vector< TriggerElement * > > &currentCombs, std::vector< std::vector< std::pair< unsigned int, unsigned int > > > &currentIdxs, unsigned int type, std::vector< std::vector< TriggerElement * > > &newCombs, std::vector< std::vector< std::pair< unsigned int, unsigned int > > > &newIdxs, unsigned int maxResults=1000, bool onlyActive=1)
 Helper method for "combine": add one "level" of multiplicity to the results. More...
 
TriggerElementFactorygetFactory ()
 
TrigHolderStructuregetHolderStorage ()
 
std::recursive_mutex & getMutex ()
 
const TriggerElementFactorygetFactory () const
 
const TrigHolderStructuregetHolderStorage () const
 
std::recursive_mutex & getMutex () const
 

Static Protected Attributes

static const TriggerElement *m_unspecifiedTE ATLAS_THREAD_SAFE
 
static std::string m_unspecifiedLabel ATLAS_THREAD_SAFE
 

Private Attributes

SG::SlotSpecificObj< TriggerElementFactorym_factory
 factory of trigger elements (one per processing slot) More...
 
SG::SlotSpecificObj< TrigHolderStructurem_holderstorage
 structure for feature holders (one per processing slot) More...
 

Static Private Attributes

static std::recursive_mutex s_rmutex
 

Detailed Description

Definition at line 40 of file TrigNavStructure.h.

Constructor & Destructor Documentation

◆ ~TrigNavStructure()

TrigNavStructure::~TrigNavStructure ( )
virtual

Definition at line 30 of file TrigNavStructure.cxx.

30  {
31  for (auto& factory : m_factory) factory.reset();
32 }

Member Function Documentation

◆ addNode() [1/2]

TriggerElement * TrigNavStructure::addNode ( std::vector< TriggerElement * > &  seeds,
unsigned int  id,
bool  ghost = false,
bool  nofwd = false 
)

adds node which is seeded from several other Needed by Topological algorithms

Parameters
seedsare all TriggerElements which seed newly created
idthe id to give for the created TriggerElement
ghostflag is saying that this TE is a light weight one, no features attaching to it is allowed
nofwdflag is saying that this TE will not be deactivated automatically in fwd deactivation process(rerunning)

Definition at line 85 of file TrigNavStructure.cxx.

85  {
86  std::lock_guard<std::recursive_mutex> lock(getMutex());
87  TriggerElementFactory& factory = getFactory();
88 
89  TriggerElement* te = factory.produce(id, ghost, nofwd);
90 
91 
93  for ( it = seeds.begin(); it != seeds.end(); ++it ) {
94  // relate to it
95  TriggerElement* seednode = *it;
97  seednode->relate( te, TriggerElement::seedsRelation );
98  // add previous Features
99  te->getPreviousFeatures().insert(te->getPreviousFeatures().end(),
100  seednode->getPreviousFeatures().begin(),
101  seednode->getPreviousFeatures().end());
102 
103  // copy RoI relations
104  if ( isRoINode(seednode) ) {
105  te->relate( seednode, TriggerElement::sameRoIRelation );
106  seednode->relate( te, TriggerElement::sameRoIRelation );
107  } else {
108  std::vector<TriggerElement*>::const_iterator itbegin = seednode->getRelated( TriggerElement::sameRoIRelation ).begin();
109  std::vector<TriggerElement*>::const_iterator itend = seednode->getRelated( TriggerElement::sameRoIRelation ).end();
110 
111  for ( ; itbegin != itend; ++itbegin ) {
112  te->relate( *itbegin, TriggerElement::sameRoIRelation );
113  (*itbegin)->relate( te, TriggerElement::sameRoIRelation );
114  }
115  }
116  }
117  return te;
118 }

◆ addNode() [2/2]

TriggerElement * TrigNavStructure::addNode ( TriggerElement seed,
unsigned int  id 
)

adds nodes seeded form the one given as an argument,

Parameters
seeda TriggerElement which direct predecessor of newly created
idan id to give newly created TriggerElement

Definition at line 79 of file TrigNavStructure.cxx.

79  {
80  std::vector<TriggerElement*> list;
81  list.push_back(seednode);
82  return addNode(list, id);
83 }

◆ addOneLevel()

bool TrigNavStructure::addOneLevel ( std::vector< std::vector< TriggerElement * > > &  currentCombs,
std::vector< std::vector< std::pair< unsigned int, unsigned int > > > &  currentIdxs,
unsigned int  type,
std::vector< std::vector< TriggerElement * > > &  newCombs,
std::vector< std::vector< std::pair< unsigned int, unsigned int > > > &  newIdxs,
unsigned int  maxResults = 1000,
bool  onlyActive = 1 
)
protected

Helper method for "combine": add one "level" of multiplicity to the results.

Definition at line 610 of file TrigNavStructure.cxx.

616 {
617  // Get the list of TEs of the desired type from the event
618  std::vector<TriggerElement*> newTEs;
619  getAllOfType(type, newTEs, onlyActive);
620 
621  if (currentCombs.size() == 0) {
622 
623 
624  for (unsigned int j = 0; j < newTEs.size(); j++) {
625 
626  std::vector<TriggerElement*> cbs;
627  cbs.push_back(newTEs[j]);
628  newCombs.push_back(cbs);
629 
630  // Do the same for the auxiliary data
631  std::vector<std::pair<unsigned int, unsigned int> > ti;
632  ti.push_back(std::pair<unsigned int, unsigned int>(type, j));
633  newIdxs.push_back(ti);
634  }
635  return 1;
636  }
637 
638  // Loop over existing combinations, adding the newTEs one by one
639  for (unsigned int i = 0; i < currentCombs.size(); i++) {
640 
641  // Get the current combinations
642  std::vector<TriggerElement*>& comb = currentCombs[i];
643 
644  // Get the auxiliary data that stores the type and index of each TE.
645  // "index" is the index of the TE in the vector of TEs returned by getallOfType - it
646  // is assumed to stay the same between calls of addOneLevel within the same combine() call
647  std::vector<std::pair<unsigned int, unsigned int> >& ti = currentIdxs[i];
648 
649  // The auxiliary data is used to avoid double-counting: we make sure that if multiple
650  // TEs of the same type appear in the n-tuple, they are always such that
651  // their indices in the getAllOfType vector increases with position in the n-tuple.
652  // I.E if we have TEs (e0, m1, e1, e2) and e0, e1 and e2 are of the same type,
653  // we only take the combination such that e0 comes before e1 and e1 before e2 in
654  // the getAllOfType vector of "e".
655 
656  // To implement this, go through the auxiliary data first and get the index
657  // of the last TE of the current type that is already in the ntuple:
658  int first = 0;
659 
660  for (unsigned int j = comb.size(); j > 0; j--)
661  if (ti[j - 1].first == type) {
662  first = ti[j - 1].second;
663  break;
664  }
665 
666  // Now instead of considering all the TEs in newTEs, only loop over those with
667  // index > first.
668 
669  for (unsigned int j = first + 1; j < newTEs.size(); j++) {
670 
671  TriggerElement* te = newTEs[j];
672 
673  // Continue if the TE overlaps with any of the TEs in the existing combination
674  if (overlaps(te, comb)) continue;
675 
676  // Add the new TE to the current combination
677  comb.push_back(te);
678 
679  // Add the current combination to the list for the next level
680  newCombs.push_back(comb);
681 
682  // Restore the current combination for the next iteration
683  comb.pop_back();
684 
685  // Do the same for the auxiliary data
686  ti.push_back(std::pair<unsigned int, unsigned int>(type, j));
687  newIdxs.push_back(ti);
688  ti.pop_back();
689 
690  // If the limit is exceeded, return immediately.
691  if (maxResults > 0 && newCombs.size() >= maxResults) {
692  return true;
693  }
694  }
695  }
696 
697  return true;
698 }

◆ addRoINode()

TriggerElement * TrigNavStructure::addRoINode ( TriggerElement initial)

gets RoI node (attached to initial)

Definition at line 58 of file TrigNavStructure.cxx.

58  {
59  std::lock_guard<std::recursive_mutex> lock(getMutex());
60  TriggerElementFactory& factory = getFactory();
61 
62  if ( isInitialNode(initial) ) {
63  TriggerElement* te = factory.produce(0);
64 
65  // build seeds, seeededBy relations
68  return te;
69  }
70  return 0;
71 }

◆ combine()

bool TrigNavStructure::combine ( std::vector< unsigned int > &  types,
std::vector< std::vector< TriggerElement * > > &  output,
unsigned int  maxResults = 1000,
bool  onlyActive = true 
)

For Algorithms: return all the possible n-tuples of TE* objects (te0, te1..., ten)

such that te0.id() == types[0], te1.id() == types[1]... In the case where ids appear multiple times, n-tuple permutations are counted only once. (so if te0.id() == te1.id(), (te0, te1) will appear but not (te1, te0)) "output" is populated with all the poClassID_traits<T>::ID();ssible combinations of this type. if "activeOnly" is true, only active trigger elements are used. The list is truncated at maxResults if maxResults > 0.

Definition at line 582 of file TrigNavStructure.cxx.

585 {
586  // It should be empty anyways, but just in case...
587  output.clear();
588 
589  std::vector< std::vector<TriggerElement*> > input;
590  std::vector< std::vector<std::pair<unsigned int, unsigned int> > > newIdxs;
591 
593  type != types.end(); ++type) {
594  // Use the previous iteration's output as the input for this one
595  std::vector< std::vector<TriggerElement*> > input = output;
596  std::vector< std::vector<std::pair<unsigned int, unsigned int> > > currentIdxs = newIdxs;
597 
598  // Remove the old n-tuples
599  output.clear();
600  newIdxs.clear();
601  // Re-populate output with the (n+1)-tuples. If error return false immediately...
602  if (not addOneLevel(input, currentIdxs, *type, output, newIdxs,
603  maxResults, onlyActive)) return false;
604  }
605 
606  return true;
607 }

◆ copyAllFeatures()

unsigned int TrigNavStructure::copyAllFeatures ( const TriggerElement sourceTE,
TriggerElement destTE 
)

gets all features from the sourceTE and copies a reference (FeatureAccessHelper) to the destTE

Parameters
sourceTE(source) TriggerElement holding features
destTE(destiny) TriggerElement: copy feature references here
Returns
number of features that were copied

Definition at line 736 of file TrigNavStructure.cxx.

737 {
738  unsigned int n_features = 0;
739  // push back all featureAccessHelpers from source to destiny TE
740  for ( std::vector< TriggerElement::FeatureAccessHelper >::const_iterator it = sourceTE->getFeatureAccessHelpers().begin();
741  it != sourceTE->getFeatureAccessHelpers().end(); ++it ) {
742  destTE->addFeature(*it);
743  n_features++;
744  }
745  return n_features;
746 
747 }

◆ countAllOfType()

unsigned int TrigNavStructure::countAllOfType ( const te_id_type  id,
const bool  activeOnly = true 
) const

The query counting a collection of all TriggerElement of a given type.

Definition at line 390 of file TrigNavStructure.cxx.

390  {
391  std::lock_guard<std::recursive_mutex> lock(getMutex());
392  const TriggerElementFactory& factory = getFactory();
393 
394  if ( activeOnly )
395  return factory.listOfProduced(id).size()
396  - count_if(factory.listOfProduced(id).begin(), factory.listOfProduced(id).end(), isNotActive);
397  //else
398  return factory.listOfProduced(id).size();
399 }

◆ decreasingOrderByTEId()

bool TrigNavStructure::decreasingOrderByTEId ( const TriggerElement te1,
const TriggerElement te2 
)
static

Definition at line 489 of file TrigNavStructure.cxx.

489  {
490  return te1->getId() > te2->getId();
491 }

◆ deserialize()

virtual bool HLT::TrigNavStructure::deserialize ( const std::vector< uint32_t > &  )
pure virtual

◆ deserializeTEs()

bool TrigNavStructure::deserializeTEs ( std::vector< uint32_t >::const_iterator &  start,
unsigned int  totalSize 
)

Definition at line 264 of file TrigNavStructure.cxx.

264  {
265  std::lock_guard<std::recursive_mutex> lock(getMutex());
266  TriggerElementFactory& factory = getFactory();
267 
268  factory.reset();
269 
270  std::vector<uint32_t>::const_iterator& inputIt = start;
271  const size_t payloadSize = *inputIt++;
272 
273  if ( totalSize < payloadSize ) { // not all TEs were recorded
274  std::cerr << "size of the navigation payload smaller than the one required to save TEs. " << totalSize << " < " << payloadSize << std::endl;
275  return false;
276  }
277 
278 
279  const unsigned int size = *inputIt++; // size in terms of number of TEs
281  std::map<uint16_t, TriggerElement* > keys;
282 
283  for ( unsigned int i = 0; i < size; ++i ) {
284  // create new TE
285  TriggerElement* te = factory.produce(TriggerElement::enquireId(inputIt)); //
286  te->deserialize(inputIt, keys, previous);
287  previous = te;
288  // keys table for deserialization of other TEs
289  keys[i] = te;
290  }
291 
292  if ( not factory.empty() ) {
293  // rebuild sameRoI relations (this can't be done by TEs deserialization)
294  TriggerElement* initialNode = getInitialNode();
295  std::vector<TriggerElement*>::const_iterator roiTEit;
296  for ( roiTEit = getDirectSuccessors(initialNode).begin();
297  roiTEit != getDirectSuccessors(initialNode).end(); ++roiTEit ) {
298  fillSameRoIRelation((*roiTEit), (*roiTEit));
299  }
300  } // else this is empty structure, but this shoudl not bother us as it is may well be valid case
301 
302  return true;
303 }

◆ fillSameRoIRelation()

void TrigNavStructure::fillSameRoIRelation ( TriggerElement roi,
TriggerElement te 
)
protected

rebuilds the sameRoIRelation between trigger elements (used internally by deserialize)

Warning
should be called for each RoI like node

Definition at line 307 of file TrigNavStructure.cxx.

307  {
308  if ( ! isRoINode(te) ) {
311  }
312  if ( isTerminalNode(te) )
313  return;
314  else { // traverse all sub nodes
315  std::vector<TriggerElement*>::const_iterator it;
316  for ( it = getDirectSuccessors(te).begin(); it != getDirectSuccessors(te).end(); ++it ) {
317  fillSameRoIRelation(roi, *it);
318  }
319  }
320 }

◆ getAll()

void TrigNavStructure::getAll ( std::vector< TriggerElement * > &  output,
const bool  activeOnly = true 
) const

The query returning a collection of all TriggerElements.

Definition at line 363 of file TrigNavStructure.cxx.

363  {
364  std::lock_guard<std::recursive_mutex> lock(getMutex());
365  const TriggerElementFactory& factory = getFactory();
366 
367  if ( not factory.listOfProduced().empty() ) {
368  std::back_insert_iterator<std::vector<TriggerElement*> > outputIt( output );
369  if (activeOnly)
370  remove_copy_if ( factory.listOfProduced().begin(), factory.listOfProduced().end(), outputIt, isNotActive );
371  else
372  copy ( factory.listOfProduced().begin(), factory.listOfProduced().end(), outputIt );
373  }
374 }

◆ getAllOfType()

void TrigNavStructure::getAllOfType ( const te_id_type  id,
std::vector< TriggerElement * > &  output,
const bool  activeOnly = true 
) const

The query returning a collection of all TriggerElements if name is given.

Parameters
idname of TE, if "" given all TEs are returned

Definition at line 344 of file TrigNavStructure.cxx.

346  {
347  std::lock_guard<std::recursive_mutex> lock(getMutex());
348  const TriggerElementFactory& factory = getFactory();
349 
350  if ( not factory.listOfProduced(id).empty() ) {
351  std::back_insert_iterator<std::vector<TriggerElement*> > outputIt( output );
352 
353  // 2 cases: only active ones, and all
354  // one can consider sorting the TEs according to the activation status and then assume that collection is sorted
355  // the same functor can be used as in copy_if
356  if (activeOnly)
357  remove_copy_if ( factory.listOfProduced(id).begin(), factory.listOfProduced(id).end(), outputIt, isNotActive );
358  else
359  copy ( factory.listOfProduced(id).begin(), factory.listOfProduced(id).end(), outputIt );
360  }
361 }

◆ getAllRoIThresholdTEs()

void TrigNavStructure::getAllRoIThresholdTEs ( std::vector< TriggerElement * > &  output) const

The query returns a vector of all TriggerElements that represent a LVL1 RoI threshold.

Definition at line 328 of file TrigNavStructure.cxx.

329 {
330  const TriggerElement* initNode = getInitialNode();
331  // get first layer of TEs representing the RoIs themselves (not the thresholds!)
332  const std::vector<TriggerElement*>& rois = getDirectSuccessors(initNode);
333  for ( std::vector<TriggerElement*>::const_iterator roi_te = rois.begin();
334  roi_te != rois.end(); ++roi_te) {
335  // get threshold-like TEs:
336  const std::vector<TriggerElement*>& tes = getDirectSuccessors( (const TriggerElement*)(*roi_te) );
337  std::vector<TriggerElement*>::const_iterator te = tes.begin();
338  for ( ; te != tes.end(); ++te) {
339  output.push_back( *te );
340  }
341  }
342 }

◆ getAllTEs() [1/2]

std::vector< TriggerElement * > & TrigNavStructure::getAllTEs ( )

access needed by slimming tools.

Definition at line 376 of file TrigNavStructure.cxx.

376  {
377  std::lock_guard<std::recursive_mutex> lock(getMutex());
378  TriggerElementFactory& factory = getFactory();
379 
380  return factory.listOfProduced();
381 }

◆ getAllTEs() [2/2]

const std::vector< TriggerElement * > & TrigNavStructure::getAllTEs ( ) const

access needed by slimming tools.

Definition at line 383 of file TrigNavStructure.cxx.

383  {
384  std::lock_guard<std::recursive_mutex> lock(getMutex());
385  const TriggerElementFactory& factory = getFactory();
386 
387  return factory.listOfProduced();
388 }

◆ getDirectPredecessors()

const std::vector< TriggerElement * > & TrigNavStructure::getDirectPredecessors ( const TriggerElement te)
static

returns list of direct predecessors (nodes seeding me)

Parameters
teTriggerElement to query
Returns
collection of TriggerElements (if empty then node is initial)

Definition at line 120 of file TrigNavStructure.cxx.

120  {
122 }

◆ getDirectSuccessors()

const std::vector< TriggerElement * > & TrigNavStructure::getDirectSuccessors ( const TriggerElement te)
static

returns list of direct predecessors (nodes I seed)

Parameters
teTriggerElement to query
Returns
collection of TriggerElements (if empty then node is terminal)

Definition at line 124 of file TrigNavStructure.cxx.

124  {
126 }

◆ getFactory() [1/2]

TriggerElementFactory& HLT::TrigNavStructure::getFactory ( )
inlineprotected

Definition at line 369 of file TrigNavStructure.h.

369 { return *m_factory; }

◆ getFactory() [2/2]

const TriggerElementFactory& HLT::TrigNavStructure::getFactory ( ) const
inlineprotected

Definition at line 373 of file TrigNavStructure.h.

373 { return *m_factory; }

◆ getFeature()

TriggerElement::FeatureAccessHelper TrigNavStructure::getFeature ( const TriggerElement te,
class_id_type  clid,
const index_or_label_type index_or_label 
) const

typeless feature access metod

Parameters
tethe TE from which the search should be done
clidthe class ID of searched type
subfeature sub index (
See also
TriggerElement::ObjectIndex), if invalid_sub_type is passed then it is neglected
Returns
invalid FeatureAccessHelper is returned if nothng is found, else valid one

Definition at line 783 of file TrigNavStructure.cxx.

783  {
784 
785 
787  bool single = true; bool recursively = false;
788  bool status = getFeatureAccessors(te, clid,index_or_label,single,features,recursively);
789 
790  if(status && !features.empty()){
791  return features.front();
792  }
793  return TriggerElement::FeatureAccessHelper(); // not found
794 }

◆ getFeatureAccessors()

bool TrigNavStructure::getFeatureAccessors ( const TriggerElement te,
class_id_type  clid,
const index_or_label_type index_or_label,
bool  only_single_feature,
TriggerElement::FeatureVec features,
bool  travel_backward_recursively,
const TriggerElement *&  source = m_unspecifiedTE,
std::string &  sourcelabel = m_unspecifiedLabel 
) const
virtual

Reimplemented in HLT::NavigationCore.

Definition at line 842 of file TrigNavStructure.cxx.

848  {
849 
850  bool singleTEstatus = getFeatureAccessorsSingleTE(te,clid,index_or_label,only_single_feature,features,source,sourcelabel);
851 
852  if(!singleTEstatus){
853  // MLOG(WARNING) << "getFeatureAccessorsSingleTE() returned false" << endmsg;
854  }
855 
856 
857 
858  if ( ! travel_backward_recursively ) {
859  return true;
860  }
861 
862  // stop digging deeper if this is an RoI node already
863  if ( isRoINode(te) ) {
864  return true;
865  }
866 
867  // return if a feature(s) is/are found
868  if ( ! features.empty() ) {
869  return true;
870  }
871 
872  // recurse deeper
873  bool recursion_status = true;
874  for( TriggerElement* predecessor: getDirectPredecessors(te) ) {
875 
876  TriggerElement::FeatureVec features_in_branch;
877 
878  recursion_status = recursion_status && getFeatureAccessors( predecessor, clid, index_or_label,
879  only_single_feature, features_in_branch,
880  travel_backward_recursively,
881  source, sourcelabel);
882  features.insert(features.end(), features_in_branch.begin(), features_in_branch.end());
883  }
884 
885  if ( only_single_feature && ( features.size() > 1 || recursion_status == false) ) {
886  // MLOG(DEBUG) << "getFeatureAccessors: looking for object of CLID: " << clid
887  // << " label: \"" << label << "\"" << " found several objects matching criteria while can only return back one, this is ambiguous" << endmsg;
888 
889  if ( getDirectPredecessors(te).size() > 1 ) // mark bifurcation point as to where one can start again
890  source = te;
891 
892  return false;
893  }
894  return true;
895 }

◆ getFeatureAccessorsSingleTE()

bool TrigNavStructure::getFeatureAccessorsSingleTE ( const TriggerElement te,
class_id_type  clid,
const index_or_label_type index_or_label,
bool  only_single_feature,
TriggerElement::FeatureVec features,
const TriggerElement *&  source,
std::string &  sourcelabel 
) const
protectedvirtual

Reimplemented in HLT::NavigationCore.

Definition at line 810 of file TrigNavStructure.cxx.

815  {
816 
817  // ATH_MSG_VERBOSE("getFeatureAccessorsSingleTE: looking for:" << (only_single_feature ? "one object" : "many objects" ) << " of CLID: " << clid
818  // << " label: \"" << label << "\"" << " starting from TE: " << te->getId());
819 
820  int size = te->getFeatureAccessHelpers().size();
821 
822  // loop the feature access helper in order depending of type of request (i.e. if single featyure needed then loop from back, if all then loop from the front)
823  for ( int it = ( only_single_feature ? size-1 : 0 ); it != (only_single_feature ? -1 : size ); only_single_feature ? it--: it++ ) {
824  auto& fea = te->getFeatureAccessHelpers().at(it);
825  //ATH_MSG_VERBOSE("getFeatureAccessors: in a loop over FeatureAccessHelpers got ObjectIndex " << fea);
826 
827  if(matchFeature(fea,clid,index_or_label)){
828  sourcelabel = label(clid,fea.getIndex().subTypeIndex());
829  source = te;
830  features.push_back(fea);
831 
832  // ATH_MSG_DEBUG("getFeatureAccessors: matching feature found in te: " << *te << " index: " << fea);
833  // now the ending (depends on the "single" flag)
834  if ( only_single_feature )
835  break;
836  }
837  } // end of loop over feature access helpers of this TE
838 
839  return true;
840 }

◆ getFeatureRecursively()

TriggerElement::FeatureAccessHelper TrigNavStructure::getFeatureRecursively ( const TriggerElement startTE,
class_id_type  clid,
const index_or_label_type index_or_label,
const TriggerElement *&  sourceTE 
) const

recursive search for features the function is similar to the above butif th features is not found at the startTE the search descends the structure of TEs until it is found.

It stops on RoI nodes.

Parameters
sourceTEis the TE where the feature was found

Definition at line 797 of file TrigNavStructure.cxx.

798  {
799 
801  bool single = true; bool recursively = true;
802  bool status = getFeatureAccessors(startTE, clid,index_or_label,single,features,recursively,sourceTE);
803 
804  if(status && !features.empty()){
805  return features.front();
806  }
807  return TriggerElement::FeatureAccessHelper(); // not found
808 }

◆ getHolder()

const BaseHolder * TrigNavStructure::getHolder ( const TriggerElement::FeatureAccessHelper fea) const

Definition at line 923 of file TrigNavStructure.cxx.

923  {
924  std::lock_guard<std::recursive_mutex> lock(getMutex());
925  const TrigHolderStructure& holderstorage = getHolderStorage();
926 
927  return holderstorage.getHolderForFeature(fea);
928 }

◆ getHolderStorage() [1/2]

TrigHolderStructure& HLT::TrigNavStructure::getHolderStorage ( )
inlineprotected

Definition at line 370 of file TrigNavStructure.h.

370 { return *m_holderstorage; }

◆ getHolderStorage() [2/2]

const TrigHolderStructure& HLT::TrigNavStructure::getHolderStorage ( ) const
inlineprotected

Definition at line 374 of file TrigNavStructure.h.

374 { return *m_holderstorage; }

◆ getInitialNode() [1/2]

TriggerElement * TrigNavStructure::getInitialNode ( )

gets initial node, if node is not there then it is created on fly

Definition at line 39 of file TrigNavStructure.cxx.

39  {
40  std::lock_guard<std::recursive_mutex> lock(getMutex());
41  TriggerElementFactory& factory = getFactory();
42 
43  if ( factory.empty() )
44  factory.produce(0);
45  return factory.listOfProduced().front();
46 }

◆ getInitialNode() [2/2]

const TriggerElement * TrigNavStructure::getInitialNode ( ) const

Definition at line 48 of file TrigNavStructure.cxx.

48  {
49  std::lock_guard<std::recursive_mutex> lock(getMutex());
50  const TriggerElementFactory& factory = getFactory();
51 
52  if ( not factory.empty() )
53  return factory.listOfProduced().front();
54  return 0;
55 }

◆ getMutex() [1/2]

std::recursive_mutex& HLT::TrigNavStructure::getMutex ( )
inlineprotected

Definition at line 371 of file TrigNavStructure.h.

371 { return s_rmutex; }

◆ getMutex() [2/2]

std::recursive_mutex& HLT::TrigNavStructure::getMutex ( ) const
inlineprotected

Definition at line 375 of file TrigNavStructure.h.

375 { return s_rmutex; }

◆ getRoINodes()

const std::vector< TriggerElement * > & TrigNavStructure::getRoINodes ( const TriggerElement somenode)
static

gets all RoI type nodes seeding indirectly this TriggerElement

For getting all RoI nodes one can call getDirectrSuccessors(getIntialNode()

Warning
If this method is called for RoI node then it returns all TEs originating from it

Definition at line 73 of file TrigNavStructure.cxx.

73  {
75 }

◆ getSuccessor()

const TriggerElement * TrigNavStructure::getSuccessor ( const TriggerElement te,
unsigned int  id 
)
static

returns successor of given type beeing seeded from this TE

Parameters
teTriggerElement to query
idthe id of the successor TreiggerElement to find
Returns
TriggerElement pointer which can be 0
Warning
the implementation is recursive

Definition at line 129 of file TrigNavStructure.cxx.

129  {
130  if ( te->getId() == id )
131  return te;
132  std::vector<TriggerElement*>::const_iterator it;
133  const TriggerElement* found(0);
135  found = getSuccessor(*it, id);
136  if (found)
137  break;
138  }
139  return found;
140 }

◆ getTopologicallySpannedBy()

bool TrigNavStructure::getTopologicallySpannedBy ( const TriggerElement te,
const std::vector< unsigned int > &  types,
std::vector< const TriggerElement * > &  children,
const bool  activeOnly = true 
) const

gets the TEs whose predecessors were used to built a given topological TE

Parameters
tetopological TE from which to start
typesvector of types to search for
childsvector of retrieved TEs; empty in case some of the required TEs cannot be found or are not active (see the activeOnly parameter)
activeOnlyoptional parameter specifying whether inactive TEs should be discarded from the search; true by default

Definition at line 714 of file TrigNavStructure.cxx.

715  {
716  if ( getDirectPredecessors(te).size() != types.size() ) {
717  return false;
718  }
719 
720  for ( unsigned i = 0 ; i < types.size(); ++i ) {
721  const TriggerElement* child = getSuccessor( getDirectPredecessors(te)[i], types[i]);
722  if(child!=0) {
723  if(activeOnly && !child->getActiveState()) {
724  children.clear();
725  return true;
726  }
727  children.push_back(child);
728  } else {
729  children.clear();
730  return true;
731  }
732  }
733  return true;
734 }

◆ hasIdFromTheSet()

bool TrigNavStructure::hasIdFromTheSet ( const TriggerElement te,
std::vector< unsigned int >  ids 
)
static

simple helper

Definition at line 493 of file TrigNavStructure.cxx.

493  {
494  if ( find(ids.begin(), ids.end(), te->getId()) != ids.end() )
495  return true;
496  return false;
497 }

◆ haveAllCommonRoIs()

bool TrigNavStructure::haveAllCommonRoIs ( const HLT::TriggerElement te1,
const HLT::TriggerElement te2 
)
static

Definition at line 449 of file TrigNavStructure.cxx.

449  {
450  std::vector<TriggerElement*> vecRoINodes1 = getRoINodes(te1);
451  std::vector<TriggerElement*> vecRoINodes2 = getRoINodes(te2);
452  sort(vecRoINodes1.begin(), vecRoINodes1.end());
453  sort(vecRoINodes2.begin(), vecRoINodes2.end());
454  return vecRoINodes1 == vecRoINodes2;
455 }

◆ haveCommonRoI()

bool TrigNavStructure::haveCommonRoI ( const TriggerElement te1,
const TriggerElement te2 
)
static

does this 2 share RoI

RoI node itself can be passed, then it will tell if a given TriggerElement is originating in this RoI for simple TriggerElement it is a bit overkill since it assumed that the number of RoIs can be any

Warning
this algorithm should not be used by sort or unique STL algorithms. Comparing algorithms are required to be "Strict weak ordering" i.e.return false if comparing x and x and if x < y and y < z then x < z (transitivity). Sort algorithm will simply misbehave (crash trying to access objects under address 0)
Returns
true if there is at least one common RoI

Definition at line 416 of file TrigNavStructure.cxx.

416  {
417  std::vector<const TriggerElement*> vecRoINodes;
418 
419  if ( isRoINode(te1) ) {
420  vecRoINodes.push_back(te1);
421  } else {
422  std::back_insert_iterator<std::vector<const TriggerElement*> > outputIt( vecRoINodes );
424  }
425  if ( isRoINode(te2) ) {
426  vecRoINodes.push_back(te2);
427  } else {
428  std::back_insert_iterator<std::vector<const TriggerElement*> > outputIt( vecRoINodes );
430  }
431  // sort (by pointers, it is OK do not be scared)
432  sort(vecRoINodes.begin(), vecRoINodes.end());
433 
434  std::vector<const TriggerElement*>::const_iterator it;
435  it = adjacent_find(vecRoINodes.begin(), vecRoINodes.end());
436 
437  if ( it == vecRoINodes.end() )
438  return false;
439 
440  return true;
441 }

◆ haveCommonSeed()

bool TrigNavStructure::haveCommonSeed ( const TriggerElement te1,
const TriggerElement te2 
)
static

checks that there is any common predecessor of two TriggerElements

Warning
See comments on haveCommonRoI. The same applies.

Definition at line 461 of file TrigNavStructure.cxx.

461  {
462  std::vector<const TriggerElement*> vecRoINodes;
463  std::back_insert_iterator<std::vector<const TriggerElement*> > outputIt( vecRoINodes );
464 
466  te1->getRelated(TriggerElement::seededByRelation).end(), outputIt);
467 
469  te2->getRelated(TriggerElement::seededByRelation).end(), outputIt);
470 
471  // sort (by pointers, it is OK do not be scared) & uniq
472  sort(vecRoINodes.begin(), vecRoINodes.end());
473 
475  it = adjacent_find(vecRoINodes.begin(), vecRoINodes.end());
476  if ( it == vecRoINodes.end() ) // after uniquing we still are
477  return false;
478  return true;
479 }

◆ haveDistinctRoI()

bool TrigNavStructure::haveDistinctRoI ( const TriggerElement te1,
const TriggerElement te2 
)
static

inversion of haveCommonRoI

But notice it is more suitable for SLT sort etc. since for comparison 2 identical objects it returns false. However the transitivity can't be guaranteed.

Definition at line 444 of file TrigNavStructure.cxx.

444  {
445  return ! haveCommonRoI(te1, te2);
446 }

◆ haveDistinctSeed()

bool TrigNavStructure::haveDistinctSeed ( const TriggerElement te1,
const TriggerElement te2 
)
static

inversion of haveCommonSeed

Definition at line 481 of file TrigNavStructure.cxx.

481  {
482  return ! haveCommonSeed(te1, te2);
483 }

◆ increasingOrderByTEId()

bool TrigNavStructure::increasingOrderByTEId ( const TriggerElement te1,
const TriggerElement te2 
)
static

for sorting TriggerElements according to their id

Note that this methods are not complementary. (It is required to be usable for STL algorithms.)

Definition at line 485 of file TrigNavStructure.cxx.

485  {
486  return te1->getId() < te2->getId();
487 }

◆ isCompatibleTree()

bool TrigNavStructure::isCompatibleTree ( const TriggerElement te1,
const TriggerElement te2 
)
static

check compatibility of 2 navigation structures

This what is checked is only the id of trigger elements whether they are having the same place in the navigation structure; have identical subtrees (check is recursive)

Definition at line 526 of file TrigNavStructure.cxx.

526  {
527  using namespace std;
528  if ( te1->getId() != te2->getId() ) {
529  return false; // distinc Id
530  }
531 
532  if ( ( isTerminalNode(te1) && isTerminalNode(te2) ) )
533  return true; // no more checks needs to be done
534  else if ( isTerminalNode(te1) || isTerminalNode(te2) )
535  return false; // one of both is terminal while another is not (case when both are terminal is covered above)
536 
537  // continue subchecks otherwise (both nonterminal)
538 
539  // folow seeds otherwise
541  return false;
542 
543  std::vector<TriggerElement*>::const_iterator seededByTe1 = te1->getRelated(TriggerElement::seedsRelation).begin();
544  std::vector<TriggerElement*>::const_iterator seededByTe2 = te2->getRelated(TriggerElement::seedsRelation).begin();
545 
546  for ( ; seededByTe1 != te1->getRelated(TriggerElement::seedsRelation).end(); ++seededByTe1, ++seededByTe2 ) {
547  if (isCompatibleTree(*seededByTe1, *seededByTe2) == false) // grrr,wrrr recursive call here
548  return false;
549  }
550  // there I should probably check as well the Features attached to the TEs
551 
552  return true;
553 }

◆ isInitialNode()

bool TrigNavStructure::isInitialNode ( const TriggerElement te)
static

queries if node is an initial one

Parameters
tenode to be queried
Returns
true if passed node is initial

Definition at line 501 of file TrigNavStructure.cxx.

501  {
502  if ( te->getRelated(TriggerElement::seededByRelation).empty() and te->getId() == 0 )
503  return true;
504  return false;
505 }

◆ isNotActive()

static bool HLT::TrigNavStructure::isNotActive ( const TriggerElement te)
inlinestatic

helper for the STL

Definition at line 257 of file TrigNavStructure.h.

257 { return !te->getActiveState(); }

◆ isRoINode()

bool TrigNavStructure::isRoINode ( const TriggerElement te)
static

queries if node is an RoI type one

Parameters
tenode to be queried
Returns
true if passed node is RoI type

Definition at line 507 of file TrigNavStructure.cxx.

507  {
508  if ( te->getRelated( TriggerElement::seededByRelation ).empty() ) // this s initial node
509  return false;
510 
511  TriggerElement* whoSeedsMe = *(te->getRelated( TriggerElement::seededByRelation ).begin());
512  if ( isInitialNode(whoSeedsMe) )
513  return true;
514  return false;
515 }

◆ isTerminalNode()

bool TrigNavStructure::isTerminalNode ( const TriggerElement te)
static

queries if node is terminal (no more TriggerElement are seeded by it)

Parameters
tenode to be queried
Returns
true if passed node is terminal

Definition at line 517 of file TrigNavStructure.cxx.

517  {
518  if ( te->getRelated( TriggerElement::seedsRelation ).empty() )
519  return true;
520  return false;
521 }

◆ isTopological()

static bool HLT::TrigNavStructure::isTopological ( const TriggerElement te)
inlinestatic

Definition at line 259 of file TrigNavStructure.h.

259 { return (getDirectPredecessors(te).size() > 1 ? true : false); }

◆ label()

std::string TrigNavStructure::label ( class_id_type  clid,
const index_or_label_type sti_or_label 
) const

Definition at line 775 of file TrigNavStructure.cxx.

775  {
776  std::lock_guard<std::recursive_mutex> lock(getMutex());
777  const TrigHolderStructure& holderstorage = getHolderStorage();
778 
779  return holderstorage.getLabel(clid,sti_or_label);
780 }

◆ matchFeature()

bool TrigNavStructure::matchFeature ( const TriggerElement::FeatureAccessHelper fea,
class_id_type  clid,
const index_or_label_type index_or_label 
) const
protected

Definition at line 898 of file TrigNavStructure.cxx.

898  {
899  //we always require the CLID to match
900  if(fea.getCLID() != clid) return false;
901 
902  if(index_or_label.index() == 0){
903  //subtype index case: if argument is invalid_sub_index we always match, else require exact match
904  auto index = std::get<sub_index_type>(index_or_label) ;
905  return (index == invalid_sub_index || index == fea.getIndex().subTypeIndex());
906  }
907 
908  if(index_or_label.index() == 1){
909  //label case: if argument is "" we always match, else require exact match (via)
910  auto label = std::get<std::string>(index_or_label);
911  if(label.empty()){
912  return true;
913  }
914  label = (label == "!") ? "" : label;
915  auto sub = subType(clid,label);
916  if(sub == invalid_sub_index) return false;
917  return matchFeature(fea,clid,sub);
918  }
919  return false;
920 }

◆ overlaps() [1/2]

bool TrigNavStructure::overlaps ( const TriggerElement t1,
const std::vector< TriggerElement * > &  teVec 
) const

Check overlap between a TE and a vector of TEs, using the method above.

Definition at line 700 of file TrigNavStructure.cxx.

700  {
701  for (std::vector<TriggerElement*>::const_iterator te2 = teVec.begin(); te2 != teVec.end(); ++te2)
702  if (overlaps(te1, *te2)) return true;
703 
704  return false;
705 }

◆ overlaps() [2/2]

bool TrigNavStructure::overlaps ( const TriggerElement t1,
const TriggerElement t2 
) const

Check overlap between trigger elements (pointer equality or RoI overlap)

Definition at line 707 of file TrigNavStructure.cxx.

707  {
708  if (te1 == te2) return true;
709  if (haveCommonRoI(te1, te2)) return true;
710 
711  return false;
712 }

◆ printASCIIArt()

void TrigNavStructure::printASCIIArt ( std::string &  str,
const TriggerElement te = 0,
int  offset = 0 
) const

pretty printing of the navigational structure (heavy)

Definition at line 152 of file TrigNavStructure.cxx.

152  {
153  using namespace std;
154  const TriggerElement* initialNode = getInitialNode();
155  if ( initialNode == 0 )
156  return;
157 
158  std::lock_guard<std::recursive_mutex> lock(getMutex());
159  const TriggerElementFactory& factory = getFactory();
160 
161 
162  if ( !te )
163  te = initialNode;
164 
165  if ( te == initialNode ) {
166  // loop over all TEs which are not seeded by anything but are not initial nodes
167  const std::vector< TriggerElement* >& allTEs = factory.listOfProduced();
168  std::vector< TriggerElement* >::const_iterator allIt;
169  for (allIt = allTEs.begin(); allIt != allTEs.end(); ++allIt) {
170  if ((*allIt)->getRelated(TriggerElement::seededByRelation).size() == 0 && *allIt != getInitialNode() )
171  printASCIIArt(str, *allIt);
172  }
173  }
174 
175  ostringstream ss;
176  // pretty print
177  for ( int i=0; i < offset; i++ ) {
178  ss << "| ";
179  //cout << " ";
180  }
181  ss << "\\_";
182 
183  ss << "id:" << dec << te->getId() << ";"
184  << "active:" <<(te->getActiveState() ? "1" : "0" ) << ";"
185  << "error:" <<(te->getErrorState() ? "1" : "0" ) << ";"
186  << "ptr:" << hex << te << ";"
187  << "#seeds:" << dec << te->getRelated(TriggerElement::seedsRelation).size() << ",";
188  // add all ptrs
189  std::vector<TriggerElement*>::const_iterator seedIt;
190  for ( seedIt = getDirectSuccessors(te).begin(); seedIt != getDirectSuccessors(te).end(); ++seedIt ) {
191  ss << *seedIt <<" ";
192  }
193 
194  ss << "#seededBy:" << dec << te->getRelated(TriggerElement::seededByRelation).size() << ";"
195  << "#RoI:" << dec << te->getRelated(TriggerElement::sameRoIRelation).size() << ";"
196  << "#features:" << te->getFeatureAccessHelpers().size() << ";";
197  for ( auto& fea: te->getFeatureAccessHelpers() ) {
198  ss << fea;
199  }
200  ss << std::endl;
201 
202  std::string str2;
203  str2 = ss.str();
204  str += str2;
205 
206  if ( ! isTerminalNode(te) ) {
207  std::vector < TriggerElement* >::const_iterator it = te->getRelated( TriggerElement::seedsRelation ).begin();
208  std::vector < TriggerElement* >::const_iterator itEnd = te->getRelated( TriggerElement::seedsRelation ).end();
209  for ( ; it != itEnd; ++it ) {
210  std::string str2;
211  printASCIIArt(str, *it, offset+1);
212  str += str2;
213  }
214  }
215 }

◆ propagateDeactivation()

bool TrigNavStructure::propagateDeactivation ( const TrigNavStructure nav)

propagates deactivation of TE state This finction should be used after Trigger is rerurn on L2 and then the reruning on L2 is required.

The deactivated lines must be propagated ahead.

Parameters
navis navigation which was reprocessed (additional branches deactivated)
Returns
true is all went fine, false in case it is spoted that the 2 navigation structures were not initially same

Definition at line 557 of file TrigNavStructure.cxx.

557  {
558  std::lock_guard<std::recursive_mutex> lock(getMutex());
559  TriggerElementFactory& factory = getFactory();
560  const TriggerElementFactory& oldFactory = nav->getFactory();
561 
562 
563  // basic checks first
564  if ( oldFactory.listOfProduced().size() > factory.listOfProduced().size() )
565  return false;
566 
567  std::vector< TriggerElement* >::const_iterator old = oldFactory.listOfProduced().begin();
569  // int i = 0;
570  do {
571  (*me)->setActiveState((*old)->getActiveState());
572  ++me;
573  ++old;
574  } while ( old != oldFactory.listOfProduced().end() );
575  return true;
576 }

◆ reset()

void TrigNavStructure::reset ( bool  inFinalize = false)
virtual

resets all the navigation, goes to the factory and asks to withdraw all produced objects

Reimplemented in HLT::NavigationCore.

Definition at line 756 of file TrigNavStructure.cxx.

756  {
757  std::lock_guard<std::recursive_mutex> lock(getMutex());
758  if (inFinalize) {
759  for (auto& factory : m_factory) factory.reset();
760  for (auto& holder : m_holderstorage) holder.reset();
761  } else {
762  getFactory().reset();
764  }
765 }

◆ serialize()

virtual bool HLT::TrigNavStructure::serialize ( std::vector< uint32_t > &  ) const
pure virtual

method serizlizes entire navigation

Parameters
outputvector to place the result
Returns
if true then OK else some sort of failure happened (likely badly truncated structure)

Implemented in HLT::NavigationCore, and HLT::StandaloneNavigation.

◆ serializeTEs()

bool TrigNavStructure::serializeTEs ( std::vector< uint32_t > &  output) const

method serizlizes the navigation structure

Parameters
outputvector to place the result
Returns
if true then OK else some sort of failure happened (likely badly truncated structure)

Definition at line 217 of file TrigNavStructure.cxx.

217  {
218  std::lock_guard<std::recursive_mutex> lock(getMutex());
219  const TriggerElementFactory& factory = getFactory();
220 
222 
223  const std::vector<TriggerElement*>& fullList = factory.listOfProduced();
224  std::vector<TriggerElement*> all;
225  all.reserve(fullList.size());
226 
227  for(std::vector<TriggerElement*>::const_iterator iter = fullList.begin(); iter != fullList.end(); ++iter) {
228  if(! (*iter)->transient() ) {
229  all.push_back( *iter );
230  }
231  }
232 
233  // reserve space (in order to be efficient it should not be resized any more, this can be studied probably later to find optimum)
234  output.reserve(10*all.size());
235 
236  // SERIALZE NAVIGATION STRUCTURE
237  // size (measured in elements)
238  output.push_back(all.size());
239 
240  // helper keys
241  std::map<TriggerElement*, uint16_t> keys;
242 
243  const TriggerElement* previous = 0;
244  std::vector<TriggerElement*>::const_iterator it;
245  uint16_t indexForTe = 0;
246  for ( it = all.begin(); it != all.end(); ++it ) {
247  // first we stream pointer as it (this is already an unique key for this TE)
248  // output.push_back((unsigned int)(*it));
249  (*it)->serialize(output, keys, previous);
250  previous = *it;
251  keys[*it] = indexForTe;
252  indexForTe++;
253  }
254 
255  return true;
256 }

◆ subType()

sub_index_type TrigNavStructure::subType ( class_id_type  clid,
const index_or_label_type sti_or_label 
) const

Definition at line 768 of file TrigNavStructure.cxx.

768  {
769  std::lock_guard<std::recursive_mutex> lock(getMutex());
770  const TrigHolderStructure& holderstorage = getHolderStorage();
771 
772  return holderstorage.getSubTypeIndex(clid,sti_or_label);
773 }

Member Data Documentation

◆ ATLAS_THREAD_SAFE [1/2]

const TriggerElement* m_unspecifiedTE HLT::TrigNavStructure::ATLAS_THREAD_SAFE
staticprotected

Definition at line 377 of file TrigNavStructure.h.

◆ ATLAS_THREAD_SAFE [2/2]

std::string m_unspecifiedLabel HLT::TrigNavStructure::ATLAS_THREAD_SAFE
staticprotected

Definition at line 378 of file TrigNavStructure.h.

◆ m_factory

SG::SlotSpecificObj<TriggerElementFactory> HLT::TrigNavStructure::m_factory
private

factory of trigger elements (one per processing slot)

Definition at line 382 of file TrigNavStructure.h.

◆ m_holderstorage

SG::SlotSpecificObj<TrigHolderStructure> HLT::TrigNavStructure::m_holderstorage
private

structure for feature holders (one per processing slot)

Definition at line 383 of file TrigNavStructure.h.

◆ s_rmutex

std::recursive_mutex TrigNavStructure::s_rmutex
staticprivate

Definition at line 385 of file TrigNavStructure.h.


The documentation for this class was generated from the following files:
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
HLT::TriggerElement::addFeature
void addFeature(class_id_type clid, const ObjectIndex &index, bool forget=false)
add helper for new feature
Definition: TrigNavStructure/Root/TriggerElement.cxx:37
PowhegControl_ttHplus_NLO.ss
ss
Definition: PowhegControl_ttHplus_NLO.py:83
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
HLT::TrigNavStructure::getAllOfType
void getAllOfType(const te_id_type id, std::vector< TriggerElement * > &output, const bool activeOnly=true) const
The query returning a collection of all TriggerElements if name is given.
Definition: TrigNavStructure.cxx:344
HLT::TrigNavStructure::label
std::string label(class_id_type clid, const index_or_label_type &sti_or_label) const
Definition: TrigNavStructure.cxx:775
HLT::TrigNavStructure::isRoINode
static bool isRoINode(const TriggerElement *te)
queries if node is an RoI type one
Definition: TrigNavStructure.cxx:507
HLT::TrigNavStructure::s_rmutex
static std::recursive_mutex s_rmutex
Definition: TrigNavStructure.h:385
HLT::TriggerElement::seedsRelation
@ seedsRelation
what TEs I am seeding
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:118
index
Definition: index.py:1
HLT::TriggerElementFactory::listOfProduced
const std::vector< TriggerElement * > & listOfProduced() const
Definition: TriggerElementFactory.h:36
HLT::TrigNavStructure::printASCIIArt
void printASCIIArt(std::string &str, const TriggerElement *te=0, int offset=0) const
pretty printing of the navigational structure (heavy)
Definition: TrigNavStructure.cxx:152
HLT::TrigHolderStructure
Definition: TrigHolderStructure.h:21
HLT::TriggerElement::FeatureVec
std::vector< FeatureAccessHelper > FeatureVec
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:233
HLT::TrigNavStructure::getMutex
std::recursive_mutex & getMutex()
Definition: TrigNavStructure.h:371
mergePhysValFiles.start
start
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:14
PlotCalibFromCool.begin
begin
Definition: PlotCalibFromCool.py:94
skel.it
it
Definition: skel.GENtoEVGEN.py:396
HLT::TriggerElement::getId
te_id_type getId() const
reset internals.
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:43
Cut::all
@ all
Definition: SUSYToolsAlg.cxx:67
HLT::TriggerElement::FeatureAccessHelper::getCLID
class_id_type getCLID() const
Class ID of object.
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:208
HLT::TrigNavStructure::isTerminalNode
static bool isTerminalNode(const TriggerElement *te)
queries if node is terminal (no more TriggerElement are seeded by it)
Definition: TrigNavStructure.cxx:517
HLT::TriggerElement::getActiveState
bool getActiveState() const
get state of the TriggerElement
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:48
HLT::TrigNavStructure::m_holderstorage
SG::SlotSpecificObj< TrigHolderStructure > m_holderstorage
structure for feature holders (one per processing slot)
Definition: TrigNavStructure.h:383
HLT::TrigNavStructure::getFeatureAccessorsSingleTE
virtual bool getFeatureAccessorsSingleTE(const TriggerElement *te, class_id_type clid, const index_or_label_type &index_or_label, bool only_single_feature, TriggerElement::FeatureVec &features, const TriggerElement *&source, std::string &sourcelabel) const
Definition: TrigNavStructure.cxx:810
HLT::TriggerElement::getErrorState
bool getErrorState() const
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:65
HLT::TrigNavStructure::getFeatureAccessors
virtual bool getFeatureAccessors(const TriggerElement *te, class_id_type clid, const index_or_label_type &index_or_label, bool only_single_feature, TriggerElement::FeatureVec &features, bool travel_backward_recursively, const TriggerElement *&source=m_unspecifiedTE, std::string &sourcelabel=m_unspecifiedLabel) const
Definition: TrigNavStructure.cxx:842
std::sort
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
Definition: DVL_algorithms.h:554
HLT::TriggerElement::seededByRelation
@ seededByRelation
what TEs are seeding me
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:119
HLT::TrigNavStructure::getInitialNode
TriggerElement * getInitialNode()
gets initial node, if node is not there then it is created on fly
Definition: TrigNavStructure.cxx:39
HLT::TrigNavStructure::haveCommonSeed
static bool haveCommonSeed(const TriggerElement *te1, const TriggerElement *te2)
checks that there is any common predecessor of two TriggerElements
Definition: TrigNavStructure.cxx:461
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
HLT::TriggerElement::getRelated
const std::vector< TriggerElement * > & getRelated(Relation rel) const
returns reference to the likns to other TriggerElements related by relation r
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:127
HLT::TrigHolderStructure::reset
void reset()
Definition: TrigHolderStructure.cxx:10
HLT::TrigNavStructure::haveCommonRoI
static bool haveCommonRoI(const TriggerElement *te1, const TriggerElement *te2)
does this 2 share RoI
Definition: TrigNavStructure.cxx:416
HLT::TrigNavStructure::getFactory
TriggerElementFactory & getFactory()
Definition: TrigNavStructure.h:369
HLT::TrigNavStructure::getDirectSuccessors
static const std::vector< TriggerElement * > & getDirectSuccessors(const TriggerElement *te)
returns list of direct predecessors (nodes I seed)
Definition: TrigNavStructure.cxx:124
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
HLT::TrigNavStructure::m_factory
SG::SlotSpecificObj< TriggerElementFactory > m_factory
factory of trigger elements (one per processing slot)
Definition: TrigNavStructure.h:382
HLT::TriggerElement::ObjectIndex::subTypeIndex
sub_index_type subTypeIndex() const
to get collection index
Definition: TrigNavStructure/Root/TriggerElement.cxx:247
HLTNavDetails::FillSize
Definition: TrigNavStructure.h:26
HLT::TriggerElement::sameRoIRelation
@ sameRoIRelation
equilateral relation of all TEs rooted in one RoI
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:117
HLT::TrigNavStructure::getDirectPredecessors
static const std::vector< TriggerElement * > & getDirectPredecessors(const TriggerElement *te)
returns list of direct predecessors (nodes seeding me)
Definition: TrigNavStructure.cxx:120
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:88
HLT::TrigHolderStructure::getHolderForFeature
HolderType * getHolderForFeature(const TriggerElement::FeatureAccessHelper &fea) const
Definition: TrigHolderStructure.h:35
lumiFormat.i
int i
Definition: lumiFormat.py:85
HLT::TriggerElement
TriggerElement is the basic ingreedient of the interface between HLT algorithms and the navigation It...
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:27
PlotPulseshapeFromCool.input
input
Definition: PlotPulseshapeFromCool.py:106
HLT::TriggerElement::relate
void relate(TriggerElement *te, Relation r)
reates given TE to other TE
Definition: TrigNavStructure/Root/TriggerElement.cxx:86
HLT::TrigNavStructure::subType
sub_index_type subType(class_id_type clid, const index_or_label_type &sti_or_label) const
Definition: TrigNavStructure.cxx:768
EL::Detail::ManagerStep::initial
@ initial
this is just the initial step we do, nothing really happens here
HLT::TrigNavStructure::getHolderStorage
TrigHolderStructure & getHolderStorage()
Definition: TrigNavStructure.h:370
HLT::TriggerElement::enquireId
static unsigned int enquireId(std::vector< uint32_t >::const_iterator &inputIt)
Definition: TrigNavStructure/Root/TriggerElement.cxx:111
histSizes.list
def list(name, path='/')
Definition: histSizes.py:38
merge.output
output
Definition: merge.py:17
HLT::TrigNavStructure::getSuccessor
static const TriggerElement * getSuccessor(const TriggerElement *te, unsigned int id)
returns successor of given type beeing seeded from this TE
Definition: TrigNavStructure.cxx:129
HLT::TriggerElementFactory
The factory of TriggerElements Creation in controlled way.
Definition: TriggerElementFactory.h:28
python.root_lsr_rank.types
types
Definition: root_lsr_rank.py:35
python.subdetectors.mmg.ids
ids
Definition: mmg.py:8
HLT::TrigNavStructure::overlaps
bool overlaps(const TriggerElement *t1, const TriggerElement *t2) const
Check overlap between trigger elements (pointer equality or RoI overlap)
Definition: TrigNavStructure.cxx:707
HLT::TriggerElementFactory::reset
void reset()
Definition: TriggerElementFactory.cxx:28
HLT::TrigNavStructure::isCompatibleTree
static bool isCompatibleTree(const TriggerElement *te1, const TriggerElement *te2)
check compatibility of 2 navigation structures
Definition: TrigNavStructure.cxx:526
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
HLT::TrigNavStructure::isInitialNode
static bool isInitialNode(const TriggerElement *te)
queries if node is an initial one
Definition: TrigNavStructure.cxx:501
HLT::TriggerElement::FeatureAccessHelper::getIndex
const ObjectIndex & getIndex() const
index in the external ojects array
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:209
CondAlgsOpts.found
int found
Definition: CondAlgsOpts.py:101
HLT::TrigNavStructure::fillSameRoIRelation
void fillSameRoIRelation(TriggerElement *roi, TriggerElement *te)
rebuilds the sameRoIRelation between trigger elements (used internally by deserialize)
Definition: TrigNavStructure.cxx:307
CSV_InDetExporter.old
old
Definition: CSV_InDetExporter.py:145
HLT::TriggerElement::FeatureAccessHelper
the FeatureAccessHelper is a class used to keep track of features attached to this TE.
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:192
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
DeMoScan.first
bool first
Definition: DeMoScan.py:536
TriggerTest.rois
rois
Definition: TriggerTest.py:23
HLT::TrigHolderStructure::getSubTypeIndex
sub_index_type getSubTypeIndex(class_id_type clid, const index_or_label_type &stiOrLabel) const
Definition: TrigHolderStructure.h:63
Herwig7_QED_EvtGen_ll.fs
dictionary fs
Definition: Herwig7_QED_EvtGen_ll.py:17
convertTimingResiduals.offset
offset
Definition: convertTimingResiduals.py:71
python.DecayParser.children
children
Definition: DecayParser.py:32
HLT::TriggerElement::getFeatureAccessHelpers
const std::vector< FeatureAccessHelper > & getFeatureAccessHelpers() const
returns all features which ara attached to this TE
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:238
copySelective.source
string source
Definition: copySelective.py:32
str
Definition: BTagTrackIpAccessor.cxx:11
python.copyTCTOutput.totalSize
totalSize
Definition: copyTCTOutput.py:93
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:798
merge.status
status
Definition: merge.py:17
HLT::TriggerElement::deserialize
void deserialize(std::vector< uint32_t >::const_iterator &inputIt, const std::map< uint16_t, TriggerElement * > &keys, const TriggerElement *previous)
deserialization
Definition: TrigNavStructure/Root/TriggerElement.cxx:182
calibdata.copy
bool copy
Definition: calibdata.py:27
HLT::TrigNavStructure::addNode
TriggerElement * addNode(TriggerElement *seed, unsigned int id)
adds nodes seeded form the one given as an argument,
Definition: TrigNavStructure.cxx:79
HLT::TriggerElementFactory::empty
bool empty() const
Definition: TriggerElementFactory.cxx:24
HLT::TrigNavStructure::addOneLevel
bool addOneLevel(std::vector< std::vector< TriggerElement * > > &currentCombs, std::vector< std::vector< std::pair< unsigned int, unsigned int > > > &currentIdxs, unsigned int type, std::vector< std::vector< TriggerElement * > > &newCombs, std::vector< std::vector< std::pair< unsigned int, unsigned int > > > &newIdxs, unsigned int maxResults=1000, bool onlyActive=1)
Helper method for "combine": add one "level" of multiplicity to the results.
Definition: TrigNavStructure.cxx:610
HLT::TrigNavStructure::isNotActive
static bool isNotActive(const TriggerElement *te)
helper for the STL
Definition: TrigNavStructure.h:257
HLT::TrigNavStructure::matchFeature
bool matchFeature(const TriggerElement::FeatureAccessHelper &fea, class_id_type clid, const index_or_label_type &index_or_label) const
Definition: TrigNavStructure.cxx:898
HLT::TriggerElementFactory::produce
TriggerElement * produce(unsigned int id, bool ghost=false, bool nofwd=false)
Definition: TriggerElementFactory.cxx:16
HLT::TriggerElement::getPreviousFeatures
const std::vector< FeatureAccessHelper > & getPreviousFeatures() const
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:251
HLT::TrigHolderStructure::getLabel
std::string getLabel(class_id_type clid, const index_or_label_type &stiOrLabel) const
Definition: TrigHolderStructure.h:78
Trk::previous
@ previous
Definition: BinningData.h:32