CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
XMLConfigReader Class Reference

#include <XMLConfigReader.h>

Public Member Functions

void readConfig (const std::string fName)
 
void readConfig (OMTFConfiguration *aConfig)
 
void readConfig (L1TMuonOverlapParams *aConfig)
 
std::vector< std::vector< int > > readEvent (unsigned int iEvent=0, unsigned int iProcessor=0, bool readEta=false)
 
void readLUT (l1t::LUT *lut, const std::string &type)
 
std::vector< GoldenPattern * > readPatterns ()
 
void setConfigFile (const std::string &fName)
 
void setEventsFile (const std::string &fName)
 
void setPatternsFile (const std::string &fName)
 
 XMLConfigReader (OMTFConfiguration *omtf_config)
 

Private Member Functions

GoldenPatternbuildGP (xercesc::DOMElement *aGPElement, unsigned int index=0)
 

Private Attributes

std::vector< GoldenPattern * > aGPs
 Cache with GPs read. More...
 
std::string configFile
 
xercesc::DOMDocument * doc
 
std::string eventsFile
 
OMTFConfigurationm_omtf_config
 
xercesc::XercesDOMParser * parser
 
std::string patternsFile
 

Detailed Description

Definition at line 26 of file XMLConfigReader.h.

Constructor & Destructor Documentation

XMLConfigReader::XMLConfigReader ( OMTFConfiguration omtf_config)

Initialise XML parser

Definition at line 41 of file XMLConfigReader.cc.

References doc, and parser.

41  : m_omtf_config(omtf_config) {
42 
43  XMLPlatformUtils::Initialize();
44 
46  parser = new XercesDOMParser();
47  parser->setValidationScheme(XercesDOMParser::Val_Auto);
48  parser->setDoNamespaces(false);
49 
50  doc = 0;
51 
52 
53 
54 }
xercesc::DOMDocument * doc
OMTFConfiguration * m_omtf_config
xercesc::XercesDOMParser * parser

Member Function Documentation

GoldenPattern * XMLConfigReader::buildGP ( xercesc::DOMElement *  aGPElement,
unsigned int  index = 0 
)
private

Loop over layers

MeanDistPhi vector

PDF vector

Definition at line 161 of file XMLConfigReader.cc.

References _toDOMS(), _toString(), assert(), cmsHarvester::index, m_omtf_config, OMTFConfiguration::nLayers, OMTFConfiguration::nPdfAddrBits, OMTFConfiguration::nRefLayers, GoldenPattern::setMeanDistPhi(), and GoldenPattern::setPdf().

Referenced by readPatterns().

162  {
163 
164  std::ostringstream stringStr;
165  if(index>0) stringStr<<"iPt"<<index;
166  else stringStr.str("iPt");
167 
168  unsigned int iPt = std::atoi(_toString(aGPElement->getAttribute(_toDOMS(stringStr.str().c_str()))).c_str());
169  if(iPt==0) return 0;
170 
171  int iEta = std::atoi(_toString(aGPElement->getAttribute(_toDOMS("iEta"))).c_str());
172  int iCharge = std::atoi(_toString(aGPElement->getAttribute(_toDOMS("iCharge"))).c_str());
173  int val = 0;
174  unsigned int nLayers = aGPElement->getElementsByTagName(_toDOMS("Layer"))->getLength();
175  assert(nLayers==m_omtf_config->nLayers);
176  DOMNode *aNode = 0;
177  DOMElement* aLayerElement = 0;
178  DOMElement* aItemElement = 0;
179  GoldenPattern::vector2D meanDistPhi2D(nLayers);
184  for(unsigned int iLayer=0;iLayer<nLayers;++iLayer){
185  aNode = aGPElement->getElementsByTagName(_toDOMS("Layer"))->item(iLayer);
186  aLayerElement = static_cast<DOMElement *>(aNode);
188  unsigned int nItems = aLayerElement->getElementsByTagName(_toDOMS("RefLayer"))->getLength();
189  assert(nItems==m_omtf_config->nRefLayers);
190  GoldenPattern::vector1D meanDistPhi1D(nItems);
191  for(unsigned int iItem=0;iItem<nItems;++iItem){
192  aNode = aLayerElement->getElementsByTagName(_toDOMS("RefLayer"))->item(iItem);
193  aItemElement = static_cast<DOMElement *>(aNode);
194  val = std::atoi(_toString(aItemElement->getAttribute(_toDOMS("meanDistPhi"))).c_str());
195  meanDistPhi1D[iItem] = val;
196  }
197  meanDistPhi2D[iLayer] = meanDistPhi1D;
198 
200  stringStr.str("");
201  if(index>0) stringStr<<"value"<<index;
202  else stringStr.str("value");
203  nItems = aLayerElement->getElementsByTagName(_toDOMS("PDF"))->getLength();
205  for(unsigned int iRefLayer=0;iRefLayer<m_omtf_config->nRefLayers;++iRefLayer){
206  pdf1D.assign(exp2(m_omtf_config->nPdfAddrBits),0);
207  for(unsigned int iPdf=0;iPdf<exp2(m_omtf_config->nPdfAddrBits);++iPdf){
208  aNode = aLayerElement->getElementsByTagName(_toDOMS("PDF"))->item(iRefLayer*exp2(m_omtf_config->nPdfAddrBits)+iPdf);
209  aItemElement = static_cast<DOMElement *>(aNode);
210  val = std::atoi(_toString(aItemElement->getAttribute(_toDOMS(stringStr.str().c_str()))).c_str());
211  pdf1D[iPdf] = val;
212  }
213  pdf2D[iRefLayer] = pdf1D;
214  }
215  pdf3D[iLayer] = pdf2D;
216  }
217 
218  Key aKey(iEta,iPt,iCharge);
219  GoldenPattern *aGP = new GoldenPattern(aKey);
220  aGP->setMeanDistPhi(meanDistPhi2D);
221  aGP->setPdf(pdf3D);
222 
223  return aGP;
224 }
unsigned int nLayers
std::vector< int > vector1D
Definition: GoldenPattern.h:49
assert(m_qm.get())
std::string _toString(const XMLCh *toTranscode)
OMTFConfiguration * m_omtf_config
unsigned int nPdfAddrBits
std::vector< vector1D > vector2D
Definition: GoldenPattern.h:50
std::vector< vector2D > vector3D
Definition: GoldenPattern.h:51
void setPdf(const vector3D &aPdf)
Definition: GoldenPattern.h:67
unsigned int nRefLayers
void setMeanDistPhi(const vector2D &aMeanDistPhi)
Definition: GoldenPattern.h:61
XMLCh * _toDOMS(std::string temp)
void XMLConfigReader::readConfig ( const std::string  fName)
void XMLConfigReader::readConfig ( OMTFConfiguration aConfig)

Addresing bits numbers

