CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
XMLConfigReader Class Reference

#include <XMLConfigReader.h>

Public Member Functions

template<class GoldenPatternType >
std::unique_ptr< GoldenPatternType > buildGP (DOMElement *aGPElement, const L1TMuonOverlapParams &aConfig, unsigned int patternGroup, unsigned int index, unsigned int aGPNumber)
 
unsigned int getPatternsVersion () const
 
unsigned int getPatternsVersion () const
 
void readConfig (const std::string fName)
 
void readConfig (const std::string fName)
 
void readConfig (L1TMuonOverlapParams *aConfig) const
 
void readConfig (L1TMuonOverlapParams *aConfig) const
 
std::vector< std::vector< int > > readEvent (unsigned int iEvent=0, unsigned int iProcessor=0, bool readEta=false)
 
std::vector< std::vector< int > > readEvent (unsigned int iEvent=0, unsigned int iProcessor=0, bool readEta=false)
 
void readLUTs (std::vector< l1t::LUT *> luts, const L1TMuonOverlapParams &aConfig, const std::vector< std::string > &types)
 
void readLUTs (std::vector< l1t::LUT *> luts, const L1TMuonOverlapParams &aConfig, const std::vector< std::string > &types)
 
std::vector< std::shared_ptr< GoldenPattern > > readPatterns (const L1TMuonOverlapParams &aConfig)
 
template<class GoldenPatternType >
GoldenPatternVec< GoldenPatternType > readPatterns (const L1TMuonOverlapParams &aConfig, const std::string &patternsFile, bool buildEmptyPatterns, bool resetNumbering=true)
 
template<class GoldenPatternType >
GoldenPatternVec< GoldenPatternType > readPatterns (const L1TMuonOverlapParams &aConfig, const std::vector< std::string > &patternsFiles, bool buildEmptyPatterns)
 
void setConfigFile (const std::string &fName)
 
void setConfigFile (const std::string &fName)
 
void setEventsFile (const std::string &fName)
 
void setEventsFile (const std::string &fName)
 
void setPatternsFile (const std::string &fName)
 
void setPatternsFiles (std::vector< std::string > &fNames)
 
 XMLConfigReader ()
 
 XMLConfigReader ()
 
 ~XMLConfigReader ()
 
 ~XMLConfigReader ()
 

Private Member Functions

std::unique_ptr< GoldenPatternbuildGP (xercesc::DOMElement *aGPElement, const L1TMuonOverlapParams &aConfig, unsigned int index=0, unsigned int aGPNumber=999)
 
template<class GoldenPatternType >
std::unique_ptr< GoldenPatternType > buildGP (xercesc::DOMElement *aGPElement, const L1TMuonOverlapParams &aConfig, unsigned int patternGroup, unsigned int index=0, unsigned int aGPNumber=999)
 

Private Attributes

std::vector< std::shared_ptr< GoldenPattern > > aGPs
 Cache with GPs read. More...
 
std::string configFile
 
std::string eventsFile
 
unsigned int iGPNumber = 0
 
unsigned int iPatternGroup = 0
 
std::string patternsFile
 
std::vector< std::string > patternsFiles
 

Detailed Description

Definition at line 26 of file XMLConfigReader.h.

Constructor & Destructor Documentation

◆ XMLConfigReader() [1/2]

XMLConfigReader::XMLConfigReader ( )

Initialise XML parser

Definition at line 42 of file XMLConfigReader.cc.

42  {
43  //XMLPlatformUtils::Initialize();
44 
46  //parser = new XercesDOMParser();
47  //parser->setValidationScheme(XercesDOMParser::Val_Auto);
48  //parser->setDoNamespaces(false);
49 
50  //doc = 0;
51 }

◆ ~XMLConfigReader() [1/2]

XMLConfigReader::~XMLConfigReader ( )

Definition at line 53 of file XMLConfigReader.cc.

53  {
54  // delete parser;
55  //XMLPlatformUtils::Terminate();
56 }

◆ XMLConfigReader() [2/2]

XMLConfigReader::XMLConfigReader ( )

◆ ~XMLConfigReader() [2/2]

XMLConfigReader::~XMLConfigReader ( )

Member Function Documentation

◆ buildGP() [1/3]

std::unique_ptr<GoldenPattern> XMLConfigReader::buildGP ( xercesc::DOMElement *  aGPElement,
const L1TMuonOverlapParams aConfig,
unsigned int  index = 0,
unsigned int  aGPNumber = 999 
)
private

Referenced by readPatterns().

◆ buildGP() [2/3]

template<class GoldenPatternType >
std::unique_ptr<GoldenPatternType> XMLConfigReader::buildGP ( xercesc::DOMElement *  aGPElement,
const L1TMuonOverlapParams aConfig,
unsigned int  patternGroup,
unsigned int  index = 0,
unsigned int  aGPNumber = 999 
)
private

◆ buildGP() [3/3]

template<class GoldenPatternType >
std::unique_ptr<GoldenPatternType> XMLConfigReader::buildGP ( DOMElement *  aGPElement,
const L1TMuonOverlapParams aConfig,
unsigned int  patternGroup,
unsigned int  index,
unsigned int  aGPNumber 
)

Build empty GP

Loop over layers

MeanDistPhi vector

PDF vector

Definition at line 331 of file XMLConfigReader.cc.

References _toDOMS(), _toString(), cms::cuda::assert(), Exception, l1tTowerCalibrationProducer_cfi::iEta, MuonTCMETValueMapProducer_cff::nLayers, L1TMuonOverlapParams::nLayers(), L1TMuonOverlapParams::nPdfAddrBits(), L1TMuonOverlapParams::nRefLayers(), fetchall_from_DQM_v2::release, AlCaHLTBitMon_QueryRunRegistry::string, Key::theGroup, Key::theIndexInGroup, particleFlowZeroSuppressionECAL_cff::thresholds, and heppy_batch::val.

