5 #include <xercesc/dom/DOMNode.hpp>
6 #include <xercesc/dom/DOM.hpp>
7 #include <xercesc/parsers/XercesDOMParser.hpp>
10 #include <xercesc/util/XMLString.hpp>
11 #include <xercesc/sax/SAXException.hpp>
12 #include <xercesc/framework/LocalFileFormatTarget.hpp>
20 using namespace XERCES_CPP_NAMESPACE;
29 XercesDOMParser*
parser =
new XercesDOMParser;
30 parser->setValidationScheme(XercesDOMParser::Val_Never);
31 parser->setDoNamespaces(
false);
32 parser->setDoSchema(
false);
34 parser->parse(filename.c_str());
36 DOMDocument* xmlDoc = parser->getDocument();
38 std::cout <<
"EcalPulseSymmCovariancesXMLTranslator::Error parsing document" << std::endl;
42 DOMElement* elementRoot = xmlDoc->getDocumentElement();
56 std::vector<std::string> pulsecov_tag(
62 k =
j + (EcalPulseShape::TEMPLATESAMPLES - 1) *
i;
64 k =
i + (EcalPulseShape::TEMPLATESAMPLES - 1) *
j;
65 pulsecov_tag[
k] = Form(
"samplecov_%d_%d",
i,
j);
70 new DOMNode*[int(EcalPulseShape::TEMPLATESAMPLES * (EcalPulseShape::TEMPLATESAMPLES + 1) / 2)];
71 for (
int k = 0;
k < EcalPulseShape::TEMPLATESAMPLES * (EcalPulseShape::TEMPLATESAMPLES + 1) / 2; ++
k) {
76 for (
int k = 0;
k < EcalPulseShape::TEMPLATESAMPLES * (EcalPulseShape::TEMPLATESAMPLES + 1) / 2; ++
k)
77 record[detid].covval[
k] = covs[
k];
79 cellnode = cellnode->getNextSibling();
81 while (cellnode && cellnode->getNodeType() != DOMNode::ELEMENT_NODE)
82 cellnode = cellnode->getNextSibling();
88 std::cout <<
" nb of channels found in xml file " << chan << std::endl;
97 std::fstream fs(filename.c_str(),
ios::out);
107 unique_ptr<DOMImplementation> impl(DOMImplementationRegistry::getDOMImplementation(
cms::xerces::uStr(
"LS").ptr()));
109 DOMLSSerializer* writer = impl->createLSSerializer();
110 if (writer->getDomConfig()->canSetParameter(XMLUni::fgDOMWRTFormatPrettyPrint,
true))
111 writer->getDomConfig()->setParameter(XMLUni::fgDOMWRTFormatPrettyPrint,
true);
113 DOMDocumentType* doctype = impl->createDocumentType(
cms::xerces::uStr(
"XML").ptr(),
nullptr,
nullptr);
116 DOMElement* root = doc->getDocumentElement();
127 pulsecov_tag[linK] = Form(
"samplecov_%d_%d", i, j);
136 if (record.
find(rawid) == record.
end())
139 DOMElement* cellnode =
writeCell(root, rawid);
153 if (record.
find(rawid) == record.
end())
156 DOMElement* cellnode =
writeCell(root, rawid);
tuple chan
lumi = TPaveText(lowX+0.38, lowY+0.061, lowX+0.45, lowY+0.161, "NDC") lumi.SetBorderSize( 0 ) lumi...
const Items & barrelItems() const
static const int TEMPLATESAMPLES
static EEDetId unhashIndex(int hi)
void WriteNodeWithValue(xercesc::DOMNode *parentNode, const std::string &tag, const T &value)
write a node with
static bool validHashIndex(int i)
std::string toString(XMLCh const *toTranscode)
static int writeXML(const std::string &filename, const EcalCondHeader &header, const EcalPulseSymmCovariances &record)
void readHeader(xercesc::DOMNode *parentNode, EcalCondHeader &header)
read header from
static const int MIN_HASH
const std::string Cell_tag("cell")
void writeHeader(xercesc::DOMNode *parentNode, const EcalCondHeader &header)
write
ZStr< XMLCh > uStr(char const *str)
void GetNodeData(xercesc::DOMNode *node, T &value)
get the node data
xercesc::DOMNode * getChildNode(xercesc::DOMNode *node, const std::string &nodename)
get the child of
const std::string PulseSymmCovariances_tag("EcalPulseSymmCovariances")
static EBDetId unhashIndex(int hi)
get a DetId from a compact index for arrays
const_iterator find(uint32_t rawId) const
static int readXML(const std::string &filename, EcalCondHeader &header, EcalPulseSymmCovariances &record)
const_iterator end() const
xercesc::DOMElement * writeCell(xercesc::DOMNode *node, const DetId &detid)
Append a Cell node with attributes to.
const Items & endcapItems() const
const DetId readCellId(xercesc::DOMElement *node)
Assuming.
Power< A, B >::type pow(const A &a, const B &b)
tuple dump
OutputFilePath = cms.string('/tmp/zhokin/'), OutputFileExt = cms.string(''),.
static std::string dumpXML(const EcalCondHeader &header, const EcalPulseSymmCovariances &record)