Chamber sectors connections to logic processros.

hw <-> logic numbering map

ref<->logic numberig map

processors initial phi for each reference layer

connections tables for each processor each logic cone Vector of all layers

Vector of all logic regions

Vector of all processors

Starting phis of each region Vector of all regions in one processor

Vector of all reflayers

Vector of all inputs

Vector of all processros

Fill all processors with the same setting as for processor 0.

Fill all processors with the same setting as for processor 0.

Definition at line 507 of file XMLConfigReader.cc.

References _toDOMS(), _toString(), assert(), OMTFConfiguration::barrelMax, OMTFConfiguration::barrelMin, OMTFConfiguration::bendingLayers, configFile, OMTFConfiguration::connections, doc, OMTFConfiguration::endcap10DegMax, OMTFConfiguration::endcap10DegMin, OMTFConfiguration::endcap20DegMax, OMTFConfiguration::endcap20DegMin, stage2BMTFBufferRaw_cfi::fwVersion, OMTFConfiguration::fwVersion, OMTFConfiguration::hwToLogicLayer, i, cuy::ii, OMTFConfiguration::logicToHwLayer, OMTFConfiguration::logicToLogic, m_omtf_config, OMTFConfiguration::minPdfVal, OMTFConfiguration::nGoldenPatterns, OMTFConfiguration::nHitsPerLayer, OMTFConfiguration::nInputs, OMTFConfiguration::nLayers, OMTFConfiguration::nLogicRegions, OMTFConfiguration::nPdfAddrBits, OMTFConfiguration::nPdfValBits, ecaldqm::binning::nPhiBins, OMTFConfiguration::nPhiBins, OMTFConfiguration::nPhiBits, OMTFConfiguration::nProcessors, OMTFConfiguration::nRefHits, OMTFConfiguration::nRefLayers, OMTFConfiguration::nTestRefHits, parser, OMTFConfiguration::processorPhiVsRefLayer, OMTFConfiguration::refHitsDefs, OMTFConfiguration::refToLogicNumber, and OMTFConfiguration::regionPhisVsRefLayerVsInput.

