CMS 3D CMS Logo

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

#include <XMLConfigWriter.h>

Public Member Functions

void finaliseXMLDocument (const std::string &fName)
 
unsigned int findMaxInput (const OMTFConfiguration::vector1D &myCounts)
 
void initialiseXMLDocument (const std::string &docName)
 
void writeAlgoMuon (xercesc::DOMElement *aTopElement, unsigned int iRefHit, const AlgoMuon &aMuon)
 
void writeCandMuon (xercesc::DOMElement *aTopElement, const l1t::RegionalMuonCand &aCand)
 
void writeConnectionsData (const std::vector< std::vector< OMTFConfiguration::vector2D > > &measurements4D)
 
xercesc::DOMElement * writeEventData (xercesc::DOMElement *aTopElement, const OmtfName &board, const OMTFinput &aInput)
 
xercesc::DOMElement * writeEventHeader (unsigned int eventId, unsigned int mixedEventId=0)
 
void writeGPData (const GoldenPattern &aGP)
 
void writeGPData (const GoldenPattern &aGP1, const GoldenPattern &aGP2, const GoldenPattern &aGP3, const GoldenPattern &aGP4)
 
void writeResultsData (xercesc::DOMElement *aTopElement, unsigned int iRegion, const Key &aKey, const OMTFResult &aResult)
 
 XMLConfigWriter (const OMTFConfiguration *aOMTFConfig)
 

Private Attributes

xercesc::DOMImplementation * domImpl
 
const OMTFConfigurationmyOMTFConfig
 
xercesc::DOMDocument * theDoc
 
xercesc::DOMElement * theTopElement
 

Detailed Description

Definition at line 28 of file XMLConfigWriter.h.

Constructor & Destructor Documentation

◆ XMLConfigWriter()

XMLConfigWriter::XMLConfigWriter ( const OMTFConfiguration aOMTFConfig)

Initialise XML document

Definition at line 88 of file XMLConfigWriter.cc.

88  {
89  XMLPlatformUtils::Initialize();
90 
92  domImpl = DOMImplementationRegistry::getDOMImplementation(_toDOMS("Range"));
93 
94  myOMTFConfig = aOMTFConfig;
95 }

References _toDOMS(), domImpl, and myOMTFConfig.

Member Function Documentation

◆ finaliseXMLDocument()

void XMLConfigWriter::finaliseXMLDocument ( const std::string &  fName)

Definition at line 114 of file XMLConfigWriter.cc.

114  {
115  XMLFormatTarget* formTarget = new LocalFileFormatTarget(fName.c_str());
116 
117 #if _XERCES_VERSION < 30100
118  xercesc::DOMWriter* domWriter = (dynamic_cast<DOMImplementation*>(domImpl))->createDOMWriter();
119  if (domWriter->canSetFeature(XMLUni::fgDOMWRTFormatPrettyPrint, true)) {
120  domWriter->setFeature(XMLUni::fgDOMWRTFormatPrettyPrint, true);
121  }
122  domWriter->writeNode(formTarget, *theTopElement);
123 
124 #else
125  xercesc::DOMLSSerializer* theSerializer = (dynamic_cast<DOMImplementation*>(domImpl))->createLSSerializer();
126  if (theSerializer->getDomConfig()->canSetParameter(XMLUni::fgDOMWRTFormatPrettyPrint, true))
127  theSerializer->getDomConfig()->setParameter(XMLUni::fgDOMWRTFormatPrettyPrint, true);
128  DOMLSOutput* theOutput = (dynamic_cast<DOMImplementation*>(domImpl))->createLSOutput();
129  theOutput->setByteStream(formTarget);
130  theSerializer->write(theTopElement, theOutput);
131  theOutput->release();
132  theSerializer->release();
133 #endif
134 
135  delete formTarget;
136 }

References domImpl, MainPageGenerator::fName, and theTopElement.

Referenced by OMTFPatternMaker::endJob(), and OMTFReconstruction::endJob().

◆ findMaxInput()

unsigned int XMLConfigWriter::findMaxInput ( const OMTFConfiguration::vector1D myCounts)

Definition at line 659 of file XMLConfigWriter.cc.

659  {
660  unsigned int max = 0;
661  unsigned int maxInput = 0;
662  for (unsigned int iInput = 0; iInput < 14; ++iInput) {
663  if (myCounts[iInput] > (int)max) {
664  max = myCounts[iInput];
665  maxInput = iInput;
666  }
667  }
668  return maxInput;
669 }

References SiStripPI::max.

Referenced by writeConnectionsData().

◆ initialiseXMLDocument()

void XMLConfigWriter::initialiseXMLDocument ( const std::string &  docName)

Definition at line 98 of file XMLConfigWriter.cc.

98  {
99  theDoc = domImpl->createDocument(nullptr, _toDOMS(docName), nullptr);
100  theTopElement = theDoc->getDocumentElement();
101 
102  unsigned int version = myOMTFConfig->patternsVersion();
103  unsigned int mask16bits = 0xFFFF;
104 
105  version &= mask16bits;
106 
107  std::ostringstream stringStr;
108  stringStr.str("");
109  stringStr << "0x" << std::hex << std::setfill('0') << std::setw(4) << version;
110  theTopElement->setAttribute(_toDOMS("version"), _toDOMS(stringStr.str()));
111 }

References _toDOMS(), domImpl, myOMTFConfig, OMTFConfiguration::patternsVersion(), theDoc, theTopElement, and BeamSplash_cfg::version.

Referenced by OMTFReconstruction::beginRun(), and OMTFPatternMaker::endJob().

◆ writeAlgoMuon()

