CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
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 InternalObj &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)
 
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 Member Functions

bool removeLayers (unsigned int iLayer)
 Utility function to set which layers should be ignored. More...
 

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 52 of file XMLConfigWriter.cc.

References _toDOMS(), and domImpl.

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

Member Function Documentation

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

Definition at line 84 of file XMLConfigWriter.cc.

References domImpl, and theTopElement.

Referenced by L1TMuonOverlapTrackProducer::endJob().

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

Definition at line 667 of file XMLConfigWriter.cc.

References bookConverter::max.

Referenced by writeConnectionsData().

667  {
668 
669  unsigned int max = 0;
670  unsigned int maxInput = 0;
671  for(unsigned int iInput=0;iInput<14;++iInput){
672  if(myCounts[iInput]>(int)max){
673  max = myCounts[iInput];
674  maxInput = iInput;
675  }
676  }
677  return maxInput;
678 }
void XMLConfigWriter::initialiseXMLDocument ( const std::string &  docName)

Definition at line 63 of file XMLConfigWriter.cc.

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

Referenced by L1TMuonOverlapTrackProducer::endJob(), and L1TMuonOverlapTrackProducer::L1TMuonOverlapTrackProducer().

63  {
64 
65  theDoc = domImpl->createDocument(0,_toDOMS(docName.c_str()), 0);
66  theTopElement = theDoc->getDocumentElement();
67 
68  unsigned int version = 1;
69  unsigned int subVersion = 0;
70  unsigned int mask32bits = pow(2,32)-1;
71 
72  version = version<<16;
73  version+=subVersion;
74  version &=mask32bits;
75 
76  std::ostringstream stringStr;
77  stringStr.str("");
78  stringStr<<"0x"<<std::hex<<std::setfill('0')<<std::setw(8)<<version;
79  theTopElement->setAttribute(_toDOMS("version"), _toDOMS(stringStr.str()));
80 
81 }
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
bool XMLConfigWriter::removeLayers ( unsigned int  iLayer)
private

Utility function to set which layers should be ignored.

Definition at line 681 of file XMLConfigWriter.cc.

Referenced by writeConnectionsData(), and writeGPData().

681  {
682 
683  return false;
684 
685  return (iLayer==6 || iLayer==7 || iLayer==9 || iLayer==11 || iLayer==13 || iLayer==15 || iLayer==24);
686 
687 }
void XMLConfigWriter::writeCandidateData ( xercesc::DOMElement *  aTopElement,
unsigned int  iRefHit,
const InternalObj aCand 
)

Definition at line 184 of file XMLConfigWriter.cc.

References _toDOMS(), InternalObj::charge, InternalObj::disc, InternalObj::eta, InternalObj::phi, InternalObj::pt, InternalObj::q, InternalObj::refLayer, and theDoc.

Referenced by L1TMuonOverlapTrackProducer::produce().

186  {
187 
188  xercesc::DOMElement* aResult = theDoc->createElement(_toDOMS("Candidate"));
189  std::ostringstream stringStr;
190  stringStr.str("");
191  stringStr<<iRefHit;
192  aResult->setAttribute(_toDOMS("iRefHit"),_toDOMS(stringStr.str()));
193  stringStr.str("");
194  stringStr<<aCand.pt;
195  aResult->setAttribute(_toDOMS("ptCode"),_toDOMS(stringStr.str()));
196  stringStr.str("");
197  stringStr<<aCand.phi;
198  aResult->setAttribute(_toDOMS("phiCode"),_toDOMS(stringStr.str()));
199  stringStr.str("");
200  stringStr<<aCand.eta;
201  aResult->setAttribute(_toDOMS("etaCode"),_toDOMS(stringStr.str()));
202  stringStr.str("");
203  stringStr<<aCand.charge;
204  aResult->setAttribute(_toDOMS("charge"),_toDOMS(stringStr.str()));
205  stringStr.str("");
206  stringStr<<aCand.q;
207  aResult->setAttribute(_toDOMS("nHits"), _toDOMS(stringStr.str()));
208  stringStr.str("");
209  stringStr<<aCand.disc;
210  aResult->setAttribute(_toDOMS("disc"), _toDOMS(stringStr.str()));
211  stringStr.str("");
212  stringStr<<aCand.refLayer;
213  aResult->setAttribute(_toDOMS("iRefLayer"), _toDOMS(stringStr.str()));
214  aTopElement->appendChild(aResult);
215 }
float phi
Definition: InternalObj.h:8
float pt
Definition: InternalObj.h:8
float eta
Definition: InternalObj.h:8
XMLCh * _toDOMS(std::string temp)
xercesc::DOMDocument * theDoc
float disc
Definition: InternalObj.h:9
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 529 of file XMLConfigWriter.cc.

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

