4 #include <xercesc/dom/DOMNode.hpp> 5 #include <xercesc/dom/DOM.hpp> 6 #include <xercesc/parsers/XercesDOMParser.hpp> 9 #include <xercesc/util/XMLString.hpp> 10 #include <xercesc/sax/SAXException.hpp> 11 #include <xercesc/framework/LocalFileFormatTarget.hpp> 24 std::cout <<
" DAQTowerStatus should not be filled out from an xml file ..." << std::endl;
27 XercesDOMParser*
parser =
new XercesDOMParser;
28 parser->setValidationScheme(XercesDOMParser::Val_Never);
29 parser->setDoNamespaces(
false);
30 parser->setDoSchema(
false);
34 DOMDocument* xmlDoc =
parser->getDocument();
36 std::cout <<
"EcalDAQTowerStatusXMLTranslator::Error parsing document" << std::endl;
40 DOMElement* elementRoot = xmlDoc->getDocumentElement();
55 cellnode = cellnode->getNextSibling();
57 while (cellnode && cellnode->getNodeType() != DOMNode::ELEMENT_NODE)
58 cellnode = cellnode->getNextSibling();
80 unique_ptr<DOMImplementation>
impl(DOMImplementationRegistry::getDOMImplementation(
cms::xerces::uStr(
"LS").ptr()));
82 DOMLSSerializer*
writer =
impl->createLSSerializer();
83 if (
writer->getDomConfig()->canSetParameter(XMLUni::fgDOMWRTFormatPrettyPrint,
true))
84 writer->getDomConfig()->setParameter(XMLUni::fgDOMWRTFormatPrettyPrint,
true);
86 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 constexpr int kEBTotalTowers
static EcalTrigTowerDetId detIdFromDenseIndex(uint32_t di)
int ieta() const
get the tower ieta
const std::string DAQTowerStatus_tag("EcalDAQTowerStatus")
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
static int writeXML(const std::string &filename, const EcalCondHeader &header, const EcalDAQTowerStatus &record)
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 DAQStatusCode_tag("DAQStatusCode")
ALPAKA_FN_ACC ALPAKA_FN_INLINE uint32_t ix(uint32_t id)
static int readXML(const std::string &filename, EcalCondHeader &header, EcalDAQTowerStatus &record)
static constexpr int kEETotalTowers
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 void plot(std::string, const EcalDAQTowerStatus &record)
static bool validHashIndex(int hi)
static std::string dumpXML(const EcalCondHeader &header, const EcalDAQTowerStatus &record)
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.
int iphi() const
get the tower iphi
const DetId readCellId(xercesc::DOMElement *node)
Assuming.