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  // Not all variables can be compared since the prescale counters are
165  // generally not the same when producing the collections and so the
166  // prescaled algo decisions do not match.
167  bool eq = m_orbitNr == rhs.getL1MenuUUID()
168  && m_bxNr == rhs.getL1FirmwareUUID()
169  && m_bxInEvent == rhs.getbxInEventNr()
170  //&& m_finalOR == rhs.getFinalOR()
171  //&& m_finalORPreVeto == rhs.getFinalORPreVeto()
172  //&& m_finalORVeto == rhs.getFinalORVeto()
173  //&& m_preScColumn == rhs.getPreScColumn()
175  //&& m_algoDecisionPreScaled == rhs.getAlgoDecisionInterm()
176  //&& m_algoDecisionFinal == rhs.getAlgoDecisionFinal()
177  ;
178 
179  //if (not eq) {
180  // std::cout << "m_orbitNr: " << m_orbitNr << " : " << rhs.getL1MenuUUID() << std::endl
181  // << "m_bxNr: " << m_bxNr << " : " << rhs.getL1FirmwareUUID() << std::endl
182  // << "m_bxInEvent: " << m_bxInEvent << " : " << rhs.getbxInEventNr() << std::endl
183  // << "m_finalOR: " << m_finalOR << " : " << rhs.getFinalOR() << std::endl
184  // << "m_finalORPreVeto: " << m_finalORPreVeto << " : " << rhs.getFinalORPreVeto() << std::endl
185  // << "m_finalORVeto: " << m_finalORVeto << " : " << rhs.getFinalORVeto() << std::endl
186  // << "m_preScColumn: " << m_preScColumn << " : " << rhs.getPreScColumn() << std::endl
187  // << std::endl;
188  // std::cout << "algoDecisions" << std::endl;
189  // for (size_t i = 0; i < m_algoDecisionInitial.size(); ++i) {
190  // std::cout << "bit " << i << ": " << m_algoDecisionInitial.at(i) << " : " << rhs.getAlgoDecisionInitial(i)
191  // << " " << m_algoDecisionPreScaled.at(i) << " : " << rhs.getAlgoDecisionInterm(i)
192  // << " " << m_algoDecisionFinal.at(i) << " : " << rhs.getAlgoDecisionFinal(i) << std::endl;
193  // }
194  //}
195 
196  return eq;
197 }
198 
199 // pretty print the content of a GlobalAlgBlk
200 void GlobalAlgBlk::print(std::ostream& myCout) const
201 {
202 
203  myCout << " uGtGlobalAlgBlk: " << std::endl;
204 
205  myCout << " L1 Menu Name (hash): 0x" << std::hex << m_orbitNr << std::endl;
206 
207  myCout << " L1 firmware (hash): 0x" << std::hex << m_bxNr << std::endl;
208 
209  myCout << " Local Bx (hex): 0x" << std::hex << std::setw(1) << std::setfill('0') << m_bxInEvent << std::endl;
210 
211  myCout << " PreScale Column: " <<std::setw(2) << m_preScColumn << std::endl;
212 
213  myCout << " Final OR Veto: " << std::hex << std::setw(1) << std::setfill('0') << m_finalORVeto << std::endl;
214 
215  myCout << " Final OR: " << std::hex << std::setw(1) << std::setfill('0') << m_finalOR << std::endl;
216 
217  // Loop through bits to create a hex word of algorithm bits.
218  int lengthWd = m_algoDecisionInitial.size();
219  myCout << " Decision (Initial) 0x" << std::hex;
220  int digit = 0;
221  for(int i=lengthWd-1; i>-1; i--) {
222  if(m_algoDecisionInitial.at(i)) digit |= (1 << (i%4));
223  if((i%4) == 0){
224  myCout << std::hex << std::setw(1) << digit;
225  digit = 0;
226  if(i%32 == 0 && i<lengthWd-1) myCout << " ";
227  }
228  } //end loop over algorithm bits
229  myCout << std::endl;
230 
231  // Loop through bits to create a hex word of algorithm bits.
232  lengthWd = m_algoDecisionPreScaled.size();
233  myCout << " Decision (Prescaled) 0x" << std::hex;
234  digit = 0;
235  for(int i=lengthWd-1; i>-1; i--) {
236  if(m_algoDecisionPreScaled.at(i)) digit |= (1 << (i%4));
237  if((i%4) == 0){
238  myCout << std::hex << std::setw(1) << digit;
239  digit = 0;
240  if(i%32 == 0 && i<lengthWd-1) myCout << " ";
241  }
242  } //end loop over algorithm bits
243  myCout << std::endl;
244 
245 
246  // Loop through bits to create a hex word of algorithm bits.
247  lengthWd = m_algoDecisionFinal.size();
248  myCout << " Decision (Final) 0x" << std::hex;
249  digit = 0;
250  for(int i=lengthWd-1; i>-1; i--) {
251  if(m_algoDecisionFinal.at(i)) digit |= (1 << (i%4));
252  if((i%4) == 0){
253  myCout << std::hex << std::setw(1) << digit;
254  digit = 0;
255  if(i%32 == 0 && i<lengthWd-1) myCout << " ";
256  }
257  } //end loop over algorithm bits
258  myCout << std::endl;
259 
260 }
261 
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 int getL1FirmwareUUID() const
Definition: GlobalAlgBlk.h:67
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: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)