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

#include <GlobalDecision.h>

Inheritance diagram for TCS::GlobalDecision:
Collaboration diagram for TCS::GlobalDecision:

Public Member Functions

 GlobalDecision (const std::string &name="L1TopoGlobalDecision")
uint64_t decision_field (const std::string &connName) const
uint32_t decision_field (const std::string &connName, unsigned int clock) const
bool passed (const std::string &connName, unsigned int bit) const
uint64_t overflow_field (const std::string &connName) const
uint32_t overflow_field (const std::string &connName, unsigned int clock) const
bool overflowed (const std::string &connName, unsigned int bit) const
const Decisiondecision (const std::string &algName) const
bool isValid () const
void setTriggerLines (const std::vector< TrigConf::TriggerLine > &triggers)
StatusCode collectDecision (const std::set< DecisionConnector * > &outconn)
StatusCode resetDecision ()
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
bool m_valid {false}
std::vector< TrigConf::TriggerLinem_triggers
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::GlobalDecision &dec)

Detailed Description

Definition at line 34 of file GlobalDecision.h.

Constructor & Destructor Documentation

◆ GlobalDecision()

GlobalDecision::GlobalDecision ( const std::string & name = "L1TopoGlobalDecision")

Definition at line 78 of file GlobalDecision.cxx.

78 :
80{}

Member Function Documentation

◆ collectDecision()

TCS::StatusCode GlobalDecision::collectDecision ( const std::set< DecisionConnector * > & outconn)

Definition at line 91 of file GlobalDecision.cxx.

91 {
93
94 for( const DecisionConnector * conn : outconn ) {
95
96 const Decision& dec = conn->decision();
97
98 unsigned int pos = 0; // for multi-output algorithms pos is the output index
99 for(const TrigConf::TriggerLine & trigger : conn->triggers() ) {
100 unsigned int position = trigger.flatindex();
101
102 uint64_t & connectorDec = m_decision[trigger.connName()];
103 uint64_t & connectorOvf = m_overflow[trigger.connName()];
104 uint64_t mask(0x1);
105
106 if( dec.bit(pos++) ) // bit set?
107 connectorDec |= (mask << position);
108 if( dec.overflow())
109 connectorOvf |= (mask << position);
110 }
111
112 }
113 m_valid = true;
115}
bool overflow() const
Definition Decision.h:45
bool bit(unsigned int index) const
Definition Decision.h:40
std::map< std::string, uint64_t > m_decision
std::map< std::string, uint64_t > m_overflow

◆ decision()

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

◆ decision_field() [1/2]

uint64_t TCS::GlobalDecision::decision_field ( const std::string & connName) const
inline

Definition at line 38 of file GlobalDecision.h.

38{ return m_decision.find(connName)->second; }

◆ decision_field() [2/2]

uint32_t GlobalDecision::decision_field ( const std::string & connName,
unsigned int clock ) const

Definition at line 48 of file GlobalDecision.cxx.

48 {
49 try {
50 if(clock==0) {
51 // lower 32 bit
52 return (uint32_t) (m_decision.at(connName) & 0xffffffff);
53 } else {
54 // upper 32 bit
55 uint64_t clock1 = m_decision.at(connName) & 0xffffffff00000000;
56 return (uint32_t) (clock1 >> 32);
57 }
58 }
59 catch(std::exception &) {
60 TRG_MSG_ERROR("Connector name " << connName << " unknown");
61 throw;
62 }
63}

◆ 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::GlobalDecision::isValid ( ) const
inline

Definition at line 49 of file GlobalDecision.h.

