ATLAS Offline Software
Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Private Attributes | List of all members
HLT::TriggerElement Class Reference

TriggerElement is the basic ingreedient of the interface between HLT algorithms and the navigation It holds navigation links by itself but they are not exposed. More...

#include <TriggerElement.h>

Collaboration diagram for HLT::TriggerElement:

Classes

class  FeatureAccessHelper
 the FeatureAccessHelper is a class used to keep track of features attached to this TE. More...
 
class  ObjectIndex
 Helper class for conversion from/to int stored in TE and pair of ints used in Navigation Object pointer in Navigation is pair of ints. More...
 

Public Types

enum  Relation { sameRoIRelation, seedsRelation, seededByRelation }
 possible relations enumeration (Note: uses no longer here) More...
 
enum  States { activeState = 0x1, ghostState = 0x2, nofwdState = 0x4, errorState = 0x8 }
 
typedef std::vector< FeatureAccessHelperFeatureVec
 

Public Member Functions

 TriggerElement ()
 
 TriggerElement (te_id_type id, bool ghost, bool nofwd=false)
 
 ~TriggerElement ()
 
te_id_type getId () const
 reset internals. More...
 
bool getActiveState () const
 get state of the TriggerElement More...
 
void setActiveState (bool state)
 set state of the TriggerElement More...
 
bool ghost () const
 
bool getGhostState () const
 
void setGhostState (bool t=true)
 
void setTransient (bool t=true)
 
bool transient ()
 
void setErrorState (bool state=true)
 
bool getErrorState () const
 
const std::vector< TriggerElement * > & getRelated (Relation rel) const
 returns reference to the likns to other TriggerElements related by relation r More...
 
void relate (TriggerElement *te, Relation r)
 reates given TE to other TE More...
 
void relate (const std::vector< TriggerElement * > &tes, Relation r)
 relates this TE to vecor of other TEs More...
 
void serialize (std::vector< uint32_t > &output, const std::map< TriggerElement *, uint16_t > &keys, const TriggerElement *previous) const
 serializes TE More...
 
void deserialize (std::vector< uint32_t >::const_iterator &inputIt, const std::map< uint16_t, TriggerElement * > &keys, const TriggerElement *previous)
 deserialization More...
 
const std::vector< FeatureAccessHelper > & getFeatureAccessHelpers () const
 returns all features which ara attached to this TE More...
 
std::vector< FeatureAccessHelper > & getFeatureAccessHelpers ()
 
void addFeature (class_id_type clid, const ObjectIndex &index, bool forget=false)
 add helper for new feature More...
 
void addFeature (const FeatureAccessHelper &f)
 
const std::vector< FeatureAccessHelper > & getPreviousFeatures () const
 
std::vector< FeatureAccessHelper > & getPreviousFeatures ()
 

Static Public Member Functions

static unsigned int enquireId (std::vector< uint32_t >::const_iterator &inputIt)
 

Public Attributes

std::map< Relation, std::vector< TriggerElement * > > m_relations
 relations holder (features outside) More...
 

Private Attributes

unsigned int m_state
 one word for all states, info in bits (saving space in serialized object) More...
 
te_id_type m_id
 id More...
 
bool m_transient
 marker that TE should not be serialized More...
 
std::vector< FeatureAccessHelperm_uses
 all features attached are in this storage More...
 
std::vector< FeatureAccessHelperm_prev
 all features attached are in this TE and seeding TEs More...
 

Detailed Description

TriggerElement is the basic ingreedient of the interface between HLT algorithms and the navigation It holds navigation links by itself but they are not exposed.

The way to work with the navigation is only via the Navigation class.

Author
Tomasz Bold Tomas.nosp@m.z.Bo.nosp@m.ld@ce.nosp@m.rn.c.nosp@m.h - U. of California - Irvine

Definition at line 27 of file TrigNavStructure/TrigNavStructure/TriggerElement.h.

Member Typedef Documentation

◆ FeatureVec

Member Enumeration Documentation

◆ Relation

possible relations enumeration (Note: uses no longer here)

Enumerator
sameRoIRelation 

equilateral relation of all TEs rooted in one RoI

seedsRelation 

what TEs I am seeding

seededByRelation 

what TEs are seeding me

Definition at line 116 of file TrigNavStructure/TrigNavStructure/TriggerElement.h.

116  {
118  seedsRelation,
120  };

◆ States

Enumerator
activeState 

this bit is keeping active/inactive state of TE

ghostState 

this TE is of type ghost/evaporating/one can't attach features to this TE

nofwdState 

this TE is of type which stops fwd deactivation

