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(parSet.getParameter<bool>("NoThrowIncompatibleMenu")),
65  m_printPfsRates(parSet.getParameter<bool>("PrintPfsRates")),
66  m_indexPfSet(parSet.getParameter<int>("IndexPfSet")),
67  m_numberAlgorithmTriggers(0),
68  m_numberTechnicalTriggers(0) {
69  // empty
70 }
71 
72 // destructor
74  // empty
75 }
76 
77 // begin job
79 
80 // begin run
81 void L1GtTriggerMenuTester::beginRun(const edm::Run& iRun, const edm::EventSetup& evSetup) {
82  // retrieve L1 trigger configuration
83  retrieveL1EventSetup(evSetup);
84 
85  // print with various level of verbosity
86 
87  // define an output stream to print into
88  // it can then be directed to whatever log level is desired
89  std::ostringstream myCout;
90 
91  int printVerbosity = 0;
92  m_l1GtMenu->print(myCout, printVerbosity);
93  myCout << std::flush << std::endl;
94 
95  printVerbosity = 1;
96  m_l1GtMenu->print(myCout, printVerbosity);
97  myCout << std::flush << std::endl;
98 
99  printVerbosity = 2;
100  m_l1GtMenu->print(myCout, printVerbosity);
101  myCout << std::flush << std::endl;
102 
103  // redirect myCout to edm::LogVerbatim TODO - parameter to choose the log
104  edm::LogVerbatim("L1GtTriggerMenuTester") << myCout.str() << std::endl;
105 
106  // prepare L1 - HLT
107  if (m_useHltMenu) {
108  associateL1SeedsHltPath(iRun, evSetup);
109 
111  edm::LogVerbatim("L1GtTriggerMenuTester")
112  << "\n List of algorithm triggers used as L1 seeds but not in L1 menu" << std::endl;
113 
114  for (std::vector<std::string>::const_iterator strIter = m_algoTriggerSeedNotInL1Menu.begin();
115  strIter != m_algoTriggerSeedNotInL1Menu.end();
116  ++strIter) {
117  edm::LogVerbatim("L1GtTriggerMenuTester") << " " << (*strIter) << std::endl;
118  }
119  }
120  }
121 
122  // print in wiki format
123  printWiki();
124 }
125 
126 // begin luminosity block
128  const edm::EventSetup& evSetup) {}
129 
130 // loop over events
132  // empty
133 }
134 
135 // end luminosity block
137 
138 }
139 
140 // end run
142 
143 // end job
145 
147  // get / update the stable parameters from the EventSetup
148 
150  evSetup.get<L1GtStableParametersRcd>().get(l1GtStablePar);
151  m_l1GtStablePar = l1GtStablePar.product();
152 
153  // number of algorithm triggers
155 
156  // number of technical triggers
158 
159  // int maxNumberTrigger = std::max(m_numberAlgorithmTriggers,
160  // m_numberTechnicalTriggers);
161 
162  // m_triggerMaskSet.reserve(maxNumberTrigger);
163  // m_prescaleFactorSet.reserve(maxNumberTrigger);
164 
165  // get / update the prescale factors from the EventSetup
166 
168  evSetup.get<L1GtPrescaleFactorsAlgoTrigRcd>().get(l1GtPfAlgo);
169  m_l1GtPfAlgo = l1GtPfAlgo.product();
170 
172 
174  evSetup.get<L1GtPrescaleFactorsTechTrigRcd>().get(l1GtPfTech);
175  m_l1GtPfTech = l1GtPfTech.product();
176 
178 
179  // get / update the trigger mask from the EventSetup
180 
182  evSetup.get<L1GtTriggerMaskAlgoTrigRcd>().get(l1GtTmAlgo);
183  m_l1GtTmAlgo = l1GtTmAlgo.product();
184 
186 
188  evSetup.get<L1GtTriggerMaskTechTrigRcd>().get(l1GtTmTech);
189  m_l1GtTmTech = l1GtTmTech.product();
190 
192 
193  edm::ESHandle<L1GtTriggerMask> l1GtTmVetoAlgo;
194  evSetup.get<L1GtTriggerMaskVetoAlgoTrigRcd>().get(l1GtTmVetoAlgo);
195  m_l1GtTmVetoAlgo = l1GtTmVetoAlgo.product();
196 
198 
199  edm::ESHandle<L1GtTriggerMask> l1GtTmVetoTech;
200  evSetup.get<L1GtTriggerMaskVetoTechTrigRcd>().get(l1GtTmVetoTech);
201  m_l1GtTmVetoTech = l1GtTmVetoTech.product();
202 
204 
205  // get / update the trigger menu from the EventSetup
206 
208  evSetup.get<L1GtTriggerMenuRcd>().get(l1GtMenu);
209  m_l1GtMenu = l1GtMenu.product();
213 }
214 
216  bool hltChanged = true;
217 
218  if (m_hltConfig.init(iRun, evSetup, m_hltProcessName, hltChanged)) {
219  // if init returns TRUE, initialization has succeeded!
220  if (hltChanged) {
221  // HLT configuration has actually changed wrt the previous run
223 
224  edm::LogVerbatim("L1GtTriggerMenuTester") << "\nHLT ConfDB menu name: \n " << m_hltTableName << std::endl;
225 
226  // loop over trigger paths, get the HLTLevel1GTSeed logical expression, and add the path to
227  // each L1 trigger
228 
231 
234 
235  for (unsigned int iHlt = 0; iHlt < m_hltConfig.size(); ++iHlt) {
236  const std::string& hltPathName = m_hltConfig.triggerName(iHlt);
237 
238  const std::vector<std::pair<bool, std::string> >& hltL1Seed = m_hltConfig.hltL1GTSeeds(hltPathName);
239 
240  unsigned int numberHltL1GTSeeds = hltL1Seed.size();
241 
242  edm::LogVerbatim("L1GtTriggerMenuTester") << "\nPath: " << hltPathName << " : <== " << numberHltL1GTSeeds
243  << " HLTLevel1GTSeed module(s)" << std::endl;
244 
245  for (unsigned int iSeedModule = 0; iSeedModule < numberHltL1GTSeeds; ++iSeedModule) {
246  // one needs a non-const logical expression... TODO check why
247  std::string m_l1SeedsLogicalExpression = (hltL1Seed[iSeedModule]).second;
248 
249  edm::LogVerbatim("L1GtTriggerMenuTester") << " '" << m_l1SeedsLogicalExpression << "'";
250 
251  // parse logical expression
252 
253  if (m_l1SeedsLogicalExpression != "L1GlobalDecision") {
254  // check also the logical expression - add/remove spaces if needed
255  L1GtLogicParser m_l1AlgoLogicParser = L1GtLogicParser(m_l1SeedsLogicalExpression);
256 
257  // list of required algorithms for seeding
258  std::vector<L1GtLogicParser::OperandToken> m_l1AlgoSeeds = m_l1AlgoLogicParser.expressionSeedsOperandList();
259  size_t l1AlgoSeedsSize = m_l1AlgoSeeds.size();
260 
261  edm::LogVerbatim("L1GtTriggerMenuTester") << " : <== " << l1AlgoSeedsSize << " L1 seeds" << std::endl;
262 
263  // for each algorithm trigger, check if it is in the L1 menu, get the bit number
264  // and add path to the vector of strings for that bit number
265 
266  for (size_t i = 0; i < l1AlgoSeedsSize; ++i) {
267  const std::string& trigNameOrAlias = (m_l1AlgoSeeds[i]).tokenName;
268 
269  CItAlgo itAlgo = m_algorithmAliasMap->find(trigNameOrAlias);
270  if (itAlgo != m_algorithmAliasMap->end()) {
271  int bitNr = (itAlgo->second).algoBitNumber();
272 
273  (m_hltPathsForL1AlgorithmTrigger.at(bitNr)).push_back(hltPathName);
274 
275  edm::LogVerbatim("L1GtTriggerMenuTester")
276  << " " << trigNameOrAlias << " bit " << bitNr << std::endl;
277 
278  } else {
280  edm::LogVerbatim("L1GtTriggerMenuTester")
281  << " " << trigNameOrAlias << " trigger not in L1 menu " << m_l1GtMenu->gtTriggerMenuName()
282  << std::endl;
283 
284  m_algoTriggerSeedNotInL1Menu.push_back(trigNameOrAlias);
285 
286  } else {
287  throw cms::Exception("FailModule")
288  << "\nAlgorithm " << trigNameOrAlias
289  << ", requested as seed by a HLT path, not found in the L1 trigger menu\n "
290  << m_l1GtMenu->gtTriggerMenuName() << "\nIncompatible L1 and HLT menus.\n"
291  << std::endl;
292  }
293  }
294  }
295  }
296  }
297  }
298  }
299  } else {
300  // if init returns FALSE, initialization has NOT succeeded, which indicates a problem
301  // with the file and/or code and needs to be investigated!
302  edm::LogError("MyAnalyzer") << " HLT config extraction failure with process name " << m_hltProcessName;
303  }
304 }
305 
306 // printing template for a trigger group
308  const std::map<std::string, const L1GtAlgorithm*>& trigGroup,
309  const bool compactPrint,
310  const bool printPfsRates) {
311  // FIXME get values - either read from a specific L1 menu file, or from
312  std::string lumiVal1 = "5.0E33";
313  std::string lumiVal2 = "7.0E33";
314  std::string trigComment;
315 
316  int trigPfVal1 = 0;
317  int trigPfVal2 = 0;
318 
319  int trigRateVal1 = 0;
320  int trigRateVal2 = 0;
321 
322  // cumulative list of L1 triggers not used as seed by HLT
323  std::vector<std::string> algoTriggerNotSeed;
324  algoTriggerNotSeed.reserve(m_numberAlgorithmTriggers);
325 
326  std::vector<std::string> techTriggerNotSeed;
327  techTriggerNotSeed.reserve(m_numberTechnicalTriggers);
328 
329  // force a page break before each group
330  edm::LogVerbatim("L1GtTriggerMenuTesterWiki") << "<p style=\"page-break-before: always\">&nbsp;</p>";
331 
332  edm::LogVerbatim("L1GtTriggerMenuTesterWiki") << "\n---++++ " << trigGroupName << "\n" << std::endl;
333 
334  if (compactPrint) {
335  edm::LogVerbatim("L1GtTriggerMenuTesterWiki")
336  << "| *Trigger Name* | *Trigger Alias* | *Bit* | *Comments* |" << std::endl;
337 
338  } else {
339  if (printPfsRates) {
340  edm::LogVerbatim("L1GtTriggerMenuTesterWiki") << "| *Trigger Name* | *Trigger Alias* | *Bit* | "
341  "*Luminosity* |||| *Seed for !HLT path(s)* | *Comments* |"
342  << std::endl;
343 
344  edm::LogVerbatim("L1GtTriggerMenuTesterWiki")
345  << "|^|^|^| *" << lumiVal1 << "* || *" << lumiVal2 << "* || ** | ** |" << std::endl;
346 
347  edm::LogVerbatim("L1GtTriggerMenuTesterWiki")
348  << "|^|^|^| *PF* | *Rate* | *PF* | *Rate* | ** | ** |" << std::endl;
349 
350  } else {
351  edm::LogVerbatim("L1GtTriggerMenuTesterWiki")
352  << "| *Trigger Name* | *Trigger Alias* | *Bit* | *Seed for !HLT path(s)* |" << std::endl;
353  }
354  }
355 
356  for (CItAlgoP itAlgo = trigGroup.begin(); itAlgo != trigGroup.end(); itAlgo++) {
357  const std::string& aName = (itAlgo->second)->algoName();
358  const std::string& aAlias = (itAlgo->second)->algoAlias();
359  const int& bitNumber = (itAlgo->second)->algoBitNumber();
360 
361  // concatenate in a string, to simplify the next print instruction
362  std::string seedsHlt;
363  if (m_useHltMenu) {
364  const std::vector<std::string>& hltPaths = m_hltPathsForL1AlgorithmTrigger.at(bitNumber);
365 
366  if (hltPaths.empty()) {
367  algoTriggerNotSeed.push_back(aAlias);
368  seedsHlt = "<font color = \"red\">Not used as seed by any !HLT path</font>";
369  } else {
370  for (std::vector<std::string>::const_iterator strIter = hltPaths.begin(); strIter != hltPaths.end();
371  ++strIter) {
372  seedsHlt = seedsHlt + (*strIter) + "<BR>";
373  }
374  }
375  }
376 
377  if (compactPrint) {
378  edm::LogVerbatim("L1GtTriggerMenuTesterWiki")
379  << "|" << std::left << "[[" << (m_htmlFile + "#" + aName) << "][ " << aName << "]] "
380  << " |" << aAlias << " | " << bitNumber << "| |" << std::endl;
381 
382  } else {
383  if (printPfsRates) {
384  edm::LogVerbatim("L1GtTriggerMenuTesterWiki")
385  << "|" << std::left << "[[" << (m_htmlFile + "#" + aName) << "][ " << aName << "]] "
386  << " |" << aAlias << " | " << bitNumber << "| " << ((trigPfVal1 != 0) ? trigPfVal1 : 0) << " | "
387  << ((trigRateVal1 != 0) ? trigRateVal1 : 0) << " | " << ((trigPfVal2 != 0) ? trigPfVal2 : 0) << " | "
388  << ((trigRateVal2 != 0) ? trigRateVal2 : 0) << " | " << seedsHlt << " | " << trigComment << " |"
389  << std::endl;
390 
391  } else {
392  edm::LogVerbatim("L1GtTriggerMenuTesterWiki")
393  << "|" << std::left << "[[" << (m_htmlFile + "#" + aName) << "][ " << aName << "]] "
394  << " |" << aAlias << " | " << bitNumber << "|" << seedsHlt << " | " << std::endl;
395  }
396  }
397  }
398 
399  edm::LogVerbatim("L1GtTriggerMenuTesterWiki")
400  << "\n"
401  << trigGroupName << ": " << (trigGroup.size()) << " bits defined." << std::endl;
402 
403  if (m_useHltMenu && (!compactPrint)) {
404  edm::LogVerbatim("L1GtTriggerMenuTesterWiki")
405  << "\n Algorithm triggers from " << trigGroupName << " not used as seeds by !HLT:" << std::endl;
406 
407  if (!algoTriggerNotSeed.empty()) {
408  for (std::vector<std::string>::const_iterator strIter = algoTriggerNotSeed.begin();
409  strIter != algoTriggerNotSeed.end();
410  ++strIter) {
411  edm::LogVerbatim("L1GtTriggerMenuTesterWiki") << " * " << (*strIter) << std::endl;
412  }
413 
414  } else {
415  edm::LogVerbatim("L1GtTriggerMenuTesterWiki") << " * none" << std::endl;
416  }
417  }
418 }
419 
422  //
423  // print menu, prescale factors and trigger mask in wiki format
424  //
425 
426  // L1 GT prescale factors for algorithm triggers
427 
428  std::vector<int> prescaleFactorsAlgoTrig = m_prescaleFactorsAlgoTrig->at(m_indexPfSet);
429 
430  // L1 GT prescale factors for technical triggers
431 
432  std::vector<int> prescaleFactorsTechTrig = m_prescaleFactorsTechTrig->at(m_indexPfSet);
433 
434  // use another map <int, L1GtAlgorithm> to get the menu sorted after bit number
435  // both algorithm and bit numbers are unique
436  typedef std::map<int, const L1GtAlgorithm*>::const_iterator CItBit;
437 
438  // algorithm triggers
439 
440  std::map<int, const L1GtAlgorithm*> algoBitToAlgo;
441 
442  std::map<std::string, const L1GtAlgorithm*> jetAlgoTrig;
443  std::map<std::string, const L1GtAlgorithm*> egammaAlgoTrig;
444  std::map<std::string, const L1GtAlgorithm*> esumAlgoTrig;
445  std::map<std::string, const L1GtAlgorithm*> muonAlgoTrig;
446  std::map<std::string, const L1GtAlgorithm*> crossAlgoTrig;
447  std::map<std::string, const L1GtAlgorithm*> bkgdAlgoTrig;
448 
449  int algoTrigNumber = 0;
450  int freeAlgoTrigNumber = 0;
451 
452  int jetAlgoTrigNumber = 0;
453  int egammaAlgoTrigNumber = 0;
454  int esumAlgoTrigNumber = 0;
455  int muonAlgoTrigNumber = 0;
456  int crossAlgoTrigNumber = 0;
457  int bkgdAlgoTrigNumber = 0;
458 
459  for (CItAlgo itAlgo = m_algorithmMap->begin(); itAlgo != m_algorithmMap->end(); itAlgo++) {
460  const int bitNumber = (itAlgo->second).algoBitNumber();
461  const std::string& algName = (itAlgo->second).algoName();
462 
463  algoBitToAlgo[bitNumber] = &(itAlgo->second);
464 
465  algoTrigNumber++;
466 
467  // per category
468 
469  const ConditionMap& conditionMap = (m_l1GtMenu->gtConditionMap()).at((itAlgo->second).algoChipNumber());
470 
471  const std::vector<L1GtLogicParser::TokenRPN>& rpnVector = (itAlgo->second).algoRpnVector();
473 
474  std::list<L1GtObject> listObjects;
475 
476  for (size_t i = 0; i < rpnVector.size(); ++i) {
477  if ((rpnVector[i]).operation == condOperand) {
478  const std::string& cndName = (rpnVector[i]).operand;
479 
480  // search the condition in the condition list
481 
482  bool foundCond = false;
483 
484  CItCond itCond = conditionMap.find(cndName);
485  if (itCond != conditionMap.end()) {
486  foundCond = true;
487 
488  // loop through object types and add them to the list
489 
490  const std::vector<L1GtObject>& objType = (itCond->second)->objectType();
491 
492  for (std::vector<L1GtObject>::const_iterator itObject = objType.begin(); itObject != objType.end();
493  itObject++) {
494  listObjects.push_back(*itObject);
495 
496  edm::LogVerbatim("L1GtTriggerMenuTester") << (*itObject) << std::endl;
497  }
498 
499  // FIXME for XML parser, add GtExternal to objType correctly
500  if ((itCond->second)->condCategory() == CondExternal) {
501  listObjects.push_back(GtExternal);
502  }
503  }
504 
505  if (!foundCond) {
506  // it should never be happen, all conditions are in the maps
507  throw cms::Exception("FailModule") << "\nCondition " << cndName << " not found in the condition map"
508  << " for chip number " << ((itAlgo->second).algoChipNumber()) << std::endl;
509  }
510  }
511  }
512 
513  // eliminate duplicates
514  listObjects.sort();
515  listObjects.unique();
516 
517  // add the algorithm to the corresponding group
518 
519  bool jetGroup = false;
520  bool egammaGroup = false;
521  bool esumGroup = false;
522  bool muonGroup = false;
523  bool crossGroup = false;
524  bool bkgdGroup = false;
525 
526  for (std::list<L1GtObject>::const_iterator itObj = listObjects.begin(); itObj != listObjects.end(); ++itObj) {
527  switch (*itObj) {
528  case Mu: {
529  muonGroup = true;
530  }
531 
532  break;
533  case NoIsoEG: {
534  egammaGroup = true;
535  }
536 
537  break;
538  case IsoEG: {
539  egammaGroup = true;
540  }
541 
542  break;
543  case CenJet: {
544  jetGroup = true;
545  }
546 
547  break;
548  case ForJet: {
549  jetGroup = true;
550  }
551 
552  break;
553  case TauJet: {
554  jetGroup = true;
555  }
556 
557  break;
558  case ETM: {
559  esumGroup = true;
560 
561  }
562 
563  break;
564  case ETT: {
565  esumGroup = true;
566 
567  }
568 
569  break;
570  case HTT: {
571  esumGroup = true;
572 
573  }
574 
575  break;
576  case HTM: {
577  esumGroup = true;
578 
579  }
580 
581  break;
582  case JetCounts: {
583  // do nothing - not available
584  }
585 
586  break;
587  case HfBitCounts: {
588  bkgdGroup = true;
589  }
590 
591  break;
592  case HfRingEtSums: {
593  bkgdGroup = true;
594  }
595 
596  break;
597  case GtExternal: {
598  bkgdGroup = true;
599  }
600 
601  break;
602  case TechTrig:
603  case Castor:
604  case BPTX:
605  default: {
606  // should not arrive here
607 
608  edm::LogVerbatim("L1GtTriggerMenuTester") << "\n Unknown object of type " << *itObj << std::endl;
609  } break;
610  }
611  }
612 
613  int sumGroup = jetGroup + egammaGroup + esumGroup + muonGroup + crossGroup + bkgdGroup;
614 
615  if (sumGroup > 1) {
616  crossAlgoTrig[algName] = &(itAlgo->second);
617  } else {
618  if (jetGroup) {
619  jetAlgoTrig[algName] = &(itAlgo->second);
620 
621  } else if (egammaGroup) {
622  egammaAlgoTrig[algName] = &(itAlgo->second);
623 
624  } else if (esumGroup && (listObjects.size() > 1)) {
625  crossAlgoTrig[algName] = &(itAlgo->second);
626 
627  } else if (esumGroup) {
628  esumAlgoTrig[algName] = &(itAlgo->second);
629 
630  } else if (muonGroup) {
631  muonAlgoTrig[algName] = &(itAlgo->second);
632 
633  } else if (bkgdGroup) {
634  bkgdAlgoTrig[algName] = &(itAlgo->second);
635 
636  } else {
637  // do nothing
638  }
639  }
640 
641  edm::LogVerbatim("L1GtTriggerMenuTester")
642  << algName << " sum: " << sumGroup << " size: " << listObjects.size() << std::endl;
643  }
644 
645  freeAlgoTrigNumber = m_numberAlgorithmTriggers - algoTrigNumber;
646 
647  jetAlgoTrigNumber = jetAlgoTrig.size();
648  egammaAlgoTrigNumber = egammaAlgoTrig.size();
649  esumAlgoTrigNumber = esumAlgoTrig.size();
650  muonAlgoTrigNumber = muonAlgoTrig.size();
651  crossAlgoTrigNumber = crossAlgoTrig.size();
652  bkgdAlgoTrigNumber = bkgdAlgoTrig.size();
653 
654  // technical triggers
655  std::map<int, const L1GtAlgorithm*> techBitToAlgo;
656 
657  int techTrigNumber = 0;
658  int freeTechTrigNumber = 0;
659 
660  for (CItAlgo itAlgo = m_technicalTriggerMap->begin(); itAlgo != m_technicalTriggerMap->end(); itAlgo++) {
661  int bitNumber = (itAlgo->second).algoBitNumber();
662  techBitToAlgo[bitNumber] = &(itAlgo->second);
663 
664  techTrigNumber++;
665  }
666 
667  freeTechTrigNumber = m_numberTechnicalTriggers - techTrigNumber;
668 
669  // name of the attached HTML file
670  if (!m_overwriteHtmlFile) {
672 
673  // replace "/" with "_"
674  std::replace(menuName.begin(), menuName.end(), '/', '_');
675  m_htmlFile = "%ATTACHURL%/" + menuName + ".html";
676  } else {
677  m_htmlFile = "%ATTACHURL%/" + m_htmlFile;
678  }
679 
680  // header for printing algorithms
681 
682  edm::LogVerbatim("L1GtTriggerMenuTesterWiki")
683  << "\n ********** L1 Trigger Menu - printing in wiki format ********** \n\n"
684  << "\n---+++ L1 menu identification\n"
685  << "\n|L1 Trigger Menu Interface: |!" << m_l1GtMenu->gtTriggerMenuInterface() << " |"
686  << "\n|L1 Trigger Menu Name: |!" << m_l1GtMenu->gtTriggerMenuName() << " |"
687  << "\n|L1 Trigger Menu Implementation: |!" << m_l1GtMenu->gtTriggerMenuImplementation() << " |"
688  << "\n|Associated L1 scale DB key: |!" << m_l1GtMenu->gtScaleDbKey() << " |"
689  << "\n\n"
690  << std::flush << std::endl;
691 
692  // Overview page
693  edm::LogVerbatim("L1GtTriggerMenuTesterWiki") << "\n---+++ Summary\n" << std::endl;
694  edm::LogVerbatim("L1GtTriggerMenuTesterWiki")
695  << " * Number of algorithm triggers: " << algoTrigNumber << " defined, 128 possible." << std::endl;
696  edm::LogVerbatim("L1GtTriggerMenuTesterWiki")
697  << " * Number of technical triggers: " << techTrigNumber << " defined, 64 possible.<BR><BR>" << std::endl;
698 
699  edm::LogVerbatim("L1GtTriggerMenuTesterWiki")
700  << " * Number of free bits for algorithm triggers: " << freeAlgoTrigNumber << std::endl;
701  edm::LogVerbatim("L1GtTriggerMenuTesterWiki")
702  << " * Number of free bits for technical triggers: " << freeTechTrigNumber << "<BR>" << std::endl;
703 
704  edm::LogVerbatim("L1GtTriggerMenuTesterWiki") << "\nNumber of algorithm triggers per trigger group\n" << std::endl;
705  edm::LogVerbatim("L1GtTriggerMenuTesterWiki") << " | *Trigger group* | *Number of bits used*|" << std::endl;
706  edm::LogVerbatim("L1GtTriggerMenuTesterWiki")
707  << " | Jet algorithm triggers: | " << jetAlgoTrigNumber << "|" << std::endl;
708  edm::LogVerbatim("L1GtTriggerMenuTesterWiki")
709  << " | EGamma algorithm triggers: | " << egammaAlgoTrigNumber << "|" << std::endl;
710  edm::LogVerbatim("L1GtTriggerMenuTesterWiki")
711  << " | Energy sum algorithm triggers: | " << esumAlgoTrigNumber << "|" << std::endl;
712  edm::LogVerbatim("L1GtTriggerMenuTesterWiki")
713  << " | Muon algorithm triggers: | " << muonAlgoTrigNumber << "|" << std::endl;
714  edm::LogVerbatim("L1GtTriggerMenuTesterWiki")
715  << " | Cross algorithm triggers: | " << crossAlgoTrigNumber << "|" << std::endl;
716  edm::LogVerbatim("L1GtTriggerMenuTesterWiki")
717  << " | Background algorithm triggers: | " << bkgdAlgoTrigNumber << "|" << std::endl;
718 
719  // force a page break
720  edm::LogVerbatim("L1GtTriggerMenuTesterWiki") << "<p style=\"page-break-before: always\">&nbsp;</p>";
721 
722  // compact print - without HLT path
723  bool compactPrint = true;
724 
725  edm::LogVerbatim("L1GtTriggerMenuTesterWiki") << "\n---+++ List of algorithm triggers sorted by trigger groups\n"
726  << std::endl;
727 
728  // Jet algorithm triggers
729  printTriggerGroup("Jet algorithm triggers", jetAlgoTrig, compactPrint, m_printPfsRates);
730 
731  // EGamma algorithm triggers
732  printTriggerGroup("EGamma algorithm triggers", egammaAlgoTrig, compactPrint, m_printPfsRates);
733 
734  // Energy sum algorithm triggers
735  printTriggerGroup("Energy sum algorithm triggers", esumAlgoTrig, compactPrint, m_printPfsRates);
736 
737  // Muon algorithm triggers
738  printTriggerGroup("Muon algorithm triggers", muonAlgoTrig, compactPrint, m_printPfsRates);
739 
740  // Cross algorithm triggers
741  printTriggerGroup("Cross algorithm triggers", crossAlgoTrig, compactPrint, m_printPfsRates);
742 
743  // Background algorithm triggers
744  printTriggerGroup("Background algorithm triggers", bkgdAlgoTrig, compactPrint, m_printPfsRates);
745 
746  // force a page break
747  edm::LogVerbatim("L1GtTriggerMenuTesterWiki") << "<p style=\"page-break-before: always\">&nbsp;</p>";
748 
749  edm::LogVerbatim("L1GtTriggerMenuTesterWiki") << "\n---+++ List of algorithm triggers sorted by bits\n" << std::endl;
750 
751  edm::LogVerbatim("L1GtTriggerMenuTesterWiki") << "| *Algorithm* | *Alias* | *Bit number* |" << std::endl;
752 
753  for (CItBit itBit = algoBitToAlgo.begin(); itBit != algoBitToAlgo.end(); itBit++) {
754  int bitNumber = itBit->first;
755  std::string aName = (itBit->second)->algoName();
756  std::string aAlias = (itBit->second)->algoAlias();
757 
758  edm::LogVerbatim("L1GtTriggerMenuTesterWiki")
759  << "|" << std::left << "[[" << (m_htmlFile + "#" + aName) << "][ " << aName << "]] "
760  << " |" << aAlias << " | " << bitNumber << "| |" << std::endl;
761  }
762 
763  // force a page break
764  edm::LogVerbatim("L1GtTriggerMenuTesterWiki") << "<p style=\"page-break-before: always\">&nbsp;</p>";
765  edm::LogVerbatim("L1GtTriggerMenuTesterWiki") << "\n---+++ List of technical triggers\n" << std::endl;
766 
767  edm::LogVerbatim("L1GtTriggerMenuTesterWiki") << "| *Technical trigger* | *Bit number* |" << std::endl;
768 
769  for (CItBit itBit = techBitToAlgo.begin(); itBit != techBitToAlgo.end(); itBit++) {
770  int bitNumber = itBit->first;
771  std::string aName = (itBit->second)->algoName();
772  std::string aAlias = (itBit->second)->algoAlias();
773 
774  edm::LogVerbatim("L1GtTriggerMenuTesterWiki")
775  << "|!" << std::left << aName << " | " << std::right << bitNumber << " |" << std::endl;
776  }
777 
778  // force a page break
779  edm::LogVerbatim("L1GtTriggerMenuTesterWiki") << "<p style=\"page-break-before: always\">&nbsp;</p>";
780 
781  // compact print false: with HLT path association, if the parameter m_useHltMenu is true
782  // otherwise, we have no association computed
783 
784  if (m_useHltMenu) {
785  compactPrint = false;
786  } else {
787  return;
788  }
789 
790  edm::LogVerbatim("L1GtTriggerMenuTesterWiki")
791  << "\n---+++ List of algorithm triggers sorted by trigger groups, including !HLT path association \n"
792  << std::endl;
793 
794  edm::LogVerbatim("L1GtTriggerMenuTesterWiki")
795  << "\n The following !HLT menu was used to associate the !HLT path to the L1 algorithm triggers:\n "
796  << std::endl;
797  edm::LogVerbatim("L1GtTriggerMenuTesterWiki") << m_hltTableName << std::endl;
798 
799  // Jet algorithm triggers
800  printTriggerGroup("Jet algorithm triggers", jetAlgoTrig, compactPrint, m_printPfsRates);
801 
802  // EGamma algorithm triggers
803  printTriggerGroup("EGamma algorithm triggers", egammaAlgoTrig, compactPrint, m_printPfsRates);
804 
805  // Energy sum algorithm triggers
806  printTriggerGroup("Energy sum algorithm triggers", esumAlgoTrig, compactPrint, m_printPfsRates);
807 
808  // Muon algorithm triggers
809  printTriggerGroup("Muon algorithm triggers", muonAlgoTrig, compactPrint, m_printPfsRates);
810 
811  // Cross algorithm triggers
812  printTriggerGroup("Cross algorithm triggers", crossAlgoTrig, compactPrint, m_printPfsRates);
813 
814  // Background algorithm triggers
815  printTriggerGroup("Background algorithm triggers", bkgdAlgoTrig, compactPrint, m_printPfsRates);
816 }
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:38
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:35
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
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:37
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:224
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 std::vector< std::vector< std::pair< bool, std::string > > > & hltL1GTSeeds() const
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:29
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:36
T get() const
Definition: EventSetup.h:73
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:45
const std::vector< unsigned int > * m_triggerMaskTechTrig