void XMLConfigWriter::writeAlgoMuon ( xercesc::DOMElement *  aTopElement,
unsigned int  iRefHit,
const AlgoMuon aMuon 
)

Definition at line 219 of file XMLConfigWriter.cc.

219  {
220  xercesc::DOMElement* aResult = theDoc->createElement(_toDOMS("AlgoMuon"));
221  std::ostringstream stringStr;
222  stringStr.str("");
223  stringStr << iRefHit;
224  aResult->setAttribute(_toDOMS("iRefHit"), _toDOMS(stringStr.str()));
225  stringStr.str("");
226  stringStr << aCand.getPt();
227  aResult->setAttribute(_toDOMS("ptCode"), _toDOMS(stringStr.str()));
228  stringStr.str("");
229  stringStr << aCand.getPhi();
230  aResult->setAttribute(_toDOMS("phiCode"), _toDOMS(stringStr.str()));
231  stringStr.str("");
232  stringStr << eta2Bits(abs(aCand.getEta()));
233  aResult->setAttribute(_toDOMS("etaCode"), _toDOMS(stringStr.str()));
234  stringStr.str("");
235  stringStr << aCand.getCharge();
236  aResult->setAttribute(_toDOMS("charge"), _toDOMS(stringStr.str()));
237  stringStr.str("");
238  stringStr << aCand.getQ();
239  aResult->setAttribute(_toDOMS("nHits"), _toDOMS(stringStr.str()));
240  stringStr.str("");
241  stringStr << aCand.getDisc();
242  aResult->setAttribute(_toDOMS("disc"), _toDOMS(stringStr.str()));
243  stringStr.str("");
244  stringStr << aCand.getRefLayer();
245  aResult->setAttribute(_toDOMS("iRefLayer"), _toDOMS(stringStr.str()));
246  stringStr.str("");
247  stringStr << std::bitset<18>(aCand.getHits());
248  aResult->setAttribute(_toDOMS("layers"), _toDOMS(stringStr.str()));
249  stringStr.str("");
250  stringStr << aCand.getPhiRHit();
251  aResult->setAttribute(_toDOMS("phiRHit"), _toDOMS(stringStr.str()));
252  stringStr.str("");
253  stringStr << aCand.getPatternNumber();
254  aResult->setAttribute(_toDOMS("patNum"), _toDOMS(stringStr.str()));
255 
256  aTopElement->appendChild(aResult);
257 }

References _toDOMS(), funct::abs(), XERCES_CPP_NAMESPACE_USE::eta2Bits(), AlgoMuon::getCharge(), AlgoMuon::getDisc(), AlgoMuon::getEta(), AlgoMuon::getHits(), AlgoMuon::getPatternNumber(), AlgoMuon::getPhi(), AlgoMuon::getPhiRHit(), AlgoMuon::getPt(), AlgoMuon::getQ(), AlgoMuon::getRefLayer(), and theDoc.

Referenced by OMTFReconstruction::writeResultToXML().

◆ writeCandMuon()

void XMLConfigWriter::writeCandMuon ( xercesc::DOMElement *  aTopElement,
const l1t::RegionalMuonCand aCand 
)

Definition at line 260 of file XMLConfigWriter.cc.

260  {
261  xercesc::DOMElement* aResult = theDoc->createElement(_toDOMS("CandMuon"));
262  std::ostringstream stringStr;
263  stringStr.str("");
264  stringStr << aCand.hwPt();
265  aResult->setAttribute(_toDOMS("hwPt"), _toDOMS(stringStr.str()));
266  stringStr.str("");
267  stringStr << aCand.hwPhi();
268  aResult->setAttribute(_toDOMS("hwPhi"), _toDOMS(stringStr.str()));
269  stringStr.str("");
270  stringStr << aCand.hwEta();
271  aResult->setAttribute(_toDOMS("hwEta"), _toDOMS(stringStr.str()));
272  stringStr.str("");
273  stringStr << aCand.hwSign();
274  aResult->setAttribute(_toDOMS("hwSign"), _toDOMS(stringStr.str()));
275  stringStr.str("");
276  stringStr << aCand.hwSignValid();
277  aResult->setAttribute(_toDOMS("hwSignValid"), _toDOMS(stringStr.str()));
278  stringStr.str("");
279  stringStr << aCand.hwQual();
280  aResult->setAttribute(_toDOMS("hwQual"), _toDOMS(stringStr.str()));
281  stringStr.str("");
282  std::map<int, int> hwAddrMap = aCand.trackAddress();
283  stringStr << std::bitset<29>(hwAddrMap[0]);
284  aResult->setAttribute(_toDOMS("hwTrackAddress"), _toDOMS(stringStr.str()));
285  stringStr.str("");
286  stringStr << aCand.link();
287  aResult->setAttribute(_toDOMS("link"), _toDOMS(stringStr.str()));
288  stringStr.str("");
289  stringStr << aCand.processor();
290  aResult->setAttribute(_toDOMS("processor"), _toDOMS(stringStr.str()));
291  stringStr.str("");
292  if (aCand.trackFinderType() == l1t::omtf_neg)
293  stringStr << "OMTF_NEG";
294  else if (aCand.trackFinderType() == l1t::omtf_pos)
295  stringStr << "OMTF_POS";
296  else
297  stringStr << aCand.trackFinderType();
298  aResult->setAttribute(_toDOMS("trackFinderType"), _toDOMS(stringStr.str()));
299  aTopElement->appendChild(aResult);
300 }