335  {
336  XMLCh *xmliEta = _toDOMS("iEta");
337  //index 0 means no number at the end
338  std::ostringstream stringStr;
339  if (index > 0)
340  stringStr << "iPt" << index;
341  else
342  stringStr.str("iPt");
343  XMLCh *xmliPt = _toDOMS(stringStr.str());
344  stringStr.str("");
345 
346  if (index > 0)
347  stringStr << "value" << index;
348  else
349  stringStr.str("value");
350  XMLCh *xmlValue = _toDOMS(stringStr.str());
351 
352  XMLCh *xmliCharge = _toDOMS("iCharge");
353  XMLCh *xmlLayer = _toDOMS("Layer");
354  XMLCh *xmlRefLayer = _toDOMS("RefLayer");
355  XMLCh *xmlmeanDistPhi = _toDOMS("meanDistPhi"); //for old version
356 
357  XMLCh *xmlmeanDistPhi0 = _toDOMS("meanDistPhi0"); //for new version
358  XMLCh *xmlmeanDistPhi1 = _toDOMS("meanDistPhi1"); //for new version
359 
360  XMLCh *xmlSelDistPhiShift = _toDOMS("selDistPhiShift");
361 
362  XMLCh *xmlPDF = _toDOMS("PDF");
363 
364  unsigned int iPt = std::atoi(_toString(aGPElement->getAttribute(xmliPt)).c_str());
365  int iEta = std::atoi(_toString(aGPElement->getAttribute(xmliEta)).c_str());
366  int iCharge = std::atoi(_toString(aGPElement->getAttribute(xmliCharge)).c_str());
367  unsigned int nLayers = aGPElement->getElementsByTagName(xmlLayer)->getLength();
368 
369  if (nLayers)
370  assert(nLayers == (unsigned)aConfig.nLayers());
371 
372  DOMNode *aNode = nullptr;
373  DOMElement *aLayerElement = nullptr;
374  DOMElement *aItemElement = nullptr;
375 
376  if (iPt == 0) {
377  Key aKey(iEta, iPt, iCharge, aGPNumber);
378  auto aGP =
379  std::make_unique<GoldenPatternType>(aKey, aConfig.nLayers(), aConfig.nRefLayers(), aConfig.nPdfAddrBits());
380  return aGP;
381  }
382 
383  stringStr.str("");
384  XMLCh *xmlRefLayerThresh = _toDOMS("RefLayerThresh");
385  if (index > 0)
386  stringStr << "tresh" << index;
387  else
388  stringStr.str("tresh");
389  XMLCh *xmlTresh = _toDOMS(stringStr.str());
390  stringStr.str("");
391 
392  std::vector<PdfValueType> thresholds(aConfig.nRefLayers(), 0);
393  unsigned int nItems = aGPElement->getElementsByTagName(xmlRefLayerThresh)->getLength();
394  if (nItems > 0 && nItems != thresholds.size()) {
395  throw cms::Exception("OMTF::XMLConfigReader: nItems != thresholds.size()");
396  }
397  for (unsigned int iItem = 0; iItem < nItems; ++iItem) {
398  aNode = aGPElement->getElementsByTagName(xmlRefLayerThresh)->item(iItem);
399  aItemElement = dynamic_cast<DOMElement *>(aNode);
400  if (aItemElement == nullptr)
401  throw cms::Exception("OMTF::XMLConfigReader: aItemElement is 0");
402  std::string strVal = _toString(aItemElement->getAttribute(xmlTresh));
403  thresholds[iItem] = std::stof(strVal);
404  //LogTrace("l1tOmtfEventPrint")<<__FUNCTION__<<":"<<__LINE__<<" strVal "<<strVal<<" thresholds[iItem] "<<thresholds[iItem]<<std::endl;
405  }
406 
408  Key aKey(iEta, iPt, iCharge, aGPNumber);
409  aKey.theGroup = patternGroup;
410  aKey.theIndexInGroup = index;
411  auto aGP = std::make_unique<GoldenPatternType>(aKey, aConfig.nLayers(), aConfig.nRefLayers(), aConfig.nPdfAddrBits());
412  if (dynamic_cast<GoldenPatternWithThresh *>(aGP.get())) {
413  dynamic_cast<GoldenPatternWithThresh *>(aGP.get())->setThresholds(thresholds);
414  }
415  for (unsigned int iLayer = 0; iLayer < nLayers; ++iLayer) {
416  aNode = aGPElement->getElementsByTagName(xmlLayer)->item(iLayer);
417  aLayerElement = static_cast<DOMElement *>(aNode);
419  unsigned int nItems = aLayerElement->getElementsByTagName(xmlRefLayer)->getLength();
420  assert(nItems == (unsigned)aConfig.nRefLayers());
421  for (unsigned int iItem = 0; iItem < nItems; ++iItem) {
422  aNode = aLayerElement->getElementsByTagName(xmlRefLayer)->item(iItem);
423  aItemElement = static_cast<DOMElement *>(aNode);
424 
425  std::string strVal = _toString(aItemElement->getAttribute(xmlmeanDistPhi));
426  if (!strVal.empty()) {
427  aGP->setMeanDistPhiValue(std::stoi(strVal), iLayer, iItem, 0);
428  } else {
429  strVal = _toString(aItemElement->getAttribute(xmlmeanDistPhi0));
430  aGP->setMeanDistPhiValue(std::stoi(strVal), iLayer, iItem, 0);
431  strVal = _toString(aItemElement->getAttribute(xmlmeanDistPhi1));
432  aGP->setMeanDistPhiValue(std::stoi(strVal), iLayer, iItem, 1);
433  }
434 
435  strVal = _toString(aItemElement->getAttribute(xmlSelDistPhiShift));
436  if (!strVal.empty()) {
437  aGP->setDistPhiBitShift(std::stoi(strVal), iLayer, iItem);
438  }
439  }
440 
442  nItems = aLayerElement->getElementsByTagName(xmlPDF)->getLength();
443 
444  //debug
445  //if(nItems!=aConfig.nRefLayers()*exp2(aConfig.nPdfAddrBits()))
446  //LogTrace("l1tOmtfEventPrint")<<" iPt "<<iPt<<" iLayer "<<iLayer<<" nLayers "<<nLayers<<" nItems "<<nItems<<" nRefLayers "<<aConfig.nRefLayers()<<" nPdfAddrBits "<<aConfig.nPdfAddrBits()<<std::endl;
447 
448  assert(nItems == aConfig.nRefLayers() * exp2(aConfig.nPdfAddrBits()));
449  for (unsigned int iRefLayer = 0; iRefLayer < (unsigned)aConfig.nRefLayers(); ++iRefLayer) {
450  for (unsigned int iPdf = 0; iPdf < exp2(aConfig.nPdfAddrBits()); ++iPdf) {
451  aNode = aLayerElement->getElementsByTagName(xmlPDF)->item(iRefLayer * exp2(aConfig.nPdfAddrBits()) + iPdf);
452  aItemElement = static_cast<DOMElement *>(aNode);
453  PdfValueType val = std::atof(_toString(aItemElement->getAttribute(xmlValue)).c_str());
454  aGP->setPdfValue(val, iLayer, iRefLayer, iPdf);
455  }
456  }
457  }
458  XMLString::release(&xmliEta);
459  XMLString::release(&xmliPt);
460  XMLString::release(&xmliCharge);
461  XMLString::release(&xmlLayer);
462  XMLString::release(&xmlRefLayer);
463  XMLString::release(&xmlmeanDistPhi);
464  XMLString::release(&xmlPDF);
465  XMLString::release(&xmlValue);
466 
467  return aGP;
468 }
assert(be >=bs)
int nPdfAddrBits() const
Access to specific general settings.
XERCES_CPP_NAMESPACE_USE std::string _toString(XMLCh const *toTranscode)
float PdfValueType
XMLCh * _toDOMS(std::string temp)

◆ getPatternsVersion() [1/2]

unsigned int XMLConfigReader::getPatternsVersion ( ) const

Definition at line 132 of file XMLConfigReader.cc.

References _toDOMS(), _toString(), cms::cuda::assert(), hcalRecHitTable_cff::doc, writedatasetfile::parser, patternsFile, fetchall_from_DQM_v2::release, and BeamSplash_cfg::version.

Referenced by L1TMuonOverlapParamsESProducer::L1TMuonOverlapParamsESProducer(), and L1TMuonOverlapPhase1ParamsESProducer::L1TMuonOverlapPhase1ParamsESProducer().

