CMS 3D CMS Logo

GlobalAlgBlk.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 // empty constructor, all members set to zero;
31 GlobalAlgBlk::GlobalAlgBlk(int orbitNr, int bxNr, int bxInEvent):
32  m_orbitNr(orbitNr), m_bxNr(bxNr), m_bxInEvent(bxInEvent)
33 {
34 
35  //Clear out the header data
36  m_finalOR=false;
37  m_preScColumn=0;
38 
39  // Reserve/Clear out the decision words
42 
45 
48 
49 }
50 
51 // empty constructor, all members set to zero;
53 {
54 
55  //Clear out the header data
56  m_orbitNr=0;
57  m_bxNr=0;
58  m_bxInEvent=0;
59  m_finalOR=false;
60  m_finalORPreVeto = false;
61  m_finalORVeto = false;
62  m_preScColumn=0;
63 
64  // Reserve/Clear out the decision words
67 
70 
73 
74 }
75 
76 // destructor
78 {
79  // empty now
80 }
81 
83 void GlobalAlgBlk::setAlgoDecisionInitial(unsigned int bit, bool val)
84 {
85  if(bit < m_algoDecisionInitial.size()) {
86 
87  m_algoDecisionInitial.at(bit) = val;
88 
89  } else {
90  // Need some erorr checking here.
91  LogTrace("L1TGlobal") << "Attempting to set an algorithm bit " << bit << " beyond limit " << m_algoDecisionInitial.size();
92  }
93 
94 }
95 
96 void GlobalAlgBlk::setAlgoDecisionInterm(unsigned int bit, bool val)
97 {
98 
99  if(bit < m_algoDecisionPreScaled.size()) {
100 
101  m_algoDecisionPreScaled.at(bit) = val;
102  } else {
103  // Need some erorr checking here.
104  LogTrace("L1TGlobal") << "Attempting to set an algorithm bit " << bit << " beyond limit " << m_algoDecisionPreScaled.size();
105  }
106 
107 }
108 
109 void GlobalAlgBlk::setAlgoDecisionFinal(unsigned int bit, bool val)
110 {
111 
112  if(bit < m_algoDecisionFinal.size()) {
113  m_algoDecisionFinal.at(bit) = val;
114  } else {
115  // Need some erorr checking here.
116  LogTrace("L1TGlobal") << "Attempting to set an algorithm bit " << bit << " beyond limit " << m_algoDecisionFinal.size();
117  }
118 
119 }
120 
122 bool GlobalAlgBlk::getAlgoDecisionInitial(unsigned int bit) const
123 {
124  if(bit>=m_algoDecisionInitial.size()) return false;
125  return m_algoDecisionInitial.at(bit);
126 }
127 
128 bool GlobalAlgBlk::getAlgoDecisionInterm(unsigned int bit) const
129 {
130  if(bit>=m_algoDecisionPreScaled.size()) return false;
131  return m_algoDecisionPreScaled.at(bit);
132 }
133 
134 bool GlobalAlgBlk::getAlgoDecisionFinal(unsigned int bit) const
135 {
136  if(bit>=m_algoDecisionFinal.size()) return false;
137  return m_algoDecisionFinal.at(bit);
138 }
139 
140 // reset the content of a GlobalAlgBlk
142 {
143 
144  //Clear out the header data
145  m_orbitNr=0;
146  m_bxNr=0;
147  m_bxInEvent=0;
148  m_finalOR=false;
149  m_finalORPreVeto = false;
150  m_finalORVeto = false;
151  m_preScColumn=0;
152 
153  // Clear out the decision words
154  // but leave the vector intact
158 
159 }
160 
161 // compare the content of this GlobalAlgBlk with another one
163 {
164  return m_orbitNr == rhs.getL1MenuUUID()
165  && m_bxNr == rhs.getL1FirmwareUUID()
166  && m_bxInEvent == rhs.getbxInEventNr()
167  && m_finalOR == rhs.getFinalOR()
169  && m_finalORVeto == rhs.getFinalORVeto()
170  && m_preScColumn == rhs.getPreScColumn()
174 }
175 
176 // pretty print the content of a GlobalAlgBlk
177 void GlobalAlgBlk::print(std::ostream& myCout) const
178 {
179 
180  myCout << " uGtGlobalAlgBlk: " << std::endl;
181 
182  myCout << " L1 Menu Name (hash): 0x" << std::hex << m_orbitNr << std::endl;
183 
184  myCout << " L1 firmware (hash): 0x" << std::hex << m_bxNr << std::endl;
185 
186  myCout << " Local Bx (hex): 0x" << std::hex << std::setw(1) << std::setfill('0') << m_bxInEvent << std::endl;
187 
188  myCout << " PreScale Column: " <<std::setw(2) << m_preScColumn << std::endl;
189 
190  myCout << " Final OR Veto: " << std::hex << std::setw(1) << std::setfill('0') << m_finalORVeto << std::endl;
191 
192  myCout << " Final OR: " << std::hex << std::setw(1) << std::setfill('0') << m_finalOR << std::endl;
193 
194  // Loop through bits to create a hex word of algorithm bits.
195  int lengthWd = m_algoDecisionInitial.size();
196  myCout << " Decision (Initial) 0x" << std::hex;
197  int digit = 0;
198  for(int i=lengthWd-1; i>-1; i--) {
199  if(m_algoDecisionInitial.at(i)) digit |= (1 << (i%4));
200  if((i%4) == 0){
201  myCout << std::hex << std::setw(1) << digit;
202  digit = 0;
203  if(i%32 == 0 && i<lengthWd-1) myCout << " ";
204  }
205  } //end loop over algorithm bits
206  myCout << std::endl;
207 
208  // Loop through bits to create a hex word of algorithm bits.
209  lengthWd = m_algoDecisionPreScaled.size();
210  myCout << " Decision (Prescaled) 0x" << std::hex;
211  digit = 0;
212  for(int i=lengthWd-1; i>-1; i--) {
213  if(m_algoDecisionPreScaled.at(i)) digit |= (1 << (i%4));
214  if((i%4) == 0){
215  myCout << std::hex << std::setw(1) << digit;
216  digit = 0;
217  if(i%32 == 0 && i<lengthWd-1) myCout << " ";
218  }
219  } //end loop over algorithm bits
220  myCout << std::endl;
221 
222 
223  // Loop through bits to create a hex word of algorithm bits.
224  lengthWd = m_algoDecisionFinal.size();
225  myCout << " Decision (Final) 0x" << std::hex;
226  digit = 0;
227  for(int i=lengthWd-1; i>-1; i--) {
228  if(m_algoDecisionFinal.at(i)) digit |= (1 << (i%4));
229  if((i%4) == 0){
230  myCout << std::hex << std::setw(1) << digit;
231  digit = 0;
232  if(i%32 == 0 && i<lengthWd-1) myCout << " ";
233  }
234  } //end loop over algorithm bits
235  myCout << std::endl;
236 
237 }
238 
const int getL1MenuUUID() const
get simple members
Definition: GlobalAlgBlk.h:66
const int getbxInEventNr() const
Definition: GlobalAlgBlk.h:68
std::vector< bool > const & getAlgoDecisionInitial() const
Get decision bits.
Definition: GlobalAlgBlk.h:84
std::vector< bool > m_algoDecisionInitial
Definition: GlobalAlgBlk.h:128
std::vector< bool > const & getAlgoDecisionFinal() const
Definition: GlobalAlgBlk.h:90
void setAlgoDecisionInitial(unsigned int bit, bool val)
Set decision bits.
Definition: GlobalAlgBlk.cc:83
GlobalAlgBlk()
constructors
Definition: GlobalAlgBlk.cc:52
bool m_finalORPreVeto
Definition: GlobalAlgBlk.h:122
int m_bxNr
bunch cross number of the actual bx -> L1FirmwareUUID
Definition: GlobalAlgBlk.h:115
const bool getFinalORVeto() const
Definition: GlobalAlgBlk.h:71
const bool getFinalORPreVeto() const
Definition: GlobalAlgBlk.h:70
const int getL1FirmwareUUID() const
Definition: GlobalAlgBlk.h:67
const bool getFinalOR() const
Definition: GlobalAlgBlk.h:69
void print(std::ostream &myCout) const
pretty print the content of a GlobalAlgBlk
void reset()
reset the content of a GlobalAlgBlk
const int getPreScColumn() const
Definition: GlobalAlgBlk.h:72
virtual ~GlobalAlgBlk()
destructor
Definition: GlobalAlgBlk.cc:77
void setAlgoDecisionInterm(unsigned int bit, bool val)
Definition: GlobalAlgBlk.cc:96
#define LogTrace(id)
static unsigned int maxPhysicsTriggers
Definition: GlobalAlgBlk.h:54
int m_orbitNr
orbit number -> L1MenuUUID
Definition: GlobalAlgBlk.h:112
virtual bool operator==(const GlobalAlgBlk &rhs) const
std::vector< bool > m_algoDecisionFinal
Definition: GlobalAlgBlk.h:130
int m_bxInEvent
bunch cross in the GT event record (E,F,0,1,2)
Definition: GlobalAlgBlk.h:118
std::vector< bool > const & getAlgoDecisionInterm() const
Definition: GlobalAlgBlk.h:87
std::vector< bool > m_algoDecisionPreScaled
Definition: GlobalAlgBlk.h:129
bool m_finalORVeto
Definition: GlobalAlgBlk.h:123
void setAlgoDecisionFinal(unsigned int bit, bool val)