References _toDOMS(), l1t::RegionalMuonCand::hwEta(), l1t::RegionalMuonCand::hwPhi(), l1t::RegionalMuonCand::hwPt(), l1t::RegionalMuonCand::hwQual(), l1t::RegionalMuonCand::hwSign(), l1t::RegionalMuonCand::hwSignValid(), l1t::RegionalMuonCand::link(), l1t::omtf_neg, l1t::omtf_pos, l1t::RegionalMuonCand::processor(), theDoc, l1t::RegionalMuonCand::trackAddress(), and l1t::RegionalMuonCand::trackFinderType().

Referenced by OMTFReconstruction::writeResultToXML().

◆ writeConnectionsData()

void XMLConfigWriter::writeConnectionsData ( const std::vector< std::vector< OMTFConfiguration::vector2D > > &  measurements4D)

iPhiMin and iPhiMax are expressed in n bit scale -2**n, +2**2-1 used in each processor

Definition at line 522 of file XMLConfigWriter.cc.

523  {
524  std::ostringstream stringStr;
525 
526  for (unsigned int iProcessor = 0; iProcessor < 6; ++iProcessor) {
527  xercesc::DOMElement* aProcessorElement = theDoc->createElement(_toDOMS("Processor"));
528  stringStr.str("");
529  stringStr << iProcessor;
530  aProcessorElement->setAttribute(_toDOMS("iProcessor"), _toDOMS(stringStr.str()));
531  for (unsigned int iRefLayer = 0; iRefLayer < myOMTFConfig->nRefLayers(); ++iRefLayer) {
532  xercesc::DOMElement* aRefLayerElement = theDoc->createElement(_toDOMS("RefLayer"));
533  stringStr.str("");
534  stringStr << iRefLayer;
535  aRefLayerElement->setAttribute(_toDOMS("iRefLayer"), _toDOMS(stringStr.str()));
536  stringStr.str("");
537  stringStr << myOMTFConfig->getProcessorPhiVsRefLayer()[iProcessor][iRefLayer];
538  aRefLayerElement->setAttribute(_toDOMS("iGlobalPhiStart"), _toDOMS(stringStr.str()));
539  aProcessorElement->appendChild(aRefLayerElement);
540  }
541  unsigned int iRefHit = 0;
543  for (unsigned int iRefLayer = 0; iRefLayer < myOMTFConfig->nRefLayers(); ++iRefLayer) {
544  for (unsigned int iRegion = 0; iRegion < 6; ++iRegion) {
545  unsigned int maxHitCount = 0;
546  for (unsigned int iInput = 0; iInput < 14; ++iInput) {
547  if ((int)maxHitCount < myOMTFConfig->getMeasurements4Dref()[iProcessor][iRegion][iRefLayer][iInput])
548  maxHitCount = myOMTFConfig->getMeasurements4Dref()[iProcessor][iRegion][iRefLayer][iInput];
549  }
550  for (unsigned int iInput = 0; iInput < 14; ++iInput) {
551  unsigned int hitCount = myOMTFConfig->getMeasurements4Dref()[iProcessor][iRegion][iRefLayer][iInput];
552  if (hitCount < maxHitCount * 0.1)
553  continue;
554  xercesc::DOMElement* aRefHitElement = theDoc->createElement(_toDOMS("RefHit"));
555  stringStr.str("");
556  stringStr << iRefHit;
557  aRefHitElement->setAttribute(_toDOMS("iRefHit"), _toDOMS(stringStr.str()));
558  stringStr.str("");
559  stringStr << iRefLayer;
560  aRefHitElement->setAttribute(_toDOMS("iRefLayer"), _toDOMS(stringStr.str()));
561 
562  stringStr.str("");
563  stringStr << iRegion;
564  aRefHitElement->setAttribute(_toDOMS("iRegion"), _toDOMS(stringStr.str()));
565 
566  stringStr.str("");
567  stringStr << iInput;
568  aRefHitElement->setAttribute(_toDOMS("iInput"), _toDOMS(stringStr.str()));
569  unsigned int logicRegionSize = 10 / 360.0 * myOMTFConfig->nPhiBins();
570  int lowScaleEnd = std::pow(2, myOMTFConfig->nPhiBits() - 1);
572  int iPhiMin = myOMTFConfig->getProcessorPhiVsRefLayer()[iProcessor][iRefLayer] -
573  myOMTFConfig->globalPhiStart(iProcessor) - lowScaleEnd;
574  int iPhiMax = iPhiMin + logicRegionSize - 1;
575 
576  iPhiMin += iRegion * logicRegionSize;
577  iPhiMax += iRegion * logicRegionSize;
578 
579  stringStr.str("");
580  stringStr << iPhiMin;
581  aRefHitElement->setAttribute(_toDOMS("iPhiMin"), _toDOMS(stringStr.str()));
582 
583  stringStr.str("");
584  stringStr << iPhiMax;
585  aRefHitElement->setAttribute(_toDOMS("iPhiMax"), _toDOMS(stringStr.str()));
586  if (iRefHit < myOMTFConfig->nRefHits())
587  aProcessorElement->appendChild(aRefHitElement);
588  ++iRefHit;
589  }
590  for (; iRegion == 5 && iRefLayer == 7 && iRefHit < myOMTFConfig->nRefHits(); ++iRefHit) {
591  xercesc::DOMElement* aRefHitElement = theDoc->createElement(_toDOMS("RefHit"));
592  stringStr.str("");
593  stringStr << iRefHit;
594  aRefHitElement->setAttribute(_toDOMS("iRefHit"), _toDOMS(stringStr.str()));
595  stringStr.str("");
596  stringStr << 0;
597  aRefHitElement->setAttribute(_toDOMS("iRefLayer"), _toDOMS(stringStr.str()));
598 
599  stringStr.str("");
600  stringStr << 0;
601  aRefHitElement->setAttribute(_toDOMS("iRegion"), _toDOMS(stringStr.str()));
602 
603  stringStr.str("");
604  stringStr << 0;
605  aRefHitElement->setAttribute(_toDOMS("iInput"), _toDOMS(stringStr.str()));
606 
607  int iPhiMin = 0;
608  int iPhiMax = 1;
609 
610  stringStr.str("");
611  stringStr << iPhiMin;
612  aRefHitElement->setAttribute(_toDOMS("iPhiMin"), _toDOMS(stringStr.str()));
613 
614  stringStr.str("");
615  stringStr << iPhiMax;
616  aRefHitElement->setAttribute(_toDOMS("iPhiMax"), _toDOMS(stringStr.str()));
617 
618  aProcessorElement->appendChild(aRefHitElement);
619  }
620  }
621  }
623  for (unsigned int iRegion = 0; iRegion < 6; ++iRegion) {
624  xercesc::DOMElement* aRegionElement = theDoc->createElement(_toDOMS("LogicRegion"));
625  stringStr.str("");
626  stringStr << iRegion;
627  aRegionElement->setAttribute(_toDOMS("iRegion"), _toDOMS(stringStr.str()));
628 
629  for (unsigned int iLogicLayer = 0; iLogicLayer < myOMTFConfig->nLayers(); ++iLogicLayer) {
630  xercesc::DOMElement* aLayerElement = theDoc->createElement(_toDOMS("Layer"));
631  stringStr.str("");
632  stringStr << iLogicLayer;
634  aLayerElement->setAttribute(_toDOMS("iLayer"), _toDOMS(stringStr.str()));
635  const OMTFConfiguration::vector1D& myCounts =
636  myOMTFConfig->getMeasurements4D()[iProcessor][iRegion][iLogicLayer];
637  unsigned int maxInput = findMaxInput(myCounts);
638  unsigned int begin = 0, end = 0;
639  if ((int)maxInput - 2 >= 0)
640  begin = maxInput - 2;
641  else
642  begin = maxInput;
643  end = maxInput + 3;
644  stringStr.str("");
645  stringStr << begin;
646  aLayerElement->setAttribute(_toDOMS("iFirstInput"), _toDOMS(stringStr.str()));
647  stringStr.str("");
648  stringStr << end - begin + 1;
649  aLayerElement->setAttribute(_toDOMS("nInputs"), _toDOMS(stringStr.str()));
650  aRegionElement->appendChild(aLayerElement);
651  }
652  aProcessorElement->appendChild(aRegionElement);
653  }
654  theTopElement->appendChild(aProcessorElement);
655  }
656 }

