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 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 writeCandidateData (xercesc::DOMElement *aTopElement, unsigned int iRefHit, const AlgoMuon &aCand)
 
void writeConnectionsData (const std::vector< std::vector< OMTFConfiguration::vector2D > > &measurements4D)
 
xercesc::DOMElement * writeEventData (xercesc::DOMElement *aTopElement, unsigned int iProcessor, 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 24 of file XMLConfigWriter.h.

Constructor & Destructor Documentation

XMLConfigWriter::XMLConfigWriter ( const OMTFConfiguration aOMTFConfig)

Initialise XML document

Definition at line 53 of file XMLConfigWriter.cc.

References _toDOMS(), domImpl, and myOMTFConfig.

53  {
54 
55  XMLPlatformUtils::Initialize();
56 
58  domImpl = DOMImplementationRegistry::getDOMImplementation(_toDOMS("Range"));
59 
60  myOMTFConfig = aOMTFConfig;
61 
62 }
xercesc::DOMImplementation * domImpl
const OMTFConfiguration * myOMTFConfig
XMLCh * _toDOMS(std::string temp)

Member Function Documentation

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

Definition at line 83 of file XMLConfigWriter.cc.

References domImpl, and theTopElement.

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

83  {
84 
85  XMLFormatTarget* formTarget = new LocalFileFormatTarget(fName.c_str());
86 
87 #if _XERCES_VERSION <30100
88  xercesc::DOMWriter* domWriter = (dynamic_cast<DOMImplementation*>(domImpl))->createDOMWriter();
89  if(domWriter->canSetFeature(XMLUni::fgDOMWRTFormatPrettyPrint, true)){
90  domWriter->setFeature(XMLUni::fgDOMWRTFormatPrettyPrint, true);
91  }
92  domWriter->writeNode(formTarget,*theTopElement);
93 
94 #else
95  xercesc::DOMLSSerializer* theSerializer = (dynamic_cast<DOMImplementation*>(domImpl))->createLSSerializer();
96  if (theSerializer->getDomConfig()->canSetParameter(XMLUni::fgDOMWRTFormatPrettyPrint, true))
97  theSerializer->getDomConfig()->setParameter(XMLUni::fgDOMWRTFormatPrettyPrint, true);
98  DOMLSOutput* theOutput = (dynamic_cast<DOMImplementation*>(domImpl))->createLSOutput();
99  theOutput->setByteStream(formTarget);
100  theSerializer->write(theTopElement, theOutput);
101  theOutput->release();
102  theSerializer->release();
103 #endif
104 
105  delete formTarget;
106 }
xercesc::DOMImplementation * domImpl
xercesc::DOMElement * theTopElement
unsigned int XMLConfigWriter::findMaxInput ( const OMTFConfiguration::vector1D myCounts)

Definition at line 572 of file XMLConfigWriter.cc.

References bookConverter::max.

Referenced by writeConnectionsData().

572  {
573 
574  unsigned int max = 0;
575  unsigned int maxInput = 0;
576  for(unsigned int iInput=0;iInput<14;++iInput){
577  if(myCounts[iInput]>(int)max){
578  max = myCounts[iInput];
579  maxInput = iInput;
580  }
581  }
582  return maxInput;
583 }
void XMLConfigWriter::initialiseXMLDocument ( const std::string &  docName)

Definition at line 65 of file XMLConfigWriter.cc.

References _toDOMS(), domImpl, OMTFConfiguration::fwVersion(), myOMTFConfig, funct::pow(), theDoc, theTopElement, and relval_steps::version.

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

65  {
66 
67  theDoc = domImpl->createDocument(0,_toDOMS(docName.c_str()), 0);
68  theTopElement = theDoc->getDocumentElement();
69 
70  unsigned int version = myOMTFConfig->fwVersion();
71  unsigned int mask32bits = pow(2,32)-1;
72 
73  version &=mask32bits;
74 
75  std::ostringstream stringStr;
76  stringStr.str("");
77  stringStr<<"0x"<<std::hex<<std::setfill('0')<<std::setw(8)<<version;
78  theTopElement->setAttribute(_toDOMS("version"), _toDOMS(stringStr.str()));
79 
80 }
unsigned int fwVersion() const
xercesc::DOMImplementation * domImpl
const OMTFConfiguration * myOMTFConfig
XMLCh * _toDOMS(std::string temp)
xercesc::DOMDocument * theDoc
xercesc::DOMElement * theTopElement
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
void XMLConfigWriter::writeCandidateData ( xercesc::DOMElement *  aTopElement,
unsigned int  iRefHit,
const AlgoMuon aCand 
)

Definition at line 183 of file XMLConfigWriter.cc.

References _toDOMS(), AlgoMuon::getCharge(), AlgoMuon::getDisc(), AlgoMuon::getEta(), AlgoMuon::getHits(), AlgoMuon::getPhi(), AlgoMuon::getPhiRHit(), AlgoMuon::getPt(), AlgoMuon::getQ(), AlgoMuon::getRefLayer(), and theDoc.

Referenced by OMTFReconstruction::writeResultToXML().

185  {
186 
187  xercesc::DOMElement* aResult = theDoc->createElement(_toDOMS("AlgoMuon"));
188  std::ostringstream stringStr;
189  stringStr.str("");
190  stringStr<<iRefHit;
191  aResult->setAttribute(_toDOMS("iRefHit"),_toDOMS(stringStr.str()));
192  stringStr.str("");
193  stringStr<<aCand.getPt();
194  aResult->setAttribute(_toDOMS("ptCode"),_toDOMS(stringStr.str()));
195  stringStr.str("");
196  stringStr<<aCand.getPhi();
197  aResult->setAttribute(_toDOMS("phiCode"),_toDOMS(stringStr.str()));
198  stringStr.str("");
199  stringStr<<aCand.getEta();
200  aResult->setAttribute(_toDOMS("etaCode"),_toDOMS(stringStr.str()));
201  stringStr.str("");
202  stringStr<<aCand.getCharge();
203  aResult->setAttribute(_toDOMS("charge"),_toDOMS(stringStr.str()));
204  stringStr.str("");
205  stringStr<<aCand.getQ();
206  aResult->setAttribute(_toDOMS("nHits"), _toDOMS(stringStr.str()));
207  stringStr.str("");
208  stringStr<<aCand.getDisc();
209  aResult->setAttribute(_toDOMS("disc"), _toDOMS(stringStr.str()));
210  stringStr.str("");
211  stringStr<<aCand.getRefLayer();
212  aResult->setAttribute(_toDOMS("iRefLayer"), _toDOMS(stringStr.str()));
213  stringStr.str("");
214  stringStr<<std::bitset<18>(aCand.getHits());
215  aResult->setAttribute(_toDOMS("layers"),_toDOMS(stringStr.str()));
216  stringStr.str("");
217  stringStr<<aCand.getPhiRHit();
218  aResult->setAttribute(_toDOMS("phiRHit"),_toDOMS(stringStr.str()));
219 
220  aTopElement->appendChild(aResult);
221 }
int getCharge() const
Definition: AlgoMuon.h:25
int getEta() const
Definition: AlgoMuon.h:19
int getQ() const
Definition: AlgoMuon.h:22
int getDisc() const
Definition: AlgoMuon.h:17
int getRefLayer() const
Definition: AlgoMuon.h:20
int getHits() const
Definition: AlgoMuon.h:21
XMLCh * _toDOMS(std::string temp)
int getPt() const
Definition: AlgoMuon.h:24
xercesc::DOMDocument * theDoc
int getPhi() const
Definition: AlgoMuon.h:18
int getPhiRHit() const
Definition: AlgoMuon.h:26
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 441 of file XMLConfigWriter.cc.

References _toDOMS(), begin, 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().

441  {
442 
443  std::ostringstream stringStr;
444 
445  for(unsigned int iProcessor=0;iProcessor<6;++iProcessor){
446  xercesc::DOMElement* aProcessorElement = theDoc->createElement(_toDOMS("Processor"));
447  stringStr.str("");
448  stringStr<<iProcessor;
449  aProcessorElement->setAttribute(_toDOMS("iProcessor"), _toDOMS(stringStr.str()));
450  for(unsigned int iRefLayer=0;iRefLayer<myOMTFConfig->nRefLayers();++iRefLayer){
451  xercesc::DOMElement* aRefLayerElement = theDoc->createElement(_toDOMS("RefLayer"));
452  stringStr.str("");
453  stringStr<<iRefLayer;
454  aRefLayerElement->setAttribute(_toDOMS("iRefLayer"), _toDOMS(stringStr.str()));
455  stringStr.str("");
456  stringStr<<myOMTFConfig->getProcessorPhiVsRefLayer()[iProcessor][iRefLayer];
457  aRefLayerElement->setAttribute(_toDOMS("iGlobalPhiStart"), _toDOMS(stringStr.str()));
458  aProcessorElement->appendChild(aRefLayerElement);
459  }
460  unsigned int iRefHit = 0;
462  for(unsigned int iRefLayer=0;iRefLayer<myOMTFConfig->nRefLayers();++iRefLayer){
463  for(unsigned int iRegion=0;iRegion<6;++iRegion){
464  unsigned int maxHitCount = 0;
465  for(unsigned int iInput=0;iInput<14;++iInput) {
466  if((int)maxHitCount<myOMTFConfig->getMeasurements4Dref()[iProcessor][iRegion][iRefLayer][iInput])
467  maxHitCount = myOMTFConfig->getMeasurements4Dref()[iProcessor][iRegion][iRefLayer][iInput];
468  }
469  for(unsigned int iInput=0;iInput<14;++iInput){
470  unsigned int hitCount = myOMTFConfig->getMeasurements4Dref()[iProcessor][iRegion][iRefLayer][iInput];
471  if(hitCount<maxHitCount*0.1) continue;
472  xercesc::DOMElement* aRefHitElement = theDoc->createElement(_toDOMS("RefHit"));
473  stringStr.str("");
474  stringStr<<iRefHit;
475  aRefHitElement->setAttribute(_toDOMS("iRefHit"), _toDOMS(stringStr.str()));
476  stringStr.str("");
477  stringStr<<iRefLayer;
478  aRefHitElement->setAttribute(_toDOMS("iRefLayer"), _toDOMS(stringStr.str()));
479 
480  stringStr.str("");
481  stringStr<<iRegion;
482  aRefHitElement->setAttribute(_toDOMS("iRegion"), _toDOMS(stringStr.str()));
483 
484  stringStr.str("");
485  stringStr<<iInput;
486  aRefHitElement->setAttribute(_toDOMS("iInput"), _toDOMS(stringStr.str()));
487  unsigned int logicRegionSize = 10/360.0*myOMTFConfig->nPhiBins();
488  int lowScaleEnd = std::pow(2,myOMTFConfig->nPhiBits()-1);
490  int iPhiMin = myOMTFConfig->getProcessorPhiVsRefLayer()[iProcessor][iRefLayer]-myOMTFConfig->globalPhiStart(iProcessor)-lowScaleEnd;
491  int iPhiMax = iPhiMin+logicRegionSize-1;
492 
493  iPhiMin+=iRegion*logicRegionSize;
494  iPhiMax+=iRegion*logicRegionSize;
495 
496  stringStr.str("");
497  stringStr<<iPhiMin;
498  aRefHitElement->setAttribute(_toDOMS("iPhiMin"), _toDOMS(stringStr.str()));
499 
500  stringStr.str("");
501  stringStr<<iPhiMax;
502  aRefHitElement->setAttribute(_toDOMS("iPhiMax"), _toDOMS(stringStr.str()));
503  if(iRefHit<myOMTFConfig->nRefHits()) aProcessorElement->appendChild(aRefHitElement);
504  ++iRefHit;
505  }
506  for(;iRegion==5 && iRefLayer==7 && iRefHit<myOMTFConfig->nRefHits();++iRefHit){
507  xercesc::DOMElement* aRefHitElement = theDoc->createElement(_toDOMS("RefHit"));
508  stringStr.str("");
509  stringStr<<iRefHit;
510  aRefHitElement->setAttribute(_toDOMS("iRefHit"), _toDOMS(stringStr.str()));
511  stringStr.str("");
512  stringStr<<0;
513  aRefHitElement->setAttribute(_toDOMS("iRefLayer"), _toDOMS(stringStr.str()));
514 
515  stringStr.str("");
516  stringStr<<0;
517  aRefHitElement->setAttribute(_toDOMS("iRegion"), _toDOMS(stringStr.str()));
518 
519  stringStr.str("");
520  stringStr<<0;
521  aRefHitElement->setAttribute(_toDOMS("iInput"), _toDOMS(stringStr.str()));
522 
523  int iPhiMin = 0;
524  int iPhiMax = 1;
525 
526  stringStr.str("");
527  stringStr<<iPhiMin;
528  aRefHitElement->setAttribute(_toDOMS("iPhiMin"), _toDOMS(stringStr.str()));
529 
530  stringStr.str("");
531  stringStr<<iPhiMax;
532  aRefHitElement->setAttribute(_toDOMS("iPhiMax"), _toDOMS(stringStr.str()));
533 
534  aProcessorElement->appendChild(aRefHitElement);
535  }
536  }
537  }
539  for(unsigned int iRegion=0;iRegion<6;++iRegion){
540  xercesc::DOMElement* aRegionElement = theDoc->createElement(_toDOMS("LogicRegion"));
541  stringStr.str("");
542  stringStr<<iRegion;
543  aRegionElement->setAttribute(_toDOMS("iRegion"), _toDOMS(stringStr.str()));
544 
545  for(unsigned int iLogicLayer=0;iLogicLayer<myOMTFConfig->nLayers();++iLogicLayer){
546  xercesc::DOMElement* aLayerElement = theDoc->createElement(_toDOMS("Layer"));
547  stringStr.str("");
548  stringStr<<iLogicLayer;
550  aLayerElement->setAttribute(_toDOMS("iLayer"), _toDOMS(stringStr.str()));
551  const OMTFConfiguration::vector1D & myCounts = myOMTFConfig->getMeasurements4D()[iProcessor][iRegion][iLogicLayer];
552  unsigned int maxInput = findMaxInput(myCounts);
553  unsigned int begin = 0, end = 0;
554  if((int)maxInput-2>=0) begin = maxInput-2;
555  else begin = maxInput;
556  end = maxInput+3;
557  stringStr.str("");
558  stringStr<<begin;
559  aLayerElement->setAttribute(_toDOMS("iFirstInput"), _toDOMS(stringStr.str()));
560  stringStr.str("");
561  stringStr<<end-begin+1;
562  aLayerElement->setAttribute(_toDOMS("nInputs"), _toDOMS(stringStr.str()));
563  aRegionElement->appendChild(aLayerElement);
564  }
565  aProcessorElement->appendChild(aRegionElement);
566  }
567  theTopElement->appendChild(aProcessorElement);
568  }
569 }
unsigned int nRefLayers() const
unsigned int nRefHits() const
unsigned int nLayers() const
unsigned int nPhiBins() const
unsigned int nPhiBits() const
const std::vector< std::vector< int > > & getProcessorPhiVsRefLayer() const
unsigned int findMaxInput(const OMTFConfiguration::vector1D &myCounts)
std::vector< int > vector1D
#define end
Definition: vmac.h:37
const OMTFConfiguration * myOMTFConfig
int globalPhiStart(unsigned int iProcessor) const
#define begin
Definition: vmac.h:30
XMLCh * _toDOMS(std::string temp)
xercesc::DOMDocument * theDoc
xercesc::DOMElement * theTopElement
vector4D & getMeasurements4Dref()
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
vector4D & getMeasurements4D()
xercesc::DOMElement * XMLConfigWriter::writeEventData ( xercesc::DOMElement *  aTopElement,
unsigned int  iProcessor,
const OMTFinput aInput 
)

Definition at line 140 of file XMLConfigWriter.cc.

References _toDOMS(), OMTFinput::getLayerData(), myOMTFConfig, OMTFConfiguration::nLayers(), OMTFConfiguration::nPhiBins(), and theDoc.

Referenced by OMTFReconstruction::writeResultToXML().

142  {
143 
144  std::ostringstream stringStr;
145 
146  xercesc::DOMElement *aProcessor = theDoc->createElement(_toDOMS("Processor"));
147  stringStr.str("");
148  stringStr<<iProcessor;
149  aProcessor->setAttribute(_toDOMS("iProcessor"), _toDOMS(stringStr.str()));
150 
151  xercesc::DOMElement *aLayer, *aHit;
152  for(unsigned int iLayer=0;iLayer<myOMTFConfig->nLayers();++iLayer){
153  const OMTFinput::vector1D & layerDataPhi = aInput.getLayerData(iLayer);
154  const OMTFinput::vector1D & layerDataEta = aInput.getLayerData(iLayer,true);
155 
156  aLayer = theDoc->createElement(_toDOMS("Layer"));
157  stringStr.str("");
158  stringStr<<iLayer;
159  aLayer->setAttribute(_toDOMS("iLayer"), _toDOMS(stringStr.str()));
160  for(unsigned int iHit=0;iHit<layerDataPhi.size();++iHit){
161  aHit = theDoc->createElement(_toDOMS("Hit"));
162  stringStr.str("");
163  stringStr<<iHit;
164  aHit->setAttribute(_toDOMS("iInput"), _toDOMS(stringStr.str()));
165  stringStr.str("");
166  stringStr<<layerDataPhi[iHit];
167  aHit->setAttribute(_toDOMS("iPhi"), _toDOMS(stringStr.str()));
168  stringStr.str("");
169  stringStr<<layerDataEta[iHit];
170  aHit->setAttribute(_toDOMS("iEta"), _toDOMS(stringStr.str()));
171  if(layerDataPhi[iHit]>=(int)myOMTFConfig->nPhiBins()) continue;
172  aLayer->appendChild(aHit);
173  }
174  if(aLayer->getChildNodes()->getLength()) aProcessor->appendChild(aLayer);
175  }
176 
177  aTopElement->appendChild(aProcessor);
178  return aProcessor;
179 
180 }
unsigned int nLayers() const
unsigned int nPhiBins() const
std::vector< int > vector1D
Definition: OMTFinput.h:15
const OMTFinput::vector1D & getLayerData(unsigned int iLayer, bool giveEta=false) const
Definition: OMTFinput.cc:19
const OMTFConfiguration * myOMTFConfig
XMLCh * _toDOMS(std::string temp)
xercesc::DOMDocument * theDoc
xercesc::DOMElement * XMLConfigWriter::writeEventHeader ( unsigned int  eventId,
unsigned int  mixedEventId = 0 
)

Definition at line 109 of file XMLConfigWriter.cc.

References _toDOMS(), theDoc, and theTopElement.

Referenced by OMTFReconstruction::reconstruct().

110  {
111 
112  unsigned int eventBx = eventId*2;
113 
114  xercesc::DOMElement *aEvent = 0;
115  xercesc::DOMElement *aBx = 0;
116  std::ostringstream stringStr;
117 
118  aEvent = theDoc->createElement(_toDOMS("Event"));
119 
120  stringStr.str("");
121  stringStr<<eventId;
122  aEvent->setAttribute(_toDOMS("iEvent"), _toDOMS(stringStr.str()));
123 
124  stringStr.str("");
125  stringStr<<mixedEventId;
126  aEvent->setAttribute(_toDOMS("iMixedEvent"), _toDOMS(stringStr.str()));
127 
128  aBx = theDoc->createElement(_toDOMS("bx"));
129  stringStr.str("");
130  stringStr<<eventBx;
131  aBx->setAttribute(_toDOMS("iBx"), _toDOMS(stringStr.str()));
132  aEvent->appendChild(aBx);
133 
134  theTopElement->appendChild(aEvent);
135 
136  return aBx;
137 }
XMLCh * _toDOMS(std::string temp)
xercesc::DOMDocument * theDoc
xercesc::DOMElement * theTopElement
void XMLConfigWriter::writeGPData ( const GoldenPattern aGP)

Definition at line 275 of file XMLConfigWriter.cc.

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().

275  {
276 
277  std::ostringstream stringStr;
278  xercesc::DOMElement *aLayer=0, *aRefLayer=0, *aPdf=0;
279 
280  xercesc::DOMElement* aGPElement = theDoc->createElement(_toDOMS("GP"));
281  stringStr.str("");
282  stringStr<<aGP.key().thePtCode;
283  aGPElement->setAttribute(_toDOMS("iPt"), _toDOMS(stringStr.str()));
284  stringStr.str("");
285  //stringStr<<aGP.key().theEtaCode;
286  stringStr<<"0";//No eta code at the moment
287  aGPElement->setAttribute(_toDOMS("iEta"), _toDOMS(stringStr.str()));
288  stringStr.str("");
289  stringStr<<0; //No phi code is assigned to GP for the moment.
290  aGPElement->setAttribute(_toDOMS("iPhi"), _toDOMS(stringStr.str()));
291  stringStr.str("");
292  stringStr<<aGP.key().theCharge;
293  aGPElement->setAttribute(_toDOMS("iCharge"), _toDOMS(stringStr.str()));
294 
295  for(unsigned int iLayer = 0;iLayer<myOMTFConfig->nLayers();++iLayer){
296  int nOfPhis = 0;
298  aLayer = theDoc->createElement(_toDOMS("Layer"));
299  stringStr.str("");
300  stringStr<<iLayer;
302  aLayer->setAttribute(_toDOMS("iLayer"), _toDOMS(stringStr.str()));
303  stringStr.str("");
304  stringStr<<nOfPhis;
305  aLayer->setAttribute(_toDOMS("nOfPhis"), _toDOMS(stringStr.str()));
306  for(unsigned int iRefLayer=0;iRefLayer<myOMTFConfig->nRefLayers();++iRefLayer){
307  aRefLayer = theDoc->createElement(_toDOMS("RefLayer"));
308  int meanDistPhi = aGP.meanDistPhiValue(iLayer,iRefLayer);
309  stringStr.str("");
310  stringStr<<meanDistPhi;
311  aRefLayer->setAttribute(_toDOMS("meanDistPhi"), _toDOMS(stringStr.str()));
312  int selDistPhi = 0;
313  stringStr.str("");
314  stringStr<<selDistPhi;
315  aRefLayer->setAttribute(_toDOMS("selDistPhi"), _toDOMS(stringStr.str()));
316  int selDistPhiShift = 0;
317  stringStr.str("");
318  stringStr<<selDistPhiShift;
319  aRefLayer->setAttribute(_toDOMS("selDistPhiShift"), _toDOMS(stringStr.str()));
320  int distMsbPhiShift = 0;
321  stringStr.str("");
322  stringStr<<distMsbPhiShift;
323  aRefLayer->setAttribute(_toDOMS("distMsbPhiShift"), _toDOMS(stringStr.str()));
324  aLayer->appendChild(aRefLayer);
325  }
326  for(unsigned int iRefLayer=0;iRefLayer<myOMTFConfig->nRefLayers();++iRefLayer){
327  for(unsigned int iPdf=0;iPdf<exp2(myOMTFConfig->nPdfAddrBits());++iPdf){
328  aPdf = theDoc->createElement(_toDOMS("PDF"));
329  stringStr.str("");
330  stringStr<<aGP.pdfValue(iLayer,iRefLayer,iPdf);
331  aPdf->setAttribute(_toDOMS("value"), _toDOMS(stringStr.str()));
332  aLayer->appendChild(aPdf);
333  }
334  }
335  aGPElement->appendChild(aLayer);
336  }
337  theTopElement->appendChild(aGPElement);
338 }
Key key() const
Definition: GoldenPattern.h:60
unsigned int nRefLayers() const
int theCharge
Definition: GoldenPattern.h:38
unsigned int nLayers() const
unsigned int thePtCode
Definition: GoldenPattern.h:37
unsigned int nPdfAddrBits() const
const OMTFConfiguration * myOMTFConfig
int pdfValue(unsigned int iLayer, unsigned int iRefLayer, unsigned int iBin) const
Definition: GoldenPattern.h:72
XMLCh * _toDOMS(std::string temp)
xercesc::DOMDocument * theDoc
int meanDistPhiValue(unsigned int iLayer, unsigned int iRefLayer) const
Definition: GoldenPattern.h:70
xercesc::DOMElement * theTopElement
void XMLConfigWriter::writeGPData ( const GoldenPattern aGP1,
const GoldenPattern aGP2,
const GoldenPattern aGP3,
const GoldenPattern aGP4 
)

Definition at line 341 of file XMLConfigWriter.cc.

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

344  {
345 
346  std::ostringstream stringStr;
347  xercesc::DOMElement *aLayer=0, *aRefLayer=0, *aPdf=0;
348 
349  xercesc::DOMElement* aGPElement = theDoc->createElement(_toDOMS("GP"));
350  stringStr.str("");
351 
352  stringStr<<aGP1.key().thePtCode;
353  aGPElement->setAttribute(_toDOMS("iPt1"), _toDOMS(stringStr.str()));
354  stringStr.str("");
355 
356  stringStr<<aGP2.key().thePtCode;
357  aGPElement->setAttribute(_toDOMS("iPt2"), _toDOMS(stringStr.str()));
358  stringStr.str("");
359 
360  stringStr<<aGP3.key().thePtCode;
361  aGPElement->setAttribute(_toDOMS("iPt3"), _toDOMS(stringStr.str()));
362  stringStr.str("");
363 
364  stringStr<<aGP4.key().thePtCode;
365  aGPElement->setAttribute(_toDOMS("iPt4"), _toDOMS(stringStr.str()));
366 
367  stringStr.str("");
368  //stringStr<<aGP1.key().theEtaCode;
369  stringStr<<"0";//No eta code at the moment
370  aGPElement->setAttribute(_toDOMS("iEta"), _toDOMS(stringStr.str()));
371  stringStr.str("");
372  stringStr<<"0";//No phi code is assigned to GP for the moment.
373  aGPElement->setAttribute(_toDOMS("iPhi"), _toDOMS(stringStr.str()));
374  stringStr.str("");
375  stringStr<<aGP1.key().theCharge;
376 
377  aGPElement->setAttribute(_toDOMS("iCharge"), _toDOMS(stringStr.str()));
378 
379  for(unsigned int iLayer = 0;iLayer<myOMTFConfig->nLayers();++iLayer){
380  int nOfPhis = 0;
382  aLayer = theDoc->createElement(_toDOMS("Layer"));
383  stringStr.str("");
384  stringStr<<iLayer;
386  aLayer->setAttribute(_toDOMS("iLayer"), _toDOMS(stringStr.str()));
387  stringStr.str("");
388  stringStr<<nOfPhis;
389  aLayer->setAttribute(_toDOMS("nOfPhis"), _toDOMS(stringStr.str()));
390  for(unsigned int iRefLayer=0;iRefLayer<myOMTFConfig->nRefLayers();++iRefLayer){
391  aRefLayer = theDoc->createElement(_toDOMS("RefLayer"));
392  int meanDistPhi = aGP1.meanDistPhiValue(iLayer,iRefLayer);
393 
394  stringStr.str("");
395  stringStr<<meanDistPhi;
396  aRefLayer->setAttribute(_toDOMS("meanDistPhi"), _toDOMS(stringStr.str()));
397 
398  //int meanDistPhi2 = aGP2.meanDistPhiValue(iLayer,iRefLayer);
399  //stringStr.str("");
400  //stringStr<<meanDistPhi2;
401  //aRefLayer->setAttribute(_toDOMS("meanDistPhi2"), _toDOMS(stringStr.str()));
402 
403  int selDistPhi = 0;
404  stringStr.str("");
405  stringStr<<selDistPhi;
406  aRefLayer->setAttribute(_toDOMS("selDistPhi"), _toDOMS(stringStr.str()));
407  int selDistPhiShift = 0;
408  stringStr.str("");
409  stringStr<<selDistPhiShift;
410  aRefLayer->setAttribute(_toDOMS("selDistPhiShift"), _toDOMS(stringStr.str()));
411  int distMsbPhiShift = 0;
412  stringStr.str("");
413  stringStr<<distMsbPhiShift;
414  aRefLayer->setAttribute(_toDOMS("distMsbPhiShift"), _toDOMS(stringStr.str()));
415  aLayer->appendChild(aRefLayer);
416  }
417  for(unsigned int iRefLayer=0;iRefLayer<myOMTFConfig->nRefLayers();++iRefLayer){
418  for(unsigned int iPdf=0;iPdf<exp2(myOMTFConfig->nPdfAddrBits());++iPdf){
419  aPdf = theDoc->createElement(_toDOMS("PDF"));
420  stringStr.str("");
421  stringStr<<aGP1.pdfValue(iLayer,iRefLayer,iPdf);
422  aPdf->setAttribute(_toDOMS("value1"), _toDOMS(stringStr.str()));
423  stringStr.str("");
424  stringStr<<aGP2.pdfValue(iLayer,iRefLayer,iPdf);
425  aPdf->setAttribute(_toDOMS("value2"), _toDOMS(stringStr.str()));
426  stringStr.str("");
427  stringStr<<aGP3.pdfValue(iLayer,iRefLayer,iPdf);
428  aPdf->setAttribute(_toDOMS("value3"), _toDOMS(stringStr.str()));
429  stringStr.str("");
430  stringStr<<aGP4.pdfValue(iLayer,iRefLayer,iPdf);
431  aPdf->setAttribute(_toDOMS("value4"), _toDOMS(stringStr.str()));
432  aLayer->appendChild(aPdf);
433  }
434  }
435  aGPElement->appendChild(aLayer);
436  }
437  theTopElement->appendChild(aGPElement);
438 }
Key key() const
Definition: GoldenPattern.h:60
unsigned int nRefLayers() const
int theCharge
Definition: GoldenPattern.h:38
unsigned int nLayers() const
unsigned int thePtCode
Definition: GoldenPattern.h:37
unsigned int nPdfAddrBits() const
const OMTFConfiguration * myOMTFConfig
int pdfValue(unsigned int iLayer, unsigned int iRefLayer, unsigned int iBin) const
Definition: GoldenPattern.h:72
XMLCh * _toDOMS(std::string temp)
xercesc::DOMDocument * theDoc
int meanDistPhiValue(unsigned int iLayer, unsigned int iRefLayer) const
Definition: GoldenPattern.h:70
xercesc::DOMElement * theTopElement
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 224 of file XMLConfigWriter.cc.

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

Referenced by OMTFReconstruction::writeResultToXML().

227  {
228 
230 
231  std::ostringstream stringStr;
233  xercesc::DOMElement* aGP = theDoc->createElement(_toDOMS("GP"));
234  stringStr.str("");
235  stringStr<<aKey.thePtCode;
236  aGP->setAttribute(_toDOMS("iPt"), _toDOMS(stringStr.str()));
237  stringStr.str("");
238  stringStr<<aKey.theEtaCode;
239  aGP->setAttribute(_toDOMS("iEta"), _toDOMS(stringStr.str()));
240  stringStr.str("");
241  stringStr<<"0";
242  aGP->setAttribute(_toDOMS("iPhi"), _toDOMS(stringStr.str()));
243  stringStr.str("");
244  stringStr<<aKey.theCharge;
245  aGP->setAttribute(_toDOMS("iCharge"), _toDOMS(stringStr.str()));
248  for(unsigned int iRefLayer=0;iRefLayer<myOMTFConfig->nRefLayers();++iRefLayer){
249  xercesc::DOMElement* aRefLayer = theDoc->createElement(_toDOMS("Result"));
250  stringStr.str("");
251  stringStr<<iRefLayer;
252  aRefLayer->setAttribute(_toDOMS("iRefLayer"), _toDOMS(stringStr.str()));
253  stringStr.str("");
254  stringStr<<iRegion;
255  aRefLayer->setAttribute(_toDOMS("iRegion"), _toDOMS(stringStr.str()));
256  stringStr.str("");
257  stringStr<<myOMTFConfig->getRefToLogicNumber()[iRefLayer];
258  aRefLayer->setAttribute(_toDOMS("iLogicLayer"), _toDOMS(stringStr.str()));
259  for(unsigned int iLogicLayer=0;iLogicLayer<myOMTFConfig->nLayers();++iLogicLayer){
260  xercesc::DOMElement* aLayer = theDoc->createElement(_toDOMS("Layer"));
261  stringStr.str("");
262  stringStr<<iLogicLayer;
263  aLayer->setAttribute(_toDOMS("iLayer"), _toDOMS(stringStr.str()));
264  stringStr.str("");
265  stringStr<<results[iLogicLayer][iRefLayer];
266  aLayer->setAttribute(_toDOMS("value"), _toDOMS(stringStr.str()));
267  if(results[iLogicLayer][iRefLayer]) aRefLayer->appendChild(aLayer);
268  }
269  if(aRefLayer->getChildNodes()->getLength()) aGP->appendChild(aRefLayer);
270  }
271  if(aGP->getChildNodes()->getLength()) aTopElement->appendChild(aGP);
272 }
unsigned int nRefLayers() const
int theCharge
Definition: GoldenPattern.h:38
unsigned int nLayers() const
const OMTFResult::vector2D & getResults() const
Definition: OMTFResult.h:20
unsigned int thePtCode
Definition: GoldenPattern.h:37
tuple results
Definition: mps_update.py:44
const OMTFConfiguration * myOMTFConfig
std::vector< vector1D > vector2D
Definition: OMTFResult.h:14
const std::vector< int > & getRefToLogicNumber() const
XMLCh * _toDOMS(std::string temp)
xercesc::DOMDocument * theDoc
int theEtaCode
Definition: GoldenPattern.h:36

Member Data Documentation

xercesc::DOMImplementation* XMLConfigWriter::domImpl
private

Definition at line 63 of file XMLConfigWriter.h.

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

const OMTFConfiguration* XMLConfigWriter::myOMTFConfig
private
xercesc::DOMDocument* XMLConfigWriter::theDoc
private
xercesc::DOMElement* XMLConfigWriter::theTopElement
private