ATLAS Offline Software
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
20 #include "AthenaKernel/CLASS_DEF.h"
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 
35  TrigConfChain();
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 
81  uint32_t getLowerId() const { return m_lower_id; }
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 
132 std::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 //
146 namespace Trig {
147  namespace Bits {
148  const uint16_t maskLevel = 0xc000;
149  const uint16_t maskCounter = 0x3fff;
150 
151  const uint16_t shiftLevel = 14;
153  }
154 
156  uint16_t getEncodedId(const std::string &level, int counter);
157 
159  return (encoded & Bits::maskCounter) >> Bits::shiftCounter;
160  }
162  return (encoded & Bits::maskLevel) >> Bits::shiftLevel;
163  }
164 }
165 
166 //
167 // Inlined global sort functions
168 //
169 inline bool operator==(const TrigConfChain &lhs, const TrigConfChain &rhs) {
170  return lhs.getName() == rhs.getName();
171 }
172 inline bool operator <(const TrigConfChain &lhs, const TrigConfChain &rhs) {
173  return lhs.getName() < rhs.getName();
174 }
175 
176 //
177 // Compare TrigConfChain and other types
178 //
179 inline bool operator==(const TrigConfChain &chn, const std::string &name) {
180  return chn.getName() == name;
181 }
182 inline bool operator==(const std::string &name, const TrigConfChain &chn) {
183  return chn.getName() == name;
184 }
185 
186 inline bool operator <(const TrigConfChain &chn, const std::string &name) {
187  return chn.getName() < name;
188 }
189 inline bool operator <(const std::string &name, const TrigConfChain &chn) {
190  return name < chn.getName();
191 }
192 
193 inline bool operator==(const TrigConfChain &chn, unsigned int id) {
194  return chn.getId() == id;
195 }
196 inline bool operator==(unsigned int id, const TrigConfChain &chn) {
197  return id == chn.getId();
198 }
199 
200 inline bool operator <(const TrigConfChain &chn, unsigned int id) {
201  return chn.getId() < id;
202 }
203 inline bool operator <(unsigned int id, const TrigConfChain &chn) {
204  return id < chn.getId();
205 }
206 
207 CLASS_DEF( TrigConfChain , 158937726 , 1 )
208 
209 #endif
TrigConfChain::m_lower_counter
uint16_t m_lower_counter
Definition: TrigConfChain.h:119
TrigConfChain::m_level
uint8_t m_level
Definition: TrigConfChain.h:120
TrigConfChain::getGroup
const std::vector< std::string > & getGroup() const
Definition: TrigConfChain.h:95
TrigConfSig.h
TrigConfChain::addSignature
void addSignature(const TrigConfSig &obj)
Definition: TrigConfChain.h:58
TrigConfChain::m_lower_id
uint32_t m_lower_id
Definition: TrigConfChain.h:117
xAOD::uint8_t
uint8_t
Definition: Muon_v1.cxx:557
TrigConfChain::getEncodedId
uint16_t getEncodedId() const
Definition: TrigConfChain.cxx:151
Trig
The common trigger namespace for trigger analysis tools.
Definition: LArCellMonAlg.h:33
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
TrigConfChain::getLowerEncodedId
uint16_t getLowerEncodedId() const
Definition: TrigConfChain.cxx:164
TrigConfChain::getPassThrough
float getPassThrough() const
Definition: TrigConfChain.h:89
TrigConfChain::clearStrings
void clearStrings()
Definition: TrigConfChain.cxx:135
TrigConfChain::getName
const std::string & getName() const
Definition: TrigConfChain.h:72
TrigConfChain::m_ebhypo_names
std::vector< std::string > m_ebhypo_names
Definition: TrigConfChain.h:129
operator==
bool operator==(const TrigConfChain &lhs, const TrigConfChain &rhs)
Definition: TrigConfChain.h:169
TrigConfChain::getLevel
const std::string getLevel() const
Definition: TrigConfChain.cxx:177
Trig::Bits::shiftCounter
const uint16_t shiftCounter
Definition: TrigConfChain.h:152
TrigConfChain::m_pass_through
float m_pass_through
Definition: TrigConfChain.h:122
TrigConfChain::addGroup
void addGroup(const std::string &name)
Definition: TrigConfChain.h:59
TrigConfChain::getChainName
const std::string & getChainName() const
Definition: TrigConfChain.h:73
TrigConfChain::matchOutputTE
bool matchOutputTE(uint32_t te_id) const
Definition: TrigConfChain.cxx:207
TrigConfChain::getPS
float getPS() const
Definition: TrigConfChain.h:88
FPGATrackSimInputUtils::Bits
Bits
Definition: FPGATrackSimInputUtils.h:15
python.iconfTool.models.loaders.level
level
Definition: loaders.py:20
TrigConfChain::getSignature
const std::vector< TrigConfSig > & getSignature() const
Definition: TrigConfChain.h:93
TrigConfChain::m_chain_name
std::string m_chain_name
Definition: TrigConfChain.h:114
TrigConfChain::addEBHypo
void addEBHypo(const std::string &name)
Definition: TrigConfChain.h:61
TrigConfChain::getGroup
std::vector< std::string > & getGroup()
Definition: TrigConfChain.h:101
TrigConfChain::m_chain_id
uint32_t m_chain_id
Definition: TrigConfChain.h:116
TrigConfChain::addLowerChainId
void addLowerChainId(uint32_t lower_id)
Definition: TrigConfChain.h:67
TrigConfChain::m_chain_counter
uint16_t m_chain_counter
Definition: TrigConfChain.h:118
Trig::Bits::maskCounter
const uint16_t maskCounter
Definition: TrigConfChain.h:149
TrigConfChain::clearGroup
void clearGroup()
Definition: TrigConfChain.h:63
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:93
TrigConfChain
Definition: TrigConfChain.h:32
TrigConfChain::setPassThrough
void setPassThrough(float val)
Definition: TrigConfChain.h:70
TrigConfChain::clearEBHypo
void clearEBHypo()
Definition: TrigConfChain.h:65
Trig::getCounterFromEncodedId
uint16_t getCounterFromEncodedId(uint16_t encoded)
Definition: TrigConfChain.h:158
TrigConfChain::m_stream_prescale
std::vector< float > m_stream_prescale
Definition: TrigConfChain.h:125
TrigConfChain::getPT
float getPT() const
Definition: TrigConfChain.h:90
TrigConfChain::m_group
std::vector< std::string > m_group
Definition: TrigConfChain.h:128
TrigConfSig
Definition: TrigConfSig.h:27
operator<
bool operator<(const TrigConfChain &lhs, const TrigConfChain &rhs)
Definition: TrigConfChain.h:172
ReadFromCoolCompare.os
os
Definition: ReadFromCoolCompare.py:231
TrigConfChain::m_lower_name
std::string m_lower_name
Definition: TrigConfChain.h:115
TrigConfChain::print
void print(std::ostream &os=std::cout) const
Definition: TrigConfChain.cxx:223
TrigConfChain::m_stream_name
std::vector< std::string > m_stream_name
Definition: TrigConfChain.h:127
TrigConfChain::getPrescale
float getPrescale() const
Definition: TrigConfChain.h:87
TrigConfChain::getCounter
uint16_t getCounter() const
Definition: TrigConfChain.h:77
Trig::Bits::maskLevel
const uint16_t maskLevel
Definition: TrigConfChain.h:148
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:227
TrigConfChain::m_prescale
float m_prescale
Definition: TrigConfChain.h:121
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
TrigConfChain::m_signature
std::vector< TrigConfSig > m_signature
Definition: TrigConfChain.h:126
str
std::string str(const TrigConfChain &)
Definition: TrigConfChain.cxx:229
Trig::Bits::shiftLevel
const uint16_t shiftLevel
Definition: TrigConfChain.h:151
TrigConfChain::addStream
void addStream(const std::string &name, float prescale)
Definition: TrigConfChain.cxx:125
TrigConfChain::getStream
const std::vector< std::string > & getStream() const
Definition: TrigConfChain.h:94
TrigConfChain::m_lower_ids
std::vector< uint32_t > m_lower_ids
Definition: TrigConfChain.h:124
TrigConfChain::getLowerName
const std::string & getLowerName() const
Definition: TrigConfChain.h:74
TrigConfChain::~TrigConfChain
~TrigConfChain()
Definition: TrigConfChain.h:54
TrigConfChain::getId
uint32_t getId() const
Definition: TrigConfChain.h:76
TrigConfChain::setPrescale
void setPrescale(float val)
Definition: TrigConfChain.h:69
Trig::getLevelFromEncodedId
uint16_t getLevelFromEncodedId(uint16_t encoded)
Definition: TrigConfChain.h:161
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14
CLASS_DEF
#define CLASS_DEF(NAME, CID, VERSION)
associate a clid and a version to a type eg
Definition: Control/AthenaKernel/AthenaKernel/CLASS_DEF.h:64
TrigConfChain::clearStream
void clearStream()
Definition: TrigConfChain.h:64
TrigConfChain::getStreamPS
std::vector< float > & getStreamPS()
Definition: TrigConfChain.h:99
TrigConfChain::getStreamPS
const std::vector< float > & getStreamPS() const
Definition: TrigConfChain.h:92
TrigConfChain::getSignaturePrescale
float getSignaturePrescale(const std::string &name) const
Definition: TrigConfChain.cxx:189
TrigConfChain::getLowerIds
const std::vector< uint32_t > & getLowerIds() const
Definition: TrigConfChain.h:104
TrigConfChain::getEBHypo
std::vector< std::string > & getEBHypo()
Definition: TrigConfChain.h:102
test_pyathena.counter
counter
Definition: test_pyathena.py:15
python.PyAthena.obj
obj
Definition: PyAthena.py:132
Trig::getEncodedId
uint16_t getEncodedId(int level, int counter)
Definition: TrigConfChain.cxx:15
TrigConfChain::getEBHypo
const std::vector< std::string > & getEBHypo() const
Definition: TrigConfChain.h:96
CLASS_DEF.h
macros to associate a CLID to a type
TrigConfChain::getLowerCounter
uint16_t getLowerCounter() const
Definition: TrigConfChain.h:80
TrigConfChain::getStream
std::vector< std::string > & getStream()
Definition: TrigConfChain.h:100
TrigConfChain::getLowerId
uint32_t getLowerId() const
Definition: TrigConfChain.h:81
TrigConfChain::TrigConfChain
TrigConfChain()
Definition: TrigConfChain.cxx:46
TrigConfChain::getLevelId
unsigned int getLevelId() const
Definition: TrigConfChain.h:84