CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TriggerMenuXmlParser.cc
Go to the documentation of this file.
1 
17 // this class header
18 #include "TriggerMenuXmlParser.h"
19 
20 // system include files
21 #include <string>
22 #include <vector>
23 
24 #include <iostream>
25 #include <fstream>
26 #include <iomanip>
27 
28 #include <boost/cstdint.hpp>
29 
30 // user include files
31 // base class
33 
36 
39 
40 #include "L1Trigger/L1TGlobal/src/L1TMenuEditor/L1TriggerMenu.hxx"
41 
42 // constructor
44  L1GtXmlParserTags(), m_xmlErrHandler(0), m_triggerMenuInterface("NULL"),
45  m_triggerMenuName("NULL"), m_triggerMenuImplementation("NULL"), m_scaleDbKey("NULL")
46 
47 {
48 
49  // menu names, scale key initialized to NULL due to ORACLE treatment of strings
50 
51  // empty
52 
53 }
54 
55 // destructor
57 
58  clearMaps();
59 
60 }
61 
62 // set the number of condition chips in GTL
64  const unsigned int& numberConditionChipsValue) {
65 
66  m_numberConditionChips = numberConditionChipsValue;
67 
68 }
69 
70 // set the number of pins on the GTL condition chips
71 void l1t::TriggerMenuXmlParser::setGtPinsOnConditionChip(const unsigned int& pinsOnConditionChipValue) {
72 
73  m_pinsOnConditionChip = pinsOnConditionChipValue;
74 
75 }
76 
77 // set the correspondence "condition chip - GTL algorithm word"
78 // in the hardware
80  const std::vector<int>& orderConditionChipValue) {
81 
82  m_orderConditionChip = orderConditionChipValue;
83 
84 }
85 
86 // set the number of physics trigger algorithms
88  const unsigned int& numberPhysTriggersValue) {
89 
90  m_numberPhysTriggers = numberPhysTriggersValue;
91 
92 }
93 
94 // set the number of technical triggers
96  const unsigned int& numberTechTriggersValue) {
97 
98  m_numberTechTriggers = numberTechTriggersValue;
99 
100 }
101 
102 // set the number of L1 jet counts received by GT
103 void l1t::TriggerMenuXmlParser::setGtNumberL1JetCounts(const unsigned int& numberL1JetCountsValue) {
104 
105  m_numberL1JetCounts = numberL1JetCountsValue;
106 
107 }
108 
109 
110 // set the condition maps
111 void l1t::TriggerMenuXmlParser::setGtConditionMap(const std::vector<ConditionMap>& condMap) {
112  m_conditionMap = condMap;
113 }
114 
115 // set the trigger menu name
117  m_triggerMenuInterface = menuInterface;
118 }
119 
121  m_triggerMenuName = menuName;
122 }
123 
125  m_triggerMenuImplementation = menuImplementation;
126 }
127 
128 // set menu associated scale key
130  m_scaleDbKey = scaleKey;
131 }
132 
133 // set the vectors containing the conditions
135  const std::vector<std::vector<MuonTemplate> >& vecMuonTempl) {
136 
137  m_vecMuonTemplate = vecMuonTempl;
138 }
139 
141  const std::vector<std::vector<CaloTemplate> >& vecCaloTempl) {
142 
143  m_vecCaloTemplate = vecCaloTempl;
144 }
145 
147  const std::vector<std::vector<EnergySumTemplate> >& vecEnergySumTempl) {
148 
149  m_vecEnergySumTemplate = vecEnergySumTempl;
150 }
151 
153  const std::vector<std::vector<L1GtJetCountsTemplate> >& vecJetCountsTempl) {
154 
155  m_vecJetCountsTemplate = vecJetCountsTempl;
156 }
157 
159  const std::vector<std::vector<L1GtCastorTemplate> >& vecCastorTempl) {
160 
161  m_vecCastorTemplate = vecCastorTempl;
162 }
163 
165  const std::vector<std::vector<L1GtHfBitCountsTemplate> >& vecHfBitCountsTempl) {
166 
167  m_vecHfBitCountsTemplate = vecHfBitCountsTempl;
168 }
169 
171  const std::vector<std::vector<L1GtHfRingEtSumsTemplate> >& vecHfRingEtSumsTempl) {
172 
173  m_vecHfRingEtSumsTemplate = vecHfRingEtSumsTempl;
174 }
175 
177  const std::vector<std::vector<L1GtBptxTemplate> >& vecBptxTempl) {
178 
179  m_vecBptxTemplate = vecBptxTempl;
180 }
181 
183  const std::vector<std::vector<L1GtExternalTemplate> >& vecExternalTempl) {
184 
185  m_vecExternalTemplate = vecExternalTempl;
186 }
187 
189  const std::vector<std::vector<CorrelationTemplate> >& vecCorrelationTempl) {
190 
191  m_vecCorrelationTemplate = vecCorrelationTempl;
192 }
193 
194 // set the vectors containing the conditions for correlation templates
195 //
197  const std::vector<std::vector<MuonTemplate> >& corMuonTempl) {
198 
199  m_corMuonTemplate = corMuonTempl;
200 }
201 
203  const std::vector<std::vector<CaloTemplate> >& corCaloTempl) {
204 
205  m_corCaloTemplate = corCaloTempl;
206 }
207 
209  const std::vector<std::vector<EnergySumTemplate> >& corEnergySumTempl) {
210 
211  m_corEnergySumTemplate = corEnergySumTempl;
212 }
213 
214 
215 
216 
217 // set the algorithm map (by algorithm names)
219  m_algorithmMap = algoMap;
220 }
221 
222 // set the algorithm map (by algorithm aliases)
224  m_algorithmAliasMap = algoMap;
225 }
226 
227 // set the technical trigger map
229  m_technicalTriggerMap = ttMap;
230 }
231 
232 //
233 
234 
235 // parse def.xml and vme.xml files
237  const std::string& vmeXmlFile) {
238 
239  XERCES_CPP_NAMESPACE_USE
240 
241  // resize the vector of condition maps
242  // the number of condition chips should be correctly set before calling parseXmlFile
243  m_conditionMap.resize(m_numberConditionChips);
244 
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);
254 
255  m_vecCorrelationTemplate.resize(m_numberConditionChips);
256  m_corMuonTemplate.resize(m_numberConditionChips);
257  m_corCaloTemplate.resize(m_numberConditionChips);
258  m_corEnergySumTemplate.resize(m_numberConditionChips);
259 
260  // set the name of the trigger menu name:
261  // defXmlFile, stripped of absolute path and .xml
262  // will be overwritten by the value read from the xml file, with a warning if
263  // they are not the same
264  m_triggerMenuName = defXmlFile;
265  size_t xmlPos = m_triggerMenuName.find_last_of("/");
266  m_triggerMenuName.erase(m_triggerMenuName.begin(), m_triggerMenuName.begin()
267  + xmlPos + 1);
268 
269  xmlPos = m_triggerMenuName.find_last_of(".");
270  m_triggerMenuName.erase(m_triggerMenuName.begin() + xmlPos, m_triggerMenuName.end());
271 
272  // error handler for xml-parser
273  m_xmlErrHandler = 0;
274 
275  std::auto_ptr<l1t::L1TriggerMenu> tm(l1t::l1TriggerMenu(defXmlFile));
276 
277  LogTrace("TriggerMenuXmlParser") << "\nOpening XML-File: \n " << defXmlFile << std::endl;
278 
279  l1t::ConditionList conditions = tm->conditions();
280 
281  workXML( tm );
282 
283 // if ((parser = initXML(defXmlFile)) != 0) {
284 // workXML(parser);
285 // }
286 // cleanupXML(parser);
287 
288 }
289 
290 //
291 
293 
294  m_triggerMenuInterfaceDate = val;
295 
296 }
297 
299 
300  m_triggerMenuInterfaceAuthor = val;
301 
302 }
303 
305 
306  m_triggerMenuInterfaceDescription = val;
307 
308 }
309 
310 
312 
313  m_triggerMenuDate = val;
314 
315 }
316 
318 
319  m_triggerMenuAuthor = val;
320 
321 }
322 
324 
325  m_triggerMenuDescription = val;
326 
327 }
328 
330 
331  m_algorithmImplementation = val;
332 
333 }
334 
335 // private methods
336 
337 
338 
348 XERCES_CPP_NAMESPACE::XercesDOMParser* l1t::TriggerMenuXmlParser::initXML(const std::string &xmlFile) {
349 
350  XERCES_CPP_NAMESPACE_USE
351 
352  // try to initialize
353  try {
354  XMLPlatformUtils::Initialize();
355  }
356  catch (const XMLException& toCatch) {
357  char* message = XMLString::transcode(toCatch.getMessage());
358 
359  edm::LogError("TriggerMenuXmlParser")
360  << "Error during Xerces-c initialization! :"
361  << message << std::endl;
362 
363  XMLString::release(&message);
364  return 0;
365  }
366 
367  XercesDOMParser* parser = new XercesDOMParser();
368  parser->setValidationScheme(XercesDOMParser::Val_Always);
369  parser->setDoNamespaces(false); // we got no dtd
370 
371  if (m_xmlErrHandler == 0) { // redundant check
372  m_xmlErrHandler = (ErrorHandler*) new HandlerBase();
373  }
374  else {
375  // TODO ASSERTION
376  }
377  parser->setErrorHandler(m_xmlErrHandler);
378 
379  // try to parse the file
380  try {
381  parser->parse(xmlFile.c_str());
382  }
383  catch(const XMLException &toCatch) {
384  char* message = XMLString::transcode(toCatch.getMessage());
385 
386  edm::LogError("TriggerMenuXmlParser")
387  << "Exception while parsing XML: \n"
388  << message << std::endl;
389 
390  XMLString::release(&message);
391  delete parser;
392  delete m_xmlErrHandler;
393  m_xmlErrHandler = 0;
394  return 0;
395  }
396  catch (const DOMException &toCatch) {
397  char *message = XMLString::transcode(toCatch.msg);
398 
399  edm::LogError("TriggerMenuXmlParser")
400  << "DOM-Exception while parsing XML: \n"
401  << message << std::endl;
402 
403  XMLString::release(&message);
404  delete parser;
405  delete m_xmlErrHandler;
406  m_xmlErrHandler = 0;
407  return 0;
408  }
409  catch (...) {
410 
411  edm::LogError("TriggerMenuXmlParser")
412  << "Unexpected Exception while parsing XML!"
413  << std::endl;
414 
415  delete parser;
416  delete m_xmlErrHandler;
417  m_xmlErrHandler = 0;
418  return 0;
419  }
420 
421  return parser;
422 }
423 
424 // find a named child of a xml node
425 XERCES_CPP_NAMESPACE::DOMNode* l1t::TriggerMenuXmlParser::findXMLChild(
426  XERCES_CPP_NAMESPACE::DOMNode* startChild, const std::string& tagName, bool beginOnly,
427  std::string* rest) {
428 
429  XERCES_CPP_NAMESPACE_USE
430 
431  char* nodeName = 0;
432 
433  DOMNode *n1 = startChild;
434  if (n1 == 0) {
435  return 0;
436  }
437 
438  if ( !tagName.empty() ) {
439  nodeName = XMLString::transcode(n1->getNodeName());
440 
441  if (!beginOnly) {
442  //match the whole tag
443  while (XMLString::compareIString(nodeName, tagName.c_str())) {
444 
445  XMLString::release(&nodeName);
446  n1 = n1->getNextSibling();
447  if (n1 == 0) {
448  break;
449  }
450 
451  nodeName = XMLString::transcode(n1->getNodeName());
452  }
453  }
454  else {
455  // match only the beginning
456  while (XMLString::compareNIString(nodeName, tagName.c_str(), tagName.length())) {
457  XMLString::release(&nodeName);
458  n1 = n1->getNextSibling();
459  if (n1 == 0) {
460  break;
461  }
462 
463  nodeName = XMLString::transcode(n1->getNodeName());
464  }
465  if (n1 != 0 && rest != 0) {
466  *rest = std::string(nodeName).substr(tagName.length(), strlen(nodeName) - tagName.length());
467  }
468  }
469  }
470  else { // empty string given
471  while (n1->getNodeType() != DOMNode::ELEMENT_NODE) {
472  n1 = n1->getNextSibling();
473  if (n1 == 0) {
474  break;
475  }
476 
477  }
478  if (n1 != 0 && rest != 0) {
479  nodeName = XMLString::transcode(n1->getNodeName());
480  *rest = std::string(nodeName);
481  }
482  }
483 
484  XMLString::release(&nodeName);
485 
486  return n1;
487 
488 }
489 
499 std::string l1t::TriggerMenuXmlParser::getXMLAttribute(const XERCES_CPP_NAMESPACE::DOMNode* node,
500  const std::string& name) {
501 
502  XERCES_CPP_NAMESPACE_USE
503 
505 
506  // get attributes list
507  DOMNamedNodeMap* attributes = node->getAttributes();
508  if (attributes == 0) {
509  return ret;
510  }
511 
512  // get attribute node
513  XMLCh* attrName = XMLString::transcode(name.c_str());
514  DOMNode* attribNode = attributes->getNamedItem(attrName);
515 
516  XMLString::release(&attrName);
517  if (attribNode == 0) {
518  return ret;
519  }
520 
521  char* retCstr = XMLString::transcode(attribNode->getNodeValue());
522  ret = retCstr;
523  XMLString::release(&retCstr);
524 
525  return ret;
526 }
527 
537 
538  XERCES_CPP_NAMESPACE_USE
539 
541 
542  DOMNode* n1 = node;
543  if (n1 == 0) {
544  return ret;
545  }
546 
547  const XMLCh* retXmlCh = n1->getTextContent();
548  if (retXmlCh == 0) {
549  return ret;
550  }
551 
552  char* retCstr = XMLString::transcode(retXmlCh);
553  XMLString::trim(retCstr); // trim spaces
554 
555  ret = retCstr;
556  XMLString::release(&retCstr);
557 
558  return ret;
559 }
560 
572  boost::uint64_t& dstL, boost::uint64_t& dstH) {
573 
574  // string to determine start of hex value, do not ignore leading zeros
575  static const std::string valid_hex_start("0123456789ABCDEFabcdef");
576 
577  // string to determine end of hex value
578  static const std::string valid_hex_end("0123456789ABCDEFabcdef");
579 
580  std::string tempStr = hexString;
581 
582  // start / end position of the hex value in the string
583  unsigned int hexStart = tempStr.find_first_of(valid_hex_start);
584  unsigned int hexEnd = tempStr.find_first_not_of(valid_hex_end, hexStart);
585 
586  if (hexStart == hexEnd) {
587 
588  LogDebug("TriggerMenuXmlParser") << "No hex value found in: " << tempStr << std::endl;
589 
590  return false;
591  }
592 
593  tempStr = tempStr.substr(hexStart, hexEnd - hexStart);
594 
595  if (tempStr.empty() ) {
596 
597  LogDebug("TriggerMenuXmlParser") << "Empty value in " << __PRETTY_FUNCTION__
598  << std::endl;
599 
600  return false;
601  }
602 
603  // split the string
604  std::string tempStrH, tempStrL;
605 
606  if (tempStr.length() > 16) { // more than 64 bit
607  tempStrL = tempStr.substr(tempStr.length()-16, 16);
608  tempStrH = tempStr.substr(0, tempStr.length()-16);
609  }
610  else {
611  tempStrL = tempStr;
612  tempStrH = "0";
613  }
614 
615  // convert lower 64bit
616  char* endPtr = (char*) tempStrL.c_str();
617  boost::uint64_t tempUIntL = strtoull(tempStrL.c_str(), &endPtr, 16);
618 
619  if (*endPtr != 0) {
620 
621  LogDebug("TriggerMenuXmlParser") << "Unable to convert " << tempStr << " to hex."
622  << std::endl;
623 
624  return false;
625  }
626 
627  // convert higher64 bit
628  endPtr = (char*) tempStrH.c_str();
629  boost::uint64_t tempUIntH = strtoull(tempStrH.c_str(), &endPtr, 16);
630 
631  if (*endPtr != 0) {
632 
633  LogDebug("TriggerMenuXmlParser") << "Unable to convert " << tempStr << " to hex."
634  << std::endl;
635 
636  return false;
637  }
638 
639  dstL = tempUIntL;
640  dstH = tempUIntH;
641 
642  return true;
643 }
644 
655 bool l1t::TriggerMenuXmlParser::getXMLHexTextValue128Old(XERCES_CPP_NAMESPACE::DOMNode* node,
656  boost::uint64_t& dstL, boost::uint64_t& dstH) {
657 
658  if (node == 0) {
659 
660  LogDebug("TriggerMenuXmlParser") << "node == 0 in " << __PRETTY_FUNCTION__ << std::endl;
661 
662  return false;
663  }
664 
665  boost::uint64_t tempUIntH, tempUIntL;
666 
667  std::string tempStr = getXMLTextValue(node);
668  if ( !hexString2UInt128(tempStr, tempUIntL, tempUIntH) ) {
669  return false;
670  }
671 
672  dstL = tempUIntL;
673  dstH = tempUIntH;
674 
675  return true;
676 }
677 
679  boost::uint64_t& dstL, boost::uint64_t& dstH) {
680 
681  boost::uint64_t tempUIntH, tempUIntL;
682 
683  std::string tempStr = childName;
684  if ( !hexString2UInt128(tempStr, tempUIntL, tempUIntH) ) {
685  return false;
686  }
687 
688  dstL = tempUIntL;
689  dstH = tempUIntH;
690 
691  return true;
692 }
693 
705 bool l1t::TriggerMenuXmlParser::getXMLHexTextValueOld(XERCES_CPP_NAMESPACE::DOMNode* node,
706  boost::uint64_t& dst) {
707 
708  boost::uint64_t dummyH; // dummy for eventual higher 64bit
709  boost::uint64_t tempUInt; // temporary unsigned integer
710 
711  if ( !getXMLHexTextValue128Old(node, tempUInt, dummyH) ) {
712  return false;
713  }
714 
715  if (dummyH != 0) {
716  edm::LogError("TriggerMenuXmlParser") << "Too large hex-value!" << std::endl;
717  return false;
718  }
719 
720  dst = tempUInt;
721 
722  return true;
723 }
724 
726  boost::uint64_t& dst) {
727 
728  boost::uint64_t dummyH; // dummy for eventual higher 64bit
729  boost::uint64_t tempUInt; // temporary unsigned integer
730 
731  if ( !getXMLHexTextValue128( childName, tempUInt, dummyH) ) {
732  return false;
733  }
734 
735  if (dummyH != 0) {
736  edm::LogError("TriggerMenuXmlParser") << "Too large hex-value!" << std::endl;
737  return false;
738  }
739 
740  dst = tempUInt;
741 
742  return true;
743 }
744 
756  unsigned int& dst) {
757 
758  XERCES_CPP_NAMESPACE_USE
759 
760  // should never happen...
761  // first try direct
762  std::string maxString = childName; // string for the maxbits
763 
764  // do the hex conversion
765 
766  boost::uint64_t maxBitsL, maxBitsH;
767  if ( !hexString2UInt128(maxString, maxBitsL, maxBitsH) ) {
768  return false;
769  }
770 
771  // count the bits
772  //LogTrace("TriggerMenuXmlParser")
773  //<< std::dec
774  //<< " words: dec: high (MSB) word = " << maxBitsH << " low word = " << maxBitsL
775  //<< std::hex << "\n"
776  //<< " words: hex: high (MSB) word = " << maxBitsH << " low word = " << maxBitsL
777  //<< std::dec
778  //<< std::endl;
779 
780  unsigned int counter = 0;
781 
782  while (maxBitsL != 0) {
783  // check if bits set countinously
784  if ( (maxBitsL & 1) == 0) {
785 
786  edm::LogError("TriggerMenuXmlParser")
787  << " Confused by not continous set bits for max value " << maxString
788  << std::endl;
789 
790  return false;
791  }
792 
793  maxBitsL >>= 1;
794  counter++;
795  }
796 
797  if ( (maxBitsH != 0) && (counter != 64)) {
798 
799  edm::LogError("TriggerMenuXmlParser")
800  << " Confused by not continous set bits for max value " << maxString
801  << std::endl;
802 
803  return false;
804  }
805 
806  while (maxBitsH != 0) {
807  //check if bits set countinously
808  if ( (maxBitsH & 1) == 0) {
809 
810  edm::LogError("TriggerMenuXmlParser")
811  << " Confused by not continous set bits for max value " << maxString
812  << std::endl;
813 
814  return false;
815  }
816 
817  maxBitsH >>= 1;
818  counter++;
819  }
820 
821  dst = counter;
822  return true;
823 
824 }
825 
826 
839  const std::string& childName, unsigned int num, std::vector<boost::uint64_t>& dst) {
840 
841  XERCES_CPP_NAMESPACE_USE
842 
843  if (node == 0) {
844 
845  LogDebug("TriggerMenuXmlParser")
846  << "node == 0 in " << __PRETTY_FUNCTION__
847  << std::endl;
848 
849  return false;
850  }
851 
852  DOMNode* n1 = findXMLChild(node->getFirstChild(), childName);
853 
854  // if child not found
855  if (n1 == 0) {
856 
857  LogDebug("TriggerMenuXmlParser") << "Child of condition not found ( " << childName
858  << ")" << std::endl;
859 
860  return false;
861  }
862 
863  // no values are sucessfull
864  if (num == 0) {
865  return true;
866  }
867 
868  //
869  dst.reserve(num);
870 
871  //
872  n1 = findXMLChild(n1->getFirstChild(), m_xmlTagValue);
873  for (unsigned int i = 0; i < num; i++) {
874  if (n1 == 0) {
875 
876  LogDebug("TriggerMenuXmlParser") << "Not enough values in condition child ( "
877  << childName << ")" << std::endl;
878 
879  return false;
880  }
881 
882  if ( !getXMLHexTextValueOld(n1, dst[i]) ) {
883 
884  edm::LogError("TriggerMenuXmlParser") << "Error converting condition child ( "
885  << childName << ") value." << std::endl;
886 
887  return false;
888  }
889 
890  n1 = findXMLChild(n1->getNextSibling(), m_xmlTagValue); // next child
891  }
892 
893  return true;
894 }
895 
903 void l1t::TriggerMenuXmlParser::cleanupXML(XERCES_CPP_NAMESPACE::XercesDOMParser* parser) {
904 
905  XERCES_CPP_NAMESPACE_USE
906 
907  if (parser != 0) {
908  delete parser;
909  }
910 
911  if (m_xmlErrHandler != 0) {
912  delete m_xmlErrHandler;
913  m_xmlErrHandler = 0;
914  }
915 
916  XMLPlatformUtils::Terminate();
917 
918 }
919 
920 
921 // methods for the VME file
922 
923 
933 bool l1t::TriggerMenuXmlParser::parseVmeXML(XERCES_CPP_NAMESPACE::XercesDOMParser* parser) {
934 
935  XERCES_CPP_NAMESPACE_USE
936 
937  DOMDocument* doc = parser->getDocument();
938  DOMNode* n1 = doc->getFirstChild();
939 
940  if (n1 == 0) {
941 
942  edm::LogError("TriggerMenuXmlParser") << "Error: Found no XML child" << std::endl;
943 
944  return false;
945  }
946 
947  // find "vme"-tag
948  n1 = findXMLChild(n1, m_xmlTagVme);
949  if (n1 == 0) {
950 
951  edm::LogError("TriggerMenuXmlParser") << "Error: No vme tag found." << std::endl;
952  return false;
953  }
954 
955  n1 = n1->getFirstChild();
956 
957  unsigned int chipCounter = 0; // count chips
958 
959  while (chipCounter < m_numberConditionChips) {
960 
961  n1 = findXMLChild(n1, m_xmlTagChip, true);
962  if (n1 == 0) {
963  // just break if no more chips found
964  break;
965  }
966 
967  // node for a particle
968  //DOMNode* particleNode = n1->getFirstChild(); // FIXME un-comment
969 
970  // FIXME parse vme.xml, modify the menu
971 
972  n1 = n1->getNextSibling();
973  chipCounter++;
974  } // end while chipCounter
975 
976  return true;
977 
978 }
979 
980 // methods for conditions and algorithms
981 
982 // clearMaps - delete all conditions and algorithms in
983 // the maps and clear the maps.
985 
986  // loop over condition maps (one map per condition chip)
987  // then loop over conditions in the map
988  for (std::vector<ConditionMap>::iterator itCondOnChip = m_conditionMap.begin(); itCondOnChip
989  != m_conditionMap.end(); itCondOnChip++) {
990 
991  // the conditions in the maps are deleted in L1uGtTriggerMenu, not here
992 
993  itCondOnChip->clear();
994 
995  }
996 
997  // the algorithms in the maps are deleted in L1uGtTriggerMenu, not here
998  m_algorithmMap.clear();
999 
1000 }
1001 
1002 // insertConditionIntoMap - safe insert of condition into condition map.
1003 // if the condition name already exists, do not insert it and return false
1005 
1006  std::string cName = cond.condName();
1007  //LogTrace("TriggerMenuXmlParser")
1008  //<< " Trying to insert condition \"" << cName << "\" in the condition map." ;
1009 
1010  // no condition name has to appear twice!
1011  if ((m_conditionMap[chipNr]).count(cName) != 0) {
1012  LogTrace("TriggerMenuXmlParser") << " Condition " << cName
1013  << " already exists - not inserted!" << std::endl;
1014  return false;
1015  }
1016 
1017  (m_conditionMap[chipNr])[cName] = &cond;
1018  //LogTrace("TriggerMenuXmlParser")
1019  //<< " OK - condition inserted!"
1020  //<< std::endl;
1021 
1022 
1023  return true;
1024 
1025 }
1026 
1027 // insert an algorithm into algorithm map
1029 
1030  std::string algName = alg.algoName();
1031  std::string algAlias = alg.algoAlias();
1032  //LogTrace("TriggerMenuXmlParser")
1033  //<< " Trying to insert algorithm \"" << algName << "\" in the algorithm map." ;
1034 
1035  // no algorithm name has to appear twice!
1036  if (m_algorithmMap.count(algName) != 0) {
1037  LogTrace("TriggerMenuXmlParser") << " Algorithm \"" << algName
1038  << "\"already exists in the algorithm map- not inserted!" << std::endl;
1039  return false;
1040  }
1041 
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;
1045  return false;
1046  }
1047 
1048  // bit number less than zero or greater than maximum number of algorithms
1049  int bitNumber = alg.algoBitNumber();
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;
1054  return false;
1055  }
1056 
1057  // maximum number of algorithms
1058  if (m_algorithmMap.size() >= m_numberPhysTriggers) {
1059  LogTrace("TriggerMenuXmlParser") << " More than maximum allowed "
1060  << m_numberPhysTriggers << " algorithms in the algorithm map - not inserted!"
1061  << std::endl;
1062  return false;
1063  }
1064 
1065  // chip number outside allowed values
1066  int chipNr = alg.algoChipNumber(static_cast<int>(m_numberConditionChips),
1067  static_cast<int>(m_pinsOnConditionChip), m_orderConditionChip);
1068 
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;
1073  return false;
1074  }
1075 
1076  // output pin outside allowed values
1077  int outputPin = alg.algoOutputPin(static_cast<int>(m_numberConditionChips),
1078  static_cast<int>(m_pinsOnConditionChip), m_orderConditionChip);
1079 
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;
1084  return false;
1085  }
1086 
1087  // no two algorithms on the same chip can have the same output pin
1088  for (CItAlgo itAlgo = m_algorithmMap.begin(); itAlgo != m_algorithmMap.end(); itAlgo++) {
1089 
1090  int iPin = (itAlgo->second).algoOutputPin( static_cast<int>(m_numberConditionChips),
1091  static_cast<int>(m_pinsOnConditionChip), m_orderConditionChip);
1092  std::string iName = itAlgo->first;
1093  int iChip = (itAlgo->second).algoChipNumber(static_cast<int>(m_numberConditionChips),
1094  static_cast<int>(m_pinsOnConditionChip), m_orderConditionChip);
1095 
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!"
1100  << std::endl;
1101  return false;
1102  }
1103 
1104  }
1105 
1106  // insert algorithm
1107  m_algorithmMap[algName] = alg;
1108  m_algorithmAliasMap[algAlias] = alg;
1109 
1110  //LogTrace("TriggerMenuXmlParser")
1111  //<< " OK - algorithm inserted!"
1112  //<< std::endl;
1113 
1114  return true;
1115 
1116 }
1117 
1118 // insert a technical trigger into technical trigger map
1120 
1121  std::string algName = alg.algoName();
1122  //LogTrace("TriggerMenuXmlParser")
1123  //<< " Trying to insert technical trigger \"" << algName
1124  //<< "\" in the technical trigger map." ;
1125 
1126  // no technical trigger name has to appear twice!
1127  if (m_technicalTriggerMap.count(algName) != 0) {
1128  LogTrace("TriggerMenuXmlParser") << " Technical trigger \""
1129  << algName
1130  << "\"already exists in the technical trigger map- not inserted!"
1131  << std::endl;
1132  return false;
1133  }
1134 
1135  // bit number less than zero or greater than maximum number of technical triggers
1136  int bitNumber = alg.algoBitNumber();
1137  if ((bitNumber < 0)
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;
1143  return false;
1144  }
1145 
1146  // no two technical triggers can have the same bit number
1147  for (CItAlgo itAlgo = m_technicalTriggerMap.begin(); itAlgo
1148  != m_technicalTriggerMap.end(); itAlgo++) {
1149 
1150  int iBitNumber = (itAlgo->second).algoBitNumber();
1151  std::string iName = itAlgo->first;
1152 
1153  if ((iBitNumber == bitNumber)) {
1154  LogTrace("TriggerMenuXmlParser") << " Bit number "
1155  << iBitNumber << " is the same as for technical trigger "
1156  << iName << " - technical trigger not inserted!"
1157  << std::endl;
1158  return false;
1159  }
1160 
1161  }
1162 
1163  // maximum number of technical triggers
1164  if (m_technicalTriggerMap.size() >= m_numberTechTriggers) {
1165  LogTrace("TriggerMenuXmlParser")
1166  << " More than maximum allowed " << m_numberTechTriggers
1167  << " technical triggers in the technical trigger map - not inserted!"
1168  << std::endl;
1169  return false;
1170  }
1171 
1172  // insert technical trigger
1173  m_technicalTriggerMap[algName] = alg;
1174 
1175  //LogTrace("TriggerMenuXmlParser")
1176  //<< " OK - technical trigger inserted!"
1177  //<< std::endl;
1178 
1179  return true;
1180 
1181 }
1182 
1183 
1184 
1185 // get the type of the condition, as defined in enum, from the condition type
1186 // as defined in the XML file
1188 
1189  if (type == m_xmlConditionAttrType1s) {
1190  return l1t::Type1s;
1191  }
1192 
1193  if (type == m_xmlConditionAttrType2s) {
1194  return l1t::Type2s;
1195  }
1196 
1197  if (type == m_xmlConditionAttrType3s) {
1198  return l1t::Type3s;
1199  }
1200 
1201  if (type == m_xmlConditionAttrType4s) {
1202  return l1t::Type4s;
1203  }
1204 
1205  if (type == m_xmlConditionAttrType2wsc) {
1206  return l1t::Type2wsc;
1207  }
1208 
1209  if (type == m_xmlConditionAttrType2cor) {
1210  return l1t::Type2cor;
1211  }
1212 
1213  return l1t::TypeNull;
1214 }
1215 
1226 
1227  if (type == m_xmlConditionAttrType1s) {
1228  return 1;
1229  }
1230 
1231  if (type == m_xmlConditionAttrType2s) {
1232  return 2;
1233  }
1234 
1235  if (type == m_xmlConditionAttrType3s) {
1236  return 3;
1237  }
1238 
1239  if (type == m_xmlConditionAttrType4s) {
1240  return 4;
1241  }
1242 
1243  if (type == m_xmlConditionAttrType2wsc) {
1244  return 2;
1245  }
1246 
1247  if (type == m_xmlConditionAttrType2cor) {
1248  return 2;
1249  }
1250 
1251  return -1;
1252 }
1253 
1262 int l1t::TriggerMenuXmlParser::getBitFromNode(XERCES_CPP_NAMESPACE::DOMNode* node) {
1263 
1264  if (getXMLAttribute(node, m_xmlAttrMode) != m_xmlAttrModeBit) {
1265 
1266  edm::LogError("TriggerMenuXmlParser") << "Invalid mode for single bit" << std::endl;
1267 
1268  return -1;
1269  }
1270 
1271  std::string tmpStr = getXMLTextValue(node);
1272  if (tmpStr == "0") {
1273  return 0;
1274  }
1275  else if (tmpStr == "1") {
1276  return 1;
1277  }
1278  else {
1279  edm::LogError("TriggerMenuXmlParser") << "Bad bit value (" << tmpStr << ")"
1280  << std::endl;
1281  return -1;
1282  }
1283 }
1284 
1294 int l1t::TriggerMenuXmlParser::getGEqFlag(XERCES_CPP_NAMESPACE::DOMNode* node,
1295  const std::string& nodeName) {
1296 
1297  XERCES_CPP_NAMESPACE_USE
1298 
1299  if (node == 0) {
1300 
1301  LogDebug("TriggerMenuXmlParser")
1302  << "node == 0 in " << __PRETTY_FUNCTION__
1303  << std::endl;
1304 
1305  return -1;
1306  }
1307 
1308  // usually the GEq flag is a child of the first child (the first element node)
1309  DOMNode* n1 = node->getFirstChild();
1310  n1 = findXMLChild(n1, nodeName);
1311 
1312  if (n1 != 0) {
1313  n1 = findXMLChild(n1->getFirstChild(), m_xmlTagGEq);
1314  if (n1 == 0) {
1315 
1316  LogDebug("TriggerMenuXmlParser") << "No \"greater or equal\" tag found"
1317  << std::endl;
1318 
1319  return -1;
1320  }
1321 
1322  return getBitFromNode(n1);
1323  }
1324  else {
1325 
1326  return -1;
1327 
1328  }
1329 
1330 }
1331 
1344 bool l1t::TriggerMenuXmlParser::getMuonMipIsoBits(XERCES_CPP_NAMESPACE::DOMNode* node,
1345  unsigned int num, std::vector<bool>& mipDst, std::vector<bool>& isoEnDst,
1346  std::vector<bool>& isoReqDst) {
1347 
1348  XERCES_CPP_NAMESPACE_USE
1349 
1350  if (node == 0) {
1351  return false;
1352  }
1353 
1354  // find ptLowThreshold child
1355  DOMNode* n1 = findXMLChild(node->getFirstChild(), m_xmlTagPtLowThreshold);
1356 
1357  if (n1 == 0) {
1358  return false;
1359  }
1360 
1361  // get first value tag
1362  n1 = findXMLChild(n1->getFirstChild(), m_xmlTagValue);
1363 
1364  for (unsigned int i = 0; i < num; i++) {
1365 
1366  if (n1 == 0) {
1367  return false;
1368  }
1369 
1370  // MIP bit
1371 
1372  DOMNode* bitnode = findXMLChild(n1->getFirstChild(), m_xmlTagEnableMip);
1373  if (bitnode == 0) {
1374  return true;
1375  }
1376 
1377  int tmpint = getBitFromNode(bitnode);
1378  if (tmpint < 0) {
1379  return false;
1380  }
1381 
1382  mipDst[i] = (tmpint != 0);
1383 
1384  //LogTrace("TriggerMenuXmlParser")
1385  //<< " MIP bit value for muon " << i << " = " << mipDst[i]
1386  //<< std::endl;
1387 
1388 
1389  // enable iso bit
1390  bitnode = findXMLChild(n1->getFirstChild(), m_xmlTagEnableIso);
1391  if (bitnode == 0) {
1392  return true;
1393  }
1394 
1395  tmpint = getBitFromNode(bitnode);
1396  if (tmpint < 0) {
1397  return false;
1398  }
1399 
1400  isoEnDst[i] = (tmpint != 0);
1401 
1402  //LogTrace("TriggerMenuXmlParser")
1403  //<< " Enabled iso bit value for muon " << i << " = " << isoEnDst[i]
1404  //<< std::endl;
1405 
1406  // request iso bit
1407  bitnode = findXMLChild(n1->getFirstChild(), m_xmlTagRequestIso);
1408  if (bitnode == 0) {
1409  return true;
1410  }
1411 
1412  tmpint = getBitFromNode(bitnode);
1413  if (tmpint < 0) {
1414  return false;
1415  }
1416 
1417  isoReqDst[i] = (tmpint != 0);
1418 
1419  //LogTrace("TriggerMenuXmlParser")
1420  //<< " Request iso bit value for muon " << i << " = " << isoReqDst[i]
1421  //<< std::endl;
1422 
1423  //
1424  n1 = findXMLChild(n1->getNextSibling(), m_xmlTagValue); // next value
1425  }
1426 
1427  return true;
1428 }
1429 
1430 
1432  std::stringstream ss;
1433  ss << data;
1434  return ss.str();
1435 }
1437  std::stringstream ss;
1438  ss << std::setfill('0');
1439  ss << std::setw(4) << date.year() << "-" << std::setw(2) << date.month() << "-" << std::setw(2) << date.day() << "T";
1440  ss << std::setw(2) << date.hours() << ":" << std::setw(2) << date.minutes() << ":" << std::setw(2) << date.seconds();
1441  //ss << data;
1442  return ss.str();
1443 }
1445  std::stringstream ss;
1446  ss << data;
1447  int value;
1448  ss >> value;
1449  return value;
1450 }
1451 
1452 
1453 
1465 bool l1t::TriggerMenuXmlParser::parseMuon(l1t::MuonCondition condMu,
1466  unsigned int chipNr, const bool corrFlag) {
1467 
1468  XERCES_CPP_NAMESPACE_USE
1469 
1470  // get condition, particle name (must be muon) and type name
1471  std::string condition = "muon";
1472  std::string particle = "muon";//l1t2string( condMu.objectType() );
1473  std::string type = l1t2string( condMu.type() );
1474  std::string name = l1t2string( condMu.name() );
1475 
1476  if( particle=="mu" ) particle = "muon";
1477 
1478  if( type=="double_wsc" ) type = "2_wsc";
1479  else if( type=="single" ) type = "1_s";
1480  else if( type=="double" ) type = "2_s";
1481  else if( type=="triple" ) type = "3";
1482  else if( type=="quad" ) type = "4";
1483 
1484  LogDebug("l1t|Global")
1485  << "\n ****************************************** "
1486  << "\n parseMuon "
1487  << "\n condition = " << condition
1488  << "\n particle = " << particle
1489  << "\n type = " << type
1490  << "\n name = " << name
1491  << std::endl;
1492 
1493  if (particle != m_xmlConditionAttrObjectMu) {
1494  edm::LogError("TriggerMenuXmlParser") << "Wrong particle for muon-condition ("
1495  << particle << ")" << std::endl;
1496  return false;
1497  }
1498 
1499  // get greater equal flag
1500  std::string str_etComparison = l1t2string( condMu.comparison_operator() );
1501 
1502  int nrObj = getNumFromType(type);
1503  if (nrObj < 0) {
1504  edm::LogError("TriggerMenuXmlParser") << "Unknown type for muon-condition (" << type
1505  << ")" << "\nCan not determine number of trigger objects. " << std::endl;
1506  return false;
1507  }
1508 
1509  // get greater equal flag
1510  int intGEq = ( str_etComparison=="ge" ) ? 1 : 0;
1511  if (intGEq < 0) {
1512  edm::LogError("TriggerMenuXmlParser") << "Error getting \"greater or equal\" flag"
1513  << std::endl;
1514  return false;
1515  }
1516  // set the boolean value for the ge_eq mode
1517  bool gEq = (intGEq != 0);
1518 
1519 // // get values
1520 
1521  // temporary storage of the parameters
1522  std::vector<MuonTemplate::ObjectParameter> objParameter(nrObj);
1523  MuonTemplate::CorrelationParameter corrParameter;
1524 
1525  // need at least two values for deltaPhi
1526  std::vector<boost::uint64_t> tmpValues((nrObj > 2) ? nrObj : 2);
1527  tmpValues.reserve( nrObj );
1528 
1529  if( int(condMu.objectRequirements().objectRequirement().size())!=nrObj ){
1530  edm::LogError("TriggerMenuXmlParser") << " condMu objects: nrObj = " << nrObj
1531  << "condMu.objectRequirements().objectRequirement().size() = "
1532  << condMu.objectRequirements().objectRequirement().size()
1533  << std::endl;
1534  return false;
1535  }
1536 
1537 
1538  std::string str_chargeCorrelation = l1t2string( condMu.requestedChargeCorr() );
1539 
1540  unsigned int chargeCorrelation = 0;
1541  if( str_chargeCorrelation=="ig" ) chargeCorrelation = 1;
1542  else if( str_chargeCorrelation=="ls" ) chargeCorrelation = 2;
1543  else if( str_chargeCorrelation=="os" ) chargeCorrelation = 4;
1544 
1545  //getXMLHexTextValue("1", dst);
1546  corrParameter.chargeCorrelation = chargeCorrelation;//tmpValues[0];
1547 
1548  std::string str_condMu = "";
1549  boost::uint64_t tempUIntH, tempUIntL;
1550  boost::uint64_t dst;
1551  int cnt = 0;
1552  for( l1t::MuonObjectRequirements::objectRequirement_const_iterator objPar = condMu.objectRequirements().objectRequirement().begin();
1553  objPar != condMu.objectRequirements().objectRequirement().end(); ++objPar ){
1554 
1555  // ET Threshold
1556  str_condMu = l1t2string( objPar->ptThreshold() );
1557  if( !getXMLHexTextValue(str_condMu, dst) ) return false;
1558  //if( cnt<nrObj ) objParameter[cnt].etThreshold = dst;
1560  if( cnt<nrObj ){
1561  objParameter[cnt].ptHighThreshold = objPar->ptThreshold();
1562  objParameter[cnt].ptLowThreshold = objPar->ptThreshold();
1563  }
1564 
1565  // Eta Range
1566  //str_condMu = "ffff";
1567  str_condMu = "7f7f";
1568  //str_condMu = "0f0f";
1569  if( !getXMLHexTextValue(str_condMu, dst) ) return false;
1570  if( cnt<nrObj ) objParameter[cnt].etaRange = dst;
1571 
1572  // Phi Range
1573  str_condMu = "3ffff";
1574  if( !getXMLHexTextValue(str_condMu, dst) ) return false;
1575  //if( cnt<nrObj ) objParameter[cnt].phiRange = dst;
1576  getXMLHexTextValue("8f", dst);
1577  objParameter[cnt].phiHigh = dst;//tmpValues[i];
1578  objParameter[cnt].phiLow = dst;//tmpValues[i];
1579 
1580  objParameter[cnt].enableMip = false;//tmpMip[i];
1581  objParameter[cnt].enableIso = false;//tmpEnableIso[i];
1582  objParameter[cnt].requestIso = false;//tmpRequestIso[i];
1583 
1584  std::string str_charge = l1t2string( objPar->requestedCharge() );
1585  int charge = 0;
1586  if( str_charge=="ign" ) charge = -1;
1587  else if( str_charge=="pos" ) charge = 0;
1588  else if( str_charge=="neg" ) charge = 1;
1589 
1590  objParameter[cnt].charge = charge;
1591 
1592  int cntQual=0;
1593  int qualityLUT = 0;
1594  for( l1t::MuonQualityLUT::quality_const_iterator iQualFlag = objPar->qualityLut().quality().begin();
1595  iQualFlag != objPar->qualityLut().quality().end(); ++iQualFlag ){
1596 
1597  bool flag = (*iQualFlag);
1598 
1599  qualityLUT |= (flag << cntQual);
1600 
1601  LogDebug("l1t|Global")
1602  << "\n quality flag " << cntQual << " = " << flag
1603  << "\n qualityLUT = " << qualityLUT
1604  << std::endl;
1605 
1606  cntQual++;
1607  }
1608 
1609  objParameter[cnt].qualityLUT = qualityLUT;
1610 
1611 
1612  int cntIso=0;
1613  int isolationLUT = 0;
1614  for( l1t::MuonIsolationLUT::isolation_const_iterator iIsoFlag = objPar->isolationLut().isolation().begin();
1615  iIsoFlag != objPar->isolationLut().isolation().end(); ++iIsoFlag ){
1616 
1617  bool flag = (*iIsoFlag);
1618 
1619  isolationLUT |= (flag << cntIso);
1620 
1621  LogDebug("l1t|Global")
1622  << "\n isolation flag " << cntIso << " = " << flag
1623  << "\n isolationLUT = " << isolationLUT
1624  << std::endl;
1625 
1626  cntIso++;
1627  }
1628 
1629  objParameter[cnt].isolationLUT = isolationLUT;
1630 
1631 
1632  int cntEta=0;
1633  unsigned int etaWindowLower=-1, etaWindowUpper=-1, etaWindowVetoLower=-1, etaWindowVetoUpper=-1;
1634  // Temporary before translation
1635  for( l1t::MuonObjectRequirement::etaWindow_const_iterator etaWindow =objPar->etaWindow().begin();
1636  etaWindow != objPar->etaWindow().end(); ++etaWindow ){
1637 
1638  LogDebug("l1t|Global")
1639  << "\n etaWindow lower = " << etaWindow->lower()
1640  << "\n etaWindow upper = " << etaWindow->upper()
1641  << std::endl;
1642  if( cntEta==0 ){ etaWindowLower = etaWindow->lower(); etaWindowUpper = etaWindow->upper(); }
1643  else if( cntEta==1 ){ etaWindowVetoLower = etaWindow->lower(); etaWindowVetoUpper = etaWindow->upper(); }
1644  cntEta++;
1645  }
1646 
1647  int cntPhi=0;
1648  unsigned int phiWindowLower=-1, phiWindowUpper=-1, phiWindowVetoLower=-1, phiWindowVetoUpper=-1;
1649  for( l1t::MuonObjectRequirement::phiWindow_const_iterator phiWindow =objPar->phiWindow().begin();
1650  phiWindow != objPar->phiWindow().end(); ++phiWindow ){
1651 
1652  LogDebug("l1t|Global")
1653  << "\n phiWindow begin = " << phiWindow->lower()
1654  << "\n phiWindow end = " << phiWindow->upper()
1655  << std::endl;
1656 
1657  if( cntPhi==0 ){ phiWindowLower = phiWindow->lower(); phiWindowUpper = phiWindow->upper(); }
1658  else if( cntPhi==1 ){ phiWindowVetoLower = phiWindow->lower(); phiWindowVetoUpper = phiWindow->upper(); }
1659  cntPhi++;
1660  }
1661 
1662  objParameter[cnt].etaWindowLower = etaWindowLower;
1663  objParameter[cnt].etaWindowUpper = etaWindowUpper;
1664  objParameter[cnt].etaWindowVetoLower = etaWindowVetoLower;
1665  objParameter[cnt].etaWindowVetoUpper = etaWindowVetoUpper;
1666 
1667  objParameter[cnt].phiWindowLower = phiWindowLower;
1668  objParameter[cnt].phiWindowUpper = phiWindowUpper;
1669  objParameter[cnt].phiWindowVetoLower = phiWindowVetoLower;
1670  objParameter[cnt].phiWindowVetoUpper = phiWindowVetoUpper;
1671 
1672 
1673  // Output for debugging
1674  LogDebug("l1t|Global")
1675  << "\n Muon PT high threshold (hex) for muon object " << cnt << " = "
1676  << std::hex << objParameter[cnt].ptHighThreshold << std::dec
1677  << "\n etaWindow (hex) for muon object " << cnt << " = "
1678  << std::hex << objParameter[cnt].etaRange << std::dec
1679  // << "\n phiRange (hex) for muon object " << cnt << " = "
1680  // << std::hex << objParameter[cnt].phiRange << std::dec
1681  << "\n etaWindow Lower / Upper for muon object " << cnt << " = "
1682  << objParameter[cnt].etaWindowLower << " / " << objParameter[cnt].etaWindowUpper
1683  << "\n etaWindowVeto Lower / Upper for muon object " << cnt << " = "
1684  << objParameter[cnt].etaWindowVetoLower << " / " << objParameter[cnt].etaWindowVetoUpper
1685  << "\n phiWindow Lower / Upper for muon object " << cnt << " = "
1686  << objParameter[cnt].phiWindowLower << " / " << objParameter[cnt].phiWindowUpper
1687  << "\n phiWindowVeto Lower / Upper for muon object " << cnt << " = "
1688  << objParameter[cnt].phiWindowVetoLower << " / " << objParameter[cnt].phiWindowVetoUpper
1689  << std::endl;
1690 
1691  cnt++;
1692  }
1693 
1694 
1695 
1696  // indicates if a correlation is used
1697  bool wscVal = (type == m_xmlConditionAttrType2wsc );
1698 
1699  if( wscVal ){
1700 
1701  xsd::cxx::tree::optional<l1t::DeltaRequirement> condRanges = condMu.deltaRequirement();
1702  LogDebug("l1t|Global")
1703  << "\t condRanges->deltaEtaRange().lower() = " << condRanges->deltaEtaRange().lower()
1704  << "\n\t condRanges->deltaEtaRange().upper() = " << condRanges->deltaEtaRange().upper()
1705  << "\n\t condRanges->deltaPhiRange().lower() = " << condRanges->deltaPhiRange().lower()
1706  << "\n\t condRanges->deltaPhiRange().upper() = " << condRanges->deltaPhiRange().upper()
1707  << std::endl;
1708 
1709  corrParameter.deltaEtaRangeLower = condRanges->deltaEtaRange().lower();
1710  corrParameter.deltaEtaRangeUpper = condRanges->deltaEtaRange().upper();
1711 
1712  corrParameter.deltaPhiRangeLower = condRanges->deltaPhiRange().lower();
1713  corrParameter.deltaPhiRangeUpper = condRanges->deltaPhiRange().upper();
1714 
1715  //
1717  //
1718 
1719  // Eta Range
1720  str_condMu = "0003";
1721  if ( !hexString2UInt128(str_condMu, tempUIntL, tempUIntH) ) {
1722  return false;
1723  }
1724  if( tempUIntH != 0 ){
1725  edm::LogError("TriggerMenuXmlParser") << "Too large hex-value!" << std::endl;
1726  return false;
1727  }
1728  corrParameter.deltaEtaRange = tempUIntL;
1729 
1730  // Phi Range
1731  str_condMu = "003";
1732  if ( !hexString2UInt128(str_condMu, tempUIntL, tempUIntH) ) {
1733  return false;
1734  }
1735  if( tempUIntH != 0 ){
1736  edm::LogError("TriggerMenuXmlParser") << "Too large hex-value!" << std::endl;
1737  return false;
1738  }
1739  corrParameter.deltaPhiRange = tempUIntL;
1740 
1741 
1742 
1743  // Max Phi Range
1744  std::string maxString = "3FF";
1745 
1746  unsigned int maxbits = 0;
1747 
1748  if ( !countConditionChildMaxBits(maxString, maxbits) ) {
1749  return false;
1750  }
1751 
1752  corrParameter.deltaPhiMaxbits = maxbits;
1753  LogTrace("TriggerMenuXmlParser")
1754  << " deltaPhiMaxbits (dec) = " << maxbits
1755  << std::endl;
1756  }
1757 
1758 
1759  // get the type of the condition, as defined in enum, from the condition type
1760  // as defined in the XML file
1761  GtConditionType cType = getTypeFromType(type);
1762  //LogTrace("TriggerMenuXmlParser")
1763  //<< " Condition type (enum value) = " << cType
1764  //<< std::endl;
1765 
1766  if (cType == l1t::TypeNull) {
1767  edm::LogError("TriggerMenuXmlParser")
1768  << "Type for muon condition id l1t::TypeNull - it means not defined in the XML file."
1769  << "\nNumber of trigger objects is set to zero. " << std::endl;
1770  return false;
1771  }
1772 
1773  // object types - all muons
1774  std::vector<L1GtObject> objType(nrObj, Mu);
1775 
1777 
1778  int relativeBx = l1t2int( condMu.relativeBx() );
1779 
1781  // now create a new CondMuonition
1782 
1783  MuonTemplate muonCond(name);
1784 
1785  muonCond.setCondType(cType);
1786  muonCond.setObjectType(objType);
1787  muonCond.setCondGEq(gEq);
1788  muonCond.setCondChipNr(chipNr);
1789  muonCond.setCondRelativeBx(relativeBx);
1790 
1791  muonCond.setConditionParameter(objParameter, corrParameter);
1792 
1793  if (edm::isDebugEnabled()) {
1794  std::ostringstream myCoutStream;
1795  muonCond.print(myCoutStream);
1796  LogTrace("TriggerMenuXmlParser") << myCoutStream.str() << "\n" << std::endl;
1797  }
1798 
1799  // insert condition into the map and into muon template vector
1800  if ( !insertConditionIntoMap(muonCond, chipNr)) {
1801  edm::LogError("TriggerMenuXmlParser")
1802  << " Error: duplicate condition (" << name << ")"
1803  << std::endl;
1804  return false;
1805  }
1806  else {
1807  if (corrFlag) {
1808  (m_corMuonTemplate[chipNr]).push_back(muonCond);
1809  }
1810  else {
1811  (m_vecMuonTemplate[chipNr]).push_back(muonCond);
1812  }
1813 
1814  }
1815 
1816 
1817  LogDebug("l1t|Global")
1818  << "\n intGEq = " << intGEq
1819  << " nrObj = " << nrObj
1820  << "\n ****************************************** "
1821  << std::endl;
1822 
1823  //
1824  return true;
1825 }
1826 
1838 bool l1t::TriggerMenuXmlParser::parseCalo(l1t::CalorimeterCondition condCalo,
1839  unsigned int chipNr, const bool corrFlag) {
1840 
1841  XERCES_CPP_NAMESPACE_USE
1842 
1843  // get condition, particle name and type name
1844 
1845  std::string condition = "calo";
1846  std::string particle = l1t2string( condCalo.objectType() );
1847  std::string type = l1t2string( condCalo.type() );
1848  std::string name = l1t2string( condCalo.name() );
1849 
1850  LogDebug("l1t|Global")
1851  << "\n ****************************************** "
1852  << "\n DARRENS TEST OUTPUT (in parseCalo) "
1853  << "\n condition = " << condition
1854  << "\n particle = " << particle
1855  << "\n type = " << type
1856  << "\n name = " << name
1857  << std::endl;
1858 
1859 
1860  // determine object type type
1861  L1GtObject caloObjType;
1862 
1863  if (particle == m_xmlConditionAttrObjectNoIsoEG) {
1864  caloObjType = NoIsoEG;
1865  }
1866  else if (particle == m_xmlConditionAttrObjectIsoEG) {
1867  caloObjType = IsoEG;
1868  }
1869  else if (particle == m_xmlConditionAttrObjectCenJet) {
1870  caloObjType = CenJet;
1871  }
1872  else if (particle == m_xmlConditionAttrObjectTauJet) {
1873  caloObjType = TauJet;
1874  }
1875  else if (particle == m_xmlConditionAttrObjectForJet) {
1876  caloObjType = ForJet;
1877  }
1878  else {
1879  edm::LogError("TriggerMenuXmlParser") << "Wrong particle for calo-condition ("
1880  << particle << ")" << std::endl;
1881  return false;
1882  }
1883 
1884  if( type=="double_wsc" ) type = "2_wsc";
1885  else if( type=="single" ) type = "1_s";
1886  else if( type=="double" ) type = "2_s";
1887  else if( type=="triple" ) type = "3";
1888  else if( type=="quad" ) type = "4";
1889 
1890 
1891  std::string str_etComparison = l1t2string( condCalo.comparison_operator() );
1892 
1893  int nrObj = getNumFromType(type);
1894  if (nrObj < 0) {
1895  edm::LogError("TriggerMenuXmlParser") << "Unknown type for calo-condition (" << type
1896  << ")" << "\nCan not determine number of trigger objects. " << std::endl;
1897  return false;
1898  }
1899 
1900  // get greater equal flag
1901  int intGEq = ( str_etComparison=="ge" ) ? 1 : 0;
1902  if (intGEq < 0) {
1903  edm::LogError("TriggerMenuXmlParser") << "Error getting \"greater or equal\" flag"
1904  << std::endl;
1905  return false;
1906  }
1907  // set the boolean value for the ge_eq mode
1908  bool gEq = (intGEq != 0);
1909 
1910  // get values
1911 
1912  // temporary storage of the parameters
1913  std::vector<CaloTemplate::ObjectParameter> objParameter(nrObj);
1914  CaloTemplate::CorrelationParameter corrParameter;
1915 
1916  // need at least one value for deltaPhiRange
1917  std::vector<boost::uint64_t> tmpValues((nrObj > 1) ? nrObj : 1);
1918  tmpValues.reserve( nrObj );
1919 
1920  if( int(condCalo.objectRequirements().objectRequirement().size())!=nrObj ){
1921  edm::LogError("TriggerMenuXmlParser") << " condCalo objects: nrObj = " << nrObj
1922  << "condCalo.objectRequirements().objectRequirement().size() = "
1923  << condCalo.objectRequirements().objectRequirement().size()
1924  << std::endl;
1925  return false;
1926  }
1927 
1928 
1929  std::string str_condCalo = "";
1930  boost::uint64_t tempUIntH, tempUIntL;
1931  boost::uint64_t dst;
1932  int cnt = 0;
1933  for( l1t::CalorimeterObjectRequirements::objectRequirement_const_iterator objPar = condCalo.objectRequirements().objectRequirement().begin();
1934  objPar != condCalo.objectRequirements().objectRequirement().end(); ++objPar ){
1935 
1936  // ET Threshold
1937  str_condCalo = l1t2string( objPar->etThreshold() );
1938  if( !getXMLHexTextValue(str_condCalo, dst) ) return false;
1939  //if( cnt<nrObj ) objParameter[cnt].etThreshold = dst;
1941  if( cnt<nrObj ) objParameter[cnt].etThreshold = objPar->etThreshold();
1942 
1943  // Eta Range
1944  //str_condCalo = "ffff";
1945  str_condCalo = "7f7f";
1946  //str_condCalo = "0f0f";
1947  if( !getXMLHexTextValue(str_condCalo, dst) ) return false;
1948  if( cnt<nrObj ) objParameter[cnt].etaRange = dst;
1949 
1950  // Phi Range
1951  str_condCalo = "3ffff";
1952  if( !getXMLHexTextValue(str_condCalo, dst) ) return false;
1953  if( cnt<nrObj ) objParameter[cnt].phiRange = dst;
1954 
1955 
1956  int cntIso=0;
1957  int isolationLUT = 0;
1958  for( l1t::CalorimeterIsolationLUT::isolation_const_iterator iIsoFlag = objPar->isolationLut().isolation().begin();
1959  iIsoFlag != objPar->isolationLut().isolation().end(); ++iIsoFlag ){
1960 
1961  bool flag = (*iIsoFlag);
1962 
1963  isolationLUT |= (flag << cntIso);
1964 
1965  LogDebug("l1t|Global")
1966  << "\n isolation flag " << cntIso << " = " << flag
1967  << "\n isolationLUT = " << isolationLUT
1968  << std::endl;
1969 
1970  cntIso++;
1971  }
1972 
1973  objParameter[cnt].isolationLUT = isolationLUT;
1974 
1975 
1976  int cntEta=0;
1977  unsigned int etaWindowLower=-1, etaWindowUpper=-1, etaWindowVetoLower=-1, etaWindowVetoUpper=-1;
1978  // Temporary before translation
1979  for( l1t::CalorimeterObjectRequirement::etaWindow_const_iterator etaWindow =objPar->etaWindow().begin();
1980  etaWindow != objPar->etaWindow().end(); ++etaWindow ){
1981 
1982  LogDebug("l1t|Global")
1983  << "\n etaWindow lower = " << etaWindow->lower()
1984  << "\n etaWindow upper = " << etaWindow->upper()
1985  << std::endl;
1986  if( cntEta==0 ){ etaWindowLower = etaWindow->lower(); etaWindowUpper = etaWindow->upper(); }
1987  else if( cntEta==1 ){ etaWindowVetoLower = etaWindow->lower(); etaWindowVetoUpper = etaWindow->upper(); }
1988  cntEta++;
1989  }
1990 
1991  int cntPhi=0;
1992  unsigned int phiWindowLower=-1, phiWindowUpper=-1, phiWindowVetoLower=-1, phiWindowVetoUpper=-1;
1993  for( l1t::CalorimeterObjectRequirement::phiWindow_const_iterator phiWindow =objPar->phiWindow().begin();
1994  phiWindow != objPar->phiWindow().end(); ++phiWindow ){
1995 
1996  LogDebug("l1t|Global")
1997  << "\n phiWindow begin = " << phiWindow->lower()
1998  << "\n phiWindow end = " << phiWindow->upper()
1999  << std::endl;
2000 
2001  if( cntPhi==0 ){ phiWindowLower = phiWindow->lower(); phiWindowUpper = phiWindow->upper(); }
2002  else if( cntPhi==1 ){ phiWindowVetoLower = phiWindow->lower(); phiWindowVetoUpper = phiWindow->upper(); }
2003  cntPhi++;
2004  }
2005 
2006  objParameter[cnt].etaWindowLower = etaWindowLower;
2007  objParameter[cnt].etaWindowUpper = etaWindowUpper;
2008  objParameter[cnt].etaWindowVetoLower = etaWindowVetoLower;
2009  objParameter[cnt].etaWindowVetoUpper = etaWindowVetoUpper;
2010 
2011  objParameter[cnt].phiWindowLower = phiWindowLower;
2012  objParameter[cnt].phiWindowUpper = phiWindowUpper;
2013  objParameter[cnt].phiWindowVetoLower = phiWindowVetoLower;
2014  objParameter[cnt].phiWindowVetoUpper = phiWindowVetoUpper;
2015 
2016 
2017  // Output for debugging
2018  LogDebug("l1t|Global")
2019  << "\n Calo ET high threshold (hex) for calo object " << cnt << " = "
2020  << std::hex << objParameter[cnt].etThreshold << std::dec
2021  << "\n etaWindow (hex) for calo object " << cnt << " = "
2022  << std::hex << objParameter[cnt].etaRange << std::dec
2023  << "\n phiRange (hex) for calo object " << cnt << " = "
2024  << std::hex << objParameter[cnt].phiRange << std::dec
2025  << "\n etaWindow Lower / Upper for calo object " << cnt << " = "
2026  << objParameter[cnt].etaWindowLower << " / " << objParameter[cnt].etaWindowUpper
2027  << "\n etaWindowVeto Lower / Upper for calo object " << cnt << " = "
2028  << objParameter[cnt].etaWindowVetoLower << " / " << objParameter[cnt].etaWindowVetoUpper
2029  << "\n phiWindow Lower / Upper for calo object " << cnt << " = "
2030  << objParameter[cnt].phiWindowLower << " / " << objParameter[cnt].phiWindowUpper
2031  << "\n phiWindowVeto Lower / Upper for calo object " << cnt << " = "
2032  << objParameter[cnt].phiWindowVetoLower << " / " << objParameter[cnt].phiWindowVetoUpper
2033  << std::endl;
2034 
2035  cnt++;
2036  }
2037 
2038 
2039 
2040  // indicates if a correlation is used
2041  bool wscVal = (type == m_xmlConditionAttrType2wsc );
2042 
2043  if( wscVal ){
2044 
2045  xsd::cxx::tree::optional<l1t::DeltaRequirement> condRanges = condCalo.deltaRequirement();
2046  LogDebug("l1t|Global")
2047  << "\t condRanges->deltaEtaRange().lower() = " << condRanges->deltaEtaRange().lower()
2048  << "\n\t condRanges->deltaEtaRange().upper() = " << condRanges->deltaEtaRange().upper()
2049  << "\n\t condRanges->deltaPhiRange().lower() = " << condRanges->deltaPhiRange().lower()
2050  << "\n\t condRanges->deltaPhiRange().upper() = " << condRanges->deltaPhiRange().upper()
2051  << std::endl;
2052 
2053  corrParameter.deltaEtaRangeLower = condRanges->deltaEtaRange().lower();
2054  corrParameter.deltaEtaRangeUpper = condRanges->deltaEtaRange().upper();
2055 
2056  corrParameter.deltaPhiRangeLower = condRanges->deltaPhiRange().lower();
2057  corrParameter.deltaPhiRangeUpper = condRanges->deltaPhiRange().upper();
2058 
2059  //
2061  //
2062 
2063  // Eta Range
2064  str_condCalo = "0003";
2065  if ( !hexString2UInt128(str_condCalo, tempUIntL, tempUIntH) ) {
2066  return false;
2067  }
2068  if( tempUIntH != 0 ){
2069  edm::LogError("TriggerMenuXmlParser") << "Too large hex-value!" << std::endl;
2070  return false;
2071  }
2072  corrParameter.deltaEtaRange = tempUIntL;
2073 
2074  // Phi Range
2075  str_condCalo = "003";
2076  if ( !hexString2UInt128(str_condCalo, tempUIntL, tempUIntH) ) {
2077  return false;
2078  }
2079  if( tempUIntH != 0 ){
2080  edm::LogError("TriggerMenuXmlParser") << "Too large hex-value!" << std::endl;
2081  return false;
2082  }
2083  corrParameter.deltaPhiRange = tempUIntL;
2084 
2085 
2086 
2087  // Max Phi Range
2088  std::string maxString = "3FF";
2089 
2090  unsigned int maxbits = 0;
2091 
2092  if ( !countConditionChildMaxBits(maxString, maxbits) ) {
2093  return false;
2094  }
2095 
2096  corrParameter.deltaPhiMaxbits = maxbits;
2097  LogTrace("TriggerMenuXmlParser")
2098  << " deltaPhiMaxbits (dec) = " << maxbits
2099  << std::endl;
2100  }
2101 
2102 
2103 
2104  // get the type of the condition, as defined in enum, from the condition type
2105  // as defined in the XML file
2106  GtConditionType cType = getTypeFromType(type);
2107  LogTrace("TriggerMenuXmlParser")
2108  << " Condition type (enum value) = " << cType
2109  << std::endl;
2110 
2111  if (cType == l1t::TypeNull) {
2112  edm::LogError("TriggerMenuXmlParser")
2113  << "Type for calo condition id l1t::TypeNull - it means not defined in the XML file."
2114  << "\nNumber of trigger objects is set to zero. " << std::endl;
2115  return false;
2116  }
2117 
2118  // object types - all same caloObjType
2119  std::vector<L1GtObject> objType(nrObj, caloObjType);
2120 
2121 
2122  int relativeBx = l1t2int( condCalo.relativeBx() );
2123 
2124  // now create a new calo condition
2125  CaloTemplate caloCond(name);
2126 
2127  caloCond.setCondType(cType);
2128  caloCond.setObjectType(objType);
2129  caloCond.setCondGEq(gEq);
2130  caloCond.setCondChipNr(chipNr);
2131  caloCond.setCondRelativeBx(relativeBx);
2132 
2133  caloCond.setConditionParameter(objParameter, corrParameter);
2134 
2135  if (edm::isDebugEnabled() ) {
2136 
2137  std::ostringstream myCoutStream;
2138  caloCond.print(myCoutStream);
2139  LogTrace("TriggerMenuXmlParser") << myCoutStream.str() << "\n" << std::endl;
2140 
2141  }
2142 
2143  // insert condition into the map
2144  if ( !insertConditionIntoMap(caloCond, chipNr)) {
2145 
2146  edm::LogError("TriggerMenuXmlParser")
2147  << " Error: duplicate condition (" << name << ")"
2148  << std::endl;
2149 
2150  return false;
2151  }
2152  else {
2153 
2154  if (corrFlag) {
2155  (m_corCaloTemplate[chipNr]).push_back(caloCond);
2156  }
2157  else {
2158  (m_vecCaloTemplate[chipNr]).push_back(caloCond);
2159  }
2160 
2161  }
2162 
2163  LogDebug("l1t|Global")
2164  << "\n intGEq = " << intGEq
2165  << " nrObj = " << nrObj
2166  << "\n ****************************************** "
2167  << std::endl;
2168 
2169 
2170  //
2171  return true;
2172 }
2173 
2185 bool l1t::TriggerMenuXmlParser::parseEnergySum(l1t::EnergySumsCondition condEnergySum,
2186  unsigned int chipNr, const bool corrFlag) {
2187 
2188  XERCES_CPP_NAMESPACE_USE
2189 
2190  // get condition, particle name and type name
2191 
2192  std::string condition = "calo";
2193  std::string type = l1t2string( condEnergySum.objectType() );
2194  std::string name = l1t2string( condEnergySum.name() );
2195 
2196  LogDebug("l1t|Global")
2197  << "\n ****************************************** "
2198  << "\n DARRENS TEST OUTPUT (in parseEnergySum) "
2199  << "\n condition = " << condition
2200  << "\n type = " << type
2201  << "\n name = " << name
2202  << std::endl;
2203 
2204  // determine object type type
2205  L1GtObject energySumObjType;
2206  GtConditionType cType;
2207 
2208  if( type == m_xmlConditionAttrObjectETM ){
2209  energySumObjType = ETM;
2210  cType = TypeETM;
2211  }
2212  else if( type == m_xmlConditionAttrObjectETT ){
2213  energySumObjType = ETT;
2214  cType = TypeETT;
2215  }
2216  else if( type == m_xmlConditionAttrObjectHTT ){
2217  energySumObjType = HTT;
2218  cType = TypeHTT;
2219  }
2220  else if( type == m_xmlConditionAttrObjectHTM ){
2221  energySumObjType = HTM;
2222  cType = TypeHTM;
2223  }
2224  else {
2225  edm::LogError("TriggerMenuXmlParser")
2226  << "Wrong type for energy-sum condition (" << type
2227  << ")" << std::endl;
2228  return false;
2229  }
2230 
2231 
2232 
2233  // global object
2234  int nrObj = 1;
2235 
2236  std::string str_etComparison = l1t2string( condEnergySum.comparison_operator() );
2237 
2238  // get greater equal flag
2239  int intGEq = ( str_etComparison=="ge" ) ? 1 : 0;
2240  if( intGEq < 0 ){
2241  edm::LogError("TriggerMenuXmlParser")
2242  << "Error getting \"greater or equal\" flag"
2243  << std::endl;
2244  return false;
2245  }
2246  // set the boolean value for the ge_eq mode
2247  bool gEq = (intGEq != 0);
2248 
2249 
2250  // get values
2251 
2252  // temporary storage of the parameters
2253  std::vector<EnergySumTemplate::ObjectParameter> objParameter(nrObj);
2254 
2255 
2256  int cnt = 0;
2257 
2258  l1t::EnergySumsObjectRequirement objPar = condEnergySum.objectRequirement();
2259 
2260  // ET Threshold
2261  objParameter[cnt].etThreshold = objPar.etThreshold();
2262 
2263  int cntPhi=0;
2264  unsigned int phiWindowLower=-1, phiWindowUpper=-1, phiWindowVetoLower=-1, phiWindowVetoUpper=-1;
2265  for( l1t::EnergySumsObjectRequirement::phiWindow_const_iterator phiWindow =objPar.phiWindow().begin();
2266  phiWindow != objPar.phiWindow().end(); ++phiWindow ){
2267 
2268  LogDebug("l1t|Global")
2269  << "\n phiWindow begin = " << phiWindow->lower()
2270  << "\n phiWindow end = " << phiWindow->upper()
2271  << std::endl;
2272 
2273  if( cntPhi==0 ){ phiWindowLower = phiWindow->lower(); phiWindowUpper = phiWindow->upper(); }
2274  else if( cntPhi==1 ){ phiWindowVetoLower = phiWindow->lower(); phiWindowVetoUpper = phiWindow->upper(); }
2275  cntPhi++;
2276  }
2277 
2278  objParameter[cnt].phiWindowLower = phiWindowLower;
2279  objParameter[cnt].phiWindowUpper = phiWindowUpper;
2280  objParameter[cnt].phiWindowVetoLower = phiWindowVetoLower;
2281  objParameter[cnt].phiWindowVetoUpper = phiWindowVetoUpper;
2282 
2283 
2284  // Output for debugging
2285  LogDebug("l1t|Global")
2286  << "\n EnergySum ET high threshold (hex) for energy sum object " << cnt << " = "
2287  << std::hex << objParameter[cnt].etThreshold << std::dec
2288  << "\n phiWindow Lower / Upper for calo object " << cnt << " = "
2289  << objParameter[cnt].phiWindowLower << " / " << objParameter[cnt].phiWindowUpper
2290  << "\n phiWindowVeto Lower / Upper for calo object " << cnt << " = "
2291  << objParameter[cnt].phiWindowVetoLower << " / " << objParameter[cnt].phiWindowVetoUpper
2292  << std::endl;
2293 
2294 
2295 
2296 
2297  int relativeBx = l1t2int( condEnergySum.relativeBx() );
2298 
2299  // object types - all same energySumObjType
2300  std::vector<L1GtObject> objType(nrObj, energySumObjType);
2301 
2302  // now create a new energySum condition
2303 
2304  EnergySumTemplate energySumCond(name);
2305 
2306  energySumCond.setCondType(cType);
2307  energySumCond.setObjectType(objType);
2308  energySumCond.setCondGEq(gEq);
2309  energySumCond.setCondChipNr(chipNr);
2310  energySumCond.setCondRelativeBx(relativeBx);
2311 
2312  energySumCond.setConditionParameter(objParameter);
2313 
2314  if (edm::isDebugEnabled() ) {
2315 
2316  std::ostringstream myCoutStream;
2317  energySumCond.print(myCoutStream);
2318  LogTrace("TriggerMenuXmlParser") << myCoutStream.str() << "\n" << std::endl;
2319 
2320  }
2321 
2322  // insert condition into the map
2323  if ( !insertConditionIntoMap(energySumCond, chipNr)) {
2324 
2325  edm::LogError("TriggerMenuXmlParser")
2326  << " Error: duplicate condition (" << name << ")"
2327  << std::endl;
2328 
2329  return false;
2330  }
2331  else {
2332 
2333  if (corrFlag) {
2334  (m_corEnergySumTemplate[chipNr]).push_back(energySumCond);
2335 
2336  }
2337  else {
2338  (m_vecEnergySumTemplate[chipNr]).push_back(energySumCond);
2339  }
2340 
2341  }
2342 
2343 
2344 
2345  /*
2346 
2347 
2348 
2349  // need at least two values for phi
2350  std::vector<boost::uint64_t> tmpValues((nrObj > 2) ? nrObj : 2);
2351 
2352  // get etThreshold values and fill into structure
2353  if ( !getConditionChildValuesOld(node, m_xmlTagEtThreshold, nrObj, tmpValues) ) {
2354  return false;
2355  }
2356 
2357  for (int i = 0; i < nrObj; i++) {
2358  objParameter[i].etThreshold = tmpValues[i];
2359 
2360  //LogTrace("TriggerMenuXmlParser")
2361  //<< " EnergySum ET high threshold (hex) for energySum object " << i << " = "
2362  //<< std::hex << objParameter[i].etThreshold << std::dec
2363  //<< std::endl;
2364 
2365  // for ETM and HTM read phi value
2366  // phi is larger than 64 bits for ETM - it needs two 64bits words
2367  // phi is less than 64 bits for HTM - it needs one 64bits word
2368  if (energySumObjType == ETM) {
2369 
2370  if (!getXMLHexTextValue128Old(
2371  findXMLChild(node->getFirstChild(), m_xmlTagPhi), tmpValues[0], tmpValues[1])) {
2372  edm::LogError("TriggerMenuXmlParser")
2373  << " Could not get phi for ETM condition (" << name << ")" << std::endl;
2374  return false;
2375  }
2376 
2377  objParameter[i].phiRange0Word = tmpValues[0];
2378  objParameter[i].phiRange1Word = tmpValues[1];
2379 
2380  } else if (energySumObjType == HTM) {
2381 
2382  if (!getXMLHexTextValueOld(findXMLChild(node->getFirstChild(), m_xmlTagPhi), tmpValues[0])) {
2383  edm::LogError("TriggerMenuXmlParser")
2384  << " Could not get phi for HTM condition (" << name << ")" << std::endl;
2385  return false;
2386  }
2387 
2388  objParameter[i].phiRange0Word = tmpValues[0];
2389 
2390  }
2391 
2392  // get energyOverflow logical flag and fill into structure
2393  DOMNode* n1;
2394  if ( (n1 = findXMLChild(node->getFirstChild(), m_xmlTagEtThreshold)) == 0) {
2395  edm::LogError("TriggerMenuXmlParser")
2396  << " Could not get energyOverflow for EnergySum condition (" << name << ")"
2397  << std::endl;
2398  return false;
2399  }
2400  if ( (n1 = findXMLChild(n1->getFirstChild(), m_xmlTagEnergyOverflow)) == 0) {
2401  edm::LogError("TriggerMenuXmlParser")
2402  << " Could not get energyOverflow for EnergySum condition (" << name << ")"
2403  << std::endl;
2404  return false;
2405  }
2406 
2407  int tmpInt = getBitFromNode(n1);
2408  if (tmpInt == 0) {
2409  objParameter[i].energyOverflow = false;
2410 
2411  //LogTrace("TriggerMenuXmlParser")
2412  //<< " EnergySum energyOverflow logical flag (hex) = "
2413  //<< std::hex << objParameter[i].energyOverflow << std::dec
2414  //<< std::endl;
2415  }
2416  else if (tmpInt == 1) {
2417  objParameter[i].energyOverflow = true;
2418 
2419  //LogTrace("TriggerMenuXmlParser")
2420  //<< " EnergySum energyOverflow logical flag (hex) = "
2421  //<< std::hex << objParameter[i].energyOverflow << std::dec
2422  //<< std::endl;
2423  }
2424  else {
2425  LogTrace("TriggerMenuXmlParser")
2426  << " EnergySum energyOverflow logical flag (hex) = " << std::hex << tmpInt
2427  << std::dec << " - wrong value! " << std::endl;
2428  return false;
2429  }
2430 
2431  }
2432 
2433  */
2434 
2435  //
2436  return true;
2437 }
2438 
2451 bool l1t::TriggerMenuXmlParser::parseJetCounts(XERCES_CPP_NAMESPACE::DOMNode* node,
2452  const std::string& name, unsigned int chipNr) {
2453 
2454  XERCES_CPP_NAMESPACE_USE
2455 
2456  /*
2457  // get condition, particle name and type name
2458  std::string condition = getXMLAttribute(node, m_xmlConditionAttrCondition);
2459  std::string particle = getXMLAttribute(node, m_xmlConditionAttrObject);
2460  std::string type = getXMLAttribute(node, m_xmlConditionAttrType);
2461 
2462  if (particle != m_xmlConditionAttrObjectJetCounts) {
2463  edm::LogError("TriggerMenuXmlParser") << "Wrong particle for JetCounts condition ("
2464  << particle << ")" << std::endl;
2465  return false;
2466  }
2467 
2468  // object type and condition type
2469  L1GtObject jetCountsObjType = JetCounts;
2470  GtConditionType cType = TypeJetCounts;
2471 
2472  // global object
2473  int nrObj = 1;
2474 
2475  // get greater equal flag
2476 
2477  int intGEq = getGEqFlag(node, m_xmlTagCountThreshold);
2478  if (intGEq < 0) {
2479  edm::LogError("TriggerMenuXmlParser") << "Error getting \"greater or equal\" flag"
2480  << std::endl;
2481  return false;
2482  }
2483  // set the boolean value for the ge_eq mode
2484  bool gEq = (intGEq != 0);
2485 
2486  // get values
2487 
2488  // temporary storage of the parameters
2489  std::vector<L1GtJetCountsTemplate::ObjectParameter> objParameter(nrObj);
2490 
2491  // get countIndex value and fill into structure
2492  // they are expressed in base 10 (values: 0 - m_numberL1JetCounts)
2493  char* endPtr = const_cast<char*>(type.c_str());
2494  long int typeInt = strtol(type.c_str(), &endPtr, 10); // base = 10
2495 
2496  if (*endPtr != 0) {
2497 
2498  LogDebug("TriggerMenuXmlParser") << "Unable to convert " << type << " to dec."
2499  << std::endl;
2500 
2501  return false;
2502  }
2503 
2504  // test if count index is out of range
2505  if ((typeInt < 0) || (typeInt > static_cast<int>(m_numberL1JetCounts))) {
2506  LogDebug("TriggerMenuXmlParser") << "Count index " << typeInt
2507  << " outside range [0, " << m_numberL1JetCounts << "]" << std::endl;
2508 
2509  return false;
2510  }
2511 
2512  objParameter[0].countIndex = static_cast<unsigned int>(typeInt);
2513 
2514  // get count threshold values and fill into structure
2515  std::vector<boost::uint64_t> tmpValues(nrObj);
2516 
2517  if ( !getConditionChildValuesOld(node, m_xmlTagCountThreshold, nrObj, tmpValues) ) {
2518  return false;
2519  }
2520 
2521  for (int i = 0; i < nrObj; i++) {
2522  objParameter[i].countThreshold = tmpValues[i];
2523 
2524  //LogTrace("TriggerMenuXmlParser")
2525  //<< " JetCounts count threshold (hex) for JetCounts object " << i << " = "
2526  //<< std::hex << objParameter[i].countThreshold << std::dec
2527  //<< std::endl;
2528 
2529  // TODO FIXME un-comment when tag available in XML file
2530 
2531  // // get countOverflow logical flag and fill into structure
2532  // DOMNode* n1;
2533  // if ( (n1 = findXMLChild(node->getFirstChild(), m_xmlTagCountThreshold)) == 0) {
2534  // edm::LogError("TriggerMenuXmlParser")
2535  // << " Could not get countOverflow for JetCounts condition ("
2536  // << name << ")"
2537  // << std::endl;
2538  // return false;
2539  // }
2540  // if ( (n1 = findXMLChild(n1->getFirstChild(), m_xmlTagCountThreshold)) == 0) {
2541  // edm::LogError("TriggerMenuXmlParser")
2542  // << " Could not get countOverflow for JetCounts condition ("
2543  // << name << ")"
2544  // << std::endl;
2545  // return false;
2546  // }
2547  //
2548  // int tmpInt = getBitFromNode(n1);
2549  // if (tmpInt == 0) {
2550  // objParameter[i].countOverflow = false;
2551  //
2552  // LogTrace("TriggerMenuXmlParser")
2553  // << " JetCounts countOverflow logical flag (hex) = "
2554  // << std::hex << objParameter[i].countOverflow << std::dec
2555  // << std::endl;
2556  // } else if (tmpInt == 1) {
2557  // objParameter[i].countOverflow = true;
2558  //
2559  // LogTrace("TriggerMenuXmlParser")
2560  // << " JetCounts countOverflow logical flag (hex) = "
2561  // << std::hex << objParameter[i].countOverflow << std::dec
2562  // << std::endl;
2563  // } else {
2564  // LogTrace("TriggerMenuXmlParser")
2565  // << " JetCounts countOverflow logical flag (hex) = "
2566  // << std::hex << tmpInt << std::dec << " - wrong value! "
2567  // << std::endl;
2568  // return false;
2569  // }
2570 
2571  }
2572 
2573  // object types - all same objType
2574  std::vector<L1GtObject> objType(nrObj, jetCountsObjType);
2575 
2576  // now create a new JetCounts condition
2577 
2578  L1GtJetCountsTemplate jetCountsCond(name);
2579 
2580  jetCountsCond.setCondType(cType);
2581  jetCountsCond.setObjectType(objType);
2582  jetCountsCond.setCondGEq(gEq);
2583  jetCountsCond.setCondChipNr(chipNr);
2584 
2585  jetCountsCond.setConditionParameter(objParameter);
2586 
2587  if (edm::isDebugEnabled() ) {
2588 
2589  std::ostringstream myCoutStream;
2590  jetCountsCond.print(myCoutStream);
2591  LogTrace("TriggerMenuXmlParser") << myCoutStream.str() << "\n" << std::endl;
2592 
2593  }
2594 
2595  // insert condition into the map
2596  if ( !insertConditionIntoMap(jetCountsCond, chipNr)) {
2597 
2598  edm::LogError("TriggerMenuXmlParser") << " Error: duplicate condition (" << name
2599  << ")" << std::endl;
2600 
2601  return false;
2602  } else {
2603 
2604  (m_vecJetCountsTemplate[chipNr]).push_back(jetCountsCond);
2605 
2606  }
2607 
2608  */
2609  //
2610  return true;
2611 }
2612 
2625 bool l1t::TriggerMenuXmlParser::parseCastor(XERCES_CPP_NAMESPACE::DOMNode* node,
2626  const std::string& name, unsigned int chipNr) {
2627 
2628  XERCES_CPP_NAMESPACE_USE
2629 
2630  /*
2631  // get condition, particle name and type name
2632  std::string condition = getXMLAttribute(node, m_xmlConditionAttrCondition);
2633  std::string particle = getXMLAttribute(node, m_xmlConditionAttrObject);
2634  std::string type = getXMLAttribute(node, m_xmlConditionAttrType);
2635 
2636  if (particle != m_xmlConditionAttrObjectCastor) {
2637  edm::LogError("TriggerMenuXmlParser")
2638  << "\nError: wrong particle for Castor condition ("
2639  << particle << ")" << std::endl;
2640  return false;
2641  }
2642 
2643  // object type and condition type
2644  // object type - irrelevant for CASTOR conditions
2645  GtConditionType cType = TypeCastor;
2646 
2647  // no objects for CASTOR conditions
2648 
2649  // set the boolean value for the ge_eq mode - irrelevant for CASTOR conditions
2650  bool gEq = false;
2651 
2652  // now create a new CASTOR condition
2653 
2654  L1GtCastorTemplate castorCond(name);
2655 
2656  castorCond.setCondType(cType);
2657  castorCond.setCondGEq(gEq);
2658  castorCond.setCondChipNr(chipNr);
2659 
2660 
2661  if (edm::isDebugEnabled() ) {
2662 
2663  std::ostringstream myCoutStream;
2664  castorCond.print(myCoutStream);
2665  LogTrace("TriggerMenuXmlParser") << myCoutStream.str() << "\n" << std::endl;
2666 
2667  }
2668 
2669  // insert condition into the map
2670  if ( !insertConditionIntoMap(castorCond, chipNr)) {
2671 
2672  edm::LogError("TriggerMenuXmlParser")
2673  << " Error: duplicate condition (" << name
2674  << ")" << std::endl;
2675 
2676  return false;
2677  } else {
2678 
2679  (m_vecCastorTemplate[chipNr]).push_back(castorCond);
2680 
2681  }
2682  */
2683 
2684  //
2685  return true;
2686 }
2687 
2688 
2701 bool l1t::TriggerMenuXmlParser::parseHfBitCounts(XERCES_CPP_NAMESPACE::DOMNode* node,
2702  const std::string& name, unsigned int chipNr) {
2703 
2704  XERCES_CPP_NAMESPACE_USE
2705 
2706  /*
2707  // get condition, particle name and type name
2708  std::string condition = getXMLAttribute(node, m_xmlConditionAttrCondition);
2709  std::string particle = getXMLAttribute(node, m_xmlConditionAttrObject);
2710  std::string type = getXMLAttribute(node, m_xmlConditionAttrType);
2711 
2712  if (particle != m_xmlConditionAttrObjectHfBitCounts) {
2713  edm::LogError("TriggerMenuXmlParser") << "Wrong particle for HfBitCounts condition ("
2714  << particle << ")" << std::endl;
2715  return false;
2716  }
2717 
2718  // object type and condition type
2719  L1GtObject hfBitCountsObjType = HfBitCounts;
2720  GtConditionType cType = TypeHfBitCounts;
2721 
2722  // global object
2723  int nrObj = 1;
2724 
2725  // get greater equal flag
2726 
2727  int intGEq = getGEqFlag(node, m_xmlTagCountThreshold);
2728  if (intGEq < 0) {
2729  edm::LogError("TriggerMenuXmlParser") << "Error getting \"greater or equal\" flag"
2730  << std::endl;
2731  return false;
2732  }
2733  // set the boolean value for the ge_eq mode
2734  bool gEq = (intGEq != 0);
2735 
2736  // get values
2737 
2738  // temporary storage of the parameters
2739  std::vector<L1GtHfBitCountsTemplate::ObjectParameter> objParameter(nrObj);
2740 
2741  // get countIndex value and fill into structure
2742  // they are expressed in base 10
2743  char* endPtr = const_cast<char*>(type.c_str());
2744  long int typeInt = strtol(type.c_str(), &endPtr, 10); // base = 10
2745 
2746  if (*endPtr != 0) {
2747 
2748  LogDebug("TriggerMenuXmlParser") << "Unable to convert " << type << " to dec."
2749  << std::endl;
2750 
2751  return false;
2752  }
2753 
2754  // test if count index is out of range FIXME introduce m_numberL1HfBitCounts?
2755  //if ((typeInt < 0) || (typeInt > static_cast<int>(m_numberL1HfBitCounts))) {
2756  // LogDebug("TriggerMenuXmlParser") << "Count index " << typeInt
2757  // << " outside range [0, " << m_numberL1HfBitCounts << "]" << std::endl;
2758  //
2759  // return false;
2760  //}
2761 
2762  objParameter[0].countIndex = static_cast<unsigned int>(typeInt);
2763 
2764  // get count threshold values and fill into structure
2765  std::vector<boost::uint64_t> tmpValues(nrObj);
2766 
2767  if ( !getConditionChildValuesOld(node, m_xmlTagCountThreshold, nrObj, tmpValues) ) {
2768  return false;
2769  }
2770 
2771  for (int i = 0; i < nrObj; i++) {
2772  objParameter[i].countThreshold = tmpValues[i];
2773 
2774  //LogTrace("TriggerMenuXmlParser")
2775  //<< " HfBitCounts count threshold (hex) for HfBitCounts object " << i << " = "
2776  //<< std::hex << objParameter[i].countThreshold << std::dec
2777  //<< std::endl;
2778 
2779  }
2780 
2781  // object types - all same objType
2782  std::vector<L1GtObject> objType(nrObj, hfBitCountsObjType);
2783 
2784  // now create a new HfBitCounts condition
2785 
2786  L1GtHfBitCountsTemplate hfBitCountsCond(name);
2787 
2788  hfBitCountsCond.setCondType(cType);
2789  hfBitCountsCond.setObjectType(objType);
2790  hfBitCountsCond.setCondGEq(gEq);
2791  hfBitCountsCond.setCondChipNr(chipNr);
2792 
2793  hfBitCountsCond.setConditionParameter(objParameter);
2794 
2795  if (edm::isDebugEnabled() ) {
2796 
2797  std::ostringstream myCoutStream;
2798  hfBitCountsCond.print(myCoutStream);
2799  LogTrace("TriggerMenuXmlParser") << myCoutStream.str() << "\n" << std::endl;
2800 
2801  }
2802 
2803  // insert condition into the map
2804  if ( !insertConditionIntoMap(hfBitCountsCond, chipNr)) {
2805 
2806  edm::LogError("TriggerMenuXmlParser") << " Error: duplicate condition (" << name
2807  << ")" << std::endl;
2808 
2809  return false;
2810  } else {
2811 
2812  (m_vecHfBitCountsTemplate[chipNr]).push_back(hfBitCountsCond);
2813 
2814  }
2815 
2816  */
2817  //
2818  return true;
2819 }
2820 
2821 
2834 bool l1t::TriggerMenuXmlParser::parseHfRingEtSums(XERCES_CPP_NAMESPACE::DOMNode* node,
2835  const std::string& name, unsigned int chipNr) {
2836 
2837  XERCES_CPP_NAMESPACE_USE
2838 
2839  /*
2840  // get condition, particle name and type name
2841  std::string condition = getXMLAttribute(node, m_xmlConditionAttrCondition);
2842  std::string particle = getXMLAttribute(node, m_xmlConditionAttrObject);
2843  std::string type = getXMLAttribute(node, m_xmlConditionAttrType);
2844 
2845  if (particle != m_xmlConditionAttrObjectHfRingEtSums) {
2846  edm::LogError("TriggerMenuXmlParser") << "Wrong particle for HfRingEtSums condition ("
2847  << particle << ")" << std::endl;
2848  return false;
2849  }
2850 
2851  // object type and condition type
2852  L1GtObject hfRingEtSumsObjType = HfRingEtSums;
2853  GtConditionType cType = TypeHfRingEtSums;
2854 
2855  // global object
2856  int nrObj = 1;
2857 
2858  // get greater equal flag
2859 
2860  int intGEq = getGEqFlag(node, m_xmlTagEtThreshold);
2861  if (intGEq < 0) {
2862  edm::LogError("TriggerMenuXmlParser") << "Error getting \"greater or equal\" flag"
2863  << std::endl;
2864  return false;
2865  }
2866  // set the boolean value for the ge_eq mode
2867  bool gEq = (intGEq != 0);
2868 
2869  // get values
2870 
2871  // temporary storage of the parameters
2872  std::vector<L1GtHfRingEtSumsTemplate::ObjectParameter> objParameter(nrObj);
2873 
2874  // get etSumIndex value and fill into structure
2875  // they are expressed in base 10
2876  char* endPtr = const_cast<char*>(type.c_str());
2877  long int typeInt = strtol(type.c_str(), &endPtr, 10); // base = 10
2878 
2879  if (*endPtr != 0) {
2880 
2881  LogDebug("TriggerMenuXmlParser") << "Unable to convert " << type << " to dec."
2882  << std::endl;
2883 
2884  return false;
2885  }
2886 
2887  // test if ET sum index is out of range FIXME introduce m_numberL1HfRingEtSums?
2888  //if ((typeInt < 0) || (typeInt > static_cast<int>(m_numberL1HfRingEtSums))) {
2889  // LogDebug("TriggerMenuXmlParser") << "Count index " << typeInt
2890  // << " outside range [0, " << m_numberL1HfRingEtSums << "]" << std::endl;
2891  //
2892  // return false;
2893  //}
2894 
2895  objParameter[0].etSumIndex = static_cast<unsigned int>(typeInt);
2896 
2897  // get ET sum threshold values and fill into structure
2898  std::vector<boost::uint64_t> tmpValues(nrObj);
2899 
2900  if ( !getConditionChildValuesOld(node, m_xmlTagEtThreshold, nrObj, tmpValues) ) {
2901  return false;
2902  }
2903 
2904  for (int i = 0; i < nrObj; i++) {
2905  objParameter[i].etSumThreshold = tmpValues[i];
2906 
2907  //LogTrace("TriggerMenuXmlParser")
2908  //<< " HfRingEtSums count threshold (hex) for HfRingEtSums object " << i << " = "
2909  //<< std::hex << objParameter[i].etSumThreshold << std::dec
2910  //<< std::endl;
2911 
2912  }
2913 
2914  // object types - all same objType
2915  std::vector<L1GtObject> objType(nrObj, hfRingEtSumsObjType);
2916 
2917  // now create a new HfRingEtSums condition
2918 
2919  L1GtHfRingEtSumsTemplate hfRingEtSumsCond(name);
2920 
2921  hfRingEtSumsCond.setCondType(cType);
2922  hfRingEtSumsCond.setObjectType(objType);
2923  hfRingEtSumsCond.setCondGEq(gEq);
2924  hfRingEtSumsCond.setCondChipNr(chipNr);
2925 
2926  hfRingEtSumsCond.setConditionParameter(objParameter);
2927 
2928  if (edm::isDebugEnabled() ) {
2929 
2930  std::ostringstream myCoutStream;
2931  hfRingEtSumsCond.print(myCoutStream);
2932  LogTrace("TriggerMenuXmlParser") << myCoutStream.str() << "\n" << std::endl;
2933 
2934  }
2935 
2936  // insert condition into the map
2937  if ( !insertConditionIntoMap(hfRingEtSumsCond, chipNr)) {
2938 
2939  edm::LogError("TriggerMenuXmlParser") << " Error: duplicate condition (" << name
2940  << ")" << std::endl;
2941 
2942  return false;
2943  } else {
2944 
2945  (m_vecHfRingEtSumsTemplate[chipNr]).push_back(hfRingEtSumsCond);
2946 
2947  }
2948  */
2949 
2950  //
2951  return true;
2952 }
2953 
2966 bool l1t::TriggerMenuXmlParser::parseBptx(XERCES_CPP_NAMESPACE::DOMNode* node,
2967  const std::string& name, unsigned int chipNr) {
2968 
2969  XERCES_CPP_NAMESPACE_USE
2970 
2971  /*
2972  // get condition, particle name and type name
2973  std::string condition = getXMLAttribute(node, m_xmlConditionAttrCondition);
2974  std::string particle = getXMLAttribute(node, m_xmlConditionAttrObject);
2975  std::string type = getXMLAttribute(node, m_xmlConditionAttrType);
2976 
2977  if (particle != m_xmlConditionAttrObjectBptx) {
2978  edm::LogError("TriggerMenuXmlParser")
2979  << "\nError: wrong particle for Bptx condition ("
2980  << particle << ")" << std::endl;
2981  return false;
2982  }
2983 
2984  // object type and condition type
2985  // object type - irrelevant for BPTX conditions
2986  GtConditionType cType = TypeBptx;
2987 
2988  // no objects for BPTX conditions
2989 
2990  // set the boolean value for the ge_eq mode - irrelevant for BPTX conditions
2991  bool gEq = false;
2992 
2993  // now create a new BPTX condition
2994 
2995  L1GtBptxTemplate bptxCond(name);
2996 
2997  bptxCond.setCondType(cType);
2998  bptxCond.setCondGEq(gEq);
2999  bptxCond.setCondChipNr(chipNr);
3000 
3001  LogTrace("TriggerMenuXmlParser") << bptxCond << "\n" << std::endl;
3002 
3003  // insert condition into the map
3004  if ( !insertConditionIntoMap(bptxCond, chipNr)) {
3005 
3006  edm::LogError("TriggerMenuXmlParser")
3007  << " Error: duplicate condition (" << name
3008  << ")" << std::endl;
3009 
3010  return false;
3011  } else {
3012 
3013  (m_vecBptxTemplate[chipNr]).push_back(bptxCond);
3014 
3015  }
3016  */
3017 
3018  //
3019  return true;
3020 }
3021 
3022 
3035 bool l1t::TriggerMenuXmlParser::parseExternal(XERCES_CPP_NAMESPACE::DOMNode* node,
3036  const std::string& name, unsigned int chipNr) {
3037 
3038  XERCES_CPP_NAMESPACE_USE
3039 
3040  /*
3041  // get condition, particle name and type name
3042  std::string condition = getXMLAttribute(node, m_xmlConditionAttrCondition);
3043  std::string particle = getXMLAttribute(node, m_xmlConditionAttrObject);
3044  std::string type = getXMLAttribute(node, m_xmlConditionAttrType);
3045 
3046  if (particle != m_xmlConditionAttrObjectGtExternal) {
3047  edm::LogError("TriggerMenuXmlParser")
3048  << "\nError: wrong particle for External condition ("
3049  << particle << ")" << std::endl;
3050  return false;
3051  }
3052 
3053  // object type and condition type
3054  // object type - irrelevant for External conditions
3055  GtConditionType cType = TypeExternal;
3056 
3057  // no objects for External conditions
3058 
3059  // set the boolean value for the ge_eq mode - irrelevant for External conditions
3060  bool gEq = false;
3061 
3062  // now create a new External condition
3063 
3064  L1GtExternalTemplate externalCond(name);
3065 
3066  externalCond.setCondType(cType);
3067  externalCond.setCondGEq(gEq);
3068  externalCond.setCondChipNr(chipNr);
3069 
3070  LogTrace("TriggerMenuXmlParser") << externalCond << "\n" << std::endl;
3071 
3072  // insert condition into the map
3073  if ( !insertConditionIntoMap(externalCond, chipNr)) {
3074 
3075  edm::LogError("TriggerMenuXmlParser")
3076  << " Error: duplicate condition (" << name
3077  << ")" << std::endl;
3078 
3079  return false;
3080  } else {
3081 
3082  (m_vecExternalTemplate[chipNr]).push_back(externalCond);
3083 
3084  }
3085  */
3086 
3087  //
3088  return true;
3089 }
3090 
3091 
3105  XERCES_CPP_NAMESPACE::DOMNode* node, const std::string& name,
3106  unsigned int chipNr) {
3107 
3108  XERCES_CPP_NAMESPACE_USE
3109 
3110  // create a new correlation condition
3111  CorrelationTemplate correlationCond(name);
3112 
3113  // check that the condition does not exist already in the map
3114  if ( !insertConditionIntoMap(correlationCond, chipNr)) {
3115 
3116  edm::LogError("TriggerMenuXmlParser")
3117  << " Error: duplicate correlation condition (" << name << ")"
3118  << std::endl;
3119 
3120  return false;
3121  }
3122 
3123  /*
3124  // get condition, particle name and type name
3125  std::string condition = getXMLAttribute(node, m_xmlConditionAttrCondition);
3126  std::string particle = getXMLAttribute(node, m_xmlConditionAttrObject);
3127  std::string type = getXMLAttribute(node, m_xmlConditionAttrType);
3128 
3129  std::cout << " ****************************************** " << std::endl;
3130  std::cout << " DARRENS TEST OUTPUT (in parseCorrelation) " << std::endl;
3131  std::cout << " condition = " << condition << std::endl;
3132  std::cout << " particle = " << particle << std::endl;
3133  std::cout << " type = " << type << std::endl;
3134  std::cout << " name = " << name << std::endl;
3135 
3136  LogTrace("TriggerMenuXmlParser") << " Condition category: "
3137  << condition << ", particle: " << particle << ", type: " << type
3138  << "\n" << std::endl;
3139 
3140  // condition type
3141  GtConditionType cType = l1t::Type2cor;
3142 
3143  // two objects (for sure)
3144  const int nrObj = 2;
3145 
3146  // object types and greater equal flag - filled in the loop
3147  int intGEq[nrObj] = { -1, -1 };
3148  std::vector<L1GtObject> objType(nrObj);
3149  std::vector<GtConditionCategory> condCateg(nrObj);
3150 
3151  // correlation flag and index in the cor*vector
3152  const bool corrFlag = true;
3153  int corrIndexVal[nrObj] = { -1, -1 };
3154 
3155  // get the subconditions
3156 
3157  DOMNode* conditionsNode = node->getFirstChild();
3158  std::string conditionNameNodeName;
3159  conditionsNode = findXMLChild(conditionsNode, "", true,
3160  &conditionNameNodeName);
3161 
3162 
3163  for (int iSubCond = 0; iSubCond < nrObj; ++iSubCond) {
3164 
3165  // get for sub-condition: category, object name and type name and condition name
3166  condition = getXMLAttribute(conditionsNode, m_xmlConditionAttrCondition);
3167  particle = getXMLAttribute(conditionsNode, m_xmlConditionAttrObject);
3168  type = getXMLAttribute(conditionsNode, m_xmlConditionAttrType);
3169 
3170  LogTrace("TriggerMenuXmlParser") << " Sub-condition category: "
3171  << condition << ", particle: " << particle << ", type: "
3172  << type << ", name: " << conditionNameNodeName << "\n"
3173  << std::endl;
3174 
3175  // call the appropriate function for this condition
3176  if (condition == m_xmlConditionAttrConditionMuon) {
3177  if (!parseMuon(conditionsNode, conditionNameNodeName, chipNr,
3178  corrFlag)) {
3179  edm::LogError("TriggerMenuXmlParser")
3180  << "Error parsing sub-condition " << condition << ")"
3181  << " with name " << conditionNameNodeName << std::endl;
3182 
3183  }
3184 
3185  // get greater equal flag
3186  intGEq[iSubCond] = getGEqFlag(conditionsNode,
3187  m_xmlTagPtHighThreshold);
3188  if (intGEq[iSubCond] < 0) {
3189  edm::LogError("TriggerMenuXmlParser")
3190  << "Error getting \"greater or equal\" flag"
3191  << " for sub-condition " << conditionNameNodeName
3192  << " for the correlation condition " << name
3193  << std::endl;
3194  return false;
3195  }
3196 
3197  // set object type and sub-condition category
3198  objType[iSubCond] = Mu;
3199  condCateg[iSubCond] = CondMuon;
3200  corrIndexVal[iSubCond] = (m_corMuonTemplate[chipNr]).size() - 1;
3201 
3202  }
3203  else if (condition == m_xmlConditionAttrConditionCalo) {
3204  if (!parseCalo(conditionsNode, conditionNameNodeName, chipNr,
3205  corrFlag)) {
3206  edm::LogError("TriggerMenuXmlParser")
3207  << "Error parsing sub-condition " << condition << ")"
3208  << " with name " << conditionNameNodeName << std::endl;
3209 
3210  }
3211 
3212  // get greater equal flag
3213  intGEq[iSubCond] = getGEqFlag(conditionsNode, m_xmlTagEtThreshold);
3214  if (intGEq[iSubCond] < 0) {
3215  edm::LogError("TriggerMenuXmlParser")
3216  << "Error getting \"greater or equal\" flag"
3217  << " for sub-condition " << conditionNameNodeName
3218  << " for the correlation condition " << name
3219  << std::endl;
3220  return false;
3221  }
3222 
3223  // set object type and sub-condition category
3224  if (particle == m_xmlConditionAttrObjectNoIsoEG) {
3225  objType[iSubCond] = NoIsoEG;
3226  }
3227  else if (particle == m_xmlConditionAttrObjectIsoEG) {
3228  objType[iSubCond] = IsoEG;
3229  }
3230  else if (particle == m_xmlConditionAttrObjectCenJet) {
3231  objType[iSubCond] = CenJet;
3232  }
3233  else if (particle == m_xmlConditionAttrObjectTauJet) {
3234  objType[iSubCond] = TauJet;
3235  }
3236  else if (particle == m_xmlConditionAttrObjectForJet) {
3237  objType[iSubCond] = ForJet;
3238  }
3239  else {
3240  edm::LogError("TriggerMenuXmlParser")
3241  << "Wrong object type " << particle
3242  << " for sub-condition " << conditionNameNodeName
3243  << " from the correlation condition " << name
3244  << std::endl;
3245  return false;
3246  }
3247 
3248  condCateg[iSubCond] = CondCalo;
3249  corrIndexVal[iSubCond] = (m_corCaloTemplate[chipNr]).size() - 1;
3250 
3251  }
3252  else if (condition == m_xmlConditionAttrConditionEnergySum) {
3253  if (!parseEnergySum(conditionsNode, conditionNameNodeName, chipNr,
3254  corrFlag)) {
3255  edm::LogError("TriggerMenuXmlParser")
3256  << "Error parsing sub-condition " << condition << ")"
3257  << " with name " << conditionNameNodeName << std::endl;
3258 
3259  }
3260 
3261  // get greater equal flag
3262  intGEq[iSubCond] = getGEqFlag(conditionsNode, m_xmlTagEtThreshold);
3263  if (intGEq[iSubCond] < 0) {
3264  edm::LogError("TriggerMenuXmlParser")
3265  << "Error getting \"greater or equal\" flag"
3266  << " for sub-condition " << conditionNameNodeName
3267  << " for the correlation condition " << name
3268  << std::endl;
3269  return false;
3270  }
3271 
3272  // set object type and sub-condition category
3273  if (particle == m_xmlConditionAttrObjectETM) {
3274  objType[iSubCond] = ETM;
3275  }
3276  else if (particle == m_xmlConditionAttrObjectETT) {
3277  objType[iSubCond] = ETT;
3278  }
3279  else if (particle == m_xmlConditionAttrObjectHTT) {
3280  objType[iSubCond] = HTT;
3281  }
3282  else if (particle == m_xmlConditionAttrObjectHTM) {
3283  objType[iSubCond] = HTM;
3284  }
3285  else {
3286  edm::LogError("TriggerMenuXmlParser")
3287  << "Wrong object type " << particle
3288  << " for sub-condition " << conditionNameNodeName
3289  << " from the correlation condition " << name
3290  << std::endl;
3291  return false;
3292  }
3293 
3294  condCateg[iSubCond] = CondEnergySum;
3295  corrIndexVal[iSubCond] = (m_corEnergySumTemplate[chipNr]).size() - 1;
3296 
3297  }
3298  else {
3299  edm::LogError("TriggerMenuXmlParser")
3300  << "Unknown or un-adequate sub-condition (" << condition
3301  << ")" << " with name " << conditionNameNodeName
3302  << " for the correlation condition " << name << std::endl;
3303 
3304  return false;
3305  }
3306 
3307  conditionsNode = findXMLChild(conditionsNode->getNextSibling(), "",
3308  true, &conditionNameNodeName);
3309 
3310  }
3311 
3312  // get greater equal flag for the correlation condition
3313  bool gEq = true;
3314  if (intGEq[0] != intGEq[1]) {
3315  edm::LogError("TriggerMenuXmlParser")
3316  << "Inconsistent GEq flags for sub-conditions (" << condition
3317  << ")" << " with name " << conditionNameNodeName
3318  << " for the correlation condition " << name << std::endl;
3319  return false;
3320 
3321  }
3322  else {
3323  gEq = (intGEq[0] != 0);
3324 
3325  }
3326 
3327  // correlation parameters
3328 
3329  // temporary storage of the parameters
3330  CorrelationTemplate::CorrelationParameter corrParameter;
3331  std::vector<boost::uint64_t> tmpValues(nrObj);
3332 
3333  // get deltaEtaRange
3334 // if ( !getConditionChildValuesOld(node, m_xmlTagDeltaEta, 1, tmpValues) ) {
3335 // return false;
3336 // }
3337 //
3338 // corrParameter.deltaEtaRange = tmpValues[0];
3339 
3340  XERCES_CPP_NAMESPACE::DOMNode* node1 = findXMLChild(node->getFirstChild(),
3341  m_xmlTagDeltaEta);
3342 
3343  std::string valString;
3344 
3345  if (node1 == 0) {
3346  edm::LogError("TriggerMenuXmlParser")
3347  << " Could not get deltaEta for correlation condition "
3348  << name << ". " << std::endl;
3349  return false;
3350  }
3351  else {
3352  valString = getXMLTextValue(node1);
3353  }
3354 
3355  corrParameter.deltaEtaRange = valString;
3356 
3357 // // deltaPhi is larger than 64bit
3358 // if ( !getXMLHexTextValue128Old(findXMLChild(node->getFirstChild(), m_xmlTagDeltaPhi),
3359 // tmpValues[0], tmpValues[1])) {
3360 // edm::LogError("TriggerMenuXmlParser")
3361 // << " Could not get deltaPhi for correlation condition " << name << ". "
3362 // << std::endl;
3363 // return false;
3364 // }
3365 //
3366 // corrParameter.deltaPhiRange = tmpValues[0];
3367 
3368  node1 = findXMLChild(node->getFirstChild(), m_xmlTagDeltaPhi);
3369 
3370  if (node1 == 0) {
3371  return false;
3372  edm::LogError("TriggerMenuXmlParser")
3373  << " Could not get deltaPhi for correlation condition "
3374  << name << ". " << std::endl;
3375  }
3376  else {
3377  valString = getXMLTextValue(node1);
3378  }
3379 
3380  corrParameter.deltaPhiRange = valString;
3381 
3382  // get maximum number of bits for delta phi
3383  //LogTrace("TriggerMenuXmlParser")
3384  //<< " Counting deltaPhiMaxbits"
3385  //<< std::endl;
3386 
3387  unsigned int maxbits;
3388 
3389  if ( !countConditionChildMaxBits(node, m_xmlTagDeltaPhi, maxbits) ) {
3390  return false;
3391  }
3392 
3393  corrParameter.deltaPhiMaxbits = maxbits;
3394  //LogTrace("TriggerMenuXmlParser")
3395  //<< " deltaPhiMaxbits (dec) = " << maxbits
3396  //<< std::endl;
3397 
3398 
3399  // fill the correlation condition
3400  correlationCond.setCondType(cType);
3401  correlationCond.setObjectType(objType);
3402  correlationCond.setCondGEq(gEq);
3403  correlationCond.setCondChipNr(chipNr);
3404 
3405  correlationCond.setCond0Category(condCateg[0]);
3406  correlationCond.setCond1Category(condCateg[1]);
3407 
3408  correlationCond.setCond0Index(corrIndexVal[0]);
3409  correlationCond.setCond1Index(corrIndexVal[1]);
3410 
3411  correlationCond.setCorrelationParameter(corrParameter);
3412 
3413  if (edm::isDebugEnabled() ) {
3414 
3415  std::ostringstream myCoutStream;
3416  correlationCond.print(myCoutStream);
3417  LogTrace("TriggerMenuXmlParser") << myCoutStream.str() << "\n"
3418  << std::endl;
3419 
3420  }
3421 
3422  // insert condition into the map
3423  // condition is not duplicate, check was done at the beginning
3424 
3425  (m_vecCorrelationTemplate[chipNr]).push_back(correlationCond);
3426 
3427  */
3428  //
3429  return true;
3430 }
3431 
3440 bool l1t::TriggerMenuXmlParser::parseId( l1t::Meta meta ) {
3441 
3442  XERCES_CPP_NAMESPACE_USE
3443 
3444 // DOMNode* doc = parser->getDocument();
3445 // DOMNode* n1 = doc->getFirstChild();
3446 
3447 // // we assume that the first child is m_xmlTagDef because it was checked in workXML
3448 
3449 // DOMNode* headerNode = n1->getFirstChild();
3450 // if (headerNode == 0) {
3451 // edm::LogError("TriggerMenuXmlParser") << "Error: No child of <" << m_xmlTagDef
3452 // << "> tag found." << std::endl;
3453 // return false;
3454 // }
3455 
3456 // headerNode = findXMLChild(headerNode, m_xmlTagHeader);
3457 // if (headerNode == 0) {
3458 
3459 // LogDebug("TriggerMenuXmlParser") << "\n Warning: Could not find <" << m_xmlTagHeader
3460 // << "> tag" << "\n - No header information." << std::endl;
3461 
3462 // } else {
3463 
3464 // DOMNode* idNode = headerNode->getFirstChild();
3465 
3466 // // find menu interface name
3467 // idNode = findXMLChild(idNode, m_xmlTagMenuInterface);
3468 // if (idNode == 0) {
3469 
3470 // LogTrace("TriggerMenuXmlParser") << "\n Warning: Could not find <"
3471 // << m_xmlTagMenuInterface << "> tag"
3472 // << "\n - Trigger menu interface name derived from file name." << std::endl;
3473 
3474 // // set the name of the trigger menu interface: from beginning of file names
3475 // // until beginning of "_L1T_Scales"
3476 // size_t xmlPos = m_triggerMenuName.find("_L1T_Scales", 0);
3477 // if (xmlPos == std::string::npos) {
3478 // LogTrace("TriggerMenuXmlParser")
3479 // << "\n Warning: Could not find \"_L1T_Scales\" " << "string in file name"
3480 // << "\n - Trigger menu interface name set to file name." << std::endl;
3481 // m_triggerMenuInterface = m_triggerMenuName;
3482 
3483 // } else {
3484 // m_triggerMenuInterface = m_triggerMenuName;
3485 // m_triggerMenuInterface.erase(
3486 // m_triggerMenuInterface.begin(), m_triggerMenuInterface.begin() + xmlPos);
3487 // }
3488 
3489 // } else {
3490 // m_triggerMenuInterface = getXMLTextValue(idNode);
3491 // }
3492 
3493 // // find menu interface creation date
3494 // idNode = headerNode->getFirstChild();
3495 // idNode = findXMLChild(idNode, m_xmlTagMenuInterfaceDate);
3496 
3497 // if (idNode == 0) {
3498 
3499 // LogTrace("TriggerMenuXmlParser") << "\n Warning: Could not find <"
3500 // << m_xmlTagMenuInterfaceDate << "> tag" << "\n - No creation date."
3501 // << m_triggerMenuInterfaceDate << std::endl;
3502 
3503 // } else {
3504 
3505 // m_triggerMenuInterfaceDate = getXMLTextValue(idNode);
3506 // }
3507 
3508 // // find menu interface creation author
3509 // idNode = headerNode->getFirstChild();
3510 // idNode = findXMLChild(idNode, m_xmlTagMenuInterfaceAuthor);
3511 
3512 // if (idNode == 0) {
3513 
3514 // LogTrace("TriggerMenuXmlParser") << "\n Warning: Could not find <"
3515 // << m_xmlTagMenuInterfaceAuthor << "> tag" << "\n - No creation author."
3516 // << m_triggerMenuInterfaceAuthor << std::endl;
3517 
3518 // } else {
3519 
3520 // m_triggerMenuInterfaceAuthor = getXMLTextValue(idNode);
3521 // }
3522 
3523 // // find menu interface description
3524 // idNode = headerNode->getFirstChild();
3525 // idNode = findXMLChild(idNode, m_xmlTagMenuInterfaceDescription);
3526 
3527 // if (idNode == 0) {
3528 
3529 // LogTrace("TriggerMenuXmlParser") << "\n Warning: Could not find <"
3530 // << m_xmlTagMenuInterfaceDescription << "> tag" << "\n - No description."
3531 // << m_triggerMenuInterfaceDescription << std::endl;
3532 
3533 // } else {
3534 
3535 // m_triggerMenuInterfaceDescription = getXMLTextValue(idNode);
3536 // }
3537 
3538 // // find menu creation date
3539 // idNode = headerNode->getFirstChild();
3540 // idNode = findXMLChild(idNode, m_xmlTagMenuDate);
3541 
3542 // if (idNode == 0) {
3543 
3544 // LogTrace("TriggerMenuXmlParser") << "\n Warning: Could not find <"
3545 // << m_xmlTagMenuDate << "> tag" << "\n - No creation date."
3546 // << m_triggerMenuDate << std::endl;
3547 
3548 // } else {
3549 
3550 // m_triggerMenuDate = getXMLTextValue(idNode);
3551 // }
3552 
3553 // // find menu creation author
3554 // idNode = headerNode->getFirstChild();
3555 // idNode = findXMLChild(idNode, m_xmlTagMenuAuthor);
3556 
3557 // if (idNode == 0) {
3558 
3559 // LogTrace("TriggerMenuXmlParser") << "\n Warning: Could not find <"
3560 // << m_xmlTagMenuAuthor << "> tag" << "\n - No creation author."
3561 // << m_triggerMenuAuthor << std::endl;
3562 
3563 // } else {
3564 
3565 // m_triggerMenuAuthor = getXMLTextValue(idNode);
3566 // }
3567 
3568 // // find menu description
3569 // idNode = headerNode->getFirstChild();
3570 // idNode = findXMLChild(idNode, m_xmlTagMenuDescription);
3571 
3572 // if (idNode == 0) {
3573 
3574 // LogTrace("TriggerMenuXmlParser") << "\n Warning: Could not find <"
3575 // << m_xmlTagMenuDescription << "> tag" << "\n - No description."
3576 // << m_triggerMenuDescription << std::endl;
3577 
3578 // } else {
3579 
3580 // m_triggerMenuDescription = getXMLTextValue(idNode);
3581 // }
3582 
3583 // // find algorithm implementation tag
3584 
3585 // idNode = headerNode->getFirstChild();
3586 
3587 // idNode = findXMLChild(idNode, m_xmlTagMenuAlgImpl);
3588 // if (idNode == 0) {
3589 
3590 // m_algorithmImplementation = "";
3591 // LogTrace("TriggerMenuXmlParser") << "\n Warning: Could not find <"
3592 // << m_xmlTagMenuAlgImpl << "> tag"
3593 // << "\n - Algorithm implementation tag set to empty string." << std::endl;
3594 
3595 // } else {
3596 
3597 // m_algorithmImplementation = getXMLTextValue(idNode);
3598 // }
3599 
3600 // // find DB key for L1 scales
3601 
3602 // idNode = headerNode->getFirstChild();
3603 
3604 // idNode = findXMLChild(idNode, m_xmlTagScaleDbKey);
3605 // if (idNode == 0) {
3606 
3607 // m_scaleDbKey = "NULL";
3608 // LogTrace("TriggerMenuXmlParser") << "\n Warning: Could not find <"
3609 // << m_xmlTagScaleDbKey << "> tag" << "\n - Scale key set to " << m_scaleDbKey
3610 // << " string." << std::endl;
3611 
3612 // } else {
3613 // m_scaleDbKey = getXMLTextValue(idNode);
3614 // }
3615 
3616 // }
3617 
3618 
3619 
3620  m_triggerMenuInterface = l1t2string( meta.name() );
3621  m_triggerMenuInterfaceDate = "2013-010-24T15:33:24";
3622  m_triggerMenuInterfaceAuthor = "Darren Puigh";
3623  m_triggerMenuInterfaceDescription = l1t2string( meta.comment() );
3624 // m_algorithmImplementation = l1t2string( meta.firmwareVersion() );
3625 // m_triggerMenuDate = l1t2string( meta.changesDate() );
3626 // m_triggerMenuAuthor = l1t2string( meta.changesAuthor() );
3627  m_triggerMenuDescription = l1t2string( meta.comment() );
3628  m_scaleDbKey = l1t2string( meta.scale_set() );
3629 
3630 
3631  int cnt = 0;
3632  for( l1t::RevisionList::revision_const_iterator revision = meta.revisions().revision().begin();
3633  revision != meta.revisions().revision().end(); ++revision ){
3634 
3635  LogDebug("l1t|Global")
3636  << "\t Revision " << cnt
3637  << "\t\t author = " << l1t2string( revision->author() )
3638  << "\t\t datetime = " << l1tDateTime2string( revision->datetime() )
3639  << std::endl;
3640 
3641  if( cnt==0 ){
3642  m_triggerMenuDate = l1tDateTime2string( revision->datetime() );
3643  m_triggerMenuAuthor = l1t2string( revision->author() );
3644  }
3645  cnt++;
3646  }
3647 
3648  //LogDebug("TriggerMenuXmlParser")
3649  LogDebug("l1t|Global")
3650  << "\n Parsed values from XML file DRULES"
3651  << "\nL1 MenuInterface: " << m_triggerMenuInterface
3652  << "\nL1 MenuInterface - Creation date: " << m_triggerMenuInterfaceDate
3653  << "\nL1 MenuInterface - Creation author: " << m_triggerMenuInterfaceAuthor
3654  << "\nL1 MenuInterface - Description: " << m_triggerMenuInterfaceDescription
3655  << "\n"
3656  << "\nAlgorithm implementation tag: " << m_algorithmImplementation
3657  << "\n"
3658  << "\nL1 Menu - Creation date: " << m_triggerMenuDate
3659  << "\nL1 Menu - Creation author: " << m_triggerMenuAuthor
3660  << "\nL1 Menu - Description: " << m_triggerMenuDescription
3661  << std::endl;
3662 
3663 
3664  // set the trigger menu name
3665  // format:
3666  // L1MenuInterface/ScaleDbKey/AlgorithmImplementationTag
3667 
3668  std::string menuName = m_triggerMenuInterface + "/" + m_scaleDbKey + "/" + m_algorithmImplementation;
3669 
3670  if (menuName != m_triggerMenuName) {
3671 
3672  LogDebug("TriggerMenuXmlParser") << "\n Warning: Inconsistent L1 menu name:"
3673  << "\n from XML file name: " << m_triggerMenuName
3674  << "\n from XML tag: " << menuName << std::endl;
3675 
3676  if (m_triggerMenuInterface != "") {
3677  if (m_scaleDbKey == "NULL") {
3678  m_triggerMenuName = m_triggerMenuInterface;
3679  } else {
3680  m_triggerMenuName = menuName;
3681  }
3682 
3683  LogTrace("TriggerMenuXmlParser") << "\n L1 menu name set to value from XML tag!"
3684  << "\n L1 Menu name: " << m_triggerMenuName << std::endl;
3685 
3686  } else {
3687  LogTrace("TriggerMenuXmlParser") << "\n L1 menu name set to file name!"
3688  << "\n L1 Menu name: " << m_triggerMenuName << std::endl;
3689 
3690  }
3691  }
3692 
3693  //
3694  return true;
3695 }
3696 
3708 bool l1t::TriggerMenuXmlParser::workCondition(XERCES_CPP_NAMESPACE::DOMNode* node,
3709  const std::string& name, unsigned int chipNr) {
3710 
3711  XERCES_CPP_NAMESPACE_USE
3712 
3713  // get condition, particle name and type name
3714  std::string condition = getXMLAttribute(node, m_xmlConditionAttrCondition);
3715  std::string particle = getXMLAttribute(node, m_xmlConditionAttrObject);
3716  std::string type = getXMLAttribute(node, m_xmlConditionAttrType);
3717 
3718  LogDebug("l1t|Global")
3719  << "\n ****************************************** "
3720  << "\n workCondition "
3721  << "\n condition = " << condition
3722  << "\n particle = " << particle
3723  << "\n type = " << type
3724  << "\n name = " << name
3725  << std::endl;
3726 
3727  if (condition.empty() || particle.empty() || type.empty() ) {
3728 
3729  edm::LogError("TriggerMenuXmlParser") << "Missing attributes for condition " << name
3730  << std::endl;
3731 
3732  return false;
3733  }
3734 
3735  //LogTrace("TriggerMenuXmlParser")
3736  //<< " condition: " << condition << ", particle: " << particle
3737  //<< ", type: " << type << std::endl;
3738 
3739  // call the appropiate function for this condition
3740 
3741  /*
3742  if (condition == m_xmlConditionAttrConditionMuon) {
3743  return parseMuon(node, name, chipNr);
3744  }
3745  else if (condition == m_xmlConditionAttrConditionCalo) {
3746  return parseCalo(node, name, chipNr);
3747  }
3748  else if (condition == m_xmlConditionAttrConditionEnergySum) {
3749  return parseEnergySum(node, name, chipNr);
3750  }
3751  else if (condition == m_xmlConditionAttrConditionJetCounts) {
3752  return parseJetCounts(node, name, chipNr);
3753  }
3754  else if (condition == m_xmlConditionAttrConditionCastor) {
3755  return parseCastor(node, name, chipNr);
3756  }
3757  else if (condition == m_xmlConditionAttrConditionHfBitCounts) {
3758  return parseHfBitCounts(node, name, chipNr);
3759  }
3760  else if (condition == m_xmlConditionAttrConditionHfRingEtSums) {
3761  return parseHfRingEtSums(node, name, chipNr);
3762  }
3763  else if (condition == m_xmlConditionAttrConditionBptx) {
3764  return parseBptx(node, name, chipNr);
3765  }
3766  else if (condition == m_xmlConditionAttrConditionExternal) {
3767  return parseExternal(node, name, chipNr);
3768  }
3769  else if (condition == m_xmlConditionAttrConditionCorrelation) {
3770  return parseCorrelation(node, name, chipNr);
3771  }
3772  else {
3773  edm::LogError("TriggerMenuXmlParser")
3774  << "\n Error: unknown condition (" << condition << ")"
3775  << std::endl;
3776 
3777  return false;
3778  }
3779 
3780  */
3781  return true;
3782 
3783 }
3784 
3795 bool l1t::TriggerMenuXmlParser::parseConditions( l1t::ConditionList conditions ){
3796 
3797  XERCES_CPP_NAMESPACE_USE
3798 
3799  LogTrace("TriggerMenuXmlParser") << "\nParsing conditions" << std::endl;
3800 
3801  int chipNr = 1;
3802  LogDebug("l1t|Global") << " ====> condCalorimeter" << std::endl;
3803  for (l1t::ConditionList::condCalorimeter_const_iterator condCalo = conditions.condCalorimeter().begin();
3804  condCalo != conditions.condCalorimeter().end(); ++condCalo ){
3805 
3806  LogDebug("l1t|Global")
3807  << condCalo->name() << " {"
3808  << " comment: " << condCalo->comment()
3809  << " locked: " << condCalo->locked()
3810  << "}"
3811  << std::endl;
3812 
3813  l1t::CalorimeterCondition condition = (*condCalo);
3814 
3815  parseCalo( condition, chipNr );
3816  }
3817 
3818  LogDebug("l1t|Global") << " ====> condMuon " << std::endl;
3819  for (l1t::ConditionList::condMuon_const_iterator condMu = conditions.condMuon().begin();
3820  condMu != conditions.condMuon().end(); ++condMu ){
3821 
3822  LogDebug("l1t|Global")
3823  << condMu->name() << " {"
3824  << " comment: " << condMu->comment()
3825  << " locked: " << condMu->locked()
3826  << "}"
3827  << std::endl;
3828 
3829  l1t::MuonCondition condition = (*condMu);
3830 
3831  parseMuon( condition, chipNr );
3832  }
3833 
3834  LogDebug("l1t|Global") << " ====> condEnergySums " << std::endl;
3835  for (l1t::ConditionList::condEnergySums_const_iterator condEnergySums = conditions.condEnergySums().begin();
3836  condEnergySums != conditions.condEnergySums().end(); ++condEnergySums ){
3837 
3838  LogDebug("l1t|Global")
3839  << condEnergySums->name() << " {"
3840  << " comment: " << condEnergySums->comment()
3841  << " locked: " << condEnergySums->locked()
3842  << "}"
3843  << std::endl;
3844 
3845  l1t::EnergySumsCondition condition = (*condEnergySums);
3846 
3847  parseEnergySum( condition, chipNr );
3848  }
3849 
3850 
3851  return true;
3852 }
3853 
3866  unsigned int chipNr) {
3867 
3868  XERCES_CPP_NAMESPACE_USE
3869 
3870 // if (node == 0) {
3871 // LogDebug("TriggerMenuXmlParser")
3872 // << " Node is 0 in " << __PRETTY_FUNCTION__
3873 // << " can not parse the algorithm " << algName
3874 // << std::endl;
3875 // return false;
3876 // }
3877 
3878  // get alias
3879  std::string algAlias = l1t2string( algorithm.name() );
3880  std::string algName = l1t2string( algorithm.name() );
3881 
3882  if (algAlias == "") {
3883  algAlias = algName;
3884  LogDebug("TriggerMenuXmlParser")
3885  << "\n No alias defined for algorithm. Alias set to algorithm name."
3886  << "\n Algorithm name: " << algName << "\n Algorithm alias: " << algAlias
3887  << std::endl;
3888  } else {
3889  //LogDebug("TriggerMenuXmlParser")
3890  LogDebug("l1t|Global") << "\n Alias defined for algorithm."
3891  << "\n Algorithm name: " << algName << "\n Algorithm alias: " << algAlias
3892  << std::endl;
3893  }
3894 
3895  // get the logical expression
3896  std::string logExpression = l1t2string( algorithm.logical_expression() );
3897 
3898  LogDebug("l1t|Global")
3899  << " Logical expression: " << logExpression
3900  << " Chip number: " << chipNr
3901  << std::endl;
3902 
3903  // determine output pin
3904  std::string pinString = l1t2string( algorithm.index() );
3905  int outputPin = 0;
3906 
3907  std::istringstream opStream(pinString);
3908 
3909  if ((opStream >> outputPin).fail()) {
3910  LogDebug("TriggerMenuXmlParser")
3911  << " Unable to convert pin string " << pinString
3912  << " to int for algorithm : " << algName
3913  << std::endl;
3914 
3915  return false;
3916  }
3917 
3918 
3919  //LogTrace("TriggerMenuXmlParser")
3920  LogDebug("l1t|Global") << " Output pin: " << outputPin
3921  << std::endl;
3922 
3923 
3924  // compute the bit number from chip number, output pin and order of the chips
3925  // pin numbering start with 1, bit numbers with 0
3926  int bitNumber = outputPin;// + (m_orderConditionChip[chipNr] -1)*m_pinsOnConditionChip -1;
3927 
3928  //LogTrace("TriggerMenuXmlParser")
3929  LogDebug("l1t|Global") << " Bit number: " << bitNumber
3930  << std::endl;
3931 
3932  // create a new algorithm and insert it into algorithm map
3933  L1GtAlgorithm alg(algName, logExpression, bitNumber);
3934  alg.setAlgoChipNumber(static_cast<int>(chipNr));
3935  alg.setAlgoAlias(algAlias);
3936 
3937  if (edm::isDebugEnabled() ) {
3938 
3939  std::ostringstream myCoutStream;
3940  alg.print(myCoutStream);
3941  LogTrace("TriggerMenuXmlParser") << myCoutStream.str() << "\n" << std::endl;
3942 
3943  }
3944 
3945  // insert algorithm into the map
3946  if ( !insertAlgorithmIntoMap(alg)) {
3947 
3948  return false;
3949  }
3950 
3951  return true;
3952 
3953 }
3954 
3955 /*
3956  * parseAlgorithms Parse the algorithms
3957  * NOTE: the algorithms used here are equivalent to "prealgo" from XML file
3958  * for the VERSION_FINAL
3959  * The "VERSION_PROTOTYPE algo" will be phased out later in the XML file
3960  * See L1GlobalTriggerConfig.h (in the attic)
3961  *
3962  * @param parser A reference to the XercesDOMParser to use.
3963  *
3964  * @return "true" if succeeded, "false" if an error occurred.
3965  *
3966  */
3967 
3968 bool l1t::TriggerMenuXmlParser::parseAlgorithms( l1t::AlgorithmList algorithms ) {
3969 
3970  XERCES_CPP_NAMESPACE_USE
3971 
3972  LogTrace("TriggerMenuXmlParser") << "\nParsing algorithms" << std::endl;
3973 
3974  int chipNr = 1;
3975  LogDebug("l1t|Global") << " ====> algorithms " << std::endl;
3976  for( l1t::AlgorithmList::algorithm_const_iterator i = algorithms.algorithm().begin();
3977  i != algorithms.algorithm().end(); ++i ){
3978 
3979  l1t::Algorithm algorithm = (*i);
3980  LogDebug("l1t|Global")
3981  << algorithm.name() << " {"
3982  << " index: " << algorithm.index()
3983  << " equation: " << algorithm.logical_expression()
3984  << " comment: " << algorithm.comment()
3985  << " locked: " << algorithm.locked()
3986  << "}"
3987  << std::endl;
3988 
3989 
3990  workAlgorithm( algorithm, chipNr );
3991  }
3992 
3993 
3994  return true;
3995 }
3996 
4007 bool l1t::TriggerMenuXmlParser::workTechTrigger(XERCES_CPP_NAMESPACE::DOMNode* node,
4008  const std::string& algName) {
4009 
4010  XERCES_CPP_NAMESPACE_USE
4011 
4012  if (node == 0) {
4013  LogDebug("TriggerMenuXmlParser")
4014  << " Node is 0 in " << __PRETTY_FUNCTION__
4015  << " can not parse the technical trigger " << algName
4016  << std::endl;
4017  return false;
4018  }
4019 
4020  // get the logical expression from the node
4021  std::string logExpression = getXMLTextValue(node);
4022 
4023  //LogTrace("TriggerMenuXmlParser")
4024  //<< " Logical expression: " << logExpression
4025  //<< std::endl;
4026 
4027  // determine bit number (use output pin tag)
4028  DOMNode* pinNode = findXMLChild(node->getFirstChild(), m_xmlTagOutput);
4029  std::string pinString;
4030  int outputPin = 0;
4031 
4032  pinNode = node->getFirstChild();
4033  if ( (pinNode = findXMLChild(pinNode, m_xmlTagOutputPin) ) != 0) {
4034  pinString = getXMLAttribute(pinNode, m_xmlAttrNr);
4035 
4036  // convert pinString to integer
4037  std::istringstream opStream(pinString);
4038 
4039  if ((opStream >> outputPin).fail()) {
4040  LogDebug("TriggerMenuXmlParser")
4041  << " Unable to convert pin string " << pinString
4042  << " to int for technical trigger : " << algName
4043  << std::endl;
4044 
4045  return false;
4046  }
4047 
4048  }
4049 
4050  if (pinNode == 0) {
4051  LogTrace("TriggerMenuXmlParser")
4052  << " Warning: No pin number found for technical trigger: "
4053  << algName << std::endl;
4054 
4055  return false;
4056  }
4057 
4058  // set the bit number
4059  int bitNumber = outputPin;
4060 
4061  //LogTrace("TriggerMenuXmlParser")
4062  //<< " Bit number: " << bitNumber
4063  //<< std::endl;
4064 
4065  // create a new technical trigger and insert it into technical trigger map
4066  // alias set automatically to name
4067  L1GtAlgorithm alg(algName, logExpression, bitNumber);
4068  alg.setAlgoAlias(algName);
4069 
4070  if (edm::isDebugEnabled() ) {
4071 
4072  std::ostringstream myCoutStream;
4073  alg.print(myCoutStream);
4074  LogTrace("TriggerMenuXmlParser") << myCoutStream.str() << "\n" << std::endl;
4075 
4076  }
4077 
4078  // insert technical trigger into the map
4079  if ( !insertTechTriggerIntoMap(alg)) {
4080 
4081  return false;
4082  }
4083 
4084  return true;
4085 
4086 }
4087 
4088 /*
4089  * parseTechTriggers Parse the technical triggers
4090  *
4091  * @param parser A reference to the XercesDOMParser to use.
4092  *
4093  * @return "true" if succeeded, "false" if an error occurred.
4094  *
4095  */
4096 
4097 bool l1t::TriggerMenuXmlParser::parseTechTriggers(XERCES_CPP_NAMESPACE::XercesDOMParser* parser) {
4098 
4099  XERCES_CPP_NAMESPACE_USE
4100 
4101  //LogTrace("TriggerMenuXmlParser") << "\nParsing technical triggers" << std::endl;
4102 
4103  DOMNode* doc = parser->getDocument();
4104  DOMNode* node = doc->getFirstChild();
4105 
4106  DOMNode* algNode = node->getFirstChild();
4107  if (algNode == 0) {
4108  edm::LogError("TriggerMenuXmlParser")
4109  << " Error: No child found for " << m_xmlTagDef << std::endl;
4110  return false;
4111  }
4112 
4113  algNode = findXMLChild(algNode, m_xmlTagTechTriggers);
4114  if (algNode == 0) {
4115  edm::LogError("TriggerMenuXmlParser") << " Error: No <"
4116  << m_xmlTagTechTriggers << "> child found."
4117  << std::endl;
4118  return false;
4119  }
4120 
4121  // walk through technical triggers
4122  DOMNode* algNameNode = algNode->getFirstChild();
4123  std::string algNameNodeName;
4124  algNameNode = findXMLChild(algNameNode, "", true, &algNameNodeName);
4125 
4126  while (algNameNode != 0) {
4127  //LogTrace("TriggerMenuXmlParser")
4128  //<< " Found an technical trigger with name: " << algNameNodeName
4129  //<< std::endl;
4130 
4131  if ( !workTechTrigger(algNameNode, algNameNodeName)) {
4132  return false;
4133  }
4134 
4135  algNameNode = findXMLChild(algNameNode->getNextSibling(), "", true,
4136  &algNameNodeName);
4137 
4138  }
4139 
4140  return true;
4141 }
4142 
4143 
4152 //bool TriggerMenuXmlParser::workXML(XERCES_CPP_NAMESPACE::XercesDOMParser* parser) {
4153 bool l1t::TriggerMenuXmlParser::workXML( std::auto_ptr<l1t::L1TriggerMenu> tm ) {
4154 
4155  XERCES_CPP_NAMESPACE_USE
4156 
4157 
4158  // clear possible old maps
4159  clearMaps();
4160 
4161  l1t::Meta meta = tm->meta();
4162  l1t::ConditionList conditions = tm->conditions();
4163  l1t::AlgorithmList algorithms = tm->algorithms();
4164 
4165  if ( !parseId( meta ) ) {
4166  clearMaps();
4167  return false;
4168  }
4169 
4170  if ( !parseConditions( conditions ) ) {
4171  clearMaps();
4172  return false;
4173  }
4174 
4175  if ( !parseAlgorithms( algorithms ) ) {
4176  clearMaps();
4177  return false;
4178  }
4179 
4180 // if ( !parseTechTriggers(parser) ) {
4181 // clearMaps();
4182 // return false;
4183 // }
4184 
4185  return true;
4186 
4187 }
4188 
4189 
4190 // static class members
4191 
#define LogDebug(id)
type
Definition: HCALResponse.h:21
bool isDebugEnabled()
int i
Definition: DBlmapReader.cc:9
bool workXML(std::auto_ptr< l1t::L1TriggerMenu > tm)
do all the steps for filling a trigger menu
bool parseJetCounts(XERCES_CPP_NAMESPACE::DOMNode *node, const std::string &name, unsigned int chipNr=0)
parse a &quot;jet counts&quot; condition
bool insertConditionIntoMap(GtCondition &cond, const int chipNr)
bool workAlgorithm(l1t::Algorithm algorithm, unsigned int chipNr)
parse an algorithm and insert it into algorithm map.
GtConditionType
Definition: GtDefinitions.h:99
void setGtAlgorithmAliasMap(const AlgorithmMap &)
Definition: L1GtObject.h:39
void setGtNumberL1JetCounts(const unsigned int &)
void setVecEnergySumTemplate(const std::vector< std::vector< EnergySumTemplate > > &)
bool parseEnergySum(l1t::EnergySumsCondition condEnergySums, unsigned int chipNr=0, const bool corrFlag=false)
parse an &quot;energy sum&quot; condition
bool insertTechTriggerIntoMap(const L1GtAlgorithm &alg)
insert a technical trigger into technical trigger map
void setAlgoAlias(const std::string &algoAliasValue)
Definition: L1GtAlgorithm.h:72
std::string l1tDateTime2string(l1t::DateTime)
bool parseConditions(l1t::ConditionList conditions)
parse all conditions
bool parseVmeXML(XERCES_CPP_NAMESPACE::XercesDOMParser *parser)
parse the vme xml file
Definition: L1GtObject.h:36
virtual void print(std::ostream &myCout) const
print condition
void setCondType(const l1t::GtConditionType &cType)
Definition: GtCondition.h:83
unsigned long long deltaEtaRange
Definition: CaloTemplate.h:81
const std::string algoName() const
get / set algorithm name
Definition: L1GtAlgorithm.h:56
unsigned long long deltaPhiRange
Definition: CaloTemplate.h:83
void setGtAlgorithmMap(const AlgorithmMap &)
bool parseCalo(l1t::CalorimeterCondition condCalo, unsigned int chipNr=0, const bool corrFlag=false)
parse a calorimeter condition
void setCondGEq(const bool &cGEq)
Definition: GtCondition.h:105
void setGtTechnicalTriggerMap(const AlgorithmMap &)
void setGtOrderConditionChip(const std::vector< int > &)
void setGtTriggerMenuImplementation(const std::string &)
virtual void print(std::ostream &myCout) const
print the condition
tuple node
Definition: Node.py:50
std::string const & algoAlias() const
get / set algorithm alias
Definition: L1GtAlgorithm.h:67
bool insertAlgorithmIntoMap(const L1GtAlgorithm &alg)
insert an algorithm into algorithm map
void setVecHfRingEtSumsTemplate(const std::vector< std::vector< L1GtHfRingEtSumsTemplate > > &)
bool parseId(std::auto_ptr< l1t::L1TriggerMenu > tm)
parse all parse all identification attributes (trigger menu names, scale DB key, etc) ...
bool parseExternal(XERCES_CPP_NAMESPACE::DOMNode *node, const std::string &name, unsigned int chipNr=0)
parse an External condition
void setAlgoChipNumber(const int algoChipNumberValue)
void setGtNumberPhysTriggers(const unsigned int &)
Definition: L1GtObject.h:38
void setVecHfBitCountsTemplate(const std::vector< std::vector< L1GtHfBitCountsTemplate > > &)
bool getMuonMipIsoBits(XERCES_CPP_NAMESPACE::DOMNode *node, unsigned int num, std::vector< bool > &mipDst, std::vector< bool > &isoEnDst, std::vector< bool > &isoReqDst)
get MIP and Isolation bits from a muon
unsigned long long deltaPhiRange
Definition: MuonTemplate.h:98
bool hexString2UInt128(const std::string &hexString, boost::uint64_t &dstL, boost::uint64_t &dstH)
convert a hexadecimal string with up to 128 to 2 boost::uint64_t
void setGtTriggerMenuInterfaceDescription(const std::string &)
bool getXMLHexTextValue(const std::string &childName, boost::uint64_t &dst)
void parseXmlFile(const std::string &defXmlFile, const std::string &vmeXmlFile)
parse def.xml and vme.xml files
AlgorithmMap::const_iterator CItAlgo
iterators through map containing the algorithms
void setGtTriggerMenuName(const std::string &)
void setVecBptxTemplate(const std::vector< std::vector< L1GtBptxTemplate > > &)
void setGtScaleDbKey(const std::string &)
void setVecJetCountsTemplate(const std::vector< std::vector< L1GtJetCountsTemplate > > &)
int getBitFromNode(XERCES_CPP_NAMESPACE::DOMNode *node)
get bit from a bit node
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
void setGtTriggerMenuInterfaceAuthor(const std::string &)
list attributes
Definition: asciidump.py:415
bool parseMuon(l1t::MuonCondition condMu, unsigned int chipNr=0, const bool corrFlag=false)
parse a muon condition
void setVecExternalTemplate(const std::vector< std::vector< L1GtExternalTemplate > > &)
std::string getXMLAttribute(const XERCES_CPP_NAMESPACE::DOMNode *node, const std::string &name)
get a named attribute for an xml node as string
tuple doc
Definition: asciidump.py:381
int algoBitNumber() const
get / set algorithm bit number
Definition: L1GtAlgorithm.h:94
bool getXMLHexTextValue128Old(XERCES_CPP_NAMESPACE::DOMNode *node, boost::uint64_t &dstL, boost::uint64_t &dstH)
get a hexadecimal value of a xml node containing text with up to 128 bit
void setVecMuonTemplate(const std::vector< std::vector< MuonTemplate > > &)
bool workCondition(XERCES_CPP_NAMESPACE::DOMNode *node, const std::string &name, unsigned int chipNr)
choose the parser for a particular condition
#define LogTrace(id)
bool parseHfRingEtSums(XERCES_CPP_NAMESPACE::DOMNode *node, const std::string &name, unsigned int chipNr=0)
parse a HfRingEtSums condition
std::map< std::string, L1GtAlgorithm > AlgorithmMap
map containing the algorithms
bool getXMLHexTextValue128(const std::string &childName, boost::uint64_t &dstL, boost::uint64_t &dstH)
void setVecCastorTemplate(const std::vector< std::vector< L1GtCastorTemplate > > &)
bool getConditionChildValuesOld(XERCES_CPP_NAMESPACE::DOMNode *node, const std::string &childName, unsigned int num, std::vector< boost::uint64_t > &dst)
get values from a child of a condition
l1t::GtConditionType getTypeFromType(const std::string &type)
const std::string & condName() const
get / set condition name
Definition: GtCondition.h:56
Definition: L1GtObject.h:30
void setGtConditionMap(const std::vector< ConditionMap > &)
unsigned long long uint64_t
Definition: Time.h:15
bool countConditionChildMaxBits(const std::string &childName, unsigned int &dst)
get the number of bits in the max attribute of a condition child
void setGtTriggerMenuDescription(const std::string &)
bool xmlFile(const std::string fParam)
void setCondChipNr(const int &cChipNr)
Definition: GtCondition.h:116
bool parseTechTriggers(XERCES_CPP_NAMESPACE::XercesDOMParser *parser)
parse all algorithms
bool parseHfBitCounts(XERCES_CPP_NAMESPACE::DOMNode *node, const std::string &name, unsigned int chipNr=0)
parse a HfBitCounts condition
void setGtPinsOnConditionChip(const unsigned int &)
XERCES_CPP_NAMESPACE::DOMNode * findXMLChild(XERCES_CPP_NAMESPACE::DOMNode *startChild, const std::string &tagName, bool beginOnly=false, std::string *rest=0)
find a named child of a xml node
Definition: L1GtObject.h:37
typedef for correlation parameters
Definition: CaloTemplate.h:79
unsigned long long deltaEtaRange
Definition: MuonTemplate.h:96
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
void setObjectType(const std::vector< L1GtObject > &objType)
Definition: GtCondition.h:94
const int algoChipNumber() const
get / set algorithm bit number
static std::atomic< unsigned int > counter
void setGtTriggerMenuInterfaceDate(const std::string &)
void setVecCaloTemplate(const std::vector< std::vector< CaloTemplate > > &)
bool workTechTrigger(XERCES_CPP_NAMESPACE::DOMNode *node, const std::string &name)
parse an algorithm and insert it into algorithm map.
virtual ~TriggerMenuXmlParser()
destructor
void setCorEnergySumTemplate(const std::vector< std::vector< EnergySumTemplate > > &)
void setGtNumberConditionChips(const unsigned int &)
void setGtAlgorithmImplementation(const std::string &)
void setCondRelativeBx(const int &cRelativeBx)
Definition: GtCondition.h:127
void cleanupXML(XERCES_CPP_NAMESPACE::XercesDOMParser *parser)
shutdown the xml utils and deallocate parser and error handler
XERCES_CPP_NAMESPACE::XercesDOMParser * initXML(const std::string &xmlFile)
init xml system
bool parseCorrelation(XERCES_CPP_NAMESPACE::DOMNode *node, const std::string &name, unsigned int chipNr=0)
parse a correlation condition
std::string getXMLTextValue(XERCES_CPP_NAMESPACE::DOMNode *node)
get the text value of a xml node as string
bool parseAlgorithms(l1t::AlgorithmList algorithms)
parse all algorithms
void setCorCaloTemplate(const std::vector< std::vector< CaloTemplate > > &)
void setCorMuonTemplate(const std::vector< std::vector< MuonTemplate > > &)
void setVecCorrelationTemplate(const std::vector< std::vector< CorrelationTemplate > > &)
long double T
void setGtTriggerMenuInterface(const std::string &)
void setGtTriggerMenuDate(const std::string &)
void setGtNumberTechTriggers(const unsigned int &)
void setGtTriggerMenuAuthor(const std::string &)
bool getXMLHexTextValueOld(XERCES_CPP_NAMESPACE::DOMNode *node, boost::uint64_t &dst)
get a hexadecimal value of a xml node containing text
void setConditionParameter(const std::vector< ObjectParameter > &)
set functions
int getGEqFlag(XERCES_CPP_NAMESPACE::DOMNode *node, const std::string &nodeName)
getGEqFlag - get the &quot;greater or equal flag&quot; from a condition
int getNumFromType(const std::string &type)
get number of particles from condition type
bool parseCastor(XERCES_CPP_NAMESPACE::DOMNode *node, const std::string &name, unsigned int chipNr=0)
parse a CASTOR condition
bool parseBptx(XERCES_CPP_NAMESPACE::DOMNode *node, const std::string &name, unsigned int chipNr=0)
parse a Bptx condition