CMS 3D CMS Logo

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