test
CMS 3D CMS Logo

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