References _toDOMS(), mps_fire::end, findMaxInput(), OMTFConfiguration::getMeasurements4D(), OMTFConfiguration::getMeasurements4Dref(), OMTFConfiguration::getProcessorPhiVsRefLayer(), OMTFConfiguration::globalPhiStart(), myOMTFConfig, OMTFConfiguration::nLayers(), OMTFConfiguration::nPhiBins(), OMTFConfiguration::nPhiBits(), OMTFConfiguration::nRefHits(), OMTFConfiguration::nRefLayers(), funct::pow(), theDoc, and theTopElement.

Referenced by OMTFPatternMaker::endJob().

◆ writeEventData()

xercesc::DOMElement * XMLConfigWriter::writeEventData ( xercesc::DOMElement *  aTopElement,
const OmtfName board,
const OMTFinput aInput 
)

Definition at line 168 of file XMLConfigWriter.cc.

170  {
171  std::ostringstream stringStr;
172 
173  xercesc::DOMElement* aProcessor = theDoc->createElement(_toDOMS("Processor"));
174  aProcessor->setAttribute(_toDOMS("board"), _toDOMS(board.name()));
175 
176  unsigned int iProcessor = board.processor();
177  stringStr.str("");
178  stringStr << iProcessor;
179  aProcessor->setAttribute(_toDOMS("iProcessor"), _toDOMS(stringStr.str()));
180  stringStr.str("");
181  if (board.position() == 1)
182  stringStr << "+";
183  stringStr << board.position();
184  aProcessor->setAttribute(_toDOMS("position"), _toDOMS(stringStr.str()));
185 
186  xercesc::DOMElement *aLayer, *aHit;
187  for (unsigned int iLayer = 0; iLayer < myOMTFConfig->nLayers(); ++iLayer) {
188  const OMTFinput::vector1D& layerDataPhi = aInput.getLayerData(iLayer);
189  const OMTFinput::vector1D& layerDataEta = aInput.getLayerData(iLayer, true);
190 
191  aLayer = theDoc->createElement(_toDOMS("Layer"));
192  stringStr.str("");
193  stringStr << iLayer;
194  aLayer->setAttribute(_toDOMS("iLayer"), _toDOMS(stringStr.str()));
195  for (unsigned int iHit = 0; iHit < layerDataPhi.size(); ++iHit) {
196  aHit = theDoc->createElement(_toDOMS("Hit"));
197  stringStr.str("");
198  stringStr << iHit;
199  aHit->setAttribute(_toDOMS("iInput"), _toDOMS(stringStr.str()));
200  stringStr.str("");
201  stringStr << layerDataPhi[iHit];
202  aHit->setAttribute(_toDOMS("iPhi"), _toDOMS(stringStr.str()));
203  stringStr.str("");
204  stringStr << eta2Bits(abs(layerDataEta[iHit]));
205  aHit->setAttribute(_toDOMS("iEta"), _toDOMS(stringStr.str()));
206  if (layerDataPhi[iHit] >= (int)myOMTFConfig->nPhiBins())
207  continue;
208  aLayer->appendChild(aHit);
209  }
210  if (aLayer->getChildNodes()->getLength())
211  aProcessor->appendChild(aLayer);
212  }
213 
214  aTopElement->appendChild(aProcessor);
215  return aProcessor;
216 }