507  {
508 
509  parser->parse(configFile.c_str());
510  xercesc::DOMDocument* doc = parser->getDocument();
511  assert(doc);
512  unsigned int nElem = doc->getElementsByTagName(_toDOMS("OMTF"))->getLength();
513  if(nElem!=1){
514  edm::LogError("critical")<<"Problem parsing XML file "<<configFile<<std::endl;
515  assert(nElem==1);
516  }
517  DOMNode *aNode = doc->getElementsByTagName(_toDOMS("OMTF"))->item(0);
518  DOMElement* aOMTFElement = static_cast<DOMElement *>(aNode);
519  unsigned int fwVersion = std::atoi(_toString(aOMTFElement->getAttribute(_toDOMS("version"))).c_str());
520 
522  nElem = aOMTFElement->getElementsByTagName(_toDOMS("GlobalData"))->getLength();
523  assert(nElem==1);
524  aNode = aOMTFElement->getElementsByTagName(_toDOMS("GlobalData"))->item(0);
525  DOMElement* aElement = static_cast<DOMElement *>(aNode);
526 
527  float minPdfVal = 0.001;
528  unsigned int nPdfAddrBits = std::atoi(_toString(aElement->getAttribute(_toDOMS("nPdfAddrBits"))).c_str());
529  unsigned int nPdfValBits = std::atoi(_toString(aElement->getAttribute(_toDOMS("nPdfValBits"))).c_str());
530  unsigned int nHitsPerLayer = std::atoi(_toString(aElement->getAttribute(_toDOMS("nHitsPerLayer"))).c_str());
531  unsigned int nPhiBits = std::atoi(_toString(aElement->getAttribute(_toDOMS("nPhiBits"))).c_str());
532  unsigned int nPhiBins = std::atoi(_toString(aElement->getAttribute(_toDOMS("nPhiBins"))).c_str());
533  unsigned int nRefHits = std::atoi(_toString(aElement->getAttribute(_toDOMS("nRefHits"))).c_str());
534  unsigned int nTestRefHits = std::atoi(_toString(aElement->getAttribute(_toDOMS("nTestRefHits"))).c_str());
535  unsigned int nProcessors = std::atoi(_toString(aElement->getAttribute(_toDOMS("nProcessors"))).c_str());
536  unsigned int nLogicRegions = std::atoi(_toString(aElement->getAttribute(_toDOMS("nLogicRegions"))).c_str());
537  unsigned int nInputs = std::atoi(_toString(aElement->getAttribute(_toDOMS("nInputs"))).c_str());
538  unsigned int nGoldenPatterns = std::atoi(_toString(aElement->getAttribute(_toDOMS("nGoldenPatterns"))).c_str());
540  m_omtf_config->minPdfVal = minPdfVal;
541  m_omtf_config->nPdfAddrBits = nPdfAddrBits;
542  m_omtf_config->nPdfValBits = nPdfValBits;
543  m_omtf_config->nHitsPerLayer = nHitsPerLayer;
544  m_omtf_config->nPhiBits = nPhiBits;
546  m_omtf_config->nRefHits = nRefHits;
547  m_omtf_config->nTestRefHits = nTestRefHits;
548  m_omtf_config->nProcessors = nProcessors;
549  m_omtf_config->nLogicRegions = nLogicRegions;
550  m_omtf_config->nInputs = nInputs;
551  m_omtf_config->nGoldenPatterns = nGoldenPatterns;
552 
554  m_omtf_config->barrelMin = std::vector<unsigned int>(6);
555  m_omtf_config->barrelMax = std::vector<unsigned int>(6);
556 
557  m_omtf_config->endcap10DegMin = std::vector<unsigned int>(6);
558  m_omtf_config->endcap10DegMax = std::vector<unsigned int>(6);
559 
560  m_omtf_config->endcap20DegMin = std::vector<unsigned int>(6);
561  m_omtf_config->endcap20DegMax = std::vector<unsigned int>(6);
562 
563  nElem = aOMTFElement->getElementsByTagName(_toDOMS("ConnectionMap"))->getLength();
564  DOMElement* aConnectionElement = 0;
565  for(uint i=0;i<nElem;++i){
566  aNode = aOMTFElement->getElementsByTagName(_toDOMS("ConnectionMap"))->item(i);
567  aConnectionElement = static_cast<DOMElement *>(aNode);
568  unsigned int iProcessor = std::atoi(_toString(aConnectionElement->getAttribute(_toDOMS("iProcessor"))).c_str());
569  unsigned int barrelMin = std::atoi(_toString(aConnectionElement->getAttribute(_toDOMS("barrelMin"))).c_str());
570  unsigned int barrelMax = std::atoi(_toString(aConnectionElement->getAttribute(_toDOMS("barrelMax"))).c_str());
571  unsigned int endcap10DegMin = std::atoi(_toString(aConnectionElement->getAttribute(_toDOMS("endcap10DegMin"))).c_str());
572  unsigned int endcap10DegMax = std::atoi(_toString(aConnectionElement->getAttribute(_toDOMS("endcap10DegMax"))).c_str());
573  unsigned int endcap20DegMin = std::atoi(_toString(aConnectionElement->getAttribute(_toDOMS("endcap20DegMin"))).c_str());
574  unsigned int endcap20DegMax = std::atoi(_toString(aConnectionElement->getAttribute(_toDOMS("endcap20DegMax"))).c_str());
575 
576  m_omtf_config->barrelMin[iProcessor] = barrelMin;
577  m_omtf_config->endcap10DegMin[iProcessor] = endcap10DegMin;
578  m_omtf_config->endcap20DegMin[iProcessor] = endcap20DegMin;
579 
580  m_omtf_config->barrelMax[iProcessor] = barrelMax;
581  m_omtf_config->endcap10DegMax[iProcessor] = endcap10DegMax;
582  m_omtf_config->endcap20DegMax[iProcessor] = endcap20DegMax;
583  }
584 
586  unsigned int nLogicLayers = 0;
587  nElem = aOMTFElement->getElementsByTagName(_toDOMS("LayerMap"))->getLength();
588  DOMElement* aLayerElement = 0;
589  for(uint i=0;i<nElem;++i){
590  aNode = aOMTFElement->getElementsByTagName(_toDOMS("LayerMap"))->item(i);
591  aLayerElement = static_cast<DOMElement *>(aNode);
592  unsigned int hwNumber = std::atoi(_toString(aLayerElement->getAttribute(_toDOMS("hwNumber"))).c_str());
593  unsigned int logicNumber = std::atoi(_toString(aLayerElement->getAttribute(_toDOMS("logicNumber"))).c_str());
594  unsigned int isBendingLayer = std::atoi(_toString(aLayerElement->getAttribute(_toDOMS("bendingLayer"))).c_str());
595  unsigned int iConnectedLayer = std::atoi(_toString(aLayerElement->getAttribute(_toDOMS("connectedToLayer"))).c_str());
596  aConfig->hwToLogicLayer[hwNumber] = logicNumber;
597  aConfig->logicToHwLayer[logicNumber] = hwNumber;
598  aConfig->logicToLogic[logicNumber] = iConnectedLayer;
599  if(isBendingLayer) aConfig->bendingLayers.insert(logicNumber);
600  if(nLogicLayers<logicNumber) nLogicLayers = logicNumber;
601  }
602  ++nLogicLayers;//logic number in XML starts from 0.
603  m_omtf_config->nLayers = nLogicLayers;
604 
606  unsigned int nRefLayers = 0;
607  nElem = aOMTFElement->getElementsByTagName(_toDOMS("RefLayerMap"))->getLength();
608  aConfig->refToLogicNumber.resize(nElem);
609  DOMElement* aRefLayerElement = 0;
610  for(uint i=0;i<nElem;++i){
611  aNode = aOMTFElement->getElementsByTagName(_toDOMS("RefLayerMap"))->item(i);
612  aRefLayerElement = static_cast<DOMElement *>(aNode);
613  unsigned int refLayer = std::atoi(_toString(aRefLayerElement->getAttribute(_toDOMS("refLayer"))).c_str());
614  unsigned int logicNumber = std::atoi(_toString(aRefLayerElement->getAttribute(_toDOMS("logicNumber"))).c_str());
615  aConfig->refToLogicNumber[refLayer] = logicNumber;
616  if(nRefLayers<logicNumber) nRefLayers = refLayer;
617  }
618  ++nRefLayers;//ref number in XML starts from 0.
619  m_omtf_config->nRefLayers = nRefLayers;
620 
622  std::vector<int> vector1D(m_omtf_config->nRefLayers,m_omtf_config->nPhiBins);
624 
630  aLayer2D.assign(m_omtf_config->nLogicRegions,aLayer1D);
633 
636  std::vector<std::pair<int,int> > aRefHit1D(m_omtf_config->nLogicRegions,std::pair<int,int>(9999,9999));
638  std::vector<std::vector<std::pair<int,int> > > aRefHit2D;
639  aRefHit2D.assign(m_omtf_config->nRefLayers,aRefHit1D);
642 
643  //Vector of ref hit definitions
644  std::vector<RefHitDef> aRefHitsDefs(m_omtf_config->nRefHits);
646  m_omtf_config->refHitsDefs.assign(m_omtf_config->nProcessors,aRefHitsDefs);
647 
648  nElem = aOMTFElement->getElementsByTagName(_toDOMS("Processor"))->getLength();
650  DOMElement* aProcessorElement = 0;
651  for(uint i=0;i<nElem;++i){
652  aNode = aOMTFElement->getElementsByTagName(_toDOMS("Processor"))->item(i);
653  aProcessorElement = static_cast<DOMElement *>(aNode);
654  unsigned int iProcessor = std::atoi(_toString(aProcessorElement->getAttribute(_toDOMS("iProcessor"))).c_str());
655  unsigned int nElem1 = aProcessorElement->getElementsByTagName(_toDOMS("RefLayer"))->getLength();
656  assert(nElem1==m_omtf_config->nRefLayers);
657  DOMElement* aRefLayerElement = 0;
658  for(uint ii=0;ii<nElem1;++ii){
659  aNode = aProcessorElement->getElementsByTagName(_toDOMS("RefLayer"))->item(ii);
660  aRefLayerElement = static_cast<DOMElement *>(aNode);
661  unsigned int iRefLayer = std::atoi(_toString(aRefLayerElement->getAttribute(_toDOMS("iRefLayer"))).c_str());
662  int iPhi = std::atoi(_toString(aRefLayerElement->getAttribute(_toDOMS("iGlobalPhiStart"))).c_str());
663  m_omtf_config->processorPhiVsRefLayer[iProcessor][iRefLayer] = iPhi;
664  }
666  nElem1 = aProcessorElement->getElementsByTagName(_toDOMS("RefHit"))->getLength();
667  assert((iProcessor==0 && nElem1==nRefHits) || (iProcessor!=0 && nElem1==0) );
668  DOMElement* aRefHitElement = 0;
669  for(uint ii=0;ii<nElem1;++ii){
670  aNode = aProcessorElement->getElementsByTagName(_toDOMS("RefHit"))->item(ii);
671  aRefHitElement = static_cast<DOMElement *>(aNode);
672  unsigned int iRefHit = std::atoi(_toString(aRefHitElement->getAttribute(_toDOMS("iRefHit"))).c_str());
673  int iPhiMin = std::atoi(_toString(aRefHitElement->getAttribute(_toDOMS("iPhiMin"))).c_str());
674  int iPhiMax = std::atoi(_toString(aRefHitElement->getAttribute(_toDOMS("iPhiMax"))).c_str());
675  unsigned int iInput = std::atoi(_toString(aRefHitElement->getAttribute(_toDOMS("iInput"))).c_str());
676  unsigned int iRegion = std::atoi(_toString(aRefHitElement->getAttribute(_toDOMS("iRegion"))).c_str());
677  unsigned int iRefLayer = std::atoi(_toString(aRefHitElement->getAttribute(_toDOMS("iRefLayer"))).c_str());
679  m_omtf_config->regionPhisVsRefLayerVsInput[iInput][iRefLayer][iRegion] = std::pair<int,int>(iPhiMin,iPhiMax);
680  m_omtf_config->refHitsDefs[iProcessor][iRefHit] = RefHitDef(iInput,iPhiMin,iPhiMax,iRegion,iRefLayer);
682  if(iProcessor==0){
683  for (unsigned int iProcessorTmp=0; iProcessorTmp<m_omtf_config->nProcessors; ++iProcessorTmp){
684  m_omtf_config->refHitsDefs[iProcessorTmp][iRefHit] = RefHitDef(iInput,iPhiMin,iPhiMax,iRegion,iRefLayer);
685  }
686  }
687  }
689  unsigned int nElem2 = aProcessorElement->getElementsByTagName(_toDOMS("LogicRegion"))->getLength();
690  assert( (iProcessor==0 && nElem2==nLogicRegions) || (iProcessor!=0 && nElem2==0) );
691  DOMElement* aRegionElement = 0;
692  for(uint ii=0;ii<nElem2;++ii){
693  aNode = aProcessorElement->getElementsByTagName(_toDOMS("LogicRegion"))->item(ii);
694  aRegionElement = static_cast<DOMElement *>(aNode);
695  unsigned int iRegion = std::atoi(_toString(aRegionElement->getAttribute(_toDOMS("iRegion"))).c_str());
696  unsigned int nElem3 = aRegionElement->getElementsByTagName(_toDOMS("Layer"))->getLength();
697  assert(nElem3==m_omtf_config->nLayers);
698  DOMElement* aLayerElement = 0;
699  for(uint iii=0;iii<nElem3;++iii){
700  aNode = aRegionElement->getElementsByTagName(_toDOMS("Layer"))->item(iii);
701  aLayerElement = static_cast<DOMElement *>(aNode);
702  unsigned int iLayer = std::atoi(_toString(aLayerElement->getAttribute(_toDOMS("iLayer"))).c_str());
703  unsigned int iFirstInput = std::atoi(_toString(aLayerElement->getAttribute(_toDOMS("iFirstInput"))).c_str());
704  unsigned int nInputs = std::atoi(_toString(aLayerElement->getAttribute(_toDOMS("nInputs"))).c_str());
705  m_omtf_config->connections[iProcessor][iRegion][iLayer] = std::pair<unsigned int, unsigned int>(iFirstInput,nInputs);
707  if(iProcessor==0){
708  for (unsigned int iProcessorTmp=0; iProcessorTmp<m_omtf_config->nProcessors; ++iProcessorTmp){
709  m_omtf_config->connections[iProcessorTmp][iRegion][iLayer] = std::pair<unsigned int, unsigned int>(iFirstInput,nInputs);
710  }
711  }
712  }
713  }
714  }
715  delete doc;
716 }
std::vector< unsigned int > endcap20DegMax
unsigned int nLayers
int i
Definition: DBlmapReader.cc:9
std::map< int, int > logicToLogic
std::vector< unsigned int > endcap10DegMin
unsigned int nInputs
xercesc::DOMDocument * doc
assert(m_qm.get())
std::string _toString(const XMLCh *toTranscode)
OMTFConfiguration * m_omtf_config
std::vector< std::vector< int > > processorPhiVsRefLayer
unsigned int nProcessors
int ii
Definition: cuy.py:588
unsigned int nLogicRegions
std::map< int, int > logicToHwLayer
std::vector< unsigned int > endcap20DegMin
std::vector< int > refToLogicNumber
std::vector< unsigned int > endcap10DegMax
unsigned int nPdfAddrBits
unsigned int fwVersion
unsigned int nTestRefHits
unsigned int nHitsPerLayer
std::vector< std::vector< RefHitDef > > refHitsDefs
std::vector< std::pair< unsigned int, unsigned int > > vector1D_A
Map of connections.
unsigned int nPhiBins
unsigned int nPhiBits
xercesc::XercesDOMParser * parser
std::vector< unsigned int > barrelMin
unsigned int nRefLayers
std::set< int > bendingLayers
std::map< int, int > hwToLogicLayer
unsigned int nRefHits
XMLCh * _toDOMS(std::string temp)
unsigned int nGoldenPatterns
std::vector< vector1D_A > vector2D_A
std::vector< std::vector< std::vector< std::pair< int, int > > > > regionPhisVsRefLayerVsInput
std::string configFile
std::vector< unsigned int > barrelMax
unsigned int nPdfValBits
void XMLConfigReader::readConfig ( L1TMuonOverlapParams aConfig)

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 306 of file XMLConfigReader.cc.

