ATLAS Offline Software
Loading...
Searching...
No Matches
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
18namespace 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
76 public:
77
79
80 ObjectIndex(sub_index_type subType, index_type begin, index_type end);
82 index_type objectsBegin() const;
83 index_type objectsEnd() const;
84 bool isSameOrWithin ( const ObjectIndex* idx) const;
85 void updateBeginAndEnd( index_type begin, index_type end);
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 {
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
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 {
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
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;
206 m_index.setSubTypeIndex(idx);
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;
259 std::vector< FeatureAccessHelper > m_uses;
260 std::vector< FeatureAccessHelper > m_prev;
261
262 };
263} // eof namespace
264
265#endif //TRIGNAVSTRUCTURE_TRIGGERELEMENT_H
FeatureAccessHelper(class_id_type clid, ObjectIndex index, bool forget=false)
bool m_forget
flag, if true saying that link to this feature should not be serialized
bool forget() const
flag, if true saying that the object does not need to be serialized
const ObjectIndex & getIndex() const
index in the external ojects array
friend std::ostream & operator<<(std::ostream &o, const FeatureAccessHelper &f)
ObjectIndex m_index
the external index (here we do not know what it is)
Helper class for conversion from/to int stored in TE and pair of ints used in Navigation Object point...
void serialize(std::vector< uint32_t > &output) const
sub_index_type subTypeIndex() const
to get collection index
index_type objectsEnd() const
to get object number in th ecollection
index_type m_objIndexEnd
auxiliary index word for big features
void updateBeginAndEnd(index_type begin, index_type end)
index_type objectsBegin() const
to get object number in th ecollection
void deserialize(std::vector< uint32_t >::const_iterator &inputIt)
index_type m_objIndexBegin
auxiliary index word for big features
bool isSameOrWithin(const ObjectIndex *idx) const
check if idx is the same as this or is within this index
std::vector< FeatureAccessHelper > m_uses
all features attached are in this storage
std::vector< FeatureAccessHelper > & getFeatureAccessHelpers()
@ nofwdState
this TE is of type which stops fwd deactivation
@ ghostState
this TE is of type ghost/evaporating/one can't attach features to this TE
@ activeState
this bit is keeping active/inactive state of TE
@ errorState
somewhere in the algorithms dealing with this TE there was an error
unsigned int m_state
one word for all states, info in bits (saving space in serialized object)
static unsigned int enquireId(std::vector< uint32_t >::const_iterator &inputIt)
Relation
possible relations enumeration (Note: uses no longer here)
@ sameRoIRelation
equilateral relation of all TEs rooted in one RoI
void serialize(std::vector< uint32_t > &output, const std::map< TriggerElement *, uint16_t > &keys, const TriggerElement *previous) const
serializes TE
const std::vector< TriggerElement * > & getRelated(Relation rel) const
returns reference to the likns to other TriggerElements related by relation r
bool getActiveState() const
get state of the TriggerElement
std::vector< FeatureAccessHelper > & getPreviousFeatures()
bool m_transient
marker that TE should not be serialized
const std::vector< FeatureAccessHelper > & getFeatureAccessHelpers() const
returns all features which ara attached to this TE
void addFeature(class_id_type clid, const ObjectIndex &index, bool forget=false)
add helper for new feature
std::vector< FeatureAccessHelper > m_prev
all features attached are in this TE and seeding TEs
const std::vector< FeatureAccessHelper > & getPreviousFeatures() const
void deserialize(std::vector< uint32_t >::const_iterator &inputIt, const std::map< uint16_t, TriggerElement * > &keys, const TriggerElement *previous)
deserialization
void setActiveState(bool state)
set state of the TriggerElement
void relate(TriggerElement *te, Relation r)
reates given TE to other TE
std::map< Relation, std::vector< TriggerElement * > > m_relations
relations holder (features outside)
int r
Definition globals.cxx:22
It used to be useful piece of code for replacing actual SG with other store of similar functionality ...
static const class_id_type invalid_class_id
Definition index.py:1