References _toDOMS(), funct::abs(), XERCES_CPP_NAMESPACE_USE::eta2Bits(), OMTFinput::getLayerData(), myOMTFConfig, OmtfName::name(), OMTFConfiguration::nLayers(), OMTFConfiguration::nPhiBins(), OmtfName::position(), OmtfName::processor(), and theDoc.

Referenced by OMTFReconstruction::writeResultToXML().

◆ writeEventHeader()

xercesc::DOMElement * XMLConfigWriter::writeEventHeader ( unsigned int  eventId,
unsigned int  mixedEventId = 0 
)

Definition at line 139 of file XMLConfigWriter.cc.

139  {
140  unsigned int eventBx = eventId * 2;
141 
142  xercesc::DOMElement* aEvent = nullptr;
143  xercesc::DOMElement* aBx = nullptr;
144  std::ostringstream stringStr;
145 
146  aEvent = theDoc->createElement(_toDOMS("Event"));
147 
148  stringStr.str("");
149  stringStr << eventId;
150  aEvent->setAttribute(_toDOMS("iEvent"), _toDOMS(stringStr.str()));
151 
152  stringStr.str("");
153  stringStr << mixedEventId;
154  aEvent->setAttribute(_toDOMS("iMixedEvent"), _toDOMS(stringStr.str()));
155 
156  aBx = theDoc->createElement(_toDOMS("bx"));
157  stringStr.str("");
158  stringStr << eventBx;
159  aBx->setAttribute(_toDOMS("iBx"), _toDOMS(stringStr.str()));
160  aEvent->appendChild(aBx);
161 
162  theTopElement->appendChild(aEvent);
163 
164  return aBx;
165 }

References _toDOMS(), theDoc, and theTopElement.

Referenced by OMTFReconstruction::reconstruct().

◆ writeGPData() [1/2]

void XMLConfigWriter::writeGPData ( const GoldenPattern aGP)

Definition at line 358 of file XMLConfigWriter.cc.

358  {
359  std::ostringstream stringStr;
360  xercesc::DOMElement *aLayer = nullptr, *aRefLayer = nullptr, *aPdf = nullptr;
361 
362  xercesc::DOMElement* aGPElement = theDoc->createElement(_toDOMS("GP"));
363  stringStr.str("");
364  stringStr << aGP.key().thePtCode;
365  aGPElement->setAttribute(_toDOMS("iPt"), _toDOMS(stringStr.str()));
366  stringStr.str("");
367  //stringStr<<aGP.key().theEtaCode;
368  stringStr << "0"; //No eta code at the moment
369  aGPElement->setAttribute(_toDOMS("iEta"), _toDOMS(stringStr.str()));
370  stringStr.str("");
371  stringStr << 0; //No phi code is assigned to GP for the moment.
372  aGPElement->setAttribute(_toDOMS("iPhi"), _toDOMS(stringStr.str()));
373  stringStr.str("");
374  stringStr << aGP.key().theCharge;
375  aGPElement->setAttribute(_toDOMS("iCharge"), _toDOMS(stringStr.str()));
376 
377  for (unsigned int iLayer = 0; iLayer < myOMTFConfig->nLayers(); ++iLayer) {
378  int nOfPhis = 0;
380  aLayer = theDoc->createElement(_toDOMS("Layer"));
381  stringStr.str("");
382  stringStr << iLayer;
384  aLayer->setAttribute(_toDOMS("iLayer"), _toDOMS(stringStr.str()));
385  stringStr.str("");
386  stringStr << nOfPhis;
387  aLayer->setAttribute(_toDOMS("nOfPhis"), _toDOMS(stringStr.str()));
388  for (unsigned int iRefLayer = 0; iRefLayer < myOMTFConfig->nRefLayers(); ++iRefLayer) {
389  aRefLayer = theDoc->createElement(_toDOMS("RefLayer"));
390  int meanDistPhi = aGP.meanDistPhiValue(iLayer, iRefLayer);
391  stringStr.str("");
392  stringStr << meanDistPhi;
393  aRefLayer->setAttribute(_toDOMS("meanDistPhi"), _toDOMS(stringStr.str()));
394  int selDistPhi = 0;
395  stringStr.str("");
396  stringStr << selDistPhi;
397  aRefLayer->setAttribute(_toDOMS("selDistPhi"), _toDOMS(stringStr.str()));
398  int selDistPhiShift = 0;
399  stringStr.str("");
400  stringStr << selDistPhiShift;
401  aRefLayer->setAttribute(_toDOMS("selDistPhiShift"), _toDOMS(stringStr.str()));
402  int distMsbPhiShift = 0;
403  stringStr.str("");
404  stringStr << distMsbPhiShift;
405  aRefLayer->setAttribute(_toDOMS("distMsbPhiShift"), _toDOMS(stringStr.str()));
406  aLayer->appendChild(aRefLayer);
407  }
408  for (unsigned int iRefLayer = 0; iRefLayer < myOMTFConfig->nRefLayers(); ++iRefLayer) {
409  for (unsigned int iPdf = 0; iPdf < exp2(myOMTFConfig->nPdfAddrBits()); ++iPdf) {
410  aPdf = theDoc->createElement(_toDOMS("PDF"));
411  stringStr.str("");
412  stringStr << aGP.pdfValue(iLayer, iRefLayer, iPdf);
413  aPdf->setAttribute(_toDOMS("value"), _toDOMS(stringStr.str()));
414  aLayer->appendChild(aPdf);
415  }
416  }
417  aGPElement->appendChild(aLayer);
418  }
419  theTopElement->appendChild(aGPElement);
420 }