errorState 

somewhere in the algorithms dealing with this TE there was an error

Definition at line 136 of file TrigNavStructure/TrigNavStructure/TriggerElement.h.

136  {
137  activeState = 0x1,
138  ghostState = 0x2,
139  nofwdState = 0x4,
140  errorState = 0x8
141  };

Constructor & Destructor Documentation

◆ TriggerElement() [1/2]

TriggerElement::TriggerElement ( )

Definition at line 15 of file TrigNavStructure/Root/TriggerElement.cxx.

16  : m_state(activeState), m_id(0), m_transient(0) {
17 }

◆ TriggerElement() [2/2]

TriggerElement::TriggerElement ( te_id_type  id,
bool  ghost,
bool  nofwd = false 
)

Definition at line 19 of file TrigNavStructure/Root/TriggerElement.cxx.

20  : m_state(activeState), m_id(id), m_transient(0) {
21  if ( ghost )
23  if ( nofwd )
25 }

◆ ~TriggerElement()

TriggerElement::~TriggerElement ( )

Definition at line 27 of file TrigNavStructure/Root/TriggerElement.cxx.

27  {
28 }

Member Function Documentation

◆ addFeature() [1/2]

void TriggerElement::addFeature ( class_id_type  clid,
const ObjectIndex index,
bool  forget = false 
)

add helper for new feature

Parameters
clidthe CLID of the object attached
indexan integer used to retrieve it
forgetis the flag notifying that during serialization link to this objects should be lost

Definition at line 37 of file TrigNavStructure/Root/TriggerElement.cxx.

37  {
38  addFeature(FeatureAccessHelper(clid, index, forget));
39 }

◆ addFeature() [2/2]

void TriggerElement::addFeature ( const FeatureAccessHelper f)

Definition at line 41 of file TrigNavStructure/Root/TriggerElement.cxx.

41  {
42  const static size_t max_features_per_te = 0xfff;
43  if ( m_uses.size() == max_features_per_te-1 ) {
44  std::cout << "ERROR - count of features per TE exceeds the limitation, further attach operations are ignored" << std::endl;
45  }
46  if ( m_uses.size() == max_features_per_te ) {
47  return;
48  }
49  // if ( m_uses.size() > 100 )
50  // std::cout << "INFO - many features per TE " << f.getCLID() << std::endl;
51  m_uses.push_back( f );
52  m_prev.push_back( f );
53 }

◆ deserialize()

void TriggerElement::deserialize ( std::vector< uint32_t >::const_iterator &  inputIt,
const std::map< uint16_t, TriggerElement * > &  keys,
const TriggerElement previous 
)

deserialization

Parameters
inputIta point where we should start reading
keyskeys wich point to the TE related by seeds relation
previousUNUSED parameter

Definition at line 182 of file TrigNavStructure/Root/TriggerElement.cxx.

183  {
184 
185  m_id = *inputIt++;
186  uint32_t seedingUsesStateWord = *inputIt++;
187  m_state = seedingUsesStateWord & 0xf;
188  unsigned int size = (seedingUsesStateWord & 0xfff00000) >> 20;
189  unsigned int featuresAttached = (seedingUsesStateWord & 0x000fff00) >> 8;
190  // std::cerr << "Try DeSerialize TE id: " << m_id << " fea: " << featuresAttached << " rel: "<< size << " raw " << seedingUsesStateWord << std::endl;
191 
192 
193 
194  std::map<uint16_t, TriggerElement*>::const_iterator id;
195  unsigned relationsCount = 0;
196  uint16_t key{0};
197  for ( unsigned int i = 0 ; i < size; ++i ) {
198  extractUint16FromUint32Vector(inputIt, key, relationsCount); // extract the key from the payload
199  ++relationsCount;
200  // look for that key
201  id = keys.find(key);
202  if ( id != keys.end() ) {
203  TriggerElement* te = id->second;
204  // relate ( te, seededByRelation );
205  te->relate ( this, seedsRelation );
206  this->relate ( te, seededByRelation ); // seededBy and seeds are reflexive ...
207  m_prev.reserve(m_prev.size() + te->getPreviousFeatures().size());
208  m_prev.insert(m_prev.end(), te->getPreviousFeatures().begin(), te->getPreviousFeatures().end() ); // rebuild previous features list
209  }
210  }
211  if ( relationsCount %2 == 1 ) inputIt++; // we need to do this because if number of features is odd the payload iterator is not incremented by extract...
212 
213  // unpack features holders info
214  m_uses.reserve(m_uses.size() + featuresAttached);
215  m_prev.reserve(m_prev.size() + featuresAttached);
216  for ( unsigned int i = 0 ; i < featuresAttached; ++i ) {
217  unsigned int clid = *inputIt++;
218  ObjectIndex coordinate;
219  coordinate.deserialize(inputIt);
220  addFeature(clid, coordinate);
221  }
222 }