References _toDOMS(), _toString(), assert(), L1TMuonOverlapParams::LayerMapNode::bendingLayer, configFile, L1TMuonOverlapParams::LayerMapNode::connectedToLayer, 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, 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, ecaldqm::binning::nPhiBins, parser, L1TMuonOverlapParams::RefLayerMapNode::refLayer, L1TMuonOverlapParams::setConnectedSectorsEnd(), L1TMuonOverlapParams::setConnectedSectorsStart(), L1TMuonOverlapParams::setFwVersion(), L1TMuonOverlapParams::setGeneralParams(), L1TMuonOverlapParams::setGlobalPhiStartMap(), L1TMuonOverlapParams::setLayerInputMap(), L1TMuonOverlapParams::setLayerMap(), L1TMuonOverlapParams::setRefHitMap(), L1TMuonOverlapParams::setRefLayerMap(), and relval_steps::version.

306  {
307 
308  parser->parse(configFile.c_str());
309  xercesc::DOMDocument* doc = parser->getDocument();
310  assert(doc);
311  unsigned int nElem = doc->getElementsByTagName(_toDOMS("OMTF"))->getLength();
312  if(nElem!=1){
313  edm::LogError("critical")<<"Problem parsing XML file "<<configFile<<std::endl;
314  assert(nElem==1);
315  }
316  DOMNode *aNode = doc->getElementsByTagName(_toDOMS("OMTF"))->item(0);
317  DOMElement* aOMTFElement = static_cast<DOMElement *>(aNode);
318 
319  unsigned int version = std::stoul(_toString(aOMTFElement->getAttribute(_toDOMS("version"))), nullptr, 16);
320  aConfig->setFwVersion(version);
321 
323  nElem = aOMTFElement->getElementsByTagName(_toDOMS("GlobalData"))->getLength();
324  assert(nElem==1);
325  aNode = aOMTFElement->getElementsByTagName(_toDOMS("GlobalData"))->item(0);
326  DOMElement* aElement = static_cast<DOMElement *>(aNode);
327 
328  unsigned int nPdfAddrBits = std::atoi(_toString(aElement->getAttribute(_toDOMS("nPdfAddrBits"))).c_str());
329  unsigned int nPdfValBits = std::atoi(_toString(aElement->getAttribute(_toDOMS("nPdfValBits"))).c_str());
330  unsigned int nHitsPerLayer = std::atoi(_toString(aElement->getAttribute(_toDOMS("nHitsPerLayer"))).c_str());
331  unsigned int nPhiBits = std::atoi(_toString(aElement->getAttribute(_toDOMS("nPhiBits"))).c_str());
332  unsigned int nPhiBins = std::atoi(_toString(aElement->getAttribute(_toDOMS("nPhiBins"))).c_str());
333  unsigned int nRefHits = std::atoi(_toString(aElement->getAttribute(_toDOMS("nRefHits"))).c_str());
334  unsigned int nTestRefHits = std::atoi(_toString(aElement->getAttribute(_toDOMS("nTestRefHits"))).c_str());
335  unsigned int nProcessors = std::atoi(_toString(aElement->getAttribute(_toDOMS("nProcessors"))).c_str());
336  unsigned int nLogicRegions = std::atoi(_toString(aElement->getAttribute(_toDOMS("nLogicRegions"))).c_str());
337  unsigned int nInputs = std::atoi(_toString(aElement->getAttribute(_toDOMS("nInputs"))).c_str());
338  unsigned int nLayers = std::atoi(_toString(aElement->getAttribute(_toDOMS("nLayers"))).c_str());
339  unsigned int nRefLayers = std::atoi(_toString(aElement->getAttribute(_toDOMS("nRefLayers"))).c_str());
340  unsigned int nGoldenPatterns = std::atoi(_toString(aElement->getAttribute(_toDOMS("nGoldenPatterns"))).c_str());
341 
342  std::vector<int> paramsVec(L1TMuonOverlapParams::GENERAL_NCONFIG);
343  paramsVec[L1TMuonOverlapParams::GENERAL_ADDRBITS] = nPdfAddrBits;
344  paramsVec[L1TMuonOverlapParams::GENERAL_VALBITS] = nPdfValBits;
345  paramsVec[L1TMuonOverlapParams::GENERAL_HITSPERLAYER] = nHitsPerLayer;
346  paramsVec[L1TMuonOverlapParams::GENERAL_PHIBITS] = nPhiBits;
348  paramsVec[L1TMuonOverlapParams::GENERAL_NREFHITS] = nRefHits;
349  paramsVec[L1TMuonOverlapParams::GENERAL_NTESTREFHITS] = nTestRefHits;
350  paramsVec[L1TMuonOverlapParams::GENERAL_NPROCESSORS] = nProcessors;
351  paramsVec[L1TMuonOverlapParams::GENERAL_NLOGIC_REGIONS] = nLogicRegions;
352  paramsVec[L1TMuonOverlapParams::GENERAL_NINPUTS] = nInputs;
353  paramsVec[L1TMuonOverlapParams::GENERAL_NLAYERS] = nLayers;
354  paramsVec[L1TMuonOverlapParams::GENERAL_NREFLAYERS] = nRefLayers;
355  paramsVec[L1TMuonOverlapParams::GENERAL_NGOLDENPATTERNS] = nGoldenPatterns;
356  aConfig->setGeneralParams(paramsVec);
357 
360  std::vector<int> sectorsStart(3*6), sectorsEnd(3*6);
361  nElem = aOMTFElement->getElementsByTagName(_toDOMS("ConnectionMap"))->getLength();
362  DOMElement* aConnectionElement = 0;
363  for(uint i=0;i<nElem;++i){
364  aNode = aOMTFElement->getElementsByTagName(_toDOMS("ConnectionMap"))->item(i);
365  aConnectionElement = static_cast<DOMElement *>(aNode);
366  unsigned int iProcessor = std::atoi(_toString(aConnectionElement->getAttribute(_toDOMS("iProcessor"))).c_str());
367  unsigned int barrelMin = std::atoi(_toString(aConnectionElement->getAttribute(_toDOMS("barrelMin"))).c_str());
368  unsigned int barrelMax = std::atoi(_toString(aConnectionElement->getAttribute(_toDOMS("barrelMax"))).c_str());
369  unsigned int endcap10DegMin = std::atoi(_toString(aConnectionElement->getAttribute(_toDOMS("endcap10DegMin"))).c_str());
370  unsigned int endcap10DegMax = std::atoi(_toString(aConnectionElement->getAttribute(_toDOMS("endcap10DegMax"))).c_str());
371  unsigned int endcap20DegMin = std::atoi(_toString(aConnectionElement->getAttribute(_toDOMS("endcap20DegMin"))).c_str());
372  unsigned int endcap20DegMax = std::atoi(_toString(aConnectionElement->getAttribute(_toDOMS("endcap20DegMax"))).c_str());
373 
374  sectorsStart[iProcessor] = barrelMin;
375  sectorsStart[iProcessor + 6] = endcap10DegMin;
376  sectorsStart[iProcessor +12] = endcap20DegMin;
377 
378  sectorsEnd[iProcessor] = barrelMax;
379  sectorsEnd[iProcessor + 6] = endcap10DegMax;
380  sectorsEnd[iProcessor + 12] = endcap20DegMax;
381  }
382  aConfig->setConnectedSectorsStart(sectorsStart);
383  aConfig->setConnectedSectorsEnd(sectorsEnd);
384 
385 
387  std::vector<L1TMuonOverlapParams::LayerMapNode> aLayerMapVec;
389 
390  nElem = aOMTFElement->getElementsByTagName(_toDOMS("LayerMap"))->getLength();
391  DOMElement* aLayerElement = 0;
392  for(uint i=0;i<nElem;++i){
393  aNode = aOMTFElement->getElementsByTagName(_toDOMS("LayerMap"))->item(i);
394  aLayerElement = static_cast<DOMElement *>(aNode);
395  unsigned int hwNumber = std::atoi(_toString(aLayerElement->getAttribute(_toDOMS("hwNumber"))).c_str());
396  unsigned int logicNumber = std::atoi(_toString(aLayerElement->getAttribute(_toDOMS("logicNumber"))).c_str());
397  unsigned int isBendingLayer = std::atoi(_toString(aLayerElement->getAttribute(_toDOMS("bendingLayer"))).c_str());
398  unsigned int iConnectedLayer = std::atoi(_toString(aLayerElement->getAttribute(_toDOMS("connectedToLayer"))).c_str());
399  aLayerMapNode.logicNumber = logicNumber;
400  aLayerMapNode.hwNumber = hwNumber;
401  aLayerMapNode.connectedToLayer = iConnectedLayer;
402  aLayerMapNode.bendingLayer = isBendingLayer;
403  aLayerMapVec.push_back(aLayerMapNode);
404  }
405  aConfig->setLayerMap(aLayerMapVec);
406 
408  std::vector<L1TMuonOverlapParams::RefLayerMapNode> aRefLayerMapVec;
410 
411  nElem = aOMTFElement->getElementsByTagName(_toDOMS("RefLayerMap"))->getLength();
412  DOMElement* aRefLayerElement = 0;
413  for(uint i=0;i<nElem;++i){
414  aNode = aOMTFElement->getElementsByTagName(_toDOMS("RefLayerMap"))->item(i);
415  aRefLayerElement = static_cast<DOMElement *>(aNode);
416  unsigned int refLayer = std::atoi(_toString(aRefLayerElement->getAttribute(_toDOMS("refLayer"))).c_str());
417  unsigned int logicNumber = std::atoi(_toString(aRefLayerElement->getAttribute(_toDOMS("logicNumber"))).c_str());
418  aRefLayerNode.refLayer = refLayer;
419  aRefLayerNode.logicNumber = logicNumber;
420  aRefLayerMapVec.push_back(aRefLayerNode);
421  }
422  aConfig->setRefLayerMap(aRefLayerMapVec);
423 
424 
425  std::vector<int> aGlobalPhiStartVec(nProcessors*nRefLayers);
426 
427  std::vector<L1TMuonOverlapParams::RefHitNode> aRefHitMapVec(nProcessors*nRefHits);
429 
430  std::vector<L1TMuonOverlapParams::LayerInputNode> aLayerInputMapVec(nProcessors*nLogicRegions*nLayers);
431  L1TMuonOverlapParams::LayerInputNode aLayerInputNode;
432 
433  nElem = aOMTFElement->getElementsByTagName(_toDOMS("Processor"))->getLength();
434  assert(nElem==nProcessors);
435  DOMElement* aProcessorElement = 0;
436  for(uint i=0;i<nElem;++i){
437  aNode = aOMTFElement->getElementsByTagName(_toDOMS("Processor"))->item(i);
438  aProcessorElement = static_cast<DOMElement *>(aNode);
439  unsigned int iProcessor = std::atoi(_toString(aProcessorElement->getAttribute(_toDOMS("iProcessor"))).c_str());
440  unsigned int nElem1 = aProcessorElement->getElementsByTagName(_toDOMS("RefLayer"))->getLength();
441  assert(nElem1==nRefLayers);
442  DOMElement* aRefLayerElement = 0;
443  for(uint ii=0;ii<nElem1;++ii){
444  aNode = aProcessorElement->getElementsByTagName(_toDOMS("RefLayer"))->item(ii);
445  aRefLayerElement = static_cast<DOMElement *>(aNode);
446  unsigned int iRefLayer = std::atoi(_toString(aRefLayerElement->getAttribute(_toDOMS("iRefLayer"))).c_str());
447  int iPhi = std::atoi(_toString(aRefLayerElement->getAttribute(_toDOMS("iGlobalPhiStart"))).c_str());
448  aGlobalPhiStartVec[iRefLayer + iProcessor*nRefLayers] = iPhi;
449  }
451  nElem1 = aProcessorElement->getElementsByTagName(_toDOMS("RefHit"))->getLength();
452  assert( (iProcessor==0 && nElem1==nRefHits) || (iProcessor!=0 && nElem1==0) );
453  DOMElement* aRefHitElement = 0;
454  for(uint ii=0;ii<nElem1;++ii){
455  aNode = aProcessorElement->getElementsByTagName(_toDOMS("RefHit"))->item(ii);
456  aRefHitElement = static_cast<DOMElement *>(aNode);
457  unsigned int iRefHit = std::atoi(_toString(aRefHitElement->getAttribute(_toDOMS("iRefHit"))).c_str());
458  int iPhiMin = std::atoi(_toString(aRefHitElement->getAttribute(_toDOMS("iPhiMin"))).c_str());
459  int iPhiMax = std::atoi(_toString(aRefHitElement->getAttribute(_toDOMS("iPhiMax"))).c_str());
460  unsigned int iInput = std::atoi(_toString(aRefHitElement->getAttribute(_toDOMS("iInput"))).c_str());
461  unsigned int iRegion = std::atoi(_toString(aRefHitElement->getAttribute(_toDOMS("iRegion"))).c_str());
462  unsigned int iRefLayer = std::atoi(_toString(aRefHitElement->getAttribute(_toDOMS("iRefLayer"))).c_str());
463 
464  aRefHitNode.iRefHit = iRefHit;
465  aRefHitNode.iPhiMin = iPhiMin;
466  aRefHitNode.iPhiMax = iPhiMax;
467  aRefHitNode.iInput = iInput;
468  aRefHitNode.iRegion = iRegion;
469  aRefHitNode.iRefLayer = iRefLayer;
470  //aRefHitMapVec[iRefHit + iProcessor*nRefHits] = aRefHitNode;
471  for (unsigned int ip=0; ip<nProcessors; ++ip) aRefHitMapVec[iRefHit + ip*nRefHits] = aRefHitNode;
472  }
474  unsigned int nElem2 = aProcessorElement->getElementsByTagName(_toDOMS("LogicRegion"))->getLength();
475  assert( (iProcessor==0 && nElem2==nLogicRegions) || (iProcessor!=0 && nElem2==0) );
476  DOMElement* aRegionElement = 0;
477  for(uint ii=0;ii<nElem2;++ii){
478  aNode = aProcessorElement->getElementsByTagName(_toDOMS("LogicRegion"))->item(ii);
479  aRegionElement = static_cast<DOMElement *>(aNode);
480  unsigned int iRegion = std::atoi(_toString(aRegionElement->getAttribute(_toDOMS("iRegion"))).c_str());
481  unsigned int nElem3 = aRegionElement->getElementsByTagName(_toDOMS("Layer"))->getLength();
482  assert(nElem3==nLayers);
483  DOMElement* aLayerElement = 0;
484  for(uint iii=0;iii<nElem3;++iii){
485  aNode = aRegionElement->getElementsByTagName(_toDOMS("Layer"))->item(iii);
486  aLayerElement = static_cast<DOMElement *>(aNode);
487  unsigned int iLayer = std::atoi(_toString(aLayerElement->getAttribute(_toDOMS("iLayer"))).c_str());
488  unsigned int iFirstInput = std::atoi(_toString(aLayerElement->getAttribute(_toDOMS("iFirstInput"))).c_str());
489  unsigned int nInputs = std::atoi(_toString(aLayerElement->getAttribute(_toDOMS("nInputs"))).c_str());
490  aLayerInputNode.iLayer = iLayer;
491  aLayerInputNode.iFirstInput = iFirstInput;
492  aLayerInputNode.nInputs = nInputs;
493 // aLayerInputMapVec[iLayer + iRegion*nLayers + iProcessor*nLayers*nLogicRegions] = aLayerInputNode;
494  for (unsigned int ip=0; ip<nProcessors; ++ip) aLayerInputMapVec[iLayer + iRegion*nLayers + ip*nLayers*nLogicRegions] = aLayerInputNode;
495  }
496  }
497  }
498 
499  aConfig->setGlobalPhiStartMap(aGlobalPhiStartVec);
500  aConfig->setLayerInputMap(aLayerInputMapVec);
501  aConfig->setRefHitMap(aRefHitMapVec);
502 
503  delete doc;
504 }
int i
Definition: DBlmapReader.cc:9
void setLayerMap(const std::vector< LayerMapNode > &aVector)
Connections definitions.
void setConnectedSectorsEnd(const std::vector< int > &aVector)
xercesc::DOMDocument * doc
unsigned int hwNumber
short layer number used within OMTF emulator
void setRefLayerMap(const std::vector< RefLayerMapNode > &aVector)
assert(m_qm.get())
std::string _toString(const XMLCh *toTranscode)
unsigned int logicNumber
logic numer of the layer
int ii
Definition: cuy.py:588
void setGeneralParams(const std::vector< int > &paramsVec)
bool bendingLayer
Is this a bending layers?
void setConnectedSectorsStart(const std::vector< int > &aVector)
xercesc::XercesDOMParser * parser
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)
unsigned int logicNumber
Corresponding logical layer number.
XMLCh * _toDOMS(std::string temp)
void setFwVersion(unsigned fwVersion)
std::string configFile
std::vector< std::vector< int > > XMLConfigReader::readEvent ( unsigned int  iEvent = 0,
unsigned int  iProcessor = 0,
bool  readEta = false 
)

