6 #include <xercesc/dom/DOMNode.hpp>
7 #include <xercesc/dom/DOM.hpp>
8 #include <xercesc/dom/DOMCharacterData.hpp>
9 #include <xercesc/parsers/XercesDOMParser.hpp>
11 #include <xercesc/framework/LocalFileFormatTarget.hpp>
12 #include <xercesc/util/XMLUni.hpp>
13 #include <xercesc/util/XMLURL.hpp>
19 using namespace xercesc;
24 const std::vector<int>& detvec,
25 const std::vector<int>& etavec,
26 const std::vector<int>& phivec,
27 const std::vector<int>& depthvec,
28 const std::vector<float>& scalevec) {
29 int nn = newfile0.size();
31 for (
int i = 0;
i <
nn;
i++) {
34 char const* fend =
"\0";
41 std::ostream fOut(&fb);
45 XMLString::transcode(
"Core", tempStr, 99);
46 std::unique_ptr<DOMImplementation> mDom(DOMImplementationRegistry::getDOMImplementation(tempStr));
48 XMLString::transcode(
"CalibrationConstants", tempStr, 99);
49 mDoc = mDom->createDocument(
nullptr,
54 DOMLSSerializer* domWriter = mDom->createLSSerializer();
55 domWriter->getDomConfig()->setParameter(XMLUni::fgDOMWRTFormatPrettyPrint,
true);
56 DOMElement*
root = mDoc->getDocumentElement();
58 XMLString::transcode(
"Hcal", tempStr, 99);
59 DOMElement* rootelem = mDoc->createElement(tempStr);
60 root->appendChild(rootelem);
62 XMLString::transcode(
"Cell", tempStr, 99);
63 std::vector<DOMElement*> theDOMVec;
65 for (
unsigned int i = 0;
i < detvec.size();
i++) {
66 theDOMVec.push_back(mDoc->createElement(tempStr));
67 newCellLine(theDOMVec[
i], detvec[
i], etavec[
i], phivec[
i], depthvec[
i], scalevec[
i]);
68 rootelem->appendChild(theDOMVec[
i]);
71 std::cout <<
" Write Doc " << theDOMVec.size() << std::endl;
72 DOMLSOutput*
output = mDom->createLSOutput();
73 output->setByteStream(&formTarget);
74 domWriter->write(mDoc,
output);
75 std::cout <<
" End of Writting " << std::endl;
83 XMLString::transcode(
"det_index", tempStr, 99);
84 DOMAttr* attrdet = mDoc->createAttribute(tempStr);
86 XMLString::transcode(
"eta_index", tempStr, 99);
87 DOMAttr* attreta = mDoc->createAttribute(tempStr);
89 XMLString::transcode(
"phi_index", tempStr, 99);
90 DOMAttr* attrphi = mDoc->createAttribute(tempStr);
92 XMLString::transcode(
"depth_index", tempStr, 99);
93 DOMAttr* attrdepth = mDoc->createAttribute(tempStr);
95 XMLString::transcode(
"scale_factor", tempStr, 99);
96 DOMAttr* attrscale = mDoc->createAttribute(tempStr);
98 std::ostringstream ost;
100 attrdet->setValue(XMLString::transcode(ost.str().c_str()));
101 detelem->setAttributeNode(attrdet);
103 std::ostringstream ost1;
105 attreta->setValue(XMLString::transcode(ost1.str().c_str()));
107 detelem->setAttributeNode(attreta);
109 std::ostringstream ost2;
111 attrphi->setValue(XMLString::transcode(ost2.str().c_str()));
113 detelem->setAttributeNode(attrphi);
115 std::ostringstream ost3;
117 attrdepth->setValue(XMLString::transcode(ost3.str().c_str()));
119 detelem->setAttributeNode(attrdepth);
121 std::ostringstream ost4;
123 attrscale->setValue(XMLString::transcode(ost4.str().c_str()));
125 detelem->setAttributeNode(attrscale);