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