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(
65 parSet.getParameter<bool> (
"NoThrowIncompatibleMenu")),
66 m_printPfsRates(parSet.getParameter<bool> (
"PrintPfsRates")),
67 m_indexPfSet(parSet.getParameter<int> (
"IndexPfSet")),
68 m_numberAlgorithmTriggers(0), m_numberTechnicalTriggers(0) {
95 std::ostringstream myCout;
97 int printVerbosity = 0;
99 myCout << std::flush << std::endl;
103 myCout << std::flush << std::endl;
107 myCout << std::flush << std::endl;
118 <<
"\n List of algorithm triggers used as L1 seeds but not in L1 menu"
121 for (std::vector<std::string>::const_iterator strIter =
126 << (*strIter) << std::endl;
245 bool hltChanged =
true;
272 const std::vector<std::pair<bool, std::string> >& hltL1Seed =
275 unsigned int numberHltL1GTSeeds = hltL1Seed.size();
278 << hltPathName <<
" : <== " << numberHltL1GTSeeds
279 <<
" HLTLevel1GTSeed module(s)" << std::endl;
281 for (
unsigned int iSeedModule = 0; iSeedModule
282 < numberHltL1GTSeeds; ++iSeedModule) {
286 (hltL1Seed[iSeedModule]).
second;
289 << m_l1SeedsLogicalExpression <<
"'";
293 if (m_l1SeedsLogicalExpression !=
"L1GlobalDecision") {
297 m_l1SeedsLogicalExpression);
300 std::vector<L1GtLogicParser::OperandToken>
303 size_t l1AlgoSeedsSize = m_l1AlgoSeeds.size();
306 <<
" : <== " << l1AlgoSeedsSize
307 <<
" L1 seeds" << std::endl;
312 for (
size_t i = 0;
i < l1AlgoSeedsSize; ++
i) {
315 (m_l1AlgoSeeds[
i]).tokenName;
321 int bitNr = (itAlgo->second).algoBitNumber();
327 <<
" " << trigNameOrAlias
328 <<
" bit " << bitNr << std::endl;
334 <<
" " << trigNameOrAlias
335 <<
" trigger not in L1 menu "
346 <<
", requested as seed by a HLT path, not found in the L1 trigger menu\n "
348 <<
"\nIncompatible L1 and HLT menus.\n"
364 <<
" HLT config extraction failure with process name "
372 const std::map<std::string, const L1GtAlgorithm*>& trigGroup,
373 const bool compactPrint,
const bool printPfsRates) {
383 int trigRateVal1 = 0;
384 int trigRateVal2 = 0;
387 std::vector < std::string > algoTriggerNotSeed;
390 std::vector < std::string > techTriggerNotSeed;
395 <<
"<p style=\"page-break-before: always\"> </p>";
398 << trigGroupName <<
"\n" << std::endl;
402 <<
"| *Trigger Name* | *Trigger Alias* | *Bit* | *Comments* |"
409 <<
"| *Trigger Name* | *Trigger Alias* | *Bit* | *Luminosity* |||| *Seed for !HLT path(s)* | *Comments* |"
413 << lumiVal1 <<
"* || *" << lumiVal2
414 <<
"* || ** | ** |" << std::endl;
417 <<
"|^|^|^| *PF* | *Rate* | *PF* | *Rate* | ** | ** |"
423 <<
"| *Trigger Name* | *Trigger Alias* | *Bit* | *Seed for !HLT path(s)* |"
429 for (
CItAlgoP itAlgo = trigGroup.begin(); itAlgo != trigGroup.end(); itAlgo++) {
431 const std::string& aName = (itAlgo->second)->algoName();
432 const std::string& aAlias = (itAlgo->second)->algoAlias();
433 const int& bitNumber = (itAlgo->second)->algoBitNumber();
439 const std::vector<std::string> &
hltPaths =
442 if (hltPaths.size() < 1) {
443 algoTriggerNotSeed.push_back(aAlias);
445 =
"<font color = \"red\">Not used as seed by any !HLT path</font>";
448 for (std::vector<std::string>::const_iterator strIter =
449 hltPaths.begin(); strIter != hltPaths.end(); ++strIter) {
451 seedsHlt = seedsHlt + (*strIter) +
"<BR>";
459 <<
"[[" << (
m_htmlFile +
"#" + aName) <<
"][ " << aName
460 <<
"]] " <<
" |" << aAlias <<
" | " << bitNumber <<
"| |"
467 << std::left <<
"[[" << (
m_htmlFile +
"#" + aName)
468 <<
"][ " << aName <<
"]] " <<
" |" << aAlias
469 <<
" | " << bitNumber <<
"| "
470 << ((trigPfVal1 != 0) ? trigPfVal1 : 0) <<
" | "
471 << ((trigRateVal1 != 0) ? trigRateVal1 : 0) <<
" | "
472 << ((trigPfVal2 != 0) ? trigPfVal2 : 0) <<
" | "
473 << ((trigRateVal2 != 0) ? trigRateVal2 : 0) <<
" | "
474 << seedsHlt <<
" | " << trigComment <<
" |"
480 << std::left <<
"[[" << (
m_htmlFile +
"#" + aName)
481 <<
"][ " << aName <<
"]] " <<
" |" << aAlias
482 <<
" | " << bitNumber <<
"|" << seedsHlt <<
" | "
491 <<
": " << (trigGroup.size()) <<
" bits defined." << std::endl;
495 <<
"\n Algorithm triggers from " << trigGroupName
496 <<
" not used as seeds by !HLT:" << std::endl;
498 if (algoTriggerNotSeed.size() != 0) {
499 for (std::vector<std::string>::const_iterator strIter =
500 algoTriggerNotSeed.begin(); strIter
501 != algoTriggerNotSeed.end(); ++strIter) {
504 << (*strIter) << std::endl;
534 typedef std::map<int, const L1GtAlgorithm*>::const_iterator CItBit;
538 std::map<int, const L1GtAlgorithm*> algoBitToAlgo;
540 std::map<std::string, const L1GtAlgorithm*> jetAlgoTrig;
541 std::map<std::string, const L1GtAlgorithm*> egammaAlgoTrig;
542 std::map<std::string, const L1GtAlgorithm*> esumAlgoTrig;
543 std::map<std::string, const L1GtAlgorithm*> muonAlgoTrig;
544 std::map<std::string, const L1GtAlgorithm*> crossAlgoTrig;
545 std::map<std::string, const L1GtAlgorithm*> bkgdAlgoTrig;
547 int algoTrigNumber = 0;
548 int freeAlgoTrigNumber = 0;
550 int jetAlgoTrigNumber = 0;
551 int egammaAlgoTrigNumber = 0;
552 int esumAlgoTrigNumber = 0;
553 int muonAlgoTrigNumber = 0;
554 int crossAlgoTrigNumber = 0;
555 int bkgdAlgoTrigNumber = 0;
560 const int bitNumber = (itAlgo->second).algoBitNumber();
561 const std::string& algName = (itAlgo->second).algoName();
563 algoBitToAlgo[bitNumber] = &(itAlgo->second);
570 (itAlgo->second).algoChipNumber());
572 const std::vector<L1GtLogicParser::TokenRPN>& rpnVector =
573 (itAlgo->second).algoRpnVector();
577 std::list<L1GtObject> listObjects;
579 for (
size_t i = 0;
i < rpnVector.size(); ++
i) {
581 if ((rpnVector[
i]).operation == condOperand) {
587 bool foundCond =
false;
589 CItCond itCond = conditionMap.find(cndName);
590 if (itCond != conditionMap.end()) {
595 const std::vector<L1GtObject>& objType =
596 (itCond->second)->objectType();
598 for (std::vector<L1GtObject>::const_iterator itObject =
599 objType.begin(); itObject != objType.end(); itObject++) {
600 listObjects.push_back(*itObject);
603 << (*itObject) << std::endl;
617 << cndName <<
" not found in the condition map"
618 <<
" for chip number "
619 << ((itAlgo->second).algoChipNumber()) << std::endl;
628 listObjects.unique();
632 bool jetGroup =
false;
633 bool egammaGroup =
false;
634 bool esumGroup =
false;
635 bool muonGroup =
false;
636 bool crossGroup =
false;
637 bool bkgdGroup =
false;
639 for (std::list<L1GtObject>::const_iterator itObj = listObjects.begin(); itObj
640 != listObjects.end(); ++itObj) {
724 <<
"\n Unknown object of type " << *itObj
732 int sumGroup = jetGroup + egammaGroup + esumGroup + muonGroup
733 + crossGroup + bkgdGroup;
736 crossAlgoTrig[algName] = &(itAlgo->second);
740 jetAlgoTrig[algName] = &(itAlgo->second);
742 }
else if (egammaGroup) {
743 egammaAlgoTrig[algName] = &(itAlgo->second);
745 }
else if (esumGroup && (listObjects.size() > 1)) {
746 crossAlgoTrig[algName] = &(itAlgo->second);
748 }
else if (esumGroup) {
749 esumAlgoTrig[algName] = &(itAlgo->second);
751 }
else if (muonGroup) {
752 muonAlgoTrig[algName] = &(itAlgo->second);
754 }
else if (bkgdGroup) {
755 bkgdAlgoTrig[algName] = &(itAlgo->second);
764 << sumGroup <<
" size: " << listObjects.size() << std::endl;
770 jetAlgoTrigNumber = jetAlgoTrig.size();
771 egammaAlgoTrigNumber = egammaAlgoTrig.size();
772 esumAlgoTrigNumber = esumAlgoTrig.size();
773 muonAlgoTrigNumber = muonAlgoTrig.size();
774 crossAlgoTrigNumber = crossAlgoTrig.size();
775 bkgdAlgoTrigNumber = bkgdAlgoTrig.size();
778 std::map<int, const L1GtAlgorithm*> techBitToAlgo;
780 int techTrigNumber = 0;
781 int freeTechTrigNumber = 0;
786 int bitNumber = (itAlgo->second).algoBitNumber();
787 techBitToAlgo[bitNumber] = &(itAlgo->second);
799 std::replace(menuName.begin(), menuName.end(),
'/',
'_');
800 m_htmlFile =
"%ATTACHURL%/" + menuName +
".html";
808 <<
"\n ********** L1 Trigger Menu - printing in wiki format ********** \n\n"
809 <<
"\n---+++ L1 menu identification\n"
810 <<
"\n|L1 Trigger Menu Interface: |!"
813 <<
" |" <<
"\n|L1 Trigger Menu Implementation: |!"
815 <<
"\n|Associated L1 scale DB key: |!"
823 <<
" * Number of algorithm triggers: " << algoTrigNumber
824 <<
" defined, 128 possible." << std::endl;
826 <<
" * Number of technical triggers: " << techTrigNumber
827 <<
" defined, 64 possible.<BR><BR>" << std::endl;
830 <<
" * Number of free bits for algorithm triggers: "
831 << freeAlgoTrigNumber << std::endl;
833 <<
" * Number of free bits for technical triggers: "
834 << freeTechTrigNumber <<
"<BR>" << std::endl;
837 <<
"\nNumber of algorithm triggers per trigger group\n"
840 <<
" | *Trigger group* | *Number of bits used*|" << std::endl;
842 <<
" | Jet algorithm triggers: | " << jetAlgoTrigNumber <<
"|"
845 <<
" | EGamma algorithm triggers: | " << egammaAlgoTrigNumber
848 <<
" | Energy sum algorithm triggers: | " << esumAlgoTrigNumber
851 <<
" | Muon algorithm triggers: | " << muonAlgoTrigNumber
854 <<
" | Cross algorithm triggers: | " << crossAlgoTrigNumber
857 <<
" | Background algorithm triggers: | " << bkgdAlgoTrigNumber
862 <<
"<p style=\"page-break-before: always\"> </p>";
865 bool compactPrint =
true;
868 <<
"\n---+++ List of algorithm triggers sorted by trigger groups\n"
897 <<
"<p style=\"page-break-before: always\"> </p>";
900 <<
"\n---+++ List of algorithm triggers sorted by bits\n"
904 <<
"| *Algorithm* | *Alias* | *Bit number* |" << std::endl;
906 for (CItBit itBit = algoBitToAlgo.begin(); itBit != algoBitToAlgo.end(); itBit++) {
908 int bitNumber = itBit->first;
913 <<
"[[" << (
m_htmlFile +
"#" + aName) <<
"][ " << aName
914 <<
"]] " <<
" |" << aAlias <<
" | " << bitNumber <<
"| |"
921 <<
"<p style=\"page-break-before: always\"> </p>";
923 <<
"\n---+++ List of technical triggers\n" << std::endl;
926 <<
"| *Technical trigger* | *Bit number* |" << std::endl;
928 for (CItBit itBit = techBitToAlgo.begin(); itBit != techBitToAlgo.end(); itBit++) {
930 int bitNumber = itBit->first;
935 << aName <<
" | " << std::right << bitNumber <<
" |"
941 <<
"<p style=\"page-break-before: always\"> </p>";
947 compactPrint =
false;
953 <<
"\n---+++ List of algorithm triggers sorted by trigger groups, including !HLT path association \n"
957 <<
"\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
const std::vector< std::vector< std::pair< bool, std::string > > > & hltL1GTSeeds() const
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< 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