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> 25 std::cout <<
" DCSTowerStatus should not be filled out from an xml file ..." << std::endl;
28 XercesDOMParser*
parser =
new XercesDOMParser;
29 parser->setValidationScheme(XercesDOMParser::Val_Never);
30 parser->setDoNamespaces(
false);
31 parser->setDoSchema(
false);
35 DOMDocument* xmlDoc =
parser->getDocument();
37 std::cout <<
"EcalDCSTowerStatusXMLTranslator::Error parsing document" << std::endl;
41 DOMElement* elementRoot = xmlDoc->getDocumentElement();
56 cellnode = cellnode->getNextSibling();
58 while (cellnode && cellnode->getNodeType() != DOMNode::ELEMENT_NODE)
59 cellnode = cellnode->getNextSibling();
81 unique_ptr<DOMImplementation>
impl(DOMImplementationRegistry::getDOMImplementation(
cms::xerces::uStr(
"LS").ptr()));
83 DOMLSSerializer*
writer =
impl->createLSSerializer();
84 if (
writer->getDomConfig()->canSetParameter(XMLUni::fgDOMWRTFormatPrettyPrint,
true))
85 writer->getDomConfig()->setParameter(XMLUni::fgDOMWRTFormatPrettyPrint,
true);
87 DOMDocumentType* doctype =
impl->createDocumentType(
cms::xerces::uStr(
"XML").ptr(),
nullptr,
nullptr);
89 DOMElement*
root =
doc->getDocumentElement();
92 std::cout <<
" barrel size " <<
record.barrelItems().size() << std::endl;
93 if (
record.barrelItems().empty())
104 std::cout <<
" endcap size " <<
record.endcapItems().size() << std::endl;
105 if (
record.endcapItems().empty())
128 std::ofstream
fout(
fn.c_str());
130 std::cout <<
" barrel size " <<
record.barrelItems().size() << std::endl;
131 if (
record.barrelItems().empty())
152 std::cout <<
" endcap size " <<
record.endcapItems().size() << std::endl;
153 if (
record.endcapItems().empty())
155 int valEE[2][20][20];
156 for (
int k = 0;
k < 2;
k++)
157 for (
int ix = 0;
ix < 20;
ix++)
158 for (
int iy = 0;
iy < 20;
iy++)
159 valEE[
k][
ix][
iy] = -1;
163 int ix = rawid.
ix() - 1;
164 int iy = 20 - rawid.
iy();
169 if (ix < 0 || ix > 19)
171 if (iy < 0 || iy > 19)
173 valEE[iz][
ix][
iy] =
record[rawid].getStatusCode();
176 for (
int k = 0;
k < 2;
k++) {
180 fout <<
" Side : " << iz << std::endl;
182 for (
int ix = 0;
ix < 20;
ix++) {
static int readXML(const std::string &filename, EcalCondHeader &header, EcalDCSTowerStatus &record)
static EcalTrigTowerDetId detIdFromDenseIndex(uint32_t di)
const std::string DCSTowerStatus_tag("EcalDCSTowerStatus")
int ieta() const
get the tower ieta
static void plot(std::string, const EcalDCSTowerStatus &record)
ALPAKA_FN_ACC int side(int ieta, int iphi)
static EcalScDetId unhashIndex(int hi)
void WriteNodeWithValue(xercesc::DOMNode *parentNode, const std::string &tag, const T &value)
write a node with
std::string toString(XMLCh const *toTranscode)
void readHeader(xercesc::DOMNode *parentNode, EcalCondHeader &header)
read header from
const std::string Cell_tag("cell")
void writeHeader(xercesc::DOMNode *parentNode, const EcalCondHeader &header)
write
ZStr< XMLCh > uStr(char const *str)
const std::string DCSStatusCode_tag("DCSStatusCode")
ALPAKA_FN_ACC ALPAKA_FN_INLINE uint32_t ix(uint32_t id)
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
static int writeXML(const std::string &filename, const EcalCondHeader &header, const EcalDCSTowerStatus &record)
static bool validHashIndex(int hi)
ALPAKA_FN_ACC ALPAKA_FN_INLINE uint32_t iy(uint32_t id)
xercesc::DOMElement * writeCell(xercesc::DOMNode *node, const DetId &detid)
Append a Cell node with attributes to.
static std::string dumpXML(const EcalCondHeader &header, const EcalDCSTowerStatus &record)
int iphi() const
get the tower iphi
const DetId readCellId(xercesc::DOMElement *node)
Assuming.