20 #include <boost/algorithm/string/erase.hpp> 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) {
89 std::ostringstream myCout;
91 int printVerbosity = 0;
93 myCout << std::flush << std::endl;
97 myCout << std::flush << std::endl;
101 myCout << std::flush << std::endl;
112 <<
"\n List of algorithm triggers used as L1 seeds but not in L1 menu" << std::endl;
117 edm::LogVerbatim(
"L1GtTriggerMenuTester") <<
" " << (*strIter) << std::endl;
216 bool hltChanged =
true;
240 unsigned int numberHltL1GTSeeds = hltL1Seed.size();
242 edm::LogVerbatim(
"L1GtTriggerMenuTester") <<
"\nPath: " << hltPathName <<
" : <== " << numberHltL1GTSeeds
243 <<
" HLTLevel1GTSeed module(s)" << std::endl;
245 for (
unsigned int iSeedModule = 0; iSeedModule < numberHltL1GTSeeds; ++iSeedModule) {
249 edm::LogVerbatim(
"L1GtTriggerMenuTester") <<
" '" << m_l1SeedsLogicalExpression <<
"'";
253 if (m_l1SeedsLogicalExpression !=
"L1GlobalDecision") {
259 size_t l1AlgoSeedsSize = m_l1AlgoSeeds.size();
261 edm::LogVerbatim(
"L1GtTriggerMenuTester") <<
" : <== " << l1AlgoSeedsSize <<
" L1 seeds" << std::endl;
266 for (
size_t i = 0;
i < l1AlgoSeedsSize; ++
i) {
267 const std::string& trigNameOrAlias = (m_l1AlgoSeeds[
i]).tokenName;
271 int bitNr = (itAlgo->second).algoBitNumber();
276 <<
" " << trigNameOrAlias <<
" bit " << bitNr << std::endl;
288 <<
"\nAlgorithm " << trigNameOrAlias
289 <<
", requested as seed by a HLT path, not found in the L1 trigger menu\n " 308 const std::map<std::string, const L1GtAlgorithm*>& trigGroup,
309 const bool compactPrint,
310 const bool printPfsRates) {
319 int trigRateVal1 = 0;
320 int trigRateVal2 = 0;
323 std::vector<std::string> algoTriggerNotSeed;
326 std::vector<std::string> techTriggerNotSeed;
330 edm::LogVerbatim(
"L1GtTriggerMenuTesterWiki") <<
"<p style=\"page-break-before: always\"> </p>";
332 edm::LogVerbatim(
"L1GtTriggerMenuTesterWiki") <<
"\n---++++ " << trigGroupName <<
"\n" << std::endl;
336 <<
"| *Trigger Name* | *Trigger Alias* | *Bit* | *Comments* |" << std::endl;
340 edm::LogVerbatim(
"L1GtTriggerMenuTesterWiki") <<
"| *Trigger Name* | *Trigger Alias* | *Bit* | " 341 "*Luminosity* |||| *Seed for !HLT path(s)* | *Comments* |" 345 <<
"|^|^|^| *" << lumiVal1 <<
"* || *" << lumiVal2 <<
"* || ** | ** |" << std::endl;
348 <<
"|^|^|^| *PF* | *Rate* | *PF* | *Rate* | ** | ** |" << std::endl;
352 <<
"| *Trigger Name* | *Trigger Alias* | *Bit* | *Seed for !HLT path(s)* |" << std::endl;
356 for (
CItAlgoP itAlgo = trigGroup.begin(); itAlgo != trigGroup.end(); itAlgo++) {
358 const std::string& aAlias = (itAlgo->second)->algoAlias();
359 const int&
bitNumber = (itAlgo->second)->algoBitNumber();
366 if (hltPaths.empty()) {
367 algoTriggerNotSeed.push_back(aAlias);
368 seedsHlt =
"<font color = \"red\">Not used as seed by any !HLT path</font>";
370 for (std::vector<std::string>::const_iterator strIter = hltPaths.begin(); strIter != hltPaths.end();
372 seedsHlt = seedsHlt + (*strIter) +
"<BR>";
379 <<
"|" << std::left <<
"[[" << (
m_htmlFile +
"#" + aName) <<
"][ " << aName <<
"]] " 380 <<
" |" << aAlias <<
" | " << bitNumber <<
"| |" << std::endl;
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 <<
" |" 393 <<
"|" << std::left <<
"[[" << (
m_htmlFile +
"#" + aName) <<
"][ " << aName <<
"]] " 394 <<
" |" << aAlias <<
" | " << bitNumber <<
"|" << seedsHlt <<
" | " << std::endl;
401 << trigGroupName <<
": " << (trigGroup.size()) <<
" bits defined." << std::endl;
405 <<
"\n Algorithm triggers from " << trigGroupName <<
" not used as seeds by !HLT:" << std::endl;
407 if (!algoTriggerNotSeed.empty()) {
408 for (std::vector<std::string>::const_iterator strIter = algoTriggerNotSeed.begin();
409 strIter != algoTriggerNotSeed.end();
411 edm::LogVerbatim(
"L1GtTriggerMenuTesterWiki") <<
" * " << (*strIter) << std::endl;
436 typedef std::map<int, const L1GtAlgorithm*>::const_iterator CItBit;
440 std::map<int, const L1GtAlgorithm*> algoBitToAlgo;
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;
449 int algoTrigNumber = 0;
450 int freeAlgoTrigNumber = 0;
452 int jetAlgoTrigNumber = 0;
453 int egammaAlgoTrigNumber = 0;
454 int esumAlgoTrigNumber = 0;
455 int muonAlgoTrigNumber = 0;
456 int crossAlgoTrigNumber = 0;
457 int bkgdAlgoTrigNumber = 0;
460 const int bitNumber = (itAlgo->second).algoBitNumber();
463 algoBitToAlgo[
bitNumber] = &(itAlgo->second);
471 const std::vector<L1GtLogicParser::TokenRPN>& rpnVector = (itAlgo->second).algoRpnVector();
474 std::list<L1GtObject> listObjects;
476 for (
size_t i = 0;
i < rpnVector.size(); ++
i) {
477 if ((rpnVector[
i]).operation == condOperand) {
482 bool foundCond =
false;
484 CItCond itCond = conditionMap.find(cndName);
485 if (itCond != conditionMap.end()) {
490 const std::vector<L1GtObject>&
objType = (itCond->second)->objectType();
492 for (std::vector<L1GtObject>::const_iterator itObject = objType.begin(); itObject != objType.end();
494 listObjects.push_back(*itObject);
507 throw cms::Exception(
"FailModule") <<
"\nCondition " << cndName <<
" not found in the condition map" 508 <<
" for chip number " << ((itAlgo->second).algoChipNumber()) << std::endl;
515 listObjects.unique();
519 bool jetGroup =
false;
520 bool egammaGroup =
false;
521 bool esumGroup =
false;
522 bool muonGroup =
false;
523 bool crossGroup =
false;
524 bool bkgdGroup =
false;
526 for (std::list<L1GtObject>::const_iterator itObj = listObjects.begin(); itObj != listObjects.end(); ++itObj) {
608 edm::LogVerbatim(
"L1GtTriggerMenuTester") <<
"\n Unknown object of type " << *itObj << std::endl;
613 int sumGroup = jetGroup + egammaGroup + esumGroup + muonGroup + crossGroup + bkgdGroup;
616 crossAlgoTrig[algName] = &(itAlgo->second);
619 jetAlgoTrig[algName] = &(itAlgo->second);
621 }
else if (egammaGroup) {
622 egammaAlgoTrig[algName] = &(itAlgo->second);
624 }
else if (esumGroup && (listObjects.size() > 1)) {
625 crossAlgoTrig[algName] = &(itAlgo->second);
627 }
else if (esumGroup) {
628 esumAlgoTrig[algName] = &(itAlgo->second);
630 }
else if (muonGroup) {
631 muonAlgoTrig[algName] = &(itAlgo->second);
633 }
else if (bkgdGroup) {
634 bkgdAlgoTrig[algName] = &(itAlgo->second);
642 << algName <<
" sum: " << sumGroup <<
" size: " << listObjects.size() << std::endl;
647 jetAlgoTrigNumber = jetAlgoTrig.size();
648 egammaAlgoTrigNumber = egammaAlgoTrig.size();
649 esumAlgoTrigNumber = esumAlgoTrig.size();
650 muonAlgoTrigNumber = muonAlgoTrig.size();
651 crossAlgoTrigNumber = crossAlgoTrig.size();
652 bkgdAlgoTrigNumber = bkgdAlgoTrig.size();
655 std::map<int, const L1GtAlgorithm*> techBitToAlgo;
657 int techTrigNumber = 0;
658 int freeTechTrigNumber = 0;
661 int bitNumber = (itAlgo->second).algoBitNumber();
662 techBitToAlgo[
bitNumber] = &(itAlgo->second);
674 std::replace(menuName.begin(), menuName.end(),
'/',
'_');
675 m_htmlFile =
"%ATTACHURL%/" + menuName +
".html";
683 <<
"\n ********** L1 Trigger Menu - printing in wiki format ********** \n\n" 684 <<
"\n---+++ L1 menu identification\n" 690 << std::flush << std::endl;
693 edm::LogVerbatim(
"L1GtTriggerMenuTesterWiki") <<
"\n---+++ Summary\n" << std::endl;
695 <<
" * Number of algorithm triggers: " << algoTrigNumber <<
" defined, 128 possible." << std::endl;
697 <<
" * Number of technical triggers: " << techTrigNumber <<
" defined, 64 possible.<BR><BR>" << std::endl;
700 <<
" * Number of free bits for algorithm triggers: " << freeAlgoTrigNumber << std::endl;
702 <<
" * Number of free bits for technical triggers: " << freeTechTrigNumber <<
"<BR>" << std::endl;
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;
707 <<
" | Jet algorithm triggers: | " << jetAlgoTrigNumber <<
"|" << std::endl;
709 <<
" | EGamma algorithm triggers: | " << egammaAlgoTrigNumber <<
"|" << std::endl;
711 <<
" | Energy sum algorithm triggers: | " << esumAlgoTrigNumber <<
"|" << std::endl;
713 <<
" | Muon algorithm triggers: | " << muonAlgoTrigNumber <<
"|" << std::endl;
715 <<
" | Cross algorithm triggers: | " << crossAlgoTrigNumber <<
"|" << std::endl;
717 <<
" | Background algorithm triggers: | " << bkgdAlgoTrigNumber <<
"|" << std::endl;
720 edm::LogVerbatim(
"L1GtTriggerMenuTesterWiki") <<
"<p style=\"page-break-before: always\"> </p>";
723 bool compactPrint =
true;
725 edm::LogVerbatim(
"L1GtTriggerMenuTesterWiki") <<
"\n---+++ List of algorithm triggers sorted by trigger groups\n" 747 edm::LogVerbatim(
"L1GtTriggerMenuTesterWiki") <<
"<p style=\"page-break-before: always\"> </p>";
749 edm::LogVerbatim(
"L1GtTriggerMenuTesterWiki") <<
"\n---+++ List of algorithm triggers sorted by bits\n" << std::endl;
751 edm::LogVerbatim(
"L1GtTriggerMenuTesterWiki") <<
"| *Algorithm* | *Alias* | *Bit number* |" << std::endl;
753 for (CItBit itBit = algoBitToAlgo.begin(); itBit != algoBitToAlgo.end(); itBit++) {
759 <<
"|" << std::left <<
"[[" << (
m_htmlFile +
"#" + aName) <<
"][ " << aName <<
"]] " 760 <<
" |" << aAlias <<
" | " << bitNumber <<
"| |" << std::endl;
764 edm::LogVerbatim(
"L1GtTriggerMenuTesterWiki") <<
"<p style=\"page-break-before: always\"> </p>";
765 edm::LogVerbatim(
"L1GtTriggerMenuTesterWiki") <<
"\n---+++ List of technical triggers\n" << std::endl;
767 edm::LogVerbatim(
"L1GtTriggerMenuTesterWiki") <<
"| *Technical trigger* | *Bit number* |" << std::endl;
769 for (CItBit itBit = techBitToAlgo.begin(); itBit != techBitToAlgo.end(); itBit++) {
775 <<
"|!" << std::left << aName <<
" | " << std::right << bitNumber <<
" |" << std::endl;
779 edm::LogVerbatim(
"L1GtTriggerMenuTesterWiki") <<
"<p style=\"page-break-before: always\"> </p>";
785 compactPrint =
false;
791 <<
"\n---+++ List of algorithm triggers sorted by trigger groups, including !HLT path association \n" 795 <<
"\n The following !HLT menu was used to associate the !HLT path to the L1 algorithm triggers:\n " unsigned int size() const
number of trigger paths in trigger table
std::vector< L1GtLogicParser::OperandToken > expressionSeedsOperandList()
const std::string & triggerName(unsigned int triggerIndex) const
def replace(string, replacements)
const std::string & tableName() const
HLT ConfDB table name.
U second(std::pair< T, U > const &p)
unsigned int gtNumberTechnicalTriggers() const
get / set the number of technical triggers
unsigned int gtNumberPhysTriggers() const
get / set the number of physics trigger algorithms
const std::vector< unsigned int > & gtTriggerMask() const
get the trigger mask
const std::vector< std::vector< std::pair< bool, std::string > > > & hltL1GTSeeds() const
const std::vector< std::vector< int > > & gtPrescaleFactors() const
get the prescale factors by reference
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d'tor
T const * product() const