test
CMS 3D CMS Logo

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