529  {
530 
531  std::ostringstream stringStr;
532 
533  for(unsigned int iProcessor=0;iProcessor<6;++iProcessor){
534  xercesc::DOMElement* aProcessorElement = theDoc->createElement(_toDOMS("Processor"));
535  stringStr.str("");
536  stringStr<<iProcessor;
537  aProcessorElement->setAttribute(_toDOMS("iProcessor"), _toDOMS(stringStr.str()));
538  for(unsigned int iRefLayer=0;iRefLayer<OMTFConfiguration::nRefLayers;++iRefLayer){
539  xercesc::DOMElement* aRefLayerElement = theDoc->createElement(_toDOMS("RefLayer"));
540  stringStr.str("");
541  stringStr<<iRefLayer;
542  aRefLayerElement->setAttribute(_toDOMS("iRefLayer"), _toDOMS(stringStr.str()));
543  stringStr.str("");
544  stringStr<<OMTFConfiguration::processorPhiVsRefLayer[iProcessor][iRefLayer];
545  aRefLayerElement->setAttribute(_toDOMS("iGlobalPhiStart"), _toDOMS(stringStr.str()));
546  aProcessorElement->appendChild(aRefLayerElement);
547  }
548  unsigned int iRefHit = 0;
549 
552  for(unsigned int iRefLayer=0;iRefLayer<OMTFConfiguration::nRefLayers;++iRefLayer){
553  for(unsigned int iRegion=0;iRegion<6;++iRegion){
554  unsigned int maxHitCount = 0;
555  for(unsigned int iInput=0;iInput<14;++iInput) {
556  if((int)maxHitCount<OMTFConfiguration::measurements4Dref[iProcessor][iRegion][iRefLayer][iInput])
557  maxHitCount = OMTFConfiguration::measurements4Dref[iProcessor][iRegion][iRefLayer][iInput];
558  }
559  for(unsigned int iInput=0;iInput<14;++iInput){
560  unsigned int hitCount = OMTFConfiguration::measurements4Dref[iProcessor][iRegion][iRefLayer][iInput];
561  if(hitCount<maxHitCount*0.1) continue;
562  xercesc::DOMElement* aRefHitElement = theDoc->createElement(_toDOMS("RefHit"));
563  stringStr.str("");
564  stringStr<<iRefHit;
565  aRefHitElement->setAttribute(_toDOMS("iRefHit"), _toDOMS(stringStr.str()));
566  stringStr.str("");
567  stringStr<<iRefLayer;
568  aRefHitElement->setAttribute(_toDOMS("iRefLayer"), _toDOMS(stringStr.str()));
569 
570  stringStr.str("");
571  stringStr<<iRegion;
572  aRefHitElement->setAttribute(_toDOMS("iRegion"), _toDOMS(stringStr.str()));
573 
574  stringStr.str("");
575  stringStr<<iInput;
576  aRefHitElement->setAttribute(_toDOMS("iInput"), _toDOMS(stringStr.str()));
577  unsigned int logicRegionSize = 10/360.0*OMTFConfiguration::nPhiBins;
578  int lowScaleEnd = std::pow(2,OMTFConfiguration::nPhiBits-1);
580  int iPhiMin = OMTFConfiguration::processorPhiVsRefLayer[iProcessor][iRefLayer]-OMTFConfiguration::globalPhiStart(iProcessor)-lowScaleEnd;
581  int iPhiMax = iPhiMin+logicRegionSize-1;
582 
583  iPhiMin+=iRegion*logicRegionSize;
584  iPhiMax+=iRegion*logicRegionSize;
585 
586  stringStr.str("");
587  stringStr<<iPhiMin;
588  aRefHitElement->setAttribute(_toDOMS("iPhiMin"), _toDOMS(stringStr.str()));
589 
590  stringStr.str("");
591  stringStr<<iPhiMax;
592  aRefHitElement->setAttribute(_toDOMS("iPhiMax"), _toDOMS(stringStr.str()));
593  if(iRefHit<OMTFConfiguration::nRefHits) aProcessorElement->appendChild(aRefHitElement);
594  ++iRefHit;
595  }
596  for(;iRegion==5 && iRefLayer==7 && iRefHit<OMTFConfiguration::nRefHits;++iRefHit){
597  xercesc::DOMElement* aRefHitElement = theDoc->createElement(_toDOMS("RefHit"));
598  stringStr.str("");
599  stringStr<<iRefHit;
600  aRefHitElement->setAttribute(_toDOMS("iRefHit"), _toDOMS(stringStr.str()));
601  stringStr.str("");
602  stringStr<<0;
603  aRefHitElement->setAttribute(_toDOMS("iRefLayer"), _toDOMS(stringStr.str()));
604 
605  stringStr.str("");
606  stringStr<<0;
607  aRefHitElement->setAttribute(_toDOMS("iRegion"), _toDOMS(stringStr.str()));
608 
609  stringStr.str("");
610  stringStr<<0;
611  aRefHitElement->setAttribute(_toDOMS("iInput"), _toDOMS(stringStr.str()));
612 
613  int iPhiMin = 0;
614  int iPhiMax = 1;
615 
616  stringStr.str("");
617  stringStr<<iPhiMin;
618  aRefHitElement->setAttribute(_toDOMS("iPhiMin"), _toDOMS(stringStr.str()));
619 
620  stringStr.str("");
621  stringStr<<iPhiMax;
622  aRefHitElement->setAttribute(_toDOMS("iPhiMax"), _toDOMS(stringStr.str()));
623 
624  aProcessorElement->appendChild(aRefHitElement);
625  }
626  }
627  }
629  for(unsigned int iRegion=0;iRegion<6;++iRegion){
630  xercesc::DOMElement* aRegionElement = theDoc->createElement(_toDOMS("LogicRegion"));
631  stringStr.str("");
632  stringStr<<iRegion;
633  aRegionElement->setAttribute(_toDOMS("iRegion"), _toDOMS(stringStr.str()));
634 
635  unsigned int iLayerNew = 0;
636  for(unsigned int iLogicLayer=0;iLogicLayer<OMTFConfiguration::nLayers;++iLogicLayer){
637  if(removeLayers(iLogicLayer)) continue;
638  xercesc::DOMElement* aLayerElement = theDoc->createElement(_toDOMS("Layer"));
639  stringStr.str("");
640  //stringStr<<iLogicLayer;
641  //After layer removal index has to be realigned
642  stringStr<<iLayerNew;
643  ++iLayerNew;
645  aLayerElement->setAttribute(_toDOMS("iLayer"), _toDOMS(stringStr.str()));
646  const OMTFConfiguration::vector1D & myCounts = OMTFConfiguration::measurements4D[iProcessor][iRegion][iLogicLayer];
647  unsigned int maxInput = findMaxInput(myCounts);
648  unsigned int begin = 0, end = 0;
649  if((int)maxInput-2>=0) begin = maxInput-2;
650  else begin = maxInput;
651  end = maxInput+3;
652  stringStr.str("");
653  stringStr<<begin;
654  aLayerElement->setAttribute(_toDOMS("iFirstInput"), _toDOMS(stringStr.str()));
655  stringStr.str("");
656  stringStr<<end-begin+1;
657  aLayerElement->setAttribute(_toDOMS("nInputs"), _toDOMS(stringStr.str()));
658  aRegionElement->appendChild(aLayerElement);
659  }
660  aProcessorElement->appendChild(aRegionElement);
661  }
662  theTopElement->appendChild(aProcessorElement);
663  }
664 }
static unsigned int nLayers
static vector4D measurements4D
static int globalPhiStart(unsigned int iProcessor)
static vector4D measurements4Dref
unsigned int findMaxInput(const OMTFConfiguration::vector1D &myCounts)
static std::vector< std::vector< int > > processorPhiVsRefLayer
std::vector< int > vector1D
static unsigned int nPhiBins
#define end
Definition: vmac.h:37
bool removeLayers(unsigned int iLayer)
Utility function to set which layers should be ignored.
static unsigned int nPhiBits
static unsigned int nRefLayers
static 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
xercesc::DOMElement * XMLConfigWriter::writeEventData ( xercesc::DOMElement *  aTopElement,
unsigned int  iProcessor,
const OMTFinput aInput 
)