Definition at line 227 of file XMLConfigReader.cc.

References _toDOMS(), _toString(), assert(), doc, eventsFile, input, m_omtf_config, OMTFConfiguration::nLayers, OMTFConfiguration::nPhiBins, and parser.

Referenced by OMTFinput::readData().

229  {
230  if(!doc){
231  parser->parse(eventsFile.c_str());
232  doc = parser->getDocument();
233  }
234  assert(doc);
235 
236 
239 
240  unsigned int nElem = doc->getElementsByTagName(_toDOMS("OMTF_Events"))->getLength();
241  assert(nElem==1);
242 
243  DOMNode *aNode = doc->getElementsByTagName(_toDOMS("OMTF_Events"))->item(0);
244  DOMElement* aOMTFElement = static_cast<DOMElement *>(aNode);
245  DOMElement* aEventElement = 0;
246  DOMElement* aBxElement = 0;
247  DOMElement* aProcElement = 0;
248  DOMElement* aLayerElement = 0;
249  DOMElement* aHitElement = 0;
250  unsigned int aLogicLayer = m_omtf_config->nLayers+1;
251  int val = 0, input=0;
252 
253  nElem = aOMTFElement->getElementsByTagName(_toDOMS("Event"))->getLength();
254  if(nElem<iEvent){
255  edm::LogError("critical")<<"Problem parsing XML file "<<eventsFile<<std::endl;
256  edm::LogError("critical")<<"not enough events found: "<<nElem<<std::endl;
257  assert(nElem>=iEvent);
258  }
259 
260  aNode = aOMTFElement->getElementsByTagName(_toDOMS("Event"))->item(iEvent);
261  aEventElement = static_cast<DOMElement *>(aNode);
262 
263  unsigned int nBX = aEventElement->getElementsByTagName(_toDOMS("bx"))->getLength();
264  assert(nBX>0);
265  aNode = aEventElement->getElementsByTagName(_toDOMS("bx"))->item(0);
266  aBxElement = static_cast<DOMElement *>(aNode);
267 
268  unsigned int nProc = aEventElement->getElementsByTagName(_toDOMS("Processor"))->getLength();
269  unsigned int aProcID = 99;
270  assert(nProc>=iProcessor);
271  for(unsigned int aProc=0;aProc<nProc;++aProc){
272  aNode = aBxElement->getElementsByTagName(_toDOMS("Processor"))->item(aProc);
273  aProcElement = static_cast<DOMElement *>(aNode);
274  aProcID = std::atoi(_toString(aProcElement->getAttribute(_toDOMS("iProcessor"))).c_str());
275  if(aProcID==iProcessor) break;
276  }
277  if(aProcID!=iProcessor) return input2D;
278 
279  unsigned int nLayersHit = aProcElement->getElementsByTagName(_toDOMS("Layer"))->getLength();
280  assert(nLayersHit<=m_omtf_config->nLayers);
281 
282  input2D.assign(m_omtf_config->nLayers,input1D);
283 
284  for(unsigned int iLayer=0;iLayer<nLayersHit;++iLayer){
285  aNode = aProcElement->getElementsByTagName(_toDOMS("Layer"))->item(iLayer);
286  aLayerElement = static_cast<DOMElement *>(aNode);
287  aLogicLayer = std::atoi(_toString(aLayerElement->getAttribute(_toDOMS("iLayer"))).c_str());
288  nElem = aLayerElement->getElementsByTagName(_toDOMS("Hit"))->getLength();
289  input1D.assign(14,m_omtf_config->nPhiBins);
290  for(unsigned int iHit=0;iHit<nElem;++iHit){
291  aNode = aLayerElement->getElementsByTagName(_toDOMS("Hit"))->item(iHit);
292  aHitElement = static_cast<DOMElement *>(aNode);
293  val = std::atoi(_toString(aHitElement->getAttribute(_toDOMS("iPhi"))).c_str());
294  if(readEta) val = std::atoi(_toString(aHitElement->getAttribute(_toDOMS("iEta"))).c_str());
295  input = std::atoi(_toString(aHitElement->getAttribute(_toDOMS("iInput"))).c_str());
296  input1D[input] = val;
297  }
298  input2D[aLogicLayer] = input1D;
299  }
300 
301  //delete doc;
302  return input2D;
303 }
unsigned int nLayers
xercesc::DOMDocument * doc
assert(m_qm.get())
std::string _toString(const XMLCh *toTranscode)
OMTFConfiguration * m_omtf_config
std::vector< int > vector1D
Definition: OMTFinput.h:14
std::vector< vector1D > vector2D
Definition: OMTFinput.h:15
static std::string const input
Definition: EdmProvDump.cc:44
int iEvent
Definition: GenABIO.cc:230
unsigned int nPhiBins
std::string eventsFile
xercesc::XercesDOMParser * parser
XMLCh * _toDOMS(std::string temp)
void XMLConfigReader::readLUT ( l1t::LUT lut,
const std::string &  type 
)