132  {
133  if (patternsFile.empty())
134  return 0;
135 
136  unsigned int version = 0;
137  XMLPlatformUtils::Initialize();
138  {
139  XercesDOMParser parser;
140  parser.setValidationScheme(XercesDOMParser::Val_Auto);
141  parser.setDoNamespaces(false);
142 
143  parser.parse(patternsFile.c_str());
144  xercesc::DOMDocument *doc = parser.getDocument();
145  assert(doc);
146 
147  XMLCh *xmlOmtf = _toDOMS("OMTF");
148  XMLCh *xmlVersion = _toDOMS("version");
149  DOMNode *aNode = doc->getElementsByTagName(xmlOmtf)->item(0);
150  DOMElement *aOMTFElement = static_cast<DOMElement *>(aNode);
151 
152  version = std::stoul(_toString(aOMTFElement->getAttribute(xmlVersion)), nullptr, 16);
153  XMLString::release(&xmlOmtf);
154  XMLString::release(&xmlVersion);
155  parser.resetDocumentPool();
156  }
157  XMLPlatformUtils::Terminate();
158 
159  return version;
160 }
assert(be >=bs)
std::string patternsFile
XERCES_CPP_NAMESPACE_USE std::string _toString(XMLCh const *toTranscode)
XMLCh * _toDOMS(std::string temp)

◆ getPatternsVersion() [2/2]

unsigned int XMLConfigReader::getPatternsVersion ( ) const

◆ readConfig() [1/4]

void XMLConfigReader::readConfig ( const std::string  fName)

◆ readConfig() [2/4]

void XMLConfigReader::readConfig ( const std::string  fName)

◆ readConfig() [3/4]

void XMLConfigReader::readConfig ( L1TMuonOverlapParams aConfig) const

Addresing bits numbers

Chamber sectors connections to logic processros. Start/End values for all processors, and chamber types are put into a single vector

hw <-> logic numbering map

ref<->logic numberig map

Definition at line 340 of file XMLConfigReader.cc.

References _toDOMS(), _toString(), cms::cuda::assert(), L1TMuonOverlapParams::LayerMapNode::bendingLayer, configFile, L1TMuonOverlapParams::LayerMapNode::connectedToLayer, hcalRecHitTable_cff::doc, L1TMuonOverlapParams::GENERAL_ADDRBITS, L1TMuonOverlapParams::GENERAL_HITSPERLAYER, L1TMuonOverlapParams::GENERAL_NCONFIG, L1TMuonOverlapParams::GENERAL_NGOLDENPATTERNS, L1TMuonOverlapParams::GENERAL_NINPUTS, L1TMuonOverlapParams::GENERAL_NLAYERS, L1TMuonOverlapParams::GENERAL_NLOGIC_REGIONS, L1TMuonOverlapParams::GENERAL_NPROCESSORS, L1TMuonOverlapParams::GENERAL_NREFHITS, L1TMuonOverlapParams::GENERAL_NREFLAYERS, L1TMuonOverlapParams::GENERAL_NTESTREFHITS, L1TMuonOverlapParams::GENERAL_PHIBINS, L1TMuonOverlapParams::GENERAL_PHIBITS, L1TMuonOverlapParams::GENERAL_VALBITS, L1TMuonOverlapParams::LayerMapNode::hwNumber, mps_fire::i, L1TMuonOverlapParams::LayerInputNode::iFirstInput, cuy::ii, L1TMuonOverlapParams::RefHitNode::iInput, L1TMuonOverlapParams::LayerInputNode::iLayer, L1TMuonOverlapParams::RefHitNode::iPhiMax, L1TMuonOverlapParams::RefHitNode::iPhiMin, L1TMuonOverlapParams::RefHitNode::iRefHit, L1TMuonOverlapParams::RefHitNode::iRefLayer, L1TMuonOverlapParams::RefHitNode::iRegion, L1TMuonOverlapParams::LayerMapNode::logicNumber, L1TMuonOverlapParams::RefLayerMapNode::logicNumber, L1TMuonOverlapParams::LayerInputNode::nInputs, MuonTCMETValueMapProducer_cff::nLayers, ecaldqm::binning::nPhiBins, writedatasetfile::parser, L1TMuonOverlapParams::RefLayerMapNode::refLayer, fetchall_from_DQM_v2::release, L1TMuonOverlapParams::setConnectedSectorsEnd(), L1TMuonOverlapParams::setConnectedSectorsStart(), L1TMuonOverlapParams::setFwVersion(), L1TMuonOverlapParams::setGeneralParams(), L1TMuonOverlapParams::setGlobalPhiStartMap(), L1TMuonOverlapParams::setLayerInputMap(), L1TMuonOverlapParams::setLayerMap(), L1TMuonOverlapParams::setRefHitMap(), L1TMuonOverlapParams::setRefLayerMap(), and BeamSplash_cfg::version.

