ATLAS Offline Software
Loading...
Searching...
No Matches
TCS::GlobalOutput Class Reference

#include <GlobalOutput.h>

Inheritance diagram for TCS::GlobalOutput:
Collaboration diagram for TCS::GlobalOutput:

Public Member Functions

 GlobalOutput (const std::string &name="L1TopoGlobalOutput")
uint64_t decision_field (const std::string &l1connName) const
uint32_t decision_field (const std::string &l1connName, unsigned int clock) const
bool passed (const std::string &connName, unsigned int bit) const
uint64_t overflow_field (const std::string &l1connName) const
uint32_t overflow_field (const std::string &l1connName, unsigned int clock) const
bool overflowed (const std::string &l1connName, unsigned int bit) const
uint64_t ambiguity_field (const std::string &l1connName) const
uint32_t ambiguity_field (const std::string &l1connName, unsigned int clock) const
std::bitset< 128 > count_field (const std::string &l1connName) const
const Decisiondecision (const std::string &algName) const
bool isValid () const
void setDecisionTriggerLines (const std::vector< TrigConf::TriggerLine > &triggers)
void setMultiplicityTriggerLines (const std::vector< TrigConf::TriggerLine > &triggers)
StatusCode collectOutput (const std::set< DecisionConnector * > &outConn, const std::set< CountingConnector * > &countConn)
StatusCode resetOutput ()
void print () const
bool msgLvl (const MSGTC::Level lvl) const
 Test the output level.
MsgStreamTC & msg () const
 The standard message stream.
MsgStreamTC & msg (const MSGTC::Level lvl) const
 The standard message stream.
const std::string & getName () const
 name accessor

Private Attributes

std::map< std::string, uint64_t > m_decision
std::map< std::string, uint64_t > m_overflow
std::map< std::string, uint64_t > m_ambiguity
std::map< std::string, std::bitset< 128 > > m_count
bool m_valid {false}
std::vector< TrigConf::TriggerLinem_triggersDec
std::vector< TrigConf::TriggerLinem_triggersCount
boost::thread_specific_ptr< MsgStreamTC > m_msg_tls
 MsgStreamTC instance (a std::cout like with print-out levels)
std::string m_name

Friends

std::ostream & operator<< (std::ostream &o, const TCS::GlobalOutput &dec)

Detailed Description

Definition at line 37 of file GlobalOutput.h.

Constructor & Destructor Documentation

◆ GlobalOutput()

GlobalOutput::GlobalOutput ( const std::string & name = "L1TopoGlobalOutput")

Definition at line 137 of file GlobalOutput.cxx.

137 :
139{}

Member Function Documentation

◆ ambiguity_field() [1/2]

uint64_t GlobalOutput::ambiguity_field ( const std::string & l1connName) const

Definition at line 111 of file GlobalOutput.cxx.

111 {
112 if (m_ambiguity.find(l1connName) != m_ambiguity.end()) {
113 return m_ambiguity.find(l1connName)->second;
114 }else{
115 TRG_MSG_WARNING("Connector name " << l1connName << " unknown");
116 return 0;
117 }
118}
std::map< std::string, uint64_t > m_ambiguity

◆ ambiguity_field() [2/2]

uint32_t GlobalOutput::ambiguity_field ( const std::string & l1connName,
unsigned int clock ) const

Definition at line 121 of file GlobalOutput.cxx.

121 {
122 if (m_ambiguity.find(l1connName) != m_ambiguity.end()) {
123 if(clock==0) {
124 // lower 32 bit
125 return static_cast<uint32_t>(m_ambiguity.find(l1connName)->second & 0xffffffff);
126 } else {
127 // upper 32 bit
128 uint64_t clock1 = m_ambiguity.find(l1connName)->second & 0xffffffff00000000;
129 return static_cast<uint32_t>(clock1 >> 32);
130 }
131 }else{
132 TRG_MSG_WARNING("Connector name " << l1connName << " unknown");
133 return 0;
134 }
135}
setEventNumber uint32_t

◆ collectOutput()

TCS::StatusCode GlobalOutput::collectOutput ( const std::set< DecisionConnector * > & outConn,
const std::set< CountingConnector * > & countConn )

Definition at line 150 of file GlobalOutput.cxx.

