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>
21 using namespace XERCES_CPP_NAMESPACE;
31 XercesDOMParser*
parser =
new XercesDOMParser;
32 parser->setValidationScheme( XercesDOMParser::Val_Never );
33 parser->setDoNamespaces(
false );
34 parser->setDoSchema(
false );
36 parser->parse(filename.c_str());
38 DOMDocument* xmlDoc = parser->getDocument();
40 std::cout <<
"EcalPulseSymmCovariancesXMLTranslator::Error parsing document" << std::endl;
44 DOMElement* elementRoot = xmlDoc->getDocumentElement();
62 if(
j >=
i) k =
j + (EcalPulseShape::TEMPLATESAMPLES-1)*
i;
63 else k =
i + (EcalPulseShape::TEMPLATESAMPLES-1)*
j;
64 pulsecov_tag[
k] = Form(
"samplecov_%d_%d",
i,
j);
68 DOMNode** covs_node =
new DOMNode*[int(EcalPulseShape::TEMPLATESAMPLES*(EcalPulseShape::TEMPLATESAMPLES+1)/2)];
69 for(
int k=0;
k<EcalPulseShape::TEMPLATESAMPLES*(EcalPulseShape::TEMPLATESAMPLES+1)/2; ++
k) {
74 for(
int k=0;
k<EcalPulseShape::TEMPLATESAMPLES*(EcalPulseShape::TEMPLATESAMPLES+1)/2; ++
k) record[detid].covval[
k] = covs[
k];
76 cellnode = cellnode->getNextSibling();
78 while(cellnode && cellnode->getNodeType() != DOMNode::ELEMENT_NODE)
79 cellnode = cellnode->getNextSibling();
85 std::cout <<
" nb of channels found in xml file " << chan << std::endl;
105 unique_ptr<DOMImplementation> impl( DOMImplementationRegistry::getDOMImplementation(
cms::xerces::uStr(
"LS").ptr()));
107 DOMLSSerializer* writer = impl->createLSSerializer();
108 if( writer->getDomConfig()->canSetParameter( XMLUni::fgDOMWRTFormatPrettyPrint,
true ))
109 writer->getDomConfig()->setParameter( XMLUni::fgDOMWRTFormatPrettyPrint,
true );
111 DOMDocumentType* doctype = impl->createDocumentType(
cms::xerces::uStr(
"XML").ptr(), 0, 0 );
115 DOMElement*
root = doc->getDocumentElement();
124 pulsecov_tag[linK] = Form(
"samplecov_%d_%d",i,j);
134 if (record.
find(rawid) == record.
end())
continue;
136 DOMElement* cellnode=
writeCell(root,rawid);
151 if (record.
find(rawid) == record.
end())
continue;
153 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)
static std::string dumpXML(const EcalCondHeader &header, const EcalPulseSymmCovariances &record)
edm::Service< TFileService > fs