340  {
341  XMLPlatformUtils::Initialize();
342  {
343  XercesDOMParser parser;
344  parser.setValidationScheme(XercesDOMParser::Val_Auto);
345  parser.setDoNamespaces(false);
346 
347  XMLCh *xmlOMTF = _toDOMS("OMTF");
348  XMLCh *xmlversion = _toDOMS("version");
349  XMLCh *xmlGlobalData = _toDOMS("GlobalData");
350  XMLCh *xmlnPdfAddrBits = _toDOMS("nPdfAddrBits");
351  XMLCh *xmlnPdfValBits = _toDOMS("nPdfValBits");
352  XMLCh *xmlnPhiBits = _toDOMS("nPhiBits");
353  XMLCh *xmlnPhiBins = _toDOMS("nPhiBins");
354  XMLCh *xmlnProcessors = _toDOMS("nProcessors");
355  XMLCh *xmlnLogicRegions = _toDOMS("nLogicRegions");
356  XMLCh *xmlnInputs = _toDOMS("nInputs");
357  XMLCh *xmlnLayers = _toDOMS("nLayers");
358  XMLCh *xmlnRefLayers = _toDOMS("nRefLayers");
359  XMLCh *xmliProcessor = _toDOMS("iProcessor");
360  XMLCh *xmlbarrelMin = _toDOMS("barrelMin");
361  XMLCh *xmlbarrelMax = _toDOMS("barrelMax");
362  XMLCh *xmlendcap10DegMin = _toDOMS("endcap10DegMin");
363  XMLCh *xmlendcap10DegMax = _toDOMS("endcap10DegMax");
364  XMLCh *xmlendcap20DegMin = _toDOMS("endcap20DegMin");
365  XMLCh *xmlendcap20DegMax = _toDOMS("endcap20DegMax");
366  XMLCh *xmlLayerMap = _toDOMS("LayerMap");
367  XMLCh *xmlhwNumber = _toDOMS("hwNumber");
368  XMLCh *xmllogicNumber = _toDOMS("logicNumber");
369  XMLCh *xmlbendingLayer = _toDOMS("bendingLayer");
370  XMLCh *xmlconnectedToLayer = _toDOMS("connectedToLayer");
371  XMLCh *xmlRefLayerMap = _toDOMS("RefLayerMap");
372  XMLCh *xmlrefLayer = _toDOMS("refLayer");
373  XMLCh *xmlProcessor = _toDOMS("Processor");
374  XMLCh *xmlRefLayer = _toDOMS("RefLayer");
375  XMLCh *xmliRefLayer = _toDOMS("iRefLayer");
376  XMLCh *xmliGlobalPhiStart = _toDOMS("iGlobalPhiStart");
377  XMLCh *xmlRefHit = _toDOMS("RefHit");
378  XMLCh *xmliRefHit = _toDOMS("iRefHit");
379  XMLCh *xmliPhiMin = _toDOMS("iPhiMin");
380  XMLCh *xmliPhiMax = _toDOMS("iPhiMax");
381  XMLCh *xmliInput = _toDOMS("iInput");
382  XMLCh *xmliRegion = _toDOMS("iRegion");
383  XMLCh *xmlLogicRegion = _toDOMS("LogicRegion");
384  XMLCh *xmlLayer = _toDOMS("Layer");
385  XMLCh *xmliLayer = _toDOMS("iLayer");
386  XMLCh *xmliFirstInput = _toDOMS("iFirstInput");
387  XMLCh *xmlnHitsPerLayer = _toDOMS("nHitsPerLayer");
388  XMLCh *xmlnRefHits = _toDOMS("nRefHits");
389  XMLCh *xmlnTestRefHits = _toDOMS("nTestRefHits");
390  XMLCh *xmlnGoldenPatterns = _toDOMS("nGoldenPatterns");
391  XMLCh *xmlConnectionMap = _toDOMS("ConnectionMap");
392  parser.parse(configFile.c_str());
393  xercesc::DOMDocument *doc = parser.getDocument();
394  assert(doc);
395  unsigned int nElem = doc->getElementsByTagName(xmlOMTF)->getLength();
396  if (nElem != 1) {
397  edm::LogError("critical") << "Problem parsing XML file " << configFile << std::endl;
398  assert(nElem == 1);
399  }
400  DOMNode *aNode = doc->getElementsByTagName(xmlOMTF)->item(0);
401  DOMElement *aOMTFElement = static_cast<DOMElement *>(aNode);
402 
403  unsigned int version = std::stoul(_toString(aOMTFElement->getAttribute(xmlversion)), nullptr, 16);
404  aConfig->setFwVersion(version);
405 
407  nElem = aOMTFElement->getElementsByTagName(xmlGlobalData)->getLength();
408  assert(nElem == 1);
409  aNode = aOMTFElement->getElementsByTagName(xmlGlobalData)->item(0);
410  DOMElement *aElement = static_cast<DOMElement *>(aNode);
411 
412  unsigned int nPdfAddrBits = std::atoi(_toString(aElement->getAttribute(xmlnPdfAddrBits)).c_str());
413  unsigned int nPdfValBits = std::atoi(_toString(aElement->getAttribute(xmlnPdfValBits)).c_str());
414  unsigned int nHitsPerLayer = std::atoi(_toString(aElement->getAttribute(xmlnHitsPerLayer)).c_str());
415  unsigned int nPhiBits = std::atoi(_toString(aElement->getAttribute(xmlnPhiBits)).c_str());
416  unsigned int nPhiBins = std::atoi(_toString(aElement->getAttribute(xmlnPhiBins)).c_str());
417 
418  unsigned int nRefHits = std::atoi(_toString(aElement->getAttribute(xmlnRefHits)).c_str());
419  unsigned int nTestRefHits = std::atoi(_toString(aElement->getAttribute(xmlnTestRefHits)).c_str());
420  unsigned int nProcessors = std::atoi(_toString(aElement->getAttribute(xmlnProcessors)).c_str());
421  unsigned int nLogicRegions = std::atoi(_toString(aElement->getAttribute(xmlnLogicRegions)).c_str());
422  unsigned int nInputs = std::atoi(_toString(aElement->getAttribute(xmlnInputs)).c_str());
423  unsigned int nLayers = std::atoi(_toString(aElement->getAttribute(xmlnLayers)).c_str());
424  unsigned int nRefLayers = std::atoi(_toString(aElement->getAttribute(xmlnRefLayers)).c_str());
425  unsigned int nGoldenPatterns = std::atoi(_toString(aElement->getAttribute(xmlnGoldenPatterns)).c_str());
426 
427  std::vector<int> paramsVec(L1TMuonOverlapParams::GENERAL_NCONFIG);
428  paramsVec[L1TMuonOverlapParams::GENERAL_ADDRBITS] = nPdfAddrBits;
429  paramsVec[L1TMuonOverlapParams::GENERAL_VALBITS] = nPdfValBits;
430  paramsVec[L1TMuonOverlapParams::GENERAL_HITSPERLAYER] = nHitsPerLayer;
431  paramsVec[L1TMuonOverlapParams::GENERAL_PHIBITS] = nPhiBits;
433  paramsVec[L1TMuonOverlapParams::GENERAL_NREFHITS] = nRefHits;
434  paramsVec[L1TMuonOverlapParams::GENERAL_NTESTREFHITS] = nTestRefHits;
435  paramsVec[L1TMuonOverlapParams::GENERAL_NPROCESSORS] = nProcessors;
436  paramsVec[L1TMuonOverlapParams::GENERAL_NLOGIC_REGIONS] = nLogicRegions;
437  paramsVec[L1TMuonOverlapParams::GENERAL_NINPUTS] = nInputs;
439  paramsVec[L1TMuonOverlapParams::GENERAL_NREFLAYERS] = nRefLayers;
440  paramsVec[L1TMuonOverlapParams::GENERAL_NGOLDENPATTERNS] = nGoldenPatterns;
441  aConfig->setGeneralParams(paramsVec);
442 
445  std::vector<int> sectorsStart(3 * nProcessors), sectorsEnd(3 * nProcessors);
446  nElem = aOMTFElement->getElementsByTagName(xmlConnectionMap)->getLength();
447  DOMElement *aConnectionElement = nullptr;
448  for (unsigned int i = 0; i < nElem; ++i) {
449  aNode = aOMTFElement->getElementsByTagName(xmlConnectionMap)->item(i);
450  aConnectionElement = static_cast<DOMElement *>(aNode);
451  unsigned int iProcessor = std::atoi(_toString(aConnectionElement->getAttribute(xmliProcessor)).c_str());
452  unsigned int barrelMin = std::atoi(_toString(aConnectionElement->getAttribute(xmlbarrelMin)).c_str());
453  unsigned int barrelMax = std::atoi(_toString(aConnectionElement->getAttribute(xmlbarrelMax)).c_str());
454  unsigned int endcap10DegMin = std::atoi(_toString(aConnectionElement->getAttribute(xmlendcap10DegMin)).c_str());
455  unsigned int endcap10DegMax = std::atoi(_toString(aConnectionElement->getAttribute(xmlendcap10DegMax)).c_str());
456  unsigned int endcap20DegMin = std::atoi(_toString(aConnectionElement->getAttribute(xmlendcap20DegMin)).c_str());
457  unsigned int endcap20DegMax = std::atoi(_toString(aConnectionElement->getAttribute(xmlendcap20DegMax)).c_str());
458 
459  sectorsStart[iProcessor] = barrelMin;
460  sectorsStart[iProcessor + nProcessors] = endcap10DegMin;
461  sectorsStart[iProcessor + 2 * nProcessors] = endcap20DegMin;
462 
463  sectorsEnd[iProcessor] = barrelMax;
464  sectorsEnd[iProcessor + nProcessors] = endcap10DegMax;
465  sectorsEnd[iProcessor + 2 * nProcessors] = endcap20DegMax;
466  }
467  aConfig->setConnectedSectorsStart(sectorsStart);
468  aConfig->setConnectedSectorsEnd(sectorsEnd);
469 
471  std::vector<L1TMuonOverlapParams::LayerMapNode> aLayerMapVec;
473 
474  nElem = aOMTFElement->getElementsByTagName(xmlLayerMap)->getLength();
475  DOMElement *aLayerElement = nullptr;
476  for (unsigned int i = 0; i < nElem; ++i) {
477  aNode = aOMTFElement->getElementsByTagName(xmlLayerMap)->item(i);
478  aLayerElement = static_cast<DOMElement *>(aNode);
479  unsigned int hwNumber = std::atoi(_toString(aLayerElement->getAttribute(xmlhwNumber)).c_str());
480  unsigned int logicNumber = std::atoi(_toString(aLayerElement->getAttribute(xmllogicNumber)).c_str());
481  unsigned int isBendingLayer = std::atoi(_toString(aLayerElement->getAttribute(xmlbendingLayer)).c_str());
482  unsigned int iConnectedLayer = std::atoi(_toString(aLayerElement->getAttribute(xmlconnectedToLayer)).c_str());
483  aLayerMapNode.logicNumber = logicNumber;
484  aLayerMapNode.hwNumber = hwNumber;
485  aLayerMapNode.connectedToLayer = iConnectedLayer;
486  aLayerMapNode.bendingLayer = isBendingLayer;
487  aLayerMapVec.push_back(aLayerMapNode);
488  }
489  aConfig->setLayerMap(aLayerMapVec);
490 
492  std::vector<L1TMuonOverlapParams::RefLayerMapNode> aRefLayerMapVec;
494 
495  nElem = aOMTFElement->getElementsByTagName(xmlRefLayerMap)->getLength();
496  DOMElement *aRefLayerElement = nullptr;
497  for (unsigned int i = 0; i < nElem; ++i) {
498  aNode = aOMTFElement->getElementsByTagName(xmlRefLayerMap)->item(i);
499  aRefLayerElement = static_cast<DOMElement *>(aNode);
500  unsigned int refLayer = std::atoi(_toString(aRefLayerElement->getAttribute(xmlrefLayer)).c_str());
501  unsigned int logicNumber = std::atoi(_toString(aRefLayerElement->getAttribute(xmllogicNumber)).c_str());
502  aRefLayerNode.refLayer = refLayer;
503  aRefLayerNode.logicNumber = logicNumber;
504  aRefLayerMapVec.push_back(aRefLayerNode);
505  }
506  aConfig->setRefLayerMap(aRefLayerMapVec);
507 
508  std::vector<int> aGlobalPhiStartVec(nProcessors * nRefLayers);
509 
510  std::vector<L1TMuonOverlapParams::RefHitNode> aRefHitMapVec(nProcessors * nRefHits);
512 
513  std::vector<L1TMuonOverlapParams::LayerInputNode> aLayerInputMapVec(nProcessors * nLogicRegions * nLayers);
514  L1TMuonOverlapParams::LayerInputNode aLayerInputNode;
515 
516  nElem = aOMTFElement->getElementsByTagName(xmlProcessor)->getLength();
517  assert(nElem == nProcessors);
518  DOMElement *aProcessorElement = nullptr;
519  for (unsigned int i = 0; i < nElem; ++i) {
520  aNode = aOMTFElement->getElementsByTagName(xmlProcessor)->item(i);
521  aProcessorElement = static_cast<DOMElement *>(aNode);
522  unsigned int iProcessor = std::atoi(_toString(aProcessorElement->getAttribute(xmliProcessor)).c_str());
523  unsigned int nElem1 = aProcessorElement->getElementsByTagName(xmlRefLayer)->getLength();
524  assert(nElem1 == nRefLayers);
525  DOMElement *aRefLayerElement = nullptr;
526  for (unsigned int ii = 0; ii < nElem1; ++ii) {
527  aNode = aProcessorElement->getElementsByTagName(xmlRefLayer)->item(ii);
528  aRefLayerElement = static_cast<DOMElement *>(aNode);
529  unsigned int iRefLayer = std::atoi(_toString(aRefLayerElement->getAttribute(xmliRefLayer)).c_str());
530  int iPhi = std::atoi(_toString(aRefLayerElement->getAttribute(xmliGlobalPhiStart)).c_str());
531  aGlobalPhiStartVec[iRefLayer + iProcessor * nRefLayers] = iPhi;
532  }
534  nElem1 = aProcessorElement->getElementsByTagName(xmlRefHit)->getLength();
535  assert((iProcessor == 0 && nElem1 == nRefHits) || (iProcessor != 0 && nElem1 == 0));
536  DOMElement *aRefHitElement = nullptr;
537  for (unsigned int ii = 0; ii < nElem1; ++ii) {
538  aNode = aProcessorElement->getElementsByTagName(xmlRefHit)->item(ii);
539  aRefHitElement = static_cast<DOMElement *>(aNode);
540  unsigned int iRefHit = std::atoi(_toString(aRefHitElement->getAttribute(xmliRefHit)).c_str());
541  int iPhiMin = std::atoi(_toString(aRefHitElement->getAttribute(xmliPhiMin)).c_str());
542  int iPhiMax = std::atoi(_toString(aRefHitElement->getAttribute(xmliPhiMax)).c_str());
543  unsigned int iInput = std::atoi(_toString(aRefHitElement->getAttribute(xmliInput)).c_str());
544  unsigned int iRegion = std::atoi(_toString(aRefHitElement->getAttribute(xmliRegion)).c_str());
545  unsigned int iRefLayer = std::atoi(_toString(aRefHitElement->getAttribute(xmliRefLayer)).c_str());
546 
547  aRefHitNode.iRefHit = iRefHit;
548  aRefHitNode.iPhiMin = iPhiMin;
549  aRefHitNode.iPhiMax = iPhiMax;
550  aRefHitNode.iInput = iInput;
551  aRefHitNode.iRegion = iRegion;
552  aRefHitNode.iRefLayer = iRefLayer;
553  for (unsigned int iProcessor = 0; iProcessor < nProcessors; iProcessor++)
554  aRefHitMapVec[iRefHit + iProcessor * nRefHits] = aRefHitNode;
555  }
557  unsigned int nElem2 = aProcessorElement->getElementsByTagName(xmlLogicRegion)->getLength();
558  assert((iProcessor == 0 && nElem2 == nLogicRegions) || (iProcessor != 0 && nElem2 == 0));
559  DOMElement *aRegionElement = nullptr;
560  for (unsigned int ii = 0; ii < nElem2; ++ii) {
561  aNode = aProcessorElement->getElementsByTagName(xmlLogicRegion)->item(ii);
562  aRegionElement = static_cast<DOMElement *>(aNode);
563  unsigned int iRegion = std::atoi(_toString(aRegionElement->getAttribute(xmliRegion)).c_str());
564  unsigned int nElem3 = aRegionElement->getElementsByTagName(xmlLayer)->getLength();
565  assert(nElem3 == nLayers);
566  DOMElement *aLayerElement = nullptr;
567  for (unsigned int iii = 0; iii < nElem3; ++iii) {
568  aNode = aRegionElement->getElementsByTagName(xmlLayer)->item(iii);
569  aLayerElement = static_cast<DOMElement *>(aNode);
570  unsigned int iLayer = std::atoi(_toString(aLayerElement->getAttribute(xmliLayer)).c_str());
571  unsigned int iFirstInput = std::atoi(_toString(aLayerElement->getAttribute(xmliFirstInput)).c_str());
572  unsigned int nInputs = std::atoi(_toString(aLayerElement->getAttribute(xmlnInputs)).c_str());
573  aLayerInputNode.iLayer = iLayer;
574  aLayerInputNode.iFirstInput = iFirstInput;
575  aLayerInputNode.nInputs = nInputs;
576  for (unsigned int iProcessor = 0; iProcessor < nProcessors; ++iProcessor)
577  aLayerInputMapVec[iLayer + iRegion * nLayers + iProcessor * nLayers * nLogicRegions] = aLayerInputNode;
578  }
579  }
580  }
581 
582  aConfig->setGlobalPhiStartMap(aGlobalPhiStartVec);
583  aConfig->setLayerInputMap(aLayerInputMapVec);
584  aConfig->setRefHitMap(aRefHitMapVec);
585 
586  // Reset the documents vector pool and release all the associated memory back to the system.
587  parser.resetDocumentPool();
588 
589  XMLString::release(&xmlOMTF);
590  XMLString::release(&xmlversion);
591  XMLString::release(&xmlGlobalData);
592  XMLString::release(&xmlnPdfAddrBits);
593  XMLString::release(&xmlnPdfValBits);
594  XMLString::release(&xmlnPhiBits);
595  XMLString::release(&xmlnPhiBins);
596  XMLString::release(&xmlnProcessors);
597  XMLString::release(&xmlnLogicRegions);
598  XMLString::release(&xmlnInputs);
599  XMLString::release(&xmlnLayers);
600  XMLString::release(&xmlnRefLayers);
601  XMLString::release(&xmliProcessor);
602  XMLString::release(&xmlbarrelMin);
603  XMLString::release(&xmlbarrelMax);
604  XMLString::release(&xmlendcap10DegMin);
605  XMLString::release(&xmlendcap10DegMax);
606  XMLString::release(&xmlendcap20DegMin);
607  XMLString::release(&xmlendcap20DegMax);
608  XMLString::release(&xmlLayerMap);
609  XMLString::release(&xmlhwNumber);
610  XMLString::release(&xmllogicNumber);
611  XMLString::release(&xmlbendingLayer);
612  XMLString::release(&xmlconnectedToLayer);
613  XMLString::release(&xmlRefLayerMap);
614  XMLString::release(&xmlrefLayer);
615  XMLString::release(&xmlProcessor);
616  XMLString::release(&xmlRefLayer);
617  XMLString::release(&xmliRefLayer);
618  XMLString::release(&xmliGlobalPhiStart);
619  XMLString::release(&xmlRefHit);
620  XMLString::release(&xmliRefHit);
621  XMLString::release(&xmliPhiMin);
622  XMLString::release(&xmliPhiMax);
623  XMLString::release(&xmliInput);
624  XMLString::release(&xmliRegion);
625  XMLString::release(&xmlLogicRegion);
626  XMLString::release(&xmlLayer);
627  XMLString::release(&xmliLayer);
628  XMLString::release(&xmliFirstInput);
629  XMLString::release(&xmlnHitsPerLayer);
630  XMLString::release(&xmlnRefHits);
631  XMLString::release(&xmlnTestRefHits);
632  XMLString::release(&xmlnGoldenPatterns);
633  XMLString::release(&xmlConnectionMap);
634  }
635  XMLPlatformUtils::Terminate();
636 }
void setLayerMap(const std::vector< LayerMapNode > &aVector)
Connections definitions.
void setConnectedSectorsEnd(const std::vector< int > &aVector)
unsigned int hwNumber
short layer number used within OMTF emulator
void setRefLayerMap(const std::vector< RefLayerMapNode > &aVector)
unsigned int logicNumber
logic numer of the layer
Log< level::Error, false > LogError
assert(be >=bs)
void setGeneralParams(const std::vector< int > &paramsVec)
XERCES_CPP_NAMESPACE_USE std::string _toString(XMLCh const *toTranscode)
bool bendingLayer
Is this a bending layers?
ii
Definition: cuy.py:589
void setConnectedSectorsStart(const std::vector< int > &aVector)
unsigned int refLayer
Reference layer number.
void setGlobalPhiStartMap(const std::vector< int > &aVector)
void setLayerInputMap(const std::vector< LayerInputNode > &aVector)
void setRefHitMap(const std::vector< RefHitNode > &aVector)
XMLCh * _toDOMS(std::string temp)
unsigned int logicNumber
Corresponding logical layer number.
void setFwVersion(unsigned fwVersion)
std::string configFile