Prepare the header

Fill payload string

Read the data into LUT

Definition at line 57 of file XMLConfigReader.cc.

References aGPs, recoMuon::in, m_omtf_config, OMTFConfiguration::nLayers, OMTFConfiguration::nPdfAddrBits, OMTFConfiguration::nRefLayers, GenerateHcalLaserBadRunList::out, l1t::LUT::read(), and readPatterns().

Referenced by L1TMuonOverlapParamsESProducer::readPatternsXML().

57  {
58 
59  std::stringstream strStream;
60  int totalInWidth = 6;
61  int outWidth = 6;
62 
63  if(type=="iCharge") outWidth = 1;
64  if(type=="iEta") outWidth = 2;
65  if(type=="iPt") outWidth = 9;
66  if(type=="meanDistPhi"){
67  outWidth = 11;
68  totalInWidth = 14;
69  }
70  if(type=="pdf"){
71  outWidth = 6;
72  totalInWidth = 20;
73  }
74 
76  strStream <<"#<header> V1 "<<totalInWidth<<" "<<outWidth<<" </header> "<<std::endl;
77 
79  const std::vector<GoldenPattern *> & aGPs = readPatterns();
80  unsigned int in = 0;
81  int out = 0;
82  for(auto it: aGPs){
83  if(type=="iCharge") out = it->key().theCharge==-1 ? 0:1;
84  if(type=="iEta") out = it->key().theEtaCode;
85  if(type=="iPt") out = it->key().thePtCode;
86  if(type=="meanDistPhi"){
87  for(unsigned int iLayer = 0;iLayer<m_omtf_config->nLayers;++iLayer){
88  for(unsigned int iRefLayer=0;iRefLayer<m_omtf_config->nRefLayers;++iRefLayer){
89  out = (1<<(outWidth-1)) + it->meanDistPhiValue(iLayer,iRefLayer);
90  strStream<<in<<" "<<out<<std::endl;
91  ++in;
92  }
93  }
94  }
95  if(type=="pdf"){
96  for(unsigned int iLayer = 0;iLayer<m_omtf_config->nLayers;++iLayer){
97  for(unsigned int iRefLayer=0;iRefLayer<m_omtf_config->nRefLayers;++iRefLayer){
98  for(unsigned int iPdf=0;iPdf<exp2(m_omtf_config->nPdfAddrBits);++iPdf){
99  out = it->pdfValue(iLayer,iRefLayer,iPdf);
100  strStream<<in<<" "<<out<<std::endl;
101  ++in;
102  }
103  }
104  }
105  }
106  if(type!="meanDistPhi" && type!="pdf"){
107  strStream<<in<<" "<<out<<std::endl;
108  ++in;
109  }
110  }
112  lut->read(strStream);
113 }
type
Definition: HCALResponse.h:21
unsigned int nLayers
OMTFConfiguration * m_omtf_config
unsigned int nPdfAddrBits
int read(std::istream &stream)
Definition: LUT.cc:35
unsigned int nRefLayers
std::vector< GoldenPattern * > aGPs
Cache with GPs read.
std::vector< GoldenPattern * > readPatterns()
std::vector< GoldenPattern * > XMLConfigReader::readPatterns ( )

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

