CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes | Private Member Functions | Private Attributes
l1t::XmlConfigReader Class Reference

#include <XmlConfigReader.h>

Public Member Functions

void buildGlobalDoc (const std::string &key, const std::string &topPath="")
 
xercesc::DOMElement * getKeyElement (const std::string &key)
 
void readContext (const xercesc::DOMElement *element, const std::string &sysId, TrigSystem &aTrigSystem)
 
void readContexts (const std::string &key, const std::string &sysId, TrigSystem &aTrigSystem)
 
void readDOMFromFile (const std::string &fName, xercesc::DOMDocument *&doc)
 
void readDOMFromFile (const std::string &fName)
 
void readDOMFromString (const std::string &str, xercesc::DOMDocument *&doc)
 
void readDOMFromString (const std::string &str)
 
void readElement (const xercesc::DOMElement *element, TrigSystem &aTrigSystem, const std::string &sysId="")
 
void readHwDescription (const xercesc::DOMElement *element, TrigSystem &aTrigSystem, const std::string &sysId="")
 
void readRootElement (TrigSystem &aTrigSystem, const std::string &sysId="")
 
 XmlConfigReader ()
 
 XmlConfigReader (xercesc::DOMDocument *doc)
 
 ~XmlConfigReader ()
 

Public Attributes

const XMLCh * kAttrDelim
 
const XMLCh * kAttrId
 
const XMLCh * kAttrModule
 
const XMLCh * kAttrType
 
const XMLCh * kTagAlgo
 
const XMLCh * kTagColumns
 
const XMLCh * kTagContext
 
const XMLCh * kTagCrate
 
const XMLCh * kTagDaqTtc
 
const XMLCh * kTagDb
 
const XMLCh * kTagDisable
 
const XMLCh * kTagExclBoards
 
const XMLCh * kTagExclude
 
const XMLCh * kTagHw
 
const XMLCh * kTagKey
 
const XMLCh * kTagLoad
 
const XMLCh * kTagMask
 
const XMLCh * kTagParam
 
const XMLCh * kTagProcessor
 
const XMLCh * kTagRole
 
const XMLCh * kTagRow
 
const XMLCh * kTagRunSettings
 
const XMLCh * kTagSlot
 
const XMLCh * kTagTypes
 
const std::string kTypeTable
 

Private Member Functions

void appendNodesFromSubDoc (xercesc::DOMNode *parentNode, xercesc::DOMDocument *subDoc)
 
void pruneString (std::string &str)
 
char * pruneString (char *&str)
 

Private Attributes

xercesc::DOMDocument * doc_
 
xercesc::XercesDOMParser * parser_
 

Detailed Description

Definition at line 23 of file XmlConfigReader.h.

Constructor & Destructor Documentation

XmlConfigReader::XmlConfigReader ( )

Initialise XML parser

Definition at line 28 of file XmlConfigReader.cc.

References doc_, kAttrDelim, kAttrId, kAttrModule, kAttrType, kTagAlgo, kTagColumns, kTagContext, kTagCrate, kTagDaqTtc, kTagDb, kTagDisable, kTagExclBoards, kTagExclude, kTagHw, kTagKey, kTagLoad, kTagMask, kTagParam, kTagProcessor, kTagRole, kTagRow, kTagRunSettings, kTagSlot, kTagTypes, kTypeTable, and parser_.