◆ readConfig() [4/4]

void XMLConfigReader::readConfig ( L1TMuonOverlapParams aConfig) const

◆ readEvent() [1/2]

std::vector< std::vector< int > > XMLConfigReader::readEvent ( unsigned int  iEvent = 0,
unsigned int  iProcessor = 0,
bool  readEta = false 
)

Definition at line 335 of file XMLConfigReader.cc.

Referenced by OMTFinput::readData().

335  {
336  return OMTFinput::vector2D();
337 }
std::vector< vector1D > vector2D
Definition: OMTFinput.h:14

◆ readEvent() [2/2]

std::vector<std::vector<int> > XMLConfigReader::readEvent ( unsigned int  iEvent = 0,
unsigned int  iProcessor = 0,
bool  readEta = false 
)

◆ readLUTs() [1/2]

void XMLConfigReader::readLUTs ( std::vector< l1t::LUT *>  luts,
const L1TMuonOverlapParams aConfig,
const std::vector< std::string > &  types 
)

Fill payload string

Prepare the header

Read the data into LUT

Definition at line 59 of file XMLConfigReader.cc.

References aGPs, mps_fire::i, recoMuon::in, L1TMuonOverlapParams::nLayers(), L1TMuonOverlapParams::nPdfAddrBits(), L1TMuonOverlapParams::nRefLayers(), MillePedeFileConverter_cfg::out, l1t::LUT::read(), readPatterns(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by L1TMuonOverlapParamsESProducer::readPatternsXML(), and L1TMuonOverlapPhase1ParamsESProducer::readPatternsXML().

61  {
63  auto const &aGPs = readPatterns(aConfig);
64 
65  for (unsigned int i = 0; i < luts.size(); i++) {
66  l1t::LUT *lut = luts[i];
67  const std::string &type = types[i];
68 
69  std::stringstream strStream;
70  int totalInWidth = 7; //Number of bits used to address LUT
71  int outWidth = 6; //Number of bits used to store LUT value
72 
73  if (type == "iCharge")
74  outWidth = 1;
75  if (type == "iEta")
76  outWidth = 2;
77  if (type == "iPt")
78  outWidth = 9;
79  if (type == "meanDistPhi") {
80  outWidth = 11;
81  totalInWidth = 14;
82  }
83  if (type == "pdf") {
84  outWidth = 6;
85  totalInWidth = 21;
86  }
87 
89  strStream << "#<header> V1 " << totalInWidth << " " << outWidth << " </header> " << std::endl;
90 
91  unsigned int in = 0;
92  int out = 0;
93  for (const auto &it : aGPs) {
94  if (type == "iCharge")
95  out = it->key().theCharge == -1 ? 0 : 1;
96  if (type == "iEta")
97  out = it->key().theEtaCode;
98  if (type == "iPt")
99  out = it->key().thePtCode;
100  if (type == "meanDistPhi") {
101  for (unsigned int iLayer = 0; iLayer < (unsigned)aConfig.nLayers(); ++iLayer) {
102  for (unsigned int iRefLayer = 0; iRefLayer < (unsigned)aConfig.nRefLayers(); ++iRefLayer) {
103  out = (1 << (outWidth - 1)) + it->meanDistPhiValue(iLayer, iRefLayer);
104  strStream << in << " " << out << std::endl;
105  ++in;
106  }
107  }
108  }
109  if (type == "pdf") {
110  for (unsigned int iLayer = 0; iLayer < (unsigned)aConfig.nLayers(); ++iLayer) {
111  for (unsigned int iRefLayer = 0; iRefLayer < (unsigned)aConfig.nRefLayers(); ++iRefLayer) {
112  for (unsigned int iPdf = 0; iPdf < exp2(aConfig.nPdfAddrBits()); ++iPdf) {
113  out = it->pdfValue(iLayer, iRefLayer, iPdf);
114  strStream << in << " " << out << std::endl;
115  ++in;
116  }
117  }
118  }
119  }
120  if (type != "meanDistPhi" && type != "pdf") {
121  strStream << in << " " << out << std::endl;
122  ++in;
123  }
124  }
125 
127  lut->read(strStream);
128  }
129 }
int read(std::istream &stream)
Definition: LUT.cc:11
int nPdfAddrBits() const
Access to specific general settings.
std::vector< std::shared_ptr< GoldenPattern > > readPatterns(const L1TMuonOverlapParams &aConfig)
std::vector< std::shared_ptr< GoldenPattern > > aGPs
Cache with GPs read.
Definition: LUT.h:29

◆ readLUTs() [2/2]

void XMLConfigReader::readLUTs ( std::vector< l1t::LUT *>  luts,
const L1TMuonOverlapParams aConfig,
const std::vector< std::string > &  types 
)

◆ readPatterns() [1/3]

std::vector< std::shared_ptr< GoldenPattern > > XMLConfigReader::readPatterns ( const L1TMuonOverlapParams aConfig)

Patterns XML format backward compatibility. Can use both packed by 4, or by 1 XML files.

Definition at line 163 of file XMLConfigReader.cc.

References _toDOMS(), aGPs, cms::cuda::assert(), buildGP(), hcalRecHitTable_cff::doc, iGPNumber, eostools::move(), writedatasetfile::parser, patternsFile, and fetchall_from_DQM_v2::release.

Referenced by OMTFReconstruction::beginRun(), and readLUTs().

163  {
164  aGPs.clear();
165 
166  XMLPlatformUtils::Initialize();
167 
168  XMLCh *xmlGP = _toDOMS("GP");
169  std::array<XMLCh *, 4> xmliPt = {{_toDOMS("iPt1"), _toDOMS("iPt2"), _toDOMS("iPt3"), _toDOMS("iPt4")}};
170 
171  {
172  XercesDOMParser parser;
173  parser.setValidationScheme(XercesDOMParser::Val_Auto);
174  parser.setDoNamespaces(false);
175 
176  parser.parse(patternsFile.c_str());
177  xercesc::DOMDocument *doc = parser.getDocument();
178  assert(doc);
179 
180  unsigned int nElem = doc->getElementsByTagName(xmlGP)->getLength();
181  if (nElem < 1) {
182  edm::LogError("critical") << "Problem parsing XML file " << patternsFile << std::endl;
183  edm::LogError("critical") << "No GoldenPattern items: GP found" << std::endl;
184  return aGPs;
185  }
186 
187  DOMNode *aNode = nullptr;
188  DOMElement *aGPElement = nullptr;
189  unsigned int iGPNumber = 0;
190 
191  for (unsigned int iItem = 0; iItem < nElem; ++iItem) {
192  aNode = doc->getElementsByTagName(xmlGP)->item(iItem);
193  aGPElement = static_cast<DOMElement *>(aNode);
194 
195  std::unique_ptr<GoldenPattern> aGP;
196  for (unsigned int index = 1; index < 5; ++index) {
198  if (aGPElement->getAttributeNode(xmliPt[index - 1])) {
199  aGP = buildGP(aGPElement, aConfig, index, iGPNumber);
200  if (aGP) {
201  aGPs.emplace_back(std::move(aGP));
202  iGPNumber++;
203  }
204  } else {
205  aGP = buildGP(aGPElement, aConfig);
206  if (aGP) {
207  aGPs.emplace_back(std::move(aGP));
208  iGPNumber++;
209  }
210  break;
211  }
212  }
213  }
214 
215  // Reset the documents vector pool and release all the associated memory back to the system.
216  //parser->resetDocumentPool();
217  parser.resetDocumentPool();
218  }
219  XMLString::release(&xmlGP);
220  XMLString::release(&xmliPt[0]);
221  XMLString::release(&xmliPt[1]);
222  XMLString::release(&xmliPt[2]);
223  XMLString::release(&xmliPt[3]);
224 
225  XMLPlatformUtils::Terminate();
226 
227  return aGPs;
228 }
Log< level::Error, false > LogError
assert(be >=bs)
std::string patternsFile
std::unique_ptr< GoldenPattern > buildGP(xercesc::DOMElement *aGPElement, const L1TMuonOverlapParams &aConfig, unsigned int index=0, unsigned int aGPNumber=999)
std::vector< std::shared_ptr< GoldenPattern > > aGPs
Cache with GPs read.
unsigned int iGPNumber
XMLCh * _toDOMS(std::string temp)
def move(src, dest)
Definition: eostools.py:511

◆ readPatterns() [2/3]

template<class GoldenPatternType >
GoldenPatternVec< GoldenPatternType > XMLConfigReader::readPatterns ( const L1TMuonOverlapParams aConfig,
const std::string &  patternsFile,
bool  buildEmptyPatterns,
bool  resetNumbering = true 
)

Patterns XML format backward compatibility. Can use both packed by 4, or by 1 XML files.

Definition at line 237 of file XMLConfigReader.cc.

References _toDOMS(), aGPs, cms::cuda::assert(), hcalRecHitTable_cff::doc, iGPNumber, iPatternGroup, eostools::move(), writedatasetfile::parser, patternsFile, and fetchall_from_DQM_v2::release.

240  {
242  aGPs.clear();
243 
244  XMLPlatformUtils::Initialize();
245 
246  if (resetNumbering) {
247  iGPNumber = 0;
248  iPatternGroup = 0;
249  }
250 
251  XMLCh *xmlGP = _toDOMS("GP");
252  std::array<XMLCh *, 4> xmliPt = {{_toDOMS("iPt1"), _toDOMS("iPt2"), _toDOMS("iPt3"), _toDOMS("iPt4")}};
253 
254  {
255  XercesDOMParser parser;
256  parser.setValidationScheme(XercesDOMParser::Val_Auto);
257  parser.setDoNamespaces(false);
258 
259  parser.parse(patternsFile.c_str());
260  xercesc::DOMDocument *doc = parser.getDocument();
261  assert(doc);
262 
263  unsigned int nElem = doc->getElementsByTagName(xmlGP)->getLength();
264  if (nElem < 1) {
265  edm::LogError("critical") << "Problem parsing XML file " << patternsFile << std::endl;
266  edm::LogError("critical") << "No GoldenPattern items: GP found" << std::endl;
267  return aGPs;
268  }
269 
270  DOMNode *aNode = nullptr;
271  DOMElement *aGPElement = nullptr;
272  //unsigned int iGPNumber=0;
273 
274  for (unsigned int iItem = 0; iItem < nElem; ++iItem, ++iPatternGroup) {
275  aNode = doc->getElementsByTagName(xmlGP)->item(iItem);
276  aGPElement = static_cast<DOMElement *>(aNode);
277 
278  for (unsigned int index = 1; index < 5; ++index) {
280  if (aGPElement->getAttributeNode(xmliPt[index - 1])) {
281  std::unique_ptr<GoldenPatternType> aGP =
282  buildGP<GoldenPatternType>(aGPElement, aConfig, iPatternGroup, index, iGPNumber);
283  if (aGP && (aGP->key().thePt || buildEmptyPatterns)) {
284  aGPs.emplace_back(std::move(aGP));
285  iGPNumber++;
286  }
287  } else {
288  std::unique_ptr<GoldenPatternType> aGP = buildGP<GoldenPatternType>(aGPElement, aConfig, iPatternGroup);
289  if (aGP && (aGP->key().thePt || buildEmptyPatterns)) {
290  aGPs.emplace_back(std::move(aGP));
291  iGPNumber++;
292  }
293  break;
294  }
295  }
296  }
297 
298  // Reset the documents vector pool and release all the associated memory back to the system.
299  //parser->resetDocumentPool();
300  parser.resetDocumentPool();
301  }
302  XMLString::release(&xmlGP);
303  XMLString::release(&xmliPt[0]);
304  XMLString::release(&xmliPt[1]);
305  XMLString::release(&xmliPt[2]);
306  XMLString::release(&xmliPt[3]);
307 
308  XMLPlatformUtils::Terminate();
309 
310  return aGPs;
311 }
unsigned int iPatternGroup
Log< level::Error, false > LogError
assert(be >=bs)
std::string patternsFile
std::vector< std::shared_ptr< GoldenPattern > > aGPs
Cache with GPs read.
unsigned int iGPNumber
std::vector< std::unique_ptr< GoldenPatternType > > GoldenPatternVec
XMLCh * _toDOMS(std::string temp)
def move(src, dest)
Definition: eostools.py:511

◆ readPatterns() [3/3]

template<class GoldenPatternType >
GoldenPatternVec< GoldenPatternType > XMLConfigReader::readPatterns ( const L1TMuonOverlapParams aConfig,
const std::vector< std::string > &  patternsFiles,
bool  buildEmptyPatterns 
)

Definition at line 315 of file XMLConfigReader.cc.

References aGPs, runTauDisplay::gp, iGPNumber, iPatternGroup, eostools::move(), and patternsFiles.

317  {
318  iGPNumber = 0;
319  iPatternGroup = 0;
321  for (const auto &aPatternsFile : patternsFiles) {
322  auto tmpGPs = readPatterns<GoldenPatternType>(aConfig, aPatternsFile, buildEmptyPatterns, false);
323  for (auto &gp : tmpGPs)
324  aGPs.push_back(std::move(gp));
325  }
326  return aGPs;
327 }
unsigned int iPatternGroup
std::vector< std::shared_ptr< GoldenPattern > > aGPs
Cache with GPs read.
unsigned int iGPNumber
std::vector< std::unique_ptr< GoldenPatternType > > GoldenPatternVec
std::vector< std::string > patternsFiles
def move(src, dest)
Definition: eostools.py:511

◆ setConfigFile() [1/2]

void XMLConfigReader::setConfigFile ( const std::string &  fName)
inline

◆ setConfigFile() [2/2]

void XMLConfigReader::setConfigFile ( const std::string &  fName)
inline

Definition at line 35 of file XMLConfigReader.h.

References configFile, and fileCollector2::fName.

◆ setEventsFile() [1/2]

void XMLConfigReader::setEventsFile ( const std::string &  fName)
inline

Definition at line 37 of file XMLConfigReader.h.

References eventsFile, and fileCollector2::fName.

◆ setEventsFile() [2/2]

void XMLConfigReader::setEventsFile ( const std::string &  fName)
inline

Definition at line 39 of file XMLConfigReader.h.

References eventsFile, and fileCollector2::fName.

◆ setPatternsFile()

void XMLConfigReader::setPatternsFile ( const std::string &  fName)
inline

◆ setPatternsFiles()

void XMLConfigReader::setPatternsFiles ( std::vector< std::string > &  fNames)
inline

Definition at line 37 of file XMLConfigReader.h.

References patternsFiles.

Referenced by L1TMuonOverlapPhase1ParamsESProducer::L1TMuonOverlapPhase1ParamsESProducer().

37 { patternsFiles = fNames; }
std::vector< std::string > patternsFiles

Member Data Documentation

◆ aGPs

std::vector<std::shared_ptr<GoldenPattern> > XMLConfigReader::aGPs
private

Cache with GPs read.

Definition at line 65 of file XMLConfigReader.h.

Referenced by readLUTs(), and readPatterns().

◆ configFile

std::string XMLConfigReader::configFile
private

◆ eventsFile

std::string XMLConfigReader::eventsFile
private

Definition at line 54 of file XMLConfigReader.h.

Referenced by setEventsFile().

◆ iGPNumber

unsigned int XMLConfigReader::iGPNumber = 0
private

Definition at line 78 of file XMLConfigReader.h.

Referenced by readPatterns().

◆ iPatternGroup

unsigned int XMLConfigReader::iPatternGroup = 0
private

Definition at line 79 of file XMLConfigReader.h.

Referenced by readPatterns().

◆ patternsFile

std::string XMLConfigReader::patternsFile
private

Definition at line 53 of file XMLConfigReader.h.

Referenced by getPatternsVersion(), readPatterns(), and setPatternsFile().

◆ patternsFiles

std::vector<std::string> XMLConfigReader::patternsFiles
private

Definition at line 68 of file XMLConfigReader.h.

Referenced by readPatterns(), and setPatternsFiles().