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

Private Attributes

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

Detailed Description

Definition at line 24 of file XMLConfigWriter.h.

Constructor & Destructor Documentation

XMLConfigWriter::XMLConfigWriter ( )

Initialise XML document

Definition at line 53 of file XMLConfigWriter.cc.

References _toDOMS(), and domImpl.

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

Member Function Documentation

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

Definition at line 82 of file XMLConfigWriter.cc.

References domImpl, and theTopElement.

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

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

Definition at line 573 of file XMLConfigWriter.cc.

References bookConverter::max.

Referenced by writeConnectionsData().

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

Definition at line 64 of file XMLConfigWriter.cc.

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

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

64  {
65 
66  theDoc = domImpl->createDocument(0,_toDOMS(docName.c_str()), 0);
67  theTopElement = theDoc->getDocumentElement();
68 
70  unsigned int mask32bits = pow(2,32)-1;
71 
72  version &=mask32bits;
73 
74  std::ostringstream stringStr;
75  stringStr.str("");
76  stringStr<<"0x"<<std::hex<<std::setfill('0')<<std::setw(8)<<version;
77  theTopElement->setAttribute(_toDOMS("version"), _toDOMS(stringStr.str()));
78 
79 }
unsigned int fwVersion
xercesc::DOMImplementation * domImpl
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
static const OMTFConfiguration * instance()
void XMLConfigWriter::writeCandidateData ( xercesc::DOMElement *  aTopElement,
unsigned int  iRefHit,
const AlgoMuon aCand 
)

Definition at line 182 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().

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

References _toDOMS(), begin, end, findMaxInput(), OMTFConfiguration::globalPhiStart(), OMTFConfiguration::instance(), OMTFConfiguration::measurements4D, OMTFConfiguration::measurements4Dref, OMTFConfiguration::nLayers, OMTFConfiguration::nPhiBins, OMTFConfiguration::nRefHits, OMTFConfiguration::nRefLayers, funct::pow(), OMTFConfiguration::processorPhiVsRefLayer, theDoc, and theTopElement.

Referenced by OMTFPatternMaker::endJob().

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

Definition at line 139 of file XMLConfigWriter.cc.

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

Referenced by OMTFReconstruction::writeResultToXML().

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

Definition at line 108 of file XMLConfigWriter.cc.

References _toDOMS(), theDoc, and theTopElement.

Referenced by OMTFReconstruction::reconstruct().

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

Definition at line 274 of file XMLConfigWriter.cc.

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

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

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

Definition at line 340 of file XMLConfigWriter.cc.

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

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

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

Referenced by OMTFReconstruction::writeResultToXML().

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

Member Data Documentation

xercesc::DOMImplementation* XMLConfigWriter::domImpl
private

Definition at line 63 of file XMLConfigWriter.h.

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

xercesc::DOMDocument* XMLConfigWriter::theDoc
private
xercesc::DOMElement* XMLConfigWriter::theTopElement
private