28  :
29  kTagHw(nullptr),
30  kTagAlgo(nullptr),
31  kTagRunSettings(nullptr),
32  kTagDb(nullptr),
33  kTagKey(nullptr),
34  kTagLoad(nullptr),
35  kTagContext(nullptr),
36  kTagParam(nullptr),
37  kTagMask(nullptr),
38  kTagDisable(nullptr),
39  kTagExclBoards(nullptr),
40  kTagExclude(nullptr),
41  kTagColumns(nullptr),
42  kTagTypes(nullptr),
43  kTagRow(nullptr),
44  kTagProcessor( nullptr),
45  kTagRole(nullptr),
46  kTagCrate(nullptr),
47  kTagSlot(nullptr),
48  kTagDaqTtc(nullptr),
49  kAttrId(nullptr),
50  kAttrType(nullptr),
51  kAttrDelim(nullptr),
52  kAttrModule(nullptr),
53  kTypeTable("table")
54 {
55  XMLPlatformUtils::Initialize();
56 
57  kTagHw = XMLString::transcode("system");
58  kTagAlgo = XMLString::transcode("algo");
59  kTagRunSettings = XMLString::transcode("run-settings");
60  kTagDb = XMLString::transcode("db");
61  kTagKey = XMLString::transcode("key");
62  kTagLoad = XMLString::transcode("load");
63  kTagContext = XMLString::transcode("context");
64  kTagParam = XMLString::transcode("param");
65  kTagMask = XMLString::transcode("mask");
66  kTagDisable = XMLString::transcode("disable");
67  kTagExclBoards = XMLString::transcode("excluded-boards");
68  kTagExclude = XMLString::transcode("exclude");
69  kTagColumns = XMLString::transcode("columns");
70  kTagTypes = XMLString::transcode("types");
71  kTagRow = XMLString::transcode("row");
72  kTagProcessor = XMLString::transcode("processor");
73  kTagRole = XMLString::transcode("role");
74  kTagCrate = XMLString::transcode("crate");
75  kTagSlot = XMLString::transcode("slot");
76  kTagDaqTtc = XMLString::transcode("daqttc-mgr");
77  kAttrId = XMLString::transcode("id");
78  kAttrType = XMLString::transcode("type");
79  kAttrDelim = XMLString::transcode("delimiter");
80  kAttrModule = XMLString::transcode("module");
81 
83  parser_ = new XercesDOMParser();
84  parser_->setValidationScheme(XercesDOMParser::Val_Auto);
85  parser_->setDoNamespaces(false);
86 
87  doc_ = nullptr;
88 }
const std::string kTypeTable
const XMLCh * kTagSlot
const XMLCh * kTagExclude
const XMLCh * kTagDaqTtc
const XMLCh * kTagKey
const XMLCh * kTagMask
const XMLCh * kTagCrate
const XMLCh * kTagRow
const XMLCh * kAttrType
const XMLCh * kTagExclBoards
const XMLCh * kTagTypes
const XMLCh * kTagLoad
const XMLCh * kTagContext
xercesc::XercesDOMParser * parser_
const XMLCh * kAttrDelim
const XMLCh * kTagDisable
const XMLCh * kTagHw
const XMLCh * kTagDb
const XMLCh * kTagParam
xercesc::DOMDocument * doc_
const XMLCh * kTagRole
const XMLCh * kAttrModule
const XMLCh * kTagRunSettings
const XMLCh * kTagProcessor
const XMLCh * kTagColumns
const XMLCh * kTagAlgo
const XMLCh * kAttrId
l1t::XmlConfigReader::XmlConfigReader ( xercesc::DOMDocument *  doc)
XmlConfigReader::~XmlConfigReader ( )

Definition at line 150 of file XmlConfigReader.cc.

References parser_, readDOMFromString(), harvestTrackValidationPlots::str, and AlCaHLTBitMon_QueryRunRegistry::string.

151 {
152  delete parser_;
153  XMLPlatformUtils::Terminate();
154 }
xercesc::XercesDOMParser * parser_

Member Function Documentation

void XmlConfigReader::appendNodesFromSubDoc ( xercesc::DOMNode *  parentNode,
xercesc::DOMDocument *  subDoc 
)
private

Definition at line 506 of file XmlConfigReader.cc.

References doc_, equals(), kTagAlgo, and kTagRunSettings.

Referenced by buildGlobalDoc().

507 {
508  DOMElement* subDocRootElement = subDoc->getDocumentElement();
509  //std::cout << "root element tag: " << _toString(subDocRootElement->getTagName()) << std::endl;
510  if (XMLString::equals(subDocRootElement->getTagName(), kTagAlgo) || XMLString::equals(subDocRootElement->getTagName(), kTagRunSettings)) {
511  DOMNode* importedNode = doc_->importNode(subDocRootElement, true);
512  parentNode->appendChild(importedNode);
513  }
514 }
bool equals(const edm::RefToBase< Jet > &j1, const edm::RefToBase< Jet > &j2)
xercesc::DOMDocument * doc_
const XMLCh * kTagRunSettings
const XMLCh * kTagAlgo
void XmlConfigReader::buildGlobalDoc ( const std::string &  key,
const std::string &  topPath = "" 
)

Definition at line 477 of file XmlConfigReader.cc.