◆ enquireId()

unsigned int TriggerElement::enquireId ( std::vector< uint32_t >::const_iterator &  inputIt)
static

Definition at line 111 of file TrigNavStructure/Root/TriggerElement.cxx.

111  {
112  return unsigned(*inputIt);
113 }

◆ getActiveState()

bool HLT::TriggerElement::getActiveState ( ) const
inline

get state of the TriggerElement

Definition at line 48 of file TrigNavStructure/TrigNavStructure/TriggerElement.h.

48 { return m_state & activeState; }

◆ getErrorState()

bool HLT::TriggerElement::getErrorState ( ) const
inline

Definition at line 65 of file TrigNavStructure/TrigNavStructure/TriggerElement.h.

65 { return m_state & errorState; }

◆ getFeatureAccessHelpers() [1/2]

std::vector< FeatureAccessHelper >& HLT::TriggerElement::getFeatureAccessHelpers ( )
inline

Definition at line 239 of file TrigNavStructure/TrigNavStructure/TriggerElement.h.

239 { return m_uses; }

◆ getFeatureAccessHelpers() [2/2]

const std::vector< FeatureAccessHelper >& HLT::TriggerElement::getFeatureAccessHelpers ( ) const
inline

returns all features which ara attached to this TE

Definition at line 238 of file TrigNavStructure/TrigNavStructure/TriggerElement.h.

238 { return m_uses; }

◆ getGhostState()

bool HLT::TriggerElement::getGhostState ( ) const
inline

Definition at line 56 of file TrigNavStructure/TrigNavStructure/TriggerElement.h.

56 { return m_state & ghostState; }

◆ getId()

te_id_type HLT::TriggerElement::getId ( ) const
inline

reset internals.

Needed because of TriggerStore (or TriggerFactory ...) can be used.

gets the id of this TriggerElement

Definition at line 43 of file TrigNavStructure/TrigNavStructure/TriggerElement.h.

43 { return m_id; }

◆ getPreviousFeatures() [1/2]

std::vector<FeatureAccessHelper>& HLT::TriggerElement::getPreviousFeatures ( )
inline

Definition at line 252 of file TrigNavStructure/TrigNavStructure/TriggerElement.h.

252 {return m_prev; }

◆ getPreviousFeatures() [2/2]

const std::vector<FeatureAccessHelper>& HLT::TriggerElement::getPreviousFeatures ( ) const
inline

Definition at line 251 of file TrigNavStructure/TrigNavStructure/TriggerElement.h.

251 {return m_prev; }

◆ getRelated()

const std::vector<TriggerElement*>& HLT::TriggerElement::getRelated ( Relation  rel) const
inline

returns reference to the likns to other TriggerElements related by relation r

Parameters
relrelation name (one of HLT::Navigation::Relation)

@return is reference ot the vector of related TEs

Definition at line 127 of file TrigNavStructure/TrigNavStructure/TriggerElement.h.

127  {
128  auto it = m_relations.find (rel);
129  if (it != m_relations.end()) {
130  return it->second;
131  }
132  static const std::vector<TriggerElement*> dumvec;
133  return dumvec;
134  }

◆ ghost()

bool HLT::TriggerElement::ghost ( ) const
inline

Definition at line 55 of file TrigNavStructure/TrigNavStructure/TriggerElement.h.

55 { return m_state & ghostState; }

◆ relate() [1/2]

void TriggerElement::relate ( const std::vector< TriggerElement * > &  tes,
Relation  r 
)

relates this TE to vecor of other TEs

Parameters
tesvector of TriggerElement pointers
rrelation .. one of Relation enums

Definition at line 95 of file TrigNavStructure/Root/TriggerElement.cxx.

95  {
96  // secure form multiple relations of the same type
97  std::vector<TriggerElement*>::const_iterator it;
98  for ( it = tes.begin(); it != tes.end(); ++it ) {
99  relate(*it, r);
100  }
101 }

◆ relate() [2/2]

void TriggerElement::relate ( TriggerElement te,
Relation  r 
)

reates given TE to other TE

Parameters
teTriggerElement pointer
rrelation .. one of Relation enums Nothe that the relation is usually reflexive ...

Definition at line 86 of file TrigNavStructure/Root/TriggerElement.cxx.