References _toDOMS(), GoldenPattern::key(), GoldenPattern::meanDistPhiValue(), myOMTFConfig, OMTFConfiguration::nLayers(), OMTFConfiguration::nPdfAddrBits(), OMTFConfiguration::nRefLayers(), GoldenPattern::pdfValue(), Key::theCharge, theDoc, Key::thePtCode, and theTopElement.

Referenced by OMTFPatternMaker::endJob(), and OMTFPatternMaker::writeMergedGPs().

◆ writeGPData() [2/2]

void XMLConfigWriter::writeGPData ( const GoldenPattern aGP1,
const GoldenPattern aGP2,
const GoldenPattern aGP3,
const GoldenPattern aGP4 
)

Definition at line 423 of file XMLConfigWriter.cc.

426  {
427  std::ostringstream stringStr;
428  xercesc::DOMElement *aLayer = nullptr, *aRefLayer = nullptr, *aPdf = nullptr;
429 
430  xercesc::DOMElement* aGPElement = theDoc->createElement(_toDOMS("GP"));
431  stringStr.str("");
432 
433  stringStr << aGP1.key().thePtCode;
434  aGPElement->setAttribute(_toDOMS("iPt1"), _toDOMS(stringStr.str()));
435  stringStr.str("");
436 
437  stringStr << aGP2.key().thePtCode;
438  aGPElement->setAttribute(_toDOMS("iPt2"), _toDOMS(stringStr.str()));
439  stringStr.str("");
440 
441  stringStr << aGP3.key().thePtCode;
442  aGPElement->setAttribute(_toDOMS("iPt3"), _toDOMS(stringStr.str()));
443  stringStr.str("");
444 
445  stringStr << aGP4.key().thePtCode;
446  aGPElement->setAttribute(_toDOMS("iPt4"), _toDOMS(stringStr.str()));
447 
448  stringStr.str("");
449  //stringStr<<aGP1.key().theEtaCode;
450  stringStr << "0"; //No eta code at the moment
451  aGPElement->setAttribute(_toDOMS("iEta"), _toDOMS(stringStr.str()));
452  stringStr.str("");
453  stringStr << "0"; //No phi code is assigned to GP for the moment.
454  aGPElement->setAttribute(_toDOMS("iPhi"), _toDOMS(stringStr.str()));
455  stringStr.str("");
456  stringStr << aGP1.key().theCharge;
457 
458  aGPElement->setAttribute(_toDOMS("iCharge"), _toDOMS(stringStr.str()));
459 
460  for (unsigned int iLayer = 0; iLayer < myOMTFConfig->nLayers(); ++iLayer) {
461  int nOfPhis = 0;
463  aLayer = theDoc->createElement(_toDOMS("Layer"));
464  stringStr.str("");
465  stringStr << iLayer;
467  aLayer->setAttribute(_toDOMS("iLayer"), _toDOMS(stringStr.str()));
468  stringStr.str("");
469  stringStr << nOfPhis;
470  aLayer->setAttribute(_toDOMS("nOfPhis"), _toDOMS(stringStr.str()));
471  for (unsigned int iRefLayer = 0; iRefLayer < myOMTFConfig->nRefLayers(); ++iRefLayer) {
472  aRefLayer = theDoc->createElement(_toDOMS("RefLayer"));
473  int meanDistPhi = aGP1.meanDistPhiValue(iLayer, iRefLayer);
474 
475  stringStr.str("");
476  stringStr << meanDistPhi;
477  aRefLayer->setAttribute(_toDOMS("meanDistPhi"), _toDOMS(stringStr.str()));
478 
479  //int meanDistPhi2 = aGP2.meanDistPhiValue(iLayer,iRefLayer);
480  //stringStr.str("");
481  //stringStr<<meanDistPhi2;
482  //aRefLayer->setAttribute(_toDOMS("meanDistPhi2"), _toDOMS(stringStr.str()));
483 
484  int selDistPhi = 0;
485  stringStr.str("");
486  stringStr << selDistPhi;
487  aRefLayer->setAttribute(_toDOMS("selDistPhi"), _toDOMS(stringStr.str()));
488  int selDistPhiShift = 0;
489  stringStr.str("");
490  stringStr << selDistPhiShift;
491  aRefLayer->setAttribute(_toDOMS("selDistPhiShift"), _toDOMS(stringStr.str()));
492  int distMsbPhiShift = 0;
493  stringStr.str("");
494  stringStr << distMsbPhiShift;
495  aRefLayer->setAttribute(_toDOMS("distMsbPhiShift"), _toDOMS(stringStr.str()));
496  aLayer->appendChild(aRefLayer);
497  }
498  for (unsigned int iRefLayer = 0; iRefLayer < myOMTFConfig->nRefLayers(); ++iRefLayer) {
499  for (unsigned int iPdf = 0; iPdf < exp2(myOMTFConfig->nPdfAddrBits()); ++iPdf) {
500  aPdf = theDoc->createElement(_toDOMS("PDF"));
501  stringStr.str("");
502  stringStr << aGP1.pdfValue(iLayer, iRefLayer, iPdf);
503  aPdf->setAttribute(_toDOMS("value1"), _toDOMS(stringStr.str()));
504  stringStr.str("");
505  stringStr << aGP2.pdfValue(iLayer, iRefLayer, iPdf);
506  aPdf->setAttribute(_toDOMS("value2"), _toDOMS(stringStr.str()));
507  stringStr.str("");
508  stringStr << aGP3.pdfValue(iLayer, iRefLayer, iPdf);
509  aPdf->setAttribute(_toDOMS("value3"), _toDOMS(stringStr.str()));
510  stringStr.str("");
511  stringStr << aGP4.pdfValue(iLayer, iRefLayer, iPdf);
512  aPdf->setAttribute(_toDOMS("value4"), _toDOMS(stringStr.str()));
513  aLayer->appendChild(aPdf);
514  }
515  }
516  aGPElement->appendChild(aLayer);
517  }
518  theTopElement->appendChild(aGPElement);
519 }