Definition at line 141 of file XMLConfigWriter.cc.

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

Referenced by L1TMuonOverlapTrackProducer::produce().

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

Definition at line 110 of file XMLConfigWriter.cc.

References _toDOMS(), theDoc, and theTopElement.

Referenced by L1TMuonOverlapTrackProducer::produce().

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

Remove some layers.

Definition at line 269 of file XMLConfigWriter.cc.

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

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

269  {
270 
271  std::ostringstream stringStr;
272  xercesc::DOMElement *aLayer=0, *aRefLayer=0, *aPdf=0;
273 
274  xercesc::DOMElement* aGPElement = theDoc->createElement(_toDOMS("GP"));
275  stringStr.str("");
276  stringStr<<aGP.key().thePtCode;
277  aGPElement->setAttribute(_toDOMS("iPt"), _toDOMS(stringStr.str()));
278  stringStr.str("");
279  stringStr<<aGP.key().theEtaCode;
280  aGPElement->setAttribute(_toDOMS("iEta"), _toDOMS(stringStr.str()));
281  stringStr.str("");
282  //stringStr<<aGP.key().thePhiCode;
283  stringStr<<"0";
284  aGPElement->setAttribute(_toDOMS("iPhi"), _toDOMS(stringStr.str()));
285  stringStr.str("");
286  stringStr<<aGP.key().theCharge;
287  aGPElement->setAttribute(_toDOMS("iCharge"), _toDOMS(stringStr.str()));
288 
289  unsigned int iLayerNew=0;
290  for(unsigned int iLayer = 0;iLayer<OMTFConfiguration::nLayers;++iLayer){
291  int nOfPhis = 0;
293  if(removeLayers(iLayer)) continue;
295  aLayer = theDoc->createElement(_toDOMS("Layer"));
296  stringStr.str("");
297  //stringStr<<iLayer;
298  //After layer removal inxed has to be realigned
299  stringStr<<iLayerNew;
300  ++iLayerNew;
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<OMTFConfiguration::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<OMTFConfiguration::nRefLayers;++iRefLayer){
327  for(unsigned int iPdf=0;iPdf<exp2(OMTFConfiguration::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:59
static unsigned int nLayers
int theCharge
Definition: GoldenPattern.h:37
unsigned int thePtCode
Definition: GoldenPattern.h:36
static unsigned int nPdfAddrBits
bool removeLayers(unsigned int iLayer)
Utility function to set which layers should be ignored.
static 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
int theEtaCode
Definition: GoldenPattern.h:35
void XMLConfigWriter::writeGPData ( const GoldenPattern aGP1,
const GoldenPattern aGP2 
)

Remove some layers.

Definition at line 341 of file XMLConfigWriter.cc.

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

342  {
343 
344  std::ostringstream stringStr;
345  xercesc::DOMElement *aLayer=0, *aRefLayer=0, *aPdf=0;
346 
347  xercesc::DOMElement* aGPElement = theDoc->createElement(_toDOMS("GP"));
348  stringStr.str("");
349  stringStr<<aGP1.key().thePtCode;
350  aGPElement->setAttribute(_toDOMS("iPt1"), _toDOMS(stringStr.str()));
351  stringStr.str("");
352 
353  stringStr<<aGP2.key().thePtCode;
354  aGPElement->setAttribute(_toDOMS("iPt2"), _toDOMS(stringStr.str()));
355  stringStr.str("");
356  stringStr<<aGP1.key().theEtaCode;
357  aGPElement->setAttribute(_toDOMS("iEta"), _toDOMS(stringStr.str()));
358  stringStr.str("");
359  //stringStr<<aGP.key().thePhiCode;
360  stringStr<<"0";
361  aGPElement->setAttribute(_toDOMS("iPhi"), _toDOMS(stringStr.str()));
362  stringStr.str("");
363  stringStr<<aGP1.key().theCharge;
364  aGPElement->setAttribute(_toDOMS("iCharge"), _toDOMS(stringStr.str()));
365 
366  unsigned int iLayerNew=0;
367  for(unsigned int iLayer = 0;iLayer<OMTFConfiguration::nLayers;++iLayer){
368  int nOfPhis = 0;
370  if(removeLayers(iLayer)) continue;
372  aLayer = theDoc->createElement(_toDOMS("Layer"));
373  stringStr.str("");
374  //stringStr<<iLayer;
375  //After layer removal inxed has to be realigned
376  stringStr<<iLayerNew;
377  ++iLayerNew;
379  aLayer->setAttribute(_toDOMS("iLayer"), _toDOMS(stringStr.str()));
380  stringStr.str("");
381  stringStr<<nOfPhis;
382  aLayer->setAttribute(_toDOMS("nOfPhis"), _toDOMS(stringStr.str()));
383  for(unsigned int iRefLayer=0;iRefLayer<OMTFConfiguration::nRefLayers;++iRefLayer){
384  aRefLayer = theDoc->createElement(_toDOMS("RefLayer"));
385  int meanDistPhi = aGP1.meanDistPhiValue(iLayer,iRefLayer);
386 
387  stringStr.str("");
388  stringStr<<meanDistPhi;
389  aRefLayer->setAttribute(_toDOMS("meanDistPhi"), _toDOMS(stringStr.str()));
390 
391  //int meanDistPhi2 = aGP2.meanDistPhiValue(iLayer,iRefLayer);
392  //stringStr.str("");
393  //stringStr<<meanDistPhi2;
394  //aRefLayer->setAttribute(_toDOMS("meanDistPhi2"), _toDOMS(stringStr.str()));
395 
396  int selDistPhi = 0;
397  stringStr.str("");
398  stringStr<<selDistPhi;
399  aRefLayer->setAttribute(_toDOMS("selDistPhi"), _toDOMS(stringStr.str()));
400  int selDistPhiShift = 0;
401  stringStr.str("");
402  stringStr<<selDistPhiShift;
403  aRefLayer->setAttribute(_toDOMS("selDistPhiShift"), _toDOMS(stringStr.str()));
404  int distMsbPhiShift = 0;
405  stringStr.str("");
406  stringStr<<distMsbPhiShift;
407  aRefLayer->setAttribute(_toDOMS("distMsbPhiShift"), _toDOMS(stringStr.str()));
408  aLayer->appendChild(aRefLayer);
409  }
410  for(unsigned int iRefLayer=0;iRefLayer<OMTFConfiguration::nRefLayers;++iRefLayer){
411  for(unsigned int iPdf=0;iPdf<exp2(OMTFConfiguration::nPdfAddrBits);++iPdf){
412  aPdf = theDoc->createElement(_toDOMS("PDF"));
413  stringStr.str("");
414  stringStr<<aGP1.pdfValue(iLayer,iRefLayer,iPdf);
415  aPdf->setAttribute(_toDOMS("value1"), _toDOMS(stringStr.str()));
416  stringStr.str("");
417  stringStr<<aGP2.pdfValue(iLayer,iRefLayer,iPdf);
418  aPdf->setAttribute(_toDOMS("value2"), _toDOMS(stringStr.str()));
419  aLayer->appendChild(aPdf);
420  }
421  }
422  aGPElement->appendChild(aLayer);
423  }
424  theTopElement->appendChild(aGPElement);
425 }
Key key() const
Definition: GoldenPattern.h:59
static unsigned int nLayers
int theCharge
Definition: GoldenPattern.h:37
unsigned int thePtCode
Definition: GoldenPattern.h:36
static unsigned int nPdfAddrBits
bool removeLayers(unsigned int iLayer)
Utility function to set which layers should be ignored.
static 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
int theEtaCode
Definition: GoldenPattern.h:35
void XMLConfigWriter::writeGPData ( const GoldenPattern aGP1,
const GoldenPattern aGP2,
const GoldenPattern aGP3,
const GoldenPattern aGP4 
)

Remove some layers.

Definition at line 428 of file XMLConfigWriter.cc.

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

431  {
432 
433  std::ostringstream stringStr;
434  xercesc::DOMElement *aLayer=0, *aRefLayer=0, *aPdf=0;
435 
436  xercesc::DOMElement* aGPElement = theDoc->createElement(_toDOMS("GP"));
437  stringStr.str("");
438  stringStr<<aGP1.key().thePtCode;
439  aGPElement->setAttribute(_toDOMS("iPt1"), _toDOMS(stringStr.str()));
440  stringStr.str("");
441  stringStr<<aGP2.key().thePtCode;
442  aGPElement->setAttribute(_toDOMS("iPt2"), _toDOMS(stringStr.str()));
443  stringStr.str("");
444  stringStr<<aGP3.key().thePtCode;
445  aGPElement->setAttribute(_toDOMS("iPt3"), _toDOMS(stringStr.str()));
446  stringStr.str("");
447  stringStr<<aGP4.key().thePtCode;
448  aGPElement->setAttribute(_toDOMS("iPt4"), _toDOMS(stringStr.str()));
449 
450  stringStr.str("");
451  stringStr<<aGP1.key().theEtaCode;
452  aGPElement->setAttribute(_toDOMS("iEta"), _toDOMS(stringStr.str()));
453  stringStr.str("");
454  //stringStr<<aGP.key().thePhiCode;
455  stringStr<<"0";
456  aGPElement->setAttribute(_toDOMS("iPhi"), _toDOMS(stringStr.str()));
457  stringStr.str("");
458  stringStr<<aGP1.key().theCharge;
459  aGPElement->setAttribute(_toDOMS("iCharge"), _toDOMS(stringStr.str()));
460 
461  unsigned int iLayerNew=0;
462  for(unsigned int iLayer = 0;iLayer<OMTFConfiguration::nLayers;++iLayer){
463  int nOfPhis = 0;
465  if(removeLayers(iLayer)) continue;
467  aLayer = theDoc->createElement(_toDOMS("Layer"));
468  stringStr.str("");
469  //stringStr<<iLayer;
470  //After layer removal inxed has to be realigned
471  stringStr<<iLayerNew;
472  ++iLayerNew;
474  aLayer->setAttribute(_toDOMS("iLayer"), _toDOMS(stringStr.str()));
475  stringStr.str("");
476  stringStr<<nOfPhis;
477  aLayer->setAttribute(_toDOMS("nOfPhis"), _toDOMS(stringStr.str()));
478  for(unsigned int iRefLayer=0;iRefLayer<OMTFConfiguration::nRefLayers;++iRefLayer){
479  aRefLayer = theDoc->createElement(_toDOMS("RefLayer"));
480  int meanDistPhi = aGP1.meanDistPhiValue(iLayer,iRefLayer);
481 
482  stringStr.str("");
483  stringStr<<meanDistPhi;
484  aRefLayer->setAttribute(_toDOMS("meanDistPhi"), _toDOMS(stringStr.str()));
485 
486  //int meanDistPhi2 = aGP2.meanDistPhiValue(iLayer,iRefLayer);
487  //stringStr.str("");
488  //stringStr<<meanDistPhi2;
489  //aRefLayer->setAttribute(_toDOMS("meanDistPhi2"), _toDOMS(stringStr.str()));
490 
491  int selDistPhi = 0;
492  stringStr.str("");
493  stringStr<<selDistPhi;
494  aRefLayer->setAttribute(_toDOMS("selDistPhi"), _toDOMS(stringStr.str()));
495  int selDistPhiShift = 0;
496  stringStr.str("");
497  stringStr<<selDistPhiShift;
498  aRefLayer->setAttribute(_toDOMS("selDistPhiShift"), _toDOMS(stringStr.str()));
499  int distMsbPhiShift = 0;
500  stringStr.str("");
501  stringStr<<distMsbPhiShift;
502  aRefLayer->setAttribute(_toDOMS("distMsbPhiShift"), _toDOMS(stringStr.str()));
503  aLayer->appendChild(aRefLayer);
504  }
505  for(unsigned int iRefLayer=0;iRefLayer<OMTFConfiguration::nRefLayers;++iRefLayer){
506  for(unsigned int iPdf=0;iPdf<exp2(OMTFConfiguration::nPdfAddrBits);++iPdf){
507  aPdf = theDoc->createElement(_toDOMS("PDF"));
508  stringStr.str("");
509  stringStr<<aGP1.pdfValue(iLayer,iRefLayer,iPdf);
510  aPdf->setAttribute(_toDOMS("value1"), _toDOMS(stringStr.str()));
511  stringStr.str("");
512  stringStr<<aGP2.pdfValue(iLayer,iRefLayer,iPdf);
513  aPdf->setAttribute(_toDOMS("value2"), _toDOMS(stringStr.str()));
514  stringStr.str("");
515  stringStr<<aGP3.pdfValue(iLayer,iRefLayer,iPdf);
516  aPdf->setAttribute(_toDOMS("value3"), _toDOMS(stringStr.str()));
517  stringStr.str("");
518  stringStr<<aGP4.pdfValue(iLayer,iRefLayer,iPdf);
519  aPdf->setAttribute(_toDOMS("value4"), _toDOMS(stringStr.str()));
520  aLayer->appendChild(aPdf);
521  }
522  }
523  aGPElement->appendChild(aLayer);
524  }
525  theTopElement->appendChild(aGPElement);
526 }
Key key() const
Definition: GoldenPattern.h:59
static unsigned int nLayers
int theCharge
Definition: GoldenPattern.h:37
unsigned int thePtCode
Definition: GoldenPattern.h:36
static unsigned int nPdfAddrBits
bool removeLayers(unsigned int iLayer)
Utility function to set which layers should be ignored.
static 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
int theEtaCode
Definition: GoldenPattern.h:35
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 218 of file XMLConfigWriter.cc.

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

Referenced by L1TMuonOverlapTrackProducer::produce().

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

Member Data Documentation

xercesc::DOMImplementation* XMLConfigWriter::domImpl
private

Definition at line 69 of file XMLConfigWriter.h.

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

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