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")),
74 m_numberAlgorithmTriggers(0),
75 m_numberTechnicalTriggers(0) {
88 std::ostringstream myCout;
90 int printVerbosity = 0;
92 myCout << std::flush << std::endl;
96 myCout << std::flush << std::endl;
100 myCout << std::flush << std::endl;
111 <<
"\n List of algorithm triggers used as L1 seeds but not in L1 menu" << std::endl;
116 edm::LogVerbatim(
"L1GtTriggerMenuTester") <<
" " << (*strIter) << std::endl;
187 bool hltChanged =
true;
211 unsigned int numberHltL1GTSeeds = hltL1Seed.size();
213 edm::LogVerbatim(
"L1GtTriggerMenuTester") <<
"\nPath: " << hltPathName <<
" : <== " << numberHltL1GTSeeds
214 <<
" HLTLevel1GTSeed module(s)" << std::endl;
216 for (
unsigned int iSeedModule = 0; iSeedModule < numberHltL1GTSeeds; ++iSeedModule) {
220 edm::LogVerbatim(
"L1GtTriggerMenuTester") <<
" '" << m_l1SeedsLogicalExpression <<
"'";
224 if (m_l1SeedsLogicalExpression !=
"L1GlobalDecision") {
230 size_t l1AlgoSeedsSize = m_l1AlgoSeeds.size();
232 edm::LogVerbatim(
"L1GtTriggerMenuTester") <<
" : <== " << l1AlgoSeedsSize <<
" L1 seeds" << std::endl;
237 for (
size_t i = 0;
i < l1AlgoSeedsSize; ++
i) {
238 const std::string& trigNameOrAlias = (m_l1AlgoSeeds[
i]).tokenName;
242 int bitNr = (itAlgo->second).algoBitNumber();
247 <<
" " << trigNameOrAlias <<
" bit " << bitNr << std::endl;
259 <<
"\nAlgorithm " << trigNameOrAlias
260 <<
", requested as seed by a HLT path, not found in the L1 trigger menu\n " 279 const std::map<std::string, const L1GtAlgorithm*>& trigGroup,
280 const bool compactPrint,
281 const bool printPfsRates) {
290 int trigRateVal1 = 0;
291 int trigRateVal2 = 0;
294 std::vector<std::string> algoTriggerNotSeed;
297 std::vector<std::string> techTriggerNotSeed;
301 edm::LogVerbatim(
"L1GtTriggerMenuTesterWiki") <<
"<p style=\"page-break-before: always\"> </p>";
303 edm::LogVerbatim(
"L1GtTriggerMenuTesterWiki") <<
"\n---++++ " << trigGroupName <<
"\n" << std::endl;
307 <<
"| *Trigger Name* | *Trigger Alias* | *Bit* | *Comments* |" << std::endl;
311 edm::LogVerbatim(
"L1GtTriggerMenuTesterWiki") <<
"| *Trigger Name* | *Trigger Alias* | *Bit* | " 312 "*Luminosity* |||| *Seed for !HLT path(s)* | *Comments* |" 316 <<
"|^|^|^| *" << lumiVal1 <<
"* || *" << lumiVal2 <<
"* || ** | ** |" << std::endl;
319 <<
"|^|^|^| *PF* | *Rate* | *PF* | *Rate* | ** | ** |" << std::endl;
323 <<
"| *Trigger Name* | *Trigger Alias* | *Bit* | *Seed for !HLT path(s)* |" << std::endl;
327 for (
CItAlgoP itAlgo = trigGroup.begin(); itAlgo != trigGroup.end(); itAlgo++) {
329 const std::string& aAlias = (itAlgo->second)->algoAlias();
330 const int&
bitNumber = (itAlgo->second)->algoBitNumber();
338 algoTriggerNotSeed.push_back(aAlias);
339 seedsHlt =
"<font color = \"red\">Not used as seed by any !HLT path</font>";
341 for (std::vector<std::string>::const_iterator strIter =
hltPaths.begin(); strIter !=
hltPaths.end();
343 seedsHlt = seedsHlt + (*strIter) +
"<BR>";
350 <<
"|" << std::left <<
"[[" << (
m_htmlFile +
"#" + aName) <<
"][ " << aName <<
"]] " 351 <<
" |" << aAlias <<
" | " <<
bitNumber <<
"| |" << std::endl;
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 <<
" |" 364 <<
"|" << std::left <<
"[[" << (
m_htmlFile +
"#" + aName) <<
"][ " << aName <<
"]] " 365 <<
" |" << aAlias <<
" | " <<
bitNumber <<
"|" << seedsHlt <<
" | " << std::endl;
372 << trigGroupName <<
": " << (trigGroup.size()) <<
" bits defined." << std::endl;
376 <<
"\n Algorithm triggers from " << trigGroupName <<
" not used as seeds by !HLT:" << std::endl;
378 if (!algoTriggerNotSeed.empty()) {
379 for (std::vector<std::string>::const_iterator strIter = algoTriggerNotSeed.begin();
380 strIter != algoTriggerNotSeed.end();
382 edm::LogVerbatim(
"L1GtTriggerMenuTesterWiki") <<
" * " << (*strIter) << std::endl;
407 typedef std::map<int, const L1GtAlgorithm*>::const_iterator CItBit;
411 std::map<int, const L1GtAlgorithm*> algoBitToAlgo;
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;
420 int algoTrigNumber = 0;
421 int freeAlgoTrigNumber = 0;
423 int jetAlgoTrigNumber = 0;
424 int egammaAlgoTrigNumber = 0;
425 int esumAlgoTrigNumber = 0;
426 int muonAlgoTrigNumber = 0;
427 int crossAlgoTrigNumber = 0;
428 int bkgdAlgoTrigNumber = 0;
431 const int bitNumber = (itAlgo->second).algoBitNumber();
434 algoBitToAlgo[
bitNumber] = &(itAlgo->second);
442 const std::vector<L1GtLogicParser::TokenRPN>& rpnVector = (itAlgo->second).algoRpnVector();
445 std::list<L1GtObject> listObjects;
447 for (
size_t i = 0;
i < rpnVector.size(); ++
i) {
448 if ((rpnVector[
i]).operation == condOperand) {
453 bool foundCond =
false;
455 CItCond itCond = conditionMap.find(cndName);
456 if (itCond != conditionMap.end()) {
461 const std::vector<L1GtObject>&
objType = (itCond->second)->objectType();
463 for (std::vector<L1GtObject>::const_iterator itObject =
objType.begin(); itObject !=
objType.end();
465 listObjects.push_back(*itObject);
478 throw cms::Exception(
"FailModule") <<
"\nCondition " << cndName <<
" not found in the condition map" 479 <<
" for chip number " << ((itAlgo->second).algoChipNumber()) << std::endl;
486 listObjects.unique();
490 bool jetGroup =
false;
491 bool egammaGroup =
false;
492 bool esumGroup =
false;
493 bool muonGroup =
false;
494 bool crossGroup =
false;
495 bool bkgdGroup =
false;
497 for (std::list<L1GtObject>::const_iterator itObj = listObjects.begin(); itObj != listObjects.end(); ++itObj) {
579 edm::LogVerbatim(
"L1GtTriggerMenuTester") <<
"\n Unknown object of type " << *itObj << std::endl;
584 int sumGroup = jetGroup + egammaGroup + esumGroup + muonGroup + crossGroup + bkgdGroup;
587 crossAlgoTrig[algName] = &(itAlgo->second);
590 jetAlgoTrig[algName] = &(itAlgo->second);
592 }
else if (egammaGroup) {
593 egammaAlgoTrig[algName] = &(itAlgo->second);
595 }
else if (esumGroup && (listObjects.size() > 1)) {
596 crossAlgoTrig[algName] = &(itAlgo->second);
598 }
else if (esumGroup) {
599 esumAlgoTrig[algName] = &(itAlgo->second);
601 }
else if (muonGroup) {
602 muonAlgoTrig[algName] = &(itAlgo->second);
604 }
else if (bkgdGroup) {
605 bkgdAlgoTrig[algName] = &(itAlgo->second);
613 << algName <<
" sum: " << sumGroup <<
" size: " << listObjects.size() << std::endl;
618 jetAlgoTrigNumber = jetAlgoTrig.size();
619 egammaAlgoTrigNumber = egammaAlgoTrig.size();
620 esumAlgoTrigNumber = esumAlgoTrig.size();
621 muonAlgoTrigNumber = muonAlgoTrig.size();
622 crossAlgoTrigNumber = crossAlgoTrig.size();
623 bkgdAlgoTrigNumber = bkgdAlgoTrig.size();
626 std::map<int, const L1GtAlgorithm*> techBitToAlgo;
628 int techTrigNumber = 0;
629 int freeTechTrigNumber = 0;
632 int bitNumber = (itAlgo->second).algoBitNumber();
633 techBitToAlgo[
bitNumber] = &(itAlgo->second);
645 std::replace(menuName.begin(), menuName.end(),
'/',
'_');
646 m_htmlFile =
"%ATTACHURL%/" + menuName +
".html";
654 <<
"\n ********** L1 Trigger Menu - printing in wiki format ********** \n\n" 655 <<
"\n---+++ L1 menu identification\n" 661 << std::flush << std::endl;
664 edm::LogVerbatim(
"L1GtTriggerMenuTesterWiki") <<
"\n---+++ Summary\n" << std::endl;
666 <<
" * Number of algorithm triggers: " << algoTrigNumber <<
" defined, 128 possible." << std::endl;
668 <<
" * Number of technical triggers: " << techTrigNumber <<
" defined, 64 possible.<BR><BR>" << std::endl;
671 <<
" * Number of free bits for algorithm triggers: " << freeAlgoTrigNumber << std::endl;
673 <<
" * Number of free bits for technical triggers: " << freeTechTrigNumber <<
"<BR>" << std::endl;
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;
678 <<
" | Jet algorithm triggers: | " << jetAlgoTrigNumber <<
"|" << std::endl;
680 <<
" | EGamma algorithm triggers: | " << egammaAlgoTrigNumber <<
"|" << std::endl;
682 <<
" | Energy sum algorithm triggers: | " << esumAlgoTrigNumber <<
"|" << std::endl;
684 <<
" | Muon algorithm triggers: | " << muonAlgoTrigNumber <<
"|" << std::endl;
686 <<
" | Cross algorithm triggers: | " << crossAlgoTrigNumber <<
"|" << std::endl;
688 <<
" | Background algorithm triggers: | " << bkgdAlgoTrigNumber <<
"|" << std::endl;
691 edm::LogVerbatim(
"L1GtTriggerMenuTesterWiki") <<
"<p style=\"page-break-before: always\"> </p>";
694 bool compactPrint =
true;
696 edm::LogVerbatim(
"L1GtTriggerMenuTesterWiki") <<
"\n---+++ List of algorithm triggers sorted by trigger groups\n" 718 edm::LogVerbatim(
"L1GtTriggerMenuTesterWiki") <<
"<p style=\"page-break-before: always\"> </p>";
720 edm::LogVerbatim(
"L1GtTriggerMenuTesterWiki") <<
"\n---+++ List of algorithm triggers sorted by bits\n" << std::endl;
722 edm::LogVerbatim(
"L1GtTriggerMenuTesterWiki") <<
"| *Algorithm* | *Alias* | *Bit number* |" << std::endl;
724 for (CItBit itBit = algoBitToAlgo.begin(); itBit != algoBitToAlgo.end(); itBit++) {
730 <<
"|" << std::left <<
"[[" << (
m_htmlFile +
"#" + aName) <<
"][ " << aName <<
"]] " 731 <<
" |" << aAlias <<
" | " <<
bitNumber <<
"| |" << std::endl;
735 edm::LogVerbatim(
"L1GtTriggerMenuTesterWiki") <<
"<p style=\"page-break-before: always\"> </p>";
736 edm::LogVerbatim(
"L1GtTriggerMenuTesterWiki") <<
"\n---+++ List of technical triggers\n" << std::endl;
738 edm::LogVerbatim(
"L1GtTriggerMenuTesterWiki") <<
"| *Technical trigger* | *Bit number* |" << std::endl;
740 for (CItBit itBit = techBitToAlgo.begin(); itBit != techBitToAlgo.end(); itBit++) {
746 <<
"|!" << std::left << aName <<
" | " << std::right <<
bitNumber <<
" |" << std::endl;
750 edm::LogVerbatim(
"L1GtTriggerMenuTesterWiki") <<
"<p style=\"page-break-before: always\"> </p>";
756 compactPrint =
false;
762 <<
"\n---+++ List of algorithm triggers sorted by trigger groups, including !HLT path association \n" 766 <<
"\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
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 getData(T &iHolder) 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