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> 26 std::cout <<
" DAQTowerStatus 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 <<
"EcalDAQTowerStatusXMLTranslator::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();
77 std::fstream fs(filename.c_str(),
ios::out);
89 unique_ptr<DOMImplementation>
impl( DOMImplementationRegistry::getDOMImplementation(
cms::xerces::uStr(
"LS").ptr()));
91 DOMLSSerializer*
writer = impl->createLSSerializer();
92 if( writer->getDomConfig()->canSetParameter( XMLUni::fgDOMWRTFormatPrettyPrint,
true ))
93 writer->getDomConfig()->setParameter( XMLUni::fgDOMWRTFormatPrettyPrint,
true );
95 DOMDocumentType* doctype = impl->createDocumentType(
cms::xerces::uStr(
"XML").ptr(),
nullptr,
nullptr );
99 DOMElement*
root = doc->getDocumentElement();
108 if (record.
find(rawid) == record.
end())
continue;
109 DOMElement* cellnode=
writeCell(root,rawid);
122 if (record.
find(rawid) == record.
end())
continue;
123 DOMElement* cellnode =
writeCell(root,rawid);
137 std::ofstream
fout(fn.c_str());
145 if (record.
find(rawid) == record.
end())
continue;
146 int ieta = rawid.
ieta();
147 int line = 17 - ieta;
149 int iphi = rawid.
iphi() - 1;
150 valEB[
line][iphi] = record[rawid].getStatusCode();
153 for(
int iphi = 0; iphi < 72; iphi++)
161 int valEE[2][20][20];
162 for(
int k = 0 ;
k < 2;
k++ )
163 for(
int ix = 0 ; ix < 20; ix++)
164 for(
int iy = 0 ; iy < 20; iy++)
165 valEE[
k][ix][iy] = -1;
171 int ix = rawid.
ix() - 1;
172 int iy = 20 - rawid.
iy();
173 int side = rawid.
zside();
175 if(side == -1) iz = 0;
176 if(ix < 0 || ix > 19)
std::cout <<
" Pb in ix " << ix << std::endl;
177 if(iy < 0 || iy > 19)
std::cout <<
" Pb in iy " << iy << std::endl;
178 valEE[iz][ix][iy] = record[rawid].getStatusCode();
181 for(
int k = 0 ;
k < 2;
k++ ) {
184 fout <<
" Side : " << iz << std::endl;
186 for(
int ix = 0 ; ix < 20; ix++) {
static EcalTrigTowerDetId detIdFromDenseIndex(uint32_t di)
const_iterator end() const
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)
chan
lumi = TPaveText(lowX+0.38, lowY+0.061, lowX+0.45, lowY+0.161, "NDC") lumi.SetBorderSize( 0 ) lumi...
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.