86  {
87  // secure form multiple relations of the same type
88  // silently ignoring if already related
89  // his helps if one wants the Topo TE to merge several RoIs
90  if ( find(m_relations[r].begin(), m_relations[r].end(), te) == m_relations[r].end() )
91  m_relations[r].push_back(te);
92 }

◆ serialize()

void TriggerElement::serialize ( std::vector< uint32_t > &  output,
const std::map< TriggerElement *, uint16_t > &  keys,
const TriggerElement previous 
) const

serializes TE

Parameters
outputis vector of raw integers where to put serialized TE
keysis a map from pointers to ksys ... this keas go to serializized TE
previousUNUSED parameter

Definition at line 134 of file TrigNavStructure/Root/TriggerElement.cxx.

135  {
136 
137  output.push_back(m_id); // record the TE id first
138  unsigned summaryIndex = output.size(); // reserve space for vaious caounters and state
139  output.push_back(0);
140 
141  auto it = m_relations.find (seededByRelation);
142  std::vector<TriggerElement*> dumvec;
143  const std::vector<TriggerElement*>& relvec =
144  (it != m_relations.end() ? it->second : dumvec);
145 
146  std::vector<TriggerElement*>::const_iterator teIt;
147  unsigned relationsCount = 0;
148  // go over all TE which seed me and record link to them
149  for ( teIt = relvec.begin(); teIt != relvec.end(); ++teIt ) {
150  std::map<TriggerElement*, uint16_t>::const_iterator key = keys.find(*teIt);
151  if ( key != keys.end() ) {
152  insertUint16ToUint32Vector(output, key->second, relationsCount);
153  relationsCount++;
154  }
155  // other are forgotten silently .... joke, there will be none
156  // due to fact that the to create TE one needs to know all the TEs seeding it
157  // so they are before on the list and in the "keys" map
158  }
159 
160  // here one should put only this features which are not to to be forget (we do not use this now)
161  std::vector< FeatureAccessHelper >::const_iterator featuresIt;
162  unsigned featuresCount = 0;
163 
164  for ( featuresIt = m_uses.begin(); featuresIt != m_uses.end(); ++featuresIt ) {
165  if ( ! featuresIt->forget() ) {
166  output.push_back ( featuresIt->getCLID() );
167  featuresIt->getIndex().serialize(output);
168  featuresCount++;
169  }
170  }
171  uint32_t seedingUsesStateWord = ((relvec.size() << 20)) | (featuresCount << 8) | (m_state & 0xf);
172  output[summaryIndex] = seedingUsesStateWord;
173  /*
174  std::cerr << "Serialized TE id: " << m_id << " fea: " << featuresCount
175  << " forg: " << m_uses.size() - featuresCount
176  << " rel: "<< m_relations[seededByRelation].size() << " raw: " << seedingUsesStateWord<< std::endl;
177  */
178 }

◆ setActiveState()

void TriggerElement::setActiveState ( bool  state)

set state of the TriggerElement

Definition at line 55 of file TrigNavStructure/Root/TriggerElement.cxx.

55  {
56  if ( m_state & nofwdState ) // this TE is immune to state changes
57  return;
58 
59  state ? m_state |= activeState : m_state &= ~activeState;
60  // std::cerr << "Deactivating " << m_id << std::endl;
61  // propagate forward the state of this TE if deactivated
62  // if activated then that attempt is illogical, theredore not done
63 
64  if ( state == true )
65  return;
66 
67  // this node is terminal or it is special TE type which is holding fwd deactivation
69  return;
70 
71  // std::cerr << "Propagating deactivation " << std::endl;
72  std::vector<TriggerElement*>::const_iterator it;
73  for ( it = getRelated(seedsRelation).begin(); it != getRelated(seedsRelation).end(); ++it ) {
74  (*it)->setActiveState(false);
75  }
76 }

◆ setErrorState()

void TriggerElement::setErrorState ( bool  state = true)

Definition at line 78 of file TrigNavStructure/Root/TriggerElement.cxx.

78  {
79  state ? m_state |= errorState : m_state &= ~errorState;
80 }

◆ setGhostState()

void TriggerElement::setGhostState ( bool  t = true)

Definition at line 82 of file TrigNavStructure/Root/TriggerElement.cxx.

82  {
83  state ? m_state |= ghostState : m_state &= ~ghostState;
84 }

◆ setTransient()

void HLT::TriggerElement::setTransient ( bool  t = true)
inline

Definition at line 59 of file TrigNavStructure/TrigNavStructure/TriggerElement.h.

59 { m_transient = t; }

◆ transient()

bool HLT::TriggerElement::transient ( )
inline

