28 #include <boost/cstdint.hpp>
40 #include "L1Trigger/L1TGlobal/src/L1TMenuEditor/L1TriggerMenu.hxx"
45 m_triggerMenuName(
"NULL"), m_triggerMenuImplementation(
"NULL"), m_scaleDbKey(
"NULL")
64 const unsigned int& numberConditionChipsValue) {
66 m_numberConditionChips = numberConditionChipsValue;
73 m_pinsOnConditionChip = pinsOnConditionChipValue;
80 const std::vector<int>& orderConditionChipValue) {
82 m_orderConditionChip = orderConditionChipValue;
88 const unsigned int& numberPhysTriggersValue) {
90 m_numberPhysTriggers = numberPhysTriggersValue;
96 const unsigned int& numberTechTriggersValue) {
98 m_numberTechTriggers = numberTechTriggersValue;
105 m_numberL1JetCounts = numberL1JetCountsValue;
112 m_conditionMap = condMap;
117 m_triggerMenuInterface = menuInterface;
121 m_triggerMenuName = menuName;
125 m_triggerMenuImplementation = menuImplementation;
130 m_scaleDbKey = scaleKey;
135 const std::vector<std::vector<MuonTemplate> >& vecMuonTempl) {
137 m_vecMuonTemplate = vecMuonTempl;
141 const std::vector<std::vector<CaloTemplate> >& vecCaloTempl) {
143 m_vecCaloTemplate = vecCaloTempl;
147 const std::vector<std::vector<L1GtEnergySumTemplate> >& vecEnergySumTempl) {
149 m_vecEnergySumTemplate = vecEnergySumTempl;
153 const std::vector<std::vector<L1GtJetCountsTemplate> >& vecJetCountsTempl) {
155 m_vecJetCountsTemplate = vecJetCountsTempl;
159 const std::vector<std::vector<L1GtCastorTemplate> >& vecCastorTempl) {
161 m_vecCastorTemplate = vecCastorTempl;
165 const std::vector<std::vector<L1GtHfBitCountsTemplate> >& vecHfBitCountsTempl) {
167 m_vecHfBitCountsTemplate = vecHfBitCountsTempl;
171 const std::vector<std::vector<L1GtHfRingEtSumsTemplate> >& vecHfRingEtSumsTempl) {
173 m_vecHfRingEtSumsTemplate = vecHfRingEtSumsTempl;
177 const std::vector<std::vector<L1GtBptxTemplate> >& vecBptxTempl) {
179 m_vecBptxTemplate = vecBptxTempl;
183 const std::vector<std::vector<L1GtExternalTemplate> >& vecExternalTempl) {
185 m_vecExternalTemplate = vecExternalTempl;
189 const std::vector<std::vector<CorrelationTemplate> >& vecCorrelationTempl) {
191 m_vecCorrelationTemplate = vecCorrelationTempl;
197 const std::vector<std::vector<MuonTemplate> >& corMuonTempl) {
199 m_corMuonTemplate = corMuonTempl;
203 const std::vector<std::vector<CaloTemplate> >& corCaloTempl) {
205 m_corCaloTemplate = corCaloTempl;
209 const std::vector<std::vector<L1GtEnergySumTemplate> >& corEnergySumTempl) {
211 m_corEnergySumTemplate = corEnergySumTempl;
219 m_algorithmMap = algoMap;
224 m_algorithmAliasMap = algoMap;
229 m_technicalTriggerMap = ttMap;
239 XERCES_CPP_NAMESPACE_USE
243 m_conditionMap.resize(m_numberConditionChips);
245 m_vecMuonTemplate.resize(m_numberConditionChips);
246 m_vecCaloTemplate.resize(m_numberConditionChips);
247 m_vecEnergySumTemplate.resize(m_numberConditionChips);
248 m_vecJetCountsTemplate.resize(m_numberConditionChips);
249 m_vecCastorTemplate.resize(m_numberConditionChips);
250 m_vecHfBitCountsTemplate.resize(m_numberConditionChips);
251 m_vecHfRingEtSumsTemplate.resize(m_numberConditionChips);
252 m_vecBptxTemplate.resize(m_numberConditionChips);
253 m_vecExternalTemplate.resize(m_numberConditionChips);
255 m_vecCorrelationTemplate.resize(m_numberConditionChips);
256 m_corMuonTemplate.resize(m_numberConditionChips);
257 m_corCaloTemplate.resize(m_numberConditionChips);
258 m_corEnergySumTemplate.resize(m_numberConditionChips);
264 m_triggerMenuName = defXmlFile;
265 size_t xmlPos = m_triggerMenuName.find_last_of(
"/");
266 m_triggerMenuName.erase(m_triggerMenuName.begin(), m_triggerMenuName.begin()
269 xmlPos = m_triggerMenuName.find_last_of(
".");
270 m_triggerMenuName.erase(m_triggerMenuName.begin() + xmlPos, m_triggerMenuName.end());
275 std::auto_ptr<l1t::L1TriggerMenu> tm(l1t::l1TriggerMenu(defXmlFile));
277 LogTrace(
"TriggerMenuXmlParser") <<
"\nOpening XML-File: \n " << defXmlFile << std::endl;
279 l1t::ConditionList conditions = tm->conditions();
294 m_triggerMenuInterfaceDate = val;
300 m_triggerMenuInterfaceAuthor = val;
306 m_triggerMenuInterfaceDescription = val;
313 m_triggerMenuDate = val;
319 m_triggerMenuAuthor = val;
325 m_triggerMenuDescription = val;
331 m_algorithmImplementation = val;
350 XERCES_CPP_NAMESPACE_USE
354 XMLPlatformUtils::Initialize();
356 catch (
const XMLException& toCatch) {
357 char*
message = XMLString::transcode(toCatch.getMessage());
360 <<
"Error during Xerces-c initialization! :"
361 << message << std::endl;
367 XercesDOMParser*
parser =
new XercesDOMParser();
368 parser->setValidationScheme(XercesDOMParser::Val_Always);
369 parser->setDoNamespaces(
false);
371 if (m_xmlErrHandler == 0) {
372 m_xmlErrHandler = (ErrorHandler*)
new HandlerBase();
377 parser->setErrorHandler(m_xmlErrHandler);
381 parser->parse(xmlFile.c_str());
383 catch(
const XMLException &toCatch) {
384 char*
message = XMLString::transcode(toCatch.getMessage());
387 <<
"Exception while parsing XML: \n"
388 << message << std::endl;
392 delete m_xmlErrHandler;
396 catch (
const DOMException &toCatch) {
397 char *
message = XMLString::transcode(toCatch.msg);
400 <<
"DOM-Exception while parsing XML: \n"
401 << message << std::endl;
405 delete m_xmlErrHandler;
412 <<
"Unexpected Exception while parsing XML!"
416 delete m_xmlErrHandler;
426 XERCES_CPP_NAMESPACE::DOMNode* startChild,
const std::string& tagName,
bool beginOnly,
429 XERCES_CPP_NAMESPACE_USE
433 DOMNode *n1 = startChild;
438 if ( !tagName.empty() ) {
439 nodeName = XMLString::transcode(n1->getNodeName());
443 while (XMLString::compareIString(nodeName, tagName.c_str())) {
446 n1 = n1->getNextSibling();
451 nodeName = XMLString::transcode(n1->getNodeName());
456 while (XMLString::compareNIString(nodeName, tagName.c_str(), tagName.length())) {
458 n1 = n1->getNextSibling();
463 nodeName = XMLString::transcode(n1->getNodeName());
465 if (n1 != 0 && rest != 0) {
466 *rest =
std::string(nodeName).substr(tagName.length(), strlen(nodeName) - tagName.length());
471 while (n1->getNodeType() != DOMNode::ELEMENT_NODE) {
472 n1 = n1->getNextSibling();
478 if (n1 != 0 && rest != 0) {
479 nodeName = XMLString::transcode(n1->getNodeName());
502 XERCES_CPP_NAMESPACE_USE
507 DOMNamedNodeMap*
attributes = node->getAttributes();
508 if (attributes == 0) {
513 XMLCh* attrName = XMLString::transcode(name.c_str());
514 DOMNode* attribNode = attributes->getNamedItem(attrName);
517 if (attribNode == 0) {
521 char* retCstr = XMLString::transcode(attribNode->getNodeValue());
538 XERCES_CPP_NAMESPACE_USE
547 const XMLCh* retXmlCh = n1->getTextContent();
552 char* retCstr = XMLString::transcode(retXmlCh);
553 XMLString::trim(retCstr);
575 static const std::string valid_hex_start(
"0123456789ABCDEFabcdef");
578 static const std::string valid_hex_end(
"0123456789ABCDEFabcdef");
583 unsigned int hexStart = tempStr.find_first_of(valid_hex_start);
584 unsigned int hexEnd = tempStr.find_first_not_of(valid_hex_end, hexStart);
586 if (hexStart == hexEnd) {
588 LogDebug(
"TriggerMenuXmlParser") <<
"No hex value found in: " << tempStr << std::endl;
593 tempStr = tempStr.substr(hexStart, hexEnd - hexStart);
595 if (tempStr.empty() ) {
597 LogDebug(
"TriggerMenuXmlParser") <<
"Empty value in " << __PRETTY_FUNCTION__
606 if (tempStr.length() > 16) {
607 tempStrL = tempStr.substr(tempStr.length()-16, 16);
608 tempStrH = tempStr.substr(0, tempStr.length()-16);
616 char* endPtr = (
char*) tempStrL.c_str();
621 LogDebug(
"TriggerMenuXmlParser") <<
"Unable to convert " << tempStr <<
" to hex."
628 endPtr = (
char*) tempStrH.c_str();
633 LogDebug(
"TriggerMenuXmlParser") <<
"Unable to convert " << tempStr <<
" to hex."
660 LogDebug(
"TriggerMenuXmlParser") <<
"node == 0 in " << __PRETTY_FUNCTION__ << std::endl;
668 if ( !hexString2UInt128(tempStr, tempUIntL, tempUIntH) ) {
684 if ( !hexString2UInt128(tempStr, tempUIntL, tempUIntH) ) {
711 if ( !getXMLHexTextValue128Old(node, tempUInt, dummyH) ) {
716 edm::LogError(
"TriggerMenuXmlParser") <<
"Too large hex-value!" << std::endl;
731 if ( !getXMLHexTextValue128( childName, tempUInt, dummyH) ) {
736 edm::LogError(
"TriggerMenuXmlParser") <<
"Too large hex-value!" << std::endl;
758 XERCES_CPP_NAMESPACE_USE
767 if ( !hexString2UInt128(maxString, maxBitsL, maxBitsH) ) {
782 while (maxBitsL != 0) {
784 if ( (maxBitsL & 1) == 0) {
787 <<
" Confused by not continous set bits for max value " << maxString
797 if ( (maxBitsH != 0) && (counter != 64)) {
800 <<
" Confused by not continous set bits for max value " << maxString
806 while (maxBitsH != 0) {
808 if ( (maxBitsH & 1) == 0) {
811 <<
" Confused by not continous set bits for max value " << maxString
839 const std::string& childName,
unsigned int num, std::vector<boost::uint64_t>& dst) {
841 XERCES_CPP_NAMESPACE_USE
846 <<
"node == 0 in " << __PRETTY_FUNCTION__
852 DOMNode* n1 = findXMLChild(node->getFirstChild(), childName);
857 LogDebug(
"TriggerMenuXmlParser") <<
"Child of condition not found ( " << childName
872 n1 = findXMLChild(n1->getFirstChild(), m_xmlTagValue);
873 for (
unsigned int i = 0;
i <
num;
i++) {
876 LogDebug(
"TriggerMenuXmlParser") <<
"Not enough values in condition child ( "
877 << childName <<
")" << std::endl;
882 if ( !getXMLHexTextValueOld(n1, dst[
i]) ) {
884 edm::LogError(
"TriggerMenuXmlParser") <<
"Error converting condition child ( "
885 << childName <<
") value." << std::endl;
890 n1 = findXMLChild(n1->getNextSibling(), m_xmlTagValue);
905 XERCES_CPP_NAMESPACE_USE
911 if (m_xmlErrHandler != 0) {
912 delete m_xmlErrHandler;
916 XMLPlatformUtils::Terminate();
935 XERCES_CPP_NAMESPACE_USE
937 DOMDocument*
doc = parser->getDocument();
938 DOMNode* n1 = doc->getFirstChild();
942 edm::LogError(
"TriggerMenuXmlParser") <<
"Error: Found no XML child" << std::endl;
948 n1 = findXMLChild(n1, m_xmlTagVme);
951 edm::LogError(
"TriggerMenuXmlParser") <<
"Error: No vme tag found." << std::endl;
955 n1 = n1->getFirstChild();
957 unsigned int chipCounter = 0;
959 while (chipCounter < m_numberConditionChips) {
961 n1 = findXMLChild(n1, m_xmlTagChip,
true);
972 n1 = n1->getNextSibling();
988 for (std::vector<ConditionMap>::iterator itCondOnChip = m_conditionMap.begin(); itCondOnChip
989 != m_conditionMap.end(); itCondOnChip++) {
993 itCondOnChip->clear();
998 m_algorithmMap.clear();
1011 if ((m_conditionMap[chipNr]).
count(cName) != 0) {
1012 LogTrace(
"TriggerMenuXmlParser") <<
" Condition " << cName
1013 <<
" already exists - not inserted!" << std::endl;
1017 (m_conditionMap[chipNr])[cName] = &cond;
1036 if (m_algorithmMap.count(algName) != 0) {
1037 LogTrace(
"TriggerMenuXmlParser") <<
" Algorithm \"" << algName
1038 <<
"\"already exists in the algorithm map- not inserted!" << std::endl;
1042 if (m_algorithmAliasMap.count(algAlias) != 0) {
1043 LogTrace(
"TriggerMenuXmlParser") <<
" Algorithm alias \"" << algAlias
1044 <<
"\"already exists in the algorithm alias map- not inserted!" << std::endl;
1050 if ((bitNumber < 0) || (bitNumber >= static_cast<int>(m_numberPhysTriggers))) {
1051 LogTrace(
"TriggerMenuXmlParser") <<
" Bit number " << bitNumber
1052 <<
" outside allowed range [0, " << m_numberPhysTriggers
1053 <<
") - algorithm not inserted!" << std::endl;
1058 if (m_algorithmMap.size() >= m_numberPhysTriggers) {
1059 LogTrace(
"TriggerMenuXmlParser") <<
" More than maximum allowed "
1060 << m_numberPhysTriggers <<
" algorithms in the algorithm map - not inserted!"
1066 int chipNr = alg.
algoChipNumber(static_cast<int>(m_numberConditionChips),
1067 static_cast<int>(m_pinsOnConditionChip), m_orderConditionChip);
1069 if ((chipNr < 0) || (chipNr > static_cast<int>(m_numberConditionChips))) {
1070 LogTrace(
"TriggerMenuXmlParser") <<
" Chip number " << chipNr
1071 <<
" outside allowed range [0, " << m_numberConditionChips
1072 <<
") - algorithm not inserted!" << std::endl;
1077 int outputPin = alg.
algoOutputPin(static_cast<int>(m_numberConditionChips),
1078 static_cast<int>(m_pinsOnConditionChip), m_orderConditionChip);
1080 if ((outputPin < 0) || (outputPin > static_cast<int>(m_pinsOnConditionChip))) {
1081 LogTrace(
"TriggerMenuXmlParser") <<
" Output pin " << outputPin
1082 <<
" outside allowed range [0, " << m_pinsOnConditionChip
1083 <<
"] - algorithm not inserted!" << std::endl;
1088 for (
CItAlgo itAlgo = m_algorithmMap.begin(); itAlgo != m_algorithmMap.end(); itAlgo++) {
1090 int iPin = (itAlgo->second).algoOutputPin( static_cast<int>(m_numberConditionChips),
1091 static_cast<int>(m_pinsOnConditionChip), m_orderConditionChip);
1093 int iChip = (itAlgo->second).algoChipNumber(static_cast<int>(m_numberConditionChips),
1094 static_cast<int>(m_pinsOnConditionChip), m_orderConditionChip);
1096 if ( (outputPin == iPin) && (chipNr == iChip)) {
1097 LogTrace(
"TriggerMenuXmlParser") <<
" Output pin " << outputPin
1098 <<
" is the same as for algorithm " << iName
1099 <<
"\n from the same chip number " << chipNr <<
" - algorithm not inserted!"
1107 m_algorithmMap[algName] = alg;
1108 m_algorithmAliasMap[algAlias] = alg;
1127 if (m_technicalTriggerMap.count(algName) != 0) {
1128 LogTrace(
"TriggerMenuXmlParser") <<
" Technical trigger \""
1130 <<
"\"already exists in the technical trigger map- not inserted!"
1138 || (bitNumber >= static_cast<int>(m_numberTechTriggers))) {
1139 LogTrace(
"TriggerMenuXmlParser") <<
" Bit number "
1140 << bitNumber <<
" outside allowed range [0, "
1141 << m_numberTechTriggers
1142 <<
") - technical trigger not inserted!" << std::endl;
1147 for (
CItAlgo itAlgo = m_technicalTriggerMap.begin(); itAlgo
1148 != m_technicalTriggerMap.end(); itAlgo++) {
1150 int iBitNumber = (itAlgo->second).algoBitNumber();
1153 if ((iBitNumber == bitNumber)) {
1154 LogTrace(
"TriggerMenuXmlParser") <<
" Bit number "
1155 << iBitNumber <<
" is the same as for technical trigger "
1156 << iName <<
" - technical trigger not inserted!"
1164 if (m_technicalTriggerMap.size() >= m_numberTechTriggers) {
1166 <<
" More than maximum allowed " << m_numberTechTriggers
1167 <<
" technical triggers in the technical trigger map - not inserted!"
1173 m_technicalTriggerMap[algName] = alg;
1189 if (type == m_xmlConditionAttrType1s) {
1193 if (type == m_xmlConditionAttrType2s) {
1197 if (type == m_xmlConditionAttrType3s) {
1201 if (type == m_xmlConditionAttrType4s) {
1205 if (type == m_xmlConditionAttrType2wsc) {
1209 if (type == m_xmlConditionAttrType2cor) {
1227 if (type == m_xmlConditionAttrType1s) {
1231 if (type == m_xmlConditionAttrType2s) {
1235 if (type == m_xmlConditionAttrType3s) {
1239 if (type == m_xmlConditionAttrType4s) {
1243 if (type == m_xmlConditionAttrType2wsc) {
1247 if (type == m_xmlConditionAttrType2cor) {
1264 if (getXMLAttribute(node, m_xmlAttrMode) != m_xmlAttrModeBit) {
1266 edm::LogError(
"TriggerMenuXmlParser") <<
"Invalid mode for single bit" << std::endl;
1272 if (tmpStr ==
"0") {
1275 else if (tmpStr ==
"1") {
1279 edm::LogError(
"TriggerMenuXmlParser") <<
"Bad bit value (" << tmpStr <<
")"
1297 XERCES_CPP_NAMESPACE_USE
1302 <<
"node == 0 in " << __PRETTY_FUNCTION__
1309 DOMNode* n1 = node->getFirstChild();
1310 n1 = findXMLChild(n1, nodeName);
1313 n1 = findXMLChild(n1->getFirstChild(), m_xmlTagGEq);
1316 LogDebug(
"TriggerMenuXmlParser") <<
"No \"greater or equal\" tag found"
1322 return getBitFromNode(n1);
1345 unsigned int num, std::vector<bool>& mipDst, std::vector<bool>& isoEnDst,
1346 std::vector<bool>& isoReqDst) {
1348 XERCES_CPP_NAMESPACE_USE
1355 DOMNode* n1 = findXMLChild(node->getFirstChild(), m_xmlTagPtLowThreshold);
1362 n1 = findXMLChild(n1->getFirstChild(), m_xmlTagValue);
1364 for (
unsigned int i = 0;
i <
num;
i++) {
1372 DOMNode* bitnode = findXMLChild(n1->getFirstChild(), m_xmlTagEnableMip);
1377 int tmpint = getBitFromNode(bitnode);
1382 mipDst[
i] = (tmpint != 0);
1390 bitnode = findXMLChild(n1->getFirstChild(), m_xmlTagEnableIso);
1395 tmpint = getBitFromNode(bitnode);
1400 isoEnDst[
i] = (tmpint != 0);
1407 bitnode = findXMLChild(n1->getFirstChild(), m_xmlTagRequestIso);
1412 tmpint = getBitFromNode(bitnode);
1417 isoReqDst[
i] = (tmpint != 0);
1424 n1 = findXMLChild(n1->getNextSibling(), m_xmlTagValue);
1432 std::stringstream ss;
1437 std::stringstream ss;
1442 std::stringstream ss;
1447 std::stringstream ss;
1448 ss << std::setfill(
'0');
1449 ss << std::setw(4) << date.year() <<
"-" << std::setw(2) << date.month() <<
"-" << std::setw(2) << date.day() <<
"T";
1450 ss << std::setw(2) << date.hours() <<
":" << std::setw(2) << date.minutes() <<
":" << std::setw(2) << date.seconds();
1455 std::stringstream ss;
1460 std::stringstream ss;
1465 std::stringstream ss;
1470 std::stringstream ss;
1475 std::stringstream ss;
1480 std::stringstream ss;
1485 std::stringstream ss;
1490 std::stringstream ss;
1495 std::stringstream ss;
1500 std::stringstream ss;
1505 std::stringstream ss;
1526 unsigned int chipNr,
const bool corrFlag) {
1528 XERCES_CPP_NAMESPACE_USE
1536 if( particle==
"mu" ) particle =
"muon";
1537 if( type==
"single" ) type =
"1_s";
1540 <<
"\n ****************************************** "
1542 <<
"\n condition = " << condition
1543 <<
"\n particle = " << particle
1544 <<
"\n type = " << type
1545 <<
"\n name = " << name
1548 if (particle != m_xmlConditionAttrObjectMu) {
1549 edm::LogError(
"TriggerMenuXmlParser") <<
"Wrong particle for muon-condition ("
1550 << particle <<
")" << std::endl;
1555 std::string str_etComparison = l1t2string( condMu.etComparison() );
1557 int nrObj = getNumFromType(type);
1559 edm::LogError(
"TriggerMenuXmlParser") <<
"Unknown type for calo-condition (" << type
1560 <<
")" <<
"\nCan not determine number of trigger objects. " << std::endl;
1565 int intGEq = ( str_etComparison==
"ge" ) ? 1 : 0;
1567 edm::LogError(
"TriggerMenuXmlParser") <<
"Error getting \"greater or equal\" flag"
1572 bool gEq = (intGEq != 0);
1577 std::vector<MuonTemplate::ObjectParameter> objParameter(nrObj);
1581 std::vector<boost::uint64_t> tmpValues((nrObj > 2) ? nrObj : 2);
1591 for (
int i = 0;
i < nrObj;
i++) {
1592 getXMLHexTextValue(
"0a", dst);
1594 objParameter[
i].ptHighThreshold = dst;
1608 for (
int i = 0;
i < nrObj;
i++) {
1620 getXMLHexTextValue(
"0a", dst);
1621 objParameter[
i].ptLowThreshold = dst;
1635 for (
int i = 0;
i < nrObj;
i++) {
1637 getXMLHexTextValue(
"f0", dst);
1638 objParameter[
i].qualityRange = dst;
1652 for (
int i = 0;
i < nrObj;
i++) {
1654 getXMLHexTextValue(
"FFFFFFFFFFFFFFFF", dst);
1655 objParameter[
i].etaRange = dst;
1669 for (
int i = 0;
i < nrObj;
i++) {
1670 getXMLHexTextValue(
"8f", dst);
1671 objParameter[
i].phiHigh = dst;
1685 for (
int i = 0;
i < nrObj;
i++) {
1686 getXMLHexTextValue(
"00", dst);
1687 objParameter[
i].phiLow = dst;
1706 getXMLHexTextValue(
"1", dst);
1716 std::vector<bool> tmpMip(nrObj);
1717 std::vector<bool> tmpEnableIso(nrObj);
1718 std::vector<bool> tmpRequestIso(nrObj);
1728 for (
int i = 0;
i < nrObj;
i++) {
1729 objParameter[
i].enableMip =
false;
1730 objParameter[
i].enableIso =
false;
1731 objParameter[
i].requestIso =
false;
1735 bool wscVal = (type == m_xmlConditionAttrType2wsc );
1784 <<
"Type for muon condition id l1t::TypeNull - it means not defined in the XML file."
1785 <<
"\nNumber of trigger objects is set to zero. " << std::endl;
1790 std::vector<L1GtObject> objType(nrObj,
Mu);
1794 int relativeBx = l1t2int( condMu.relativeBx() );
1801 muonCond.setCondType(cType);
1802 muonCond.setObjectType(objType);
1803 muonCond.setCondGEq(gEq);
1804 muonCond.setCondChipNr(chipNr);
1805 muonCond.setCondRelativeBx(relativeBx);
1807 muonCond.setConditionParameter(objParameter, corrParameter);
1810 std::ostringstream myCoutStream;
1811 muonCond.print(myCoutStream);
1812 LogTrace(
"TriggerMenuXmlParser") << myCoutStream.str() <<
"\n" << std::endl;
1816 if ( !insertConditionIntoMap(muonCond, chipNr)) {
1818 <<
" Error: duplicate condition (" << name <<
")"
1824 (m_corMuonTemplate[chipNr]).push_back(muonCond);
1827 (m_vecMuonTemplate[chipNr]).push_back(muonCond);
1848 unsigned int chipNr,
const bool corrFlag) {
1850 XERCES_CPP_NAMESPACE_USE
1855 std::string particle = l1t2string( condCalo.objectType() );
1860 <<
"\n ****************************************** "
1861 <<
"\n DARRENS TEST OUTPUT (in parseCalo) "
1862 <<
"\n condition = " << condition
1863 <<
"\n particle = " << particle
1864 <<
"\n type = " << type
1865 <<
"\n name = " << name
1872 if (particle == m_xmlConditionAttrObjectNoIsoEG) {
1875 else if (particle == m_xmlConditionAttrObjectIsoEG) {
1876 caloObjType =
IsoEG;
1878 else if (particle == m_xmlConditionAttrObjectCenJet) {
1881 else if (particle == m_xmlConditionAttrObjectTauJet) {
1884 else if (particle == m_xmlConditionAttrObjectForJet) {
1888 edm::LogError(
"TriggerMenuXmlParser") <<
"Wrong particle for calo-condition ("
1889 << particle <<
")" << std::endl;
1893 if( type==
"double_wsc" ) type =
"2_wsc";
1894 else if( type==
"single" ) type =
"1_s";
1895 else if( type==
"double" ) type =
"2_s";
1896 else if( type==
"triple" ) type =
"3";
1897 else if( type==
"quad" ) type =
"4";
1900 std::string str_etComparison = l1t2string( condCalo.etComparison() );
1902 int nrObj = getNumFromType(type);
1904 edm::LogError(
"TriggerMenuXmlParser") <<
"Unknown type for calo-condition (" << type
1905 <<
")" <<
"\nCan not determine number of trigger objects. " << std::endl;
1910 int intGEq = ( str_etComparison==
"ge" ) ? 1 : 0;
1912 edm::LogError(
"TriggerMenuXmlParser") <<
"Error getting \"greater or equal\" flag"
1917 bool gEq = (intGEq != 0);
1922 std::vector<CaloTemplate::ObjectParameter> objParameter(nrObj);
1926 std::vector<boost::uint64_t> tmpValues((nrObj > 1) ? nrObj : 1);
1927 tmpValues.reserve( nrObj );
1929 if(
int(condCalo.objectRequirements().objectRequirement().size())!=nrObj ){
1930 edm::LogError(
"TriggerMenuXmlParser") <<
" condCalo objects: nrObj = " << nrObj
1931 <<
"condCalo.objectRequirements().objectRequirement().size() = "
1932 << condCalo.objectRequirements().objectRequirement().size()
1942 for( l1t::CalorimeterObjectRequirements::objectRequirement_const_iterator objPar = condCalo.objectRequirements().objectRequirement().begin();
1943 objPar != condCalo.objectRequirements().objectRequirement().end(); ++objPar ){
1946 str_condCalo = l1t2string( objPar->etThreshold() );
1947 if( !getXMLHexTextValue(str_condCalo, dst) )
return false;
1950 if( cnt<nrObj ) objParameter[cnt].etThreshold = objPar->etThreshold();
1954 str_condCalo =
"7f7f";
1956 if( !getXMLHexTextValue(str_condCalo, dst) )
return false;
1957 if( cnt<nrObj ) objParameter[cnt].etaRange = dst;
1960 str_condCalo =
"3ffff";
1961 if( !getXMLHexTextValue(str_condCalo, dst) )
return false;
1962 if( cnt<nrObj ) objParameter[cnt].phiRange = dst;
1967 unsigned int etaWindowLower=-1, etaWindowUpper=-1, etaWindowVetoLower=-1, etaWindowVetoUpper=-1;
1969 for( l1t::CalorimeterObjectRequirement::etaWindow_const_iterator etaWindow =objPar->etaWindow().begin();
1970 etaWindow != objPar->etaWindow().end(); ++etaWindow ){
1973 <<
"\n etaWindow lower = " << etaWindow->lower()
1974 <<
"\n etaWindow upper = " << etaWindow->upper()
1976 if( cntEta==0 ){ etaWindowLower = etaWindow->lower(); etaWindowUpper = etaWindow->upper(); }
1977 else if( cntEta==1 ){ etaWindowVetoLower = etaWindow->lower(); etaWindowVetoUpper = etaWindow->upper(); }
1982 unsigned int phiWindowLower=-1, phiWindowUpper=-1, phiWindowVetoLower=-1, phiWindowVetoUpper=-1;
1983 for( l1t::CalorimeterObjectRequirement::phiWindow_const_iterator phiWindow =objPar->phiWindow().begin();
1984 phiWindow != objPar->phiWindow().end(); ++phiWindow ){
1987 <<
"\n phiWindow begin = " << phiWindow->lower()
1988 <<
"\n phiWindow end = " << phiWindow->upper()
1991 if( cntPhi==0 ){ phiWindowLower = phiWindow->lower(); phiWindowUpper = phiWindow->upper(); }
1992 else if( cntPhi==1 ){ phiWindowVetoLower = phiWindow->lower(); phiWindowVetoUpper = phiWindow->upper(); }
1996 objParameter[cnt].etaWindowLower = etaWindowLower;
1997 objParameter[cnt].etaWindowUpper = etaWindowUpper;
1998 objParameter[cnt].etaWindowVetoLower = etaWindowVetoLower;
1999 objParameter[cnt].etaWindowVetoUpper = etaWindowVetoUpper;
2001 objParameter[cnt].phiWindowLower = phiWindowLower;
2002 objParameter[cnt].phiWindowUpper = phiWindowUpper;
2003 objParameter[cnt].phiWindowVetoLower = phiWindowVetoLower;
2004 objParameter[cnt].phiWindowVetoUpper = phiWindowVetoUpper;
2009 <<
"\n Calo ET high threshold (hex) for calo object " << cnt <<
" = "
2010 << std::hex << objParameter[cnt].etThreshold << std::dec
2011 <<
"\n etaWindow (hex) for calo object " << cnt <<
" = "
2012 << std::hex << objParameter[cnt].etaRange << std::dec
2013 <<
"\n phiRange (hex) for calo object " << cnt <<
" = "
2014 << std::hex << objParameter[cnt].phiRange << std::dec
2015 <<
"\n etaWindow Lower / Upper for calo object " << cnt <<
" = "
2016 << objParameter[cnt].etaWindowLower <<
" / " << objParameter[cnt].etaWindowUpper
2017 <<
"\n etaWindowVeto Lower / Upper for calo object " << cnt <<
" = "
2018 << objParameter[cnt].etaWindowVetoLower <<
" / " << objParameter[cnt].etaWindowVetoUpper
2019 <<
"\n phiWindow Lower / Upper for calo object " << cnt <<
" = "
2020 << objParameter[cnt].phiWindowLower <<
" / " << objParameter[cnt].phiWindowUpper
2021 <<
"\n phiWindowVeto Lower / Upper for calo object " << cnt <<
" = "
2022 << objParameter[cnt].phiWindowVetoLower <<
" / " << objParameter[cnt].phiWindowVetoUpper
2031 bool wscVal = (type == m_xmlConditionAttrType2wsc );
2035 xsd::cxx::tree::optional<l1t::DeltaRequirement> condRanges = condCalo.deltaRequirement();
2037 <<
"\t condRanges->deltaEtaRange().lower() = " << condRanges->deltaEtaRange().lower()
2038 <<
"\n\t condRanges->deltaEtaRange().upper() = " << condRanges->deltaEtaRange().upper()
2039 <<
"\n\t condRanges->deltaPhiRange().lower() = " << condRanges->deltaPhiRange().lower()
2040 <<
"\n\t condRanges->deltaPhiRange().upper() = " << condRanges->deltaPhiRange().upper()
2054 str_condCalo =
"0003";
2055 if ( !hexString2UInt128(str_condCalo, tempUIntL, tempUIntH) ) {
2058 if( tempUIntH != 0 ){
2059 edm::LogError(
"TriggerMenuXmlParser") <<
"Too large hex-value!" << std::endl;
2065 str_condCalo =
"003";
2066 if ( !hexString2UInt128(str_condCalo, tempUIntL, tempUIntH) ) {
2069 if( tempUIntH != 0 ){
2070 edm::LogError(
"TriggerMenuXmlParser") <<
"Too large hex-value!" << std::endl;
2080 unsigned int maxbits = 0;
2082 if ( !countConditionChildMaxBits(maxString, maxbits) ) {
2088 <<
" deltaPhiMaxbits (dec) = " << maxbits
2098 <<
" Condition type (enum value) = " << cType
2103 <<
"Type for calo condition id l1t::TypeNull - it means not defined in the XML file."
2104 <<
"\nNumber of trigger objects is set to zero. " << std::endl;
2109 std::vector<L1GtObject> objType(nrObj, caloObjType);
2112 int relativeBx = l1t2int( condCalo.relativeBx() );
2117 caloCond.setCondType(cType);
2118 caloCond.setObjectType(objType);
2119 caloCond.setCondGEq(gEq);
2120 caloCond.setCondChipNr(chipNr);
2121 caloCond.setCondRelativeBx(relativeBx);
2123 caloCond.setConditionParameter(objParameter, corrParameter);
2127 std::ostringstream myCoutStream;
2128 caloCond.print(myCoutStream);
2129 LogTrace(
"TriggerMenuXmlParser") << myCoutStream.str() <<
"\n" << std::endl;
2134 if ( !insertConditionIntoMap(caloCond, chipNr)) {
2137 <<
" Error: duplicate condition (" << name <<
")"
2145 (m_corCaloTemplate[chipNr]).push_back(caloCond);
2148 (m_vecCaloTemplate[chipNr]).push_back(caloCond);
2154 <<
"\n intGEq = " << intGEq
2155 <<
" nrObj = " << nrObj
2156 <<
"\n ****************************************** "
2177 unsigned int chipNr,
const bool corrFlag) {
2179 XERCES_CPP_NAMESPACE_USE
2388 XERCES_CPP_NAMESPACE_USE
2562 XERCES_CPP_NAMESPACE_USE
2638 XERCES_CPP_NAMESPACE_USE
2771 XERCES_CPP_NAMESPACE_USE
2903 XERCES_CPP_NAMESPACE_USE
2972 XERCES_CPP_NAMESPACE_USE
3040 unsigned int chipNr) {
3042 XERCES_CPP_NAMESPACE_USE
3048 if ( !insertConditionIntoMap(correlationCond, chipNr)) {
3051 <<
" Error: duplicate correlation condition (" << name <<
")"
3376 XERCES_CPP_NAMESPACE_USE
3554 m_triggerMenuInterface = l1t2string( meta.name() );
3555 m_triggerMenuInterfaceDate =
"2013-010-24T15:33:24";
3556 m_triggerMenuInterfaceAuthor =
"Darren Puigh";
3557 m_triggerMenuInterfaceDescription = l1t2string( meta.description() );
3561 m_triggerMenuDescription = l1t2string( meta.description() );
3562 m_scaleDbKey = l1t2string( meta.scalesKey() );
3566 for( l1t::History::revision_const_iterator revision = meta.history().revision().begin();
3567 revision != meta.history().revision().end(); ++revision ){
3570 <<
"\t Revision " << cnt
3571 <<
"\t\t author = " << l1t2string( revision->author() )
3572 <<
"\t\t datetime = " << l1t2string( revision->datetime() )
3576 m_triggerMenuDate = l1t2string( revision->datetime() );
3577 m_triggerMenuAuthor = l1t2string( revision->author() );
3584 <<
"\n Parsed values from XML file DRULES"
3585 <<
"\nL1 MenuInterface: " << m_triggerMenuInterface
3586 <<
"\nL1 MenuInterface - Creation date: " << m_triggerMenuInterfaceDate
3587 <<
"\nL1 MenuInterface - Creation author: " << m_triggerMenuInterfaceAuthor
3588 <<
"\nL1 MenuInterface - Description: " << m_triggerMenuInterfaceDescription
3590 <<
"\nAlgorithm implementation tag: " << m_algorithmImplementation
3592 <<
"\nL1 Menu - Creation date: " << m_triggerMenuDate
3593 <<
"\nL1 Menu - Creation author: " << m_triggerMenuAuthor
3594 <<
"\nL1 Menu - Description: " << m_triggerMenuDescription
3602 std::string menuName = m_triggerMenuInterface +
"/" + m_scaleDbKey +
"/" + m_algorithmImplementation;
3604 if (menuName != m_triggerMenuName) {
3606 LogDebug(
"TriggerMenuXmlParser") <<
"\n Warning: Inconsistent L1 menu name:"
3607 <<
"\n from XML file name: " << m_triggerMenuName
3608 <<
"\n from XML tag: " << menuName << std::endl;
3610 if (m_triggerMenuInterface !=
"") {
3611 if (m_scaleDbKey ==
"NULL") {
3612 m_triggerMenuName = m_triggerMenuInterface;
3614 m_triggerMenuName = menuName;
3617 LogTrace(
"TriggerMenuXmlParser") <<
"\n L1 menu name set to value from XML tag!"
3618 <<
"\n L1 Menu name: " << m_triggerMenuName << std::endl;
3621 LogTrace(
"TriggerMenuXmlParser") <<
"\n L1 menu name set to file name!"
3622 <<
"\n L1 Menu name: " << m_triggerMenuName << std::endl;
3645 XERCES_CPP_NAMESPACE_USE
3648 std::string condition = getXMLAttribute(node, m_xmlConditionAttrCondition);
3649 std::string particle = getXMLAttribute(node, m_xmlConditionAttrObject);
3653 <<
"\n ****************************************** "
3654 <<
"\n workCondition "
3655 <<
"\n condition = " << condition
3656 <<
"\n particle = " << particle
3657 <<
"\n type = " << type
3658 <<
"\n name = " << name
3661 if (condition.empty() || particle.empty() || type.empty() ) {
3663 edm::LogError(
"TriggerMenuXmlParser") <<
"Missing attributes for condition " << name
3731 XERCES_CPP_NAMESPACE_USE
3733 LogTrace(
"TriggerMenuXmlParser") <<
"\nParsing conditions" << std::endl;
3736 LogDebug(
"l1t|Global") <<
" ====> condCalorimeter" << std::endl;
3737 for (l1t::ConditionList::condCalorimeter_const_iterator condCalo = conditions.condCalorimeter().begin();
3738 condCalo != conditions.condCalorimeter().end(); ++condCalo ){
3741 << condCalo->name() <<
" {"
3742 <<
" description: " << condCalo->description()
3743 <<
" locked: " << condCalo->locked()
3747 l1t::CalorimeterCondition condition = (*condCalo);
3749 parseCalo( condition, chipNr );
3752 LogDebug(
"l1t|Global") <<
" ====> condMuon " << std::endl;
3753 for (l1t::ConditionList::condMuon_const_iterator condMu = conditions.condMuon().begin();
3754 condMu != conditions.condMuon().end(); ++condMu ){
3757 << condMu->name() <<
" {"
3758 <<
" description: " << condMu->description()
3759 <<
" locked: " << condMu->locked()
3763 l1t::MuonCondition condition = (*condMu);
3765 parseMuon( condition, chipNr );
3784 unsigned int chipNr) {
3786 XERCES_CPP_NAMESPACE_USE
3797 std::string algAlias = l1t2string( algorithm.name() );
3798 std::string algName = l1t2string( algorithm.name() );
3800 if (algAlias ==
"") {
3803 <<
"\n No alias defined for algorithm. Alias set to algorithm name."
3804 <<
"\n Algorithm name: " << algName <<
"\n Algorithm alias: " << algAlias
3808 LogDebug(
"l1t|Global") <<
"\n Alias defined for algorithm."
3809 <<
"\n Algorithm name: " << algName <<
"\n Algorithm alias: " << algAlias
3814 std::string logExpression = l1t2string( algorithm.equation() );
3817 <<
" Logical expression: " << logExpression
3818 <<
" Chip number: " << chipNr
3822 std::string pinString = l1t2string( algorithm.index() );
3825 std::istringstream opStream(pinString);
3827 if ((opStream >> outputPin).
fail()) {
3829 <<
" Unable to convert pin string " << pinString
3830 <<
" to int for algorithm : " << algName
3838 LogDebug(
"l1t|Global") <<
" Output pin: " << outputPin
3844 int bitNumber = outputPin;
3847 LogDebug(
"l1t|Global") <<
" Bit number: " << bitNumber
3857 std::ostringstream myCoutStream;
3858 alg.
print(myCoutStream);
3859 LogTrace(
"TriggerMenuXmlParser") << myCoutStream.str() <<
"\n" << std::endl;
3864 if ( !insertAlgorithmIntoMap(alg)) {
3888 XERCES_CPP_NAMESPACE_USE
3890 LogTrace(
"TriggerMenuXmlParser") <<
"\nParsing algorithms" << std::endl;
3893 LogDebug(
"l1t|Global") <<
" ====> algorithms " << std::endl;
3894 for( l1t::AlgorithmList::algorithm_const_iterator
i = algorithms.algorithm().begin();
3895 i != algorithms.algorithm().end(); ++
i ){
3899 << algorithm.name() <<
" {"
3900 <<
" index: " << algorithm.index()
3901 <<
" equation: " << algorithm.equation()
3902 <<
" description: " << algorithm.description()
3903 <<
" locked: " << algorithm.locked()
3908 workAlgorithm( algorithm, chipNr );
3928 XERCES_CPP_NAMESPACE_USE
3932 <<
" Node is 0 in " << __PRETTY_FUNCTION__
3933 <<
" can not parse the technical trigger " << algName
3939 std::string logExpression = getXMLTextValue(node);
3946 DOMNode* pinNode = findXMLChild(node->getFirstChild(), m_xmlTagOutput);
3950 pinNode = node->getFirstChild();
3951 if ( (pinNode = findXMLChild(pinNode, m_xmlTagOutputPin) ) != 0) {
3952 pinString = getXMLAttribute(pinNode, m_xmlAttrNr);
3955 std::istringstream opStream(pinString);
3957 if ((opStream >> outputPin).
fail()) {
3959 <<
" Unable to convert pin string " << pinString
3960 <<
" to int for technical trigger : " << algName
3970 <<
" Warning: No pin number found for technical trigger: "
3971 << algName << std::endl;
3977 int bitNumber = outputPin;
3990 std::ostringstream myCoutStream;
3991 alg.
print(myCoutStream);
3992 LogTrace(
"TriggerMenuXmlParser") << myCoutStream.str() <<
"\n" << std::endl;
3997 if ( !insertTechTriggerIntoMap(alg)) {
4017 XERCES_CPP_NAMESPACE_USE
4021 DOMNode*
doc = parser->getDocument();
4022 DOMNode*
node = doc->getFirstChild();
4024 DOMNode* algNode = node->getFirstChild();
4027 <<
" Error: No child found for " << m_xmlTagDef << std::endl;
4031 algNode = findXMLChild(algNode, m_xmlTagTechTriggers);
4034 << m_xmlTagTechTriggers <<
"> child found."
4040 DOMNode* algNameNode = algNode->getFirstChild();
4042 algNameNode = findXMLChild(algNameNode,
"",
true, &algNameNodeName);
4044 while (algNameNode != 0) {
4049 if ( !workTechTrigger(algNameNode, algNameNodeName)) {
4053 algNameNode = findXMLChild(algNameNode->getNextSibling(),
"",
true,
4073 XERCES_CPP_NAMESPACE_USE
4079 l1t::Meta meta = tm->meta();
4080 l1t::ConditionList conditions = tm->conditions();
4081 l1t::AlgorithmList algorithms = tm->algorithms();
4083 if ( !parseId( meta ) ) {
4088 if ( !parseConditions( conditions ) ) {
4093 if ( !parseAlgorithms( algorithms ) ) {
< trclass="colgroup">< tdclass="colgroup"colspan=5 > Ecal cluster collections</td ></tr >< tr >< td >< ahref="classreco_1_1BasicCluster.html"> reco::BasicCluster</a ></td >< td >< ahref="DataFormats_EgammaReco.html"> reco::BasicClusterCollection</a ></td >< td >< ahref="#"> hybridSuperClusters</a ></td >< tdclass="description"> Basic clusters reconstructed with hybrid algorithm(barrel only)</td >< td >S.Rahatlou</td ></tr >< tr >< td >< a href
unsigned int deltaPhiMaxbits
void setAlgoAlias(const std::string &algoAliasValue)
virtual void print(std::ostream &myCout) const
print condition
unsigned long long deltaEtaRange
const std::string algoName() const
get / set algorithm name
unsigned long long deltaPhiRange
unsigned int deltaPhiRangeLower
std::string const & algoAlias() const
get / set algorithm alias
void setAlgoChipNumber(const int algoChipNumberValue)
AlgorithmMap::const_iterator CItAlgo
iterators through map containing the algorithms
unsigned int deltaEtaRangeUpper
const int algoOutputPin(const int numberConditionChips, const int pinsOnConditionChip, const std::vector< int > &orderConditionChip) const
get the output pin on the condition chip for the algorithm
int algoBitNumber() const
get / set algorithm bit number
std::map< std::string, L1GtAlgorithm > AlgorithmMap
map containing the algorithms
unsigned int deltaPhiRangeUpper
const std::string & condName() const
get / set condition name
unsigned long long uint64_t
bool xmlFile(const std::string fParam)
typedef for correlation parameters
char data[epos_bytes_allocation]
const int algoChipNumber() const
get / set algorithm bit number
static std::atomic< unsigned int > counter
unsigned int chargeCorrelation
unsigned int deltaEtaRangeLower