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;
242 bool hltChanged =
true;
269 const std::vector<std::pair<bool, std::string> >& hltL1Seed =
272 unsigned int numberHltL1GTSeeds = hltL1Seed.size();
275 << hltPathName <<
" : <== " << numberHltL1GTSeeds
276 <<
" HLTLevel1GTSeed module(s)" << std::endl;
278 for (
unsigned int iSeedModule = 0; iSeedModule
279 < numberHltL1GTSeeds; ++iSeedModule) {
283 (hltL1Seed[iSeedModule]).
second;
286 << m_l1SeedsLogicalExpression <<
"'";
290 if (m_l1SeedsLogicalExpression !=
"L1GlobalDecision") {
294 m_l1SeedsLogicalExpression);
297 std::vector<L1GtLogicParser::OperandToken>
300 size_t l1AlgoSeedsSize = m_l1AlgoSeeds.size();
303 <<
" : <== " << l1AlgoSeedsSize
304 <<
" L1 seeds" << std::endl;
309 for (
size_t i = 0;
i < l1AlgoSeedsSize; ++
i) {
312 (m_l1AlgoSeeds[
i]).tokenName;
318 int bitNr = (itAlgo->second).algoBitNumber();
324 <<
" " << trigNameOrAlias
325 <<
" bit " << bitNr << std::endl;
331 <<
" " << trigNameOrAlias
332 <<
" trigger not in L1 menu " 343 <<
", requested as seed by a HLT path, not found in the L1 trigger menu\n " 345 <<
"\nIncompatible L1 and HLT menus.\n" 361 <<
" HLT config extraction failure with process name " 369 const std::map<std::string, const L1GtAlgorithm*>& trigGroup,
370 const bool compactPrint,
const bool printPfsRates) {
380 int trigRateVal1 = 0;
381 int trigRateVal2 = 0;
384 std::vector < std::string > algoTriggerNotSeed;
387 std::vector < std::string > techTriggerNotSeed;
392 <<
"<p style=\"page-break-before: always\"> </p>";
395 << trigGroupName <<
"\n" << std::endl;
399 <<
"| *Trigger Name* | *Trigger Alias* | *Bit* | *Comments* |" 406 <<
"| *Trigger Name* | *Trigger Alias* | *Bit* | *Luminosity* |||| *Seed for !HLT path(s)* | *Comments* |" 410 << lumiVal1 <<
"* || *" << lumiVal2
411 <<
"* || ** | ** |" << std::endl;
414 <<
"|^|^|^| *PF* | *Rate* | *PF* | *Rate* | ** | ** |" 420 <<
"| *Trigger Name* | *Trigger Alias* | *Bit* | *Seed for !HLT path(s)* |" 426 for (
CItAlgoP itAlgo = trigGroup.begin(); itAlgo != trigGroup.end(); itAlgo++) {
429 const std::string& aAlias = (itAlgo->second)->algoAlias();
430 const int& bitNumber = (itAlgo->second)->algoBitNumber();
436 const std::vector<std::string> &
hltPaths =
439 if (hltPaths.size() < 1) {
440 algoTriggerNotSeed.push_back(aAlias);
442 =
"<font color = \"red\">Not used as seed by any !HLT path</font>";
445 for (std::vector<std::string>::const_iterator strIter =
446 hltPaths.begin(); strIter != hltPaths.end(); ++strIter) {
448 seedsHlt = seedsHlt + (*strIter) +
"<BR>";
456 <<
"[[" << (
m_htmlFile +
"#" + aName) <<
"][ " << aName
457 <<
"]] " <<
" |" << aAlias <<
" | " << bitNumber <<
"| |" 464 << std::left <<
"[[" << (
m_htmlFile +
"#" + aName)
465 <<
"][ " << aName <<
"]] " <<
" |" << aAlias
466 <<
" | " << bitNumber <<
"| " 467 << ((trigPfVal1 != 0) ? trigPfVal1 : 0) <<
" | " 468 << ((trigRateVal1 != 0) ? trigRateVal1 : 0) <<
" | " 469 << ((trigPfVal2 != 0) ? trigPfVal2 : 0) <<
" | " 470 << ((trigRateVal2 != 0) ? trigRateVal2 : 0) <<
" | " 471 << seedsHlt <<
" | " << trigComment <<
" |" 477 << std::left <<
"[[" << (
m_htmlFile +
"#" + aName)
478 <<
"][ " << aName <<
"]] " <<
" |" << aAlias
479 <<
" | " << bitNumber <<
"|" << seedsHlt <<
" | " 488 <<
": " << (trigGroup.size()) <<
" bits defined." << std::endl;
492 <<
"\n Algorithm triggers from " << trigGroupName
493 <<
" not used as seeds by !HLT:" << std::endl;
495 if (algoTriggerNotSeed.size() != 0) {
496 for (std::vector<std::string>::const_iterator strIter =
497 algoTriggerNotSeed.begin(); strIter
498 != algoTriggerNotSeed.end(); ++strIter) {
501 << (*strIter) << std::endl;
531 typedef std::map<int, const L1GtAlgorithm*>::const_iterator CItBit;
535 std::map<int, const L1GtAlgorithm*> algoBitToAlgo;
537 std::map<std::string, const L1GtAlgorithm*> jetAlgoTrig;
538 std::map<std::string, const L1GtAlgorithm*> egammaAlgoTrig;
539 std::map<std::string, const L1GtAlgorithm*> esumAlgoTrig;
540 std::map<std::string, const L1GtAlgorithm*> muonAlgoTrig;
541 std::map<std::string, const L1GtAlgorithm*> crossAlgoTrig;
542 std::map<std::string, const L1GtAlgorithm*> bkgdAlgoTrig;
544 int algoTrigNumber = 0;
545 int freeAlgoTrigNumber = 0;
547 int jetAlgoTrigNumber = 0;
548 int egammaAlgoTrigNumber = 0;
549 int esumAlgoTrigNumber = 0;
550 int muonAlgoTrigNumber = 0;
551 int crossAlgoTrigNumber = 0;
552 int bkgdAlgoTrigNumber = 0;
557 const int bitNumber = (itAlgo->second).algoBitNumber();
560 algoBitToAlgo[bitNumber] = &(itAlgo->second);
567 (itAlgo->second).algoChipNumber());
569 const std::vector<L1GtLogicParser::TokenRPN>& rpnVector =
570 (itAlgo->second).algoRpnVector();
574 std::list<L1GtObject> listObjects;
576 for (
size_t i = 0;
i < rpnVector.size(); ++
i) {
578 if ((rpnVector[
i]).operation == condOperand) {
584 bool foundCond =
false;
586 CItCond itCond = conditionMap.find(cndName);
587 if (itCond != conditionMap.end()) {
592 const std::vector<L1GtObject>&
objType =
593 (itCond->second)->objectType();
595 for (std::vector<L1GtObject>::const_iterator itObject =
596 objType.begin(); itObject != objType.end(); itObject++) {
597 listObjects.push_back(*itObject);
600 << (*itObject) << std::endl;
614 << cndName <<
" not found in the condition map" 615 <<
" for chip number " 616 << ((itAlgo->second).algoChipNumber()) << std::endl;
625 listObjects.unique();
629 bool jetGroup =
false;
630 bool egammaGroup =
false;
631 bool esumGroup =
false;
632 bool muonGroup =
false;
633 bool crossGroup =
false;
634 bool bkgdGroup =
false;
636 for (std::list<L1GtObject>::const_iterator itObj = listObjects.begin(); itObj
637 != listObjects.end(); ++itObj) {
721 <<
"\n Unknown object of type " << *itObj
729 int sumGroup = jetGroup + egammaGroup + esumGroup + muonGroup
730 + crossGroup + bkgdGroup;
733 crossAlgoTrig[algName] = &(itAlgo->second);
737 jetAlgoTrig[algName] = &(itAlgo->second);
739 }
else if (egammaGroup) {
740 egammaAlgoTrig[algName] = &(itAlgo->second);
742 }
else if (esumGroup && (listObjects.size() > 1)) {
743 crossAlgoTrig[algName] = &(itAlgo->second);
745 }
else if (esumGroup) {
746 esumAlgoTrig[algName] = &(itAlgo->second);
748 }
else if (muonGroup) {
749 muonAlgoTrig[algName] = &(itAlgo->second);
751 }
else if (bkgdGroup) {
752 bkgdAlgoTrig[algName] = &(itAlgo->second);
761 << sumGroup <<
" size: " << listObjects.size() << std::endl;
767 jetAlgoTrigNumber = jetAlgoTrig.size();
768 egammaAlgoTrigNumber = egammaAlgoTrig.size();
769 esumAlgoTrigNumber = esumAlgoTrig.size();
770 muonAlgoTrigNumber = muonAlgoTrig.size();
771 crossAlgoTrigNumber = crossAlgoTrig.size();
772 bkgdAlgoTrigNumber = bkgdAlgoTrig.size();
775 std::map<int, const L1GtAlgorithm*> techBitToAlgo;
777 int techTrigNumber = 0;
778 int freeTechTrigNumber = 0;
783 int bitNumber = (itAlgo->second).algoBitNumber();
784 techBitToAlgo[bitNumber] = &(itAlgo->second);
796 std::replace(menuName.begin(), menuName.end(),
'/',
'_');
797 m_htmlFile =
"%ATTACHURL%/" + menuName +
".html";
805 <<
"\n ********** L1 Trigger Menu - printing in wiki format ********** \n\n" 806 <<
"\n---+++ L1 menu identification\n" 807 <<
"\n|L1 Trigger Menu Interface: |!" 810 <<
" |" <<
"\n|L1 Trigger Menu Implementation: |!" 812 <<
"\n|Associated L1 scale DB key: |!" 820 <<
" * Number of algorithm triggers: " << algoTrigNumber
821 <<
" defined, 128 possible." << std::endl;
823 <<
" * Number of technical triggers: " << techTrigNumber
824 <<
" defined, 64 possible.<BR><BR>" << std::endl;
827 <<
" * Number of free bits for algorithm triggers: " 828 << freeAlgoTrigNumber << std::endl;
830 <<
" * Number of free bits for technical triggers: " 831 << freeTechTrigNumber <<
"<BR>" << std::endl;
834 <<
"\nNumber of algorithm triggers per trigger group\n" 837 <<
" | *Trigger group* | *Number of bits used*|" << std::endl;
839 <<
" | Jet algorithm triggers: | " << jetAlgoTrigNumber <<
"|" 842 <<
" | EGamma algorithm triggers: | " << egammaAlgoTrigNumber
845 <<
" | Energy sum algorithm triggers: | " << esumAlgoTrigNumber
848 <<
" | Muon algorithm triggers: | " << muonAlgoTrigNumber
851 <<
" | Cross algorithm triggers: | " << crossAlgoTrigNumber
854 <<
" | Background algorithm triggers: | " << bkgdAlgoTrigNumber
859 <<
"<p style=\"page-break-before: always\"> </p>";
862 bool compactPrint =
true;
865 <<
"\n---+++ List of algorithm triggers sorted by trigger groups\n" 894 <<
"<p style=\"page-break-before: always\"> </p>";
897 <<
"\n---+++ List of algorithm triggers sorted by bits\n" 901 <<
"| *Algorithm* | *Alias* | *Bit number* |" << std::endl;
903 for (CItBit itBit = algoBitToAlgo.begin(); itBit != algoBitToAlgo.end(); itBit++) {
905 int bitNumber = itBit->first;
910 <<
"[[" << (
m_htmlFile +
"#" + aName) <<
"][ " << aName
911 <<
"]] " <<
" |" << aAlias <<
" | " << bitNumber <<
"| |" 918 <<
"<p style=\"page-break-before: always\"> </p>";
920 <<
"\n---+++ List of technical triggers\n" << std::endl;
923 <<
"| *Technical trigger* | *Bit number* |" << std::endl;
925 for (CItBit itBit = techBitToAlgo.begin(); itBit != techBitToAlgo.end(); itBit++) {
927 int bitNumber = itBit->first;
932 << aName <<
" | " << std::right << bitNumber <<
" |" 938 <<
"<p style=\"page-break-before: always\"> </p>";
944 compactPrint =
false;
950 <<
"\n---+++ List of algorithm triggers sorted by trigger groups, including !HLT path association \n" 954 <<
"\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
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< 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