6 #include <xercesc/dom/DOMNode.hpp> 7 #include <xercesc/dom/DOM.hpp> 8 #include <xercesc/parsers/XercesDOMParser.hpp> 9 #include <xercesc/util/XMLString.hpp> 10 #include <xercesc/sax/SAXException.hpp> 11 #include <xercesc/framework/LocalFileFormatTarget.hpp> 26 fstream fs(filename.c_str(),
ios::out);
37 unique_ptr<DOMImplementation>
impl( DOMImplementationRegistry::getDOMImplementation(
cms::xerces::uStr(
"LS").ptr()));
39 DOMLSSerializer*
writer = impl->createLSSerializer();
40 if( writer->getDomConfig()->canSetParameter( XMLUni::fgDOMWRTFormatPrettyPrint,
true ))
41 writer->getDomConfig()->setParameter( XMLUni::fgDOMWRTFormatPrettyPrint,
true );
43 DOMDocumentType* doctype = impl->createDocumentType(
cms::xerces::uStr(
"XML").ptr(),
nullptr,
nullptr );
45 DOMElement*
root = doc->getDocumentElement();
49 for ( vector<AlignTransform>::const_iterator it = record.
m_align.begin();
50 it != record.
m_align.end(); it++ ) {
51 int Id = (*it).rawId();
52 int sub = (Id>>24)&0xF;
59 int side = (Id>>16)&1;
68 if(SM < 10) subdet <<
"0" << SM;
76 int side = (Id>>14)&1;
84 if(x == 20) subdet <<
"F";
85 else if(x == 70) subdet <<
"N";
86 else cout <<
" strange value for x " << x << endl;
93 int plane = (Id>>18)&1;
94 int side = (Id>>19)&1;
95 if(side == 0) subdet <<
"-";
97 if(plane) subdet <<
"F";
99 if(x/30) subdet <<
"F";
102 else cout <<
" problem sub = " << sub << endl;
103 cout << (*it).rawId()
104 <<
" " << (*it).rotation().getPhi()
105 <<
" " << (*it).rotation().getTheta()
106 <<
" " << (*it).rotation().getPsi()
107 <<
" " << (*it).translation().x()
108 <<
" " << (*it).translation().y()
109 <<
" " << (*it).translation().z()
111 uint32_t rawid = (*it).rawId();
112 DOMElement* cellnode =
114 root->appendChild(cellnode);
const std::string Phi_tag("Phi")
const std::string x_tag("x")
const std::string id_tag("id")
std::vector< AlignTransform > m_align
void WriteNodeWithValue(xercesc::DOMNode *parentNode, const std::string &tag, const T &value)
write a node with
static std::string dumpXML(const EcalCondHeader &header, const Alignments &record)
std::string toString(XMLCh const *toTranscode)
static int writeXML(const std::string &filename, const EcalCondHeader &header, const Alignments &record)
const std::string y_tag("y")
const std::string Cell_tag("cell")
const std::string subdet_tag("SubDet")
void writeHeader(xercesc::DOMNode *parentNode, const EcalCondHeader &header)
write
ZStr< XMLCh > uStr(char const *str)
const std::string z_tag("z")
const std::string Psi_tag("Psi")
const std::string Theta_tag("Theta")
const std::string AlignmentConstant_tag("EcalAlignmentConstant")