6 #include <xercesc/dom/DOMNode.hpp> 7 #include <xercesc/dom/DOM.hpp> 8 #include <xercesc/dom/DOMCharacterData.hpp> 9 #include <xercesc/parsers/XercesDOMParser.hpp> 12 #include <xercesc/framework/LocalFileFormatTarget.hpp> 13 #include <xercesc/util/XMLUni.hpp> 14 #include <xercesc/util/XMLURL.hpp> 25 const std::vector<int>& detvec,
26 const std::vector<int>& etavec,
27 const std::vector<int>& phivec,
28 const std::vector<int>& depthvec,
29 const std::vector<float>& scalevec) {
30 int nn = newfile0.size();
32 for (
int i = 0;
i <
nn;
i++) {
35 char const* fend =
"\0";
42 std::ostream fOut(&fb);
46 XMLString::transcode(
"Core", tempStr, 99);
47 std::unique_ptr<DOMImplementation> mDom(DOMImplementationRegistry::getDOMImplementation(tempStr));
49 XMLString::transcode(
"CalibrationConstants", tempStr, 99);
50 mDoc = mDom->createDocument(
nullptr,
55 DOMLSSerializer* domWriter = mDom->createLSSerializer();
56 domWriter->getDomConfig()->setParameter(XMLUni::fgDOMWRTFormatPrettyPrint,
true);
57 DOMElement*
root = mDoc->getDocumentElement();
59 XMLString::transcode(
"Hcal", tempStr, 99);
60 DOMElement* rootelem = mDoc->createElement(tempStr);
61 root->appendChild(rootelem);
63 XMLString::transcode(
"Cell", tempStr, 99);
64 std::vector<DOMElement*> theDOMVec;
66 for (
unsigned int i = 0;
i < detvec.size();
i++) {
67 theDOMVec.push_back(mDoc->createElement(tempStr));
68 newCellLine(theDOMVec[
i], detvec[
i], etavec[
i], phivec[
i], depthvec[
i], scalevec[
i]);
69 rootelem->appendChild(theDOMVec[
i]);
73 DOMLSOutput*
output = mDom->createLSOutput();
74 output->setByteStream(&formTarget);
75 domWriter->write(mDoc,
output);
84 XMLString::transcode(
"det_index", tempStr, 99);
85 DOMAttr* attrdet = mDoc->createAttribute(tempStr);
87 XMLString::transcode(
"eta_index", tempStr, 99);
88 DOMAttr* attreta = mDoc->createAttribute(tempStr);
90 XMLString::transcode(
"phi_index", tempStr, 99);
91 DOMAttr* attrphi = mDoc->createAttribute(tempStr);
93 XMLString::transcode(
"depth_index", tempStr, 99);
94 DOMAttr* attrdepth = mDoc->createAttribute(tempStr);
96 XMLString::transcode(
"scale_factor", tempStr, 99);
97 DOMAttr* attrscale = mDoc->createAttribute(tempStr);
99 std::ostringstream ost;
101 attrdet->setValue(XMLString::transcode(ost.str().c_str()));
102 detelem->setAttributeNode(attrdet);
104 std::ostringstream ost1;
106 attreta->setValue(XMLString::transcode(ost1.str().c_str()));
108 detelem->setAttributeNode(attreta);
110 std::ostringstream ost2;
112 attrphi->setValue(XMLString::transcode(ost2.str().c_str()));
114 detelem->setAttributeNode(attrphi);
116 std::ostringstream ost3;
118 attrdepth->setValue(XMLString::transcode(ost3.str().c_str()));
120 detelem->setAttributeNode(attrdepth);
122 std::ostringstream ost4;
124 attrscale->setValue(XMLString::transcode(ost4.str().c_str()));
126 detelem->setAttributeNode(attrscale);
Log< level::Info, true > LogVerbatim
void newCellLine(xercesc::DOMElement *, int, int, int, int, float)
void writeXML(std::string &, const std::vector< int > &, const std::vector< int > &, const std::vector< int > &, const std::vector< int > &, const std::vector< float > &)
virtual ~HcalConstantsXMLWriter()