CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
L1GlobalTriggerRecord.cc
Go to the documentation of this file.
1 
15 // this class header
17 
18 // system include files
19 #include <iomanip>
20 
21 
22 // user include files
24 
25 // constructors
27 {
28 
29  // empty
30 
31 }
32 
33 L1GlobalTriggerRecord::L1GlobalTriggerRecord(const unsigned int numberPhysTriggers,
34  const unsigned int numberTechnicalTriggers) {
35 
36  m_gtDecisionWord.reserve(numberPhysTriggers);
37  m_gtTechnicalTriggerWord.reserve(numberTechnicalTriggers);
38 
39  m_gtDecisionWordBeforeMask.reserve(numberPhysTriggers);
40  m_gtTechnicalTriggerWordBeforeMask.reserve(numberTechnicalTriggers);
41 
42 }
43 
44 // copy constructor
47 {
48 
50 
53 
56 
59 
60 }
61 
62 // destructor
64 {
65 
66  // empty now
67 
68 }
69 
70 // assignment operator
73 {
74 
75  if ( this != &result ) {
76 
78 
81 
84 
87  }
88 
89  return *this;
90 
91 }
92 
93 // equal operator
95  const L1GlobalTriggerRecord& result) const
96 {
97 
98  if (m_gtGlobalDecision != result.m_gtGlobalDecision) {
99  return false;
100  }
101 
102  if (m_gtDecisionWord != result.m_gtDecisionWord) {
103  return false;
104  }
105 
107  return false;
108  }
109 
111  return false;
112  }
113 
115  return false;
116  }
117 
119  return false;
120  }
121 
123  return false;
124  }
125 
126  // all members identical
127  return true;
128 
129 }
130 
131 // unequal operator
133  const L1GlobalTriggerRecord& result) const
134 {
135 
136  return !( result == *this);
137 
138 }
139 // methods
140 
141 
142 // set global decision
143 void L1GlobalTriggerRecord::setDecision(const bool& dValue)
144 {
145 
146  m_gtGlobalDecision = dValue;
147 
148 }
149 
150 // set decision word
152  const DecisionWord& dWordValue)
153 {
154 
155  m_gtDecisionWord = dWordValue;
156 
157 }
158 
160  const TechnicalTriggerWord& ttWordValue)
161 {
162 
163  m_gtTechnicalTriggerWord = ttWordValue;
164 
165 }
166 
167 // set decision word before applying the masks
169  const DecisionWord& dWordValue)
170 {
171 
172  m_gtDecisionWordBeforeMask = dWordValue;
173 
174 }
175 
177  const TechnicalTriggerWord& ttWordValue)
178 {
179 
181 
182 }
183 
184 
185 // print global decision and algorithm decision word
186 void L1GlobalTriggerRecord::printGtDecision(std::ostream& myCout) const
187 {
188 
189  myCout << std::endl;
190  myCout << "\n Global decision (FinalOR): " << m_gtGlobalDecision << std::endl;
191 
192  // decision word (in 64bits words)
193  int sizeW64 = 64; // 64 bits words
194 
195  int iBit = 0;
196  int jBit = m_gtDecisionWord.size();
197  int nrDecWord = m_gtDecisionWord.size()/sizeW64;
198 
199  std::ostringstream stream64;
200 
201  std::vector<std::string> decWord;
202  decWord.reserve(nrDecWord);
203 
204  for (std::vector<bool>::const_reverse_iterator ritBit = m_gtDecisionWord.rbegin();
205  ritBit != m_gtDecisionWord.rend(); ++ritBit) {
206 
207  stream64 << (*ritBit ? '1' : '0');
208 
209  if ( (((iBit + 1)%16) == (sizeW64%16)) ) {
210  stream64 << " ";
211  }
212 
213  if ( ((iBit + 1)%sizeW64) == 0) {
214  std::string iW = stream64.str();
215  stream64.str("");
216 
217  decWord.push_back(iW);
218  }
219 
220 
221  iBit++;
222  jBit--;
223  }
224 
225  int iWord = 0;
226 
227  myCout << "\n DecisionWord after trigger mask (bitset style)";
228  for (std::vector<std::string>::reverse_iterator ritWord = decWord.rbegin();
229  ritWord != decWord.rend(); ++ritWord) {
230 
231  myCout << "\n Bits "
232  << iWord*sizeW64 + sizeW64 - 1 << " : " << iWord*sizeW64 << "\n ";
233  myCout << *ritWord;
234 
235  iWord++;
236 
237  }
238 
239 }
240 
241 // print technical trigger word (reverse order for vector<bool>)
242 void L1GlobalTriggerRecord::printTechnicalTrigger(std::ostream& myCout) const
243 {
244 
245  myCout << "\n Technical triggers after trigger mask (bitset style): \n " ;
246 
247  int sizeW64 = 64; // 64 bits words
248  int iBit = 0;
249 
250  for (std::vector<bool>::const_reverse_iterator ritBit = m_gtTechnicalTriggerWord.rbegin();
251  ritBit != m_gtTechnicalTriggerWord.rend(); ++ritBit) {
252 
253  myCout << (*ritBit ? '1' : '0');
254 
255  if ( (((iBit + 1)%16) == (sizeW64%16)) && (iBit != 63) ) {
256  myCout << " ";
257  }
258 
259  iBit++;
260  }
261 
262 
263 }
264 
265 // clear the record
267 {
268 
269  m_gtGlobalDecision = false;
270 
271  for (std::vector<bool>::iterator itBit = m_gtDecisionWord.begin();
272  itBit != m_gtDecisionWord.end(); ++itBit) {
273 
274  *itBit = false;
275 
276  }
277  for (std::vector<bool>::iterator itBit = m_gtTechnicalTriggerWord.begin();
278  itBit != m_gtTechnicalTriggerWord.end(); ++itBit) {
279 
280  *itBit = false;
281 
282  }
283  for (std::vector<bool>::iterator itBit = m_gtDecisionWordBeforeMask.begin();
284  itBit != m_gtDecisionWordBeforeMask.end(); ++itBit) {
285 
286  *itBit = false;
287 
288  }
289 
290  for (std::vector<bool>::iterator itBit = m_gtTechnicalTriggerWordBeforeMask.begin();
291  itBit != m_gtTechnicalTriggerWordBeforeMask.end(); ++itBit) {
292 
293  *itBit = false;
294 
295  }
296 
299 
300 }
301 
302 
303 // pretty print the content of a L1GlobalTriggerRecord
304 void L1GlobalTriggerRecord::print(std::ostream& myCout) const
305 {
306 
307  printGtDecision(myCout);
308 
309  myCout << std::endl;
310 
311  printTechnicalTrigger(myCout);
312 
313  myCout << std::endl;
314  myCout << "\n Index of prescale factor set for technical triggers: "
315  << m_gtPrescaleFactorIndexTech << std::endl;
316  myCout << " Index of prescale factor set for algorithm triggers: "
317  << m_gtPrescaleFactorIndexTech << std::endl;
318  myCout << std::endl;
319 
320 
321 }
322 
323 // output stream operator
324 std::ostream& operator<<(std::ostream& streamRec, const L1GlobalTriggerRecord& result)
325 {
326  result.print(streamRec);
327  return streamRec;
328 
329 }
TechnicalTriggerWord m_gtTechnicalTriggerWord
technical trigger word for L1A bunch cross
void setDecisionWordBeforeMask(const DecisionWord &dWordValue)
L1GlobalTriggerRecord & operator=(const L1GlobalTriggerRecord &)
assignment operator
void setDecision(const bool &dValue)
void setTechnicalTriggerWord(const TechnicalTriggerWord &ttWordValue)
void setDecisionWord(const DecisionWord &dWordValue)
bool m_gtGlobalDecision
global decision for L1A bunch cross
unsigned int m_gtPrescaleFactorIndexAlgo
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:187
DecisionWord m_gtDecisionWordBeforeMask
algorithm decision word for L1A bunch cross before applying the masks
bool operator!=(const L1GlobalTriggerRecord &) const
unequal operator
TechnicalTriggerWord m_gtTechnicalTriggerWordBeforeMask
technical trigger word for L1A bunch cross before applying the masks
std::vector< bool > DecisionWord
typedefs
void print(std::ostream &myCout) const
pretty print the content of a L1GlobalTriggerRecord
tuple result
Definition: query.py:137
std::vector< bool > TechnicalTriggerWord
technical trigger bits (64 bits)
void reset()
clear the record
DecisionWord m_gtDecisionWord
algorithm decision word for L1A bunch cross
void setTechnicalTriggerWordBeforeMask(const TechnicalTriggerWord &ttWordValue)
unsigned int m_gtPrescaleFactorIndexTech
virtual ~L1GlobalTriggerRecord()
destructor
void printTechnicalTrigger(std::ostream &myCout) const
print technical triggers
void printGtDecision(std::ostream &myCout) const
print global decision and algorithm decision word
bool operator==(const L1GlobalTriggerRecord &) const
equal operator
L1GlobalTriggerRecord()
constructors