150 {
151 resetOutput();
152
153 for( const DecisionConnector * conn : outConn ) {
154
155 const Decision& dec = conn->decision();
156
157 unsigned int pos = 0; // for multi-output algorithms pos is the output index
158 for(const TrigConf::TriggerLine & trigger : conn->triggers() ) {
159 unsigned int position = trigger.flatindex();
160
161 uint64_t & l1connectorDec = m_decision[trigger.connName()];
162 uint64_t & l1connectorOvf = m_overflow[trigger.connName()];
163 uint64_t & l1connectorAmb = m_ambiguity[trigger.connName()];
164 uint64_t mask(0x1);
165
166 if( dec.bit(pos++) ) // bit set?
167 l1connectorDec |= (mask << position);
168 if( dec.overflow())
169 l1connectorOvf |= (mask << position);
170 if( dec.ambiguity())
171 l1connectorAmb |= (mask << position);
172 }
173
174 }
175
176 for (const CountingConnector * conn : countConn) {
177
178 const Count& count = conn->count();
179
180 const TrigConf::TriggerLine & trigger = conn->triggers().at(0); // counting connectors only have one trigger line
181
182 std::bitset<128> & l1connectorCount = m_count[trigger.connName()];
183
184 l1connectorCount |= count.getCountBits();
185
186 }
187
188 m_valid = true;
190}
bool ambiguity() const
Definition Decision.h:46
bool overflow() const
Definition Decision.h:45
bool bit(unsigned int index) const
Definition Decision.h:40
StatusCode resetOutput()
std::map< std::string, uint64_t > m_overflow
std::map< std::string, std::bitset< 128 > > m_count
std::map< std::string, uint64_t > m_decision
const std::string & connName() const
Definition L1Connector.h:33
int count(std::string s, const std::string &regx)
count how many occurances of a regx are in a string
Definition hcg.cxx:146

◆ count_field()

std::bitset< 128 > GlobalOutput::count_field ( const std::string & l1connName) const

Definition at line 74 of file GlobalOutput.cxx.

74 {
75 if (m_count.find(l1connName) != m_count.end()) {
76 return m_count.find(l1connName)->second;
77 }else{
78 TRG_MSG_WARNING("Connector name " << l1connName << " unknown");
79 return 0;
80 }
81}

◆ decision()

const Decision & TCS::GlobalOutput::decision ( const std::string & algName) const

◆ decision_field() [1/2]

uint64_t GlobalOutput::decision_field ( const std::string & l1connName) const

Definition at line 47 of file GlobalOutput.cxx.

47 {
48 if (m_decision.find(l1connName) != m_decision.end()) {
49 return m_decision.find(l1connName)->second;
50 }else{
51 TRG_MSG_WARNING("Connector name " << l1connName << " unknown");
52 return 0;
53 }
54}

◆ decision_field() [2/2]

uint32_t GlobalOutput::decision_field ( const std::string & l1connName,
unsigned int clock ) const

Definition at line 57 of file GlobalOutput.cxx.

57 {
58 if (m_decision.find(l1connName) != m_decision.end()) {
59 if(clock==0) {
60 // lower 32 bit
61 return static_cast<uint32_t>(m_decision.at(l1connName) & 0xffffffff);
62 } else {
63 // upper 32 bit
64 uint64_t clock1 = m_decision.at(l1connName) & 0xffffffff00000000;
65 return static_cast<uint32_t>(clock1 >> 32);
66 }
67 }else{
68 TRG_MSG_WARNING("Connector name " << l1connName << " unknown");
69 return 0;
70 }
71}

◆ getName()

const std::string & TrigConf::TrigConfMessaging::getName ( ) const
inlineinherited

name accessor

Returns
the name

Definition at line 101 of file TrigConfMessaging.h.

101 {
102 return m_name;
103 }

◆ isValid()

bool TCS::GlobalOutput::isValid ( ) const
inline

Definition at line 57 of file GlobalOutput.h.

57{ return m_valid; }

◆ msg() [1/2]

MsgStreamTC & TrigConf::TrigConfMessaging::msg ( ) const
inlineinherited

The standard message stream.

Returns a reference to the message stream May not be invoked before sysInitialize() has been invoked.

Definition at line 86 of file TrigConfMessaging.h.

87 {
88 MsgStreamTC* ms = m_msg_tls.get();
89 if (!ms) {
90 ms = new MsgStreamTC(m_name);
91 m_msg_tls.reset(ms);
92 }
93 return *ms;
94 }
boost::thread_specific_ptr< MsgStreamTC > m_msg_tls
MsgStreamTC instance (a std::cout like with print-out levels)

