CMS 3D CMS Logo

L1GtUtils.cc
Go to the documentation of this file.
1 
15 // this class header
17 
18 // system include files
19 #include <iomanip>
20 
21 // user include files
25 
27 
28 // constructor(s)
30  :
31 
32  m_l1GtStableParCacheID(0ULL),
33  m_numberAlgorithmTriggers(0),
34 
35  m_numberTechnicalTriggers(0),
36 
37  m_l1GtPfAlgoCacheID(0ULL),
38  m_l1GtPfTechCacheID(0ULL),
39 
40  m_l1GtTmAlgoCacheID(0ULL),
41  m_l1GtTmTechCacheID(0ULL),
42 
43  m_l1GtTmVetoAlgoCacheID(0ULL),
44  m_l1GtTmVetoTechCacheID(0ULL),
45 
46  m_l1GtMenuCacheID(0ULL),
47 
48  m_l1EventSetupValid(false),
49 
50  m_l1GtMenuLiteValid(false),
51 
52  m_beginRunCache(false),
53 
54  m_runIDCache(0),
55 
56  m_physicsDaqPartition(0),
57 
58  m_retrieveL1EventSetup(false),
59 
60  m_retrieveL1GtTriggerMenuLite(false)
61 
62 {
63  if (useEventSetupIn == UseEventSetupIn::Run || useEventSetupIn == UseEventSetupIn::RunAndEvent) {
79  }
80  if (useEventSetupIn == UseEventSetupIn::Event || useEventSetupIn == UseEventSetupIn::RunAndEvent) {
89  }
90 }
91 
95  UseEventSetupIn useEventSetupIn)
96  : L1GtUtils(pset, iC, useL1GtTriggerMenuLite, useEventSetupIn) {}
97 
101  UseEventSetupIn useEventSetupIn)
102  : L1GtUtils(iC, useEventSetupIn) {
104 }
105 
106 // destructor
108  // empty
109 }
110 
111 const std::string L1GtUtils::triggerCategory(const TriggerCategory& trigCategory) const {
112  switch (trigCategory) {
113  case AlgorithmTrigger: {
114  return "Algorithm Trigger";
115  } break;
116  case TechnicalTrigger: {
117  return "Technical Trigger";
118  }
119 
120  break;
121  default: {
122  return EmptyString;
123  } break;
124  }
125 }
126 
127 void L1GtUtils::retrieveL1EventSetup(const edm::EventSetup& evSetup, bool isRun) {
128  //
129  m_retrieveL1EventSetup = true;
130 
131  m_l1EventSetupValid = true;
132  // FIXME test for each record if valid; if not set m_l1EventSetupValid = false;
133 
134  // get / update the stable parameters from the EventSetup
135  // local cache & check on cacheIdentifier
136 
137  auto l1GtStableParametersRcd = evSetup.get<L1GtStableParametersRcd>();
138  unsigned long long l1GtStableParCacheID = l1GtStableParametersRcd.cacheIdentifier();
139 
140  if (m_l1GtStableParCacheID != l1GtStableParCacheID) {
141  if (isRun) {
142  m_l1GtStablePar = &l1GtStableParametersRcd.get(m_L1GtStableParametersRunToken);
143  } else {
144  m_l1GtStablePar = &l1GtStableParametersRcd.get(m_L1GtStableParametersEventToken);
145  }
146 
147  // number of algorithm triggers
149 
150  // number of technical triggers
152 
154 
155  m_triggerMaskSet.reserve(maxNumberTrigger);
156  m_prescaleFactorSet.reserve(maxNumberTrigger);
157 
158  //
159  m_l1GtStableParCacheID = l1GtStableParCacheID;
160  }
161 
162  // get / update the prescale factors from the EventSetup
163  // local cache & check on cacheIdentifier
164 
165  auto l1GtPrescaleFactorsAlgoTrigRcd = evSetup.get<L1GtPrescaleFactorsAlgoTrigRcd>();
166  unsigned long long l1GtPfAlgoCacheID = l1GtPrescaleFactorsAlgoTrigRcd.cacheIdentifier();
167 
168  if (m_l1GtPfAlgoCacheID != l1GtPfAlgoCacheID) {
169  if (isRun) {
170  m_l1GtPfAlgo = &l1GtPrescaleFactorsAlgoTrigRcd.get(m_L1GtPrescaleFactorsAlgoTrigRunToken);
171  } else {
172  m_l1GtPfAlgo = &l1GtPrescaleFactorsAlgoTrigRcd.get(m_L1GtPrescaleFactorsAlgoTrigEventToken);
173  }
174 
176 
177  m_l1GtPfAlgoCacheID = l1GtPfAlgoCacheID;
178  }
179 
180  auto l1GtPrescaleFactorsTechTrigRcd = evSetup.get<L1GtPrescaleFactorsTechTrigRcd>();
181  unsigned long long l1GtPfTechCacheID = l1GtPrescaleFactorsTechTrigRcd.cacheIdentifier();
182 
183  if (m_l1GtPfTechCacheID != l1GtPfTechCacheID) {
184  if (isRun) {
185  m_l1GtPfTech = &l1GtPrescaleFactorsTechTrigRcd.get(m_L1GtPrescaleFactorsTechTrigRunToken);
186  } else {
187  m_l1GtPfTech = &l1GtPrescaleFactorsTechTrigRcd.get(m_L1GtPrescaleFactorsTechTrigEventToken);
188  }
189 
191 
192  m_l1GtPfTechCacheID = l1GtPfTechCacheID;
193  }
194 
195  // get / update the trigger mask from the EventSetup
196  // local cache & check on cacheIdentifier
197 
198  auto l1GtTriggerMaskAlgoTrigRcd = evSetup.get<L1GtTriggerMaskAlgoTrigRcd>();
199  unsigned long long l1GtTmAlgoCacheID = l1GtTriggerMaskAlgoTrigRcd.cacheIdentifier();
200 
201  if (m_l1GtTmAlgoCacheID != l1GtTmAlgoCacheID) {
202  if (isRun) {
203  m_l1GtTmAlgo = &l1GtTriggerMaskAlgoTrigRcd.get(m_L1GtTriggerMaskAlgoTrigRunToken);
204  } else {
205  m_l1GtTmAlgo = &l1GtTriggerMaskAlgoTrigRcd.get(m_L1GtTriggerMaskAlgoTrigEventToken);
206  }
207 
209 
210  m_l1GtTmAlgoCacheID = l1GtTmAlgoCacheID;
211  }
212 
213  auto l1GtTriggerMaskTechTrigRcd = evSetup.get<L1GtTriggerMaskTechTrigRcd>();
214  unsigned long long l1GtTmTechCacheID = l1GtTriggerMaskTechTrigRcd.cacheIdentifier();
215 
216  if (m_l1GtTmTechCacheID != l1GtTmTechCacheID) {
217  if (isRun) {
218  m_l1GtTmTech = &l1GtTriggerMaskTechTrigRcd.get(m_L1GtTriggerMaskTechTrigRunToken);
219  } else {
220  m_l1GtTmTech = &l1GtTriggerMaskTechTrigRcd.get(m_L1GtTriggerMaskTechTrigEventToken);
221  }
222 
224 
225  m_l1GtTmTechCacheID = l1GtTmTechCacheID;
226  }
227 
228  auto l1GtTriggerMaskVetoAlgoTrigRcd = evSetup.get<L1GtTriggerMaskVetoAlgoTrigRcd>();
229  unsigned long long l1GtTmVetoAlgoCacheID = l1GtTriggerMaskVetoAlgoTrigRcd.cacheIdentifier();
230 
231  if (m_l1GtTmVetoAlgoCacheID != l1GtTmVetoAlgoCacheID) {
232  edm::ESHandle<L1GtTriggerMask> l1GtTmVetoAlgo;
233  evSetup.get<L1GtTriggerMaskVetoAlgoTrigRcd>().get(l1GtTmVetoAlgo);
234  m_l1GtTmVetoAlgo = l1GtTmVetoAlgo.product();
235  if (isRun) {
236  m_l1GtTmVetoAlgo = &l1GtTriggerMaskVetoAlgoTrigRcd.get(m_L1GtTriggerMaskVetoAlgoTrigRunToken);
237  } else {
238  m_l1GtTmVetoAlgo = &l1GtTriggerMaskVetoAlgoTrigRcd.get(m_L1GtTriggerMaskVetoAlgoTrigEventToken);
239  }
240 
242 
243  m_l1GtTmVetoAlgoCacheID = l1GtTmVetoAlgoCacheID;
244  }
245 
246  auto l1GtTriggerMaskVetoTechTrigRcd = evSetup.get<L1GtTriggerMaskVetoTechTrigRcd>();
247  unsigned long long l1GtTmVetoTechCacheID = l1GtTriggerMaskVetoTechTrigRcd.cacheIdentifier();
248 
249  if (m_l1GtTmVetoTechCacheID != l1GtTmVetoTechCacheID) {
250  if (isRun) {
251  m_l1GtTmVetoTech = &l1GtTriggerMaskVetoTechTrigRcd.get(m_L1GtTriggerMaskVetoTechTrigRunToken);
252  } else {
253  m_l1GtTmVetoTech = &l1GtTriggerMaskVetoTechTrigRcd.get(m_L1GtTriggerMaskVetoTechTrigEventToken);
254  }
255 
257 
258  m_l1GtTmVetoTechCacheID = l1GtTmVetoTechCacheID;
259  }
260 
261  // get / update the trigger menu from the EventSetup
262  // local cache & check on cacheIdentifier
263 
264  auto l1GtTriggerMenuRcd = evSetup.get<L1GtTriggerMenuRcd>();
265  unsigned long long l1GtMenuCacheID = l1GtTriggerMenuRcd.cacheIdentifier();
266 
267  if (m_l1GtMenuCacheID != l1GtMenuCacheID) {
269  evSetup.get<L1GtTriggerMenuRcd>().get(l1GtMenu);
270  m_l1GtMenu = l1GtMenu.product();
271  if (isRun) {
272  m_l1GtMenu = &l1GtTriggerMenuRcd.get(m_L1GtTriggerMenuRunToken);
273  } else {
274  m_l1GtMenu = &l1GtTriggerMenuRcd.get(m_L1GtTriggerMenuEventToken);
275  }
276 
279 
281 
282  m_l1GtMenuCacheID = l1GtMenuCacheID;
283  }
284 }
285 
288 
289  // get L1GtTriggerMenuLite
291  if (!m_l1GtUtilsHelper->l1GtTriggerMenuLiteToken().isUninitialized()) {
292  iRun.getByToken(m_l1GtUtilsHelper->l1GtTriggerMenuLiteToken(), l1GtMenuLite);
293  }
294 
295  if (!l1GtMenuLite.isValid()) {
296  LogDebug("L1GtUtils") << "\nL1GtTriggerMenuLite with \n " << m_l1GtUtilsHelper->l1GtTriggerMenuLiteInputTag()
297  << "\nrequested, but not found in the run." << std::endl;
298 
299  m_l1GtMenuLiteValid = false;
300  } else {
301  m_l1GtMenuLite = l1GtMenuLite.product();
302  m_l1GtMenuLiteValid = true;
303 
304  LogDebug("L1GtUtils") << "\nL1GtTriggerMenuLite with \n " << m_l1GtUtilsHelper->l1GtTriggerMenuLiteInputTag()
305  << "\nretrieved for run " << iRun.runAuxiliary().run() << std::endl;
306 
310 
313 
316  }
317 }
318 
320  const edm::EventSetup& evSetup,
321  bool useL1EventSetup,
322  bool useL1GtTriggerMenuLite) {
323  // first call will turn this to true: the quantities which can be cached in
324  // beginRun will not be cached then in analyze
325  m_beginRunCache = true;
326 
327  // if requested, retrieve and cache L1 event setup
328  // keep the caching based on cacheIdentifier() for each record
329  if (useL1EventSetup) {
330  bool isRun = true;
331  retrieveL1EventSetup(evSetup, isRun);
332  }
333 
334  // cached per run
335 
336  // if requested, retrieve and cache the L1GtTriggerMenuLite
337  // L1GtTriggerMenuLite is defined per run and produced in prompt reco by L1Reco
338  // and put in the Run section
341  }
342 }
343 
345  const edm::EventSetup& evSetup,
346  const bool useL1EventSetup,
347  const bool useL1GtTriggerMenuLite) {
348  // if there was no retrieval and caching in beginRun, do it here
349  if (!m_beginRunCache) {
350  // if requested, retrieve and cache L1 event setup
351  // keep the caching based on cacheIdentifier() for each record
352  if (useL1EventSetup) {
353  bool isRun = false;
354  retrieveL1EventSetup(evSetup, isRun);
355  }
356  }
357 
358  // cached per run
359 
360  const edm::Run& iRun = iEvent.getRun();
361  edm::RunID runID = iRun.runAuxiliary().id();
362 
363  if (runID != m_runIDCache) {
364  if (!m_beginRunCache) {
365  // if requested, retrieve and cache the L1GtTriggerMenuLite
366  // L1GtTriggerMenuLite is defined per run and produced in prompt reco by L1Reco
367  // and put in the Run section
370  }
371  }
372  m_runIDCache = runID;
373  }
374 }
375 
376 const bool L1GtUtils::l1AlgoTechTrigBitNumber(const std::string& nameAlgoTechTrig,
377  TriggerCategory& trigCategory,
378  int& bitNumber) const {
379  trigCategory = AlgorithmTrigger;
380  bitNumber = -1;
381 
383  if (m_l1GtMenuLiteValid) {
384  // test if the name is an algorithm alias
386  itTrig != m_algorithmAliasMapLite->end();
387  itTrig++) {
388  if (itTrig->second == nameAlgoTechTrig) {
389  trigCategory = AlgorithmTrigger;
390  bitNumber = itTrig->first;
391 
392  return true;
393  }
394  }
395 
396  // test if the name is an algorithm name
397  for (L1GtTriggerMenuLite::CItL1Trig itTrig = m_algorithmMapLite->begin(); itTrig != m_algorithmMapLite->end();
398  itTrig++) {
399  if (itTrig->second == nameAlgoTechTrig) {
400  trigCategory = AlgorithmTrigger;
401  bitNumber = itTrig->first;
402 
403  return true;
404  }
405  }
406 
407  // test if the name is a technical trigger
409  itTrig != m_technicalTriggerMapLite->end();
410  itTrig++) {
411  if (itTrig->second == nameAlgoTechTrig) {
412  trigCategory = TechnicalTrigger;
413  bitNumber = itTrig->first;
414 
415  return true;
416  }
417  }
418 
419  } else if (m_retrieveL1EventSetup) {
420  // test if the name is an algorithm alias
421  CItAlgo itAlgo = m_algorithmAliasMap->find(nameAlgoTechTrig);
422  if (itAlgo != m_algorithmAliasMap->end()) {
423  trigCategory = AlgorithmTrigger;
424  bitNumber = (itAlgo->second).algoBitNumber();
425 
426  return true;
427  }
428 
429  // test if the name is an algorithm name
430  itAlgo = m_algorithmMap->find(nameAlgoTechTrig);
431  if (itAlgo != m_algorithmMap->end()) {
432  trigCategory = AlgorithmTrigger;
433  bitNumber = (itAlgo->second).algoBitNumber();
434 
435  return true;
436  }
437 
438  // test if the name is a technical trigger
439  itAlgo = m_technicalTriggerMap->find(nameAlgoTechTrig);
440  if (itAlgo != m_technicalTriggerMap->end()) {
441  trigCategory = TechnicalTrigger;
442  bitNumber = (itAlgo->second).algoBitNumber();
443 
444  return true;
445  }
446 
447  } else {
448  // only L1GtTriggerMenuLite requested, but it is not valid
449  return false;
450  }
451  } else if (m_retrieveL1EventSetup) {
452  // test if the name is an algorithm alias
453  CItAlgo itAlgo = m_algorithmAliasMap->find(nameAlgoTechTrig);
454  if (itAlgo != m_algorithmAliasMap->end()) {
455  trigCategory = AlgorithmTrigger;
456  bitNumber = (itAlgo->second).algoBitNumber();
457 
458  return true;
459  }
460 
461  // test if the name is an algorithm name
462  itAlgo = m_algorithmMap->find(nameAlgoTechTrig);
463  if (itAlgo != m_algorithmMap->end()) {
464  trigCategory = AlgorithmTrigger;
465  bitNumber = (itAlgo->second).algoBitNumber();
466 
467  return true;
468  }
469 
470  // test if the name is a technical trigger
471  itAlgo = m_technicalTriggerMap->find(nameAlgoTechTrig);
472  if (itAlgo != m_technicalTriggerMap->end()) {
473  trigCategory = TechnicalTrigger;
474  bitNumber = (itAlgo->second).algoBitNumber();
475 
476  return true;
477  }
478 
479  } else {
480  // L1 trigger configuration not retrieved
481  return false;
482  }
483 
484  // all possibilities already tested, so it should not arrive here
485  return false;
486 }
487 
489  const TriggerCategory& trigCategory,
490  std::string& aliasL1Trigger,
491  std::string& nameL1Trigger) const {
492  aliasL1Trigger.clear();
493  nameL1Trigger.clear();
494 
496  if (m_l1GtMenuLiteValid) {
497  // for an algorithm trigger
498  if (trigCategory == AlgorithmTrigger) {
499  bool trigAliasFound = false;
500  bool trigNameFound = false;
501 
503  itTrig != m_algorithmAliasMapLite->end();
504  itTrig++) {
505  if (static_cast<int>(itTrig->first) == bitNumber) {
506  aliasL1Trigger = itTrig->second;
507  trigAliasFound = true;
508  break;
509  }
510  }
511 
512  for (L1GtTriggerMenuLite::CItL1Trig itTrig = m_algorithmMapLite->begin(); itTrig != m_algorithmMapLite->end();
513  itTrig++) {
514  if (static_cast<int>(itTrig->first) == bitNumber) {
515  nameL1Trigger = itTrig->second;
516  trigNameFound = true;
517  break;
518  }
519  }
520 
521  if (!(trigAliasFound && trigNameFound)) {
522  return false;
523  }
524 
525  return true;
526 
527  } else if (trigCategory == TechnicalTrigger) {
528  // for a technical trigger
529 
530  bool trigNameFound = false;
531 
533  itTrig != m_technicalTriggerMapLite->end();
534  itTrig++) {
535  if (static_cast<int>(itTrig->first) == bitNumber) {
536  nameL1Trigger = itTrig->second;
537 
538  // technically, no alias is defined for technical triggers
539  // users use mainly aliases, so just return the name here
540  aliasL1Trigger = itTrig->second;
541 
542  trigNameFound = true;
543  break;
544  }
545  }
546 
547  if (!(trigNameFound)) {
548  return false;
549  }
550 
551  return true;
552 
553  } else {
554  // non-existing trigger category...
555  return false;
556  }
557 
558  } else if (m_retrieveL1EventSetup) {
559  // for an algorithm trigger
560  if (trigCategory == AlgorithmTrigger) {
561  bool trigAliasFound = false;
562 
563  for (CItAlgo itTrig = m_algorithmAliasMap->begin(); itTrig != m_algorithmAliasMap->end(); itTrig++) {
564  if ((itTrig->second).algoBitNumber() == bitNumber) {
565  aliasL1Trigger = itTrig->first;
566  // get the name here, avoiding a loop on m_algorithmMap
567  nameL1Trigger = (itTrig->second).algoName();
568 
569  trigAliasFound = true;
570  break;
571  }
572  }
573 
574  if (!(trigAliasFound)) {
575  return false;
576  }
577 
578  return true;
579 
580  } else if (trigCategory == TechnicalTrigger) {
581  // for a technical trigger
582 
583  bool trigNameFound = false;
584 
585  for (CItAlgo itTrig = m_technicalTriggerMap->begin(); itTrig != m_technicalTriggerMap->end(); itTrig++) {
586  if ((itTrig->second).algoBitNumber() == bitNumber) {
587  nameL1Trigger = (itTrig->second).algoName();
588  // technically, no alias is defined for technical triggers
589  // users use mainly aliases, so just return the name here
590  aliasL1Trigger = nameL1Trigger;
591 
592  trigNameFound = true;
593  break;
594  }
595  }
596 
597  if (!(trigNameFound)) {
598  return false;
599  }
600 
601  return true;
602 
603  } else {
604  // non-existing trigger category...
605  return false;
606  }
607 
608  } else {
609  // only L1GtTriggerMenuLite requested, but it is not valid
610  return false;
611  }
612  } else if (m_retrieveL1EventSetup) {
613  // for an algorithm trigger
614  if (trigCategory == AlgorithmTrigger) {
615  bool trigAliasFound = false;
616 
617  for (CItAlgo itTrig = m_algorithmAliasMap->begin(); itTrig != m_algorithmAliasMap->end(); itTrig++) {
618  if ((itTrig->second).algoBitNumber() == bitNumber) {
619  aliasL1Trigger = itTrig->first;
620  // get the name here, avoiding a loop on m_algorithmMap
621  nameL1Trigger = (itTrig->second).algoName();
622 
623  trigAliasFound = true;
624  break;
625  }
626  }
627 
628  if (!(trigAliasFound)) {
629  return false;
630  }
631 
632  return true;
633 
634  } else if (trigCategory == TechnicalTrigger) {
635  // for a technical trigger
636 
637  bool trigNameFound = false;
638 
639  for (CItAlgo itTrig = m_technicalTriggerMap->begin(); itTrig != m_technicalTriggerMap->end(); itTrig++) {
640  if ((itTrig->second).algoBitNumber() == bitNumber) {
641  nameL1Trigger = (itTrig->second).algoName();
642  // technically, no alias is defined for technical triggers
643  // users use mainly aliases, so just return the name here
644  aliasL1Trigger = itTrig->first;
645 
646  trigNameFound = true;
647  break;
648  }
649  }
650 
651  if (!(trigNameFound)) {
652  return false;
653  }
654 
655  return true;
656 
657  } else {
658  // non-existing trigger category...
659  return false;
660  }
661 
662  } else {
663  // L1 trigger configuration not retrieved
664  return false;
665  }
666 
667  // all possibilities already tested, so it should not arrive here
668  return false;
669 }
670 
672  const std::string& nameAlgoTechTrig,
673  bool& decisionBeforeMask,
674  bool& decisionAfterMask,
675  int& prescaleFactor,
676  int& triggerMask) const {
677  // initial values for returned results
678  decisionBeforeMask = false;
679  decisionAfterMask = false;
680  prescaleFactor = -1;
681  triggerMask = -1;
682 
683  // initialize error code and L1 configuration code
684  int iError = 0;
685  int l1ConfCode = 0;
686 
687  // check if L1 configuration is available
688 
689  if (!availableL1Configuration(iError, l1ConfCode)) {
690  return iError;
691  }
692 
693  // at this point, a valid L1 configuration is available, so the if/else if/else
694  // can be simplified
695 
696  // if the given name is not an algorithm trigger alias, an algorithm trigger name
697  // or a technical trigger in the current menu, return with error code 1
698 
699  TriggerCategory trigCategory = AlgorithmTrigger;
700  int bitNumber = -1;
701 
702  if (!l1AlgoTechTrigBitNumber(nameAlgoTechTrig, trigCategory, bitNumber)) {
703  iError = l1ConfCode + 1;
704 
706  if (m_l1GtMenuLiteValid) {
707  LogDebug("L1GtUtils") << "\nAlgorithm/technical trigger \n " << nameAlgoTechTrig
708  << "\not found in the trigger menu \n " << m_l1GtMenuLite->gtTriggerMenuImplementation()
709  << "\nretrieved from L1GtTriggerMenuLite" << std::endl;
710 
711  } else {
712  // fall through: L1 trigger configuration from event setup
713  LogDebug("L1GtUtils") << "\nAlgorithm/technical trigger \n " << nameAlgoTechTrig
714  << "\not found in the trigger menu \n " << m_l1GtMenu->gtTriggerMenuImplementation()
715  << "\nretrieved from Event Setup" << std::endl;
716  }
717 
718  } else {
719  // L1 trigger configuration from event setup only
720  LogDebug("L1GtUtils") << "\nAlgorithm/technical trigger \n " << nameAlgoTechTrig
721  << "\not found in the trigger menu \n " << m_l1GtMenu->gtTriggerMenuImplementation()
722  << "\nretrieved from Event Setup" << std::endl;
723  }
724 
725  return iError;
726  }
727 
728  // check here if a positive bit number was retrieved
729  // exit in case of negative bit number, before retrieving L1 GT products, saving time
730 
731  if (bitNumber < 0) {
732  iError = l1ConfCode + 2;
733 
735  if (m_l1GtMenuLiteValid) {
736  LogDebug("L1GtUtils") << "\nNegative bit number for " << triggerCategory(trigCategory) << "\n "
737  << nameAlgoTechTrig << "\nfrom menu \n " << m_l1GtMenuLite->gtTriggerMenuImplementation()
738  << "\nretrieved from L1GtTriggerMenuLite" << std::endl;
739 
740  } else {
741  // fall through: L1 trigger configuration from event setup
742  LogDebug("L1GtUtils") << "\nNegative bit number for " << triggerCategory(trigCategory) << "\n "
743  << nameAlgoTechTrig << "\nfrom menu \n " << m_l1GtMenu->gtTriggerMenuImplementation()
744  << "\nretrieved from Event Setup" << std::endl;
745  }
746 
747  } else {
748  // L1 trigger configuration from event setup only
749  LogDebug("L1GtUtils") << "\nNegative bit number for " << triggerCategory(trigCategory) << "\n "
750  << nameAlgoTechTrig << "\nfrom menu \n " << m_l1GtMenu->gtTriggerMenuImplementation()
751  << "\nretrieved from Event Setup" << std::endl;
752  }
753 
754  return iError;
755  }
756 
757  // retrieve L1GlobalTriggerRecord and 1GlobalTriggerReadoutRecord product
758  // intermediate error code for the records
759  // the module returns an error code only if both the lite and the readout record are missing
760 
761  int iErrorRecord = 0;
762 
763  bool validRecord = false;
764  bool gtReadoutRecordValid = false;
765 
767  if (!m_l1GtUtilsHelper->l1GtRecordToken().isUninitialized()) {
768  iEvent.getByToken(m_l1GtUtilsHelper->l1GtRecordToken(), gtRecord);
769  }
770  if (gtRecord.isValid()) {
771  validRecord = true;
772 
773  } else {
774  iErrorRecord = 10;
775  LogDebug("L1GtUtils") << "\nL1GlobalTriggerRecord with \n " << m_l1GtUtilsHelper->l1GtRecordInputTag()
776  << "\nnot found in the event." << std::endl;
777  }
778 
780  if (!m_l1GtUtilsHelper->l1GtReadoutRecordToken().isUninitialized()) {
781  iEvent.getByToken(m_l1GtUtilsHelper->l1GtReadoutRecordToken(), gtReadoutRecord);
782  }
783  if (gtReadoutRecord.isValid()) {
784  gtReadoutRecordValid = true;
785  validRecord = true;
786 
787  } else {
788  iErrorRecord = iErrorRecord + 100;
789  LogDebug("L1GtUtils") << "\nL1GlobalTriggerReadoutRecord with \n "
790  << m_l1GtUtilsHelper->l1GtReadoutRecordInputTag() << "\nnot found in the event." << std::endl;
791  }
792 
793  // get the prescale factor index from
794  // L1GlobalTriggerReadoutRecord if valid
795  // if not, from L1GlobalTriggerRecord if valid
796  // else return an error
797 
798  int pfIndexTechTrig = -1;
799  int pfIndexAlgoTrig = -1;
800 
801  if (validRecord) {
802  if (gtReadoutRecordValid) {
803  pfIndexTechTrig = (gtReadoutRecord->gtFdlWord()).gtPrescaleFactorIndexTech();
804  pfIndexAlgoTrig = (gtReadoutRecord->gtFdlWord()).gtPrescaleFactorIndexAlgo();
805 
806  } else {
807  pfIndexTechTrig = static_cast<int>(gtRecord->gtPrescaleFactorIndexTech());
808  pfIndexAlgoTrig = static_cast<int>(gtRecord->gtPrescaleFactorIndexAlgo());
809  }
810 
811  } else {
812  LogDebug("L1GtUtils") << "\nError: "
813  << "\nNo valid L1GlobalTriggerRecord with \n " << m_l1GtUtilsHelper->l1GtRecordInputTag()
814  << "\nfound in the event."
815  << "\nNo valid L1GlobalTriggerReadoutRecord with \n "
816  << m_l1GtUtilsHelper->l1GtReadoutRecordInputTag() << "\nfound in the event." << std::endl;
817 
818  iError = l1ConfCode + iErrorRecord;
819  return iError;
820  }
821 
822  // depending on trigger category (algorithm trigger or technical trigger)
823  // get the correct quantities
824 
825  // number of sets of prescale factors
826  // index of prescale factor set retrieved from data
827  // pointer to the actual prescale factor set
828  // pointer to the set of trigger masks
829 
830  size_t pfSetsSize = 0;
831  int pfIndex = -1;
832  const std::vector<int>* prescaleFactorsSubset = nullptr;
833  const std::vector<unsigned int>* triggerMasksSet = nullptr;
834 
835  switch (trigCategory) {
836  case AlgorithmTrigger: {
838  if (m_l1GtMenuLiteValid) {
839  pfSetsSize = m_prescaleFactorsAlgoTrigLite->size();
840  triggerMasksSet = m_triggerMaskAlgoTrigLite;
841 
842  } else {
843  // fall through: L1 trigger configuration from event setup
844  pfSetsSize = m_prescaleFactorsAlgoTrig->size();
845  triggerMasksSet = m_triggerMaskAlgoTrig;
846  }
847 
848  } else {
849  // L1 trigger configuration from event setup only
850  pfSetsSize = m_prescaleFactorsAlgoTrig->size();
851  triggerMasksSet = m_triggerMaskAlgoTrig;
852  }
853 
854  pfIndex = pfIndexAlgoTrig;
855 
856  } break;
857  case TechnicalTrigger: {
859  if (m_l1GtMenuLiteValid) {
860  pfSetsSize = m_prescaleFactorsTechTrigLite->size();
861  triggerMasksSet = m_triggerMaskTechTrigLite;
862 
863  } else {
864  // fall through: L1 trigger configuration from event setup
865  pfSetsSize = m_prescaleFactorsTechTrig->size();
866  triggerMasksSet = m_triggerMaskTechTrig;
867  }
868 
869  } else {
870  // L1 trigger configuration from event setup only
871  pfSetsSize = m_prescaleFactorsTechTrig->size();
872  triggerMasksSet = m_triggerMaskTechTrig;
873  }
874 
875  pfIndex = pfIndexTechTrig;
876 
877  } break;
878  default: {
879  // should not be the case
880  iError = l1ConfCode + iErrorRecord + 3;
881  return iError;
882 
883  } break;
884  }
885 
886  // test prescale factor set index correctness, then retrieve the actual set of prescale factors
887 
888  if (pfIndex < 0) {
889  iError = l1ConfCode + iErrorRecord + 1000;
890  LogDebug("L1GtUtils") << "\nError: index of prescale factor set retrieved from the data \n"
891  << "less than zero."
892  << "\n Value of index retrieved from data = " << pfIndex << std::endl;
893 
894  return iError;
895 
896  } else if (pfIndex >= (static_cast<int>(pfSetsSize))) {
897  iError = l1ConfCode + iErrorRecord + 2000;
898  LogDebug("L1GtUtils") << "\nError: index of prescale factor set retrieved from the data \n"
899  << "greater than the size of the vector of prescale factor sets."
900  << "\n Value of index retrieved from data = " << pfIndex
901  << "\n Vector size = " << pfSetsSize << std::endl;
902 
903  return iError;
904 
905  } else {
906  switch (trigCategory) {
907  case AlgorithmTrigger: {
909  if (m_l1GtMenuLiteValid) {
910  prescaleFactorsSubset = &((*m_prescaleFactorsAlgoTrigLite).at(pfIndex));
911 
912  } else {
913  // fall through: L1 trigger configuration from event setup
914  prescaleFactorsSubset = &((*m_prescaleFactorsAlgoTrig).at(pfIndex));
915  }
916 
917  } else {
918  // L1 trigger configuration from event setup only
919  prescaleFactorsSubset = &((*m_prescaleFactorsAlgoTrig).at(pfIndex));
920  }
921 
922  } break;
923  case TechnicalTrigger: {
925  if (m_l1GtMenuLiteValid) {
926  prescaleFactorsSubset = &((*m_prescaleFactorsTechTrigLite).at(pfIndex));
927 
928  } else {
929  // fall through: L1 trigger configuration from event setup
930  prescaleFactorsSubset = &((*m_prescaleFactorsTechTrig).at(pfIndex));
931  }
932 
933  } else {
934  // L1 trigger configuration from event setup only
935  prescaleFactorsSubset = &((*m_prescaleFactorsTechTrig).at(pfIndex));
936  }
937 
938  } break;
939  default: {
940  // do nothing - it was tested before, with return
941 
942  } break;
943  }
944  }
945 
946  // algorithm result before applying the trigger masks
947  // the bit number is positive (tested previously)
948 
949  switch (trigCategory) {
950  case AlgorithmTrigger: {
951  if (gtReadoutRecordValid) {
952  const DecisionWord& decWord = gtReadoutRecord->decisionWord();
953  decisionBeforeMask = trigResult(decWord, bitNumber, nameAlgoTechTrig, trigCategory, iError);
954  if (iError) {
955  return (iError + l1ConfCode + iErrorRecord);
956  }
957 
958  } else {
959  const DecisionWord& decWord = gtRecord->decisionWordBeforeMask();
960  decisionBeforeMask = trigResult(decWord, bitNumber, nameAlgoTechTrig, trigCategory, iError);
961  if (iError) {
962  return (iError + l1ConfCode + iErrorRecord);
963  }
964  }
965 
966  } break;
967  case TechnicalTrigger: {
968  if (gtReadoutRecordValid) {
969  const DecisionWord& decWord = gtReadoutRecord->technicalTriggerWord();
970  decisionBeforeMask = trigResult(decWord, bitNumber, nameAlgoTechTrig, trigCategory, iError);
971  if (iError) {
972  return (iError + l1ConfCode + iErrorRecord);
973  }
974 
975  } else {
976  const DecisionWord& decWord = gtRecord->technicalTriggerWordBeforeMask();
977  decisionBeforeMask = trigResult(decWord, bitNumber, nameAlgoTechTrig, trigCategory, iError);
978  if (iError) {
979  return (iError + l1ConfCode + iErrorRecord);
980  }
981  }
982 
983  } break;
984  default: {
985  // do nothing - it was tested before, with return
986 
987  } break;
988  }
989 
990  // prescale factor
991  // the bit number is positive (tested previously)
992 
993  if (bitNumber < (static_cast<int>(prescaleFactorsSubset->size()))) {
994  prescaleFactor = (*prescaleFactorsSubset)[bitNumber];
995  } else {
996  iError = l1ConfCode + iErrorRecord + 4000;
997  LogDebug("L1GtUtils") << "\nError: bit number " << bitNumber << " retrieved for " << triggerCategory(trigCategory)
998  << "\n " << nameAlgoTechTrig << "\ngreater than size of actual L1 GT prescale factor set: "
999  << prescaleFactorsSubset->size() << "\nError: Inconsistent L1 trigger configuration!"
1000  << std::endl;
1001 
1002  return iError;
1003  }
1004 
1005  // trigger mask and trigger result after applying the trigger masks
1006 
1007  if (bitNumber < (static_cast<int>((*triggerMasksSet).size()))) {
1009  if (m_l1GtMenuLiteValid) {
1010  triggerMask = (*triggerMasksSet)[bitNumber];
1011 
1012  } else {
1013  // fall through: L1 trigger configuration from event setup
1014  // masks in event setup are for all partitions
1015  triggerMask = ((*triggerMasksSet)[bitNumber]) & (1 << m_physicsDaqPartition);
1016  }
1017 
1018  } else {
1019  // L1 trigger configuration from event setup only
1020  // masks in event setup are for all partitions
1021  triggerMask = ((*triggerMasksSet)[bitNumber]) & (1 << m_physicsDaqPartition);
1022  }
1023 
1024  } else {
1025  iError = l1ConfCode + iErrorRecord + 5000;
1026  LogDebug("L1GtUtils") << "\nError: bit number " << bitNumber << " retrieved for " << triggerCategory(trigCategory)
1027  << "\n " << nameAlgoTechTrig
1028  << "\ngreater than size of L1 GT trigger mask set: " << (*triggerMasksSet).size()
1029  << "\nError: Inconsistent L1 trigger configuration!" << std::endl;
1030 
1031  return iError;
1032  }
1033 
1035 
1036  if (triggerMask) {
1037  decisionAfterMask = false;
1038  }
1039 
1040  return iError;
1041 }
1042 
1044  const std::string& nameAlgoTechTrig,
1045  int& errorCode) const {
1046  // initial values
1047  bool decisionBeforeMask = false;
1048  bool decisionAfterMask = false;
1049  int prescaleFactor = -1;
1050  int triggerMask = -1;
1051 
1053 
1054  return decisionBeforeMask;
1055 }
1056 
1058  const std::string& nameAlgoTechTrig,
1059  int& errorCode) const {
1060  // initial values
1061  bool decisionBeforeMask = false;
1062  bool decisionAfterMask = false;
1063  int prescaleFactor = -1;
1064  int triggerMask = -1;
1065 
1067 
1068  return decisionAfterMask;
1069 }
1070 
1071 const bool L1GtUtils::decision(const edm::Event& iEvent, const std::string& nameAlgoTechTrig, int& errorCode) const {
1072  // initial values
1073  bool decisionBeforeMask = false;
1074  bool decisionAfterMask = false;
1075  int prescaleFactor = -1;
1076  int triggerMask = -1;
1077 
1079 
1080  return decisionAfterMask;
1081 }
1082 
1084  const std::string& nameAlgoTechTrig,
1085  int& errorCode) const {
1086  // initial values
1087  bool decisionBeforeMask = false;
1088  bool decisionAfterMask = false;
1089  int prescaleFactor = -1;
1090  int triggerMask = -1;
1091 
1093 
1094  return prescaleFactor;
1095 }
1096 
1097 const int L1GtUtils::triggerMask(const edm::Event& iEvent, const std::string& nameAlgoTechTrig, int& errorCode) const {
1098  // initial values
1099  bool decisionBeforeMask = false;
1100  bool decisionAfterMask = false;
1101  int prescaleFactor = -1;
1102  int triggerMask = -1;
1103 
1105 
1106  return triggerMask;
1107 }
1108 
1109 const int L1GtUtils::triggerMask(const std::string& nameAlgoTechTrig, int& errorCode) const {
1110  // initial values for returned results
1111  int triggerMaskValue = -1;
1112 
1113  // initialize error code and L1 configuration code
1114  int iError = 0;
1115  int l1ConfCode = 0;
1116 
1117  // check if L1 configuration is available
1118 
1119  if (!availableL1Configuration(iError, l1ConfCode)) {
1120  errorCode = iError;
1121  return triggerMaskValue;
1122  }
1123 
1124  // at this point, a valid L1 configuration is available, so the if/else if/else
1125  // can be simplified
1126 
1127  // if the given name is not an algorithm trigger alias, an algorithm trigger name
1128  // or a technical trigger in the current menu, return with error code 1
1129 
1130  TriggerCategory trigCategory = AlgorithmTrigger;
1131  int bitNumber = -1;
1132 
1133  if (!l1AlgoTechTrigBitNumber(nameAlgoTechTrig, trigCategory, bitNumber)) {
1134  iError = l1ConfCode + 1;
1135 
1137  if (m_l1GtMenuLiteValid) {
1138  LogDebug("L1GtUtils") << "\nAlgorithm/technical trigger \n " << nameAlgoTechTrig
1139  << "\not found in the trigger menu \n " << m_l1GtMenuLite->gtTriggerMenuImplementation()
1140  << "\nretrieved from L1GtTriggerMenuLite" << std::endl;
1141 
1142  } else {
1143  // fall through: L1 trigger configuration from event setup
1144  LogDebug("L1GtUtils") << "\nAlgorithm/technical trigger \n " << nameAlgoTechTrig
1145  << "\not found in the trigger menu \n " << m_l1GtMenu->gtTriggerMenuImplementation()
1146  << "\nretrieved from Event Setup" << std::endl;
1147  }
1148 
1149  } else {
1150  // L1 trigger configuration from event setup only
1151  LogDebug("L1GtUtils") << "\nAlgorithm/technical trigger \n " << nameAlgoTechTrig
1152  << "\not found in the trigger menu \n " << m_l1GtMenu->gtTriggerMenuImplementation()
1153  << "\nretrieved from Event Setup" << std::endl;
1154  }
1155 
1156  errorCode = iError;
1157  return triggerMaskValue;
1158  }
1159 
1160  // check here if a positive bit number was retrieved
1161  // exit in case of negative bit number, before retrieving L1 GT products, saving time
1162 
1163  if (bitNumber < 0) {
1164  iError = l1ConfCode + 2;
1165 
1167  if (m_l1GtMenuLiteValid) {
1168  LogDebug("L1GtUtils") << "\nNegative bit number for " << triggerCategory(trigCategory) << "\n "
1169  << nameAlgoTechTrig << "\nfrom menu \n " << m_l1GtMenuLite->gtTriggerMenuImplementation()
1170  << "\nretrieved from L1GtTriggerMenuLite" << std::endl;
1171 
1172  } else {
1173  // fall through: L1 trigger configuration from event setup
1174  LogDebug("L1GtUtils") << "\nNegative bit number for " << triggerCategory(trigCategory) << "\n "
1175  << nameAlgoTechTrig << "\nfrom menu \n " << m_l1GtMenu->gtTriggerMenuImplementation()
1176  << "\nretrieved from Event Setup" << std::endl;
1177  }
1178 
1179  } else {
1180  // L1 trigger configuration from event setup only
1181  LogDebug("L1GtUtils") << "\nNegative bit number for " << triggerCategory(trigCategory) << "\n "
1182  << nameAlgoTechTrig << "\nfrom menu \n " << m_l1GtMenu->gtTriggerMenuImplementation()
1183  << "\nretrieved from Event Setup" << std::endl;
1184  }
1185 
1186  errorCode = iError;
1187  return triggerMaskValue;
1188  }
1189 
1190  // depending on trigger category (algorithm trigger or technical trigger)
1191  // get the correct quantities
1192 
1193  // pointer to the set of trigger masks
1194 
1195  const std::vector<unsigned int>* triggerMasksSet = nullptr;
1196 
1197  switch (trigCategory) {
1198  case AlgorithmTrigger: {
1200  if (m_l1GtMenuLiteValid) {
1201  triggerMasksSet = m_triggerMaskAlgoTrigLite;
1202 
1203  } else {
1204  // fall through: L1 trigger configuration from event setup
1205  triggerMasksSet = m_triggerMaskAlgoTrig;
1206  }
1207 
1208  } else {
1209  // L1 trigger configuration from event setup only
1210  triggerMasksSet = m_triggerMaskAlgoTrig;
1211  }
1212 
1213  } break;
1214  case TechnicalTrigger: {
1216  if (m_l1GtMenuLiteValid) {
1217  triggerMasksSet = m_triggerMaskTechTrigLite;
1218 
1219  } else {
1220  // fall through: L1 trigger configuration from event setup
1221  triggerMasksSet = m_triggerMaskTechTrig;
1222  }
1223 
1224  } else {
1225  // L1 trigger configuration from event setup only
1226  triggerMasksSet = m_triggerMaskTechTrig;
1227  }
1228 
1229  } break;
1230  default: {
1231  // should not be the case
1232  iError = l1ConfCode + 3;
1233 
1234  errorCode = iError;
1235  return triggerMaskValue;
1236 
1237  } break;
1238  }
1239 
1240  // trigger mask
1241 
1242  if (bitNumber < (static_cast<int>((*triggerMasksSet).size()))) {
1244  if (m_l1GtMenuLiteValid) {
1245  triggerMaskValue = (*triggerMasksSet)[bitNumber];
1246 
1247  } else {
1248  // fall through: L1 trigger configuration from event setup
1249  // masks in event setup are for all partitions
1250  triggerMaskValue = ((*triggerMasksSet)[bitNumber]) & (1 << m_physicsDaqPartition);
1251  }
1252 
1253  } else {
1254  // L1 trigger configuration from event setup only
1255  // masks in event setup are for all partitions
1256  triggerMaskValue = ((*triggerMasksSet)[bitNumber]) & (1 << m_physicsDaqPartition);
1257  }
1258 
1259  } else {
1260  iError = l1ConfCode + 5000;
1261  LogDebug("L1GtUtils") << "\nError: bit number " << bitNumber << " retrieved for " << triggerCategory(trigCategory)
1262  << "\n " << nameAlgoTechTrig
1263  << "\ngreater than size of L1 GT trigger mask set: " << (*triggerMasksSet).size()
1264  << "\nError: Inconsistent L1 trigger configuration!" << std::endl;
1265 
1266  errorCode = iError;
1267  return triggerMaskValue;
1268  }
1269 
1270  errorCode = iError;
1271  return triggerMaskValue;
1272 }
1273 
1275  const TriggerCategory& trigCategory,
1276  int& errorCode) const {
1277  // initialize the index to a negative value
1278  int pfIndex = -1;
1279 
1280  // initialize error code and L1 configuration code
1281  int iError = 0;
1282  int l1ConfCode = 0;
1283 
1284  // check if L1 configuration is available
1285 
1286  if (!availableL1Configuration(iError, l1ConfCode)) {
1287  errorCode = iError;
1288  return pfIndex;
1289  }
1290 
1291  // at this point, a valid L1 configuration is available, so the if/else if/else
1292  // can be simplified
1293 
1294  // retrieve L1GlobalTriggerRecord and 1GlobalTriggerReadoutRecord product
1295  // intermediate error code for the records
1296  // the module returns an error code only if both the lite and the readout record are missing
1297 
1298  int iErrorRecord = 0;
1299 
1300  bool validRecord = false;
1301  bool gtReadoutRecordValid = false;
1302 
1304  if (!m_l1GtUtilsHelper->l1GtRecordToken().isUninitialized()) {
1305  iEvent.getByToken(m_l1GtUtilsHelper->l1GtRecordToken(), gtRecord);
1306  }
1307  if (gtRecord.isValid()) {
1308  validRecord = true;
1309 
1310  } else {
1311  iErrorRecord = 10;
1312  LogDebug("L1GtUtils") << "\nL1GlobalTriggerRecord with \n " << m_l1GtUtilsHelper->l1GtRecordInputTag()
1313  << "\nnot found in the event." << std::endl;
1314  }
1315 
1317  if (!m_l1GtUtilsHelper->l1GtReadoutRecordToken().isUninitialized()) {
1318  iEvent.getByToken(m_l1GtUtilsHelper->l1GtReadoutRecordToken(), gtReadoutRecord);
1319  }
1320  if (gtReadoutRecord.isValid()) {
1321  gtReadoutRecordValid = true;
1322  validRecord = true;
1323 
1324  } else {
1325  iErrorRecord = iErrorRecord + 100;
1326  LogDebug("L1GtUtils") << "\nL1GlobalTriggerReadoutRecord with \n "
1327  << m_l1GtUtilsHelper->l1GtReadoutRecordInputTag() << "\nnot found in the event." << std::endl;
1328  }
1329 
1330  // get the prescale factor index from
1331  // L1GlobalTriggerReadoutRecord if valid
1332  // if not, from L1GlobalTriggerRecord if valid
1333  // else return an error
1334 
1335  int pfIndexTechTrig = -1;
1336  int pfIndexAlgoTrig = -1;
1337 
1338  if (validRecord) {
1339  if (gtReadoutRecordValid) {
1340  pfIndexTechTrig = (gtReadoutRecord->gtFdlWord()).gtPrescaleFactorIndexTech();
1341  pfIndexAlgoTrig = (gtReadoutRecord->gtFdlWord()).gtPrescaleFactorIndexAlgo();
1342 
1343  } else {
1344  pfIndexTechTrig = static_cast<int>(gtRecord->gtPrescaleFactorIndexTech());
1345  pfIndexAlgoTrig = static_cast<int>(gtRecord->gtPrescaleFactorIndexAlgo());
1346  }
1347 
1348  } else {
1349  LogDebug("L1GtUtils") << "\nError: "
1350  << "\nNo valid L1GlobalTriggerRecord with \n " << m_l1GtUtilsHelper->l1GtRecordInputTag()
1351  << "\nfound in the event."
1352  << "\nNo valid L1GlobalTriggerReadoutRecord with \n "
1353  << m_l1GtUtilsHelper->l1GtReadoutRecordInputTag() << "\nfound in the event." << std::endl;
1354 
1355  iError = l1ConfCode + iErrorRecord;
1356 
1357  errorCode = iError;
1358  return pfIndex;
1359  }
1360 
1361  // depending on trigger category (algorithm trigger or technical trigger)
1362  // get the correct quantities
1363 
1364  // number of sets of prescale factors
1365  // index of prescale factor set retrieved from data
1366  // pointer to the actual prescale factor set
1367  // pointer to the set of trigger masks
1368 
1369  size_t pfSetsSize = 0;
1370 
1371  switch (trigCategory) {
1372  case AlgorithmTrigger: {
1374  if (m_l1GtMenuLiteValid) {
1375  pfSetsSize = m_prescaleFactorsAlgoTrigLite->size();
1376 
1377  } else {
1378  // fall through: L1 trigger configuration from event setup
1379  pfSetsSize = m_prescaleFactorsAlgoTrig->size();
1380  }
1381 
1382  } else {
1383  // L1 trigger configuration from event setup only
1384  pfSetsSize = m_prescaleFactorsAlgoTrig->size();
1385  }
1386 
1387  pfIndex = pfIndexAlgoTrig;
1388 
1389  } break;
1390  case TechnicalTrigger: {
1392  if (m_l1GtMenuLiteValid) {
1393  pfSetsSize = m_prescaleFactorsTechTrigLite->size();
1394 
1395  } else {
1396  // fall through: L1 trigger configuration from event setup
1397  pfSetsSize = m_prescaleFactorsTechTrig->size();
1398  }
1399 
1400  } else {
1401  // L1 trigger configuration from event setup only
1402  pfSetsSize = m_prescaleFactorsTechTrig->size();
1403  }
1404 
1405  pfIndex = pfIndexTechTrig;
1406 
1407  } break;
1408  default: {
1409  // should not be the case
1410  iError = l1ConfCode + iErrorRecord + 3;
1411  return iError;
1412 
1413  } break;
1414  }
1415 
1416  // test prescale factor set index correctness, then retrieve the actual set of prescale factors
1417 
1418  if (pfIndex < 0) {
1419  iError = l1ConfCode + iErrorRecord + 1000;
1420  LogDebug("L1GtUtils") << "\nError: index of prescale factor set retrieved from the data \n"
1421  << "less than zero."
1422  << "\n Value of index retrieved from data = " << pfIndex << std::endl;
1423 
1424  errorCode = iError;
1425  return pfIndex;
1426 
1427  } else if (pfIndex >= (static_cast<int>(pfSetsSize))) {
1428  iError = l1ConfCode + iErrorRecord + 2000;
1429  LogDebug("L1GtUtils") << "\nError: index of prescale factor set retrieved from the data \n"
1430  << "greater than the size of the vector of prescale factor sets."
1431  << "\n Value of index retrieved from data = " << pfIndex
1432  << "\n Vector size = " << pfSetsSize << std::endl;
1433 
1434  errorCode = iError;
1435  return pfIndex;
1436 
1437  } else {
1438  errorCode = iError;
1439  return pfIndex;
1440  }
1441 
1442  errorCode = iError;
1443  return pfIndex;
1444 }
1445 
1446 const std::vector<int>& L1GtUtils::prescaleFactorSet(const edm::Event& iEvent,
1447  const TriggerCategory& trigCategory,
1448  int& errorCode) {
1449  // clear the vector before filling it
1450  m_prescaleFactorSet.clear();
1451 
1452  // initialize error code
1453  int iError = 0;
1454 
1455  const int pfIndex = prescaleFactorSetIndex(iEvent, trigCategory, iError);
1456 
1457  if (iError == 0) {
1458  switch (trigCategory) {
1459  case AlgorithmTrigger: {
1461  if (m_l1GtMenuLiteValid) {
1462  m_prescaleFactorSet = (*m_prescaleFactorsAlgoTrigLite).at(pfIndex);
1463 
1464  } else {
1465  // fall through: L1 trigger configuration from event setup
1466  m_prescaleFactorSet = (*m_prescaleFactorsAlgoTrig).at(pfIndex);
1467  }
1468 
1469  } else {
1470  // L1 trigger configuration from event setup only
1471  m_prescaleFactorSet = (*m_prescaleFactorsAlgoTrig).at(pfIndex);
1472  }
1473 
1474  } break;
1475  case TechnicalTrigger: {
1477  if (m_l1GtMenuLiteValid) {
1478  m_prescaleFactorSet = (*m_prescaleFactorsTechTrigLite).at(pfIndex);
1479 
1480  } else {
1481  // fall through: L1 trigger configuration from event setup
1482  m_prescaleFactorSet = (*m_prescaleFactorsTechTrig).at(pfIndex);
1483  }
1484 
1485  } else {
1486  // L1 trigger configuration from event setup only
1487  m_prescaleFactorSet = (*m_prescaleFactorsTechTrig).at(pfIndex);
1488  }
1489 
1490  } break;
1491  default: {
1492  // do nothing - it was tested before, with return
1493 
1494  } break;
1495  }
1496  }
1497 
1498  errorCode = iError;
1499  return m_prescaleFactorSet;
1500 }
1501 
1502 const std::vector<unsigned int>& L1GtUtils::triggerMaskSet(const TriggerCategory& trigCategory, int& errorCode) {
1503  // clear the vector before filling it
1504  m_triggerMaskSet.clear();
1505 
1506  // initialize error code and L1 configuration code
1507  int iError = 0;
1508  int l1ConfCode = 0;
1509 
1510  // check if L1 configuration is available
1511 
1512  if (!availableL1Configuration(iError, l1ConfCode)) {
1513  errorCode = iError;
1514  return m_triggerMaskSet;
1515  }
1516 
1517  // at this point, a valid L1 configuration is available, so the if/else if/else
1518  // can be simplified
1519 
1520  // depending on trigger category (algorithm trigger or technical trigger)
1521  // get the correct quantities
1522 
1523  // pointer to the set of trigger masks
1524 
1525  switch (trigCategory) {
1526  case AlgorithmTrigger: {
1528  // L1GtTriggerMenuLite has masks for physics partition only
1529  // avoid copy to m_triggerMaskSet, return directly m_triggerMaskAlgoTrigLite
1530  if (m_l1GtMenuLiteValid) {
1531  errorCode = iError;
1532  return (*m_triggerMaskAlgoTrigLite);
1533 
1534  } else {
1535  // fall through: L1 trigger configuration from event setup
1536  for (unsigned i = 0; i < m_triggerMaskAlgoTrig->size(); i++) {
1538  }
1539  }
1540 
1541  } else {
1542  // L1 trigger configuration from event setup only
1543  for (unsigned i = 0; i < m_triggerMaskAlgoTrig->size(); i++) {
1545  }
1546  }
1547  } break;
1548  case TechnicalTrigger: {
1550  if (m_l1GtMenuLiteValid) {
1551  errorCode = iError;
1552  return (*m_triggerMaskTechTrigLite);
1553 
1554  } else {
1555  // fall through: L1 trigger configuration from event setup
1556  for (unsigned i = 0; i < m_triggerMaskTechTrig->size(); i++) {
1558  }
1559  }
1560 
1561  } else {
1562  // L1 trigger configuration from event setup only
1563  for (unsigned i = 0; i < m_triggerMaskTechTrig->size(); i++) {
1565  }
1566  }
1567  } break;
1568  default: {
1569  // should not be the case
1570  iError = l1ConfCode + 3;
1571 
1572  errorCode = iError;
1573  return m_triggerMaskSet;
1574 
1575  } break;
1576  }
1577 
1578  errorCode = iError;
1579  return m_triggerMaskSet;
1580 }
1581 
1584  if (m_l1GtMenuLiteValid) {
1586 
1587  } else if (m_retrieveL1EventSetup) {
1588  return m_l1GtMenu->gtTriggerMenuName();
1589 
1590  } else {
1591  // only L1GtTriggerMenuLite requested, but it is not valid
1592  return EmptyString;
1593  }
1594  } else if (m_retrieveL1EventSetup) {
1595  return m_l1GtMenu->gtTriggerMenuName();
1596 
1597  } else {
1598  // L1 trigger configuration not retrieved
1599  return EmptyString;
1600  }
1601 }
1602 
1605  if (m_l1GtMenuLiteValid) {
1607 
1608  } else if (m_retrieveL1EventSetup) {
1610 
1611  } else {
1612  // only L1GtTriggerMenuLite requested, but it is not valid
1613  return EmptyString;
1614  }
1615  } else if (m_retrieveL1EventSetup) {
1617 
1618  } else {
1619  // L1 trigger configuration not retrieved
1620  return EmptyString;
1621  }
1622 }
1623 
1625  // initialize error code and return value
1626  int iError = 0;
1627  int l1ConfCode = 0;
1628 
1629  // check if L1 configuration is available
1630 
1631  if (!availableL1Configuration(iError, l1ConfCode)) {
1632  errorCode = iError;
1633  return nullptr;
1634  }
1635 
1636  if (m_retrieveL1EventSetup) {
1637  errorCode = iError;
1638  return m_l1GtMenu;
1639  } else {
1640  iError = l1ConfCode;
1641 
1642  errorCode = iError;
1643  return nullptr;
1644  }
1645 
1646  errorCode = iError;
1647  return m_l1GtMenu;
1648 }
1649 
1651  // initialize error code and return value
1652  int iError = 0;
1653  int l1ConfCode = 0;
1654 
1655  // check if L1 configuration is available
1656 
1657  if (!availableL1Configuration(iError, l1ConfCode)) {
1658  errorCode = iError;
1659  return nullptr;
1660  }
1661 
1663  if (m_l1GtMenuLiteValid) {
1664  errorCode = iError;
1665  return m_l1GtMenuLite;
1666 
1667  } else {
1668  iError = l1ConfCode;
1669 
1670  errorCode = iError;
1671  return nullptr;
1672  }
1673  } else {
1674  iError = l1ConfCode;
1675 
1676  errorCode = iError;
1677  return nullptr;
1678  }
1679 
1680  errorCode = iError;
1681  return m_l1GtMenuLite;
1682 }
1683 
1684 const bool L1GtUtils::availableL1Configuration(int& errorCode, int& l1ConfCode) const {
1686  if (!m_retrieveL1EventSetup) {
1687  LogDebug("L1GtUtils") << "\nRetrieve L1 trigger configuration from L1GtTriggerMenuLite only.\n" << std::endl;
1688  l1ConfCode = 0;
1689  } else {
1690  LogDebug("L1GtUtils") << "\nFall through: retrieve L1 trigger configuration from L1GtTriggerMenuLite."
1691  << "\nIf L1GtTriggerMenuLite not valid, try to retrieve from event setup.\n"
1692  << std::endl;
1693  l1ConfCode = 100000;
1694  }
1695 
1696  if (m_l1GtMenuLiteValid) {
1697  LogDebug("L1GtUtils") << "\nRetrieve L1 trigger configuration from L1GtTriggerMenuLite, valid product.\n"
1698  << std::endl;
1699  l1ConfCode = l1ConfCode + 10000;
1700  errorCode = 0;
1701 
1702  return true;
1703 
1704  } else if (m_retrieveL1EventSetup) {
1705  if (m_l1EventSetupValid) {
1706  LogDebug("L1GtUtils") << "\nFall through: retrieve L1 trigger configuration from event setup."
1707  << "\nFirst option was L1GtTriggerMenuLite - but product is not valid.\n"
1708  << std::endl;
1709  l1ConfCode = l1ConfCode + 20000;
1710  errorCode = 0;
1711 
1712  return true;
1713 
1714  } else {
1715  LogDebug("L1GtUtils") << "\nFall through: L1GtTriggerMenuLite not valid, event setup not valid.\n" << std::endl;
1716  l1ConfCode = l1ConfCode + L1GtNotValidError;
1717  errorCode = l1ConfCode;
1718 
1719  return false;
1720  }
1721 
1722  } else {
1723  LogDebug("L1GtUtils") << "\nError: L1 trigger configuration requested from L1GtTriggerMenuLite only"
1724  << "\nbut L1GtTriggerMenuLite is not valid.\n"
1725  << std::endl;
1726  l1ConfCode = l1ConfCode + L1GtNotValidError;
1727  errorCode = l1ConfCode;
1728 
1729  return false;
1730  }
1731  } else if (m_retrieveL1EventSetup) {
1732  LogDebug("L1GtUtils") << "\nRetrieve L1 trigger configuration from event setup."
1733  << "\nL1GtTriggerMenuLite product was not requested.\n"
1734  << std::endl;
1735  l1ConfCode = 200000;
1736 
1737  if (m_l1EventSetupValid) {
1738  LogDebug("L1GtUtils") << "\nRetrieve L1 trigger configuration from event setup only."
1739  << "\nValid L1 trigger event setup.\n"
1740  << std::endl;
1741  l1ConfCode = l1ConfCode + 10000;
1742  errorCode = 0;
1743 
1744  return true;
1745 
1746  } else {
1747  LogDebug("L1GtUtils") << "\nRetrieve L1 trigger configuration from event setup only."
1748  << "\nNo valid L1 trigger event setup.\n"
1749  << std::endl;
1750  l1ConfCode = l1ConfCode + L1GtNotValidError;
1751  errorCode = l1ConfCode;
1752 
1753  return false;
1754  }
1755 
1756  } else {
1757  LogDebug("L1GtUtils") << "\nError: no L1 trigger configuration requested to be retrieved."
1758  << "\nMust call before getL1GtRunCache in beginRun and analyze.\n"
1759  << std::endl;
1760  l1ConfCode = 300000;
1761  errorCode = l1ConfCode;
1762 
1763  return false;
1764  }
1765 }
1766 
1767 // private methods
1768 
1769 const bool L1GtUtils::trigResult(const DecisionWord& decWord,
1770  const int bitNumber,
1771  const std::string& nameAlgoTechTrig,
1772  const TriggerCategory& trigCategory,
1773  int& errorCode) const {
1774  bool trigRes = false;
1775  errorCode = 0;
1776 
1777  if (bitNumber < (static_cast<int>(decWord.size()))) {
1778  trigRes = decWord[bitNumber];
1779  } else {
1780  errorCode = 3000;
1781  LogDebug("L1GtUtils") << "\nError: bit number " << bitNumber << " retrieved for " << triggerCategory(trigCategory)
1782  << "\n " << nameAlgoTechTrig
1783  << "\ngreater than size of L1 GT decision word: " << decWord.size()
1784  << "\nError: Inconsistent L1 trigger configuration!" << std::endl;
1785  }
1786 
1787  return trigRes;
1788 }
1789 
1791  :
1792 
1793  m_logicalExpression(expression),
1794 
1795  m_l1GtUtils(l1GtUtils),
1796 
1797  m_l1ConfCode(-1),
1798 
1799  m_validL1Configuration(false),
1800 
1801  m_validLogicalExpression(false),
1802 
1803  m_l1ResultsAlreadyCalled(false),
1804 
1805  m_expL1TriggersSize(0),
1806 
1807  m_expBitsTechTrigger(false) {
1808  initialize();
1809 }
1810 
1811 // destructor
1813  // empty
1814 }
1815 
1817  // get the vector of triggers corresponding to the logical expression
1818  // check also the logical expression - add/remove spaces if needed
1819 
1820  try {
1821  L1GtLogicParser m_l1AlgoLogicParser = L1GtLogicParser(m_logicalExpression);
1822 
1823  // list of L1 triggers from the logical expression
1824  m_expL1Triggers = m_l1AlgoLogicParser.operandTokenVector();
1825  m_expL1TriggersSize = m_expL1Triggers.size();
1826 
1827  m_validLogicalExpression = true;
1828 
1829  } catch (cms::Exception& ex) {
1830  m_validLogicalExpression = false;
1831 
1832  edm::LogWarning("L1GtUtils") << ex;
1833  edm::LogWarning("L1GtUtils") << ex.what();
1834  edm::LogWarning("L1GtUtils") << ex.explainSelf();
1835  }
1836 
1837  // try to convert the string representing each L1 trigger to bit number,
1838  // to check if the logical expression is constructed from bit numbers
1839  // trade-off: cache it here, irrespective of the expression
1840  // when the conversion fails (normally for the first seed,
1841  // if not expression of technical trigger bits), stop and
1842  // set m_expBitsTechTrigger to false
1843 
1844  m_expBitsTechTrigger = true;
1845 
1846  for (size_t iTrig = 0; iTrig < m_expL1TriggersSize; ++iTrig) {
1847  const std::string& bitString = (m_expL1Triggers[iTrig]).tokenName;
1848  std::istringstream bitStream(bitString);
1849  int bitInt;
1850 
1851  if ((bitStream >> bitInt).fail()) {
1852  m_expBitsTechTrigger = false;
1853 
1854  break;
1855  }
1856 
1857  (m_expL1Triggers[iTrig]).tokenNumber = bitInt;
1858  }
1859 
1860  // resize and fill
1861  m_decisionsBeforeMask.resize(m_expL1TriggersSize);
1862  m_decisionsAfterMask.resize(m_expL1TriggersSize);
1863  m_prescaleFactors.resize(m_expL1TriggersSize);
1864  m_triggerMasks.resize(m_expL1TriggersSize);
1865  m_errorCodes.resize(m_expL1TriggersSize);
1866  m_expTriggerCategory.resize(m_expL1TriggersSize);
1867  m_expTriggerInMenu.resize(m_expL1TriggersSize);
1868 
1869  LogDebug("L1GtUtils") << std::endl;
1870  LogTrace("L1GtUtils") << "\nLogical expression\n " << m_logicalExpression << "\n has " << m_expL1TriggersSize
1871  << " L1 triggers" << std::endl;
1872  for (size_t iTrig = 0; iTrig < m_expL1TriggersSize; ++iTrig) {
1873  const std::string& trigNameOrAlias = (m_expL1Triggers[iTrig]).tokenName;
1874  LogTrace("L1GtUtils") << " " << trigNameOrAlias << std::endl;
1875 
1876  (m_decisionsBeforeMask[iTrig]).first = trigNameOrAlias;
1877  (m_decisionsBeforeMask[iTrig]).second = false;
1878 
1879  (m_decisionsAfterMask[iTrig]).first = trigNameOrAlias;
1880  (m_decisionsAfterMask[iTrig]).second = false;
1881 
1882  (m_prescaleFactors[iTrig]).first = trigNameOrAlias;
1883  (m_prescaleFactors[iTrig]).second = -1;
1884 
1885  (m_triggerMasks[iTrig]).first = trigNameOrAlias;
1886  (m_triggerMasks[iTrig]).second = -1;
1887 
1888  (m_errorCodes[iTrig]).first = trigNameOrAlias;
1889  (m_errorCodes[iTrig]).second = -1;
1890 
1891  m_expTriggerCategory[iTrig] = L1GtUtils::AlgorithmTrigger;
1892 
1893  m_expTriggerInMenu[iTrig] = false;
1894  }
1895  LogTrace("L1GtUtils") << std::endl;
1896 
1897  return true;
1898 }
1899 
1901  const edm::EventSetup& evSetup,
1902  const std::string& logicExpression) {
1903  // initialize error code
1904  int errorCode = 0;
1905 
1906  // logical expression has changed - one must re-initialize all quantities related to the logical expression
1907  // and clear the vectors
1908 
1909  m_logicalExpression = logicExpression;
1910  m_validLogicalExpression = false;
1911 
1912  m_l1ResultsAlreadyCalled = false;
1913 
1914  m_expL1TriggersSize = 0;
1915  m_expBitsTechTrigger = false;
1916 
1917  //
1918  m_decisionsBeforeMask.clear();
1919  m_decisionsAfterMask.clear();
1920  m_prescaleFactors.clear();
1921  m_triggerMasks.clear();
1922  m_errorCodes.clear();
1923  m_expTriggerCategory.clear();
1924  m_expTriggerInMenu.clear();
1925 
1926  initialize();
1927 
1928  //
1929  errorCode = logicalExpressionRunUpdate(iRun, evSetup);
1930 
1931  return errorCode;
1932 }
1933 
1935  const edm::EventSetup& evSetup) {
1936  // check first that a valid L1 configuration was retrieved,
1937  // to prevent also calls before the L1 configuration retrieval
1938 
1939  // initialize error code and L1 configuration code
1940  int errorCode = 0;
1941  int l1ConfCode = 0;
1942 
1943  if (!(m_l1GtUtils.availableL1Configuration(errorCode, l1ConfCode))) {
1944  m_validL1Configuration = false;
1945  return errorCode;
1946  } else {
1947  m_validL1Configuration = true;
1948  m_l1ConfCode = l1ConfCode;
1949  }
1950 
1951  // check if the trigger (name of alias) from the logical expression are in the menu,
1952  // if names are used, set tokenNumber to the corresponding bit number
1953  // if technical trigger bits, set tokenName to the corresponding technical trigger name, if
1954  // a technical trigger exists on that bit
1955  // for each trigger, set also the trigger category
1956 
1957  // initialization
1959  int bitNumber = -1;
1960 
1961  for (size_t iTrig = 0; iTrig < m_expL1TriggersSize; ++iTrig) {
1962  trigCategory = L1GtUtils::AlgorithmTrigger;
1963  bitNumber = -1;
1964  const std::string& trigNameOrAlias = (m_expL1Triggers[iTrig]).tokenName;
1965 
1966  if (!m_expBitsTechTrigger) {
1967  const bool triggerInMenu = m_l1GtUtils.l1AlgoTechTrigBitNumber(trigNameOrAlias, trigCategory, bitNumber);
1968 
1969  (m_expL1Triggers[iTrig]).tokenNumber = bitNumber;
1970  m_expTriggerCategory[iTrig] = trigCategory;
1971  m_expTriggerInMenu[iTrig] = triggerInMenu;
1972 
1973  } else {
1974  std::string aliasL1Trigger;
1975  std::string nameL1Trigger;
1976 
1977  trigCategory = L1GtUtils::TechnicalTrigger;
1978  bitNumber = (m_expL1Triggers[iTrig]).tokenNumber;
1979 
1980  const bool triggerInMenu =
1981  m_l1GtUtils.l1TriggerNameFromBit(bitNumber, trigCategory, aliasL1Trigger, nameL1Trigger);
1982 
1983  if (!triggerInMenu) {
1984  aliasL1Trigger = "Technical_trigger_bit_" + (m_expL1Triggers[iTrig]).tokenName + "_empty";
1985  }
1986 
1987  (m_expL1Triggers[iTrig]).tokenName = aliasL1Trigger;
1988  m_expTriggerCategory[iTrig] = trigCategory;
1989  m_expTriggerInMenu[iTrig] = triggerInMenu;
1990 
1991  // put the names of the technical triggers in the returned quantities
1992 
1993  (m_decisionsBeforeMask[iTrig]).first = aliasL1Trigger;
1994  (m_decisionsAfterMask[iTrig]).first = aliasL1Trigger;
1995  (m_prescaleFactors[iTrig]).first = aliasL1Trigger;
1996  (m_triggerMasks[iTrig]).first = aliasL1Trigger;
1997  (m_errorCodes[iTrig]).first = aliasL1Trigger;
1998  }
1999  }
2000 
2001  return errorCode;
2002 }
2003 
2004 const std::vector<std::pair<std::string, bool> >& L1GtUtils::LogicalExpressionL1Results::decisionsBeforeMask() {
2005  // throw an exception if the result is not computed once per event - user usage error
2006  if (!m_l1ResultsAlreadyCalled) {
2007  throw cms::Exception("FailModule")
2008  << "\nUsage error: "
2009  << "\n Method 'errorCodes' must be called in the event loop before attempting to use this method.\n"
2010  << std::endl;
2011  }
2012 
2013  return m_decisionsBeforeMask;
2014 }
2015 
2016 const std::vector<std::pair<std::string, bool> >& L1GtUtils::LogicalExpressionL1Results::decisionsAfterMask() {
2017  // throw an exception if the result is not computed once per event - user usage error
2018  if (!m_l1ResultsAlreadyCalled) {
2019  throw cms::Exception("FailModule")
2020  << "\nUsage error: "
2021  << "\n Method 'errorCodes' must be called in the event loop before attempting to use this method.\n"
2022  << std::endl;
2023  }
2024 
2025  return m_decisionsAfterMask;
2026 }
2027 
2028 const std::vector<std::pair<std::string, int> >& L1GtUtils::LogicalExpressionL1Results::prescaleFactors() {
2029  // throw an exception if the result is not computed once per event - user usage error
2030  if (!m_l1ResultsAlreadyCalled) {
2031  throw cms::Exception("FailModule")
2032  << "\nUsage error: "
2033  << "\n Method 'errorCodes' must be called in the event loop before attempting to use this method.\n"
2034  << std::endl;
2035  }
2036 
2037  return m_prescaleFactors;
2038 }
2039 
2040 const std::vector<std::pair<std::string, int> >& L1GtUtils::LogicalExpressionL1Results::triggerMasks() {
2041  // throw an exception if the result is not computed once per event - user usage error
2042  if (!m_l1ResultsAlreadyCalled) {
2043  throw cms::Exception("FailModule")
2044  << "\nUsage error: "
2045  << "\n Method 'errorCodes' must be called in the event loop before attempting to use this method.\n"
2046  << std::endl;
2047  }
2048 
2049  return m_triggerMasks;
2050 }
2051 
2052 const std::vector<std::pair<std::string, int> >& L1GtUtils::LogicalExpressionL1Results::errorCodes(
2053  const edm::Event& iEvent) {
2054  m_l1ResultsAlreadyCalled = false;
2055 
2056  // if not a valid L1 configuration, reset all quantities and return
2057  if (!m_validL1Configuration) {
2058  reset(m_decisionsBeforeMask);
2059  reset(m_decisionsAfterMask);
2060  reset(m_prescaleFactors);
2061  reset(m_triggerMasks);
2062  reset(m_errorCodes);
2063 
2064  m_l1ResultsAlreadyCalled = true;
2065  return m_errorCodes;
2066  }
2067 
2068  l1Results(iEvent);
2069 
2070  m_l1ResultsAlreadyCalled = true;
2071 
2072  return m_errorCodes;
2073 }
2074 
2075 void L1GtUtils::LogicalExpressionL1Results::reset(const std::vector<std::pair<std::string, bool> >& _pairVector) const {
2076  std::vector<std::pair<std::string, bool> > pairVector = _pairVector;
2077  for (size_t iTrig = 0; iTrig < m_expL1TriggersSize; ++iTrig) {
2078  (pairVector[iTrig]).second = false;
2079  }
2080 }
2081 
2082 void L1GtUtils::LogicalExpressionL1Results::reset(const std::vector<std::pair<std::string, int> >& _pairVector) const {
2083  std::vector<std::pair<std::string, int> > pairVector = _pairVector;
2084  for (size_t iTrig = 0; iTrig < m_expL1TriggersSize; ++iTrig) {
2085  (pairVector[iTrig]).second = -1;
2086  }
2087 }
2088 
2090  // reset the vectors before filling them
2091  reset(m_decisionsBeforeMask);
2092  reset(m_decisionsAfterMask);
2093  reset(m_prescaleFactors);
2094  reset(m_triggerMasks);
2095  reset(m_errorCodes);
2096 
2097  // initialization of actual values for each trigger
2098  bool decisionBeforeMaskValue = false;
2099  bool decisionAfterMaskValue = false;
2100  int prescaleFactorValue = -1;
2101  int triggerMaskValue = -1;
2102  int errorCode = -1;
2103 
2104  LogDebug("L1GtUtils") << std::endl;
2105  LogTrace("L1GtUtils") << "\nLogical expression\n " << m_logicalExpression << std::endl;
2106 
2107  // for each trigger, if it is in the L1 menu, get the prescale factor and trigger mask
2108 
2109  for (size_t iTrig = 0; iTrig < m_expL1TriggersSize; ++iTrig) {
2110  const std::string& trigNameOrAlias = (m_expL1Triggers[iTrig]).tokenName;
2111 
2112  if (m_expTriggerInMenu[iTrig]) {
2113  errorCode = m_l1GtUtils.l1Results(iEvent,
2114  trigNameOrAlias,
2115  decisionBeforeMaskValue,
2116  decisionAfterMaskValue,
2117  prescaleFactorValue,
2118  triggerMaskValue);
2119 
2120  if (errorCode != 0) {
2121  // error while retrieving the results
2122  // for this trigger: set prescale factor to -1, trigger mask to -1
2123 
2124  decisionBeforeMaskValue = false;
2125  decisionAfterMaskValue = false;
2126  prescaleFactorValue = -1;
2127  triggerMaskValue = -1;
2128  }
2129 
2130  } else {
2131  // no trigger name or trigger alias in the menu, no bits:
2132  // for this trigger: set prescale factor to -1, set the error code
2133 
2134  decisionBeforeMaskValue = false;
2135  decisionAfterMaskValue = false;
2136  prescaleFactorValue = -1;
2137  triggerMaskValue = -1;
2138  errorCode = m_l1ConfCode + 1;
2139  }
2140 
2141  LogTrace("L1GtUtils") << "\n" << trigNameOrAlias << ":" << std::endl;
2142 
2143  (m_decisionsBeforeMask[iTrig]).second = decisionBeforeMaskValue;
2144  LogTrace("L1GtUtils") << " decision before mask = " << decisionBeforeMaskValue << std::endl;
2145 
2146  (m_decisionsAfterMask[iTrig]).second = decisionAfterMaskValue;
2147  LogTrace("L1GtUtils") << " decision after mask = " << decisionAfterMaskValue << std::endl;
2148 
2149  (m_prescaleFactors[iTrig]).second = prescaleFactorValue;
2150  LogTrace("L1GtUtils") << " prescale factor = " << prescaleFactorValue << std::endl;
2151 
2152  (m_triggerMasks[iTrig]).second = triggerMaskValue;
2153  LogTrace("L1GtUtils") << " trigger mask = " << triggerMaskValue << std::endl;
2154 
2155  (m_errorCodes[iTrig]).second = errorCode;
2156  LogTrace("L1GtUtils") << " error code = " << errorCode << std::endl;
2157  }
2158 
2159  LogDebug("L1GtUtils") << std::endl;
2160 }
2161 
2163 const int L1GtUtils::L1GtNotValidError = 99999;
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
L1GtTriggerMenuLite::gtPrescaleFactorsAlgoTrig
const std::vector< std::vector< int > > & gtPrescaleFactorsAlgoTrig() const
get the prescale factors by reference / set the prescale factors
Definition: L1GtTriggerMenuLite.h:128
L1GtUtils::m_l1GtPfAlgoCacheID
unsigned long long m_l1GtPfAlgoCacheID
Definition: L1GtUtils.h:402
L1GtTriggerMenuLite::gtTriggerMaskAlgoTrig
const std::vector< unsigned int > & gtTriggerMaskAlgoTrig() const
get the trigger mask for physics algorithms
Definition: L1GtTriggerMenuLite.h:116
L1GtUtils::UseEventSetupIn
UseEventSetupIn
Definition: L1GtUtils.h:76
L1GtUtils::LogicalExpressionL1Results::decisionsAfterMask
const std::vector< std::pair< std::string, bool > > & decisionsAfterMask()
Definition: L1GtUtils.cc:2016
L1GtTriggerMenu::gtTriggerMenuName
const std::string & gtTriggerMenuName() const
Definition: L1GtTriggerMenu.h:91
useL1EventSetup
static const bool useL1EventSetup(true)
mps_fire.i
i
Definition: mps_fire.py:355
L1GtUtils::prescaleFactorSet
const std::vector< int > & prescaleFactorSet(const edm::Event &iEvent, const TriggerCategory &trigCategory, int &errorCode)
Definition: L1GtUtils.cc:1446
L1GtUtils::triggerMaskSet
const std::vector< unsigned int > & triggerMaskSet(const TriggerCategory &trigCategory, int &errorCode)
Definition: L1GtUtils.cc:1502
L1GtPrescaleFactors
Definition: L1GtPrescaleFactors.h:32
MessageLogger.h
L1GtUtils::m_triggerMaskSet
std::vector< unsigned int > m_triggerMaskSet
Definition: L1GtUtils.h:466
funct::false
false
Definition: Factorize.h:34
L1GtUtils::LogicalExpressionL1Results::triggerMasks
const std::vector< std::pair< std::string, int > > & triggerMasks()
Definition: L1GtUtils.cc:2040
L1GtUtils::UseEventSetupIn::RunAndEvent
edm::Handle::product
T const * product() const
Definition: Handle.h:70
edm::RunID
Definition: RunID.h:28
L1GtUtils::UseEventSetupIn::Event
L1GtUtils::m_L1GtTriggerMaskVetoAlgoTrigRunToken
edm::ESGetToken< L1GtTriggerMask, L1GtTriggerMaskVetoAlgoTrigRcd > m_L1GtTriggerMaskVetoAlgoTrigRunToken
Definition: L1GtUtils.h:481
L1GtUtils::LogicalExpressionL1Results::prescaleFactors
const std::vector< std::pair< std::string, int > > & prescaleFactors()
Definition: L1GtUtils.cc:2028
L1GtUtils::ptrL1GtTriggerMenuLite
const L1GtTriggerMenuLite * ptrL1GtTriggerMenuLite(int &errorCode)
return a pointer to the L1GtTriggerMenuLite product
Definition: L1GtUtils.cc:1650
L1GtStableParameters::gtNumberTechnicalTriggers
unsigned int gtNumberTechnicalTriggers() const
get / set the number of technical triggers
Definition: L1GtStableParameters.h:53
L1GtUtils::m_L1GtStableParametersRunToken
edm::ESGetToken< L1GtStableParameters, L1GtStableParametersRcd > m_L1GtStableParametersRunToken
Definition: L1GtUtils.h:476
L1GtUtils::l1TriggerMenuImplementation
const std::string & l1TriggerMenuImplementation() const
return the L1 trigger menu implementation
Definition: L1GtUtils.cc:1603
L1GtUtils::m_beginRunCache
bool m_beginRunCache
flag for call of getL1GtRunCache in beginRun
Definition: L1GtUtils.h:457
L1GlobalTriggerReadoutSetupFwd.h
edm::Run
Definition: Run.h:45
L1GtUtils::m_l1GtTmAlgoCacheID
unsigned long long m_l1GtTmAlgoCacheID
Definition: L1GtUtils.h:412
L1GtUtils::getL1GtRunCache
void getL1GtRunCache(const edm::Run &, const edm::EventSetup &, const bool, const bool)
get all the run-constant quantities for L1 trigger and cache them
Definition: L1GtUtils.cc:319
L1GtUtils::m_l1GtMenuLiteValid
bool m_l1GtMenuLiteValid
Definition: L1GtUtils.h:454
L1GtUtils::m_physicsDaqPartition
unsigned int m_physicsDaqPartition
index of physics DAQ partition
Definition: L1GtUtils.h:464
L1GtPrescaleFactors::gtPrescaleFactors
const std::vector< std::vector< int > > & gtPrescaleFactors() const
get the prescale factors by reference
Definition: L1GtPrescaleFactors.h:45
L1GtUtils::decisionBeforeMask
const bool decisionBeforeMask(const edm::Event &iEvent, const std::string &nameAlgoTechTrig, int &errorCode) const
return decision before trigger mask for a given algorithm or technical trigger
Definition: L1GtUtils.cc:1043
L1GtUtils::LogicalExpressionL1Results::logicalExpressionRunUpdate
const int logicalExpressionRunUpdate(const edm::Run &, const edm::EventSetup &, const std::string &)
Definition: L1GtUtils.cc:1900
L1GtUtils::m_triggerMaskVetoTechTrig
const std::vector< unsigned int > * m_triggerMaskVetoTechTrig
Definition: L1GtUtils.h:427
L1GtUtilsHelper
Definition: L1GtUtilsHelper.h:37
L1GtTriggerMenu::gtTriggerMenuImplementation
const std::string & gtTriggerMenuImplementation() const
Definition: L1GtTriggerMenu.h:96
HIPAlignmentAlgorithm_cfi.algoName
algoName
Definition: HIPAlignmentAlgorithm_cfi.py:5
edm::second
U second(std::pair< T, U > const &p)
Definition: ParameterSet.cc:215
L1GtUtils::m_L1GtTriggerMaskAlgoTrigRunToken
edm::ESGetToken< L1GtTriggerMask, L1GtTriggerMaskAlgoTrigRcd > m_L1GtTriggerMaskAlgoTrigRunToken
Definition: L1GtUtils.h:479
L1GtTriggerMaskVetoTechTrigRcd
Definition: L1GtTriggerMaskVetoTechTrigRcd.h:39
L1GtUtils::~L1GtUtils
virtual ~L1GtUtils()
destructor
Definition: L1GtUtils.cc:107
L1GtUtils::m_runIDCache
edm::RunID m_runIDCache
run cache ID
Definition: L1GtUtils.h:460
L1GtUtils::decision
const bool decision(const edm::Event &iEvent, const std::string &nameAlgoTechTrig, int &errorCode) const
Definition: L1GtUtils.cc:1071
L1GtUtils::EmptyString
static const std::string EmptyString
Definition: L1GtUtils.h:373
L1GtUtils::m_L1GtTriggerMaskVetoAlgoTrigEventToken
edm::ESGetToken< L1GtTriggerMask, L1GtTriggerMaskVetoAlgoTrigRcd > m_L1GtTriggerMaskVetoAlgoTrigEventToken
Definition: L1GtUtils.h:491
cms::Exception::what
char const * what() const noexcept override
Definition: Exception.cc:103
L1GtUtils::m_algorithmMap
const AlgorithmMap * m_algorithmMap
Definition: L1GtUtils.h:433
L1GtUtils::m_l1GtPfTechCacheID
unsigned long long m_l1GtPfTechCacheID
Definition: L1GtUtils.h:405
L1GtUtils::m_prescaleFactorsAlgoTrig
const std::vector< std::vector< int > > * m_prescaleFactorsAlgoTrig
Definition: L1GtUtils.h:407
edm::ConsumesCollector::esConsumes
auto esConsumes()
Definition: ConsumesCollector.h:86
edm::Handle< L1GtTriggerMenuLite >
L1GlobalTriggerRecord::gtPrescaleFactorIndexAlgo
const unsigned int gtPrescaleFactorIndexAlgo() const
Definition: L1GlobalTriggerRecord.h:87
L1GtPrescaleFactorsTechTrigRcd
Definition: L1GtPrescaleFactorsTechTrigRcd.h:38
L1GtTriggerMenuLite::CItL1Trig
L1TriggerMap::const_iterator CItL1Trig
iterators through map containing the physics algorithms or the technical triggers
Definition: L1GtTriggerMenuLite.h:45
dqmdumpme.first
first
Definition: dqmdumpme.py:55
L1GtUtils::L1GtNotValidError
static const int L1GtNotValidError
Definition: L1GtUtils.h:374
L1GtUtils::m_l1GtUtilsHelper
std::unique_ptr< L1GtUtilsHelper > m_l1GtUtilsHelper
Definition: L1GtUtils.h:473
L1GtUtils::TechnicalTrigger
Definition: L1GtUtils.h:140
L1GtUtils::m_L1GtTriggerMaskAlgoTrigEventToken
edm::ESGetToken< L1GtTriggerMask, L1GtTriggerMaskAlgoTrigRcd > m_L1GtTriggerMaskAlgoTrigEventToken
Definition: L1GtUtils.h:489
L1GtUtils::m_retrieveL1EventSetup
bool m_retrieveL1EventSetup
flags to check which method was used to retrieve L1 trigger configuration
Definition: L1GtUtils.h:470
L1GtUtils::m_triggerMaskTechTrig
const std::vector< unsigned int > * m_triggerMaskTechTrig
Definition: L1GtUtils.h:424
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
L1GtUtils::m_L1GtPrescaleFactorsAlgoTrigRunToken
edm::ESGetToken< L1GtPrescaleFactors, L1GtPrescaleFactorsAlgoTrigRcd > m_L1GtPrescaleFactorsAlgoTrigRunToken
Definition: L1GtUtils.h:477
edm::Run::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Run.h:315
L1GlobalTriggerRecord.h
CItAlgo
AlgorithmMap::const_iterator CItAlgo
iterators through map containing the algorithms
Definition: L1GtTriggerMenuFwd.h:38
L1GtUtils::m_L1GtTriggerMenuEventToken
edm::ESGetToken< L1GtTriggerMenu, L1GtTriggerMenuRcd > m_L1GtTriggerMenuEventToken
Definition: L1GtUtils.h:493
L1GtUtils::TriggerCategory
TriggerCategory
Definition: L1GtUtils.h:140
L1GtUtils::m_algorithmAliasMap
const AlgorithmMap * m_algorithmAliasMap
Definition: L1GtUtils.h:434
L1GtTriggerMenuLite::gtTechnicalTriggerMap
const L1TriggerMap & gtTechnicalTriggerMap() const
get / set the technical trigger map
Definition: L1GtTriggerMenuLite.h:111
L1GtTriggerMaskTechTrigRcd
Definition: L1GtTriggerMaskTechTrigRcd.h:39
L1GtTriggerMenuRcd
Definition: L1GtTriggerMenuRcd.h:32
L1GtUtils::trigResult
const bool trigResult(const DecisionWord &decWord, const int bitNumber, const std::string &nameAlgoTechTrig, const TriggerCategory &trigCategory, int &errorCode) const
Definition: L1GtUtils.cc:1769
L1GtTriggerMaskAlgoTrigRcd
Definition: L1GtTriggerMaskAlgoTrigRcd.h:39
edm::ESHandle
Definition: DTSurvey.h:22
L1GtUtils::LogicalExpressionL1Results::l1Results
void l1Results(const edm::Event &iEvent)
Definition: L1GtUtils.cc:2089
L1GtUtils
Definition: L1GtUtils.h:66
L1GtTriggerMask
Definition: L1GtTriggerMask.h:33
L1GtStableParameters
Definition: L1GtStableParameters.h:33
L1GtUtils::triggerCategory
const std::string triggerCategory(const TriggerCategory &) const
public methods
Definition: L1GtUtils.cc:111
L1GtUtils::availableL1Configuration
const bool availableL1Configuration(int &errorCode, int &l1ConfCode) const
Definition: L1GtUtils.cc:1684
useL1GtTriggerMenuLite
static const bool useL1GtTriggerMenuLite(true)
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
L1GtUtils::l1TriggerMenu
const std::string & l1TriggerMenu() const
return the L1 trigger menu name
Definition: L1GtUtils.cc:1582
edm::LogWarning
Definition: MessageLogger.h:141
L1GtUtils::m_triggerMaskTechTrigLite
const std::vector< unsigned int > * m_triggerMaskTechTrigLite
Definition: L1GtUtils.h:449
L1GtUtils::m_L1GtTriggerMaskTechTrigEventToken
edm::ESGetToken< L1GtTriggerMask, L1GtTriggerMaskTechTrigRcd > m_L1GtTriggerMaskTechTrigEventToken
Definition: L1GtUtils.h:490
L1GtUtils::m_numberTechnicalTriggers
unsigned int m_numberTechnicalTriggers
number of technical triggers
Definition: L1GtUtils.h:398
L1GtTriggerMenuLite::gtTriggerMenuImplementation
const std::string & gtTriggerMenuImplementation() const
Definition: L1GtTriggerMenuLite.h:91
L1GtTriggerMenuLite::gtTriggerMaskTechTrig
const std::vector< unsigned int > & gtTriggerMaskTechTrig() const
get the trigger mask for technical triggers
Definition: L1GtTriggerMenuLite.h:122
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:670
edm::ParameterSet
Definition: ParameterSet.h:36
L1GtTriggerMenu
Definition: L1GtTriggerMenu.h:48
L1GtUtils::UseEventSetupIn::Run
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
L1GtTriggerMenuLite::gtAlgorithmMap
const L1TriggerMap & gtAlgorithmMap() const
get / set the algorithm map (by name)
Definition: L1GtTriggerMenuLite.h:101
L1GtUtils::LogicalExpressionL1Results::initialize
bool initialize()
Definition: L1GtUtils.cc:1816
L1GtTriggerMask::gtTriggerMask
const std::vector< unsigned int > & gtTriggerMask() const
get the trigger mask
Definition: L1GtTriggerMask.h:47
L1GtUtils::LogicalExpressionL1Results::reset
void reset(const std::vector< std::pair< std::string, bool > > &) const
reset for each L1 trigger the value from pair.second
Definition: L1GtUtils.cc:2075
L1GlobalTriggerReadoutRecord::decisionWord
const DecisionWord & decisionWord(int bxInEventValue) const
Definition: L1GlobalTriggerReadoutRecord.cc:186
L1GtLogicParser::operandTokenVector
std::vector< OperandToken > & operandTokenVector()
return the vector of operand tokens
Definition: L1GtLogicParser.h:111
L1GtUtils::m_l1GtStablePar
const L1GtStableParameters * m_l1GtStablePar
event setup cached stuff
Definition: L1GtUtils.h:391
L1GtUtils::l1Results
const int l1Results(const edm::Event &iEvent, const std::string &nameAlgoTechTrig, bool &decisionBeforeMask, bool &decisionAfterMask, int &prescaleFactor, int &triggerMask) const
Definition: L1GtUtils.cc:671
L1GtUtils::m_L1GtPrescaleFactorsAlgoTrigEventToken
edm::ESGetToken< L1GtPrescaleFactors, L1GtPrescaleFactorsAlgoTrigRcd > m_L1GtPrescaleFactorsAlgoTrigEventToken
Definition: L1GtUtils.h:487
Skims_PDWG_cff.prescaleFactor
prescaleFactor
Definition: Skims_PDWG_cff.py:25
iEvent
int iEvent
Definition: GenABIO.cc:224
L1GtUtils::decisionAfterMask
const bool decisionAfterMask(const edm::Event &iEvent, const std::string &nameAlgoTechTrig, int &errorCode) const
return decision after trigger mask for a given algorithm or technical trigger
Definition: L1GtUtils.cc:1057
L1GtUtils::LogicalExpressionL1Results::errorCodes
const std::vector< std::pair< std::string, int > > & errorCodes(const edm::Event &)
Definition: L1GtUtils.cc:2052
L1GtUtils::retrieveL1EventSetup
void retrieveL1EventSetup(const edm::EventSetup &, bool isRun=true)
retrieve all the relevant L1 trigger event setup records and cache them to improve the speed
Definition: L1GtUtils.cc:127
L1GtUtils::m_l1GtMenu
const L1GtTriggerMenu * m_l1GtMenu
Definition: L1GtUtils.h:430
L1GtUtils::m_l1GtMenuLite
const L1GtTriggerMenuLite * m_l1GtMenuLite
L1GtTriggerMenuLite cached stuff.
Definition: L1GtUtils.h:442
L1GtTriggerMenu::gtAlgorithmAliasMap
const AlgorithmMap & gtAlgorithmAliasMap() const
get / set the algorithm map (by alias)
Definition: L1GtTriggerMenu.h:192
L1GtUtils::retrieveL1GtTriggerMenuLite
void retrieveL1GtTriggerMenuLite(const edm::Run &)
retrieve L1GtTriggerMenuLite (per run product) and cache it to improve the speed
Definition: L1GtUtils.cc:286
L1GtStableParameters::gtNumberPhysTriggers
unsigned int gtNumberPhysTriggers() const
get / set the number of physics trigger algorithms
Definition: L1GtStableParameters.h:43
edm::EventSetup
Definition: EventSetup.h:57
L1GtUtils::l1AlgoTechTrigBitNumber
const bool l1AlgoTechTrigBitNumber(const std::string &nameAlgoTechTrig, TriggerCategory &trigCategory, int &bitNumber) const
Definition: L1GtUtils.cc:376
L1GtUtils::m_algorithmAliasMapLite
const L1GtTriggerMenuLite::L1TriggerMap * m_algorithmAliasMapLite
Definition: L1GtUtils.h:445
L1GtUtils::m_l1GtPfTech
const L1GtPrescaleFactors * m_l1GtPfTech
Definition: L1GtUtils.h:404
get
#define get
L1GtUtils::m_prescaleFactorsTechTrigLite
const std::vector< std::vector< int > > * m_prescaleFactorsTechTrigLite
Definition: L1GtUtils.h:452
L1GtStableParametersRcd
Definition: L1GtStableParametersRcd.h:39
L1GtUtils::m_L1GtStableParametersEventToken
edm::ESGetToken< L1GtStableParameters, L1GtStableParametersRcd > m_L1GtStableParametersEventToken
Definition: L1GtUtils.h:486
L1GtUtils::LogicalExpressionL1Results::~LogicalExpressionL1Results
~LogicalExpressionL1Results()
destructor
Definition: L1GtUtils.cc:1812
L1GtTriggerMaskVetoAlgoTrigRcd
Definition: L1GtTriggerMaskVetoAlgoTrigRcd.h:39
L1GtTriggerMenuLite::gtPrescaleFactorsTechTrig
const std::vector< std::vector< int > > & gtPrescaleFactorsTechTrig() const
Definition: L1GtTriggerMenuLite.h:132
DecisionWord
std::vector< bool > DecisionWord
typedefs
Definition: L1GlobalTriggerReadoutSetupFwd.h:34
L1GtUtils::m_algorithmMapLite
const L1GtTriggerMenuLite::L1TriggerMap * m_algorithmMapLite
Definition: L1GtUtils.h:444
L1GtTriggerMenuLite
Definition: L1GtTriggerMenuLite.h:39
L1GtUtils::AlgorithmTrigger
Definition: L1GtUtils.h:140
L1GtUtils::m_technicalTriggerMapLite
const L1GtTriggerMenuLite::L1TriggerMap * m_technicalTriggerMapLite
Definition: L1GtUtils.h:446
L1GlobalTriggerRecord::decisionWordBeforeMask
const DecisionWord decisionWordBeforeMask() const
Definition: L1GlobalTriggerRecord.h:64
L1GtUtils::m_technicalTriggerMap
const AlgorithmMap * m_technicalTriggerMap
Definition: L1GtUtils.h:435
edm::Run::runAuxiliary
RunAuxiliary const & runAuxiliary() const override
Definition: Run.h:61
L1GtUtils::m_triggerMaskAlgoTrig
const std::vector< unsigned int > * m_triggerMaskAlgoTrig
Definition: L1GtUtils.h:423
L1GtUtils::l1TriggerNameFromBit
const bool l1TriggerNameFromBit(const int &bitNumber, const TriggerCategory &trigCategory, std::string &aliasL1Trigger, std::string &nameL1Trigger) const
Definition: L1GtUtils.cc:488
L1GlobalTriggerRecord::gtPrescaleFactorIndexTech
const unsigned int gtPrescaleFactorIndexTech() const
get/set index of the set of prescale factors
Definition: L1GlobalTriggerRecord.h:81
L1GtUtils::L1GtUtils
L1GtUtils(edm::ParameterSet const &pset, edm::ConsumesCollector &&iC, bool useL1GtTriggerMenuLite, UseEventSetupIn use=UseEventSetupIn::Run)
Definition: L1GtUtils.cc:92
L1GtUtils::m_L1GtTriggerMenuRunToken
edm::ESGetToken< L1GtTriggerMenu, L1GtTriggerMenuRcd > m_L1GtTriggerMenuRunToken
Definition: L1GtUtils.h:483
L1GtUtils::LogicalExpressionL1Results::decisionsBeforeMask
const std::vector< std::pair< std::string, bool > > & decisionsBeforeMask()
Definition: L1GtUtils.cc:2004
L1GtUtils::triggerMask
const int triggerMask(const edm::Event &iEvent, const std::string &nameAlgoTechTrig, int &errorCode) const
return trigger mask for a given algorithm or technical trigger
Definition: L1GtUtils.cc:1097
L1GtLogicParser
Definition: L1GtLogicParser.h:31
L1GtUtils::prescaleFactorSetIndex
const int prescaleFactorSetIndex(const edm::Event &iEvent, const TriggerCategory &trigCategory, int &errorCode) const
Definition: L1GtUtils.cc:1274
L1GtUtils::m_retrieveL1GtTriggerMenuLite
bool m_retrieveL1GtTriggerMenuLite
Definition: L1GtUtils.h:471
L1GtUtils::m_numberAlgorithmTriggers
unsigned int m_numberAlgorithmTriggers
number of algorithm triggers
Definition: L1GtUtils.h:395
edm::Transition::BeginRun
L1GtUtils.h
L1GtUtils::m_triggerMaskAlgoTrigLite
const std::vector< unsigned int > * m_triggerMaskAlgoTrigLite
Definition: L1GtUtils.h:448
Exception
Definition: hltDiff.cc:246
L1GtUtils::m_L1GtTriggerMaskTechTrigRunToken
edm::ESGetToken< L1GtTriggerMask, L1GtTriggerMaskTechTrigRcd > m_L1GtTriggerMaskTechTrigRunToken
Definition: L1GtUtils.h:480
edm::RunAuxiliary::run
RunNumber_t run() const
Definition: RunAuxiliary.h:31
cms::Exception::explainSelf
virtual std::string explainSelf() const
Definition: Exception.cc:108
L1GtTriggerMenuLite::gtTriggerMenuName
const std::string & gtTriggerMenuName() const
Definition: L1GtTriggerMenuLite.h:86
L1GtUtils::m_l1GtMenuCacheID
unsigned long long m_l1GtMenuCacheID
Definition: L1GtUtils.h:431
L1GtUtils::m_l1GtTmTech
const L1GtTriggerMask * m_l1GtTmTech
Definition: L1GtUtils.h:414
L1GtUtils::m_l1EventSetupValid
bool m_l1EventSetupValid
Definition: L1GtUtils.h:437
edm::RunAuxiliary::id
RunID const & id() const
Definition: RunAuxiliary.h:27
reset
void reset(double vett[256])
Definition: TPedValues.cc:11
L1GtUtils::m_prescaleFactorsAlgoTrigLite
const std::vector< std::vector< int > > * m_prescaleFactorsAlgoTrigLite
Definition: L1GtUtils.h:451
L1TBPTX_cfi.bitNumber
bitNumber
Definition: L1TBPTX_cfi.py:26
L1GtUtils::m_prescaleFactorSet
std::vector< int > m_prescaleFactorSet
Definition: L1GtUtils.h:467
cms::Exception
Definition: Exception.h:70
initialize
static AlgebraicMatrix initialize()
Definition: BeamSpotTransientTrackingRecHit.cc:24
edm::eventsetup::EventSetupRecord::cacheIdentifier
unsigned long long cacheIdentifier() const
Definition: EventSetupRecord.h:185
L1GlobalTriggerReadoutRecord::technicalTriggerWord
const TechnicalTriggerWord & technicalTriggerWord(int bxInEventValue) const
Definition: L1GlobalTriggerReadoutRecord.cc:212
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:671
L1GtUtils::m_prescaleFactorsTechTrig
const std::vector< std::vector< int > > * m_prescaleFactorsTechTrig
Definition: L1GtUtils.h:408
L1GtPrescaleFactorsAlgoTrigRcd
Definition: L1GtPrescaleFactorsAlgoTrigRcd.h:38
L1GtUtils::m_l1GtTmTechCacheID
unsigned long long m_l1GtTmTechCacheID
Definition: L1GtUtils.h:415
L1GtUtils::m_L1GtTriggerMaskVetoTechTrigEventToken
edm::ESGetToken< L1GtTriggerMask, L1GtTriggerMaskVetoTechTrigRcd > m_L1GtTriggerMaskVetoTechTrigEventToken
Definition: L1GtUtils.h:492
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
L1GtUtils::m_l1GtTmVetoAlgoCacheID
unsigned long long m_l1GtTmVetoAlgoCacheID
Definition: L1GtUtils.h:418
L1GtUtils::m_l1GtTmVetoTechCacheID
unsigned long long m_l1GtTmVetoTechCacheID
Definition: L1GtUtils.h:421
L1GtUtils::m_triggerMaskVetoAlgoTrig
const std::vector< unsigned int > * m_triggerMaskVetoAlgoTrig
Definition: L1GtUtils.h:426
L1GlobalTriggerRecord::technicalTriggerWordBeforeMask
const TechnicalTriggerWord technicalTriggerWordBeforeMask() const
Definition: L1GlobalTriggerRecord.h:66
edm::Event
Definition: Event.h:73
L1GtUtils::LogicalExpressionL1Results::LogicalExpressionL1Results
LogicalExpressionL1Results(const std::string &, L1GtUtils &)
constructor(s)
Definition: L1GtUtils.cc:1790
L1GtUtils::m_l1GtTmVetoTech
const L1GtTriggerMask * m_l1GtTmVetoTech
Definition: L1GtUtils.h:420
L1GtTriggerMenu::gtTechnicalTriggerMap
const AlgorithmMap & gtTechnicalTriggerMap() const
get / set the technical trigger map
Definition: L1GtTriggerMenu.h:197
L1GtUtils::m_L1GtPrescaleFactorsTechTrigRunToken
edm::ESGetToken< L1GtPrescaleFactors, L1GtPrescaleFactorsTechTrigRcd > m_L1GtPrescaleFactorsTechTrigRunToken
Definition: L1GtUtils.h:478
L1GtUtils::ptrL1TriggerMenuEventSetup
const L1GtTriggerMenu * ptrL1TriggerMenuEventSetup(int &errorCode)
return a pointer to the L1 trigger menu from event setup
Definition: L1GtUtils.cc:1624
L1GtUtils::prescaleFactor
const int prescaleFactor(const edm::Event &iEvent, const std::string &nameAlgoTechTrig, int &errorCode) const
return prescale factor for a given algorithm or technical trigger
Definition: L1GtUtils.cc:1083
L1GlobalTriggerReadoutRecord::gtFdlWord
const L1GtFdlWord gtFdlWord(int bxInEventValue) const
get / set FDL word (record) in the GT readout record
Definition: L1GlobalTriggerReadoutRecord.cc:372
L1GlobalTriggerReadoutRecord.h
L1GtUtils::m_l1GtPfAlgo
const L1GtPrescaleFactors * m_l1GtPfAlgo
prescale factors
Definition: L1GtUtils.h:401
edm::ConsumesCollector
Definition: ConsumesCollector.h:39
L1GtUtils::m_l1GtStableParCacheID
unsigned long long m_l1GtStableParCacheID
Definition: L1GtUtils.h:392
L1GtTriggerMenu::gtAlgorithmMap
const AlgorithmMap & gtAlgorithmMap() const
get / set the algorithm map (by name)
Definition: L1GtTriggerMenu.h:187
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
L1GtUtils::m_L1GtPrescaleFactorsTechTrigEventToken
edm::ESGetToken< L1GtPrescaleFactors, L1GtPrescaleFactorsTechTrigRcd > m_L1GtPrescaleFactorsTechTrigEventToken
Definition: L1GtUtils.h:488
L1GtUtils::m_L1GtTriggerMaskVetoTechTrigRunToken
edm::ESGetToken< L1GtTriggerMask, L1GtTriggerMaskVetoTechTrigRcd > m_L1GtTriggerMaskVetoTechTrigRunToken
Definition: L1GtUtils.h:482
L1GtTriggerMenuLite::gtAlgorithmAliasMap
const L1TriggerMap & gtAlgorithmAliasMap() const
get / set the algorithm map (by alias)
Definition: L1GtTriggerMenuLite.h:106
L1GtUtils::m_l1GtTmVetoAlgo
const L1GtTriggerMask * m_l1GtTmVetoAlgo
Definition: L1GtUtils.h:417
L1GtUtils::m_l1GtTmAlgo
const L1GtTriggerMask * m_l1GtTmAlgo
trigger masks & veto masks
Definition: L1GtUtils.h:411