28 #include <boost/cstdint.hpp>
43 m_triggerMenuName(
"NULL"), m_triggerMenuImplementation(
"NULL"), m_scaleDbKey(
"NULL")
62 const unsigned int& numberConditionChipsValue) {
78 const std::vector<int>& orderConditionChipValue) {
86 const unsigned int& numberPhysTriggersValue) {
94 const unsigned int& numberTechTriggersValue) {
133 const std::vector<std::vector<L1GtMuonTemplate> >& vecMuonTempl) {
139 const std::vector<std::vector<L1GtCaloTemplate> >& vecCaloTempl) {
145 const std::vector<std::vector<L1GtEnergySumTemplate> >& vecEnergySumTempl) {
151 const std::vector<std::vector<L1GtJetCountsTemplate> >& vecJetCountsTempl) {
157 const std::vector<std::vector<L1GtCastorTemplate> >& vecCastorTempl) {
163 const std::vector<std::vector<L1GtHfBitCountsTemplate> >& vecHfBitCountsTempl) {
169 const std::vector<std::vector<L1GtHfRingEtSumsTemplate> >& vecHfRingEtSumsTempl) {
175 const std::vector<std::vector<L1GtBptxTemplate> >& vecBptxTempl) {
181 const std::vector<std::vector<L1GtExternalTemplate> >& vecExternalTempl) {
187 const std::vector<std::vector<L1GtCorrelationTemplate> >& vecCorrelationTempl) {
195 const std::vector<std::vector<L1GtMuonTemplate> >& corMuonTempl) {
201 const std::vector<std::vector<L1GtCaloTemplate> >& corCaloTempl) {
207 const std::vector<std::vector<L1GtEnergySumTemplate> >& corEnergySumTempl) {
235 const std::string& vmeXmlFile) {
237 XERCES_CPP_NAMESPACE_USE
275 LogTrace(
"L1GtTriggerMenuXmlParser") <<
"\nOpening XML-File: \n " << defXmlFile << std::endl;
277 if ((parser =
initXML(defXmlFile)) != 0) {
344 XERCES_CPP_NAMESPACE_USE
348 XMLPlatformUtils::Initialize();
350 catch (
const XMLException& toCatch) {
351 char*
message = XMLString::transcode(toCatch.getMessage());
354 <<
"Error during Xerces-c initialization! :"
355 << message << std::endl;
361 XercesDOMParser*
parser =
new XercesDOMParser();
362 parser->setValidationScheme(XercesDOMParser::Val_Always);
363 parser->setDoNamespaces(
false);
375 parser->parse(xmlFile.c_str());
377 catch(
const XMLException &toCatch) {
378 char*
message = XMLString::transcode(toCatch.getMessage());
381 <<
"Exception while parsing XML: \n"
382 << message << std::endl;
390 catch (
const DOMException &toCatch) {
391 char *
message = XMLString::transcode(toCatch.msg);
394 <<
"DOM-Exception while parsing XML: \n"
395 << message << std::endl;
406 <<
"Unexpected Exception while parsing XML!"
420 XERCES_CPP_NAMESPACE::DOMNode* startChild,
const std::string&
tagName,
bool beginOnly,
423 XERCES_CPP_NAMESPACE_USE
427 DOMNode *n1 = startChild;
432 if ( !tagName.empty() ) {
433 nodeName = XMLString::transcode(n1->getNodeName());
437 while (XMLString::compareIString(nodeName, tagName.c_str())) {
440 n1 = n1->getNextSibling();
445 nodeName = XMLString::transcode(n1->getNodeName());
450 while (XMLString::compareNIString(nodeName, tagName.c_str(), tagName.length())) {
452 n1 = n1->getNextSibling();
457 nodeName = XMLString::transcode(n1->getNodeName());
459 if (n1 != 0 && rest != 0) {
460 *rest = std::string(nodeName).substr(tagName.length(), strlen(nodeName) - tagName.length());
465 while (n1->getNodeType() != DOMNode::ELEMENT_NODE) {
466 n1 = n1->getNextSibling();
472 if (n1 != 0 && rest != 0) {
473 nodeName = XMLString::transcode(n1->getNodeName());
474 *rest = std::string(nodeName);
494 const std::string&
name) {
496 XERCES_CPP_NAMESPACE_USE
501 DOMNamedNodeMap*
attributes = node->getAttributes();
502 if (attributes == 0) {
507 XMLCh* attrName = XMLString::transcode(name.c_str());
508 DOMNode* attribNode = attributes->getNamedItem(attrName);
511 if (attribNode == 0) {
515 char* retCstr = XMLString::transcode(attribNode->getNodeValue());
532 XERCES_CPP_NAMESPACE_USE
541 const XMLCh* retXmlCh = n1->getTextContent();
546 char* retCstr = XMLString::transcode(retXmlCh);
547 XMLString::trim(retCstr);
569 static const std::string valid_hex_start(
"0123456789ABCDEFabcdef");
572 static const std::string valid_hex_end(
"0123456789ABCDEFabcdef");
574 std::string tempStr = hexString;
577 unsigned int hexStart = tempStr.find_first_of(valid_hex_start);
578 unsigned int hexEnd = tempStr.find_first_not_of(valid_hex_end, hexStart);
580 if (hexStart == hexEnd) {
582 LogDebug(
"L1GtTriggerMenuXmlParser") <<
"No hex value found in: " << tempStr << std::endl;
587 tempStr = tempStr.substr(hexStart, hexEnd - hexStart);
589 if (tempStr.empty() ) {
591 LogDebug(
"L1GtTriggerMenuXmlParser") <<
"Empty value in " << __PRETTY_FUNCTION__
598 std::string tempStrH, tempStrL;
600 if (tempStr.length() > 16) {
601 tempStrL = tempStr.substr(tempStr.length()-16, 16);
602 tempStrH = tempStr.substr(0, tempStr.length()-16);
610 char* endPtr = (
char*) tempStrL.c_str();
615 LogDebug(
"L1GtTriggerMenuXmlParser") <<
"Unable to convert " << tempStr <<
" to hex."
622 endPtr = (
char*) tempStrH.c_str();
627 LogDebug(
"L1GtTriggerMenuXmlParser") <<
"Unable to convert " << tempStr <<
" to hex."
654 LogDebug(
"L1GtTriggerMenuXmlParser") <<
"node == 0 in " << __PRETTY_FUNCTION__ << std::endl;
694 edm::LogError(
"L1GtTriggerMenuXmlParser") <<
"Too large hex-value!" << std::endl;
715 const std::string& childName,
unsigned int& dst) {
717 XERCES_CPP_NAMESPACE_USE
722 LogDebug(
"L1GtTriggerMenuXmlParser")
723 <<
"node == 0 in " << __PRETTY_FUNCTION__ << std::endl;
728 DOMNode* n1 =
findXMLChild(node->getFirstChild(), childName);
732 LogDebug(
"L1GtTriggerMenuXmlParser") <<
"Child of condition not found ( " << childName
742 LogDebug(
"L1GtTriggerMenuXmlParser") <<
"No value tag found for child " << childName
743 <<
" in " << __PRETTY_FUNCTION__ << std::endl;
751 if (maxString.empty() ) {
754 if (maxString.empty() ) {
756 LogDebug(
"L1GtTriggerMenuXmlParser") <<
"No Max value found for " << childName
779 unsigned int counter = 0;
781 while (maxBitsL != 0) {
783 if ( (maxBitsL & 1) == 0) {
786 <<
" Confused by not continous set bits for max value " << maxString
787 <<
"(child=" << childName <<
")" << std::endl;
796 if ( (maxBitsH != 0) && (counter != 64)) {
799 <<
" Confused by not continous set bits for max value " << maxString <<
"(child="
800 << childName <<
")" << std::endl;
805 while (maxBitsH != 0) {
807 if ( (maxBitsH & 1) == 0) {
810 <<
" Confused by not continous set bits for max value " << maxString
811 <<
"(child=" << childName <<
")" << std::endl;
837 const std::string& childName,
unsigned int num, std::vector<boost::uint64_t>& dst) {
839 XERCES_CPP_NAMESPACE_USE
843 LogDebug(
"L1GtTriggerMenuXmlParser")
844 <<
"node == 0 in " << __PRETTY_FUNCTION__
850 DOMNode* n1 =
findXMLChild(node->getFirstChild(), childName);
855 LogDebug(
"L1GtTriggerMenuXmlParser") <<
"Child of condition not found ( " << childName
871 for (
unsigned int i = 0;
i <
num;
i++) {
874 LogDebug(
"L1GtTriggerMenuXmlParser") <<
"Not enough values in condition child ( "
875 << childName <<
")" << std::endl;
882 edm::LogError(
"L1GtTriggerMenuXmlParser") <<
"Error converting condition child ( "
883 << childName <<
") value." << std::endl;
903 XERCES_CPP_NAMESPACE_USE
914 XMLPlatformUtils::Terminate();
933 XERCES_CPP_NAMESPACE_USE
935 DOMDocument*
doc = parser->getDocument();
936 DOMNode* n1 = doc->getFirstChild();
940 edm::LogError(
"L1GtTriggerMenuXmlParser") <<
"Error: Found no XML child" << std::endl;
949 edm::LogError(
"L1GtTriggerMenuXmlParser") <<
"Error: No vme tag found." << std::endl;
953 n1 = n1->getFirstChild();
955 unsigned int chipCounter = 0;
970 n1 = n1->getNextSibling();
986 for (std::vector<ConditionMap>::iterator itCondOnChip =
m_conditionMap.begin(); itCondOnChip
991 itCondOnChip->clear();
1004 std::string cName = cond.
condName();
1010 LogTrace(
"L1GtTriggerMenuXmlParser") <<
" Condition " << cName
1011 <<
" already exists - not inserted!" << std::endl;
1028 std::string algName = alg.
algoName();
1035 LogTrace(
"L1GtTriggerMenuXmlParser") <<
" Algorithm \"" << algName
1036 <<
"\"already exists in the algorithm map- not inserted!" << std::endl;
1041 LogTrace(
"L1GtTriggerMenuXmlParser") <<
" Algorithm alias \"" << algAlias
1042 <<
"\"already exists in the algorithm alias map- not inserted!" << std::endl;
1049 LogTrace(
"L1GtTriggerMenuXmlParser") <<
" Bit number " << bitNumber
1051 <<
") - algorithm not inserted!" << std::endl;
1057 LogTrace(
"L1GtTriggerMenuXmlParser") <<
" More than maximum allowed "
1068 LogTrace(
"L1GtTriggerMenuXmlParser") <<
" Chip number " << chipNr
1070 <<
") - algorithm not inserted!" << std::endl;
1079 LogTrace(
"L1GtTriggerMenuXmlParser") <<
" Output pin " << outputPin
1081 <<
"] - algorithm not inserted!" << std::endl;
1090 std::string iName = itAlgo->first;
1094 if ( (outputPin == iPin) && (chipNr == iChip)) {
1095 LogTrace(
"L1GtTriggerMenuXmlParser") <<
" Output pin " << outputPin
1096 <<
" is the same as for algorithm " << iName
1097 <<
"\n from the same chip number " << chipNr <<
" - algorithm not inserted!"
1119 std::string algName = alg.
algoName();
1126 LogTrace(
"L1GtTriggerMenuXmlParser") <<
" Technical trigger \""
1128 <<
"\"already exists in the technical trigger map- not inserted!"
1137 LogTrace(
"L1GtTriggerMenuXmlParser") <<
" Bit number "
1138 << bitNumber <<
" outside allowed range [0, "
1140 <<
") - technical trigger not inserted!" << std::endl;
1148 int iBitNumber = (itAlgo->second).algoBitNumber();
1149 std::string iName = itAlgo->first;
1151 if ((iBitNumber == bitNumber)) {
1152 LogTrace(
"L1GtTriggerMenuXmlParser") <<
" Bit number "
1153 << iBitNumber <<
" is the same as for technical trigger "
1154 << iName <<
" - technical trigger not inserted!"
1163 LogTrace(
"L1GtTriggerMenuXmlParser")
1165 <<
" technical triggers in the technical trigger map - not inserted!"
1264 edm::LogError(
"L1GtTriggerMenuXmlParser") <<
"Invalid mode for single bit" << std::endl;
1270 if (tmpStr ==
"0") {
1273 else if (tmpStr ==
"1") {
1277 edm::LogError(
"L1GtTriggerMenuXmlParser") <<
"Bad bit value (" << tmpStr <<
")"
1293 const std::string& nodeName) {
1295 XERCES_CPP_NAMESPACE_USE
1299 LogDebug(
"L1GtTriggerMenuXmlParser")
1300 <<
"node == 0 in " << __PRETTY_FUNCTION__
1307 DOMNode* n1 = node->getFirstChild();
1314 LogDebug(
"L1GtTriggerMenuXmlParser") <<
"No \"greater or equal\" tag found"
1343 unsigned int num, std::vector<bool>& mipDst, std::vector<bool>& isoEnDst,
1344 std::vector<bool>& isoReqDst) {
1346 XERCES_CPP_NAMESPACE_USE
1362 for (
unsigned int i = 0;
i <
num;
i++) {
1380 mipDst[
i] = (tmpint != 0);
1398 isoEnDst[
i] = (tmpint != 0);
1415 isoReqDst[
i] = (tmpint != 0);
1440 const std::string&
name,
unsigned int chipNr,
const bool corrFlag) {
1442 XERCES_CPP_NAMESPACE_USE
1450 edm::LogError(
"L1GtTriggerMenuXmlParser") <<
"Wrong particle for muon-condition ("
1451 << particle <<
")" << std::endl;
1457 edm::LogError(
"L1GtTriggerMenuXmlParser") <<
"Unknown type for muon-condition (" << type
1458 <<
")" <<
"\nCan not determine number of trigger objects. " << std::endl;
1466 edm::LogError(
"L1GtTriggerMenuXmlParser") <<
"Error getting \"greater or equal\" flag"
1471 bool gEq = (intGEq != 0);
1476 std::vector<L1GtMuonTemplate::ObjectParameter> objParameter(nrObj);
1480 std::vector<boost::uint64_t> tmpValues((nrObj > 2) ? nrObj : 2);
1487 for (
int i = 0;
i < nrObj;
i++) {
1488 objParameter[
i].ptHighThreshold = tmpValues[
i];
1501 for (
int i = 0;
i < nrObj;
i++) {
1509 tmpValues[
i] = (tmpValues[
i])/16;
1511 objParameter[
i].ptLowThreshold = tmpValues[
i];
1524 for (
int i = 0;
i < nrObj;
i++) {
1525 objParameter[
i].qualityRange = tmpValues[
i];
1538 for (
int i = 0;
i < nrObj;
i++) {
1540 objParameter[
i].etaRange = tmpValues[
i];
1553 for (
int i = 0;
i < nrObj;
i++) {
1554 objParameter[
i].phiHigh = tmpValues[
i];
1567 for (
int i = 0;
i < nrObj;
i++) {
1568 objParameter[
i].phiLow = tmpValues[
i];
1580 LogDebug(
"L1GtTriggerMenuXmlParser")
1581 <<
" Error getting charge correlation from muon condition (" << name <<
")"
1595 std::vector<bool> tmpMip(nrObj);
1596 std::vector<bool> tmpEnableIso(nrObj);
1597 std::vector<bool> tmpRequestIso(nrObj);
1601 <<
" Could not get mip and iso bits from muon condition (" << name <<
")"
1606 for (
int i = 0;
i < nrObj;
i++) {
1607 objParameter[
i].enableMip = tmpMip[
i];
1608 objParameter[
i].enableIso = tmpEnableIso[
i];
1609 objParameter[
i].requestIso = tmpRequestIso[
i];
1625 tmpValues[0], tmpValues[1])) {
1627 <<
" Could not get deltaPhi for muon condition with wsc (" << name <<
")"
1640 unsigned int maxbits;
1661 <<
"Type for muon condition id TypeNull - it means not defined in the XML file."
1662 <<
"\nNumber of trigger objects is set to zero. " << std::endl;
1667 std::vector<L1GtObject> objType(nrObj,
Mu);
1681 std::ostringstream myCoutStream;
1682 muonCond.
print(myCoutStream);
1683 LogTrace(
"L1GtTriggerMenuXmlParser") << myCoutStream.str() <<
"\n" << std::endl;
1690 <<
" Error: duplicate condition (" << name <<
")"
1721 const std::string&
name,
unsigned int chipNr,
const bool corrFlag) {
1723 XERCES_CPP_NAMESPACE_USE
1737 caloObjType =
IsoEG;
1749 edm::LogError(
"L1GtTriggerMenuXmlParser") <<
"Wrong particle for calo-condition ("
1750 << particle <<
")" << std::endl;
1756 edm::LogError(
"L1GtTriggerMenuXmlParser") <<
"Unknown type for calo-condition (" << type
1757 <<
")" <<
"\nCan not determine number of trigger objects. " << std::endl;
1765 edm::LogError(
"L1GtTriggerMenuXmlParser") <<
"Error getting \"greater or equal\" flag"
1770 bool gEq = (intGEq != 0);
1775 std::vector<L1GtCaloTemplate::ObjectParameter> objParameter(nrObj);
1779 std::vector<boost::uint64_t> tmpValues((nrObj > 1) ? nrObj : 1);
1786 for (
int i = 0;
i < nrObj;
i++) {
1787 objParameter[
i].etThreshold = tmpValues[
i];
1801 for (
int i = 0;
i < nrObj;
i++) {
1803 objParameter[
i].etaRange = tmpValues[
i];
1816 for (
int i = 0;
i < nrObj;
i++) {
1817 objParameter[
i].phiRange = tmpValues[
i];
1848 unsigned int maxbits;
1869 <<
"Type for calo condition id TypeNull - it means not defined in the XML file."
1870 <<
"\nNumber of trigger objects is set to zero. " << std::endl;
1875 std::vector<L1GtObject> objType(nrObj, caloObjType);
1890 std::ostringstream myCoutStream;
1891 caloCond.
print(myCoutStream);
1892 LogTrace(
"L1GtTriggerMenuXmlParser") << myCoutStream.str() <<
"\n" << std::endl;
1900 <<
" Error: duplicate condition (" << name <<
")"
1933 XERCES_CPP_NAMESPACE::DOMNode*
node,
const std::string&
name,
1934 unsigned int chipNr,
const bool corrFlag) {
1936 XERCES_CPP_NAMESPACE_USE
1949 energySumObjType =
ETM;
1955 energySumObjType =
ETT;
1961 energySumObjType =
HTT;
1967 energySumObjType =
HTM;
1973 <<
"Wrong particle or type for energy-sum condition (" << particle <<
", " << type
1974 <<
")" << std::endl;
1985 edm::LogError(
"L1GtTriggerMenuXmlParser") <<
"Error getting \"greater or equal\" flag"
1990 bool gEq = (intGEq != 0);
1995 std::vector<L1GtEnergySumTemplate::ObjectParameter> objParameter(nrObj);
1998 std::vector<boost::uint64_t> tmpValues((nrObj > 2) ? nrObj : 2);
2005 for (
int i = 0;
i < nrObj;
i++) {
2006 objParameter[
i].etThreshold = tmpValues[
i];
2016 if (energySumObjType ==
ETM) {
2021 <<
" Could not get phi for ETM condition (" << name <<
")" << std::endl;
2025 objParameter[
i].phiRange0Word = tmpValues[0];
2026 objParameter[
i].phiRange1Word = tmpValues[1];
2028 }
else if (energySumObjType ==
HTM) {
2032 <<
" Could not get phi for HTM condition (" << name <<
")" << std::endl;
2036 objParameter[
i].phiRange0Word = tmpValues[0];
2044 <<
" Could not get energyOverflow for EnergySum condition (" << name <<
")"
2050 <<
" Could not get energyOverflow for EnergySum condition (" << name <<
")"
2057 objParameter[
i].energyOverflow =
false;
2064 else if (tmpInt == 1) {
2065 objParameter[
i].energyOverflow =
true;
2073 LogTrace(
"L1GtTriggerMenuXmlParser")
2074 <<
" EnergySum energyOverflow logical flag (hex) = " << std::hex << tmpInt
2075 << std::dec <<
" - wrong value! " << std::endl;
2082 std::vector<L1GtObject> objType(nrObj, energySumObjType);
2097 std::ostringstream myCoutStream;
2098 energySumCond.
print(myCoutStream);
2099 LogTrace(
"L1GtTriggerMenuXmlParser") << myCoutStream.str() <<
"\n" << std::endl;
2107 <<
" Error: duplicate condition (" << name <<
")"
2142 const std::string&
name,
unsigned int chipNr) {
2144 XERCES_CPP_NAMESPACE_USE
2152 edm::LogError(
"L1GtTriggerMenuXmlParser") <<
"Wrong particle for JetCounts condition ("
2153 << particle <<
")" << std::endl;
2168 edm::LogError(
"L1GtTriggerMenuXmlParser") <<
"Error getting \"greater or equal\" flag"
2173 bool gEq = (intGEq != 0);
2178 std::vector<L1GtJetCountsTemplate::ObjectParameter> objParameter(nrObj);
2182 char* endPtr =
const_cast<char*
>(type.c_str());
2183 long int typeInt = strtol(type.c_str(), &endPtr, 10);
2187 LogDebug(
"L1GtTriggerMenuXmlParser") <<
"Unable to convert " << type <<
" to dec."
2195 LogDebug(
"L1GtTriggerMenuXmlParser") <<
"Count index " << typeInt
2201 objParameter[0].countIndex =
static_cast<unsigned int>(typeInt);
2204 std::vector<boost::uint64_t> tmpValues(nrObj);
2210 for (
int i = 0;
i < nrObj;
i++) {
2211 objParameter[
i].countThreshold = tmpValues[
i];
2263 std::vector<L1GtObject> objType(nrObj, jetCountsObjType);
2278 std::ostringstream myCoutStream;
2279 jetCountsCond.
print(myCoutStream);
2280 LogTrace(
"L1GtTriggerMenuXmlParser") << myCoutStream.str() <<
"\n" << std::endl;
2287 edm::LogError(
"L1GtTriggerMenuXmlParser") <<
" Error: duplicate condition (" << name
2288 <<
")" << std::endl;
2315 const std::string&
name,
unsigned int chipNr) {
2317 XERCES_CPP_NAMESPACE_USE
2326 <<
"\nError: wrong particle for Castor condition ("
2327 << particle <<
")" << std::endl;
2351 std::ostringstream myCoutStream;
2352 castorCond.
print(myCoutStream);
2353 LogTrace(
"L1GtTriggerMenuXmlParser") << myCoutStream.str() <<
"\n" << std::endl;
2361 <<
" Error: duplicate condition (" << name
2362 <<
")" << std::endl;
2390 const std::string&
name,
unsigned int chipNr) {
2392 XERCES_CPP_NAMESPACE_USE
2400 edm::LogError(
"L1GtTriggerMenuXmlParser") <<
"Wrong particle for HfBitCounts condition ("
2401 << particle <<
")" << std::endl;
2416 edm::LogError(
"L1GtTriggerMenuXmlParser") <<
"Error getting \"greater or equal\" flag"
2421 bool gEq = (intGEq != 0);
2426 std::vector<L1GtHfBitCountsTemplate::ObjectParameter> objParameter(nrObj);
2430 char* endPtr =
const_cast<char*
>(type.c_str());
2431 long int typeInt = strtol(type.c_str(), &endPtr, 10);
2435 LogDebug(
"L1GtTriggerMenuXmlParser") <<
"Unable to convert " << type <<
" to dec."
2449 objParameter[0].countIndex =
static_cast<unsigned int>(typeInt);
2452 std::vector<boost::uint64_t> tmpValues(nrObj);
2458 for (
int i = 0;
i < nrObj;
i++) {
2459 objParameter[
i].countThreshold = tmpValues[
i];
2469 std::vector<L1GtObject> objType(nrObj, hfBitCountsObjType);
2484 std::ostringstream myCoutStream;
2485 hfBitCountsCond.
print(myCoutStream);
2486 LogTrace(
"L1GtTriggerMenuXmlParser") << myCoutStream.str() <<
"\n" << std::endl;
2493 edm::LogError(
"L1GtTriggerMenuXmlParser") <<
" Error: duplicate condition (" << name
2494 <<
")" << std::endl;
2522 const std::string&
name,
unsigned int chipNr) {
2524 XERCES_CPP_NAMESPACE_USE
2532 edm::LogError(
"L1GtTriggerMenuXmlParser") <<
"Wrong particle for HfRingEtSums condition ("
2533 << particle <<
")" << std::endl;
2548 edm::LogError(
"L1GtTriggerMenuXmlParser") <<
"Error getting \"greater or equal\" flag"
2553 bool gEq = (intGEq != 0);
2558 std::vector<L1GtHfRingEtSumsTemplate::ObjectParameter> objParameter(nrObj);
2562 char* endPtr =
const_cast<char*
>(type.c_str());
2563 long int typeInt = strtol(type.c_str(), &endPtr, 10);
2567 LogDebug(
"L1GtTriggerMenuXmlParser") <<
"Unable to convert " << type <<
" to dec."
2581 objParameter[0].etSumIndex =
static_cast<unsigned int>(typeInt);
2584 std::vector<boost::uint64_t> tmpValues(nrObj);
2590 for (
int i = 0;
i < nrObj;
i++) {
2591 objParameter[
i].etSumThreshold = tmpValues[
i];
2601 std::vector<L1GtObject> objType(nrObj, hfRingEtSumsObjType);
2616 std::ostringstream myCoutStream;
2617 hfRingEtSumsCond.
print(myCoutStream);
2618 LogTrace(
"L1GtTriggerMenuXmlParser") << myCoutStream.str() <<
"\n" << std::endl;
2625 edm::LogError(
"L1GtTriggerMenuXmlParser") <<
" Error: duplicate condition (" << name
2626 <<
")" << std::endl;
2653 const std::string&
name,
unsigned int chipNr) {
2655 XERCES_CPP_NAMESPACE_USE
2664 <<
"\nError: wrong particle for Bptx condition ("
2665 << particle <<
")" << std::endl;
2686 LogTrace(
"L1GtTriggerMenuXmlParser") << bptxCond <<
"\n" << std::endl;
2692 <<
" Error: duplicate condition (" << name
2693 <<
")" << std::endl;
2721 const std::string&
name,
unsigned int chipNr) {
2723 XERCES_CPP_NAMESPACE_USE
2732 <<
"\nError: wrong particle for External condition ("
2733 << particle <<
")" << std::endl;
2754 LogTrace(
"L1GtTriggerMenuXmlParser") << externalCond <<
"\n" << std::endl;
2760 <<
" Error: duplicate condition (" << name
2761 <<
")" << std::endl;
2789 XERCES_CPP_NAMESPACE::DOMNode*
node,
const std::string&
name,
2790 unsigned int chipNr) {
2792 XERCES_CPP_NAMESPACE_USE
2801 <<
" Error: duplicate correlation condition (" << name <<
")"
2812 LogTrace(
"L1GtTriggerMenuXmlParser") <<
" Condition category: "
2813 << condition <<
", particle: " << particle <<
", type: " << type
2814 <<
"\n" << std::endl;
2820 const int nrObj = 2;
2823 int intGEq[nrObj] = { -1, -1 };
2824 std::vector<L1GtObject> objType(nrObj);
2825 std::vector<L1GtConditionCategory> condCateg(nrObj);
2828 const bool corrFlag =
true;
2829 int corrIndexVal[nrObj] = { -1, -1 };
2833 DOMNode* conditionsNode = node->getFirstChild();
2834 std::string conditionNameNodeName;
2835 conditionsNode =
findXMLChild(conditionsNode,
"",
true,
2836 &conditionNameNodeName);
2839 for (
int iSubCond = 0; iSubCond < nrObj; ++iSubCond) {
2846 LogTrace(
"L1GtTriggerMenuXmlParser") <<
" Sub-condition category: "
2847 << condition <<
", particle: " << particle <<
", type: "
2848 << type <<
", name: " << conditionNameNodeName <<
"\n"
2853 if (!
parseMuon(conditionsNode, conditionNameNodeName, chipNr,
2856 <<
"Error parsing sub-condition " << condition <<
")"
2857 <<
" with name " << conditionNameNodeName << std::endl;
2862 intGEq[iSubCond] =
getGEqFlag(conditionsNode,
2864 if (intGEq[iSubCond] < 0) {
2866 <<
"Error getting \"greater or equal\" flag"
2867 <<
" for sub-condition " << conditionNameNodeName
2868 <<
" for the correlation condition " << name
2874 objType[iSubCond] =
Mu;
2880 if (!
parseCalo(conditionsNode, conditionNameNodeName, chipNr,
2883 <<
"Error parsing sub-condition " << condition <<
")"
2884 <<
" with name " << conditionNameNodeName << std::endl;
2890 if (intGEq[iSubCond] < 0) {
2892 <<
"Error getting \"greater or equal\" flag"
2893 <<
" for sub-condition " << conditionNameNodeName
2894 <<
" for the correlation condition " << name
2904 objType[iSubCond] =
IsoEG;
2907 objType[iSubCond] =
CenJet;
2910 objType[iSubCond] =
TauJet;
2913 objType[iSubCond] =
ForJet;
2917 <<
"Wrong object type " << particle
2918 <<
" for sub-condition " << conditionNameNodeName
2919 <<
" from the correlation condition " << name
2929 if (!
parseEnergySum(conditionsNode, conditionNameNodeName, chipNr,
2932 <<
"Error parsing sub-condition " << condition <<
")"
2933 <<
" with name " << conditionNameNodeName << std::endl;
2939 if (intGEq[iSubCond] < 0) {
2941 <<
"Error getting \"greater or equal\" flag"
2942 <<
" for sub-condition " << conditionNameNodeName
2943 <<
" for the correlation condition " << name
2950 objType[iSubCond] =
ETM;
2953 objType[iSubCond] =
ETT;
2956 objType[iSubCond] =
HTT;
2959 objType[iSubCond] =
HTM;
2963 <<
"Wrong object type " << particle
2964 <<
" for sub-condition " << conditionNameNodeName
2965 <<
" from the correlation condition " << name
2976 <<
"Unknown or un-adequate sub-condition (" << condition
2977 <<
")" <<
" with name " << conditionNameNodeName
2978 <<
" for the correlation condition " << name << std::endl;
2983 conditionsNode =
findXMLChild(conditionsNode->getNextSibling(),
"",
2984 true, &conditionNameNodeName);
2990 if (intGEq[0] != intGEq[1]) {
2992 <<
"Inconsistent GEq flags for sub-conditions (" << condition
2993 <<
")" <<
" with name " << conditionNameNodeName
2994 <<
" for the correlation condition " << name << std::endl;
2999 gEq = (intGEq[0] != 0);
3007 std::vector<boost::uint64_t> tmpValues(nrObj);
3016 XERCES_CPP_NAMESPACE::DOMNode* node1 =
findXMLChild(node->getFirstChild(),
3019 std::string valString;
3023 <<
" Could not get deltaEta for correlation condition "
3024 << name <<
". " << std::endl;
3049 <<
" Could not get deltaPhi for correlation condition "
3050 << name <<
". " << std::endl;
3063 unsigned int maxbits;
3076 correlationCond.setCondType(cType);
3077 correlationCond.setObjectType(objType);
3078 correlationCond.setCondGEq(gEq);
3079 correlationCond.setCondChipNr(chipNr);
3081 correlationCond.setCond0Category(condCateg[0]);
3082 correlationCond.setCond1Category(condCateg[1]);
3084 correlationCond.setCond0Index(corrIndexVal[0]);
3085 correlationCond.setCond1Index(corrIndexVal[1]);
3087 correlationCond.setCorrelationParameter(corrParameter);
3091 std::ostringstream myCoutStream;
3092 correlationCond.print(myCoutStream);
3093 LogTrace(
"L1GtTriggerMenuXmlParser") << myCoutStream.str() <<
"\n"
3117 XERCES_CPP_NAMESPACE_USE
3119 DOMNode*
doc = parser->getDocument();
3120 DOMNode* n1 = doc->getFirstChild();
3124 DOMNode* headerNode = n1->getFirstChild();
3125 if (headerNode == 0) {
3127 <<
"> tag found." << std::endl;
3132 if (headerNode == 0) {
3135 <<
"> tag" <<
"\n - No header information." << std::endl;
3139 DOMNode* idNode = headerNode->getFirstChild();
3145 LogTrace(
"L1GtTriggerMenuXmlParser") <<
"\n Warning: Could not find <"
3147 <<
"\n - Trigger menu interface name derived from file name." << std::endl;
3152 if (xmlPos == std::string::npos) {
3153 LogTrace(
"L1GtTriggerMenuXmlParser")
3154 <<
"\n Warning: Could not find \"_L1T_Scales\" " <<
"string in file name"
3155 <<
"\n - Trigger menu interface name set to file name." << std::endl;
3169 idNode = headerNode->getFirstChild();
3174 LogTrace(
"L1GtTriggerMenuXmlParser") <<
"\n Warning: Could not find <"
3184 idNode = headerNode->getFirstChild();
3189 LogTrace(
"L1GtTriggerMenuXmlParser") <<
"\n Warning: Could not find <"
3199 idNode = headerNode->getFirstChild();
3204 LogTrace(
"L1GtTriggerMenuXmlParser") <<
"\n Warning: Could not find <"
3214 idNode = headerNode->getFirstChild();
3219 LogTrace(
"L1GtTriggerMenuXmlParser") <<
"\n Warning: Could not find <"
3229 idNode = headerNode->getFirstChild();
3234 LogTrace(
"L1GtTriggerMenuXmlParser") <<
"\n Warning: Could not find <"
3244 idNode = headerNode->getFirstChild();
3249 LogTrace(
"L1GtTriggerMenuXmlParser") <<
"\n Warning: Could not find <"
3260 idNode = headerNode->getFirstChild();
3266 LogTrace(
"L1GtTriggerMenuXmlParser") <<
"\n Warning: Could not find <"
3268 <<
"\n - Algorithm implementation tag set to empty string." << std::endl;
3277 idNode = headerNode->getFirstChild();
3283 LogTrace(
"L1GtTriggerMenuXmlParser") <<
"\n Warning: Could not find <"
3285 <<
" string." << std::endl;
3293 LogDebug(
"L1GtTriggerMenuXmlParser")
3294 <<
"\n Parsed values from XML file"
3316 LogDebug(
"L1GtTriggerMenuXmlParser") <<
"\n Warning: Inconsistent L1 menu name:"
3318 <<
"\n from XML tag: " << menuName << std::endl;
3327 LogTrace(
"L1GtTriggerMenuXmlParser") <<
"\n L1 menu name set to value from XML tag!"
3331 LogTrace(
"L1GtTriggerMenuXmlParser") <<
"\n L1 menu name set to file name!"
3353 const std::string&
name,
unsigned int chipNr) {
3355 XERCES_CPP_NAMESPACE_USE
3362 if (condition.empty() || particle.empty() || type.empty() ) {
3364 edm::LogError(
"L1GtTriggerMenuXmlParser") <<
"Missing attributes for condition " << name
3408 <<
"\n Error: unknown condition (" << condition <<
")"
3430 XERCES_CPP_NAMESPACE_USE
3432 LogTrace(
"L1GtTriggerMenuXmlParser") <<
"\nParsing conditions" << std::endl;
3434 DOMNode*
doc = parser->getDocument();
3435 DOMNode* n1 = doc->getFirstChild();
3439 DOMNode* chipNode = n1->getFirstChild();
3440 if (chipNode == 0) {
3443 <<
"> tag found." << std::endl;
3450 std::string chipName;
3452 if (chipNode == 0) {
3455 <<
"> tag" << std::endl;
3460 unsigned int chipNr = 0;
3464 DOMNode* conditionsNode = chipNode->getFirstChild();
3466 if (conditionsNode == 0) {
3469 <<
"> child found in Chip " << chipName << std::endl;
3474 char* nodeName = XMLString::transcode(chipNode->getNodeName());
3482 DOMNode* conditionNameNode = conditionsNode->getFirstChild();
3483 std::string conditionNameNodeName;
3484 conditionNameNode =
findXMLChild(conditionNameNode,
"",
true, &conditionNameNodeName);
3485 while (conditionNameNode != 0) {
3487 LogTrace(
"L1GtTriggerMenuXmlParser")
3488 <<
"\n Found a condition with name: " << conditionNameNodeName
3491 if ( !
workCondition(conditionNameNode, conditionNameNodeName, chipNr) ) {
3494 conditionNameNode =
findXMLChild(conditionNameNode->getNextSibling(),
"",
true,
3495 &conditionNameNodeName);
3519 const std::string& algName,
unsigned int chipNr) {
3521 XERCES_CPP_NAMESPACE_USE
3524 LogDebug(
"L1GtTriggerMenuXmlParser")
3525 <<
" Node is 0 in " << __PRETTY_FUNCTION__
3526 <<
" can not parse the algorithm " << algName
3534 if (algAlias ==
"") {
3536 LogDebug(
"L1GtTriggerMenuXmlParser")
3537 <<
"\n No alias defined for algorithm. Alias set to algorithm name."
3538 <<
"\n Algorithm name: " << algName <<
"\n Algorithm alias: " << algAlias
3541 LogDebug(
"L1GtTriggerMenuXmlParser") <<
"\n Alias defined for algorithm."
3542 <<
"\n Algorithm name: " << algName <<
"\n Algorithm alias: " << algAlias
3559 std::string pinString;
3562 pinNode = node->getFirstChild();
3567 std::istringstream opStream(pinString);
3569 if ((opStream >> outputPin).
fail()) {
3570 LogDebug(
"L1GtTriggerMenuXmlParser")
3571 <<
" Unable to convert pin string " << pinString
3572 <<
" to int for algorithm : " << algName
3581 LogTrace(
"L1GtTriggerMenuXmlParser") <<
" Warning: No pin number found for algorithm: "
3582 << algName << std::endl;
3602 alg.setAlgoChipNumber(static_cast<int>(chipNr));
3603 alg.setAlgoAlias(algAlias);
3607 std::ostringstream myCoutStream;
3608 alg.print(myCoutStream);
3609 LogTrace(
"L1GtTriggerMenuXmlParser") << myCoutStream.str() <<
"\n" << std::endl;
3638 XERCES_CPP_NAMESPACE_USE
3642 DOMNode*
doc = parser->getDocument();
3643 DOMNode*
node = doc->getFirstChild();
3645 DOMNode* chipNode = node->getFirstChild();
3646 if (chipNode == 0) {
3653 std::string chipName;
3655 if (chipNode == 0) {
3661 unsigned int chipNr = 0;
3672 DOMNode* algNode = chipNode->getFirstChild();
3676 <<
"> child found in chip " << chipName << std::endl;
3681 DOMNode* algNameNode = algNode->getFirstChild();
3682 std::string algNameNodeName;
3683 algNameNode =
findXMLChild(algNameNode,
"",
true, &algNameNodeName);
3685 while (algNameNode != 0) {
3690 if ( !
workAlgorithm(algNameNode, algNameNodeName, chipNr)) {
3694 algNameNode =
findXMLChild(algNameNode->getNextSibling(),
"",
true, &algNameNodeName);
3718 const std::string& algName) {
3720 XERCES_CPP_NAMESPACE_USE
3723 LogDebug(
"L1GtTriggerMenuXmlParser")
3724 <<
" Node is 0 in " << __PRETTY_FUNCTION__
3725 <<
" can not parse the technical trigger " << algName
3739 std::string pinString;
3742 pinNode = node->getFirstChild();
3747 std::istringstream opStream(pinString);
3749 if ((opStream >> outputPin).
fail()) {
3750 LogDebug(
"L1GtTriggerMenuXmlParser")
3751 <<
" Unable to convert pin string " << pinString
3752 <<
" to int for technical trigger : " << algName
3761 LogTrace(
"L1GtTriggerMenuXmlParser")
3762 <<
" Warning: No pin number found for technical trigger: "
3763 << algName << std::endl;
3769 int bitNumber = outputPin;
3782 std::ostringstream myCoutStream;
3783 alg.
print(myCoutStream);
3784 LogTrace(
"L1GtTriggerMenuXmlParser") << myCoutStream.str() <<
"\n" << std::endl;
3809 XERCES_CPP_NAMESPACE_USE
3813 DOMNode*
doc = parser->getDocument();
3814 DOMNode*
node = doc->getFirstChild();
3816 DOMNode* algNode = node->getFirstChild();
3819 <<
" Error: No child found for " <<
m_xmlTagDef << std::endl;
3832 DOMNode* algNameNode = algNode->getFirstChild();
3833 std::string algNameNodeName;
3834 algNameNode =
findXMLChild(algNameNode,
"",
true, &algNameNodeName);
3836 while (algNameNode != 0) {
3845 algNameNode =
findXMLChild(algNameNode->getNextSibling(),
"",
true,
3864 XERCES_CPP_NAMESPACE_USE
3866 DOMDocument*
doc = parser->getDocument();
3867 DOMNode* n1 = doc->getFirstChild();
3871 edm::LogError(
"L1GtTriggerMenuXmlParser") <<
"Error: Found no XML child" << std::endl;
3876 char* nodeName = XMLString::transcode(n1->getNodeName());
3878 if (XMLString::compareIString(nodeName,
m_xmlTagDef.c_str())) {
3880 edm::LogError(
"L1GtTriggerMenuXmlParser") <<
"Error: First XML child is not \" "
3886 LogTrace(
"L1GtTriggerMenuXmlParser")
3887 <<
"\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)
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