ATLAS Offline Software
Loading...
Searching...
No Matches
TrigConfChain.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef TRIGCONF_CHAIN_H
6#define TRIGCONF_CHAIN_H
7
8/*
9 @author Rustem Ospanov
10 @date July 2009
11
12 @brief This class provides map between monitoring object TrigMonChain
13 and chain configuration. This class is copied after HLTChain class
14 with some variables removed. It was added so we would be able to
15 write chain configuration into ROOT files and ship it along with
16 monitoring data.
17*/
18
19// Local
21// Framework
23
24// C/C++
25#include <iosfwd>
26#include <stdint.h>
27#include <string>
28#include <vector>
29
30
31
33{
34 public:
35
36 TrigConfChain() = default;
37 TrigConfChain(const TrigConfChain&) = default;
38 TrigConfChain(TrigConfChain&&) noexcept = default;
39 TrigConfChain& operator=(const TrigConfChain&) = default;
40 TrigConfChain& operator=(TrigConfChain&&) noexcept = default;
41
42 // Constructor for L2 and EF chains
43 TrigConfChain(const std::string &chain_name,
44 int chain_counter,
45 unsigned int chain_id,
46 const std::string &level,
47 const std::string &lower_chain_name,
48 int lower_chain_counter,
49 unsigned int lower_chain_id,
50 float prescale,
51 float pass_through);
52
53 // Constructor for L1 chains
54 TrigConfChain(const std::string &chain_name,
55 int chain_counter,
56 unsigned int chain_id,
57 float prescale);
58
59
60
62
63 void clearStrings();
64
65 void addSignature(const TrigConfSig &obj) { m_signature.push_back(obj); }
66 void addGroup (const std::string &name) { m_group.push_back(name); }
67 void addStream (const std::string &name, float prescale);
68 void addEBHypo (const std::string &name) { m_ebhypo_names.push_back(name); }
69
70 void clearGroup () { m_group.clear(); }
71 void clearStream () { m_stream_name.clear(); m_stream_prescale.clear(); }
72 void clearEBHypo () { m_ebhypo_names.clear(); }
73
74 void addLowerChainId(uint32_t lower_id) { m_lower_ids.push_back(lower_id); }
75
76 void setPrescale (float val) { m_prescale = val; }
77 void setPassThrough(float val) { m_pass_through = val; }
78
79 const std::string& getName() const { return m_chain_name; }
80 const std::string& getChainName() const { return getName(); }
81 const std::string& getLowerName() const { return m_lower_name; }
82
83 uint32_t getId() const { return m_chain_id; }
84 uint16_t getCounter() const { return m_chain_counter; }
85 uint16_t getEncodedId() const;
86
87 uint16_t getLowerCounter() const { return m_lower_counter; }
88 uint32_t getLowerId() const { return m_lower_id; }
89 uint16_t getLowerEncodedId() const;
90
91 unsigned int getLevelId() const { return m_level; }
92 const std::string getLevel() const;
93
94 float getPrescale() const { return m_prescale; }
95 float getPS() const { return getPrescale(); }
96 float getPassThrough() const { return m_pass_through; }
97 float getPT() const { return getPassThrough(); }
98
99 const std::vector<float>& getStreamPS() const { return m_stream_prescale; }
100 const std::vector<TrigConfSig>& getSignature() const { return m_signature; }
101 const std::vector<std::string>& getStream() const { return m_stream_name; }
102 const std::vector<std::string>& getGroup() const { return m_group; }
103 const std::vector<std::string>& getEBHypo() const { return m_ebhypo_names; }
104
105 // Allow access to stream and group
106 std::vector<float>& getStreamPS() { return m_stream_prescale; }
107 std::vector<std::string>& getStream() { return m_stream_name; }
108 std::vector<std::string>& getGroup() { return m_group; }
109 std::vector<std::string>& getEBHypo() { return m_ebhypo_names; }
110
111 const std::vector<uint32_t>& getLowerIds() const { return m_lower_ids; }
112
113 float getSignaturePrescale(const std::string &name) const;
114
115 bool matchOutputTE(uint32_t te_id) const;
116
117 void print(std::ostream &os) const;
118 void print() const;
119
120 private:
121
122 std::string m_chain_name{}; // Chain name
123 std::string m_lower_name{}; // Lower chain name
124 uint32_t m_chain_id{}; // Hash value from chain_name
125 uint32_t m_lower_id{}; // Lower chain hash value from chain_name
126 uint16_t m_chain_counter{}; // Chain counter
127 uint16_t m_lower_counter{}; // Lower chain counter
128 uint8_t m_level{}; // Trigger level
129 float m_prescale{}; // Prescale value
130 float m_pass_through{}; // Pass_through flag
131
132 std::vector<uint32_t> m_lower_ids; // Lower chain ids (exceptional case!)
133 std::vector<float> m_stream_prescale; // Stream prescale list
134 std::vector<TrigConfSig> m_signature; // Signature list
135 std::vector<std::string> m_stream_name; // Stream name list
136 std::vector<std::string> m_group; // Group name list
137 std::vector<std::string> m_ebhypo_names; // List of L1 items from EB Hypo
138};
139
140std::string str(const TrigConfChain &);
141
142//
143// getEncoded() returns 16 bit word for chain level and counter:
144// llcccccccccccccc
145// 0123456789012345
146//
147// chain level [l] 2 bits (0:3) = 1 (L1), 2 (L2), 3 (EF)
148// chain counter [c] 14 bits (0:16,384)
149//
150
151//
152// Helper functions
153//
154namespace Trig {
155 namespace Bits {
156 const uint16_t maskLevel = 0xc000;
157 const uint16_t maskCounter = 0x3fff;
158
159 const uint16_t shiftLevel = 14;
160 const uint16_t shiftCounter = 0;
161 }
162
163 uint16_t getEncodedId(int level, int counter);
164 uint16_t getEncodedId(const std::string &level, int counter);
165
166 inline uint16_t getCounterFromEncodedId(uint16_t encoded) {
167 return (encoded & Bits::maskCounter) >> Bits::shiftCounter;
168 }
169 inline uint16_t getLevelFromEncodedId(uint16_t encoded) {
170 return (encoded & Bits::maskLevel) >> Bits::shiftLevel;
171 }
172}
173
174//
175// Inlined global sort functions
176//
177inline bool operator==(const TrigConfChain &lhs, const TrigConfChain &rhs) {
178 return lhs.getName() == rhs.getName();
179}
180inline bool operator <(const TrigConfChain &lhs, const TrigConfChain &rhs) {
181 return lhs.getName() < rhs.getName();
182}
183
184//
185// Compare TrigConfChain and other types
186//
187inline bool operator==(const TrigConfChain &chn, const std::string &name) {
188 return chn.getName() == name;
189}
190inline bool operator==(const std::string &name, const TrigConfChain &chn) {
191 return chn.getName() == name;
192}
193
194inline bool operator <(const TrigConfChain &chn, const std::string &name) {
195 return chn.getName() < name;
196}
197inline bool operator <(const std::string &name, const TrigConfChain &chn) {
198 return name < chn.getName();
199}
200
201inline bool operator==(const TrigConfChain &chn, unsigned int id) {
202 return chn.getId() == id;
203}
204inline bool operator==(unsigned int id, const TrigConfChain &chn) {
205 return id == chn.getId();
206}
207
208inline bool operator <(const TrigConfChain &chn, unsigned int id) {
209 return chn.getId() < id;
210}
211inline bool operator <(unsigned int id, const TrigConfChain &chn) {
212 return id < chn.getId();
213}
214
215CLASS_DEF( TrigConfChain , 158937726 , 1 )
216
217#endif
macros to associate a CLID to a type
#define CLASS_DEF(NAME, CID, VERSION)
associate a clid and a version to a type eg
bool operator<(const TrigConfChain &lhs, const TrigConfChain &rhs)
bool operator==(const TrigConfChain &lhs, const TrigConfChain &rhs)
float getPrescale() const
std::vector< std::string > m_ebhypo_names
TrigConfChain(const TrigConfChain &)=default
unsigned int getLevelId() const
std::vector< std::string > & getEBHypo()
void setPassThrough(float val)
std::vector< float > & getStreamPS()
uint16_t m_chain_counter
float getPS() const
float getPassThrough() const
float getSignaturePrescale(const std::string &name) const
const std::vector< float > & getStreamPS() const
std::vector< std::string > m_stream_name
const std::vector< std::string > & getStream() const
const std::string & getName() const
std::vector< float > m_stream_prescale
const std::vector< uint32_t > & getLowerIds() const
std::string m_lower_name
TrigConfChain(TrigConfChain &&) noexcept=default
std::vector< std::string > m_group
const std::string & getLowerName() const
const std::vector< std::string > & getGroup() const
uint16_t getLowerEncodedId() const
std::vector< uint32_t > m_lower_ids
void addSignature(const TrigConfSig &obj)
uint16_t getLowerCounter() const
bool matchOutputTE(uint32_t te_id) const
const std::vector< std::string > & getEBHypo() const
const std::string & getChainName() const
uint32_t m_chain_id
void setPrescale(float val)
void addLowerChainId(uint32_t lower_id)
uint16_t getEncodedId() const
std::vector< std::string > & getStream()
float getPT() const
const std::vector< TrigConfSig > & getSignature() const
uint16_t getCounter() const
const std::string getLevel() const
uint32_t getId() const
uint32_t getLowerId() const
void addEBHypo(const std::string &name)
std::vector< TrigConfSig > m_signature
uint16_t m_lower_counter
std::vector< std::string > & getGroup()
TrigConfChain()=default
void addStream(const std::string &name, float prescale)
void addGroup(const std::string &name)
void print() const
std::string m_chain_name
uint32_t m_lower_id
const uint16_t shiftCounter
const uint16_t maskLevel
const uint16_t maskCounter
const uint16_t shiftLevel
The common trigger namespace for trigger analysis tools.
uint16_t getEncodedId(int level, int counter)
uint16_t getLevelFromEncodedId(uint16_t encoded)
uint16_t getCounterFromEncodedId(uint16_t encoded)
STL namespace.