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