test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
XMLConfigReader.cc
Go to the documentation of this file.
1 #include <iostream>
2 #include <cmath>
3 #include <algorithm>
4 #include <utility>
5 
9 
11 
13 
14 #include "xercesc/framework/StdOutFormatTarget.hpp"
15 #include "xercesc/framework/LocalFileFormatTarget.hpp"
16 #include "xercesc/parsers/XercesDOMParser.hpp"
17 #include "xercesc/dom/DOM.hpp"
18 #include "xercesc/dom/DOMException.hpp"
19 #include "xercesc/dom/DOMImplementation.hpp"
20 #include "xercesc/sax/HandlerBase.hpp"
21 #include "xercesc/util/XMLString.hpp"
22 #include "xercesc/util/PlatformUtils.hpp"
23 #include "xercesc/util/XercesDefs.hpp"
24 XERCES_CPP_NAMESPACE_USE
25 
28 // XMLConfigReader
30 inline std::string _toString(XMLCh const* toTranscode) {
32 return tmp;
33 }
34 
35 inline XMLCh* _toDOMS(std::string temp) {
36  XMLCh* buff = XMLString::transcode(temp.c_str());
37  return buff;
38 }
42 
43  XMLPlatformUtils::Initialize();
44 
46  parser = new XercesDOMParser();
47  parser->setValidationScheme(XercesDOMParser::Val_Auto);
48  parser->setDoNamespaces(false);
49 
50  doc = 0;
51 }
55 
56  std::stringstream strStream;
57  int totalInWidth = 6;
58  int outWidth = 6;
59 
60  if(type=="iCharge") outWidth = 1;
61  if(type=="iEta") outWidth = 2;
62  if(type=="iPt") outWidth = 9;
63  if(type=="meanDistPhi"){
64  outWidth = 11;
65  totalInWidth = 14;
66  }
67  if(type=="pdf"){
68  outWidth = 6;
69  totalInWidth = 20;
70  }
71 
73  strStream <<"#<header> V1 "<<totalInWidth<<" "<<outWidth<<" </header> "<<std::endl;
74 
76  const std::vector<GoldenPattern *> & aGPs = readPatterns(aConfig);
77  unsigned int in = 0;
78  int out = 0;
79  for(auto it: aGPs){
80  if(type=="iCharge") out = it->key().theCharge==-1 ? 0:1;
81  if(type=="iEta") out = it->key().theEtaCode;
82  if(type=="iPt") out = it->key().thePtCode;
83  if(type=="meanDistPhi"){
84  for(unsigned int iLayer = 0;iLayer<(unsigned) aConfig.nLayers();++iLayer){
85  for(unsigned int iRefLayer=0;iRefLayer<(unsigned) aConfig.nRefLayers();++iRefLayer){
86  out = (1<<(outWidth-1)) + it->meanDistPhiValue(iLayer,iRefLayer);
87  strStream<<in<<" "<<out<<std::endl;
88  ++in;
89  }
90  }
91  }
92  if(type=="pdf"){
93  for(unsigned int iLayer = 0;iLayer<(unsigned)aConfig.nLayers();++iLayer){
94  for(unsigned int iRefLayer=0;iRefLayer<(unsigned)aConfig.nRefLayers();++iRefLayer){
95  for(unsigned int iPdf=0;iPdf<exp2(aConfig.nPdfAddrBits());++iPdf){
96  out = it->pdfValue(iLayer,iRefLayer,iPdf);
97  strStream<<in<<" "<<out<<std::endl;
98  ++in;
99  }
100  }
101  }
102  }
103  if(type!="meanDistPhi" && type!="pdf"){
104  strStream<<in<<" "<<out<<std::endl;
105  ++in;
106  }
107  }
109  lut->read(strStream);
110 }
113 std::vector<GoldenPattern*> XMLConfigReader::readPatterns(const L1TMuonOverlapParams & aConfig){
114 
115  aGPs.clear();
116 
117  parser->parse(patternsFile.c_str());
118  xercesc::DOMDocument* doc = parser->getDocument();
119  assert(doc);
120 
121  unsigned int nElem = doc->getElementsByTagName(_toDOMS("GP"))->getLength();
122  if(nElem<1){
123  edm::LogError("critical")<<"Problem parsing XML file "<<patternsFile<<std::endl;
124  edm::LogError("critical")<<"No GoldenPattern items: GP found"<<std::endl;
125  return aGPs;
126  }
127 
128  DOMNode *aNode = 0;
129  DOMElement* aGPElement = 0;
130  for(unsigned int iItem=0;iItem<nElem;++iItem){
131  aNode = doc->getElementsByTagName(_toDOMS("GP"))->item(iItem);
132  aGPElement = static_cast<DOMElement *>(aNode);
133 
134  std::ostringstream stringStr;
135  GoldenPattern *aGP;
136  for(unsigned int index = 1;index<5;++index){
137  stringStr.str("");
138  stringStr<<"iPt"<<index;
140  if(aGPElement->getAttributeNode(_toDOMS(stringStr.str().c_str()))){
141  aGP = buildGP(aGPElement, aConfig, index);
142  if(aGP) aGPs.push_back(aGP);
143  }
144  else{
145  aGP = buildGP(aGPElement, aConfig);
146  if(aGP) aGPs.push_back(aGP);
147  break;
148  }
149  }
150  }
151  delete doc;
152 
153  return aGPs;
154 }
157 GoldenPattern * XMLConfigReader::buildGP(DOMElement* aGPElement,
158  const L1TMuonOverlapParams & aConfig,
159  unsigned int index){
160 
161  std::ostringstream stringStr;
162  if(index>0) stringStr<<"iPt"<<index;
163  else stringStr.str("iPt");
164 
165  unsigned int iPt = std::atoi(_toString(aGPElement->getAttribute(_toDOMS(stringStr.str().c_str()))).c_str());
166  if(iPt==0) return 0;
167 
168  int iEta = std::atoi(_toString(aGPElement->getAttribute(_toDOMS("iEta"))).c_str());
169  int iCharge = std::atoi(_toString(aGPElement->getAttribute(_toDOMS("iCharge"))).c_str());
170  int val = 0;
171  unsigned int nLayers = aGPElement->getElementsByTagName(_toDOMS("Layer"))->getLength();
172  assert(nLayers==(unsigned) aConfig.nLayers());
173 
174  DOMNode *aNode = 0;
175  DOMElement* aLayerElement = 0;
176  DOMElement* aItemElement = 0;
177  GoldenPattern::vector2D meanDistPhi2D(nLayers);
178  GoldenPattern::vector1D pdf1D(exp2(aConfig.nPdfAddrBits()));
179  GoldenPattern::vector3D pdf3D(aConfig.nLayers());
180  GoldenPattern::vector2D pdf2D(aConfig.nRefLayers());
182  for(unsigned int iLayer=0;iLayer<nLayers;++iLayer){
183  aNode = aGPElement->getElementsByTagName(_toDOMS("Layer"))->item(iLayer);
184  aLayerElement = static_cast<DOMElement *>(aNode);
186  unsigned int nItems = aLayerElement->getElementsByTagName(_toDOMS("RefLayer"))->getLength();
187  assert(nItems==(unsigned) aConfig.nRefLayers());
188  GoldenPattern::vector1D meanDistPhi1D(nItems);
189  for(unsigned int iItem=0;iItem<nItems;++iItem){
190  aNode = aLayerElement->getElementsByTagName(_toDOMS("RefLayer"))->item(iItem);
191  aItemElement = static_cast<DOMElement *>(aNode);
192  val = std::atoi(_toString(aItemElement->getAttribute(_toDOMS("meanDistPhi"))).c_str());
193  meanDistPhi1D[iItem] = val;
194  }
195  meanDistPhi2D[iLayer] = meanDistPhi1D;
196 
198  stringStr.str("");
199  if(index>0) stringStr<<"value"<<index;
200  else stringStr.str("value");
201  nItems = aLayerElement->getElementsByTagName(_toDOMS("PDF"))->getLength();
202  assert(nItems==aConfig.nRefLayers()*exp2(aConfig.nPdfAddrBits()));
203  for(unsigned int iRefLayer=0;iRefLayer<(unsigned) aConfig.nRefLayers();++iRefLayer){
204  pdf1D.assign(exp2(aConfig.nPdfAddrBits()),0);
205  for(unsigned int iPdf=0;iPdf<exp2(aConfig.nPdfAddrBits());++iPdf){
206  aNode = aLayerElement->getElementsByTagName(_toDOMS("PDF"))->item(iRefLayer*exp2(aConfig.nPdfAddrBits())+iPdf);
207  aItemElement = static_cast<DOMElement *>(aNode);
208  val = std::atoi(_toString(aItemElement->getAttribute(_toDOMS(stringStr.str().c_str()))).c_str());
209  pdf1D[iPdf] = val;
210  }
211  pdf2D[iRefLayer] = pdf1D;
212  }
213  pdf3D[iLayer] = pdf2D;
214  }
215 
216  Key aKey(iEta,iPt,iCharge);
217  GoldenPattern *aGP = new GoldenPattern(aKey,0);
218  aGP->setMeanDistPhi(meanDistPhi2D);
219  aGP->setPdf(pdf3D);
220 
221  return aGP;
222 }
225 std::vector<std::vector<int> > XMLConfigReader::readEvent(unsigned int iEvent,
226  unsigned int iProcessor,
227  bool readEta){
228 
229  return OMTFinput::vector2D();
230 
231  /*
232  if(!doc){
233  parser->parse(eventsFile.c_str());
234  doc = parser->getDocument();
235  }
236  assert(doc);
237 
238  OMTFinput::vector1D input1D(14,m_omtf_config->nPhiBins);
239  OMTFinput::vector2D input2D(m_omtf_config->nLayers);
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  for(unsigned int iLayer=0;iLayer<nLayersHit;++iLayer){
284  aNode = aProcElement->getElementsByTagName(_toDOMS("Layer"))->item(iLayer);
285  aLayerElement = static_cast<DOMElement *>(aNode);
286  aLogicLayer = std::atoi(_toString(aLayerElement->getAttribute(_toDOMS("iLayer"))).c_str());
287  nElem = aLayerElement->getElementsByTagName(_toDOMS("Hit"))->getLength();
288  input1D.assign(14,m_omtf_config->nPhiBins);
289 
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  */
304 }
308 
309  parser->parse(configFile.c_str());
310  xercesc::DOMDocument* doc = parser->getDocument();
311  assert(doc);
312  unsigned int nElem = doc->getElementsByTagName(_toDOMS("OMTF"))->getLength();
313  if(nElem!=1){
314  edm::LogError("critical")<<"Problem parsing XML file "<<configFile<<std::endl;
315  assert(nElem==1);
316  }
317  DOMNode *aNode = doc->getElementsByTagName(_toDOMS("OMTF"))->item(0);
318  DOMElement* aOMTFElement = static_cast<DOMElement *>(aNode);
319 
320  unsigned int version = std::stoul(_toString(aOMTFElement->getAttribute(_toDOMS("version"))), nullptr, 16);
321  aConfig->setFwVersion(version);
322 
324  nElem = aOMTFElement->getElementsByTagName(_toDOMS("GlobalData"))->getLength();
325  assert(nElem==1);
326  aNode = aOMTFElement->getElementsByTagName(_toDOMS("GlobalData"))->item(0);
327  DOMElement* aElement = static_cast<DOMElement *>(aNode);
328 
329  unsigned int nPdfAddrBits = std::atoi(_toString(aElement->getAttribute(_toDOMS("nPdfAddrBits"))).c_str());
330  unsigned int nPdfValBits = std::atoi(_toString(aElement->getAttribute(_toDOMS("nPdfValBits"))).c_str());
331  unsigned int nHitsPerLayer = std::atoi(_toString(aElement->getAttribute(_toDOMS("nHitsPerLayer"))).c_str());
332  unsigned int nPhiBits = std::atoi(_toString(aElement->getAttribute(_toDOMS("nPhiBits"))).c_str());
333  unsigned int nPhiBins = std::atoi(_toString(aElement->getAttribute(_toDOMS("nPhiBins"))).c_str());
334  unsigned int nRefHits = std::atoi(_toString(aElement->getAttribute(_toDOMS("nRefHits"))).c_str());
335  unsigned int nTestRefHits = std::atoi(_toString(aElement->getAttribute(_toDOMS("nTestRefHits"))).c_str());
336  unsigned int nProcessors = std::atoi(_toString(aElement->getAttribute(_toDOMS("nProcessors"))).c_str());
337  unsigned int nLogicRegions = std::atoi(_toString(aElement->getAttribute(_toDOMS("nLogicRegions"))).c_str());
338  unsigned int nInputs = std::atoi(_toString(aElement->getAttribute(_toDOMS("nInputs"))).c_str());
339  unsigned int nLayers = std::atoi(_toString(aElement->getAttribute(_toDOMS("nLayers"))).c_str());
340  unsigned int nRefLayers = std::atoi(_toString(aElement->getAttribute(_toDOMS("nRefLayers"))).c_str());
341  unsigned int nGoldenPatterns = std::atoi(_toString(aElement->getAttribute(_toDOMS("nGoldenPatterns"))).c_str());
342 
343  std::vector<int> paramsVec(L1TMuonOverlapParams::GENERAL_NCONFIG);
344  paramsVec[L1TMuonOverlapParams::GENERAL_ADDRBITS] = nPdfAddrBits;
345  paramsVec[L1TMuonOverlapParams::GENERAL_VALBITS] = nPdfValBits;
346  paramsVec[L1TMuonOverlapParams::GENERAL_HITSPERLAYER] = nHitsPerLayer;
347  paramsVec[L1TMuonOverlapParams::GENERAL_PHIBITS] = nPhiBits;
349  paramsVec[L1TMuonOverlapParams::GENERAL_NREFHITS] = nRefHits;
350  paramsVec[L1TMuonOverlapParams::GENERAL_NTESTREFHITS] = nTestRefHits;
351  paramsVec[L1TMuonOverlapParams::GENERAL_NPROCESSORS] = nProcessors;
352  paramsVec[L1TMuonOverlapParams::GENERAL_NLOGIC_REGIONS] = nLogicRegions;
353  paramsVec[L1TMuonOverlapParams::GENERAL_NINPUTS] = nInputs;
354  paramsVec[L1TMuonOverlapParams::GENERAL_NLAYERS] = nLayers;
355  paramsVec[L1TMuonOverlapParams::GENERAL_NREFLAYERS] = nRefLayers;
356  paramsVec[L1TMuonOverlapParams::GENERAL_NGOLDENPATTERNS] = nGoldenPatterns;
357  aConfig->setGeneralParams(paramsVec);
358 
361  std::vector<int> sectorsStart(3*nProcessors), sectorsEnd(3*nProcessors);
362  nElem = aOMTFElement->getElementsByTagName(_toDOMS("ConnectionMap"))->getLength();
363  DOMElement* aConnectionElement = 0;
364  for(uint i=0;i<nElem;++i){
365  aNode = aOMTFElement->getElementsByTagName(_toDOMS("ConnectionMap"))->item(i);
366  aConnectionElement = static_cast<DOMElement *>(aNode);
367  unsigned int iProcessor = std::atoi(_toString(aConnectionElement->getAttribute(_toDOMS("iProcessor"))).c_str());
368  unsigned int barrelMin = std::atoi(_toString(aConnectionElement->getAttribute(_toDOMS("barrelMin"))).c_str());
369  unsigned int barrelMax = std::atoi(_toString(aConnectionElement->getAttribute(_toDOMS("barrelMax"))).c_str());
370  unsigned int endcap10DegMin = std::atoi(_toString(aConnectionElement->getAttribute(_toDOMS("endcap10DegMin"))).c_str());
371  unsigned int endcap10DegMax = std::atoi(_toString(aConnectionElement->getAttribute(_toDOMS("endcap10DegMax"))).c_str());
372  unsigned int endcap20DegMin = std::atoi(_toString(aConnectionElement->getAttribute(_toDOMS("endcap20DegMin"))).c_str());
373  unsigned int endcap20DegMax = std::atoi(_toString(aConnectionElement->getAttribute(_toDOMS("endcap20DegMax"))).c_str());
374 
375  sectorsStart[iProcessor] = barrelMin;
376  sectorsStart[iProcessor + nProcessors] = endcap10DegMin;
377  sectorsStart[iProcessor + 2*nProcessors] = endcap20DegMin;
378 
379  sectorsEnd[iProcessor] = barrelMax;
380  sectorsEnd[iProcessor + nProcessors] = endcap10DegMax;
381  sectorsEnd[iProcessor + 2*nProcessors] = endcap20DegMax;
382  }
383  aConfig->setConnectedSectorsStart(sectorsStart);
384  aConfig->setConnectedSectorsEnd(sectorsEnd);
385 
386 
388  std::vector<L1TMuonOverlapParams::LayerMapNode> aLayerMapVec;
390 
391  nElem = aOMTFElement->getElementsByTagName(_toDOMS("LayerMap"))->getLength();
392  DOMElement* aLayerElement = 0;
393  for(uint i=0;i<nElem;++i){
394  aNode = aOMTFElement->getElementsByTagName(_toDOMS("LayerMap"))->item(i);
395  aLayerElement = static_cast<DOMElement *>(aNode);
396  unsigned int hwNumber = std::atoi(_toString(aLayerElement->getAttribute(_toDOMS("hwNumber"))).c_str());
397  unsigned int logicNumber = std::atoi(_toString(aLayerElement->getAttribute(_toDOMS("logicNumber"))).c_str());
398  unsigned int isBendingLayer = std::atoi(_toString(aLayerElement->getAttribute(_toDOMS("bendingLayer"))).c_str());
399  unsigned int iConnectedLayer = std::atoi(_toString(aLayerElement->getAttribute(_toDOMS("connectedToLayer"))).c_str());
400  aLayerMapNode.logicNumber = logicNumber;
401  aLayerMapNode.hwNumber = hwNumber;
402  aLayerMapNode.connectedToLayer = iConnectedLayer;
403  aLayerMapNode.bendingLayer = isBendingLayer;
404  aLayerMapVec.push_back(aLayerMapNode);
405  }
406  aConfig->setLayerMap(aLayerMapVec);
407 
409  std::vector<L1TMuonOverlapParams::RefLayerMapNode> aRefLayerMapVec;
411 
412  nElem = aOMTFElement->getElementsByTagName(_toDOMS("RefLayerMap"))->getLength();
413  DOMElement* aRefLayerElement = 0;
414  for(uint i=0;i<nElem;++i){
415  aNode = aOMTFElement->getElementsByTagName(_toDOMS("RefLayerMap"))->item(i);
416  aRefLayerElement = static_cast<DOMElement *>(aNode);
417  unsigned int refLayer = std::atoi(_toString(aRefLayerElement->getAttribute(_toDOMS("refLayer"))).c_str());
418  unsigned int logicNumber = std::atoi(_toString(aRefLayerElement->getAttribute(_toDOMS("logicNumber"))).c_str());
419  aRefLayerNode.refLayer = refLayer;
420  aRefLayerNode.logicNumber = logicNumber;
421  aRefLayerMapVec.push_back(aRefLayerNode);
422  }
423  aConfig->setRefLayerMap(aRefLayerMapVec);
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  for (unsigned int iProcessor=0; iProcessor<nProcessors; iProcessor++) aRefHitMapVec[iRefHit + iProcessor*nRefHits] = aRefHitNode;
471  }
473  unsigned int nElem2 = aProcessorElement->getElementsByTagName(_toDOMS("LogicRegion"))->getLength();
474  assert( (iProcessor==0 && nElem2==nLogicRegions) || (iProcessor!=0 && nElem2==0) );
475  DOMElement* aRegionElement = 0;
476  for(uint ii=0;ii<nElem2;++ii){
477  aNode = aProcessorElement->getElementsByTagName(_toDOMS("LogicRegion"))->item(ii);
478  aRegionElement = static_cast<DOMElement *>(aNode);
479  unsigned int iRegion = std::atoi(_toString(aRegionElement->getAttribute(_toDOMS("iRegion"))).c_str());
480  unsigned int nElem3 = aRegionElement->getElementsByTagName(_toDOMS("Layer"))->getLength();
481  assert(nElem3==nLayers);
482  DOMElement* aLayerElement = 0;
483  for(uint iii=0;iii<nElem3;++iii){
484  aNode = aRegionElement->getElementsByTagName(_toDOMS("Layer"))->item(iii);
485  aLayerElement = static_cast<DOMElement *>(aNode);
486  unsigned int iLayer = std::atoi(_toString(aLayerElement->getAttribute(_toDOMS("iLayer"))).c_str());
487  unsigned int iFirstInput = std::atoi(_toString(aLayerElement->getAttribute(_toDOMS("iFirstInput"))).c_str());
488  unsigned int nInputs = std::atoi(_toString(aLayerElement->getAttribute(_toDOMS("nInputs"))).c_str());
489  aLayerInputNode.iLayer = iLayer;
490  aLayerInputNode.iFirstInput = iFirstInput;
491  aLayerInputNode.nInputs = nInputs;
492  for (unsigned int iProcessor=0; iProcessor<nProcessors; ++iProcessor) aLayerInputMapVec[iLayer + iRegion*nLayers + iProcessor*nLayers*nLogicRegions] = aLayerInputNode;
493  }
494  }
495  }
496 
497  aConfig->setGlobalPhiStartMap(aGlobalPhiStartVec);
498  aConfig->setLayerInputMap(aLayerInputMapVec);
499  aConfig->setRefHitMap(aRefHitMapVec);
500 
501  delete doc;
502 }
505 
type
Definition: HCALResponse.h:21
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
std::vector< int > vector1D
Definition: GoldenPattern.h:50
void setRefLayerMap(const std::vector< RefLayerMapNode > &aVector)
assert(m_qm.get())
std::string _toString(const XMLCh *toTranscode)
void readLUT(l1t::LUT *lut, const L1TMuonOverlapParams &aConfig, const std::string &type)
unsigned int logicNumber
logic numer of the layer
std::vector< std::vector< int > > readEvent(unsigned int iEvent=0, unsigned int iProcessor=0, bool readEta=false)
int ii
Definition: cuy.py:588
std::vector< vector1D > vector2D
Definition: OMTFinput.h:16
std::string patternsFile
std::vector< GoldenPattern * > readPatterns(const L1TMuonOverlapParams &aConfig)
int read(std::istream &stream)
Definition: LUT.cc:35
int iEvent
Definition: GenABIO.cc:230
std::vector< vector1D > vector2D
Definition: GoldenPattern.h:51
std::vector< vector2D > vector3D
Definition: GoldenPattern.h:52
void setPdf(const vector3D &aPdf)
Definition: GoldenPattern.h:68
void setGeneralParams(const std::vector< int > &paramsVec)
GoldenPattern * buildGP(xercesc::DOMElement *aGPElement, const L1TMuonOverlapParams &aConfig, unsigned int index=0)
XMLCh * transcode(const T &fInput)
tuple lut
Definition: lumiPlot.py:244
void readConfig(const std::string fName)
bool bendingLayer
Is this a bending layers?
void setConnectedSectorsStart(const std::vector< int > &aVector)
xercesc::XercesDOMParser * parser
int nPdfAddrBits() const
Access to specific general settings.
Definition: LUT.h:29
unsigned int refLayer
Reference layer number.
void setGlobalPhiStartMap(const std::vector< int > &aVector)
void setLayerInputMap(const std::vector< LayerInputNode > &aVector)
std::vector< GoldenPattern * > aGPs
Cache with GPs read.
void setRefHitMap(const std::vector< RefHitNode > &aVector)
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
void setMeanDistPhi(const vector2D &aMeanDistPhi)
Definition: GoldenPattern.h:62
unsigned int logicNumber
Corresponding logical layer number.
XMLCh * _toDOMS(std::string temp)
void setFwVersion(unsigned fwVersion)
std::string configFile