References _toString(), appendNodesFromSubDoc(), MillePedeFileConverter_cfg::fileName, getKeyElement(), mps_fire::i, kAttrModule, kTagLoad, readDOMFromFile(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by l1t::TrigSystem::configureSystemFromFiles().

478 {
479  DOMElement* keyElement = getKeyElement(key);
480  if (keyElement) {
481  DOMNodeList* loadElements = keyElement->getElementsByTagName(kTagLoad);
482  for (XMLSize_t i = 0; i < loadElements->getLength(); ++i) {
483  DOMElement* loadElement = static_cast<DOMElement*>(loadElements->item(i));
484  std::string fileName = _toString(loadElement->getAttribute(kAttrModule));
485  if (fileName.find("/") != 0) { // load element has a relative path
486  // build an absolute path with directory of top xml file
487  size_t pos;
488  std::string topDir = "";
489  pos = topPath.find_last_of("/");
490  if (pos != std::string::npos) {
491  topDir = topPath.substr(0, pos+1);
492  }
493  fileName = topDir + fileName;
494  }
495  //std::cout << "loading file " << fileName << std::endl;
496  DOMDocument* subDoc = nullptr;
497  readDOMFromFile(fileName, subDoc);
498  if (subDoc) {
499  appendNodesFromSubDoc(keyElement, subDoc);
500  }
501  }
502  }
503 }
void readDOMFromFile(const std::string &fName, xercesc::DOMDocument *&doc)
const XMLCh * kTagLoad
const XMLCh * kAttrModule
xercesc::DOMElement * getKeyElement(const std::string &key)
void appendNodesFromSubDoc(xercesc::DOMNode *parentNode, xercesc::DOMDocument *subDoc)
std::string _toString(XMLCh const *toTranscode)
DOMElement * XmlConfigReader::getKeyElement ( const std::string &  key)

Definition at line 460 of file XmlConfigReader.cc.

References _toString(), doc_, equals(), mps_fire::i, kAttrId, kTagDb, and kTagKey.

Referenced by buildGlobalDoc(), and readContexts().

461 {
462  DOMElement* rootElement = doc_->getDocumentElement();
463  if (XMLString::equals(rootElement->getTagName(), kTagDb)) {
464  DOMNodeList* keyElements = rootElement->getElementsByTagName(kTagKey);
465 
466  for (XMLSize_t i = 0; i < keyElements->getLength(); ++i) {
467  DOMElement* keyElement = static_cast<DOMElement*>(keyElements->item(i));
468  if (_toString(keyElement->getAttribute(kAttrId)) == key) { // we found the key we were looking for
469  return keyElement;
470  }
471  }
472  }
473  return nullptr;
474 }
const XMLCh * kTagKey
const XMLCh * kTagDb
bool equals(const edm::RefToBase< Jet > &j1, const edm::RefToBase< Jet > &j2)
xercesc::DOMDocument * doc_
const XMLCh * kAttrId
std::string _toString(XMLCh const *toTranscode)
void XmlConfigReader::pruneString ( std::string &  str)
private

Definition at line 556 of file XmlConfigReader.cc.

Referenced by readContext().

557 {
558  std::size_t alphanumBegin = str.find_first_not_of("\n\t ");
559  std::size_t alphanumEnd = str.find_last_not_of("\n\t ");
560  if (alphanumBegin != std::string::npos) {
561  if (alphanumEnd != std::string::npos) {
562  str = str.substr(alphanumBegin, alphanumEnd - alphanumBegin + 1);
563  } else {
564  str = str.substr(alphanumBegin);
565  }
566  }
567 }
char * XmlConfigReader::pruneString ( char *&  str)
private

Definition at line 545 of file XmlConfigReader.cc.

References XmlConfigReader_reject_symbols.

546 {
547  size_t alphanumBegin = 0, alphanumEnd = strlen(str)-1;
548 
549  while( str[alphanumBegin] && XmlConfigReader_reject_symbols[ unsigned(str[alphanumBegin]) ] ) alphanumBegin++;
550  while( alphanumEnd >= alphanumBegin && XmlConfigReader_reject_symbols[ unsigned(str[alphanumEnd] ) ] ) alphanumEnd--;
551 
552  str[alphanumEnd+1] = '\0';
553  return str + alphanumBegin;
554 }
const char XmlConfigReader_reject_symbols[256]
void XmlConfigReader::readContext ( const xercesc::DOMElement *  element,
const std::string &  sysId,
TrigSystem aTrigSystem 
)

columnsStr = _toString(colChilds->item(k)->getNodeValue()); pruneString(columnsStr);

typesStr = _toString(colTypesChilds->item(k)->getNodeValue()); pruneString(typesStr);

std::string rowStr = _toString(rowChilds->item(k)->getNodeValue()); pruneString(rowStr); rowStrs.push_back(rowStr);

Definition at line 330 of file XmlConfigReader.cc.

References _toString(), l1t::TrigSystem::addMask(), l1t::TrigSystem::addSetting(), l1t::TrigSystem::addSettingTable(), cms::xerces::cStr(), tablePrinter::delim, l1t::TrigSystem::disableDaqProc(), HTMLExport::elem(), equals(), mps_fire::i, gen::k, kAttrDelim, kAttrId, kAttrType, kTagColumns, kTagContext, kTagDisable, kTagMask, kTagParam, kTagRow, kTagTypes, kTypeTable, pruneString(), fetchall_from_DQM_v2::release, AlCaHLTBitMon_QueryRunRegistry::string, and l1t::TrigSystem::systemId().

Referenced by readContexts(), and readElement().

331 {
332  std::string systemId = sysId;
333  if (systemId == "") {
334  systemId = aTrigSystem.systemId();
335  }
336  if (_toString(element->getAttribute(kAttrId)) == systemId) {
337  DOMNodeList* contextElements = element->getElementsByTagName(kTagContext);
338 
339  for (XMLSize_t i = 0; i < contextElements->getLength(); ++i) {
340  DOMElement* contextElement = static_cast<DOMElement*>(contextElements->item(i));
341  std::string contextId = _toString(contextElement->getAttribute(kAttrId));
342 
343  for (DOMElement* elem = static_cast<DOMElement*>(contextElement->getFirstChild()); elem; elem = static_cast<DOMElement*>(elem->getNextSibling())) {
344  if (elem->getNodeType() == DOMNode::ELEMENT_NODE) {
345  if (XMLString::equals(elem->getTagName(), kTagParam)) {
346  // found a parameter
347  char *id = xercesc::XMLString::transcode( elem->getAttribute(kAttrId) );
348  char *type = xercesc::XMLString::transcode( elem->getAttribute(kAttrType) );
349  char *delim = xercesc::XMLString::transcode( elem->getAttribute(kAttrDelim) );
350 
351  // the type table needs special treatment since it consists of child nodes
352  if (type == kTypeTable) {
353 
354  // get the columns string
355  std::string columnsStr = "";
356  DOMNodeList* colElements = elem->getElementsByTagName(kTagColumns);
357  for (XMLSize_t j = 0; j < colElements->getLength(); ++j) {
358  DOMNodeList* colChilds = colElements->item(j)->getChildNodes();
359  for (XMLSize_t k = 0; k < colChilds->getLength(); ++k) {
360  if (colChilds->item(k)->getNodeType() == DOMNode::TEXT_NODE) {
363  char *cStr = xercesc::XMLString::transcode( colChilds->item(k)->getNodeValue() );
364  columnsStr = pruneString( cStr );
366  }
367  }
368  }
369 
370  // get the column type string
371  std::string typesStr = "";
372  DOMNodeList* colTypesElements = elem->getElementsByTagName(kTagTypes);
373  for (XMLSize_t j = 0; j < colTypesElements->getLength(); ++j) {
374  DOMNodeList* colTypesChilds = colTypesElements->item(j)->getChildNodes();
375  for (XMLSize_t k = 0; k < colTypesChilds->getLength(); ++k) {
376  if (colTypesChilds->item(k)->getNodeType() == DOMNode::TEXT_NODE) {
379  char *tStr = xercesc::XMLString::transcode( colTypesChilds->item(k)->getNodeValue() );
380  typesStr = pruneString( tStr );
382  }
383  }
384  }
385 
386  // get the rows
387  std::vector<std::string> rowStrs;
388  DOMNodeList* rowElements = elem->getElementsByTagName(kTagRow);
389  for (XMLSize_t j = 0; j < rowElements->getLength(); ++j) {
390  DOMNodeList* rowChilds = rowElements->item(j)->getChildNodes();
391  for (XMLSize_t k = 0; k < rowChilds->getLength(); ++k) {
392  if (rowChilds->item(k)->getNodeType() == DOMNode::TEXT_NODE) {
396  char *rStr = xercesc::XMLString::transcode( rowChilds->item(k)->getNodeValue() );
397  rowStrs.push_back( pruneString(rStr) );
399  }
400  }
401  }
402 // std::cout << "param element node with id attribute " << id << " and type attribute " << typesStr << std::endl;
403  aTrigSystem.addSettingTable(std::string(id), columnsStr, typesStr, rowStrs, contextId, std::string(delim));
404 
405  } else { // all types other than table
406  std::string value = "";
407  DOMNodeList* valNodes = elem->getChildNodes();
408  for (XMLSize_t j = 0; j < valNodes->getLength(); ++j) {
409  if (valNodes->item(j)->getNodeType() == DOMNode::TEXT_NODE) {
410  value += _toString(valNodes->item(j)->getNodeValue());
411  }
412  }
413 
414  // strip leading and trailing line breaks and spaces
415  pruneString(value);
416 
417 // std::cout << "param element node with id attribute " << id << " and type attribute " << type << " with value: [" << value << "]" << std::endl;
418  aTrigSystem.addSetting(std::string(type), std::string(id), value, contextId, std::string(delim));
419  }
420 
424 
425  } else if (XMLString::equals(elem->getTagName(), kTagMask)) {
426  // found a Mask
427  std::string id = _toString(elem->getAttribute(kAttrId));
428  //std::cout << "Mask element node with id attribute " << id << std::endl;
429  aTrigSystem.addMask(id, contextId);
430 
431  } else if (XMLString::equals(elem->getTagName(), kTagDisable)) {
432  // found a disable
433  std::string id = _toString(elem->getAttribute(kAttrId));
434  aTrigSystem.disableDaqProc(id);
435  }
436  }
437  }
438  }
439  }
440 }
void disableDaqProc(const std::string &daqProc)
Definition: TrigSystem.cc:340
type
Definition: HCALResponse.h:21
const std::string kTypeTable
const XMLCh * kTagMask
void addMask(const std::string &id, const std::string &procRole)
Definition: TrigSystem.cc:231
void addSetting(const std::string &type, const std::string &id, const std::string &value, const std::string &procRole, const std::string &delim="")
Definition: TrigSystem.cc:82
const XMLCh * kTagRow
const XMLCh * kAttrType
const XMLCh * kTagTypes
const XMLCh * kTagContext
ZStr< char > cStr(XMLCh const *str)
const XMLCh * kAttrDelim
Definition: value.py:1
def elem(elemtype, innerHTML='', html_class='', kwargs)
Definition: HTMLExport.py:18
int k[5][pyjets_maxn]
const XMLCh * kTagDisable
bool equals(const edm::RefToBase< Jet > &j1, const edm::RefToBase< Jet > &j2)
std::string systemId()
Definition: TrigSystem.h:37
const XMLCh * kTagParam
void pruneString(std::string &str)
const XMLCh * kTagColumns
const XMLCh * kAttrId
std::string _toString(XMLCh const *toTranscode)
void addSettingTable(const std::string &id, const std::string &columns, const std::string &types, const std::vector< std::string > &rows, const std::string &procRole, const std::string &delim)
Definition: TrigSystem.cc:131
void XmlConfigReader::readContexts ( const std::string &  key,
const std::string &  sysId,
TrigSystem aTrigSystem 
)

Definition at line 443 of file XmlConfigReader.cc.

References gather_cfg::cout, HTMLExport::elem(), equals(), getKeyElement(), kTagAlgo, kTagRunSettings, and readContext().

Referenced by l1t::TrigSystem::configureSystemFromFiles().

444 {
445  DOMElement* keyElement = getKeyElement(key);
446  if (keyElement) {
447  for (DOMElement* elem = static_cast<DOMElement*>(keyElement->getFirstChild()); elem; elem = static_cast<DOMElement*>(elem->getNextSibling())) {
448  if (elem->getNodeType() == DOMNode::ELEMENT_NODE) {
449  if (XMLString::equals(elem->getTagName(), kTagAlgo) || XMLString::equals(elem->getTagName(), kTagRunSettings)) {
450  readContext(elem, sysId, aTrigSystem);
451  }
452  }
453  }
454  } else {
455  std::cout << "Key not found: " << key << std::endl;
456  }
457 }
def elem(elemtype, innerHTML='', html_class='', kwargs)
Definition: HTMLExport.py:18
bool equals(const edm::RefToBase< Jet > &j1, const edm::RefToBase< Jet > &j2)
const XMLCh * kTagRunSettings
xercesc::DOMElement * getKeyElement(const std::string &key)
const XMLCh * kTagAlgo
void readContext(const xercesc::DOMElement *element, const std::string &sysId, TrigSystem &aTrigSystem)
void l1t::XmlConfigReader::readDOMFromFile ( const std::string &  fName,
xercesc::DOMDocument *&  doc 
)
void XmlConfigReader::readDOMFromFile ( const std::string &  fName)

Definition at line 188 of file XmlConfigReader.cc.

References doc_, and parser_.

189 {
190  parser_->parse(fName.c_str());
191  doc_ = parser_->getDocument();
192 
193  if (! doc_) {
194  edm::LogError("XmlConfigReader") << "Could not parse file " << fName << "\n";
195  }
196 
197  assert(doc_);
198 }
xercesc::XercesDOMParser * parser_
xercesc::DOMDocument * doc_
void l1t::XmlConfigReader::readDOMFromString ( const std::string &  str,
xercesc::DOMDocument *&  doc 
)
void XmlConfigReader::readDOMFromString ( const std::string &  str)

Definition at line 166 of file XmlConfigReader.cc.

References doc_, parser_, readDOMFromFile(), and AlCaHLTBitMon_QueryRunRegistry::string.

167 {
168  MemBufInputSource xmlstr_buf((const XMLByte*)(str.c_str()), str.size(), "xmlstrbuf");
169  parser_->parse(xmlstr_buf);
170  doc_ = parser_->getDocument();
171  assert(doc_);
172 }
xercesc::XercesDOMParser * parser_
xercesc::DOMDocument * doc_
void XmlConfigReader::readElement ( const xercesc::DOMElement *  element,
TrigSystem aTrigSystem,
const std::string &  sysId = "" 
)

Definition at line 214 of file XmlConfigReader.cc.

References equals(), kTagAlgo, kTagHw, kTagRunSettings, readContext(), and readHwDescription().

Referenced by readRootElement().

215 {
216  if (XMLString::equals(element->getTagName(), kTagHw)) {
217  // in case this is a HW description
218  readHwDescription(element, aTrigSystem, sysId);
219  } else if (XMLString::equals(element->getTagName(), kTagAlgo) || XMLString::equals(element->getTagName(), kTagRunSettings)) {
220  // in case this is a configuration snippet
221  readContext(element, sysId, aTrigSystem);
222  }
223 }
void readHwDescription(const xercesc::DOMElement *element, TrigSystem &aTrigSystem, const std::string &sysId="")
const XMLCh * kTagHw
bool equals(const edm::RefToBase< Jet > &j1, const edm::RefToBase< Jet > &j2)
const XMLCh * kTagRunSettings
const XMLCh * kTagAlgo
void readContext(const xercesc::DOMElement *element, const std::string &sysId, TrigSystem &aTrigSystem)
void XmlConfigReader::readHwDescription ( const xercesc::DOMElement *  element,
TrigSystem aTrigSystem,
const std::string &  sysId = "" 
)

Definition at line 226 of file XmlConfigReader.cc.

References _toString(), l1t::TrigSystem::addDaqCrate(), l1t::TrigSystem::addDaqRole(), l1t::TrigSystem::addProcCrate(), l1t::TrigSystem::addProcRole(), l1t::TrigSystem::addProcSlot(), l1t::TrigSystem::disableDaqProc(), HTMLExport::elem(), equals(), mps_fire::i, kAttrId, kTagCrate, kTagDaqTtc, kTagExclBoards, kTagExclude, kTagProcessor, kTagRole, kTagSlot, l1t::TrigSystem::setSystemId(), AlCaHLTBitMon_QueryRunRegistry::string, and geometryCSVtoXML::xx.

Referenced by readElement().

227 {
228  // if sysId == "" set the systemId of the trigsystem from the xml sytem id
229  if (sysId != "" && sysId != _toString(element->getAttribute(kAttrId))) {
230  return;
231  }
232  aTrigSystem.setSystemId(_toString(element->getAttribute(kAttrId)));
233 
234  // handle processors
235  DOMNodeList* processors = element->getElementsByTagName(kTagProcessor);
236  XMLSize_t nodeCount = processors->getLength();
237  for (XMLSize_t xx = 0; xx < nodeCount; ++xx) {
238  DOMNode* currentNode = processors->item(xx);
239  if (currentNode->getNodeType() && currentNode->getNodeType() == DOMNode::ELEMENT_NODE) { //no null and is element
240  DOMElement* currentElement = static_cast<DOMElement*>( currentNode );
241  std::string procStr = _toString(currentElement->getAttribute(kAttrId));
242 
243  DOMNodeList* roles = currentElement->getElementsByTagName(kTagRole);
244  // roles of this processor (should be only one)
245  for (XMLSize_t i = 0; i < roles->getLength(); ++i) {
246  DOMNodeList* roleChilds = roles->item(i)->getChildNodes();
247  for (XMLSize_t j = 0; j < roleChilds->getLength(); ++j) {
248  if (roleChilds->item(j)->getNodeType() == DOMNode::TEXT_NODE) {
249  aTrigSystem.addProcRole(procStr, _toString(roleChilds->item(j)->getNodeValue()));
250  }
251  }
252  }
253 
254  DOMNodeList* crates = currentElement->getElementsByTagName(kTagCrate);
255  // crates of this processor (should be only one)
256  for (XMLSize_t i = 0; i < crates->getLength(); ++i) {
257  DOMNodeList* crateChilds = crates->item(i)->getChildNodes();
258  for (XMLSize_t j = 0; j < crateChilds->getLength(); ++j) {
259  if (crateChilds->item(j)->getNodeType() == DOMNode::TEXT_NODE) {
260  aTrigSystem.addProcCrate(procStr, _toString(crateChilds->item(j)->getNodeValue()));
261  }
262  }
263  }
264 
265  DOMNodeList* slots = currentElement->getElementsByTagName(kTagSlot);
266  // slots of this processor (should be only one)
267  for (XMLSize_t i = 0; i < slots->getLength(); ++i) {
268  DOMNodeList* slotChilds = slots->item(i)->getChildNodes();
269  for (XMLSize_t j = 0; j < slotChilds->getLength(); ++j) {
270  if (slotChilds->item(j)->getNodeType() == DOMNode::TEXT_NODE) {
271  aTrigSystem.addProcSlot(procStr, _toString(slotChilds->item(j)->getNodeValue()));
272  }
273  }
274  }
275 
276  }
277  }
278 
279  // handle DAQ TTC managers
280  DOMNodeList* daqttcs = element->getElementsByTagName(kTagDaqTtc);
281  nodeCount = daqttcs->getLength();
282  for (XMLSize_t xx = 0; xx < nodeCount; ++xx) {
283  DOMNode* currentNode = daqttcs->item(xx);
284  if (currentNode->getNodeType() && currentNode->getNodeType() == DOMNode::ELEMENT_NODE) { //no null and is element
285  DOMElement* currentElement = static_cast<DOMElement*>( currentNode );
286  std::string daqttcStr = _toString(currentElement->getAttribute(kAttrId));
287 
288  DOMNodeList* roles = currentElement->getElementsByTagName(kTagRole);
289  // roles of this DAQ TTC manager (should be only one)
290  for (XMLSize_t i = 0; i < roles->getLength(); ++i) {
291  DOMNodeList* roleChilds = roles->item(i)->getChildNodes();
292  for (XMLSize_t j = 0; j < roleChilds->getLength(); ++j) {
293  if (roleChilds->item(j)->getNodeType() == DOMNode::TEXT_NODE) {
294  aTrigSystem.addDaqRole(daqttcStr, _toString(roleChilds->item(j)->getNodeValue()));
295  }
296  }
297  }
298 
299  DOMNodeList* crates = currentElement->getElementsByTagName(kTagCrate);
300  // crates of this DAQ TTC manager (should be only one)
301  for (XMLSize_t i = 0; i < crates->getLength(); ++i) {
302  DOMNodeList* crateChilds = crates->item(i)->getChildNodes();
303  for (XMLSize_t j = 0; j < crateChilds->getLength(); ++j) {
304  if (crateChilds->item(j)->getNodeType() == DOMNode::TEXT_NODE) {
305  aTrigSystem.addDaqCrate(daqttcStr, _toString(crateChilds->item(j)->getNodeValue()));
306  }
307  }
308  }
309  }
310  }
311 
312  // handle excluded boards
313  DOMNodeList* exclBoards = element->getElementsByTagName(kTagExclBoards);
314  for (XMLSize_t xx = 0; xx < exclBoards->getLength(); ++xx) {
315  DOMElement* exclBoardElem = static_cast<DOMElement*>(exclBoards->item(xx));
316 
317  for (DOMElement* elem = static_cast<DOMElement*>(exclBoardElem->getFirstChild()); elem; elem = static_cast<DOMElement*>(elem->getNextSibling())) {
318  if (elem->getNodeType() == DOMNode::ELEMENT_NODE) {
319  if (XMLString::equals(elem->getTagName(), kTagExclude)) {
320  // found an excluded board
321  std::string id = _toString(elem->getAttribute(kAttrId));
322  aTrigSystem.disableDaqProc(id); // handle in the same way as disabled ids in the run-settings
323  }
324  }
325  }
326  }
327 }
void disableDaqProc(const std::string &daqProc)
Definition: TrigSystem.cc:340
const XMLCh * kTagSlot
const XMLCh * kTagExclude
const XMLCh * kTagDaqTtc
void addDaqRole(const std::string &daq, const std::string &role)
Definition: TrigSystem.cc:65
const XMLCh * kTagCrate
void addProcRole(const std::string &processor, const std::string &role)
Definition: TrigSystem.cc:39
const XMLCh * kTagExclBoards
void addProcCrate(const std::string &processor, const std::string &crate)
Definition: TrigSystem.cc:60
def elem(elemtype, innerHTML='', html_class='', kwargs)
Definition: HTMLExport.py:18
void addDaqCrate(const std::string &daq, const std::string &crate)
Definition: TrigSystem.cc:77
bool equals(const edm::RefToBase< Jet > &j1, const edm::RefToBase< Jet > &j2)
const XMLCh * kTagRole
void addProcSlot(const std::string &processor, const std::string &slot)
Definition: TrigSystem.cc:55
const XMLCh * kTagProcessor
void setSystemId(const std::string id)
Definition: TrigSystem.h:38
const XMLCh * kAttrId
std::string _toString(XMLCh const *toTranscode)
void XmlConfigReader::readRootElement ( TrigSystem aTrigSystem,
const std::string &  sysId = "" 
)

Definition at line 201 of file XmlConfigReader.cc.

References gather_cfg::cout, doc_, and readElement().

Referenced by l1t::TrigSystem::configureSystemFromFiles(), and L1TGlobalPrescalesVetosESProducer::L1TGlobalPrescalesVetosESProducer().

202 {
203  DOMElement* rootElement = doc_->getDocumentElement();
204  if (rootElement) {
205  if (rootElement->getNodeType() == DOMNode::ELEMENT_NODE) {
206  readElement(rootElement, aTrigSystem, sysId);
207  }
208  } else {
209  std::cout << "No xml root element found" << std::endl;
210  }
211 }
void readElement(const xercesc::DOMElement *element, TrigSystem &aTrigSystem, const std::string &sysId="")
xercesc::DOMDocument * doc_

Member Data Documentation

xercesc::DOMDocument* l1t::XmlConfigReader::doc_
private
const XMLCh* l1t::XmlConfigReader::kAttrDelim

Definition at line 49 of file XmlConfigReader.h.

Referenced by readContext(), and XmlConfigReader().

const XMLCh* l1t::XmlConfigReader::kAttrId

Definition at line 47 of file XmlConfigReader.h.

Referenced by getKeyElement(), readContext(), readHwDescription(), and XmlConfigReader().

const XMLCh* l1t::XmlConfigReader::kAttrModule

Definition at line 50 of file XmlConfigReader.h.

Referenced by buildGlobalDoc(), and XmlConfigReader().

const XMLCh* l1t::XmlConfigReader::kAttrType

Definition at line 48 of file XmlConfigReader.h.

Referenced by readContext(), and XmlConfigReader().

const XMLCh* l1t::XmlConfigReader::kTagAlgo
const XMLCh* l1t::XmlConfigReader::kTagColumns

Definition at line 39 of file XmlConfigReader.h.

Referenced by readContext(), and XmlConfigReader().

const XMLCh* l1t::XmlConfigReader::kTagContext

Definition at line 33 of file XmlConfigReader.h.

Referenced by readContext(), and XmlConfigReader().

const XMLCh* l1t::XmlConfigReader::kTagCrate

Definition at line 44 of file XmlConfigReader.h.

Referenced by readHwDescription(), and XmlConfigReader().

const XMLCh* l1t::XmlConfigReader::kTagDaqTtc

Definition at line 46 of file XmlConfigReader.h.

Referenced by readHwDescription(), and XmlConfigReader().

const XMLCh* l1t::XmlConfigReader::kTagDb

Definition at line 30 of file XmlConfigReader.h.

Referenced by getKeyElement(), and XmlConfigReader().

const XMLCh* l1t::XmlConfigReader::kTagDisable

Definition at line 36 of file XmlConfigReader.h.

Referenced by readContext(), and XmlConfigReader().

const XMLCh* l1t::XmlConfigReader::kTagExclBoards

Definition at line 37 of file XmlConfigReader.h.

Referenced by readHwDescription(), and XmlConfigReader().

const XMLCh* l1t::XmlConfigReader::kTagExclude

Definition at line 38 of file XmlConfigReader.h.

Referenced by readHwDescription(), and XmlConfigReader().

const XMLCh* l1t::XmlConfigReader::kTagHw

Definition at line 27 of file XmlConfigReader.h.

Referenced by readElement(), and XmlConfigReader().

const XMLCh* l1t::XmlConfigReader::kTagKey

Definition at line 31 of file XmlConfigReader.h.

Referenced by getKeyElement(), and XmlConfigReader().

const XMLCh* l1t::XmlConfigReader::kTagLoad

Definition at line 32 of file XmlConfigReader.h.

Referenced by buildGlobalDoc(), and XmlConfigReader().

const XMLCh* l1t::XmlConfigReader::kTagMask

Definition at line 35 of file XmlConfigReader.h.

Referenced by readContext(), and XmlConfigReader().

const XMLCh* l1t::XmlConfigReader::kTagParam

Definition at line 34 of file XmlConfigReader.h.

Referenced by readContext(), and XmlConfigReader().

const XMLCh* l1t::XmlConfigReader::kTagProcessor

Definition at line 42 of file XmlConfigReader.h.

Referenced by readHwDescription(), and XmlConfigReader().

const XMLCh* l1t::XmlConfigReader::kTagRole

Definition at line 43 of file XmlConfigReader.h.

Referenced by readHwDescription(), and XmlConfigReader().

const XMLCh* l1t::XmlConfigReader::kTagRow

Definition at line 41 of file XmlConfigReader.h.

Referenced by readContext(), and XmlConfigReader().

const XMLCh* l1t::XmlConfigReader::kTagRunSettings
const XMLCh* l1t::XmlConfigReader::kTagSlot

Definition at line 45 of file XmlConfigReader.h.

Referenced by readHwDescription(), and XmlConfigReader().

const XMLCh* l1t::XmlConfigReader::kTagTypes

Definition at line 40 of file XmlConfigReader.h.

Referenced by readContext(), and XmlConfigReader().

const std::string l1t::XmlConfigReader::kTypeTable

Definition at line 51 of file XmlConfigReader.h.

Referenced by readContext(), and XmlConfigReader().

xercesc::XercesDOMParser* l1t::XmlConfigReader::parser_
private