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