20 #include <boost/algorithm/string/erase.hpp> 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")),
71 m_numberAlgorithmTriggers(0),
72 m_numberTechnicalTriggers(0) {
85 std::ostringstream myCout;
87 int printVerbosity = 0;
89 myCout << std::flush << std::endl;
93 myCout << std::flush << std::endl;
97 myCout << std::flush << std::endl;
108 <<
"\n List of algorithm triggers used as L1 seeds but not in L1 menu" << std::endl;
113 edm::LogVerbatim(
"L1GtTriggerMenuTester") <<
" " << (*strIter) << std::endl;
184 bool hltChanged =
true;
208 unsigned int numberHltL1GTSeeds = hltL1Seed.size();
210 edm::LogVerbatim(
"L1GtTriggerMenuTester") <<
"\nPath: " << hltPathName <<
" : <== " << numberHltL1GTSeeds
211 <<
" HLTLevel1GTSeed module(s)" << std::endl;
213 for (
unsigned int iSeedModule = 0; iSeedModule < numberHltL1GTSeeds; ++iSeedModule) {
217 edm::LogVerbatim(
"L1GtTriggerMenuTester") <<
" '" << m_l1SeedsLogicalExpression <<
"'";
221 if (m_l1SeedsLogicalExpression !=
"L1GlobalDecision") {
227 size_t l1AlgoSeedsSize = m_l1AlgoSeeds.size();
229 edm::LogVerbatim(
"L1GtTriggerMenuTester") <<
" : <== " << l1AlgoSeedsSize <<
" L1 seeds" << std::endl;
234 for (
size_t i = 0;
i < l1AlgoSeedsSize; ++
i) {
235 const std::string& trigNameOrAlias = (m_l1AlgoSeeds[
i]).tokenName;
239 int bitNr = (itAlgo->second).algoBitNumber();
244 <<
" " << trigNameOrAlias <<
" bit " << bitNr << std::endl;
256 <<
"\nAlgorithm " << trigNameOrAlias
257 <<
", requested as seed by a HLT path, not found in the L1 trigger menu\n " 276 const std::map<std::string, const L1GtAlgorithm*>& trigGroup,
277 const bool compactPrint,
278 const bool printPfsRates) {
287 int trigRateVal1 = 0;
288 int trigRateVal2 = 0;
291 std::vector<std::string> algoTriggerNotSeed;
294 std::vector<std::string> techTriggerNotSeed;
298 edm::LogVerbatim(
"L1GtTriggerMenuTesterWiki") <<
"<p style=\"page-break-before: always\"> </p>";
300 edm::LogVerbatim(
"L1GtTriggerMenuTesterWiki") <<
"\n---++++ " << trigGroupName <<
"\n" << std::endl;
304 <<
"| *Trigger Name* | *Trigger Alias* | *Bit* | *Comments* |" << std::endl;
308 edm::LogVerbatim(
"L1GtTriggerMenuTesterWiki") <<
"| *Trigger Name* | *Trigger Alias* | *Bit* | " 309 "*Luminosity* |||| *Seed for !HLT path(s)* | *Comments* |" 313 <<
"|^|^|^| *" << lumiVal1 <<
"* || *" << lumiVal2 <<
"* || ** | ** |" << std::endl;
316 <<
"|^|^|^| *PF* | *Rate* | *PF* | *Rate* | ** | ** |" << std::endl;
320 <<
"| *Trigger Name* | *Trigger Alias* | *Bit* | *Seed for !HLT path(s)* |" << std::endl;
324 for (
CItAlgoP itAlgo = trigGroup.begin(); itAlgo != trigGroup.end(); itAlgo++) {
326 const std::string& aAlias = (itAlgo->second)->algoAlias();
327 const int&
bitNumber = (itAlgo->second)->algoBitNumber();
335 algoTriggerNotSeed.push_back(aAlias);
336 seedsHlt =
"<font color = \"red\">Not used as seed by any !HLT path</font>";
338 for (std::vector<std::string>::const_iterator strIter =
hltPaths.begin(); strIter !=
hltPaths.end();
340 seedsHlt = seedsHlt + (*strIter) +
"<BR>";
347 <<
"|" << std::left <<
"[[" << (
m_htmlFile +
"#" + aName) <<
"][ " << aName <<
"]] " 348 <<
" |" << aAlias <<
" | " <<
bitNumber <<
"| |" << std::endl;
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 <<
" |" 361 <<
"|" << std::left <<
"[[" << (
m_htmlFile +
"#" + aName) <<
"][ " << aName <<
"]] " 362 <<
" |" << aAlias <<
" | " <<
bitNumber <<
"|" << seedsHlt <<
" | " << std::endl;
369 << trigGroupName <<
": " << (trigGroup.size()) <<
" bits defined." << std::endl;
373 <<
"\n Algorithm triggers from " << trigGroupName <<
" not used as seeds by !HLT:" << std::endl;
375 if (!algoTriggerNotSeed.empty()) {
376 for (std::vector<std::string>::const_iterator strIter = algoTriggerNotSeed.begin();
377 strIter != algoTriggerNotSeed.end();
379 edm::LogVerbatim(
"L1GtTriggerMenuTesterWiki") <<
" * " << (*strIter) << std::endl;
404 typedef std::map<int, const L1GtAlgorithm*>::const_iterator CItBit;
408 std::map<int, const L1GtAlgorithm*> algoBitToAlgo;
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;
417 int algoTrigNumber = 0;
418 int freeAlgoTrigNumber = 0;
420 int jetAlgoTrigNumber = 0;
421 int egammaAlgoTrigNumber = 0;
422 int esumAlgoTrigNumber = 0;
423 int muonAlgoTrigNumber = 0;
424 int crossAlgoTrigNumber = 0;
425 int bkgdAlgoTrigNumber = 0;
428 const int bitNumber = (itAlgo->second).algoBitNumber();
431 algoBitToAlgo[
bitNumber] = &(itAlgo->second);
439 const std::vector<L1GtLogicParser::TokenRPN>& rpnVector = (itAlgo->second).algoRpnVector();
442 std::list<L1GtObject> listObjects;
444 for (
size_t i = 0;
i < rpnVector.size(); ++
i) {
445 if ((rpnVector[
i]).operation == condOperand) {
450 bool foundCond =
false;
452 CItCond itCond = conditionMap.find(cndName);
453 if (itCond != conditionMap.end()) {
458 const std::vector<L1GtObject>&
objType = (itCond->second)->objectType();
460 for (std::vector<L1GtObject>::const_iterator itObject =
objType.begin(); itObject !=
objType.end();
462 listObjects.push_back(*itObject);
475 throw cms::Exception(
"FailModule") <<
"\nCondition " << cndName <<
" not found in the condition map" 476 <<
" for chip number " << ((itAlgo->second).algoChipNumber()) << std::endl;
483 listObjects.unique();
487 bool jetGroup =
false;
488 bool egammaGroup =
false;
489 bool esumGroup =
false;
490 bool muonGroup =
false;
491 bool crossGroup =
false;
492 bool bkgdGroup =
false;
494 for (std::list<L1GtObject>::const_iterator itObj = listObjects.begin(); itObj != listObjects.end(); ++itObj) {
576 edm::LogVerbatim(
"L1GtTriggerMenuTester") <<
"\n Unknown object of type " << *itObj << std::endl;
581 int sumGroup = jetGroup + egammaGroup + esumGroup + muonGroup + crossGroup + bkgdGroup;
584 crossAlgoTrig[algName] = &(itAlgo->second);
587 jetAlgoTrig[algName] = &(itAlgo->second);
589 }
else if (egammaGroup) {
590 egammaAlgoTrig[algName] = &(itAlgo->second);
592 }
else if (esumGroup && (listObjects.size() > 1)) {
593 crossAlgoTrig[algName] = &(itAlgo->second);
595 }
else if (esumGroup) {
596 esumAlgoTrig[algName] = &(itAlgo->second);
598 }
else if (muonGroup) {
599 muonAlgoTrig[algName] = &(itAlgo->second);
601 }
else if (bkgdGroup) {
602 bkgdAlgoTrig[algName] = &(itAlgo->second);
610 << algName <<
" sum: " << sumGroup <<
" size: " << listObjects.size() << std::endl;
615 jetAlgoTrigNumber = jetAlgoTrig.size();
616 egammaAlgoTrigNumber = egammaAlgoTrig.size();
617 esumAlgoTrigNumber = esumAlgoTrig.size();
618 muonAlgoTrigNumber = muonAlgoTrig.size();
619 crossAlgoTrigNumber = crossAlgoTrig.size();
620 bkgdAlgoTrigNumber = bkgdAlgoTrig.size();
623 std::map<int, const L1GtAlgorithm*> techBitToAlgo;
625 int techTrigNumber = 0;
626 int freeTechTrigNumber = 0;
629 int bitNumber = (itAlgo->second).algoBitNumber();
630 techBitToAlgo[
bitNumber] = &(itAlgo->second);
642 std::replace(menuName.begin(), menuName.end(),
'/',
'_');
643 m_htmlFile =
"%ATTACHURL%/" + menuName +
".html";
651 <<
"\n ********** L1 Trigger Menu - printing in wiki format ********** \n\n" 652 <<
"\n---+++ L1 menu identification\n" 658 << std::flush << std::endl;
661 edm::LogVerbatim(
"L1GtTriggerMenuTesterWiki") <<
"\n---+++ Summary\n" << std::endl;
663 <<
" * Number of algorithm triggers: " << algoTrigNumber <<
" defined, 128 possible." << std::endl;
665 <<
" * Number of technical triggers: " << techTrigNumber <<
" defined, 64 possible.<BR><BR>" << std::endl;
668 <<
" * Number of free bits for algorithm triggers: " << freeAlgoTrigNumber << std::endl;
670 <<
" * Number of free bits for technical triggers: " << freeTechTrigNumber <<
"<BR>" << std::endl;
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;
675 <<
" | Jet algorithm triggers: | " << jetAlgoTrigNumber <<
"|" << std::endl;
677 <<
" | EGamma algorithm triggers: | " << egammaAlgoTrigNumber <<
"|" << std::endl;
679 <<
" | Energy sum algorithm triggers: | " << esumAlgoTrigNumber <<
"|" << std::endl;
681 <<
" | Muon algorithm triggers: | " << muonAlgoTrigNumber <<
"|" << std::endl;
683 <<
" | Cross algorithm triggers: | " << crossAlgoTrigNumber <<
"|" << std::endl;
685 <<
" | Background algorithm triggers: | " << bkgdAlgoTrigNumber <<
"|" << std::endl;
688 edm::LogVerbatim(
"L1GtTriggerMenuTesterWiki") <<
"<p style=\"page-break-before: always\"> </p>";
691 bool compactPrint =
true;
693 edm::LogVerbatim(
"L1GtTriggerMenuTesterWiki") <<
"\n---+++ List of algorithm triggers sorted by trigger groups\n" 715 edm::LogVerbatim(
"L1GtTriggerMenuTesterWiki") <<
"<p style=\"page-break-before: always\"> </p>";
717 edm::LogVerbatim(
"L1GtTriggerMenuTesterWiki") <<
"\n---+++ List of algorithm triggers sorted by bits\n" << std::endl;
719 edm::LogVerbatim(
"L1GtTriggerMenuTesterWiki") <<
"| *Algorithm* | *Alias* | *Bit number* |" << std::endl;
721 for (CItBit itBit = algoBitToAlgo.begin(); itBit != algoBitToAlgo.end(); itBit++) {
727 <<
"|" << std::left <<
"[[" << (
m_htmlFile +
"#" + aName) <<
"][ " << aName <<
"]] " 728 <<
" |" << aAlias <<
" | " <<
bitNumber <<
"| |" << std::endl;
732 edm::LogVerbatim(
"L1GtTriggerMenuTesterWiki") <<
"<p style=\"page-break-before: always\"> </p>";
733 edm::LogVerbatim(
"L1GtTriggerMenuTesterWiki") <<
"\n---+++ List of technical triggers\n" << std::endl;
735 edm::LogVerbatim(
"L1GtTriggerMenuTesterWiki") <<
"| *Technical trigger* | *Bit number* |" << std::endl;
737 for (CItBit itBit = techBitToAlgo.begin(); itBit != techBitToAlgo.end(); itBit++) {
743 <<
"|!" << std::left << aName <<
" | " << std::right <<
bitNumber <<
" |" << std::endl;
747 edm::LogVerbatim(
"L1GtTriggerMenuTesterWiki") <<
"<p style=\"page-break-before: always\"> </p>";
753 compactPrint =
false;
759 <<
"\n---+++ List of algorithm triggers sorted by trigger groups, including !HLT path association \n" 763 <<
"\n The following !HLT menu was used to associate the !HLT path to the L1 algorithm triggers:\n "
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
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
def replace(string, replacements)
Log< level::Error, false > LogError
const std::vector< std::vector< int > > & gtPrescaleFactors() const
get the prescale factors by reference
U second(std::pair< T, U > const &p)
unsigned int size() const
number of trigger paths in trigger table
const std::vector< std::vector< std::pair< bool, std::string > > > & hltL1GTSeeds() const
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d'tor
deadvectors [0] push_back({0.0175431, 0.538005, 6.80997, 13.29})
const std::string & tableName() const
HLT ConfDB table name.
unsigned int gtNumberTechnicalTriggers() const
get / set the number of technical triggers
unsigned int gtNumberPhysTriggers() const
get / set the number of physics trigger algorithms