References _toDOMS(), GoldenPattern::key(), GoldenPattern::meanDistPhiValue(), myOMTFConfig, OMTFConfiguration::nLayers(), OMTFConfiguration::nPdfAddrBits(), OMTFConfiguration::nRefLayers(), GoldenPattern::pdfValue(), Key::theCharge, theDoc, Key::thePtCode, and theTopElement.

◆ writeResultsData()

void XMLConfigWriter::writeResultsData ( xercesc::DOMElement *  aTopElement,
unsigned int  iRegion,
const Key aKey,
const OMTFResult aResult 
)

Write GP key parameters

Write results details for this GP

Definition at line 305 of file XMLConfigWriter.cc.

308  {
310 
311  std::ostringstream stringStr;
313  xercesc::DOMElement* aGP = theDoc->createElement(_toDOMS("GP"));
314  stringStr.str("");
315  stringStr << aKey.thePtCode;
316  aGP->setAttribute(_toDOMS("iPt"), _toDOMS(stringStr.str()));
317  stringStr.str("");
318  stringStr << aKey.theEtaCode;
319  aGP->setAttribute(_toDOMS("iEta"), _toDOMS(stringStr.str()));
320  stringStr.str("");
321  stringStr << "0";
322  aGP->setAttribute(_toDOMS("iPhi"), _toDOMS(stringStr.str()));
323  stringStr.str("");
324  stringStr << aKey.theCharge;
325  aGP->setAttribute(_toDOMS("iCharge"), _toDOMS(stringStr.str()));
328  for (unsigned int iRefLayer = 0; iRefLayer < myOMTFConfig->nRefLayers(); ++iRefLayer) {
329  xercesc::DOMElement* aRefLayer = theDoc->createElement(_toDOMS("Result"));
330  stringStr.str("");
331  stringStr << iRefLayer;
332  aRefLayer->setAttribute(_toDOMS("iRefLayer"), _toDOMS(stringStr.str()));
333  stringStr.str("");
334  stringStr << iRegion;
335  aRefLayer->setAttribute(_toDOMS("iRegion"), _toDOMS(stringStr.str()));
336  stringStr.str("");
337  stringStr << myOMTFConfig->getRefToLogicNumber()[iRefLayer];
338  aRefLayer->setAttribute(_toDOMS("iLogicLayer"), _toDOMS(stringStr.str()));
339  for (unsigned int iLogicLayer = 0; iLogicLayer < myOMTFConfig->nLayers(); ++iLogicLayer) {
340  xercesc::DOMElement* aLayer = theDoc->createElement(_toDOMS("Layer"));
341  stringStr.str("");
342  stringStr << iLogicLayer;
343  aLayer->setAttribute(_toDOMS("iLayer"), _toDOMS(stringStr.str()));
344  stringStr.str("");
345  stringStr << results[iLogicLayer][iRefLayer];
346  aLayer->setAttribute(_toDOMS("value"), _toDOMS(stringStr.str()));
347  if (results[iLogicLayer][iRefLayer])
348  aRefLayer->appendChild(aLayer);
349  }
350  if (aRefLayer->getChildNodes()->getLength())
351  aGP->appendChild(aRefLayer);
352  }
353  if (aGP->getChildNodes()->getLength())
354  aTopElement->appendChild(aGP);
355 }

References _toDOMS(), OMTFConfiguration::getRefToLogicNumber(), OMTFResult::getResults(), myOMTFConfig, OMTFConfiguration::nLayers(), OMTFConfiguration::nRefLayers(), bookConverter::results, Key::theCharge, theDoc, Key::theEtaCode, and Key::thePtCode.

Referenced by OMTFReconstruction::writeResultToXML().

Member Data Documentation

◆ domImpl

xercesc::DOMImplementation* XMLConfigWriter::domImpl
private

Definition at line 61 of file XMLConfigWriter.h.

Referenced by finaliseXMLDocument(), initialiseXMLDocument(), and XMLConfigWriter().

◆ myOMTFConfig

const OMTFConfiguration* XMLConfigWriter::myOMTFConfig
private

◆ theDoc

xercesc::DOMDocument* XMLConfigWriter::theDoc
private

◆ theTopElement

