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 608 of file TrigNavStructure.cxx.

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

◆ 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 580 of file TrigNavStructure.cxx.

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

◆ 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 734 of file TrigNavStructure.cxx.

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

◆ 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 388 of file TrigNavStructure.cxx.

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

◆ decreasingOrderByTEId()

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

Definition at line 487 of file TrigNavStructure.cxx.

487  {
488  return te1->getId() > te2->getId();
489 }

◆ 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 361 of file TrigNavStructure.cxx.

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

◆ 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 342 of file TrigNavStructure.cxx.

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

◆ 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 ( const TriggerElement* roi_te : rois ) {
334  // get threshold-like TEs:
335  const std::vector<TriggerElement*>& tes = getDirectSuccessors( roi_te );
336  for (TriggerElement* te : tes) {
337  output.push_back( te );
338  }
339  }
340 }

◆ getAllTEs() [1/2]

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

access needed by slimming tools.

Definition at line 374 of file TrigNavStructure.cxx.

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

◆ getAllTEs() [2/2]

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

access needed by slimming tools.

Definition at line 381 of file TrigNavStructure.cxx.

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

◆ 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 781 of file TrigNavStructure.cxx.

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

◆ 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 840 of file TrigNavStructure.cxx.

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

◆ 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 808 of file TrigNavStructure.cxx.

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

◆ 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 795 of file TrigNavStructure.cxx.

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

◆ getHolder()

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

Definition at line 921 of file TrigNavStructure.cxx.

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

◆ 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 712 of file TrigNavStructure.cxx.

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

◆ hasIdFromTheSet()

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

simple helper

Definition at line 491 of file TrigNavStructure.cxx.

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

◆ haveAllCommonRoIs()

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

Definition at line 447 of file TrigNavStructure.cxx.

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

◆ 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 414 of file TrigNavStructure.cxx.

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

◆ 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 459 of file TrigNavStructure.cxx.

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

◆ 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 442 of file TrigNavStructure.cxx.

442  {
443  return ! haveCommonRoI(te1, te2);
444 }

◆ haveDistinctSeed()

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

inversion of haveCommonSeed

Definition at line 479 of file TrigNavStructure.cxx.

479  {
480  return ! haveCommonSeed(te1, te2);
481 }

◆ 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 483 of file TrigNavStructure.cxx.

483  {
484  return te1->getId() < te2->getId();
485 }

◆ 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 524 of file TrigNavStructure.cxx.

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

◆ 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 499 of file TrigNavStructure.cxx.

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

◆ 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 505 of file TrigNavStructure.cxx.

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

◆ 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 515 of file TrigNavStructure.cxx.

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

◆ 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 773 of file TrigNavStructure.cxx.

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

◆ 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 896 of file TrigNavStructure.cxx.

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

◆ 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 698 of file TrigNavStructure.cxx.

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

◆ 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 705 of file TrigNavStructure.cxx.

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

◆ 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 555 of file TrigNavStructure.cxx.

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

◆ 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 754 of file TrigNavStructure.cxx.

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

◆ 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 766 of file TrigNavStructure.cxx.

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

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
createLinkingScheme.iter
iter
Definition: createLinkingScheme.py:62
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:342
HLT::TrigNavStructure::label
std::string label(class_id_type clid, const index_or_label_type &sti_or_label) const
Definition: TrigNavStructure.cxx:773
HLT::TrigNavStructure::isRoINode
static bool isRoINode(const TriggerElement *te)
queries if node is an RoI type one
Definition: TrigNavStructure.cxx:505
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:13
PlotCalibFromCool.begin
begin
Definition: PlotCalibFromCool.py:94
skel.it
it
Definition: skel.GENtoEVGEN.py:407
HLT::TriggerElement::getId
te_id_type getId() const
reset internals.
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:43
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:515
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:808
HLT::TriggerElement::getErrorState
bool getErrorState() const
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:65
python.RatesEmulationExample.lock
lock
Definition: RatesEmulationExample.py:148
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:840
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
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:459
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:92
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:414
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:93
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:766
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:16
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:705
checkTriggerxAOD.found
found
Definition: checkTriggerxAOD.py:328
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:524
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:499
HLT::TriggerElement::FeatureAccessHelper::getIndex
const ObjectIndex & getIndex() const
index in the external ojects array
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:209
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
DeMoScan.first
bool first
Definition: DeMoScan.py:534
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:31
str
Definition: BTagTrackIpAccessor.cxx:11
python.copyTCTOutput.totalSize
totalSize
Definition: copyTCTOutput.py:92
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:801
merge.status
status
Definition: merge.py:16
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:26
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:608
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:896
Cut::all
@ all
Definition: SUSYToolsAlg.cxx:67
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