◆ msg() [2/2]

MsgStreamTC & TrigConf::TrigConfMessaging::msg ( const MSGTC::Level lvl) const
inlineinherited

The standard message stream.

Returns a reference to the default message stream May not be invoked before sysInitialize() has been invoked.

Definition at line 96 of file TrigConfMessaging.h.

97 {
98 return msg() << lvl;
99 }
MsgStreamTC & msg() const
The standard message stream.

◆ msgLvl()

bool TrigConf::TrigConfMessaging::msgLvl ( const MSGTC::Level lvl) const
inlineinherited

Test the output level.

Parameters
lvlThe message level to test against
Returns
boolean Indicting if messages at given level will be printed
Return values
trueMessages at level "lvl" will be printed

Definition at line 75 of file TrigConfMessaging.h.

76 {
77 if (msg().level() <= lvl) {
78 msg() << lvl;
79 return true;
80 }
81 else {
82 return false;
83 }
84 }

◆ overflow_field() [1/2]

uint64_t GlobalOutput::overflow_field ( const std::string & l1connName) const

Definition at line 84 of file GlobalOutput.cxx.

84 {
85 if (m_overflow.find(l1connName) != m_overflow.end()) {
86 return m_overflow.find(l1connName)->second;
87 }else{
88 TRG_MSG_WARNING("Connector name " << l1connName << " unknown");
89 return 0;
90 }
91}

◆ overflow_field() [2/2]

uint32_t GlobalOutput::overflow_field ( const std::string & l1connName,
unsigned int clock ) const

Definition at line 94 of file GlobalOutput.cxx.

94 {
95 if (m_overflow.find(l1connName) != m_overflow.end()) {
96 if(clock==0) {
97 // lower 32 bit
98 return static_cast<uint32_t>(m_overflow.find(l1connName)->second & 0xffffffff);
99 } else {
100 // upper 32 bit
101 uint64_t clock1 = m_overflow.find(l1connName)->second & 0xffffffff00000000;
102 return static_cast<uint32_t>(clock1 >> 32);
103 }
104 }else{
105 TRG_MSG_WARNING("Connector name " << l1connName << " unknown");
106 return 0;
107 }
108}

◆ overflowed()

bool TCS::GlobalOutput::overflowed ( const std::string & l1connName,
unsigned int bit ) const
inline

Definition at line 48 of file GlobalOutput.h.

48{ return ( ( (uint64_t)0x1 << bit) & m_overflow.find(l1connName)->second) != 0; }

◆ passed()

bool TCS::GlobalOutput::passed ( const std::string & connName,
unsigned int bit ) const
inline

Definition at line 45 of file GlobalOutput.h.

45{ return ( ( (uint64_t)0x1 << bit) & m_decision.find(connName)->second) != 0; }

◆ print()

void TCS::GlobalOutput::print ( ) const

Definition at line 229 of file GlobalOutput.cxx.

229 {
230
231 if(!isValid())
232 TRG_MSG_INFO("Note that the overall decision has not been calculated");
233
234 for(auto const& dec : m_decision)
235 TRG_MSG_INFO("Overall decision from connector " << dec.first << ": 0x" << right << hex << setfill('0') << setw(16) << decision_field(dec.first) << std::dec << setfill(' '));
236
237 if(isValid()) {
238 for(const TrigConf::TriggerLine & trigger : m_triggersDec){
239 unsigned int position = trigger.flatindex();
240 TRG_MSG_INFO(" " << setw(30) << left << trigger.name() << " " << (passed(trigger.connName(), position) ? "pass" : "fail") );}
241 } else {
242 for(const TrigConf::TriggerLine & trigger : m_triggersDec)
243 TRG_MSG_INFO(" " << setw(30) << left << trigger.name() << " unset" );
244 }
245}
bool isValid() const
uint64_t decision_field(const std::string &l1connName) const
std::vector< TrigConf::TriggerLine > m_triggersDec
bool passed(const std::string &connName, unsigned int bit) const

◆ resetOutput()

TCS::StatusCode GlobalOutput::resetOutput ( )

Definition at line 194 of file GlobalOutput.cxx.

194 {
195 m_decision.clear();
196 m_overflow.clear();
197 m_ambiguity.clear();
198 m_count.clear();
199
200 m_valid = false;
202}

