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>
18 using namespace XERCES_CPP_NAMESPACE;
26 std::cout <<
" DCSTowerStatus should not be filled out from an xml file ..." << std::endl;
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 <<
"EcalDCSTowerStatusXMLTranslator::Error parsing document" << std::endl;
42 DOMElement* elementRoot = xmlDoc->getDocumentElement();
58 cellnode = cellnode->getNextSibling();
60 while(cellnode && cellnode->getNodeType() != DOMNode::ELEMENT_NODE)
61 cellnode = cellnode->getNextSibling();
85 unique_ptr<DOMImplementation> impl( DOMImplementationRegistry::getDOMImplementation(
cms::xerces::uStr(
"LS").ptr()));
87 DOMLSSerializer* writer = impl->createLSSerializer();
88 if( writer->getDomConfig()->canSetParameter( XMLUni::fgDOMWRTFormatPrettyPrint,
true ))
89 writer->getDomConfig()->setParameter( XMLUni::fgDOMWRTFormatPrettyPrint,
true );
91 DOMDocumentType* doctype = impl->createDocumentType(
cms::xerces::uStr(
"XML").ptr(), 0, 0 );
93 DOMElement*
root = doc->getDocumentElement();
102 if (record.
find(rawid) == record.
end())
continue;
103 DOMElement* cellnode=
writeCell(root,rawid);
116 if (record.
find(rawid) == record.
end())
continue;
117 DOMElement* cellnode=
writeCell(root,rawid);
131 std::ofstream
fout(fn.c_str());
139 if (record.
find(rawid) == record.
end())
continue;
140 int ieta = rawid.
ieta();
141 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++)
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;
165 int ix = rawid.
ix() - 1;
166 int iy = 20 - rawid.
iy();
167 int side = rawid.
zside();
169 if(side == -1) iz = 0;
170 if(ix < 0 || ix > 19)
std::cout <<
" Pb in ix " << ix << std::endl;
171 if(iy < 0 || iy > 19)
std::cout <<
" Pb in iy " << iy << std::endl;
172 valEE[iz][ix][iy] = record[rawid].getStatusCode();
175 for(
int k = 0 ;
k < 2;
k++ ) {
178 fout <<
" Side : " << iz << std::endl;
180 for(
int ix = 0 ; ix < 20; ix++) {
181 if(valEE[
k][ix][
line] < 0)
fout <<
" . ";
182 else fout << setw(2) << valEE[
k][ix][
line] <<
" ";
static int readXML(const std::string &filename, EcalCondHeader &header, EcalDCSTowerStatus &record)
static EcalTrigTowerDetId detIdFromDenseIndex(uint32_t di)
const std::string DCSTowerStatus_tag("EcalDCSTowerStatus")
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...
static void plot(std::string, const EcalDCSTowerStatus &record)
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
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 DCSStatusCode_tag("DCSStatusCode")
int iphi() const
get the tower iphi
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)
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)
const DetId readCellId(xercesc::DOMElement *node)
Assuming.
edm::Service< TFileService > fs