File indexing completed on 2024-04-06 12:04:32
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #include "DataFormats/L1TGlobal/interface/GlobalExtBlk.h"
0017
0018
0019
0020
0021
0022 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0023 #include "FWCore/MessageLogger/interface/MessageDrop.h"
0024
0025
0026
0027
0028 GlobalExtBlk::GlobalExtBlk() {
0029
0030 m_extDecision.reserve(maxExternalConditions);
0031 m_extDecision.assign(maxExternalConditions, false);
0032 }
0033
0034
0035 GlobalExtBlk::~GlobalExtBlk() {
0036
0037 }
0038
0039
0040 void GlobalExtBlk::setExternalDecision(unsigned int bit, bool val) {
0041 if (bit < m_extDecision.size()) {
0042 m_extDecision.at(bit) = val;
0043
0044 } else {
0045
0046 LogTrace("L1TGlobal") << "Attempting to set a external bit " << bit << " beyond limit " << m_extDecision.size();
0047 }
0048 }
0049
0050
0051 bool GlobalExtBlk::getExternalDecision(unsigned int bit) const {
0052 if (bit >= m_extDecision.size())
0053 return false;
0054 return m_extDecision.at(bit);
0055 }
0056
0057
0058 void GlobalExtBlk::reset() {
0059
0060
0061 m_extDecision.assign(maxExternalConditions, false);
0062 }
0063
0064
0065 void GlobalExtBlk::print(std::ostream& myCout) const {
0066 myCout << " GlobalExtBlk " << std::endl;
0067
0068
0069 int lengthWd = m_extDecision.size();
0070 myCout << " External Conditions 0x" << std::hex;
0071 int digit = 0;
0072 bool firstNonZero = false;
0073 for (int i = lengthWd - 1; i > -1; i--) {
0074 if (m_extDecision.at(i))
0075 digit |= (1 << (i % 4));
0076 if (digit > 0)
0077 firstNonZero = true;
0078 if ((i % 4) == 0 && firstNonZero) {
0079 myCout << std::hex << std::setw(1) << digit;
0080 digit = 0;
0081 if (i % 32 == 0 && i < lengthWd - 1)
0082 myCout << " ";
0083 }
0084 }
0085 if (!firstNonZero)
0086 myCout << "0";
0087 myCout << std::endl;
0088 }