xercesc::DOMElement* XMLConfigWriter::theTopElement
private
OmtfName::name
std::string name() const
Definition: OmtfName.cc:51
l1t::RegionalMuonCand::processor
const int processor() const
Get processor ID on which the candidate was found (0..5 for OMTF/EMTF; 0..11 for BMTF)
Definition: RegionalMuonCand.h:179
l1t::RegionalMuonCand::link
const int link() const
Get link on which the MicroGMT receives the candidate.
Definition: RegionalMuonCand.h:177
l1t::RegionalMuonCand::hwPhi
const int hwPhi() const
Get compressed local phi (returned int * 2*pi/576 = local phi in rad)
Definition: RegionalMuonCand.h:167
OMTFResult::vector2D
std::vector< vector1D > vector2D
Definition: OMTFResult.h:12
l1t::omtf_pos
Definition: RegionalMuonCandFwd.h:8
XMLConfigWriter::findMaxInput
unsigned int findMaxInput(const OMTFConfiguration::vector1D &myCounts)
Definition: XMLConfigWriter.cc:659
OMTFConfiguration::getMeasurements4D
vector4D & getMeasurements4D()
Definition: OMTFConfiguration.h:122
XMLConfigWriter::theDoc
xercesc::DOMDocument * theDoc
Definition: XMLConfigWriter.h:63
Key::thePtCode
unsigned int thePtCode
Definition: GoldenPattern.h:35
OMTFConfiguration::nRefHits
unsigned int nRefHits() const
Definition: OMTFConfiguration.h:94
bookConverter.results
results
Definition: bookConverter.py:144
OMTFConfiguration::nPhiBins
unsigned int nPhiBins() const
Definition: OMTFConfiguration.h:93
OMTFConfiguration::getProcessorPhiVsRefLayer
const std::vector< std::vector< int > > & getProcessorPhiVsRefLayer() const
Definition: OMTFConfiguration.h:114
l1t::RegionalMuonCand::hwQual
const int hwQual() const
Get quality code.
Definition: RegionalMuonCand.h:175
OmtfName::processor
unsigned int processor() const
Definition: OmtfName.cc:84
l1t::RegionalMuonCand::hwEta
const int hwEta() const
Get compressed eta (returned int * 0.010875 = eta)
Definition: RegionalMuonCand.h:169
MainPageGenerator.fName
fName
Definition: MainPageGenerator.py:301
l1t::RegionalMuonCand::hwPt
const int hwPt() const
Get compressed pT (returned int * 0.5 = pT (GeV))
Definition: RegionalMuonCand.h:161
XMLConfigWriter::domImpl
xercesc::DOMImplementation * domImpl
Definition: XMLConfigWriter.h:61
Key::theCharge
int theCharge
Definition: GoldenPattern.h:36
_toDOMS
XMLCh * _toDOMS(std::string temp)
Definition: XMLConfigWriter.cc:82
OMTFConfiguration::patternsVersion
unsigned int patternsVersion() const
Definition: OMTFConfiguration.h:82
mps_fire.end
end
Definition: mps_fire.py:242
OMTFConfiguration::nPdfAddrBits
unsigned int nPdfAddrBits() const
Definition: OMTFConfiguration.h:91
l1t::RegionalMuonCand::trackFinderType
const tftype trackFinderType() const
Get track-finder which found the muon (bmtf, emtf_pos/emtf_neg or omtf_pos/omtf_neg)
Definition: RegionalMuonCand.h:181
OMTFConfiguration::globalPhiStart
int globalPhiStart(unsigned int iProcessor) const
Definition: OMTFConfiguration.cc:199
GoldenPattern::pdfValue
int pdfValue(unsigned int iLayer, unsigned int iRefLayer, unsigned int iBin) const
Definition: GoldenPattern.h:68
OMTFConfiguration::vector1D
std::vector< int > vector1D
Definition: OMTFConfiguration.h:50
OMTFResult::getResults
const OMTFResult::vector2D & getResults() const
Definition: OMTFResult.h:18
XMLConfigWriter::myOMTFConfig
const OMTFConfiguration * myOMTFConfig
Definition: XMLConfigWriter.h:65
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
OMTFConfiguration::nLayers
unsigned int nLayers() const
Definition: OMTFConfiguration.h:87
OMTFConfiguration::nPhiBits
unsigned int nPhiBits() const
Definition: OMTFConfiguration.h:90
GoldenPattern::key
Key key() const
Definition: GoldenPattern.h:56
OMTFConfiguration::getRefToLogicNumber
const std::vector< int > & getRefToLogicNumber() const
Definition: OMTFConfiguration.h:105
OMTFinput::vector1D
std::vector< int > vector1D
Definition: OMTFinput.h:13
Key::theEtaCode
int theEtaCode
Definition: GoldenPattern.h:34
l1t::RegionalMuonCand::trackAddress
const std::map< int, int > & trackAddress() const
Get the track address (identifies track primitives used for reconstruction)
Definition: RegionalMuonCand.h:191
l1t::RegionalMuonCand::hwSign
const int hwSign() const
Get charge sign bit (charge = (-1)^(sign))
Definition: RegionalMuonCand.h:171
GoldenPattern::meanDistPhiValue
int meanDistPhiValue(unsigned int iLayer, unsigned int iRefLayer) const
Definition: GoldenPattern.h:66
OMTFConfiguration::getMeasurements4Dref
vector4D & getMeasurements4Dref()
Definition: OMTFConfiguration.h:123
OMTFConfiguration::nRefLayers
unsigned int nRefLayers() const
Definition: OMTFConfiguration.h:89
OmtfName::position
int position() const
Definition: OmtfName.cc:82
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
l1t::RegionalMuonCand::hwSignValid
const int hwSignValid() const
Get charge sign valid bit (0 - not valid (high pT muon); 1 - valid)
Definition: RegionalMuonCand.h:173
XERCES_CPP_NAMESPACE_USE::eta2Bits
unsigned int eta2Bits(unsigned int eta)
Definition: XMLConfigWriter.cc:41
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
OMTFinput::getLayerData
const OMTFinput::vector1D & getLayerData(unsigned int iLayer, bool giveEta=false) const
Definition: OMTFinput.cc:17
XMLConfigWriter::theTopElement
xercesc::DOMElement * theTopElement
Definition: XMLConfigWriter.h:62
l1t::omtf_neg
Definition: RegionalMuonCandFwd.h:8
BeamSplash_cfg.version
version
Definition: BeamSplash_cfg.py:45