CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
GlobalExtBlk.cc
Go to the documentation of this file.
1 
15 // this class header
17 
18 // system include files
19 
20 // user include files
21 
24 
25 // constructors
26 
27 // empty constructor, all members set to zero;
29  // Reserve/Clear out the decision words
31  m_extDecision.assign(maxExternalConditions, false);
32 }
33 
34 // destructor
36  // empty now
37 }
38 
40 void GlobalExtBlk::setExternalDecision(unsigned int bit, bool val) {
41  if (bit < m_extDecision.size()) {
42  m_extDecision.at(bit) = val;
43 
44  } else {
45  // Need some erorr checking here.
46  LogTrace("L1TGlobal") << "Attempting to set a external bit " << bit << " beyond limit " << m_extDecision.size();
47  }
48 }
49 
51 bool GlobalExtBlk::getExternalDecision(unsigned int bit) const {
52  if (bit >= m_extDecision.size())
53  return false;
54  return m_extDecision.at(bit);
55 }
56 
57 // reset the content of a GlobalExtBlk
59  // Clear out the decision words
60  // but leave the vector intact
61  m_extDecision.assign(maxExternalConditions, false);
62 }
63 
64 // pretty print the content of a GlobalExtBlk
65 void GlobalExtBlk::print(std::ostream& myCout) const {
66  myCout << " GlobalExtBlk " << std::endl;
67 
68  // Loop through bits to create a hex word of algorithm bits.
69  int lengthWd = m_extDecision.size();
70  myCout << " External Conditions 0x" << std::hex;
71  int digit = 0;
72  bool firstNonZero = false;
73  for (int i = lengthWd - 1; i > -1; i--) {
74  if (m_extDecision.at(i))
75  digit |= (1 << (i % 4));
76  if (digit > 0)
77  firstNonZero = true;
78  if ((i % 4) == 0 && firstNonZero) {
79  myCout << std::hex << std::setw(1) << digit;
80  digit = 0;
81  if (i % 32 == 0 && i < lengthWd - 1)
82  myCout << " ";
83  }
84  } //end loop over algorithm bits
85  if (!firstNonZero)
86  myCout << "0";
87  myCout << std::endl;
88 }
void print(std::ostream &myCout) const
pretty print the content of a GlobalExtBlk
Definition: GlobalExtBlk.cc:65
void reset()
reset the content of a GlobalExtBlk
Definition: GlobalExtBlk.cc:58
static const unsigned int maxExternalConditions
Definition: GlobalExtBlk.h:43
#define LogTrace(id)
virtual ~GlobalExtBlk()
destructor
Definition: GlobalExtBlk.cc:35
void setExternalDecision(unsigned int bit, bool val)
Set decision bits.
Definition: GlobalExtBlk.cc:40
bool getExternalDecision(unsigned int bit) const
Get decision bits.
Definition: GlobalExtBlk.cc:51
GlobalExtBlk()
constructors
Definition: GlobalExtBlk.cc:28
std::vector< bool > m_extDecision
Definition: GlobalExtBlk.h:58