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>
17 using namespace XERCES_CPP_NAMESPACE;
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);
32 parser->parse(filename.c_str());
34 DOMDocument* xmlDoc = parser->getDocument();
36 std::cout <<
"EcalDAQTowerStatusXMLTranslator::Error parsing document" << std::endl;
40 DOMElement* elementRoot = xmlDoc->getDocumentElement();
56 cellnode = cellnode->getNextSibling();
58 while (cellnode && cellnode->getNodeType() != DOMNode::ELEMENT_NODE)
59 cellnode = cellnode->getNextSibling();
82 unique_ptr<DOMImplementation> impl(DOMImplementationRegistry::getDOMImplementation(
cms::xerces::uStr(
"LS").ptr()));
84 DOMLSSerializer* writer = impl->createLSSerializer();
85 if (writer->getDomConfig()->canSetParameter(XMLUni::fgDOMWRTFormatPrettyPrint,
true))
86 writer->getDomConfig()->setParameter(XMLUni::fgDOMWRTFormatPrettyPrint,
true);
88 DOMDocumentType* doctype = impl->createDocumentType(
cms::xerces::uStr(
"XML").ptr(),
nullptr,
nullptr);
91 DOMElement* root = doc->getDocumentElement();
99 if (record.
find(rawid) == record.
end())
101 DOMElement* cellnode =
writeCell(root, rawid);
114 if (record.
find(rawid) == record.
end())
116 DOMElement* cellnode =
writeCell(root, rawid);
130 std::ofstream
fout(fn.c_str());
137 if (record.
find(rawid) == record.
end())
139 int ieta = rawid.
ieta();
140 int line = 17 - ieta;
143 int iphi = rawid.
iphi() - 1;
144 valEB[
line][iphi] = record[rawid].getStatusCode();
147 for (
int iphi = 0; iphi < 72; iphi++)
157 int valEE[2][20][20];
158 for (
int k = 0;
k < 2;
k++)
159 for (
int ix = 0; ix < 20; ix++)
160 for (
int iy = 0; iy < 20; iy++)
161 valEE[
k][ix][iy] = -1;
165 int ix = rawid.
ix() - 1;
166 int iy = 20 - rawid.
iy();
167 int side = rawid.
zside();
171 if (ix < 0 || ix > 19)
172 std::cout <<
" Pb in ix " << ix << std::endl;
173 if (iy < 0 || iy > 19)
174 std::cout <<
" Pb in iy " << iy << std::endl;
175 valEE[iz][ix][iy] = record[rawid].getStatusCode();
178 for (
int k = 0;
k < 2;
k++) {
182 fout <<
" Side : " << iz << std::endl;
184 for (
int ix = 0; ix < 20; ix++) {
185 if (valEE[
k][ix][
line] < 0)
static EcalTrigTowerDetId detIdFromDenseIndex(uint32_t di)
const_iterator end() const
tuple chan
lumi = TPaveText(lowX+0.38, lowY+0.061, lowX+0.45, lowY+0.161, "NDC") lumi.SetBorderSize( 0 ) lumi...
const std::string DAQTowerStatus_tag("EcalDAQTowerStatus")
static EcalScDetId unhashIndex(int hi)
const Items & endcapItems() const
const_iterator find(uint32_t rawId) const
void WriteNodeWithValue(xercesc::DOMNode *parentNode, const std::string &tag, const T &value)
write a node with
int ieta() const
get the tower ieta
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")
const Items & barrelItems() const
void writeHeader(xercesc::DOMNode *parentNode, const EcalCondHeader &header)
write
ZStr< XMLCh > uStr(char const *str)
const std::string DAQStatusCode_tag("DAQStatusCode")
int iphi() const
get the tower iphi
static int readXML(const std::string &filename, EcalCondHeader &header, EcalDAQTowerStatus &record)
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)
xercesc::DOMElement * writeCell(xercesc::DOMNode *node, const DetId &detid)
Append a Cell node with attributes to.
const DetId readCellId(xercesc::DOMElement *node)
Assuming.
tuple dump
OutputFilePath = cms.string('/tmp/zhokin/'), OutputFileExt = cms.string(''),.