CMS 3D CMS Logo

L1GtTriggerMenuLite.cc
Go to the documentation of this file.
1 
24 // this class header
26 
27 // system include files
28 #include <iostream>
29 #include <iomanip>
30 
31 // user include files
32 
33 // forward declarations
34 
35 // constructor
37  : m_triggerMenuInterface("NULL"),
38  m_triggerMenuName("NULL"),
39  m_triggerMenuImplementation("NULL"),
40  m_scaleDbKey("NULL") {
41  // empty
42 }
43 
45  const L1TriggerMap& algorithmMapVal,
46  const L1TriggerMap& algorithmAliasMapVal,
47  const L1TriggerMap& technicalTriggerMapVal,
48  const std::vector<unsigned int>& triggerMaskAlgoTrigVal,
49  const std::vector<unsigned int>& triggerMaskTechTrigVal,
50  const std::vector<std::vector<int> >& prescaleFactorsAlgoTrigVal,
51  const std::vector<std::vector<int> >& prescaleFactorsTechTrigVal)
52  : m_triggerMenuInterface("NULL"),
53  m_triggerMenuName(triggerMenuNameVal),
54  m_triggerMenuImplementation("NULL"),
55  m_scaleDbKey("NULL"),
56  m_algorithmMap(algorithmMapVal),
57  m_algorithmAliasMap(algorithmAliasMapVal),
58  m_technicalTriggerMap(technicalTriggerMapVal),
59  m_triggerMaskAlgoTrig(triggerMaskAlgoTrigVal),
60  m_triggerMaskTechTrig(triggerMaskTechTrigVal),
61  m_prescaleFactorsAlgoTrig(prescaleFactorsAlgoTrigVal),
62  m_prescaleFactorsTechTrig(prescaleFactorsTechTrigVal)
63 
64 {
65  // empty
66 }
67 
68 // copy constructor
74 
75  // copy algorithm map
78 
79  // copy technical triggers
80  // (separate map for technical triggers and physics triggers)
82 
83  // copy masks
86 
87  // copy prescale factors
90 }
91 
92 // destructor
94  m_algorithmMap.clear();
95  m_algorithmAliasMap.clear();
96  m_technicalTriggerMap.clear();
97 }
98 
99 // assignment operator
101  if (this != &rhs) {
106 
109 
111 
114 
117  }
118 
119  // return the object
120  return *this;
121 }
122 
123 // equal operator
126  return false;
127  }
128 
130  return false;
131  }
132 
134  return false;
135  }
136 
137  if (m_scaleDbKey != rhs.m_scaleDbKey) {
138  return false;
139  }
140 
141  if (m_algorithmMap != rhs.m_algorithmMap) {
142  return false;
143  }
144 
146  return false;
147  }
148 
150  return false;
151  }
152 
154  return false;
155  }
156 
158  return false;
159  }
160 
162  return false;
163  }
164 
166  return false;
167  }
168 
169  // all members identical
170  return true;
171 }
172 
173 // unequal operator
174 bool L1GtTriggerMenuLite::operator!=(const L1GtTriggerMenuLite& otherObj) const { return !(otherObj == *this); }
175 
176 // merge rule: test on isProductEqual
177 bool L1GtTriggerMenuLite::isProductEqual(const L1GtTriggerMenuLite& otherObj) const { return (otherObj == *this); }
178 
179 // set the trigger menu name
181  m_triggerMenuInterface = menuInterface;
182 }
183 
185 
187  m_triggerMenuImplementation = menuImplementation;
188 }
189 
190 // set menu associated scale key
191 void L1GtTriggerMenuLite::setGtScaleDbKey(const std::string& scaleKey) { m_scaleDbKey = scaleKey; }
192 
193 // set the algorithm map (by algorithm names)
195 
196 // set the algorithm map (by algorithm aliases)
198 
199 // set the technical trigger map
201 
202 // set the trigger mask for physics algorithms
203 void L1GtTriggerMenuLite::setGtTriggerMaskAlgoTrig(const std::vector<unsigned int>& maskValue) {
204  m_triggerMaskAlgoTrig = maskValue;
205 }
206 
207 // set the trigger mask for technical triggers
208 void L1GtTriggerMenuLite::setGtTriggerMaskTechTrig(const std::vector<unsigned int>& maskValue) {
209  m_triggerMaskTechTrig = maskValue;
210 }
211 
212 // set the prescale factors
213 void L1GtTriggerMenuLite::setGtPrescaleFactorsAlgoTrig(const std::vector<std::vector<int> >& factorValue) {
214  m_prescaleFactorsAlgoTrig = factorValue;
215 }
216 
217 void L1GtTriggerMenuLite::setGtPrescaleFactorsTechTrig(const std::vector<std::vector<int> >& factorValue) {
218  m_prescaleFactorsTechTrig = factorValue;
219 }
220 
221 // print the trigger menu
222 void L1GtTriggerMenuLite::print(std::ostream& myCout, int& printVerbosity) const {
223  //
224 
225  switch (printVerbosity) {
226  case 0: {
227  size_t nrDefinedAlgo = m_algorithmMap.size();
228  size_t nrDefinedTech = m_technicalTriggerMap.size();
229 
230  // header for printing algorithms
231 
232  myCout << "\n ********** L1 Trigger Menu - printing ********** \n"
233  << "\nL1 Trigger Menu Interface: " << m_triggerMenuInterface
234  << "\nL1 Trigger Menu Name: " << m_triggerMenuName
235  << "\nL1 Trigger Menu Implementation: " << m_triggerMenuImplementation
236  << "\nAssociated Scale DB Key: " << m_scaleDbKey << "\n\n"
237  << "\nL1 Physics Algorithms: " << nrDefinedAlgo << " algorithms defined."
238  << "\n\n"
239  << "Bit Number " << std::right << std::setw(35) << "Algorithm Name"
240  << " " << std::right << std::setw(35) << "Algorithm Alias"
241  << " " << std::right << std::setw(12) << "Trigger Mask";
242  for (unsigned iSet = 0; iSet < m_prescaleFactorsAlgoTrig.size(); iSet++) {
243  myCout << std::right << std::setw(10) << "PF Set " << std::right << std::setw(2) << iSet;
244  }
245 
246  myCout << std::endl;
247 
248  for (CItL1Trig itTrig = m_algorithmMap.begin(); itTrig != m_algorithmMap.end(); itTrig++) {
249  const unsigned int bitNumber = itTrig->first;
250  const std::string& aName = itTrig->second;
251 
252  std::string aAlias;
253  CItL1Trig itAlias = m_algorithmAliasMap.find(bitNumber);
254  if (itAlias != m_algorithmAliasMap.end()) {
255  aAlias = itAlias->second;
256  }
257 
258  myCout << std::setw(6) << bitNumber << " " << std::right << std::setw(35) << aName << " " << std::right
259  << std::setw(35) << aAlias << " " << std::right << std::setw(12) << m_triggerMaskAlgoTrig[bitNumber];
260  for (unsigned iSet = 0; iSet < m_prescaleFactorsAlgoTrig.size(); iSet++) {
261  myCout << std::right << std::setw(12) << m_prescaleFactorsAlgoTrig[iSet][bitNumber];
262  }
263 
264  myCout << std::endl;
265  }
266 
267  myCout << "\nL1 Technical Triggers: " << nrDefinedTech << " technical triggers defined."
268  << "\n\n"
269  << std::endl;
270  if (nrDefinedTech) {
271  myCout << std::right << std::setw(6) << "Bit Number " << std::right << std::setw(45)
272  << " Technical trigger name "
273  << " " << std::right << std::setw(12) << "Trigger Mask";
274  for (unsigned iSet = 0; iSet < m_prescaleFactorsTechTrig.size(); iSet++) {
275  myCout << std::right << std::setw(10) << "PF Set " << std::right << std::setw(2) << iSet;
276  }
277 
278  myCout << std::endl;
279  }
280 
281  for (CItL1Trig itTrig = m_technicalTriggerMap.begin(); itTrig != m_technicalTriggerMap.end(); itTrig++) {
282  unsigned int bitNumber = itTrig->first;
283  std::string aName = itTrig->second;
284 
285  myCout << std::setw(6) << bitNumber << " " << std::right << std::setw(45) << aName << std::right
286  << std::setw(12) << m_triggerMaskTechTrig[bitNumber];
287  for (unsigned iSet = 0; iSet < m_prescaleFactorsTechTrig.size(); iSet++) {
288  myCout << std::right << std::setw(12) << m_prescaleFactorsTechTrig[iSet][bitNumber];
289  }
290 
291  myCout << std::endl;
292  }
293 
294  } break;
295  default: {
296  myCout << "\n ********** L1 Trigger Menu - printing ********** \n\n"
297  << "Verbosity level: " << printVerbosity << " not implemented.\n\n"
298  << std::endl;
299  } break;
300  }
301 }
302 
303 // output stream operator
304 std::ostream& operator<<(std::ostream& streamRec, const L1GtTriggerMenuLite& result) {
305  int verbosityLevel = 0;
306 
307  result.print(streamRec, verbosityLevel);
308  return streamRec;
309 }
310 
311 // get the alias for a physics algorithm with a given bit number
312 const std::string* L1GtTriggerMenuLite::gtAlgorithmAlias(const unsigned int bitNumber, int& errorCode) const {
313  const std::string* gtAlgorithmAlias = nullptr;
314 
315  for (CItL1Trig itTrig = m_algorithmAliasMap.begin(); itTrig != m_algorithmAliasMap.end(); itTrig++) {
316  if (itTrig->first == bitNumber) {
317  gtAlgorithmAlias = &(itTrig->second);
318 
319  errorCode = 0;
320  return gtAlgorithmAlias;
321  }
322  }
323 
324  errorCode = 1;
325  return gtAlgorithmAlias;
326 }
327 
328 // get the name for a physics algorithm or a technical trigger
329 // with a given bit number
330 const std::string* L1GtTriggerMenuLite::gtAlgorithmName(const unsigned int bitNumber, int& errorCode) const {
331  const std::string* gtAlgorithmName = nullptr;
332 
333  for (CItL1Trig itTrig = m_algorithmMap.begin(); itTrig != m_algorithmMap.end(); itTrig++) {
334  if (itTrig->first == bitNumber) {
335  gtAlgorithmName = &(itTrig->second);
336 
337  errorCode = 0;
338  return gtAlgorithmName;
339  }
340  }
341 
342  errorCode = 1;
343  return gtAlgorithmName;
344 }
345 
346 const std::string* L1GtTriggerMenuLite::gtTechTrigName(const unsigned int bitNumber, int& errorCode) const {
347  const std::string* gtTechTrigName = nullptr;
348 
349  for (CItL1Trig itTrig = m_technicalTriggerMap.begin(); itTrig != m_technicalTriggerMap.end(); itTrig++) {
350  if (itTrig->first == bitNumber) {
351  gtTechTrigName = &(itTrig->second);
352 
353  errorCode = 0;
354  return gtTechTrigName;
355  }
356  }
357 
358  errorCode = 1;
359  return gtTechTrigName;
360 }
361 
362 // get the bit number for a physics algorithm or a technical trigger
363 // with a given name or alias
364 const unsigned int L1GtTriggerMenuLite::gtBitNumber(const std::string& trigName, int& errorCode) const {
365  unsigned int bitNr = 999;
366 
367  //
368  for (CItL1Trig itTrig = m_algorithmAliasMap.begin(); itTrig != m_algorithmAliasMap.end(); itTrig++) {
369  if (itTrig->second == trigName) {
370  bitNr = itTrig->first;
371 
372  errorCode = 0;
373  return bitNr;
374  }
375  }
376 
377  //
378  for (CItL1Trig itTrig = m_algorithmMap.begin(); itTrig != m_algorithmMap.end(); itTrig++) {
379  if (itTrig->second == trigName) {
380  bitNr = itTrig->first;
381  errorCode = 0;
382  return bitNr;
383  }
384  }
385 
386  //
387  for (CItL1Trig itTrig = m_technicalTriggerMap.begin(); itTrig != m_technicalTriggerMap.end(); itTrig++) {
388  if (itTrig->second == trigName) {
389  bitNr = itTrig->first;
390  errorCode = 0;
391  return bitNr;
392  }
393  }
394 
395  errorCode = 1;
396  return bitNr;
397 }
398 
399 // get the result for a physics algorithm or a technical trigger with name trigName
400 // use directly the format of decisionWord (no typedef)
402  const std::vector<bool>& decWord,
403  int& errorCode) const {
404  bool trigResult = false;
405 
406  // try first physics algorithm aliases
407 
408  for (CItL1Trig itTrig = m_algorithmAliasMap.begin(); itTrig != m_algorithmAliasMap.end(); itTrig++) {
409  if (itTrig->second == trigName) {
410  unsigned int bitNumber = itTrig->first;
411 
412  if ((bitNumber >= decWord.size())) {
413  trigResult = false;
414  errorCode = 10;
415  } else {
416  trigResult = decWord[bitNumber];
417  errorCode = 0;
418  }
419 
420  return trigResult;
421  }
422  }
423 
424  // ... then physics algorithm names
425 
426  for (CItL1Trig itTrig = m_algorithmMap.begin(); itTrig != m_algorithmMap.end(); itTrig++) {
427  if (itTrig->second == trigName) {
428  unsigned int bitNumber = itTrig->first;
429 
430  if ((bitNumber >= decWord.size())) {
431  trigResult = false;
432  errorCode = 10;
433  } else {
434  trigResult = decWord[bitNumber];
435  errorCode = 0;
436  }
437 
438  return trigResult;
439  }
440  }
441 
442  // ... then technical trigger names
443 
444  for (CItL1Trig itTrig = m_technicalTriggerMap.begin(); itTrig != m_technicalTriggerMap.end(); itTrig++) {
445  if (itTrig->second == trigName) {
446  unsigned int bitNumber = itTrig->first;
447 
448  if ((bitNumber >= decWord.size())) {
449  trigResult = false;
450  errorCode = 10;
451  } else {
452  trigResult = decWord[bitNumber];
453  errorCode = 0;
454  }
455 
456  return trigResult;
457  }
458  }
459 
460  // algorithm or technical trigger not in the menu
461 
462  errorCode = 1;
463  return false;
464 }
L1GtTriggerMenuLite::operator!=
bool operator!=(const L1GtTriggerMenuLite &) const
unequal operator
Definition: L1GtTriggerMenuLite.cc:174
L1GtTriggerMenuLite::gtAlgorithmName
const std::string * gtAlgorithmName(const unsigned int bitNumber, int &errorCode) const
Definition: L1GtTriggerMenuLite.cc:330
L1GtTriggerMenuLite::gtTriggerResult
const bool gtTriggerResult(const std::string &trigName, const std::vector< bool > &decWord, int &errorCode) const
Definition: L1GtTriggerMenuLite.cc:401
L1GtTriggerMenuLite::m_triggerMenuInterface
std::string m_triggerMenuInterface
menu names
Definition: L1GtTriggerMenuLite.h:162
L1GtTriggerMenuLite::setGtTriggerMenuInterface
void setGtTriggerMenuInterface(const std::string &)
Definition: L1GtTriggerMenuLite.cc:180
L1GtTriggerMenuLite.h
L1GtTriggerMenuLite::gtBitNumber
const unsigned int gtBitNumber(const std::string &trigName, int &errorCode) const
Definition: L1GtTriggerMenuLite.cc:364
L1GtTriggerMenuLite::CItL1Trig
L1TriggerMap::const_iterator CItL1Trig
iterators through map containing the physics algorithms or the technical triggers
Definition: L1GtTriggerMenuLite.h:45
L1GtTriggerMenuLite::gtTechTrigName
const std::string * gtTechTrigName(const unsigned int bitNumber, int &errorCode) const
Definition: L1GtTriggerMenuLite.cc:346
L1GtTriggerMenuLite::setGtAlgorithmAliasMap
void setGtAlgorithmAliasMap(const L1TriggerMap &)
Definition: L1GtTriggerMenuLite.cc:197
L1GtTriggerMenuLite::m_algorithmMap
L1TriggerMap m_algorithmMap
map containing the physics algorithms (by name)
Definition: L1GtTriggerMenuLite.h:170
HLTSiStripMonitoring_cff.verbosityLevel
verbosityLevel
L1 selection andOrL1 = cms.bool( True ), l1Algorithms = cms.vstring("L1_ZeroBias_FirstCollidingBunch"...
Definition: HLTSiStripMonitoring_cff.py:261
L1GtTriggerMenuLite::setGtTriggerMaskTechTrig
void setGtTriggerMaskTechTrig(const std::vector< unsigned int > &)
set the trigger mask for technical triggers
Definition: L1GtTriggerMenuLite.cc:208
L1GtTriggerMenuLite::m_prescaleFactorsAlgoTrig
std::vector< std::vector< int > > m_prescaleFactorsAlgoTrig
prescale factors
Definition: L1GtTriggerMenuLite.h:185
L1GtTriggerMenuLite::setGtPrescaleFactorsTechTrig
void setGtPrescaleFactorsTechTrig(const std::vector< std::vector< int > > &)
Definition: L1GtTriggerMenuLite.cc:217
L1GtTriggerMenuLite::setGtTechnicalTriggerMap
void setGtTechnicalTriggerMap(const L1TriggerMap &)
Definition: L1GtTriggerMenuLite.cc:200
L1GtTriggerMenuLite::m_triggerMenuImplementation
std::string m_triggerMenuImplementation
Definition: L1GtTriggerMenuLite.h:164
L1GtTriggerMenuLite::m_triggerMaskTechTrig
std::vector< unsigned int > m_triggerMaskTechTrig
trigger mask for technical triggers
Definition: L1GtTriggerMenuLite.h:182
L1GtTriggerMenuLite::setGtTriggerMenuName
void setGtTriggerMenuName(const std::string &)
Definition: L1GtTriggerMenuLite.cc:184
L1GtTriggerMenuLite::print
void print(std::ostream &, int &) const
Definition: L1GtTriggerMenuLite.cc:222
EgHLTOffTrigSelection_cfi.trigName
trigName
Definition: EgHLTOffTrigSelection_cfi.py:8
L1GtTriggerMenuLite::setGtTriggerMaskAlgoTrig
void setGtTriggerMaskAlgoTrig(const std::vector< unsigned int > &)
set the trigger mask for physics algorithms
Definition: L1GtTriggerMenuLite.cc:203
L1GtTriggerMenuLite::setGtPrescaleFactorsAlgoTrig
void setGtPrescaleFactorsAlgoTrig(const std::vector< std::vector< int > > &)
Definition: L1GtTriggerMenuLite.cc:213
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
L1GtTriggerMenuLite::setGtTriggerMenuImplementation
void setGtTriggerMenuImplementation(const std::string &)
Definition: L1GtTriggerMenuLite.cc:186
L1GtTriggerMenuLite::m_technicalTriggerMap
L1TriggerMap m_technicalTriggerMap
map containing the technical triggers
Definition: L1GtTriggerMenuLite.h:176
L1GtTriggerMenuLite::m_triggerMenuName
std::string m_triggerMenuName
Definition: L1GtTriggerMenuLite.h:163
L1GtTriggerMenuLite
Definition: L1GtTriggerMenuLite.h:39
L1GtTriggerMenuLite::m_triggerMaskAlgoTrig
std::vector< unsigned int > m_triggerMaskAlgoTrig
trigger mask for physics algorithms
Definition: L1GtTriggerMenuLite.h:179
operator<<
std::ostream & operator<<(std::ostream &streamRec, const L1GtTriggerMenuLite &result)
Definition: L1GtTriggerMenuLite.cc:304
L1GtTriggerMenuLite::isProductEqual
bool isProductEqual(const L1GtTriggerMenuLite &) const
merge rule: test on isProductEqual
Definition: L1GtTriggerMenuLite.cc:177
L1GtTriggerMenuLite::~L1GtTriggerMenuLite
virtual ~L1GtTriggerMenuLite()
Definition: L1GtTriggerMenuLite.cc:93
L1GtTriggerMenuLite::setGtScaleDbKey
void setGtScaleDbKey(const std::string &)
Definition: L1GtTriggerMenuLite.cc:191
L1GtTriggerMenuLite::m_prescaleFactorsTechTrig
std::vector< std::vector< int > > m_prescaleFactorsTechTrig
Definition: L1GtTriggerMenuLite.h:186
L1TBPTX_cfi.bitNumber
bitNumber
Definition: L1TBPTX_cfi.py:26
mps_fire.result
result
Definition: mps_fire.py:311
L1GtTriggerMenuLite::operator=
L1GtTriggerMenuLite & operator=(const L1GtTriggerMenuLite &)
assignment operator
Definition: L1GtTriggerMenuLite.cc:100
L1GtTriggerMenuLite::L1TriggerMap
std::map< unsigned int, std::string > L1TriggerMap
map containing the physics algorithms or the technical triggers
Definition: L1GtTriggerMenuLite.h:42
L1GtTriggerMenuLite::gtAlgorithmAlias
const std::string * gtAlgorithmAlias(const unsigned int bitNumber, int &errorCode) const
get the alias for a physics algorithm with a given bit number
Definition: L1GtTriggerMenuLite.cc:312
L1GtTriggerMenuLite::L1GtTriggerMenuLite
L1GtTriggerMenuLite()
constructor
Definition: L1GtTriggerMenuLite.cc:36
L1GtTriggerMenuLite::m_algorithmAliasMap
L1TriggerMap m_algorithmAliasMap
map containing the physics algorithms (by alias)
Definition: L1GtTriggerMenuLite.h:173
L1GtTriggerMenuLite::operator==
bool operator==(const L1GtTriggerMenuLite &) const
equal operator
Definition: L1GtTriggerMenuLite.cc:124
L1GtTriggerMenuLite::m_scaleDbKey
std::string m_scaleDbKey
menu associated scale key
Definition: L1GtTriggerMenuLite.h:167
L1GtTriggerMenuLite::setGtAlgorithmMap
void setGtAlgorithmMap(const L1TriggerMap &)
Definition: L1GtTriggerMenuLite.cc:194