Definition at line 60 of file TrigNavStructure/TrigNavStructure/TriggerElement.h.

60 { return m_transient; }

Member Data Documentation

◆ m_id

te_id_type HLT::TriggerElement::m_id
private

◆ m_prev

std::vector< FeatureAccessHelper > HLT::TriggerElement::m_prev
private

all features attached are in this TE and seeding TEs

Definition at line 260 of file TrigNavStructure/TrigNavStructure/TriggerElement.h.

◆ m_relations

std::map<Relation, std::vector<TriggerElement*> > HLT::TriggerElement::m_relations

relations holder (features outside)

Definition at line 143 of file TrigNavStructure/TrigNavStructure/TriggerElement.h.

◆ m_state

unsigned int HLT::TriggerElement::m_state
private

one word for all states, info in bits (saving space in serialized object)

Definition at line 256 of file TrigNavStructure/TrigNavStructure/TriggerElement.h.

◆ m_transient

bool HLT::TriggerElement::m_transient
private

marker that TE should not be serialized

Definition at line 258 of file TrigNavStructure/TrigNavStructure/TriggerElement.h.

◆ m_uses

std::vector< FeatureAccessHelper > HLT::TriggerElement::m_uses
private

all features attached are in this storage

Definition at line 259 of file TrigNavStructure/TrigNavStructure/TriggerElement.h.


The documentation for this class was generated from the following files:
HLT::TriggerElement::ghostState
@ ghostState
this TE is of type ghost/evaporating/one can't attach features to this TE
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:138
beamspotman.r
def r
Definition: beamspotman.py:676
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
skel.rel
rel
Announce start of JO checkingrelease nimber checking.
Definition: skel.GENtoEVGEN.py:182
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
HLT::TriggerElement::seedsRelation
@ seedsRelation
what TEs I am seeding
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:118
index
Definition: index.py:1
insertUint16ToUint32Vector
void insertUint16ToUint32Vector(std::vector< uint32_t > &v, uint16_t val, unsigned count)
Definition: TrigNavStructure/Root/TriggerElement.cxx:115
extractUint16FromUint32Vector
void extractUint16FromUint32Vector(std::vector< uint32_t >::const_iterator &it, uint16_t &val, unsigned count)
Definition: TrigNavStructure/Root/TriggerElement.cxx:125
PlotCalibFromCool.begin
begin
Definition: PlotCalibFromCool.py:94
skel.it
it
Definition: skel.GENtoEVGEN.py:396
NSWL1::coordinate
float coordinate(const Vertex &v)
Definition: GeoUtils.h:56
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
empty
bool empty(TH1 *h)
Definition: computils.cxx:295
xAOD::unsigned
unsigned
Definition: RingSetConf_v1.cxx:662
HLT::TriggerElement::seededByRelation
@ seededByRelation
what TEs are seeding me
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:119
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
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
HLT::TriggerElement::m_state
unsigned int m_state
one word for all states, info in bits (saving space in serialized object)
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:256
HLT::TriggerElement::m_uses
std::vector< FeatureAccessHelper > m_uses
all features attached are in this storage
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:259
HLT::TriggerElement::sameRoIRelation
@ sameRoIRelation
equilateral relation of all TEs rooted in one RoI
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:117
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:93
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
HLT::TriggerElement::relate
void relate(TriggerElement *te, Relation r)
reates given TE to other TE
Definition: TrigNavStructure/Root/TriggerElement.cxx:86
HLT::TriggerElement::m_transient
bool m_transient
marker that TE should not be serialized
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:258
hist_file_dump.f
f
Definition: hist_file_dump.py:135
HLT::TriggerElement::m_relations
std::map< Relation, std::vector< TriggerElement * > > m_relations
relations holder (features outside)
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:143
merge.output
output
Definition: merge.py:17
HLT::TriggerElement::m_prev
std::vector< FeatureAccessHelper > m_prev
all features attached are in this TE and seeding TEs
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:260
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:227
HLT::TriggerElement::ghost
bool ghost() const
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:55
HLT::TriggerElement::nofwdState
@ nofwdState
this TE is of type which stops fwd deactivation
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:139
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:798
HLT::TriggerElement::errorState
@ errorState
somewhere in the algorithms dealing with this TE there was an error
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:140
HLT::TriggerElement::activeState
@ activeState
this bit is keeping active/inactive state of TE
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:137
HLT::TriggerElement::getPreviousFeatures
const std::vector< FeatureAccessHelper > & getPreviousFeatures() const
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:251
HLT::TriggerElement::m_id
te_id_type m_id
id
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:257
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37