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
38 // Constructor for L2 and EF chains
39 TrigConfChain(const std::string &chain_name,
40 int chain_counter,
41 unsigned int chain_id,
42 const std::string &level,
43 const std::string &lower_chain_name,
44 int lower_chain_counter,
45 unsigned int lower_chain_id,
46 float prescale,
47 float pass_through);
48
49 // Constructor for L1 chains
50 TrigConfChain(const std::string &chain_name,
51 int chain_counter,
52 unsigned int chain_id,
53 float prescale);
54
56
57 void clearStrings();
58
59 void addSignature(const TrigConfSig &obj) { m_signature.push_back(obj); }
60 void addGroup (const std::string &name) { m_group.push_back(name); }
61 void addStream (const std::string &name, float prescale);
62 void addEBHypo (const std::string &name) { m_ebhypo_names.push_back(name); }
63
64 void clearGroup () { m_group.clear(); }
65 void clearStream () { m_stream_name.clear(); m_stream_prescale.clear(); }
66 void clearEBHypo () { m_ebhypo_names.clear(); }
67
68 void addLowerChainId(uint32_t lower_id) { m_lower_ids.push_back(lower_id); }
69
70 void setPrescale (float val) { m_prescale = val; }
71 void setPassThrough(float val) { m_pass_through = val; }
72
73 const std::string& getName() const { return m_chain_name; }
74 const std::string& getChainName() const { return getName(); }
75 const std::string& getLowerName() const { return m_lower_name; }
76
77 uint32_t getId() const { return m_chain_id; }
78 uint16_t getCounter() const { return m_chain_counter; }
79 uint16_t getEncodedId() const;
80
81 uint16_t getLowerCounter() const { return m_lower_counter; }
82 uint32_t getLowerId() const { return m_lower_id; }
83 uint16_t getLowerEncodedId() const;
84
85 unsigned int getLevelId() const { return m_level; }
86 const std::string getLevel() const;
87
88 float getPrescale() const { return m_prescale; }
89 float getPS() const { return getPrescale(); }
90 float getPassThrough() const { return m_pass_through; }
91 float getPT() const { return getPassThrough(); }
92
93 const std::vector<float>& getStreamPS() const { return m_stream_prescale; }
94 const std::vector<TrigConfSig>& getSignature() const { return m_signature; }
95 const std::vector<std::string>& getStream() const { return m_stream_name; }
96 const std::vector<std::string>& getGroup() const { return m_group; }
97 const std::vector<std::string>& getEBHypo() const { return m_ebhypo_names; }
98
99 // Allow access to stream and group
100 std::vector<float>& getStreamPS() { return m_stream_prescale; }
101 std::vector<std::string>& getStream() { return m_stream_name; }
102 std::vector<std::string>& getGroup() { return m_group; }
103 std::vector<std::string>& getEBHypo() { return m_ebhypo_names; }
104
105 const std::vector<uint32_t>& getLowerIds() const { return m_lower_ids; }
106
107 float getSignaturePrescale(const std::string &name) const;
108
109 bool matchOutputTE(uint32_t te_id) const;
110
111 void print(std::ostream &os) const;
112 void print() const;
113
114 private:
115
116 std::string m_chain_name{}; // Chain name
117 std::string m_lower_name{}; // Lower chain name
118 uint32_t m_chain_id{}; // Hash value from chain_name
119 uint32_t m_lower_id{}; // Lower chain hash value from chain_name
120 uint16_t m_chain_counter{}; // Chain counter
121 uint16_t m_lower_counter{}; // Lower chain counter
122 uint8_t m_level{}; // Trigger level
123 float m_prescale{}; // Prescale value
124 float m_pass_through{}; // Pass_through flag
125
126 std::vector<uint32_t> m_lower_ids; // Lower chain ids (exceptional case!)
127 std::vector<float> m_stream_prescale; // Stream prescale list
128 std::vector<TrigConfSig> m_signature; // Signature list
129 std::vector<std::string> m_stream_name; // Stream name list
130 std::vector<std::string> m_group; // Group name list
131 std::vector<std::string> m_ebhypo_names; // List of L1 items from EB Hypo
132};
133
134std::string str(const TrigConfChain &);
135
136//
137// getEncoded() returns 16 bit word for chain level and counter:
138// llcccccccccccccc
139// 0123456789012345
140//
141// chain level [l] 2 bits (0:3) = 1 (L1), 2 (L2), 3 (EF)
142// chain counter [c] 14 bits (0:16,384)
143//
144
145//
146// Helper functions
147//
148namespace Trig {
149 namespace Bits {
150 const uint16_t maskLevel = 0xc000;
151 const uint16_t maskCounter = 0x3fff;
152
153 const uint16_t shiftLevel = 14;
154 const uint16_t shiftCounter = 0;
155 }
156
157 uint16_t getEncodedId(int level, int counter);
158 uint16_t getEncodedId(const std::string &level, int counter);
159
160 inline uint16_t getCounterFromEncodedId(uint16_t encoded) {
161 return (encoded & Bits::maskCounter) >> Bits::shiftCounter;
162 }
163 inline uint16_t getLevelFromEncodedId(uint16_t encoded) {
164 return (encoded & Bits::maskLevel) >> Bits::shiftLevel;
165 }
166}
167
168//
169// Inlined global sort functions
170//
171inline bool operator==(const TrigConfChain &lhs, const TrigConfChain &rhs) {
172 return lhs.getName() == rhs.getName();
173}
174inline bool operator <(const TrigConfChain &lhs, const TrigConfChain &rhs) {
175 return lhs.getName() < rhs.getName();
176}
177
178//
179// Compare TrigConfChain and other types
180//
181inline bool operator==(const TrigConfChain &chn, const std::string &name) {
182 return chn.getName() == name;
183}
184inline bool operator==(const std::string &name, const TrigConfChain &chn) {
185 return chn.getName() == name;
186}
187
188inline bool operator <(const TrigConfChain &chn, const std::string &name) {
189 return chn.getName() < name;
190}
191inline bool operator <(const std::string &name, const TrigConfChain &chn) {
192 return name < chn.getName();
193}
194
195inline bool operator==(const TrigConfChain &chn, unsigned int id) {
196 return chn.getId() == id;
197}
198inline bool operator==(unsigned int id, const TrigConfChain &chn) {
199 return id == chn.getId();
200}
201
202inline bool operator <(const TrigConfChain &chn, unsigned int id) {
203 return chn.getId() < id;
204}
205inline bool operator <(unsigned int id, const TrigConfChain &chn) {
206 return id < chn.getId();
207}
208
209CLASS_DEF( TrigConfChain , 158937726 , 1 )
210
211#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
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
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)