◆ setDecisionTriggerLines()

void GlobalOutput::setDecisionTriggerLines ( const std::vector< TrigConf::TriggerLine > & triggers)

Definition at line 19 of file GlobalOutput.cxx.

19 {
20
21 m_triggersDec = triggers;
22 vector<string> l1connNames = {};
23 for (const TrigConf::TriggerLine & trigger : triggers){
24 auto it = find(l1connNames.begin(), l1connNames.end(), trigger.connName());
25 if (it == l1connNames.end()){
26 l1connNames.push_back(trigger.connName());
27 m_decision[trigger.connName()] = 0;
28 }
29 }
30}
std::string find(const std::string &s)
return a remapped string
Definition hcg.cxx:138

◆ setMultiplicityTriggerLines()

void GlobalOutput::setMultiplicityTriggerLines ( const std::vector< TrigConf::TriggerLine > & triggers)

Definition at line 33 of file GlobalOutput.cxx.

33 {
34
35 m_triggersCount = triggers;
36 vector<string> l1connNames = {};
37 for (const TrigConf::TriggerLine & trigger : triggers){
38 auto it = find(l1connNames.begin(), l1connNames.end(), trigger.connName());
39 if (it == l1connNames.end()){
40 l1connNames.push_back(trigger.connName());
41 m_count[trigger.connName()] = 0;
42 }
43 }
44}
std::vector< TrigConf::TriggerLine > m_triggersCount

◆ operator<<

std::ostream & operator<< ( std::ostream & o,
const TCS::GlobalOutput & dec )
friend

Definition at line 208 of file GlobalOutput.cxx.

209 {
210
211 if(!dec.isValid())
212 o << "Note that the overall decision has not been calculated" << endl;
213
214 for(auto const& itdec : dec.m_decision)
215 o << "Overall decision for connector " << itdec.first << ": 0x" << right << hex << setfill('0') << setw(16) << dec.decision_field(itdec.first) << std::dec << setfill(' ') << endl;
216
217 if(dec.isValid()) {
218 for(const TrigConf::TriggerLine & trigger : dec.m_triggersDec){
219 unsigned int position = trigger.flatindex();
220 o << " " << setw(30) << left << trigger.name() << " " << (dec.passed(trigger.connName(), position) ? "pass" : "fail") << endl;}
221 } else {
222 for(const TrigConf::TriggerLine & trigger : dec.m_triggersDec)
223 o << " " << setw(30) << left << trigger.name() << " unset" << endl;
224 }
225 return o;
226}
unsigned int flatindex() const
Definition L1Connector.h:28
const std::string & name() const
Definition L1Connector.h:26

Member Data Documentation

◆ m_ambiguity

std::map<std::string,uint64_t> TCS::GlobalOutput::m_ambiguity
private

Definition at line 76 of file GlobalOutput.h.

◆ m_count

std::map<std::string,std::bitset<128> > TCS::GlobalOutput::m_count
private

Definition at line 79 of file GlobalOutput.h.

◆ m_decision

std::map<std::string,uint64_t> TCS::GlobalOutput::m_decision
private

Definition at line 72 of file GlobalOutput.h.

◆ m_msg_tls

boost::thread_specific_ptr<MsgStreamTC> TrigConf::TrigConfMessaging::m_msg_tls
mutableprivateinherited

MsgStreamTC instance (a std::cout like with print-out levels)

Definition at line 71 of file TrigConfMessaging.h.

◆ m_name

std::string TrigConf::TrigConfMessaging::m_name
privateinherited

Definition at line 72 of file TrigConfMessaging.h.

◆ m_overflow

std::map<std::string,uint64_t> TCS::GlobalOutput::m_overflow
private

Definition at line 74 of file GlobalOutput.h.

◆ m_triggersCount

std::vector<TrigConf::TriggerLine> TCS::GlobalOutput::m_triggersCount
private

Definition at line 86 of file GlobalOutput.h.

◆ m_triggersDec

std::vector<TrigConf::TriggerLine> TCS::GlobalOutput::m_triggersDec
private

Definition at line 85 of file GlobalOutput.h.

◆ m_valid

bool TCS::GlobalOutput::m_valid {false}
private

Definition at line 82 of file GlobalOutput.h.

82{false};

The documentation for this class was generated from the following files: