CMS 3D CMS Logo

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

#include <XMLConfigWriter.h>

Public Member Functions

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

Private Attributes

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

Detailed Description

Definition at line 27 of file XMLConfigWriter.h.

Constructor & Destructor Documentation

XMLConfigWriter::XMLConfigWriter ( const OMTFConfiguration aOMTFConfig)

Initialise XML document

Definition at line 74 of file XMLConfigWriter.cc.

References _toDOMS(), domImpl, and myOMTFConfig.

74  {
75 
76  XMLPlatformUtils::Initialize();
77 
79  domImpl = DOMImplementationRegistry::getDOMImplementation(_toDOMS("Range"));
80 
81  myOMTFConfig = aOMTFConfig;
82 
83 }
XMLCh * _toDOMS(std::string temp)
xercesc::DOMImplementation * domImpl
const OMTFConfiguration * myOMTFConfig

Member Function Documentation

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

Definition at line 104 of file XMLConfigWriter.cc.

References domImpl, and theTopElement.

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

104  {
105 
106  XMLFormatTarget* formTarget = new LocalFileFormatTarget(fName.c_str());
107 
108 #if _XERCES_VERSION <30100
109  xercesc::DOMWriter* domWriter = (dynamic_cast<DOMImplementation*>(domImpl))->createDOMWriter();
110  if(domWriter->canSetFeature(XMLUni::fgDOMWRTFormatPrettyPrint, true)){
111  domWriter->setFeature(XMLUni::fgDOMWRTFormatPrettyPrint, true);
112  }
113  domWriter->writeNode(formTarget,*theTopElement);
114 
115 #else
116  xercesc::DOMLSSerializer* theSerializer = (dynamic_cast<DOMImplementation*>(domImpl))->createLSSerializer();
117  if (theSerializer->getDomConfig()->canSetParameter(XMLUni::fgDOMWRTFormatPrettyPrint, true))
118  theSerializer->getDomConfig()->setParameter(XMLUni::fgDOMWRTFormatPrettyPrint, true);
119  DOMLSOutput* theOutput = (dynamic_cast<DOMImplementation*>(domImpl))->createLSOutput();
120  theOutput->setByteStream(formTarget);
121  theSerializer->write(theTopElement, theOutput);
122  theOutput->release();
123  theSerializer->release();
124 #endif
125 
126  delete formTarget;
127 }
xercesc::DOMImplementation * domImpl
xercesc::DOMElement * theTopElement
unsigned int XMLConfigWriter::findMaxInput ( const OMTFConfiguration::vector1D myCounts)

Definition at line 647 of file XMLConfigWriter.cc.

References SiStripPI::max.

Referenced by writeConnectionsData().

647  {
648 
649  unsigned int max = 0;
650  unsigned int maxInput = 0;
651  for(unsigned int iInput=0;iInput<14;++iInput){
652  if(myCounts[iInput]>(int)max){
653  max = myCounts[iInput];
654  maxInput = iInput;
655  }
656  }
657  return maxInput;
658 }
void XMLConfigWriter::initialiseXMLDocument ( const std::string &  docName)

Definition at line 86 of file XMLConfigWriter.cc.

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

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

86  {
87 
88  theDoc = domImpl->createDocument(nullptr,_toDOMS(docName), nullptr);
89  theTopElement = theDoc->getDocumentElement();
90 
91  unsigned int version = myOMTFConfig->patternsVersion();
92  unsigned int mask16bits = 0xFFFF;
93 
94  version &=mask16bits;
95 
96  std::ostringstream stringStr;
97  stringStr.str("");
98  stringStr<<"0x"<<std::hex<<std::setfill('0')<<std::setw(4)<<version;
99  theTopElement->setAttribute(_toDOMS("version"), _toDOMS(stringStr.str()));
100 
101 }
XMLCh * _toDOMS(std::string temp)
xercesc::DOMImplementation * domImpl
const OMTFConfiguration * myOMTFConfig
xercesc::DOMDocument * theDoc
xercesc::DOMElement * theTopElement
unsigned int patternsVersion() const
void XMLConfigWriter::writeAlgoMuon ( xercesc::DOMElement *  aTopElement,
unsigned int  iRefHit,
const AlgoMuon aMuon 
)

Definition at line 211 of file XMLConfigWriter.cc.

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

Referenced by OMTFReconstruction::writeResultToXML().

213  {
214 
215  xercesc::DOMElement* aResult = theDoc->createElement(_toDOMS("AlgoMuon"));
216  std::ostringstream stringStr;
217  stringStr.str("");
218  stringStr<<iRefHit;
219  aResult->setAttribute(_toDOMS("iRefHit"),_toDOMS(stringStr.str()));
220  stringStr.str("");
221  stringStr<<aCand.getPt();
222  aResult->setAttribute(_toDOMS("ptCode"),_toDOMS(stringStr.str()));
223  stringStr.str("");
224  stringStr<<aCand.getPhi();
225  aResult->setAttribute(_toDOMS("phiCode"),_toDOMS(stringStr.str()));
226  stringStr.str("");
227  stringStr<<eta2Bits(abs(aCand.getEta()));
228  aResult->setAttribute(_toDOMS("etaCode"),_toDOMS(stringStr.str()));
229  stringStr.str("");
230  stringStr<<aCand.getCharge();
231  aResult->setAttribute(_toDOMS("charge"),_toDOMS(stringStr.str()));
232  stringStr.str("");
233  stringStr<<aCand.getQ();
234  aResult->setAttribute(_toDOMS("nHits"), _toDOMS(stringStr.str()));
235  stringStr.str("");
236  stringStr<<aCand.getDisc();
237  aResult->setAttribute(_toDOMS("disc"), _toDOMS(stringStr.str()));
238  stringStr.str("");
239  stringStr<<aCand.getRefLayer();
240  aResult->setAttribute(_toDOMS("iRefLayer"), _toDOMS(stringStr.str()));
241  stringStr.str("");
242  stringStr<<std::bitset<18>(aCand.getHits());
243  aResult->setAttribute(_toDOMS("layers"),_toDOMS(stringStr.str()));
244  stringStr.str("");
245  stringStr<<aCand.getPhiRHit();
246  aResult->setAttribute(_toDOMS("phiRHit"),_toDOMS(stringStr.str()));
247  stringStr.str("");
248  stringStr<<aCand.getPatternNumber();
249  aResult->setAttribute(_toDOMS("patNum"),_toDOMS(stringStr.str()));
250 
251  aTopElement->appendChild(aResult);
252 }
unsigned int eta2Bits(unsigned int eta)
XMLCh * _toDOMS(std::string temp)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
xercesc::DOMDocument * theDoc
void XMLConfigWriter::writeCandMuon ( xercesc::DOMElement *  aTopElement,
const l1t::RegionalMuonCand aCand 
)

Definition at line 255 of file XMLConfigWriter.cc.

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

Referenced by OMTFReconstruction::writeResultToXML().

256  {
257 
258  xercesc::DOMElement* aResult = theDoc->createElement(_toDOMS("CandMuon"));
259  std::ostringstream stringStr;
260  stringStr.str("");
261  stringStr<<aCand.hwPt();
262  aResult->setAttribute(_toDOMS("hwPt"),_toDOMS(stringStr.str()));
263  stringStr.str("");
264  stringStr<<aCand.hwPhi();
265  aResult->setAttribute(_toDOMS("hwPhi"),_toDOMS(stringStr.str()));
266  stringStr.str("");
267  stringStr<<aCand.hwEta();
268  aResult->setAttribute(_toDOMS("hwEta"),_toDOMS(stringStr.str()));
269  stringStr.str("");
270  stringStr<<aCand.hwSign();
271  aResult->setAttribute(_toDOMS("hwSign"),_toDOMS(stringStr.str()));
272  stringStr.str("");
273  stringStr<<aCand.hwSignValid();
274  aResult->setAttribute(_toDOMS("hwSignValid"),_toDOMS(stringStr.str()));
275  stringStr.str("");
276  stringStr<<aCand.hwQual();
277  aResult->setAttribute(_toDOMS("hwQual"), _toDOMS(stringStr.str()));
278  stringStr.str("");
279  std::map<int, int> hwAddrMap = aCand.trackAddress();
280  stringStr<<std::bitset<29>(hwAddrMap[0]);
281  aResult->setAttribute(_toDOMS("hwTrackAddress"), _toDOMS(stringStr.str()));
282  stringStr.str("");
283  stringStr<<aCand.link();
284  aResult->setAttribute(_toDOMS("link"), _toDOMS(stringStr.str()));
285  stringStr.str("");
286  stringStr<<aCand.processor();
287  aResult->setAttribute(_toDOMS("processor"), _toDOMS(stringStr.str()));
288  stringStr.str("");
289  if (aCand.trackFinderType() == l1t::omtf_neg) stringStr<<"OMTF_NEG";
290  else if (aCand.trackFinderType() == l1t::omtf_pos) stringStr<<"OMTF_POS";
291  else stringStr<<aCand.trackFinderType();
292  aResult->setAttribute(_toDOMS("trackFinderType"), _toDOMS(stringStr.str()));
293  aTopElement->appendChild(aResult);
294 }
const int hwSignValid() const
Get charge sign valid bit (0 - not valid (high pT muon); 1 - valid)
const int hwQual() const
Get quality code.
XMLCh * _toDOMS(std::string temp)
const int hwEta() const
Get compressed eta (returned int * 0.010875 = eta)
const std::map< int, int > & trackAddress() const
Get the track address (identifies track primitives used for reconstruction)
const int hwPhi() const
Get compressed local phi (returned int * 2*pi/576 = local phi in rad)
const int link() const
Get link on which the MicroGMT receives the candidate.
const tftype trackFinderType() const
Get track-finder which found the muon (bmtf, emtf_pos/emtf_neg or omtf_pos/omtf_neg) ...
const int processor() const
Get processor ID on which the candidate was found (0..5 for OMTF/EMTF; 0..11 for BMTF) ...
const int hwPt() const
Get compressed pT (returned int * 0.5 = pT (GeV))
const int hwSign() const
Get charge sign bit (charge = (-1)^(sign))
xercesc::DOMDocument * theDoc
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 516 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().

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

Definition at line 161 of file XMLConfigWriter.cc.

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

Referenced by OMTFReconstruction::writeResultToXML().

163  {
164 
165  std::ostringstream stringStr;
166 
167  xercesc::DOMElement *aProcessor = theDoc->createElement(_toDOMS("Processor"));
168  aProcessor->setAttribute(_toDOMS("board"), _toDOMS(board.name()) );
169 
170  unsigned int iProcessor = board.processor();
171  stringStr.str("");
172  stringStr<<iProcessor;
173  aProcessor->setAttribute(_toDOMS("iProcessor"), _toDOMS(stringStr.str()));
174  stringStr.str("");
175  if (board.position()==1) stringStr<<"+";
176  stringStr<<board.position();
177  aProcessor->setAttribute(_toDOMS("position"), _toDOMS(stringStr.str()));
178 
179  xercesc::DOMElement *aLayer, *aHit;
180  for(unsigned int iLayer=0;iLayer<myOMTFConfig->nLayers();++iLayer){
181  const OMTFinput::vector1D & layerDataPhi = aInput.getLayerData(iLayer);
182  const OMTFinput::vector1D & layerDataEta = aInput.getLayerData(iLayer,true);
183 
184  aLayer = theDoc->createElement(_toDOMS("Layer"));
185  stringStr.str("");
186  stringStr<<iLayer;
187  aLayer->setAttribute(_toDOMS("iLayer"), _toDOMS(stringStr.str()));
188  for(unsigned int iHit=0;iHit<layerDataPhi.size();++iHit){
189  aHit = theDoc->createElement(_toDOMS("Hit"));
190  stringStr.str("");
191  stringStr<<iHit;
192  aHit->setAttribute(_toDOMS("iInput"), _toDOMS(stringStr.str()));
193  stringStr.str("");
194  stringStr<<layerDataPhi[iHit];
195  aHit->setAttribute(_toDOMS("iPhi"), _toDOMS(stringStr.str()));
196  stringStr.str("");
197  stringStr<<eta2Bits(abs(layerDataEta[iHit]));
198  aHit->setAttribute(_toDOMS("iEta"), _toDOMS(stringStr.str()));
199  if(layerDataPhi[iHit]>=(int)myOMTFConfig->nPhiBins()) continue;
200  aLayer->appendChild(aHit);
201  }
202  if(aLayer->getChildNodes()->getLength()) aProcessor->appendChild(aLayer);
203  }
204 
205  aTopElement->appendChild(aProcessor);
206  return aProcessor;
207 
208 }
unsigned int processor() const
Definition: OmtfName.cc:60
unsigned int nLayers() const
unsigned int nPhiBins() const
unsigned int eta2Bits(unsigned int eta)
std::vector< int > vector1D
Definition: OMTFinput.h:15
const OMTFinput::vector1D & getLayerData(unsigned int iLayer, bool giveEta=false) const
Definition: OMTFinput.cc:19
XMLCh * _toDOMS(std::string temp)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int position() const
Definition: OmtfName.cc:58
const OMTFConfiguration * myOMTFConfig
std::string name() const
Definition: OmtfName.cc:39
xercesc::DOMDocument * theDoc
xercesc::DOMElement * XMLConfigWriter::writeEventHeader ( unsigned int  eventId,
unsigned int  mixedEventId = 0 
)

Definition at line 130 of file XMLConfigWriter.cc.

References _toDOMS(), theDoc, and theTopElement.

Referenced by OMTFReconstruction::reconstruct().

131  {
132 
133  unsigned int eventBx = eventId*2;
134 
135  xercesc::DOMElement *aEvent = nullptr;
136  xercesc::DOMElement *aBx = nullptr;
137  std::ostringstream stringStr;
138 
139  aEvent = theDoc->createElement(_toDOMS("Event"));
140 
141  stringStr.str("");
142  stringStr<<eventId;
143  aEvent->setAttribute(_toDOMS("iEvent"), _toDOMS(stringStr.str()));
144 
145  stringStr.str("");
146  stringStr<<mixedEventId;
147  aEvent->setAttribute(_toDOMS("iMixedEvent"), _toDOMS(stringStr.str()));
148 
149  aBx = theDoc->createElement(_toDOMS("bx"));
150  stringStr.str("");
151  stringStr<<eventBx;
152  aBx->setAttribute(_toDOMS("iBx"), _toDOMS(stringStr.str()));
153  aEvent->appendChild(aBx);
154 
155  theTopElement->appendChild(aEvent);
156 
157  return aBx;
158 }
XMLCh * _toDOMS(std::string temp)
xercesc::DOMDocument * theDoc
xercesc::DOMElement * theTopElement
void XMLConfigWriter::writeGPData ( const GoldenPattern aGP)

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

350  {
351 
352  std::ostringstream stringStr;
353  xercesc::DOMElement *aLayer=nullptr, *aRefLayer=nullptr, *aPdf=nullptr;
354 
355  xercesc::DOMElement* aGPElement = theDoc->createElement(_toDOMS("GP"));
356  stringStr.str("");
357  stringStr<<aGP.key().thePtCode;
358  aGPElement->setAttribute(_toDOMS("iPt"), _toDOMS(stringStr.str()));
359  stringStr.str("");
360  //stringStr<<aGP.key().theEtaCode;
361  stringStr<<"0";//No eta code at the moment
362  aGPElement->setAttribute(_toDOMS("iEta"), _toDOMS(stringStr.str()));
363  stringStr.str("");
364  stringStr<<0; //No phi code is assigned to GP for the moment.
365  aGPElement->setAttribute(_toDOMS("iPhi"), _toDOMS(stringStr.str()));
366  stringStr.str("");
367  stringStr<<aGP.key().theCharge;
368  aGPElement->setAttribute(_toDOMS("iCharge"), _toDOMS(stringStr.str()));
369 
370  for(unsigned int iLayer = 0;iLayer<myOMTFConfig->nLayers();++iLayer){
371  int nOfPhis = 0;
373  aLayer = theDoc->createElement(_toDOMS("Layer"));
374  stringStr.str("");
375  stringStr<<iLayer;
377  aLayer->setAttribute(_toDOMS("iLayer"), _toDOMS(stringStr.str()));
378  stringStr.str("");
379  stringStr<<nOfPhis;
380  aLayer->setAttribute(_toDOMS("nOfPhis"), _toDOMS(stringStr.str()));
381  for(unsigned int iRefLayer=0;iRefLayer<myOMTFConfig->nRefLayers();++iRefLayer){
382  aRefLayer = theDoc->createElement(_toDOMS("RefLayer"));
383  int meanDistPhi = aGP.meanDistPhiValue(iLayer,iRefLayer);
384  stringStr.str("");
385  stringStr<<meanDistPhi;
386  aRefLayer->setAttribute(_toDOMS("meanDistPhi"), _toDOMS(stringStr.str()));
387  int selDistPhi = 0;
388  stringStr.str("");
389  stringStr<<selDistPhi;
390  aRefLayer->setAttribute(_toDOMS("selDistPhi"), _toDOMS(stringStr.str()));
391  int selDistPhiShift = 0;
392  stringStr.str("");
393  stringStr<<selDistPhiShift;
394  aRefLayer->setAttribute(_toDOMS("selDistPhiShift"), _toDOMS(stringStr.str()));
395  int distMsbPhiShift = 0;
396  stringStr.str("");
397  stringStr<<distMsbPhiShift;
398  aRefLayer->setAttribute(_toDOMS("distMsbPhiShift"), _toDOMS(stringStr.str()));
399  aLayer->appendChild(aRefLayer);
400  }
401  for(unsigned int iRefLayer=0;iRefLayer<myOMTFConfig->nRefLayers();++iRefLayer){
402  for(unsigned int iPdf=0;iPdf<exp2(myOMTFConfig->nPdfAddrBits());++iPdf){
403  aPdf = theDoc->createElement(_toDOMS("PDF"));
404  stringStr.str("");
405  stringStr<<aGP.pdfValue(iLayer,iRefLayer,iPdf);
406  aPdf->setAttribute(_toDOMS("value"), _toDOMS(stringStr.str()));
407  aLayer->appendChild(aPdf);
408  }
409  }
410  aGPElement->appendChild(aLayer);
411  }
412  theTopElement->appendChild(aGPElement);
413 }
Key key() const
Definition: GoldenPattern.h:58
unsigned int nRefLayers() const
int theCharge
Definition: GoldenPattern.h:35
unsigned int nLayers() const
unsigned int thePtCode
Definition: GoldenPattern.h:34
unsigned int nPdfAddrBits() const
XMLCh * _toDOMS(std::string temp)
const OMTFConfiguration * myOMTFConfig
int pdfValue(unsigned int iLayer, unsigned int iRefLayer, unsigned int iBin) const
Definition: GoldenPattern.h:70
xercesc::DOMDocument * theDoc
int meanDistPhiValue(unsigned int iLayer, unsigned int iRefLayer) const
Definition: GoldenPattern.h:68
xercesc::DOMElement * theTopElement
void XMLConfigWriter::writeGPData ( const GoldenPattern aGP1,
const GoldenPattern aGP2,
const GoldenPattern aGP3,
const GoldenPattern aGP4 
)

