26 #include <boost/cstdint.hpp>
42 m_triggerMenuName(
"NULL"), m_triggerMenuImplementation(
"NULL"), m_scaleDbKey(
"NULL")
61 const unsigned int& numberConditionChipsValue) {
77 const std::vector<int>& orderConditionChipValue) {
85 const unsigned int& numberPhysTriggersValue) {
93 const unsigned int& numberTechTriggersValue) {
132 const std::vector<std::vector<L1GtMuonTemplate> >& vecMuonTempl) {
138 const std::vector<std::vector<L1GtCaloTemplate> >& vecCaloTempl) {
144 const std::vector<std::vector<L1GtEnergySumTemplate> >& vecEnergySumTempl) {
150 const std::vector<std::vector<L1GtJetCountsTemplate> >& vecJetCountsTempl) {
156 const std::vector<std::vector<L1GtCastorTemplate> >& vecCastorTempl) {
162 const std::vector<std::vector<L1GtHfBitCountsTemplate> >& vecHfBitCountsTempl) {
168 const std::vector<std::vector<L1GtHfRingEtSumsTemplate> >& vecHfRingEtSumsTempl) {
174 const std::vector<std::vector<L1GtBptxTemplate> >& vecBptxTempl) {
180 const std::vector<std::vector<L1GtExternalTemplate> >& vecExternalTempl) {
186 const std::vector<std::vector<L1GtCorrelationTemplate> >& vecCorrelationTempl) {
194 const std::vector<std::vector<L1GtMuonTemplate> >& corMuonTempl) {
200 const std::vector<std::vector<L1GtCaloTemplate> >& corCaloTempl) {
206 const std::vector<std::vector<L1GtEnergySumTemplate> >& corEnergySumTempl) {
236 XERCES_CPP_NAMESPACE_USE
274 LogTrace(
"L1GtTriggerMenuXmlParser") <<
"\nOpening XML-File: \n " << defXmlFile << std::endl;
276 if ((parser =
initXML(defXmlFile)) != 0) {
343 XERCES_CPP_NAMESPACE_USE
349 catch (
const XMLException& toCatch) {
350 char*
message = XMLString::transcode(toCatch.getMessage());
353 <<
"Error during Xerces-c initialization! :"
354 << message << std::endl;
360 XercesDOMParser*
parser =
new XercesDOMParser();
361 parser->setValidationScheme(XercesDOMParser::Val_Always);
362 parser->setDoNamespaces(
false);
374 parser->parse(xmlFile.c_str());
376 catch(
const XMLException &toCatch) {
377 char*
message = XMLString::transcode(toCatch.getMessage());
380 <<
"Exception while parsing XML: \n"
381 << message << std::endl;
389 catch (
const DOMException &toCatch) {
390 char *
message = XMLString::transcode(toCatch.msg);
393 <<
"DOM-Exception while parsing XML: \n"
394 << message << std::endl;
405 <<
"Unexpected Exception while parsing XML!"
419 XERCES_CPP_NAMESPACE::DOMNode* startChild,
const std::string& tagName,
bool beginOnly,
422 XERCES_CPP_NAMESPACE_USE
426 DOMNode *n1 = startChild;
431 if ( !tagName.empty() ) {
432 nodeName = XMLString::transcode(n1->getNodeName());
436 while (XMLString::compareIString(nodeName, tagName.c_str())) {
439 n1 = n1->getNextSibling();
444 nodeName = XMLString::transcode(n1->getNodeName());
449 while (XMLString::compareNIString(nodeName, tagName.c_str(), tagName.length())) {
451 n1 = n1->getNextSibling();
456 nodeName = XMLString::transcode(n1->getNodeName());
458 if (n1 != 0 && rest != 0) {
459 *rest =
std::string(nodeName).substr(tagName.length(), strlen(nodeName) - tagName.length());
464 while (n1->getNodeType() != DOMNode::ELEMENT_NODE) {
465 n1 = n1->getNextSibling();
471 if (n1 != 0 && rest != 0) {
472 nodeName = XMLString::transcode(n1->getNodeName());
495 XERCES_CPP_NAMESPACE_USE
500 DOMNamedNodeMap*
attributes = node->getAttributes();
501 if (attributes == 0) {
506 XMLCh* attrName = XMLString::transcode(name.c_str());
507 DOMNode* attribNode = attributes->getNamedItem(attrName);
510 if (attribNode == 0) {
514 char* retCstr = XMLString::transcode(attribNode->getNodeValue());
531 XERCES_CPP_NAMESPACE_USE
540 const XMLCh* retXmlCh = n1->getTextContent();
545 char* retCstr = XMLString::transcode(retXmlCh);
546 XMLString::trim(retCstr);
568 static const std::string valid_hex_start(
"0123456789ABCDEFabcdef");
571 static const std::string valid_hex_end(
"0123456789ABCDEFabcdef");
576 unsigned int hexStart = tempStr.find_first_of(valid_hex_start);
577 unsigned int hexEnd = tempStr.find_first_not_of(valid_hex_end, hexStart);
579 if (hexStart == hexEnd) {
581 LogDebug(
"L1GtTriggerMenuXmlParser") <<
"No hex value found in: " << tempStr << std::endl;
586 tempStr = tempStr.substr(hexStart, hexEnd - hexStart);
588 if (tempStr.empty() ) {
590 LogDebug(
"L1GtTriggerMenuXmlParser") <<
"Empty value in " << __PRETTY_FUNCTION__
599 if (tempStr.length() > 16) {
600 tempStrL = tempStr.substr(tempStr.length()-16, 16);
601 tempStrH = tempStr.substr(0, tempStr.length()-16);
609 char* endPtr = (
char*) tempStrL.c_str();
614 LogDebug(
"L1GtTriggerMenuXmlParser") <<
"Unable to convert " << tempStr <<
" to hex."
621 endPtr = (
char*) tempStrH.c_str();
626 LogDebug(
"L1GtTriggerMenuXmlParser") <<
"Unable to convert " << tempStr <<
" to hex."
653 LogDebug(
"L1GtTriggerMenuXmlParser") <<
"node == 0 in " << __PRETTY_FUNCTION__ << std::endl;
693 edm::LogError(
"L1GtTriggerMenuXmlParser") <<
"Too large hex-value!" << std::endl;
716 XERCES_CPP_NAMESPACE_USE
721 LogDebug(
"L1GtTriggerMenuXmlParser")
722 <<
"node == 0 in " << __PRETTY_FUNCTION__ << std::endl;
727 DOMNode* n1 =
findXMLChild(node->getFirstChild(), childName);
731 LogDebug(
"L1GtTriggerMenuXmlParser") <<
"Child of condition not found ( " << childName
741 LogDebug(
"L1GtTriggerMenuXmlParser") <<
"No value tag found for child " << childName
742 <<
" in " << __PRETTY_FUNCTION__ << std::endl;
750 if (maxString.empty() ) {
753 if (maxString.empty() ) {
755 LogDebug(
"L1GtTriggerMenuXmlParser") <<
"No Max value found for " << childName
780 while (maxBitsL != 0) {
782 if ( (maxBitsL & 1) == 0) {
785 <<
" Confused by not continous set bits for max value " << maxString
786 <<
"(child=" << childName <<
")" << std::endl;
795 if ( (maxBitsH != 0) && (counter != 64)) {
798 <<
" Confused by not continous set bits for max value " << maxString <<
"(child="
799 << childName <<
")" << std::endl;
804 while (maxBitsH != 0) {
806 if ( (maxBitsH & 1) == 0) {
809 <<
" Confused by not continous set bits for max value " << maxString
810 <<
"(child=" << childName <<
")" << std::endl;
836 const std::string& childName,
unsigned int num, std::vector<boost::uint64_t>& dst) {
838 XERCES_CPP_NAMESPACE_USE
842 LogDebug(
"L1GtTriggerMenuXmlParser")
843 <<
"node == 0 in " << __PRETTY_FUNCTION__
849 DOMNode* n1 =
findXMLChild(node->getFirstChild(), childName);
854 LogDebug(
"L1GtTriggerMenuXmlParser") <<
"Child of condition not found ( " << childName
870 for (
unsigned int i = 0;
i <
num;
i++) {
873 LogDebug(
"L1GtTriggerMenuXmlParser") <<
"Not enough values in condition child ( "
874 << childName <<
")" << std::endl;
881 edm::LogError(
"L1GtTriggerMenuXmlParser") <<
"Error converting condition child ( "
882 << childName <<
") value." << std::endl;
902 XERCES_CPP_NAMESPACE_USE
932 XERCES_CPP_NAMESPACE_USE
934 DOMDocument*
doc = parser->getDocument();
935 DOMNode* n1 = doc->getFirstChild();
939 edm::LogError(
"L1GtTriggerMenuXmlParser") <<
"Error: Found no XML child" << std::endl;
948 edm::LogError(
"L1GtTriggerMenuXmlParser") <<
"Error: No vme tag found." << std::endl;
952 n1 = n1->getFirstChild();
954 unsigned int chipCounter = 0;
969 n1 = n1->getNextSibling();
985 for (std::vector<ConditionMap>::iterator itCondOnChip =
m_conditionMap.begin(); itCondOnChip
990 itCondOnChip->clear();
1009 LogTrace(
"L1GtTriggerMenuXmlParser") <<
" Condition " << cName
1010 <<
" already exists - not inserted!" << std::endl;
1034 LogTrace(
"L1GtTriggerMenuXmlParser") <<
" Algorithm \"" << algName
1035 <<
"\"already exists in the algorithm map- not inserted!" << std::endl;
1040 LogTrace(
"L1GtTriggerMenuXmlParser") <<
" Algorithm alias \"" << algAlias
1041 <<
"\"already exists in the algorithm alias map- not inserted!" << std::endl;
1048 LogTrace(
"L1GtTriggerMenuXmlParser") <<
" Bit number " << bitNumber
1050 <<
") - algorithm not inserted!" << std::endl;
1056 LogTrace(
"L1GtTriggerMenuXmlParser") <<
" More than maximum allowed "
1067 LogTrace(
"L1GtTriggerMenuXmlParser") <<
" Chip number " << chipNr
1069 <<
") - algorithm not inserted!" << std::endl;
1078 LogTrace(
"L1GtTriggerMenuXmlParser") <<
" Output pin " << outputPin
1080 <<
"] - algorithm not inserted!" << std::endl;
1093 if ( (outputPin == iPin) && (chipNr == iChip)) {
1094 LogTrace(
"L1GtTriggerMenuXmlParser") <<
" Output pin " << outputPin
1095 <<
" is the same as for algorithm " << iName
1096 <<
"\n from the same chip number " << chipNr <<
" - algorithm not inserted!"
1125 LogTrace(
"L1GtTriggerMenuXmlParser") <<
" Technical trigger \""
1127 <<
"\"already exists in the technical trigger map- not inserted!"
1136 LogTrace(
"L1GtTriggerMenuXmlParser") <<
" Bit number "
1137 << bitNumber <<
" outside allowed range [0, "
1139 <<
") - technical trigger not inserted!" << std::endl;
1147 int iBitNumber = (itAlgo->second).algoBitNumber();
1150 if ((iBitNumber == bitNumber)) {
1151 LogTrace(
"L1GtTriggerMenuXmlParser") <<
" Bit number "
1152 << iBitNumber <<
" is the same as for technical trigger "
1153 << iName <<
" - technical trigger not inserted!"
1162 LogTrace(
"L1GtTriggerMenuXmlParser")
1164 <<
" technical triggers in the technical trigger map - not inserted!"
1263 edm::LogError(
"L1GtTriggerMenuXmlParser") <<
"Invalid mode for single bit" << std::endl;
1269 if (tmpStr ==
"0") {
1272 else if (tmpStr ==
"1") {
1276 edm::LogError(
"L1GtTriggerMenuXmlParser") <<
"Bad bit value (" << tmpStr <<
")"
1294 XERCES_CPP_NAMESPACE_USE
1298 LogDebug(
"L1GtTriggerMenuXmlParser")
1299 <<
"node == 0 in " << __PRETTY_FUNCTION__
1306 DOMNode* n1 = node->getFirstChild();
1313 LogDebug(
"L1GtTriggerMenuXmlParser") <<
"No \"greater or equal\" tag found"
1342 unsigned int num, std::vector<bool>& mipDst, std::vector<bool>& isoEnDst,
1343 std::vector<bool>& isoReqDst) {
1345 XERCES_CPP_NAMESPACE_USE
1361 for (
unsigned int i = 0;
i <
num;
i++) {
1379 mipDst[
i] = (tmpint != 0);
1397 isoEnDst[
i] = (tmpint != 0);
1414 isoReqDst[
i] = (tmpint != 0);
1441 XERCES_CPP_NAMESPACE_USE
1449 edm::LogError(
"L1GtTriggerMenuXmlParser") <<
"Wrong particle for muon-condition ("
1450 << particle <<
")" << std::endl;
1456 edm::LogError(
"L1GtTriggerMenuXmlParser") <<
"Unknown type for muon-condition (" << type
1457 <<
")" <<
"\nCan not determine number of trigger objects. " << std::endl;
1465 edm::LogError(
"L1GtTriggerMenuXmlParser") <<
"Error getting \"greater or equal\" flag"
1470 bool gEq = (intGEq != 0);
1475 std::vector<L1GtMuonTemplate::ObjectParameter> objParameter(nrObj);
1479 std::vector<boost::uint64_t> tmpValues((nrObj > 2) ? nrObj : 2);
1486 for (
int i = 0;
i < nrObj;
i++) {
1487 objParameter[
i].ptHighThreshold = tmpValues[
i];
1500 for (
int i = 0;
i < nrObj;
i++) {
1508 tmpValues[
i] = (tmpValues[
i])/16;
1510 objParameter[
i].ptLowThreshold = tmpValues[
i];
1523 for (
int i = 0;
i < nrObj;
i++) {
1524 objParameter[
i].qualityRange = tmpValues[
i];
1537 for (
int i = 0;
i < nrObj;
i++) {
1539 objParameter[
i].etaRange = tmpValues[
i];
1552 for (
int i = 0;
i < nrObj;
i++) {
1553 objParameter[
i].phiHigh = tmpValues[
i];
1566 for (
int i = 0;
i < nrObj;
i++) {
1567 objParameter[
i].phiLow = tmpValues[
i];
1579 LogDebug(
"L1GtTriggerMenuXmlParser")
1580 <<
" Error getting charge correlation from muon condition (" << name <<
")"
1594 std::vector<bool> tmpMip(nrObj);
1595 std::vector<bool> tmpEnableIso(nrObj);
1596 std::vector<bool> tmpRequestIso(nrObj);
1600 <<
" Could not get mip and iso bits from muon condition (" << name <<
")"
1605 for (
int i = 0;
i < nrObj;
i++) {
1606 objParameter[
i].enableMip = tmpMip[
i];
1607 objParameter[
i].enableIso = tmpEnableIso[
i];
1608 objParameter[
i].requestIso = tmpRequestIso[
i];
1624 tmpValues[0], tmpValues[1])) {
1626 <<
" Could not get deltaPhi for muon condition with wsc (" << name <<
")"
1639 unsigned int maxbits;
1660 <<
"Type for muon condition id TypeNull - it means not defined in the XML file."
1661 <<
"\nNumber of trigger objects is set to zero. " << std::endl;
1666 std::vector<L1GtObject> objType(nrObj,
Mu);
1680 std::ostringstream myCoutStream;
1681 muonCond.
print(myCoutStream);
1682 LogTrace(
"L1GtTriggerMenuXmlParser") << myCoutStream.str() <<
"\n" << std::endl;
1689 <<
" Error: duplicate condition (" << name <<
")"
1722 XERCES_CPP_NAMESPACE_USE
1736 caloObjType =
IsoEG;
1748 edm::LogError(
"L1GtTriggerMenuXmlParser") <<
"Wrong particle for calo-condition ("
1749 << particle <<
")" << std::endl;
1755 edm::LogError(
"L1GtTriggerMenuXmlParser") <<
"Unknown type for calo-condition (" << type
1756 <<
")" <<
"\nCan not determine number of trigger objects. " << std::endl;
1764 edm::LogError(
"L1GtTriggerMenuXmlParser") <<
"Error getting \"greater or equal\" flag"
1769 bool gEq = (intGEq != 0);
1774 std::vector<L1GtCaloTemplate::ObjectParameter> objParameter(nrObj);
1778 std::vector<boost::uint64_t> tmpValues((nrObj > 1) ? nrObj : 1);
1785 for (
int i = 0;
i < nrObj;
i++) {
1786 objParameter[
i].etThreshold = tmpValues[
i];
1800 for (
int i = 0;
i < nrObj;
i++) {
1802 objParameter[
i].etaRange = tmpValues[
i];
1815 for (
int i = 0;
i < nrObj;
i++) {
1816 objParameter[
i].phiRange = tmpValues[
i];
1847 unsigned int maxbits;
1868 <<
"Type for calo condition id TypeNull - it means not defined in the XML file."
1869 <<
"\nNumber of trigger objects is set to zero. " << std::endl;
1874 std::vector<L1GtObject> objType(nrObj, caloObjType);
1889 std::ostringstream myCoutStream;
1890 caloCond.
print(myCoutStream);
1891 LogTrace(
"L1GtTriggerMenuXmlParser") << myCoutStream.str() <<
"\n" << std::endl;
1899 <<
" Error: duplicate condition (" << name <<
")"
1933 unsigned int chipNr,
const bool corrFlag) {
1935 XERCES_CPP_NAMESPACE_USE
1948 energySumObjType =
ETM;
1954 energySumObjType =
ETT;
1960 energySumObjType =
HTT;
1966 energySumObjType =
HTM;
1972 <<
"Wrong particle or type for energy-sum condition (" << particle <<
", " << type
1973 <<
")" << std::endl;
1984 edm::LogError(
"L1GtTriggerMenuXmlParser") <<
"Error getting \"greater or equal\" flag"
1989 bool gEq = (intGEq != 0);
1994 std::vector<L1GtEnergySumTemplate::ObjectParameter> objParameter(nrObj);
1997 std::vector<boost::uint64_t> tmpValues((nrObj > 2) ? nrObj : 2);
2004 for (
int i = 0;
i < nrObj;
i++) {
2005 objParameter[
i].etThreshold = tmpValues[
i];
2015 if (energySumObjType ==
ETM) {
2020 <<
" Could not get phi for ETM condition (" << name <<
")" << std::endl;
2024 objParameter[
i].phiRange0Word = tmpValues[0];
2025 objParameter[
i].phiRange1Word = tmpValues[1];
2027 }
else if (energySumObjType ==
HTM) {
2031 <<
" Could not get phi for HTM condition (" << name <<
")" << std::endl;
2035 objParameter[
i].phiRange0Word = tmpValues[0];
2043 <<
" Could not get energyOverflow for EnergySum condition (" << name <<
")"
2049 <<
" Could not get energyOverflow for EnergySum condition (" << name <<
")"
2056 objParameter[
i].energyOverflow =
false;
2063 else if (tmpInt == 1) {
2064 objParameter[
i].energyOverflow =
true;
2072 LogTrace(
"L1GtTriggerMenuXmlParser")
2073 <<
" EnergySum energyOverflow logical flag (hex) = " << std::hex << tmpInt
2074 <<
std::dec <<
" - wrong value! " << std::endl;
2081 std::vector<L1GtObject> objType(nrObj, energySumObjType);
2096 std::ostringstream myCoutStream;
2097 energySumCond.
print(myCoutStream);
2098 LogTrace(
"L1GtTriggerMenuXmlParser") << myCoutStream.str() <<
"\n" << std::endl;
2106 <<
" Error: duplicate condition (" << name <<
")"
2143 XERCES_CPP_NAMESPACE_USE
2151 edm::LogError(
"L1GtTriggerMenuXmlParser") <<
"Wrong particle for JetCounts condition ("
2152 << particle <<
")" << std::endl;
2167 edm::LogError(
"L1GtTriggerMenuXmlParser") <<
"Error getting \"greater or equal\" flag"
2172 bool gEq = (intGEq != 0);
2177 std::vector<L1GtJetCountsTemplate::ObjectParameter> objParameter(nrObj);
2181 char* endPtr =
nullptr;
2182 long int typeInt = strtol(type.c_str(), &endPtr, 10);
2186 LogDebug(
"L1GtTriggerMenuXmlParser") <<
"Unable to convert " << type <<
" to dec."
2194 LogDebug(
"L1GtTriggerMenuXmlParser") <<
"Count index " << typeInt
2200 objParameter[0].countIndex =
static_cast<unsigned int>(typeInt);
2203 std::vector<boost::uint64_t> tmpValues(nrObj);
2209 for (
int i = 0;
i < nrObj;
i++) {
2210 objParameter[
i].countThreshold = tmpValues[
i];
2262 std::vector<L1GtObject> objType(nrObj, jetCountsObjType);
2277 std::ostringstream myCoutStream;
2278 jetCountsCond.
print(myCoutStream);
2279 LogTrace(
"L1GtTriggerMenuXmlParser") << myCoutStream.str() <<
"\n" << std::endl;
2286 edm::LogError(
"L1GtTriggerMenuXmlParser") <<
" Error: duplicate condition (" << name
2287 <<
")" << std::endl;
2316 XERCES_CPP_NAMESPACE_USE
2325 <<
"\nError: wrong particle for Castor condition ("
2326 << particle <<
")" << std::endl;
2350 std::ostringstream myCoutStream;
2351 castorCond.
print(myCoutStream);
2352 LogTrace(
"L1GtTriggerMenuXmlParser") << myCoutStream.str() <<
"\n" << std::endl;
2360 <<
" Error: duplicate condition (" << name
2361 <<
")" << std::endl;
2391 XERCES_CPP_NAMESPACE_USE
2399 edm::LogError(
"L1GtTriggerMenuXmlParser") <<
"Wrong particle for HfBitCounts condition ("
2400 << particle <<
")" << std::endl;
2415 edm::LogError(
"L1GtTriggerMenuXmlParser") <<
"Error getting \"greater or equal\" flag"
2420 bool gEq = (intGEq != 0);
2425 std::vector<L1GtHfBitCountsTemplate::ObjectParameter> objParameter(nrObj);
2429 char* endPtr =
nullptr;
2430 long int typeInt = strtol(type.c_str(), &endPtr, 10);
2434 LogDebug(
"L1GtTriggerMenuXmlParser") <<
"Unable to convert " << type <<
" to dec."
2448 objParameter[0].countIndex =
static_cast<unsigned int>(typeInt);
2451 std::vector<boost::uint64_t> tmpValues(nrObj);
2457 for (
int i = 0;
i < nrObj;
i++) {
2458 objParameter[
i].countThreshold = tmpValues[
i];
2468 std::vector<L1GtObject> objType(nrObj, hfBitCountsObjType);
2483 std::ostringstream myCoutStream;
2484 hfBitCountsCond.
print(myCoutStream);
2485 LogTrace(
"L1GtTriggerMenuXmlParser") << myCoutStream.str() <<
"\n" << std::endl;
2492 edm::LogError(
"L1GtTriggerMenuXmlParser") <<
" Error: duplicate condition (" << name
2493 <<
")" << std::endl;
2523 XERCES_CPP_NAMESPACE_USE
2531 edm::LogError(
"L1GtTriggerMenuXmlParser") <<
"Wrong particle for HfRingEtSums condition ("
2532 << particle <<
")" << std::endl;
2547 edm::LogError(
"L1GtTriggerMenuXmlParser") <<
"Error getting \"greater or equal\" flag"
2552 bool gEq = (intGEq != 0);
2557 std::vector<L1GtHfRingEtSumsTemplate::ObjectParameter> objParameter(nrObj);
2561 char* endPtr =
nullptr;
2562 long int typeInt = strtol(type.c_str(), &endPtr, 10);
2566 LogDebug(
"L1GtTriggerMenuXmlParser") <<
"Unable to convert " << type <<
" to dec."
2580 objParameter[0].etSumIndex =
static_cast<unsigned int>(typeInt);
2583 std::vector<boost::uint64_t> tmpValues(nrObj);
2589 for (
int i = 0;
i < nrObj;
i++) {
2590 objParameter[
i].etSumThreshold = tmpValues[
i];
2600 std::vector<L1GtObject> objType(nrObj, hfRingEtSumsObjType);
2615 std::ostringstream myCoutStream;
2616 hfRingEtSumsCond.
print(myCoutStream);
2617 LogTrace(
"L1GtTriggerMenuXmlParser") << myCoutStream.str() <<
"\n" << std::endl;
2624 edm::LogError(
"L1GtTriggerMenuXmlParser") <<
" Error: duplicate condition (" << name
2625 <<
")" << std::endl;
2654 XERCES_CPP_NAMESPACE_USE
2663 <<
"\nError: wrong particle for Bptx condition ("
2664 << particle <<
")" << std::endl;
2685 LogTrace(
"L1GtTriggerMenuXmlParser") << bptxCond <<
"\n" << std::endl;
2691 <<
" Error: duplicate condition (" << name
2692 <<
")" << std::endl;
2722 XERCES_CPP_NAMESPACE_USE
2731 <<
"\nError: wrong particle for External condition ("
2732 << particle <<
")" << std::endl;
2753 LogTrace(
"L1GtTriggerMenuXmlParser") << externalCond <<
"\n" << std::endl;
2759 <<
" Error: duplicate condition (" << name
2760 <<
")" << std::endl;
2789 unsigned int chipNr) {
2791 XERCES_CPP_NAMESPACE_USE
2800 <<
" Error: duplicate correlation condition (" << name <<
")"
2811 LogTrace(
"L1GtTriggerMenuXmlParser") <<
" Condition category: "
2812 << condition <<
", particle: " << particle <<
", type: " << type
2813 <<
"\n" << std::endl;
2819 const int nrObj = 2;
2822 int intGEq[nrObj] = { -1, -1 };
2823 std::vector<L1GtObject> objType(nrObj);
2824 std::vector<L1GtConditionCategory> condCateg(nrObj);
2827 const bool corrFlag =
true;
2828 int corrIndexVal[nrObj] = { -1, -1 };
2832 DOMNode* conditionsNode = node->getFirstChild();
2834 conditionsNode =
findXMLChild(conditionsNode,
"",
true,
2835 &conditionNameNodeName);
2838 for (
int iSubCond = 0; iSubCond < nrObj; ++iSubCond) {
2845 LogTrace(
"L1GtTriggerMenuXmlParser") <<
" Sub-condition category: "
2846 << condition <<
", particle: " << particle <<
", type: "
2847 << type <<
", name: " << conditionNameNodeName <<
"\n"
2852 if (!
parseMuon(conditionsNode, conditionNameNodeName, chipNr,
2855 <<
"Error parsing sub-condition " << condition <<
")"
2856 <<
" with name " << conditionNameNodeName << std::endl;
2861 intGEq[iSubCond] =
getGEqFlag(conditionsNode,
2863 if (intGEq[iSubCond] < 0) {
2865 <<
"Error getting \"greater or equal\" flag"
2866 <<
" for sub-condition " << conditionNameNodeName
2867 <<
" for the correlation condition " << name
2873 objType[iSubCond] =
Mu;
2879 if (!
parseCalo(conditionsNode, conditionNameNodeName, chipNr,
2882 <<
"Error parsing sub-condition " << condition <<
")"
2883 <<
" with name " << conditionNameNodeName << std::endl;
2889 if (intGEq[iSubCond] < 0) {
2891 <<
"Error getting \"greater or equal\" flag"
2892 <<
" for sub-condition " << conditionNameNodeName
2893 <<
" for the correlation condition " << name
2903 objType[iSubCond] =
IsoEG;
2906 objType[iSubCond] =
CenJet;
2909 objType[iSubCond] =
TauJet;
2912 objType[iSubCond] =
ForJet;
2916 <<
"Wrong object type " << particle
2917 <<
" for sub-condition " << conditionNameNodeName
2918 <<
" from the correlation condition " << name
2928 if (!
parseEnergySum(conditionsNode, conditionNameNodeName, chipNr,
2931 <<
"Error parsing sub-condition " << condition <<
")"
2932 <<
" with name " << conditionNameNodeName << std::endl;
2938 if (intGEq[iSubCond] < 0) {
2940 <<
"Error getting \"greater or equal\" flag"
2941 <<
" for sub-condition " << conditionNameNodeName
2942 <<
" for the correlation condition " << name
2949 objType[iSubCond] =
ETM;
2952 objType[iSubCond] =
ETT;
2955 objType[iSubCond] =
HTT;
2958 objType[iSubCond] =
HTM;
2962 <<
"Wrong object type " << particle
2963 <<
" for sub-condition " << conditionNameNodeName
2964 <<
" from the correlation condition " << name
2975 <<
"Unknown or un-adequate sub-condition (" << condition
2976 <<
")" <<
" with name " << conditionNameNodeName
2977 <<
" for the correlation condition " << name << std::endl;
2982 conditionsNode =
findXMLChild(conditionsNode->getNextSibling(),
"",
2983 true, &conditionNameNodeName);
2989 if (intGEq[0] != intGEq[1]) {
2991 <<
"Inconsistent GEq flags for sub-conditions (" << condition
2992 <<
")" <<
" with name " << conditionNameNodeName
2993 <<
" for the correlation condition " << name << std::endl;
2998 gEq = (intGEq[0] != 0);
3006 std::vector<boost::uint64_t> tmpValues(nrObj);
3015 XERCES_CPP_NAMESPACE::DOMNode* node1 =
findXMLChild(node->getFirstChild(),
3022 <<
" Could not get deltaEta for correlation condition "
3023 << name <<
". " << std::endl;
3048 <<
" Could not get deltaPhi for correlation condition "
3049 << name <<
". " << std::endl;
3062 unsigned int maxbits;
3075 correlationCond.setCondType(cType);
3076 correlationCond.setObjectType(objType);
3077 correlationCond.setCondGEq(gEq);
3078 correlationCond.setCondChipNr(chipNr);
3080 correlationCond.setCond0Category(condCateg[0]);
3081 correlationCond.setCond1Category(condCateg[1]);
3083 correlationCond.setCond0Index(corrIndexVal[0]);
3084 correlationCond.setCond1Index(corrIndexVal[1]);
3086 correlationCond.setCorrelationParameter(corrParameter);
3090 std::ostringstream myCoutStream;
3091 correlationCond.print(myCoutStream);
3092 LogTrace(
"L1GtTriggerMenuXmlParser") << myCoutStream.str() <<
"\n"
3116 XERCES_CPP_NAMESPACE_USE
3118 DOMNode*
doc = parser->getDocument();
3119 DOMNode* n1 = doc->getFirstChild();
3123 DOMNode* headerNode = n1->getFirstChild();
3124 if (headerNode == 0) {
3126 <<
"> tag found." << std::endl;
3131 if (headerNode == 0) {
3134 <<
"> tag" <<
"\n - No header information." << std::endl;
3138 DOMNode* idNode = headerNode->getFirstChild();
3144 LogTrace(
"L1GtTriggerMenuXmlParser") <<
"\n Warning: Could not find <"
3146 <<
"\n - Trigger menu interface name derived from file name." << std::endl;
3151 if (xmlPos == std::string::npos) {
3152 LogTrace(
"L1GtTriggerMenuXmlParser")
3153 <<
"\n Warning: Could not find \"_L1T_Scales\" " <<
"string in file name"
3154 <<
"\n - Trigger menu interface name set to file name." << std::endl;
3168 idNode = headerNode->getFirstChild();
3173 LogTrace(
"L1GtTriggerMenuXmlParser") <<
"\n Warning: Could not find <"
3183 idNode = headerNode->getFirstChild();
3188 LogTrace(
"L1GtTriggerMenuXmlParser") <<
"\n Warning: Could not find <"
3198 idNode = headerNode->getFirstChild();
3203 LogTrace(
"L1GtTriggerMenuXmlParser") <<
"\n Warning: Could not find <"
3213 idNode = headerNode->getFirstChild();
3218 LogTrace(
"L1GtTriggerMenuXmlParser") <<
"\n Warning: Could not find <"
3228 idNode = headerNode->getFirstChild();
3233 LogTrace(
"L1GtTriggerMenuXmlParser") <<
"\n Warning: Could not find <"
3243 idNode = headerNode->getFirstChild();
3248 LogTrace(
"L1GtTriggerMenuXmlParser") <<
"\n Warning: Could not find <"
3259 idNode = headerNode->getFirstChild();
3265 LogTrace(
"L1GtTriggerMenuXmlParser") <<
"\n Warning: Could not find <"
3267 <<
"\n - Algorithm implementation tag set to empty string." << std::endl;
3276 idNode = headerNode->getFirstChild();
3282 LogTrace(
"L1GtTriggerMenuXmlParser") <<
"\n Warning: Could not find <"
3284 <<
" string." << std::endl;
3292 LogDebug(
"L1GtTriggerMenuXmlParser")
3293 <<
"\n Parsed values from XML file"
3315 LogDebug(
"L1GtTriggerMenuXmlParser") <<
"\n Warning: Inconsistent L1 menu name:"
3317 <<
"\n from XML tag: " << menuName << std::endl;
3326 LogTrace(
"L1GtTriggerMenuXmlParser") <<
"\n L1 menu name set to value from XML tag!"
3330 LogTrace(
"L1GtTriggerMenuXmlParser") <<
"\n L1 menu name set to file name!"
3354 XERCES_CPP_NAMESPACE_USE
3361 if (condition.empty() || particle.empty() || type.empty() ) {
3363 edm::LogError(
"L1GtTriggerMenuXmlParser") <<
"Missing attributes for condition " << name
3407 <<
"\n Error: unknown condition (" << condition <<
")"
3429 XERCES_CPP_NAMESPACE_USE
3431 LogTrace(
"L1GtTriggerMenuXmlParser") <<
"\nParsing conditions" << std::endl;
3433 DOMNode*
doc = parser->getDocument();
3434 DOMNode* n1 = doc->getFirstChild();
3438 DOMNode* chipNode = n1->getFirstChild();
3439 if (chipNode == 0) {
3442 <<
"> tag found." << std::endl;
3451 if (chipNode == 0) {
3454 <<
"> tag" << std::endl;
3459 unsigned int chipNr = 0;
3463 DOMNode* conditionsNode = chipNode->getFirstChild();
3465 if (conditionsNode == 0) {
3468 <<
"> child found in Chip " << chipName << std::endl;
3473 char* nodeName = XMLString::transcode(chipNode->getNodeName());
3481 DOMNode* conditionNameNode = conditionsNode->getFirstChild();
3483 conditionNameNode =
findXMLChild(conditionNameNode,
"",
true, &conditionNameNodeName);
3484 while (conditionNameNode != 0) {
3486 LogTrace(
"L1GtTriggerMenuXmlParser")
3487 <<
"\n Found a condition with name: " << conditionNameNodeName
3490 if ( !
workCondition(conditionNameNode, conditionNameNodeName, chipNr) ) {
3493 conditionNameNode =
findXMLChild(conditionNameNode->getNextSibling(),
"",
true,
3494 &conditionNameNodeName);
3518 const std::string& algName,
unsigned int chipNr) {
3520 XERCES_CPP_NAMESPACE_USE
3523 LogDebug(
"L1GtTriggerMenuXmlParser")
3524 <<
" Node is 0 in " << __PRETTY_FUNCTION__
3525 <<
" can not parse the algorithm " << algName
3533 if (algAlias ==
"") {
3535 LogDebug(
"L1GtTriggerMenuXmlParser")
3536 <<
"\n No alias defined for algorithm. Alias set to algorithm name."
3537 <<
"\n Algorithm name: " << algName <<
"\n Algorithm alias: " << algAlias
3540 LogDebug(
"L1GtTriggerMenuXmlParser") <<
"\n Alias defined for algorithm."
3541 <<
"\n Algorithm name: " << algName <<
"\n Algorithm alias: " << algAlias
3561 pinNode = node->getFirstChild();
3566 std::istringstream opStream(pinString);
3568 if ((opStream >> outputPin).
fail()) {
3569 LogDebug(
"L1GtTriggerMenuXmlParser")
3570 <<
" Unable to convert pin string " << pinString
3571 <<
" to int for algorithm : " << algName
3580 LogTrace(
"L1GtTriggerMenuXmlParser") <<
" Warning: No pin number found for algorithm: "
3581 << algName << std::endl;
3601 alg.setAlgoChipNumber(static_cast<int>(chipNr));
3602 alg.setAlgoAlias(algAlias);
3606 std::ostringstream myCoutStream;
3607 alg.print(myCoutStream);
3608 LogTrace(
"L1GtTriggerMenuXmlParser") << myCoutStream.str() <<
"\n" << std::endl;
3637 XERCES_CPP_NAMESPACE_USE
3641 DOMNode*
doc = parser->getDocument();
3642 DOMNode*
node = doc->getFirstChild();
3644 DOMNode* chipNode = node->getFirstChild();
3645 if (chipNode == 0) {
3654 if (chipNode == 0) {
3660 unsigned int chipNr = 0;
3671 DOMNode* algNode = chipNode->getFirstChild();
3675 <<
"> child found in chip " << chipName << std::endl;
3680 DOMNode* algNameNode = algNode->getFirstChild();
3682 algNameNode =
findXMLChild(algNameNode,
"",
true, &algNameNodeName);
3684 while (algNameNode != 0) {
3689 if ( !
workAlgorithm(algNameNode, algNameNodeName, chipNr)) {
3693 algNameNode =
findXMLChild(algNameNode->getNextSibling(),
"",
true, &algNameNodeName);
3719 XERCES_CPP_NAMESPACE_USE
3722 LogDebug(
"L1GtTriggerMenuXmlParser")
3723 <<
" Node is 0 in " << __PRETTY_FUNCTION__
3724 <<
" can not parse the technical trigger " << algName
3741 pinNode = node->getFirstChild();
3746 std::istringstream opStream(pinString);
3748 if ((opStream >> outputPin).
fail()) {
3749 LogDebug(
"L1GtTriggerMenuXmlParser")
3750 <<
" Unable to convert pin string " << pinString
3751 <<
" to int for technical trigger : " << algName
3760 LogTrace(
"L1GtTriggerMenuXmlParser")
3761 <<
" Warning: No pin number found for technical trigger: "
3762 << algName << std::endl;
3768 int bitNumber = outputPin;
3781 std::ostringstream myCoutStream;
3782 alg.
print(myCoutStream);
3783 LogTrace(
"L1GtTriggerMenuXmlParser") << myCoutStream.str() <<
"\n" << std::endl;
3808 XERCES_CPP_NAMESPACE_USE
3812 DOMNode*
doc = parser->getDocument();
3813 DOMNode*
node = doc->getFirstChild();
3815 DOMNode* algNode = node->getFirstChild();
3818 <<
" Error: No child found for " <<
m_xmlTagDef << std::endl;
3831 DOMNode* algNameNode = algNode->getFirstChild();
3833 algNameNode =
findXMLChild(algNameNode,
"",
true, &algNameNodeName);
3835 while (algNameNode != 0) {
3844 algNameNode =
findXMLChild(algNameNode->getNextSibling(),
"",
true,
3863 XERCES_CPP_NAMESPACE_USE
3865 DOMDocument*
doc = parser->getDocument();
3866 DOMNode* n1 = doc->getFirstChild();
3870 edm::LogError(
"L1GtTriggerMenuXmlParser") <<
"Error: Found no XML child" << std::endl;
3875 char* nodeName = XMLString::transcode(n1->getNodeName());
3877 if (XMLString::compareIString(nodeName,
m_xmlTagDef.c_str())) {
3879 edm::LogError(
"L1GtTriggerMenuXmlParser") <<
"Error: First XML child is not \" "
3885 LogTrace(
"L1GtTriggerMenuXmlParser")
3886 <<
"\nFirst node name is: " << nodeName
typedef for correlation parameters
void setAlgoAlias(const std::string &algoAliasValue)
virtual void print(std::ostream &myCout) const
print the condition
virtual void print(std::ostream &myCout) const
print condition
unsigned long long deltaPhiRange
unsigned int deltaPhiMaxbits
void setConditionParameter(const std::vector< ObjectParameter > &)
set functions
const std::string algoName() const
get / set algorithm name
const std::string & condName() const
get / set condition name
unsigned long long deltaEtaRange
void setCondGEq(const bool &cGEq)
unsigned int deltaPhiMaxbits
unsigned int deltaPhiMaxbits
std::string const & algoAlias() const
get / set algorithm alias
virtual void print(std::ostream &myCout) const
print the condition
std::string deltaEtaRange
void setConditionParameter(const std::vector< ObjectParameter > &objParameter, const CorrelationParameter &corrParameter)
set functions
void setObjectType(const std::vector< L1GtObject > &objType)
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
unsigned long long deltaPhiRange0Word
typedef for correlation parameters
int algoBitNumber() const
get / set algorithm bit number
unsigned int chargeCorrelation
virtual void print(std::ostream &myCout) const
print the condition
virtual void print(std::ostream &myCout) const
print the condition
virtual void print(std::ostream &myCout) const
print the condition
void setConditionParameter(const std::vector< ObjectParameter > &)
set functions
std::string deltaPhiRange
virtual void print(std::ostream &myCout) const
print the condition
unsigned long long uint64_t
unsigned long long deltaEtaRange
void setCondChipNr(const int &cChipNr)
bool xmlFile(const std::string fParam)
void setConditionParameter(const std::vector< ObjectParameter > &)
set functions
const int algoChipNumber() const
get / set algorithm bit number
void setCondType(const L1GtConditionType &cType)
static std::atomic< unsigned int > counter
virtual void print(std::ostream &myCout) const
print the condition
unsigned long long deltaPhiRange1Word
void setConditionParameter(const std::vector< ObjectParameter > &objParameter, const CorrelationParameter &corrParameter)
set functions
tuple size
Write out results.
void setConditionParameter(const std::vector< ObjectParameter > &)
set functions