49{ 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 TCS::GlobalDecision::overflow_field ( const std::string & connName) const
inline

Definition at line 43 of file GlobalDecision.h.

43{ return m_overflow.find(connName)->second; }

◆ overflow_field() [2/2]

uint32_t GlobalDecision::overflow_field ( const std::string & connName,
unsigned int clock ) const

Definition at line 66 of file GlobalDecision.cxx.

66 {
67 if(clock==0) {
68 // lower 32 bit
69 return (uint32_t) (m_overflow.find(connName)->second & 0xffffffff);
70 } else {
71 // upper 32 bit
72 uint64_t clock1 = m_overflow.find(connName)->second & 0xffffffff00000000;
73 return (uint32_t) (clock1 >> 32);
74 }
75}

◆ overflowed()

bool TCS::GlobalDecision::overflowed ( const std::string & connName,
unsigned int bit ) const
inline

Definition at line 45 of file GlobalDecision.h.

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

◆ passed()

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

Definition at line 42 of file GlobalDecision.h.

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

◆ print()

void TCS::GlobalDecision::print ( ) const

Definition at line 153 of file GlobalDecision.cxx.

153 {
154
155 if(!isValid())
156 TRG_MSG_INFO("Note that the overall decision has not been calculated");
157
158 for(auto const& dec : m_decision)
159 TRG_MSG_INFO("Overall decision from connector " << dec.first << ": 0x" << right << hex << setfill('0') << setw(16) << decision_field(dec.first) << std::dec << setfill(' '));
160
161 if(isValid()) {
162 for(const TrigConf::TriggerLine & trigger : m_triggers){
163 unsigned int position = trigger.flatindex();
164 TRG_MSG_INFO(" " << setw(30) << left << trigger.name() << " " << (passed(trigger.connName(), position) ? "pass" : "fail") );}
165 } else {
166 for(const TrigConf::TriggerLine & trigger : m_triggers)
167 TRG_MSG_INFO(" " << setw(30) << left << trigger.name() << " unset" );
168 }
169}
std::vector< TrigConf::TriggerLine > m_triggers
bool passed(const std::string &connName, unsigned int bit) const
uint64_t decision_field(const std::string &connName) const

◆ resetDecision()

TCS::StatusCode GlobalDecision::resetDecision ( )

Definition at line 119 of file GlobalDecision.cxx.

119 {
120 for(auto const& dec : m_decision)
121 m_decision[dec.first] = 0;
122 for(auto const& ovf : m_overflow)
123 m_overflow[ovf.first] = 0;
124 m_valid = false;
126}

◆ setTriggerLines()

void GlobalDecision::setTriggerLines ( const std::vector< TrigConf::TriggerLine > & triggers)

Definition at line 34 of file GlobalDecision.cxx.

34 {
35
36 m_triggers = triggers;
37 vector<string> connNames = {};
38 for (const TrigConf::TriggerLine & trigger : triggers){
39 auto it = find(connNames.begin(), connNames.end(), trigger.connName());
40 if (it == connNames.end()){
41 connNames.push_back(trigger.connName());
42 m_decision[trigger.connName()] = 0;
43 }
44 }
45}
std::string find(const std::string &s)
return a remapped string
Definition hcg.cxx:138

◆ operator<<

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

Definition at line 132 of file GlobalDecision.cxx.

133 {
134 ios_state_guard guard{o};
135 if(!dec.isValid())
136 o << "Note that the overall decision has not been calculated" << endl;
137
138 for(auto const& itdec : dec.m_decision)
139 o << "Overall decision for connector " << itdec.first << ": 0x" << right << hex << setfill('0') << setw(16) << dec.decision_field(itdec.first) << std::dec << setfill(' ') << endl;
140
141 if(dec.isValid()) {
142 for(const TrigConf::TriggerLine & trigger : dec.m_triggers){
143 unsigned int position = trigger.flatindex();
144 o << " " << setw(30) << left << trigger.name() << " " << (dec.passed(trigger.connName(), position) ? "pass" : "fail") << endl;}
145 } else {
146 for(const TrigConf::TriggerLine & trigger : dec.m_triggers)
147 o << " " << setw(30) << left << trigger.name() << " unset" << endl;
148 }
149 return o;
150}
unsigned int flatindex() const
Definition L1Connector.h:29
const std::string & connName() const
Definition L1Connector.h:34
const std::string & name() const
Definition L1Connector.h:27

Member Data Documentation

◆ m_decision

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

Definition at line 62 of file GlobalDecision.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::GlobalDecision::m_overflow
private

Definition at line 64 of file GlobalDecision.h.

◆ m_triggers

std::vector<TrigConf::TriggerLine> TCS::GlobalDecision::m_triggers
private

Definition at line 70 of file GlobalDecision.h.

◆ m_valid

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

Definition at line 67 of file GlobalDecision.h.

67{false};

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