Definition at line 416 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.

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

302  {
303 
305 
306  std::ostringstream stringStr;
308  xercesc::DOMElement* aGP = theDoc->createElement(_toDOMS("GP"));
309  stringStr.str("");
310  stringStr<<aKey.thePtCode;
311  aGP->setAttribute(_toDOMS("iPt"), _toDOMS(stringStr.str()));
312  stringStr.str("");
313  stringStr<<aKey.theEtaCode;
314  aGP->setAttribute(_toDOMS("iEta"), _toDOMS(stringStr.str()));
315  stringStr.str("");
316  stringStr<<"0";
317  aGP->setAttribute(_toDOMS("iPhi"), _toDOMS(stringStr.str()));
318  stringStr.str("");
319  stringStr<<aKey.theCharge;
320  aGP->setAttribute(_toDOMS("iCharge"), _toDOMS(stringStr.str()));
323  for(unsigned int iRefLayer=0;iRefLayer<myOMTFConfig->nRefLayers();++iRefLayer){
324  xercesc::DOMElement* aRefLayer = theDoc->createElement(_toDOMS("Result"));
325  stringStr.str("");
326  stringStr<<iRefLayer;
327  aRefLayer->setAttribute(_toDOMS("iRefLayer"), _toDOMS(stringStr.str()));
328  stringStr.str("");
329  stringStr<<iRegion;
330  aRefLayer->setAttribute(_toDOMS("iRegion"), _toDOMS(stringStr.str()));
331  stringStr.str("");
332  stringStr<<myOMTFConfig->getRefToLogicNumber()[iRefLayer];
333  aRefLayer->setAttribute(_toDOMS("iLogicLayer"), _toDOMS(stringStr.str()));
334  for(unsigned int iLogicLayer=0;iLogicLayer<myOMTFConfig->nLayers();++iLogicLayer){
335  xercesc::DOMElement* aLayer = theDoc->createElement(_toDOMS("Layer"));
336  stringStr.str("");
337  stringStr<<iLogicLayer;
338  aLayer->setAttribute(_toDOMS("iLayer"), _toDOMS(stringStr.str()));
339  stringStr.str("");
340  stringStr<<results[iLogicLayer][iRefLayer];
341  aLayer->setAttribute(_toDOMS("value"), _toDOMS(stringStr.str()));
342  if(results[iLogicLayer][iRefLayer]) aRefLayer->appendChild(aLayer);
343  }
344  if(aRefLayer->getChildNodes()->getLength()) aGP->appendChild(aRefLayer);
345  }
346  if(aGP->getChildNodes()->getLength()) aTopElement->appendChild(aGP);
347 }
unsigned int nRefLayers() const
int theCharge
Definition: GoldenPattern.h:35
unsigned int nLayers() const
const OMTFResult::vector2D & getResults() const
Definition: OMTFResult.h:20
unsigned int thePtCode
Definition: GoldenPattern.h:34
XMLCh * _toDOMS(std::string temp)
const OMTFConfiguration * myOMTFConfig
std::vector< vector1D > vector2D
Definition: OMTFResult.h:14
const std::vector< int > & getRefToLogicNumber() const
xercesc::DOMDocument * theDoc
int theEtaCode
Definition: GoldenPattern.h:33

Member Data Documentation

xercesc::DOMImplementation* XMLConfigWriter::domImpl
private

Definition at line 69 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