ATLAS Offline Software
TrigNavStructure/TrigNavStructure/TriggerElement.h
Go to the documentation of this file.
1 // -*- c++ -*-
2 
3 /*
4  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 #ifndef TRIGNAVSTRUCTURE_TRIGGERELEMENT_H
8 #define TRIGNAVSTRUCTURE_TRIGGERELEMENT_H
9 
10 #include <map>
11 #include <vector>
12 #include <string>
13 #include <stdint.h>
14 #include <ostream>
15 
16 
17 #include "TrigNavStructure/Types.h"
18 namespace HLT {
19 
28  public:
29 
31  TriggerElement( te_id_type id, bool ghost, bool nofwd=false);
33 
38  // void reset();
39 
43  inline te_id_type getId() const { return m_id; }
44 
48  inline bool getActiveState() const { return m_state & activeState; }
49 
53  void setActiveState( bool state );
54 
55  inline bool ghost() const { return m_state & ghostState; }
56  bool getGhostState() const { return m_state & ghostState; }
57  void setGhostState( bool t = true);
58 
59  void setTransient(bool t = true) { m_transient = t; }
60  bool transient() { return m_transient; }
61 
62 
63  void setErrorState(bool state = true);
64 
65  inline bool getErrorState() const { return m_state & errorState; }
66 
75  class ObjectIndex {
76  public:
77 
78  ObjectIndex();
79 
82  index_type objectsBegin() const;
83  index_type objectsEnd() const;
84  bool isSameOrWithin ( const ObjectIndex* idx) const;
86  bool operator<(const ObjectIndex& obj) const;
87 
88  void serialize(std::vector<uint32_t>& output) const;
89  void deserialize( std::vector<uint32_t>::const_iterator& inputIt);
90 
92  bool valid() const;
93  bool operator==(const ObjectIndex& rhs) const {
95  || m_objIndexEnd != rhs.m_objIndexEnd)
96  return false;
97  return true;
98  }
99  bool operator!=(const ObjectIndex& rhs) const {
100  return ! (*this == rhs);
101  }
102 
103  private:
107  };
108 
109 
110 
111 
112 
116  enum Relation {
120  };
121 
127  inline const std::vector<TriggerElement*>& getRelated( Relation rel ) const {
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  }
135 
136  enum States {
137  activeState = 0x1,
138  ghostState = 0x2,
139  nofwdState = 0x4,
140  errorState = 0x8
141  };
142 
143  std::map<Relation, std::vector<TriggerElement*> > m_relations;
144 
151  void relate( TriggerElement* te, Relation r );
152 
158  void relate( const std::vector<TriggerElement*>& tes, Relation r );
159 
160  static unsigned int enquireId( std::vector<uint32_t>::const_iterator& inputIt );
161 
168  void serialize( std::vector<uint32_t>& output, const std::map<TriggerElement*, uint16_t>& keys, const TriggerElement* previous ) const;
169 
176  void deserialize( std::vector<uint32_t>::const_iterator& inputIt, const std::map<uint16_t, TriggerElement*>& keys, const TriggerElement* previous );
177 
178 
179 
193  public:
195  : m_CLID(0), m_forget(false) {}
196 
198  : m_CLID(clid), m_index(index),m_forget(forget) {}
199 
200  //FeatureAccessHelper( unsigned int clid, const ObjectIndex& index, bool forget=false) //!< the only constructor
201  // : m_CLID(clid), m_index(index),m_forget(forget) {}
202 
203  //method needed for navigation rewiring (AOD->xAOD)
205  m_CLID = clid;
207  }
208  inline class_id_type getCLID() const {return m_CLID;}
209  inline const ObjectIndex& getIndex() const {return m_index;}
210 
211  inline void setForget( bool value = true ) { m_forget = value; }
212  inline bool forget() const { return m_forget; }
213  friend std::ostream& operator<<( std::ostream& o, const FeatureAccessHelper& f ) {
214  o << " CLID:" << f.m_CLID
215  << " idx:" << f.m_index.subTypeIndex()
216  << ":" << f.m_index.objectsBegin()
217  << ":" << f.m_index.objectsEnd() << std::dec;
218  return o;
219  }
220  bool operator==(const FeatureAccessHelper& rhs) const {
221  if (m_CLID != rhs.m_CLID || m_index != rhs.m_index)
222  return false;
223  return true;
224  }
225 
226  bool valid() const { return m_CLID != invalid_class_id and m_index.valid(); }
227 
228  private:
231  bool m_forget;
232  };
233  typedef std::vector< FeatureAccessHelper > FeatureVec;
234 
238  const std::vector< FeatureAccessHelper >& getFeatureAccessHelpers() const { return m_uses; }
239  std::vector< FeatureAccessHelper >& getFeatureAccessHelpers() { return m_uses; }
240 
247  void addFeature( class_id_type clid, const ObjectIndex& index, bool forget=false );
248  void addFeature( const FeatureAccessHelper& f);
249 
250 
251  const std::vector<FeatureAccessHelper>& getPreviousFeatures() const {return m_prev; }
252  std::vector<FeatureAccessHelper>& getPreviousFeatures() {return m_prev; }
253  // void appendFeaturesKeyPrint(const std::vector<FeatureAccessHelper>& k);
254 
255  private:
256  unsigned int m_state;
258  bool m_transient;
259  std::vector< FeatureAccessHelper > m_uses;
260  std::vector< FeatureAccessHelper > m_prev;
261 
262  };
263 } // eof namespace
264 
265 #endif //TRIGNAVSTRUCTURE_TRIGGERELEMENT_H
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
HLT::TriggerElement::ObjectIndex
Helper class for conversion from/to int stored in TE and pair of ints used in Navigation Object point...
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:75
beamspotman.r
def r
Definition: beamspotman.py:676
HLT::TriggerElement::ObjectIndex::serialize
void serialize(std::vector< uint32_t > &output) const
Definition: TrigNavStructure/Root/TriggerElement.cxx:278
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
HLT::TriggerElement::ObjectIndex::deserialize
void deserialize(std::vector< uint32_t >::const_iterator &inputIt)
Definition: TrigNavStructure/Root/TriggerElement.cxx:306
HLT::TriggerElement::Relation
Relation
possible relations enumeration (Note: uses no longer here)
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:116
skel.rel
rel
Announce start of JO checkingrelease nimber checking.
Definition: skel.GENtoEVGEN.py:182
HLT::TriggerElement::getFeatureAccessHelpers
std::vector< FeatureAccessHelper > & getFeatureAccessHelpers()
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:239
HLT::TriggerElement::FeatureAccessHelper::m_index
ObjectIndex m_index
the external index (here we do not know what it is)
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:230
HLT::TriggerElement::seedsRelation
@ seedsRelation
what TEs I am seeding
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:118
index
Definition: index.py:1
HLT::TriggerElement::ObjectIndex::m_objIndexEnd
index_type m_objIndexEnd
auxiliary index word for big features
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:106
HLT::TriggerElement::FeatureVec
std::vector< FeatureAccessHelper > FeatureVec
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:233
HLT::TriggerElement::FeatureAccessHelper::operator<<
friend std::ostream & operator<<(std::ostream &o, const FeatureAccessHelper &f)
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:213
HLT::TriggerElement::FeatureAccessHelper::setCLIDandIndex
void setCLIDandIndex(class_id_type clid, sub_index_type idx)
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:204
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
HLT::TriggerElement::FeatureAccessHelper::getCLID
class_id_type getCLID() const
Class ID of object.
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:208
HLT::TriggerElement::getActiveState
bool getActiveState() const
get state of the TriggerElement
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:48
athena.value
value
Definition: athena.py:124
HLT::TriggerElement::getErrorState
bool getErrorState() const
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:65
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
HLT::TriggerElement::ObjectIndex::operator!=
bool operator!=(const ObjectIndex &rhs) const
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:99
HLT::TriggerElement::seededByRelation
@ seededByRelation
what TEs are seeding me
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:119
HLT::TriggerElement::FeatureAccessHelper::m_CLID
class_id_type m_CLID
the CLID of the object
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:229
HLT::TriggerElement::setTransient
void setTransient(bool t=true)
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:59
HLT::TriggerElement::setActiveState
void setActiveState(bool state)
set state of the TriggerElement
Definition: TrigNavStructure/Root/TriggerElement.cxx:55
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::TriggerElement::setErrorState
void setErrorState(bool state=true)
Definition: TrigNavStructure/Root/TriggerElement.cxx:78
HLT::TriggerElement::ObjectIndex::subTypeIndex
sub_index_type subTypeIndex() const
to get collection index
Definition: TrigNavStructure/Root/TriggerElement.cxx:247
HLT::TriggerElement::ObjectIndex::objectsBegin
index_type objectsBegin() const
to get object number in th ecollection
Definition: TrigNavStructure/Root/TriggerElement.cxx:256
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::getGhostState
bool getGhostState() const
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:56
HLT::TriggerElement::ObjectIndex::valid
bool valid() const
Definition: TrigNavStructure/Root/TriggerElement.cxx:342
HLT::TriggerElement::m_uses
std::vector< FeatureAccessHelper > m_uses
all features attached are in this storage
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:259
HLT::TriggerElement::ObjectIndex::m_subTypeIndex
sub_index_type m_subTypeIndex
actual index storage
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:104
HLT::TriggerElement::sameRoIRelation
@ sameRoIRelation
equilateral relation of all TEs rooted in one RoI
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:117
HLT
It used to be useful piece of code for replacing actual SG with other store of similar functionality ...
Definition: HLTResultReader.h:26
HLT::TriggerElement::serialize
void serialize(std::vector< uint32_t > &output, const std::map< TriggerElement *, uint16_t > &keys, const TriggerElement *previous) const
serializes TE
Definition: TrigNavStructure/Root/TriggerElement.cxx:134
HLT::TriggerElement
TriggerElement is the basic ingreedient of the interface between HLT algorithms and the navigation It...
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:27
Types.h
HLT::TriggerElement::FeatureAccessHelper::FeatureAccessHelper
FeatureAccessHelper(class_id_type clid, ObjectIndex index, bool forget=false)
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:197
HLT::TriggerElement::FeatureAccessHelper::m_forget
bool m_forget
flag, if true saying that link to this feature should not be serialized
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:231
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::class_id_type
uint32_t class_id_type
Definition: Trigger/TrigEvent/TrigNavStructure/Root/Types.h:11
HLT::TriggerElement::enquireId
static unsigned int enquireId(std::vector< uint32_t >::const_iterator &inputIt)
Definition: TrigNavStructure/Root/TriggerElement.cxx:111
HLT::sub_index_type
uint16_t sub_index_type
Definition: Trigger/TrigEvent/TrigNavStructure/Root/Types.h:9
HLT::TriggerElement::FeatureAccessHelper::FeatureAccessHelper
FeatureAccessHelper()
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:194
HLT::TriggerElement::FeatureAccessHelper::setForget
void setForget(bool value=true)
sets the forget flag
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:211
HLT::TriggerElement::ObjectIndex::updateBeginAndEnd
void updateBeginAndEnd(index_type begin, index_type end)
Definition: TrigNavStructure/Root/TriggerElement.cxx:264
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
HLT::TriggerElement::States
States
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:136
HLT::TriggerElement::ObjectIndex::setSubTypeIndex
void setSubTypeIndex(sub_index_type idx)
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:91
HLT::TriggerElement::FeatureAccessHelper::forget
bool forget() const
flag, if true saying that the object does not need to be serialized
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:212
HLT::TriggerElement::~TriggerElement
~TriggerElement()
Definition: TrigNavStructure/Root/TriggerElement.cxx:27
HLT::TriggerElement::ObjectIndex::operator<
bool operator<(const ObjectIndex &obj) const
Definition: TrigNavStructure/Root/TriggerElement.cxx:269
HLT::TriggerElement::FeatureAccessHelper::operator==
bool operator==(const FeatureAccessHelper &rhs) const
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:220
HLT::TriggerElement::ObjectIndex::m_objIndexBegin
index_type m_objIndexBegin
auxiliary index word for big features
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:105
HLT::TriggerElement::ObjectIndex::ObjectIndex
ObjectIndex()
Definition: TrigNavStructure/Root/TriggerElement.cxx:234
HLT::TriggerElement::ghost
bool ghost() const
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:55
HLT::TriggerElement::ObjectIndex::objectsEnd
index_type objectsEnd() const
to get object number in th ecollection
Definition: TrigNavStructure/Root/TriggerElement.cxx:260
HLT::TriggerElement::FeatureAccessHelper::getIndex
const ObjectIndex & getIndex() const
index in the external ojects array
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:209
HLT::TriggerElement::setGhostState
void setGhostState(bool t=true)
Definition: TrigNavStructure/Root/TriggerElement.cxx:82
HLT::TriggerElement::FeatureAccessHelper
the FeatureAccessHelper is a class used to keep track of features attached to this TE.
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:192
HLT::TriggerElement::TriggerElement
TriggerElement()
Definition: TrigNavStructure/Root/TriggerElement.cxx:15
HLT::TriggerElement::ObjectIndex::operator==
bool operator==(const ObjectIndex &rhs) const
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:93
HLT::TriggerElement::FeatureAccessHelper::valid
bool valid() const
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:226
LArNewCalib_DelayDump_OFC_Cali.idx
idx
Definition: LArNewCalib_DelayDump_OFC_Cali.py:69
HLT::TriggerElement::nofwdState
@ nofwdState
this TE is of type which stops fwd deactivation
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:139
HLT::TriggerElement::getFeatureAccessHelpers
const std::vector< FeatureAccessHelper > & getFeatureAccessHelpers() const
returns all features which ara attached to this TE
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:238
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:798
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
HLT::TriggerElement::errorState
@ errorState
somewhere in the algorithms dealing with this TE there was an error
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:140
python.PyAthena.obj
obj
Definition: PyAthena.py:132
HLT::TriggerElement::activeState
@ activeState
this bit is keeping active/inactive state of TE
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:137
HLT::index_type
uint32_t index_type
Definition: Trigger/TrigEvent/TrigNavStructure/Root/Types.h:10
HLT::TriggerElement::ObjectIndex::isSameOrWithin
bool isSameOrWithin(const ObjectIndex *idx) const
check if idx is the same as this or is within this index
Definition: TrigNavStructure/Root/TriggerElement.cxx:332
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
HLT::TriggerElement::getPreviousFeatures
std::vector< FeatureAccessHelper > & getPreviousFeatures()
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:252
Trk::previous
@ previous
Definition: BinningData.h:32
HLT::te_id_type
uint32_t te_id_type
Definition: Trigger/TrigEvent/TrigNavStructure/TrigNavStructure/Types.h:11