CMS 3D CMS Logo

L1GtTriggerMenuTester.cc
Go to the documentation of this file.
1 
15 // this class header
17 
18 // system include files
19 #include <iomanip>
20 #include <boost/algorithm/string/erase.hpp>
21 
22 // user include files
23 // base class
25 
28 
31 
34 
37 
39 
42 
44 
47 
50 
52 
55 
56 // forward declarations
57 
58 // constructor(s)
60  m_overwriteHtmlFile(parSet.getParameter<bool> ("OverwriteHtmlFile")),
61  m_htmlFile(parSet.getParameter<std::string> ("HtmlFile")),
62  m_useHltMenu(parSet.getParameter<bool> ("UseHltMenu")),
63  m_hltProcessName(parSet.getParameter<std::string> ("HltProcessName")),
64  m_noThrowIncompatibleMenu(
65  parSet.getParameter<bool> ("NoThrowIncompatibleMenu")),
66  m_printPfsRates(parSet.getParameter<bool> ("PrintPfsRates")),
67  m_indexPfSet(parSet.getParameter<int> ("IndexPfSet")),
68  m_numberAlgorithmTriggers(0), m_numberTechnicalTriggers(0) {
69 
70  // empty
71 
72 }
73 
74 // destructor
76  // empty
77 }
78 
79 // begin job
81 
82 }
83 
84 // begin run
86  const edm::EventSetup& evSetup) {
87 
88  // retrieve L1 trigger configuration
89  retrieveL1EventSetup(evSetup);
90 
91  // print with various level of verbosity
92 
93  // define an output stream to print into
94  // it can then be directed to whatever log level is desired
95  std::ostringstream myCout;
96 
97  int printVerbosity = 0;
98  m_l1GtMenu->print(myCout, printVerbosity);
99  myCout << std::flush << std::endl;
100 
101  printVerbosity = 1;
102  m_l1GtMenu->print(myCout, printVerbosity);
103  myCout << std::flush << std::endl;
104 
105  printVerbosity = 2;
106  m_l1GtMenu->print(myCout, printVerbosity);
107  myCout << std::flush << std::endl;
108 
109  // redirect myCout to edm::LogVerbatim TODO - parameter to choose the log
110  edm::LogVerbatim("L1GtTriggerMenuTester") << myCout.str() << std::endl;
111 
112  // prepare L1 - HLT
113  if (m_useHltMenu) {
114  associateL1SeedsHltPath(iRun, evSetup);
115 
117  edm::LogVerbatim("L1GtTriggerMenuTester")
118  << "\n List of algorithm triggers used as L1 seeds but not in L1 menu"
119  << std::endl;
120 
121  for (std::vector<std::string>::const_iterator strIter =
122  m_algoTriggerSeedNotInL1Menu.begin(); strIter
123  != m_algoTriggerSeedNotInL1Menu.end(); ++strIter) {
124 
125  edm::LogVerbatim("L1GtTriggerMenuTester") << " "
126  << (*strIter) << std::endl;
127  }
128 
129  }
130  }
131 
132  // print in wiki format
133  printWiki();
134 
135 }
136 
137 // begin luminosity block
139  const edm::EventSetup& evSetup) {
140 
141 }
142 
143 // loop over events
145  const edm::EventSetup& evSetup) {
146 
147  // empty
148 
149 }
150 
151 // end luminosity block
153  const edm::EventSetup& evSetup) {
154 
155 }
156 
157 // end run
159 
160 }
161 
162 // end job
164 
165 }
166 
168 
169  // get / update the stable parameters from the EventSetup
170 
172  evSetup.get<L1GtStableParametersRcd> ().get(l1GtStablePar);
173  m_l1GtStablePar = l1GtStablePar.product();
174 
175  // number of algorithm triggers
177 
178  // number of technical triggers
180 
181 // int maxNumberTrigger = std::max(m_numberAlgorithmTriggers,
182 // m_numberTechnicalTriggers);
183 
184 // m_triggerMaskSet.reserve(maxNumberTrigger);
185 // m_prescaleFactorSet.reserve(maxNumberTrigger);
186 
187  // get / update the prescale factors from the EventSetup
188 
189 
191  evSetup.get<L1GtPrescaleFactorsAlgoTrigRcd> ().get(l1GtPfAlgo);
192  m_l1GtPfAlgo = l1GtPfAlgo.product();
193 
195 
197  evSetup.get<L1GtPrescaleFactorsTechTrigRcd> ().get(l1GtPfTech);
198  m_l1GtPfTech = l1GtPfTech.product();
199 
201 
202  // get / update the trigger mask from the EventSetup
203 
205  evSetup.get<L1GtTriggerMaskAlgoTrigRcd> ().get(l1GtTmAlgo);
206  m_l1GtTmAlgo = l1GtTmAlgo.product();
207 
209 
211  evSetup.get<L1GtTriggerMaskTechTrigRcd> ().get(l1GtTmTech);
212  m_l1GtTmTech = l1GtTmTech.product();
213 
215 
216  edm::ESHandle<L1GtTriggerMask> l1GtTmVetoAlgo;
217  evSetup.get<L1GtTriggerMaskVetoAlgoTrigRcd> ().get(l1GtTmVetoAlgo);
218  m_l1GtTmVetoAlgo = l1GtTmVetoAlgo.product();
219 
221 
222  edm::ESHandle<L1GtTriggerMask> l1GtTmVetoTech;
223  evSetup.get<L1GtTriggerMaskVetoTechTrigRcd> ().get(l1GtTmVetoTech);
224  m_l1GtTmVetoTech = l1GtTmVetoTech.product();
225 
227 
228  // get / update the trigger menu from the EventSetup
229 
231  evSetup.get<L1GtTriggerMenuRcd> ().get(l1GtMenu);
232  m_l1GtMenu = l1GtMenu.product();
236 
237 }
238 
240  const edm::EventSetup& evSetup) {
241 
242  bool hltChanged = true;
243 
244  if (m_hltConfig.init(iRun, evSetup, m_hltProcessName, hltChanged)) {
245 
246  // if init returns TRUE, initialization has succeeded!
247  if (hltChanged) {
248 
249  // HLT configuration has actually changed wrt the previous run
251 
252  edm::LogVerbatim("L1GtTriggerMenuTester")
253  << "\nHLT ConfDB menu name: \n " << m_hltTableName
254  << std::endl;
255 
256  // loop over trigger paths, get the HLTLevel1GTSeed logical expression, and add the path to
257  // each L1 trigger
258 
261 
264 
265  for (unsigned int iHlt = 0; iHlt < m_hltConfig.size(); ++iHlt) {
266 
267  const std::string& hltPathName = m_hltConfig.triggerName(iHlt);
268 
269  const std::vector<std::pair<bool, std::string> >& hltL1Seed =
270  m_hltConfig.hltL1GTSeeds(hltPathName);
271 
272  unsigned int numberHltL1GTSeeds = hltL1Seed.size();
273 
274  edm::LogVerbatim("L1GtTriggerMenuTester") << "\nPath: "
275  << hltPathName << " : <== " << numberHltL1GTSeeds
276  << " HLTLevel1GTSeed module(s)" << std::endl;
277 
278  for (unsigned int iSeedModule = 0; iSeedModule
279  < numberHltL1GTSeeds; ++iSeedModule) {
280 
281  // one needs a non-const logical expression... TODO check why
282  std::string m_l1SeedsLogicalExpression =
283  (hltL1Seed[iSeedModule]).second;
284 
285  edm::LogVerbatim("L1GtTriggerMenuTester") << " '"
286  << m_l1SeedsLogicalExpression << "'";
287 
288  // parse logical expression
289 
290  if (m_l1SeedsLogicalExpression != "L1GlobalDecision") {
291 
292  // check also the logical expression - add/remove spaces if needed
293  L1GtLogicParser m_l1AlgoLogicParser = L1GtLogicParser(
294  m_l1SeedsLogicalExpression);
295 
296  // list of required algorithms for seeding
297  std::vector<L1GtLogicParser::OperandToken>
298  m_l1AlgoSeeds =
299  m_l1AlgoLogicParser.expressionSeedsOperandList();
300  size_t l1AlgoSeedsSize = m_l1AlgoSeeds.size();
301 
302  edm::LogVerbatim("L1GtTriggerMenuTester")
303  << " : <== " << l1AlgoSeedsSize
304  << " L1 seeds" << std::endl;
305 
306  // for each algorithm trigger, check if it is in the L1 menu, get the bit number
307  // and add path to the vector of strings for that bit number
308 
309  for (size_t i = 0; i < l1AlgoSeedsSize; ++i) {
310 
311  const std::string& trigNameOrAlias =
312  (m_l1AlgoSeeds[i]).tokenName;
313 
314  CItAlgo itAlgo = m_algorithmAliasMap->find(
315  trigNameOrAlias);
316  if (itAlgo != m_algorithmAliasMap->end()) {
317 
318  int bitNr = (itAlgo->second).algoBitNumber();
319 
320  (m_hltPathsForL1AlgorithmTrigger.at(bitNr)).push_back(
321  hltPathName);
322 
323  edm::LogVerbatim("L1GtTriggerMenuTester")
324  << " " << trigNameOrAlias
325  << " bit " << bitNr << std::endl;
326 
327  } else {
328 
330  edm::LogVerbatim("L1GtTriggerMenuTester")
331  << " " << trigNameOrAlias
332  << " trigger not in L1 menu "
334  << std::endl;
335 
337  trigNameOrAlias);
338 
339  } else {
340  throw cms::Exception("FailModule")
341  << "\nAlgorithm "
342  << trigNameOrAlias
343  << ", requested as seed by a HLT path, not found in the L1 trigger menu\n "
345  << "\nIncompatible L1 and HLT menus.\n"
346  << std::endl;
347 
348  }
349  }
350  }
351 
352  }
353  }
354 
355  }
356  }
357  } else {
358  // if init returns FALSE, initialization has NOT succeeded, which indicates a problem
359  // with the file and/or code and needs to be investigated!
360  edm::LogError("MyAnalyzer")
361  << " HLT config extraction failure with process name "
362  << m_hltProcessName;
363  }
364 
365 }
366 
367 // printing template for a trigger group
369  const std::map<std::string, const L1GtAlgorithm*>& trigGroup,
370  const bool compactPrint, const bool printPfsRates) {
371 
372  // FIXME get values - either read from a specific L1 menu file, or from
373  std::string lumiVal1 = "5.0E33";
374  std::string lumiVal2 = "7.0E33";
375  std::string trigComment;
376 
377  int trigPfVal1 = 0;
378  int trigPfVal2 = 0;
379 
380  int trigRateVal1 = 0;
381  int trigRateVal2 = 0;
382 
383  // cumulative list of L1 triggers not used as seed by HLT
384  std::vector < std::string > algoTriggerNotSeed;
385  algoTriggerNotSeed.reserve(m_numberAlgorithmTriggers);
386 
387  std::vector < std::string > techTriggerNotSeed;
388  techTriggerNotSeed.reserve(m_numberTechnicalTriggers);
389 
390  // force a page break before each group
391  edm::LogVerbatim("L1GtTriggerMenuTesterWiki")
392  << "<p style=\"page-break-before: always\">&nbsp;</p>";
393 
394  edm::LogVerbatim("L1GtTriggerMenuTesterWiki") << "\n---++++ "
395  << trigGroupName << "\n" << std::endl;
396 
397  if (compactPrint) {
398  edm::LogVerbatim("L1GtTriggerMenuTesterWiki")
399  << "| *Trigger Name* | *Trigger Alias* | *Bit* | *Comments* |"
400  << std::endl;
401 
402  } else {
403 
404  if (printPfsRates) {
405  edm::LogVerbatim("L1GtTriggerMenuTesterWiki")
406  << "| *Trigger Name* | *Trigger Alias* | *Bit* | *Luminosity* |||| *Seed for !HLT path(s)* | *Comments* |"
407  << std::endl;
408 
409  edm::LogVerbatim("L1GtTriggerMenuTesterWiki") << "|^|^|^| *"
410  << lumiVal1 << "* || *" << lumiVal2
411  << "* || ** | ** |" << std::endl;
412 
413  edm::LogVerbatim("L1GtTriggerMenuTesterWiki")
414  << "|^|^|^| *PF* | *Rate* | *PF* | *Rate* | ** | ** |"
415  << std::endl;
416 
417  } else {
418 
419  edm::LogVerbatim("L1GtTriggerMenuTesterWiki")
420  << "| *Trigger Name* | *Trigger Alias* | *Bit* | *Seed for !HLT path(s)* |"
421  << std::endl;
422  }
423 
424  }
425 
426  for (CItAlgoP itAlgo = trigGroup.begin(); itAlgo != trigGroup.end(); itAlgo++) {
427 
428  const std::string& aName = (itAlgo->second)->algoName();
429  const std::string& aAlias = (itAlgo->second)->algoAlias();
430  const int& bitNumber = (itAlgo->second)->algoBitNumber();
431 
432 
433  // concatenate in a string, to simplify the next print instruction
434  std::string seedsHlt;
435  if (m_useHltMenu) {
436  const std::vector<std::string> & hltPaths =
437  m_hltPathsForL1AlgorithmTrigger.at(bitNumber);
438 
439  if (hltPaths.empty()) {
440  algoTriggerNotSeed.push_back(aAlias);
441  seedsHlt
442  = "<font color = \"red\">Not used as seed by any !HLT path</font>";
443  } else {
444 
445  for (std::vector<std::string>::const_iterator strIter =
446  hltPaths.begin(); strIter != hltPaths.end(); ++strIter) {
447 
448  seedsHlt = seedsHlt + (*strIter) + "<BR>";
449  }
450  }
451 
452  }
453 
454  if (compactPrint) {
455  edm::LogVerbatim("L1GtTriggerMenuTesterWiki") << "|" << std::left
456  << "[[" << (m_htmlFile + "#" + aName) << "][ " << aName
457  << "]] " << " |" << aAlias << " | " << bitNumber << "| |"
458  << std::endl;
459 
460  } else {
461 
462  if (printPfsRates) {
463  edm::LogVerbatim("L1GtTriggerMenuTesterWiki") << "|"
464  << std::left << "[[" << (m_htmlFile + "#" + aName)
465  << "][ " << aName << "]] " << " |" << aAlias
466  << " | " << bitNumber << "| "
467  << ((trigPfVal1 != 0) ? trigPfVal1 : 0) << " | "
468  << ((trigRateVal1 != 0) ? trigRateVal1 : 0) << " | "
469  << ((trigPfVal2 != 0) ? trigPfVal2 : 0) << " | "
470  << ((trigRateVal2 != 0) ? trigRateVal2 : 0) << " | "
471  << seedsHlt << " | " << trigComment << " |"
472  << std::endl;
473 
474  } else {
475 
476  edm::LogVerbatim("L1GtTriggerMenuTesterWiki") << "|"
477  << std::left << "[[" << (m_htmlFile + "#" + aName)
478  << "][ " << aName << "]] " << " |" << aAlias
479  << " | " << bitNumber << "|" << seedsHlt << " | "
480  << std::endl;
481  }
482 
483  }
484 
485  }
486 
487  edm::LogVerbatim("L1GtTriggerMenuTesterWiki") << "\n" << trigGroupName
488  << ": " << (trigGroup.size()) << " bits defined." << std::endl;
489 
490  if (m_useHltMenu && (!compactPrint)) {
491  edm::LogVerbatim("L1GtTriggerMenuTesterWiki")
492  << "\n Algorithm triggers from " << trigGroupName
493  << " not used as seeds by !HLT:" << std::endl;
494 
495  if (!algoTriggerNotSeed.empty()) {
496  for (std::vector<std::string>::const_iterator strIter =
497  algoTriggerNotSeed.begin(); strIter
498  != algoTriggerNotSeed.end(); ++strIter) {
499 
500  edm::LogVerbatim("L1GtTriggerMenuTesterWiki") << " * "
501  << (*strIter) << std::endl;
502  }
503 
504  } else {
505  edm::LogVerbatim("L1GtTriggerMenuTesterWiki") << " * none"
506  << std::endl;
507  }
508  }
509 
510 }
511 
514 
515  //
516  // print menu, prescale factors and trigger mask in wiki format
517  //
518 
519  // L1 GT prescale factors for algorithm triggers
520 
521  std::vector<int> prescaleFactorsAlgoTrig = m_prescaleFactorsAlgoTrig->at(
522  m_indexPfSet);
523 
524  // L1 GT prescale factors for technical triggers
525 
526  std::vector<int> prescaleFactorsTechTrig = m_prescaleFactorsTechTrig->at(
527  m_indexPfSet);
528 
529  // use another map <int, L1GtAlgorithm> to get the menu sorted after bit number
530  // both algorithm and bit numbers are unique
531  typedef std::map<int, const L1GtAlgorithm*>::const_iterator CItBit;
532 
533  // algorithm triggers
534 
535  std::map<int, const L1GtAlgorithm*> algoBitToAlgo;
536 
537  std::map<std::string, const L1GtAlgorithm*> jetAlgoTrig;
538  std::map<std::string, const L1GtAlgorithm*> egammaAlgoTrig;
539  std::map<std::string, const L1GtAlgorithm*> esumAlgoTrig;
540  std::map<std::string, const L1GtAlgorithm*> muonAlgoTrig;
541  std::map<std::string, const L1GtAlgorithm*> crossAlgoTrig;
542  std::map<std::string, const L1GtAlgorithm*> bkgdAlgoTrig;
543 
544  int algoTrigNumber = 0;
545  int freeAlgoTrigNumber = 0;
546 
547  int jetAlgoTrigNumber = 0;
548  int egammaAlgoTrigNumber = 0;
549  int esumAlgoTrigNumber = 0;
550  int muonAlgoTrigNumber = 0;
551  int crossAlgoTrigNumber = 0;
552  int bkgdAlgoTrigNumber = 0;
553 
554  for (CItAlgo itAlgo = m_algorithmMap->begin(); itAlgo
555  != m_algorithmMap->end(); itAlgo++) {
556 
557  const int bitNumber = (itAlgo->second).algoBitNumber();
558  const std::string& algName = (itAlgo->second).algoName();
559 
560  algoBitToAlgo[bitNumber] = &(itAlgo->second);
561 
562  algoTrigNumber++;
563 
564  // per category
565 
566  const ConditionMap& conditionMap = (m_l1GtMenu->gtConditionMap()).at(
567  (itAlgo->second).algoChipNumber());
568 
569  const std::vector<L1GtLogicParser::TokenRPN>& rpnVector =
570  (itAlgo->second).algoRpnVector();
571  const L1GtLogicParser::OperationType condOperand =
573 
574  std::list<L1GtObject> listObjects;
575 
576  for (size_t i = 0; i < rpnVector.size(); ++i) {
577 
578  if ((rpnVector[i]).operation == condOperand) {
579 
580  const std::string& cndName = (rpnVector[i]).operand;
581 
582  // search the condition in the condition list
583 
584  bool foundCond = false;
585 
586  CItCond itCond = conditionMap.find(cndName);
587  if (itCond != conditionMap.end()) {
588  foundCond = true;
589 
590  // loop through object types and add them to the list
591 
592  const std::vector<L1GtObject>& objType =
593  (itCond->second)->objectType();
594 
595  for (std::vector<L1GtObject>::const_iterator itObject =
596  objType.begin(); itObject != objType.end(); itObject++) {
597  listObjects.push_back(*itObject);
598 
599  edm::LogVerbatim("L1GtTriggerMenuTester")
600  << (*itObject) << std::endl;
601  }
602 
603  // FIXME for XML parser, add GtExternal to objType correctly
604  if ((itCond->second)->condCategory() == CondExternal) {
605  listObjects.push_back(GtExternal);
606  }
607 
608  }
609 
610  if (!foundCond) {
611 
612  // it should never be happen, all conditions are in the maps
613  throw cms::Exception("FailModule") << "\nCondition "
614  << cndName << " not found in the condition map"
615  << " for chip number "
616  << ((itAlgo->second).algoChipNumber()) << std::endl;
617  }
618 
619  }
620 
621  }
622 
623  // eliminate duplicates
624  listObjects.sort();
625  listObjects.unique();
626 
627  // add the algorithm to the corresponding group
628 
629  bool jetGroup = false;
630  bool egammaGroup = false;
631  bool esumGroup = false;
632  bool muonGroup = false;
633  bool crossGroup = false;
634  bool bkgdGroup = false;
635 
636  for (std::list<L1GtObject>::const_iterator itObj = listObjects.begin(); itObj
637  != listObjects.end(); ++itObj) {
638 
639  switch (*itObj) {
640  case Mu: {
641  muonGroup = true;
642  }
643 
644  break;
645  case NoIsoEG: {
646  egammaGroup = true;
647  }
648 
649  break;
650  case IsoEG: {
651  egammaGroup = true;
652  }
653 
654  break;
655  case CenJet: {
656  jetGroup = true;
657  }
658 
659  break;
660  case ForJet: {
661  jetGroup = true;
662  }
663 
664  break;
665  case TauJet: {
666  jetGroup = true;
667  }
668 
669  break;
670  case ETM: {
671  esumGroup = true;
672 
673  }
674 
675  break;
676  case ETT: {
677  esumGroup = true;
678 
679  }
680 
681  break;
682  case HTT: {
683  esumGroup = true;
684 
685  }
686 
687  break;
688  case HTM: {
689  esumGroup = true;
690 
691  }
692 
693  break;
694  case JetCounts: {
695  // do nothing - not available
696  }
697 
698  break;
699  case HfBitCounts: {
700  bkgdGroup = true;
701  }
702 
703  break;
704  case HfRingEtSums: {
705  bkgdGroup = true;
706  }
707 
708  break;
709  case GtExternal: {
710  bkgdGroup = true;
711  }
712 
713  break;
714  case TechTrig:
715  case Castor:
716  case BPTX:
717  default: {
718  // should not arrive here
719 
720  edm::LogVerbatim("L1GtTriggerMenuTester")
721  << "\n Unknown object of type " << *itObj
722  << std::endl;
723  }
724  break;
725  }
726 
727  }
728 
729  int sumGroup = jetGroup + egammaGroup + esumGroup + muonGroup
730  + crossGroup + bkgdGroup;
731 
732  if (sumGroup > 1) {
733  crossAlgoTrig[algName] = &(itAlgo->second);
734  } else {
735 
736  if (jetGroup) {
737  jetAlgoTrig[algName] = &(itAlgo->second);
738 
739  } else if (egammaGroup) {
740  egammaAlgoTrig[algName] = &(itAlgo->second);
741 
742  } else if (esumGroup && (listObjects.size() > 1)) {
743  crossAlgoTrig[algName] = &(itAlgo->second);
744 
745  } else if (esumGroup) {
746  esumAlgoTrig[algName] = &(itAlgo->second);
747 
748  } else if (muonGroup) {
749  muonAlgoTrig[algName] = &(itAlgo->second);
750 
751  } else if (bkgdGroup) {
752  bkgdAlgoTrig[algName] = &(itAlgo->second);
753 
754  } else {
755  // do nothing
756  }
757 
758  }
759 
760  edm::LogVerbatim("L1GtTriggerMenuTester") << algName << " sum: "
761  << sumGroup << " size: " << listObjects.size() << std::endl;
762 
763  }
764 
765  freeAlgoTrigNumber = m_numberAlgorithmTriggers - algoTrigNumber;
766 
767  jetAlgoTrigNumber = jetAlgoTrig.size();
768  egammaAlgoTrigNumber = egammaAlgoTrig.size();
769  esumAlgoTrigNumber = esumAlgoTrig.size();
770  muonAlgoTrigNumber = muonAlgoTrig.size();
771  crossAlgoTrigNumber = crossAlgoTrig.size();
772  bkgdAlgoTrigNumber = bkgdAlgoTrig.size();
773 
774  // technical triggers
775  std::map<int, const L1GtAlgorithm*> techBitToAlgo;
776 
777  int techTrigNumber = 0;
778  int freeTechTrigNumber = 0;
779 
780  for (CItAlgo itAlgo = m_technicalTriggerMap->begin(); itAlgo
781  != m_technicalTriggerMap->end(); itAlgo++) {
782 
783  int bitNumber = (itAlgo->second).algoBitNumber();
784  techBitToAlgo[bitNumber] = &(itAlgo->second);
785 
786  techTrigNumber++;
787  }
788 
789  freeTechTrigNumber = m_numberTechnicalTriggers - techTrigNumber;
790 
791  // name of the attached HTML file
792  if (!m_overwriteHtmlFile) {
794 
795  // replace "/" with "_"
796  std::replace(menuName.begin(), menuName.end(), '/', '_');
797  m_htmlFile = "%ATTACHURL%/" + menuName + ".html";
798  } else {
799  m_htmlFile = "%ATTACHURL%/" + m_htmlFile;
800  }
801 
802  // header for printing algorithms
803 
804  edm::LogVerbatim("L1GtTriggerMenuTesterWiki")
805  << "\n ********** L1 Trigger Menu - printing in wiki format ********** \n\n"
806  << "\n---+++ L1 menu identification\n"
807  << "\n|L1 Trigger Menu Interface: |!"
808  << m_l1GtMenu->gtTriggerMenuInterface() << " |"
809  << "\n|L1 Trigger Menu Name: |!" << m_l1GtMenu->gtTriggerMenuName()
810  << " |" << "\n|L1 Trigger Menu Implementation: |!"
812  << "\n|Associated L1 scale DB key: |!"
813  << m_l1GtMenu->gtScaleDbKey() << " |" << "\n\n" << std::flush
814  << std::endl;
815 
816  // Overview page
817  edm::LogVerbatim("L1GtTriggerMenuTesterWiki") << "\n---+++ Summary\n"
818  << std::endl;
819  edm::LogVerbatim("L1GtTriggerMenuTesterWiki")
820  << " * Number of algorithm triggers: " << algoTrigNumber
821  << " defined, 128 possible." << std::endl;
822  edm::LogVerbatim("L1GtTriggerMenuTesterWiki")
823  << " * Number of technical triggers: " << techTrigNumber
824  << " defined, 64 possible.<BR><BR>" << std::endl;
825 
826  edm::LogVerbatim("L1GtTriggerMenuTesterWiki")
827  << " * Number of free bits for algorithm triggers: "
828  << freeAlgoTrigNumber << std::endl;
829  edm::LogVerbatim("L1GtTriggerMenuTesterWiki")
830  << " * Number of free bits for technical triggers: "
831  << freeTechTrigNumber << "<BR>" << std::endl;
832 
833  edm::LogVerbatim("L1GtTriggerMenuTesterWiki")
834  << "\nNumber of algorithm triggers per trigger group\n"
835  << std::endl;
836  edm::LogVerbatim("L1GtTriggerMenuTesterWiki")
837  << " | *Trigger group* | *Number of bits used*|" << std::endl;
838  edm::LogVerbatim("L1GtTriggerMenuTesterWiki")
839  << " | Jet algorithm triggers: | " << jetAlgoTrigNumber << "|"
840  << std::endl;
841  edm::LogVerbatim("L1GtTriggerMenuTesterWiki")
842  << " | EGamma algorithm triggers: | " << egammaAlgoTrigNumber
843  << "|" << std::endl;
844  edm::LogVerbatim("L1GtTriggerMenuTesterWiki")
845  << " | Energy sum algorithm triggers: | " << esumAlgoTrigNumber
846  << "|" << std::endl;
847  edm::LogVerbatim("L1GtTriggerMenuTesterWiki")
848  << " | Muon algorithm triggers: | " << muonAlgoTrigNumber
849  << "|" << std::endl;
850  edm::LogVerbatim("L1GtTriggerMenuTesterWiki")
851  << " | Cross algorithm triggers: | " << crossAlgoTrigNumber
852  << "|" << std::endl;
853  edm::LogVerbatim("L1GtTriggerMenuTesterWiki")
854  << " | Background algorithm triggers: | " << bkgdAlgoTrigNumber
855  << "|" << std::endl;
856 
857  // force a page break
858  edm::LogVerbatim("L1GtTriggerMenuTesterWiki")
859  << "<p style=\"page-break-before: always\">&nbsp;</p>";
860 
861  // compact print - without HLT path
862  bool compactPrint = true;
863 
864  edm::LogVerbatim("L1GtTriggerMenuTesterWiki")
865  << "\n---+++ List of algorithm triggers sorted by trigger groups\n"
866  << std::endl;
867 
868  // Jet algorithm triggers
869  printTriggerGroup("Jet algorithm triggers", jetAlgoTrig, compactPrint,
871 
872  // EGamma algorithm triggers
873  printTriggerGroup("EGamma algorithm triggers", egammaAlgoTrig,
874  compactPrint, m_printPfsRates);
875 
876  // Energy sum algorithm triggers
877  printTriggerGroup("Energy sum algorithm triggers", esumAlgoTrig,
878  compactPrint, m_printPfsRates);
879 
880  // Muon algorithm triggers
881  printTriggerGroup("Muon algorithm triggers", muonAlgoTrig, compactPrint,
883 
884  // Cross algorithm triggers
885  printTriggerGroup("Cross algorithm triggers", crossAlgoTrig, compactPrint,
887 
888  // Background algorithm triggers
889  printTriggerGroup("Background algorithm triggers", bkgdAlgoTrig,
890  compactPrint, m_printPfsRates);
891 
892  // force a page break
893  edm::LogVerbatim("L1GtTriggerMenuTesterWiki")
894  << "<p style=\"page-break-before: always\">&nbsp;</p>";
895 
896  edm::LogVerbatim("L1GtTriggerMenuTesterWiki")
897  << "\n---+++ List of algorithm triggers sorted by bits\n"
898  << std::endl;
899 
900  edm::LogVerbatim("L1GtTriggerMenuTesterWiki")
901  << "| *Algorithm* | *Alias* | *Bit number* |" << std::endl;
902 
903  for (CItBit itBit = algoBitToAlgo.begin(); itBit != algoBitToAlgo.end(); itBit++) {
904 
905  int bitNumber = itBit->first;
906  std::string aName = (itBit->second)->algoName();
907  std::string aAlias = (itBit->second)->algoAlias();
908 
909  edm::LogVerbatim("L1GtTriggerMenuTesterWiki") << "|" << std::left
910  << "[[" << (m_htmlFile + "#" + aName) << "][ " << aName
911  << "]] " << " |" << aAlias << " | " << bitNumber << "| |"
912  << std::endl;
913 
914  }
915 
916  // force a page break
917  edm::LogVerbatim("L1GtTriggerMenuTesterWiki")
918  << "<p style=\"page-break-before: always\">&nbsp;</p>";
919  edm::LogVerbatim("L1GtTriggerMenuTesterWiki")
920  << "\n---+++ List of technical triggers\n" << std::endl;
921 
922  edm::LogVerbatim("L1GtTriggerMenuTesterWiki")
923  << "| *Technical trigger* | *Bit number* |" << std::endl;
924 
925  for (CItBit itBit = techBitToAlgo.begin(); itBit != techBitToAlgo.end(); itBit++) {
926 
927  int bitNumber = itBit->first;
928  std::string aName = (itBit->second)->algoName();
929  std::string aAlias = (itBit->second)->algoAlias();
930 
931  edm::LogVerbatim("L1GtTriggerMenuTesterWiki") << "|!" << std::left
932  << aName << " | " << std::right << bitNumber << " |"
933  << std::endl;
934  }
935 
936  // force a page break
937  edm::LogVerbatim("L1GtTriggerMenuTesterWiki")
938  << "<p style=\"page-break-before: always\">&nbsp;</p>";
939 
940  // compact print false: with HLT path association, if the parameter m_useHltMenu is true
941  // otherwise, we have no association computed
942 
943  if (m_useHltMenu) {
944  compactPrint = false;
945  } else {
946  return;
947  }
948 
949  edm::LogVerbatim("L1GtTriggerMenuTesterWiki")
950  << "\n---+++ List of algorithm triggers sorted by trigger groups, including !HLT path association \n"
951  << std::endl;
952 
953  edm::LogVerbatim("L1GtTriggerMenuTesterWiki")
954  << "\n The following !HLT menu was used to associate the !HLT path to the L1 algorithm triggers:\n "
955  << std::endl;
956  edm::LogVerbatim("L1GtTriggerMenuTesterWiki") << m_hltTableName
957  << std::endl;
958 
959  // Jet algorithm triggers
960  printTriggerGroup("Jet algorithm triggers", jetAlgoTrig, compactPrint,
962 
963  // EGamma algorithm triggers
964  printTriggerGroup("EGamma algorithm triggers", egammaAlgoTrig,
965  compactPrint, m_printPfsRates);
966 
967  // Energy sum algorithm triggers
968  printTriggerGroup("Energy sum algorithm triggers", esumAlgoTrig,
969  compactPrint, m_printPfsRates);
970 
971  // Muon algorithm triggers
972  printTriggerGroup("Muon algorithm triggers", muonAlgoTrig, compactPrint,
974 
975  // Cross algorithm triggers
976  printTriggerGroup("Cross algorithm triggers", crossAlgoTrig, compactPrint,
978 
979  // Background algorithm triggers
980  printTriggerGroup("Background algorithm triggers", bkgdAlgoTrig,
981  compactPrint, m_printPfsRates);
982 
983 }
unsigned int size() const
number of trigger paths in trigger table
std::vector< L1GtLogicParser::OperandToken > expressionSeedsOperandList()
const std::string & gtTriggerMenuName() const
void printTriggerGroup(const std::string &trigGroupName, const std::map< std::string, const L1GtAlgorithm * > &trigGroup, const bool compactPrint, const bool printPfsRates)
printing template for a trigger group
bool m_overwriteHtmlFile
input parameters
void endJob() override
end job
const std::vector< std::vector< int > > * m_prescaleFactorsTechTrig
Definition: L1GtObject.h:39
const std::string & triggerName(unsigned int triggerIndex) const
L1GtTriggerMenuTester(const edm::ParameterSet &)
std::map< std::string, L1GtCondition * > ConditionMap
map containing the conditions
const L1GtStableParameters * m_l1GtStablePar
event setup cached stuff
Definition: L1GtObject.h:36
const std::vector< unsigned int > * m_triggerMaskVetoAlgoTrig
ConditionMap::const_iterator CItCond
iterators through map containing the conditions
void associateL1SeedsHltPath(const edm::Run &, const edm::EventSetup &)
L1 seed - HLT path association.
void beginRun(const edm::Run &, const edm::EventSetup &) override
begin run
const std::vector< std::vector< std::pair< bool, std::string > > > & hltL1GTSeeds() const
def replace(string, replacements)
bool m_printPfsRates
print prescale factors and rates
std::string m_hltTableName
HLT menu was used to associate the HLT path to the L1 algorithm triggers.
const AlgorithmMap * m_algorithmAliasMap
const std::string & gtTriggerMenuImplementation() const
HLTConfigProvider m_hltConfig
The instance of the HLTConfigProvider as a data member.
const L1GtTriggerMenu * m_l1GtMenu
const std::string & tableName() const
HLT ConfDB table name.
const AlgorithmMap * m_algorithmMap
const L1GtTriggerMask * m_l1GtTmVetoAlgo
const std::vector< ConditionMap > & gtConditionMap() const
get / set / build the condition maps
const L1GtPrescaleFactors * m_l1GtPfTech
const std::vector< unsigned int > * m_triggerMaskAlgoTrig
void printWiki()
printing in Wiki format
AlgorithmMap::const_iterator CItAlgo
iterators through map containing the algorithms
Definition: L1GtObject.h:38
U second(std::pair< T, U > const &p)
void endRun(const edm::Run &, const edm::EventSetup &) override
end run
unsigned int gtNumberTechnicalTriggers() const
get / set the number of technical triggers
unsigned int gtNumberPhysTriggers() const
get / set the number of physics trigger algorithms
int iEvent
Definition: GenABIO.cc:230
std::vector< std::string > m_techTriggerSeedNotInL1Menu
void endLuminosityBlock(const edm::LuminosityBlock &, const edm::EventSetup &) override
end luminosity block
const std::vector< unsigned int > & gtTriggerMask() const
get the trigger mask
void print(std::ostream &, int &) const
const std::string & gtScaleDbKey() const
menu associated scale key
void analyze(const edm::Event &, const edm::EventSetup &) override
analyze
int m_indexPfSet
index of prescale factor set to be printed
const std::vector< unsigned int > * m_triggerMaskVetoTechTrig
bool m_useHltMenu
use a HLT menu for L1 seed - HLT path association
std::map< std::string, const L1GtAlgorithm * >::const_iterator CItAlgoP
constant iterator
const L1GtTriggerMask * m_l1GtTmAlgo
trigger masks & veto masks
const std::string & gtTriggerMenuInterface() const
get / set the trigger menu names
const std::vector< std::vector< int > > & gtPrescaleFactors() const
get the prescale factors by reference
Definition: L1GtObject.h:30
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d&#39;tor
const std::vector< std::vector< int > > * m_prescaleFactorsAlgoTrig
const L1GtPrescaleFactors * m_l1GtPfAlgo
prescale factors
unsigned int m_numberAlgorithmTriggers
number of algorithm triggers
Definition: L1GtObject.h:37
T get() const
Definition: EventSetup.h:63
const AlgorithmMap & gtAlgorithmMap() const
get / set the algorithm map (by name)
const AlgorithmMap * m_technicalTriggerMap
void beginLuminosityBlock(const edm::LuminosityBlock &, const edm::EventSetup &) override
begin luminosity block
const L1GtTriggerMask * m_l1GtTmTech
std::vector< std::string > m_algoTriggerSeedNotInL1Menu
vector of algorithm or technical triggers not in the L1 menu
std::vector< std::vector< std::string > > m_hltPathsForL1TechnicalTrigger
vector of HLT paths seeded by a L1 technical trigger - vector index corresponds to the bit number ...
const L1GtTriggerMask * m_l1GtTmVetoTech
std::vector< std::vector< std::string > > m_hltPathsForL1AlgorithmTrigger
vector of HLT paths seeded by a L1 algorithm trigger - vector index corresponds to the bit number ...
const AlgorithmMap & gtTechnicalTriggerMap() const
get / set the technical trigger map
const AlgorithmMap & gtAlgorithmAliasMap() const
get / set the algorithm map (by alias)
void beginJob() override
begin job
void retrieveL1EventSetup(const edm::EventSetup &)
retrieve all the relevant L1 trigger event setup records
T const * product() const
Definition: ESHandle.h:86
std::string m_htmlFile
name of HTML file attached to the wiki page
std::string m_hltProcessName
process name of HLT process for which to get HLT configuration
unsigned int m_numberTechnicalTriggers
number of technical triggers
Definition: Run.h:44
const std::vector< unsigned int > * m_triggerMaskTechTrig