22 #include <boost/algorithm/string/erase.hpp>
62 m_overwriteHtmlFile(parSet.getParameter<bool> (
"OverwriteHtmlFile")),
63 m_htmlFile(parSet.getParameter<std::
string> (
"HtmlFile")),
64 m_useHltMenu(parSet.getParameter<bool> (
"UseHltMenu")),
65 m_hltProcessName(parSet.getParameter<std::
string> (
"HltProcessName")),
66 m_noThrowIncompatibleMenu(
67 parSet.getParameter<bool> (
"NoThrowIncompatibleMenu")),
68 m_printPfsRates(parSet.getParameter<bool> (
"PrintPfsRates")),
69 m_indexPfSet(parSet.getParameter<int> (
"IndexPfSet")),
70 m_numberAlgorithmTriggers(0), m_numberTechnicalTriggers(0) {
97 std::ostringstream myCout;
99 int printVerbosity = 0;
101 myCout << std::flush << std::endl;
105 myCout << std::flush << std::endl;
109 myCout << std::flush << std::endl;
120 <<
"\n List of algorithm triggers used as L1 seeds but not in L1 menu"
123 for (std::vector<std::string>::const_iterator strIter =
128 << (*strIter) << std::endl;
247 bool hltChanged =
true;
274 const std::vector<std::pair<bool, std::string> >& hltL1Seed =
277 unsigned int numberHltL1GTSeeds = hltL1Seed.size();
280 << hltPathName <<
" : <== " << numberHltL1GTSeeds
281 <<
" HLTLevel1GTSeed module(s)" << std::endl;
283 for (
unsigned int iSeedModule = 0; iSeedModule
284 < numberHltL1GTSeeds; ++iSeedModule) {
288 (hltL1Seed[iSeedModule]).
second;
291 << m_l1SeedsLogicalExpression <<
"'";
295 if (m_l1SeedsLogicalExpression !=
"L1GlobalDecision") {
299 m_l1SeedsLogicalExpression);
302 std::vector<L1GtLogicParser::OperandToken>
305 size_t l1AlgoSeedsSize = m_l1AlgoSeeds.size();
308 <<
" : <== " << l1AlgoSeedsSize
309 <<
" L1 seeds" << std::endl;
314 for (
size_t i = 0;
i < l1AlgoSeedsSize; ++
i) {
317 (m_l1AlgoSeeds[
i]).tokenName;
323 int bitNr = (itAlgo->second).algoBitNumber();
329 <<
" " << trigNameOrAlias
330 <<
" bit " << bitNr << std::endl;
336 <<
" " << trigNameOrAlias
337 <<
" trigger not in L1 menu "
348 <<
", requested as seed by a HLT path, not found in the L1 trigger menu\n "
350 <<
"\nIncompatible L1 and HLT menus.\n"
366 <<
" HLT config extraction failure with process name "
374 const std::map<std::string, const L1GtAlgorithm*>& trigGroup,
375 const bool compactPrint,
const bool printPfsRates) {
385 int trigRateVal1 = 0;
386 int trigRateVal2 = 0;
389 std::vector < std::string > algoTriggerNotSeed;
392 std::vector < std::string > techTriggerNotSeed;
397 <<
"<p style=\"page-break-before: always\"> </p>";
400 << trigGroupName <<
"\n" << std::endl;
404 <<
"| *Trigger Name* | *Trigger Alias* | *Bit* | *Comments* |"
411 <<
"| *Trigger Name* | *Trigger Alias* | *Bit* | *Luminosity* |||| *Seed for !HLT path(s)* | *Comments* |"
415 << lumiVal1 <<
"* || *" << lumiVal2
416 <<
"* || ** | ** |" << std::endl;
419 <<
"|^|^|^| *PF* | *Rate* | *PF* | *Rate* | ** | ** |"
425 <<
"| *Trigger Name* | *Trigger Alias* | *Bit* | *Seed for !HLT path(s)* |"
431 for (
CItAlgoP itAlgo = trigGroup.begin(); itAlgo != trigGroup.end(); itAlgo++) {
433 const std::string& aName = (itAlgo->second)->algoName();
434 const std::string& aAlias = (itAlgo->second)->algoAlias();
435 const int& bitNumber = (itAlgo->second)->algoBitNumber();
441 const std::vector<std::string> &
hltPaths =
444 if (hltPaths.size() < 1) {
445 algoTriggerNotSeed.push_back(aAlias);
447 =
"<font color = \"red\">Not used as seed by any !HLT path</font>";
450 for (std::vector<std::string>::const_iterator strIter =
451 hltPaths.begin(); strIter != hltPaths.end(); ++strIter) {
453 seedsHlt = seedsHlt + (*strIter) +
"<BR>";
461 <<
"[[" << (
m_htmlFile +
"#" + aName) <<
"][ " << aName
462 <<
"]] " <<
" |" << aAlias <<
" | " << bitNumber <<
"| |"
469 << std::left <<
"[[" << (
m_htmlFile +
"#" + aName)
470 <<
"][ " << aName <<
"]] " <<
" |" << aAlias
471 <<
" | " << bitNumber <<
"| "
472 << ((trigPfVal1 != 0) ? trigPfVal1 : 0) <<
" | "
473 << ((trigRateVal1 != 0) ? trigRateVal1 : 0) <<
" | "
474 << ((trigPfVal2 != 0) ? trigPfVal2 : 0) <<
" | "
475 << ((trigRateVal2 != 0) ? trigRateVal2 : 0) <<
" | "
476 << seedsHlt <<
" | " << trigComment <<
" |"
482 << std::left <<
"[[" << (
m_htmlFile +
"#" + aName)
483 <<
"][ " << aName <<
"]] " <<
" |" << aAlias
484 <<
" | " << bitNumber <<
"|" << seedsHlt <<
" | "
493 <<
": " << (trigGroup.size()) <<
" bits defined." << std::endl;
497 <<
"\n Algorithm triggers from " << trigGroupName
498 <<
" not used as seeds by !HLT:" << std::endl;
500 if (algoTriggerNotSeed.size() != 0) {
501 for (std::vector<std::string>::const_iterator strIter =
502 algoTriggerNotSeed.begin(); strIter
503 != algoTriggerNotSeed.end(); ++strIter) {
506 << (*strIter) << std::endl;
536 typedef std::map<int, const L1GtAlgorithm*>::const_iterator CItBit;
540 std::map<int, const L1GtAlgorithm*> algoBitToAlgo;
542 std::map<std::string, const L1GtAlgorithm*> jetAlgoTrig;
543 std::map<std::string, const L1GtAlgorithm*> egammaAlgoTrig;
544 std::map<std::string, const L1GtAlgorithm*> esumAlgoTrig;
545 std::map<std::string, const L1GtAlgorithm*> muonAlgoTrig;
546 std::map<std::string, const L1GtAlgorithm*> crossAlgoTrig;
547 std::map<std::string, const L1GtAlgorithm*> bkgdAlgoTrig;
549 int algoTrigNumber = 0;
550 int freeAlgoTrigNumber = 0;
552 int jetAlgoTrigNumber = 0;
553 int egammaAlgoTrigNumber = 0;
554 int esumAlgoTrigNumber = 0;
555 int muonAlgoTrigNumber = 0;
556 int crossAlgoTrigNumber = 0;
557 int bkgdAlgoTrigNumber = 0;
562 const int bitNumber = (itAlgo->second).algoBitNumber();
563 const std::string& algName = (itAlgo->second).algoName();
565 algoBitToAlgo[bitNumber] = &(itAlgo->second);
572 (itAlgo->second).algoChipNumber());
574 const std::vector<L1GtLogicParser::TokenRPN>& rpnVector =
575 (itAlgo->second).algoRpnVector();
579 std::list<L1GtObject> listObjects;
581 for (
size_t i = 0;
i < rpnVector.size(); ++
i) {
583 if ((rpnVector[
i]).operation == condOperand) {
589 bool foundCond =
false;
591 CItCond itCond = conditionMap.find(cndName);
592 if (itCond != conditionMap.end()) {
597 const std::vector<L1GtObject>& objType =
598 (itCond->second)->objectType();
600 for (std::vector<L1GtObject>::const_iterator itObject =
601 objType.begin(); itObject != objType.end(); itObject++) {
602 listObjects.push_back(*itObject);
605 << (*itObject) << std::endl;
619 << cndName <<
" not found in the condition map"
620 <<
" for chip number "
621 << ((itAlgo->second).algoChipNumber()) << std::endl;
630 listObjects.unique();
634 bool jetGroup =
false;
635 bool egammaGroup =
false;
636 bool esumGroup =
false;
637 bool muonGroup =
false;
638 bool crossGroup =
false;
639 bool bkgdGroup =
false;
641 for (std::list<L1GtObject>::const_iterator itObj = listObjects.begin(); itObj
642 != listObjects.end(); ++itObj) {
726 <<
"\n Unknown object of type " << *itObj
734 int sumGroup = jetGroup + egammaGroup + esumGroup + muonGroup
735 + crossGroup + bkgdGroup;
738 crossAlgoTrig[algName] = &(itAlgo->second);
742 jetAlgoTrig[algName] = &(itAlgo->second);
744 }
else if (egammaGroup) {
745 egammaAlgoTrig[algName] = &(itAlgo->second);
747 }
else if (esumGroup && (listObjects.size() > 1)) {
748 crossAlgoTrig[algName] = &(itAlgo->second);
750 }
else if (esumGroup) {
751 esumAlgoTrig[algName] = &(itAlgo->second);
753 }
else if (muonGroup) {
754 muonAlgoTrig[algName] = &(itAlgo->second);
756 }
else if (bkgdGroup) {
757 bkgdAlgoTrig[algName] = &(itAlgo->second);
766 << sumGroup <<
" size: " << listObjects.size() << std::endl;
772 jetAlgoTrigNumber = jetAlgoTrig.size();
773 egammaAlgoTrigNumber = egammaAlgoTrig.size();
774 esumAlgoTrigNumber = esumAlgoTrig.size();
775 muonAlgoTrigNumber = muonAlgoTrig.size();
776 crossAlgoTrigNumber = crossAlgoTrig.size();
777 bkgdAlgoTrigNumber = bkgdAlgoTrig.size();
780 std::map<int, const L1GtAlgorithm*> techBitToAlgo;
782 int techTrigNumber = 0;
783 int freeTechTrigNumber = 0;
788 int bitNumber = (itAlgo->second).algoBitNumber();
789 techBitToAlgo[bitNumber] = &(itAlgo->second);
801 std::replace(menuName.begin(), menuName.end(),
'/',
'_');
802 m_htmlFile =
"%ATTACHURL%/" + menuName +
".html";
810 <<
"\n ********** L1 Trigger Menu - printing in wiki format ********** \n\n"
811 <<
"\n---+++ L1 menu identification\n"
812 <<
"\n|L1 Trigger Menu Interface: |!"
815 <<
" |" <<
"\n|L1 Trigger Menu Implementation: |!"
817 <<
"\n|Associated L1 scale DB key: |!"
825 <<
" * Number of algorithm triggers: " << algoTrigNumber
826 <<
" defined, 128 possible." << std::endl;
828 <<
" * Number of technical triggers: " << techTrigNumber
829 <<
" defined, 64 possible.<BR><BR>" << std::endl;
832 <<
" * Number of free bits for algorithm triggers: "
833 << freeAlgoTrigNumber << std::endl;
835 <<
" * Number of free bits for technical triggers: "
836 << freeTechTrigNumber <<
"<BR>" << std::endl;
839 <<
"\nNumber of algorithm triggers per trigger group\n"
842 <<
" | *Trigger group* | *Number of bits used*|" << std::endl;
844 <<
" | Jet algorithm triggers: | " << jetAlgoTrigNumber <<
"|"
847 <<
" | EGamma algorithm triggers: | " << egammaAlgoTrigNumber
850 <<
" | Energy sum algorithm triggers: | " << esumAlgoTrigNumber
853 <<
" | Muon algorithm triggers: | " << muonAlgoTrigNumber
856 <<
" | Cross algorithm triggers: | " << crossAlgoTrigNumber
859 <<
" | Background algorithm triggers: | " << bkgdAlgoTrigNumber
864 <<
"<p style=\"page-break-before: always\"> </p>";
867 bool compactPrint =
true;
870 <<
"\n---+++ List of algorithm triggers sorted by trigger groups\n"
899 <<
"<p style=\"page-break-before: always\"> </p>";
902 <<
"\n---+++ List of algorithm triggers sorted by bits\n"
906 <<
"| *Algorithm* | *Alias* | *Bit number* |" << std::endl;
908 for (CItBit itBit = algoBitToAlgo.begin(); itBit != algoBitToAlgo.end(); itBit++) {
910 int bitNumber = itBit->first;
915 <<
"[[" << (
m_htmlFile +
"#" + aName) <<
"][ " << aName
916 <<
"]] " <<
" |" << aAlias <<
" | " << bitNumber <<
"| |"
923 <<
"<p style=\"page-break-before: always\"> </p>";
925 <<
"\n---+++ List of technical triggers\n" << std::endl;
928 <<
"| *Technical trigger* | *Bit number* |" << std::endl;
930 for (CItBit itBit = techBitToAlgo.begin(); itBit != techBitToAlgo.end(); itBit++) {
932 int bitNumber = itBit->first;
937 << aName <<
" | " << std::right << bitNumber <<
" |"
943 <<
"<p style=\"page-break-before: always\"> </p>";
949 compactPrint =
false;
955 <<
"\n---+++ List of algorithm triggers sorted by trigger groups, including !HLT path association \n"
959 <<
"\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