Definition at line 116 of file XMLConfigReader.cc.

References _toDOMS(), aGPs, assert(), buildGP(), doc, cmsHarvester::index, parser, and patternsFile.

Referenced by OMTFProcessor::configure(), and readLUT().

116  {
117 
118  //if(aGPs.size()) return aGPs;
119  aGPs.clear();
120 
121  parser->parse(patternsFile.c_str());
122  xercesc::DOMDocument* doc = parser->getDocument();
123  assert(doc);
124 
125  unsigned int nElem = doc->getElementsByTagName(_toDOMS("GP"))->getLength();
126  if(nElem<1){
127  edm::LogError("critical")<<"Problem parsing XML file "<<patternsFile<<std::endl;
128  edm::LogError("critical")<<"No GoldenPattern items: GP found"<<std::endl;
129  return aGPs;
130  }
131 
132  DOMNode *aNode = 0;
133  DOMElement* aGPElement = 0;
134  for(unsigned int iItem=0;iItem<nElem;++iItem){
135  aNode = doc->getElementsByTagName(_toDOMS("GP"))->item(iItem);
136  aGPElement = static_cast<DOMElement *>(aNode);
137 
138  std::ostringstream stringStr;
139  GoldenPattern *aGP;
140  for(unsigned int index = 1;index<5;++index){
141  stringStr.str("");
142  stringStr<<"iPt"<<index;
144  if(aGPElement->getAttributeNode(_toDOMS(stringStr.str().c_str()))){
145  aGP = buildGP(aGPElement,index);
146  if(aGP) aGPs.push_back(aGP);
147  }
148  else{
149  aGP = buildGP(aGPElement);
150  if(aGP) aGPs.push_back(aGP);
151  break;
152  }
153  }
154  }
155  delete doc;
156 
157  return aGPs;
158 }
GoldenPattern * buildGP(xercesc::DOMElement *aGPElement, unsigned int index=0)
xercesc::DOMDocument * doc
assert(m_qm.get())
std::string patternsFile
xercesc::XercesDOMParser * parser
std::vector< GoldenPattern * > aGPs
Cache with GPs read.
XMLCh * _toDOMS(std::string temp)
void XMLConfigReader::setConfigFile ( const std::string &  fName)
inline
void XMLConfigReader::setEventsFile ( const std::string &  fName)
inline

Definition at line 38 of file XMLConfigReader.h.

References eventsFile, and MainPageGenerator::fName.

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

Member Data Documentation

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

Cache with GPs read.

Definition at line 65 of file XMLConfigReader.h.

Referenced by readLUT(), and readPatterns().

std::string XMLConfigReader::configFile
private
xercesc::DOMDocument* XMLConfigReader::doc
private

Definition at line 62 of file XMLConfigReader.h.

Referenced by readConfig(), readEvent(), readPatterns(), and XMLConfigReader().

std::string XMLConfigReader::eventsFile
private

Definition at line 56 of file XMLConfigReader.h.

Referenced by readEvent(), and setEventsFile().

OMTFConfiguration* XMLConfigReader::m_omtf_config
private

Definition at line 67 of file XMLConfigReader.h.

Referenced by buildGP(), readConfig(), readEvent(), and readLUT().

xercesc::XercesDOMParser* XMLConfigReader::parser
private

Definition at line 61 of file XMLConfigReader.h.

Referenced by readConfig(), readEvent(), readPatterns(), and XMLConfigReader().

std::string XMLConfigReader::patternsFile
private

Definition at line 55 of file XMLConfigReader.h.

Referenced by readPatterns(), and setPatternsFile().