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> 33 std::cout <<
" TPGTowerStatus should not be filled out from an xml file ..." << std::endl;
36 XercesDOMParser*
parser =
new XercesDOMParser;
37 parser->setValidationScheme( XercesDOMParser::Val_Never );
38 parser->setDoNamespaces(
false );
39 parser->setDoSchema(
false );
41 parser->parse(filename.c_str());
43 DOMDocument* xmlDoc = parser->getDocument();
45 std::cout <<
"EcalTPGTowerStatusXMLTranslator::Error parsing document" << std::endl;
49 DOMElement* elementRoot = xmlDoc->getDocumentElement();
82 std::fstream fs(filename.c_str(),
ios::out);
92 unique_ptr<DOMImplementation>
impl( DOMImplementationRegistry::getDOMImplementation(
cms::xerces::uStr(
"LS").ptr()));
94 DOMLSSerializer*
writer = impl->createLSSerializer();
95 if( writer->getDomConfig()->canSetParameter( XMLUni::fgDOMWRTFormatPrettyPrint,
true ))
96 writer->getDomConfig()->setParameter( XMLUni::fgDOMWRTFormatPrettyPrint,
true );
98 DOMDocumentType* doctype = impl->createDocumentType(
cms::xerces::uStr(
"XML").ptr(), 0, 0 );
102 DOMElement*
root = doc->getDocumentElement();
105 std::cout <<
"EcalTPGTowerStatusXMLTranslator::dumpXML" << std::endl;
107 std::cout <<
" tower map size " << towerMap.size() << std::endl;
109 for(it = towerMap.begin(); it != towerMap.end(); ++it) {
110 if((*it).second > 0) {
112 std::cout <<
" TTDetId " << ttId <<
" eta " << ttId.
ieta() <<
" phi " << ttId.
iphi() << std::endl;
113 uint32_t rawid =
ttId;
114 DOMElement* cellnode=
writeCell(root,rawid);
128 std::ofstream
fout(fn.c_str());
131 for(
int iphi = 0; iphi < 72; iphi++)
132 valEB[
line][iphi] = 0;
135 std::cout <<
" tower map size " << towerMap.size() << std::endl;
137 for(it = towerMap.begin(); it != towerMap.end(); ++it) {
138 if((*it).second > 0) {
140 int ieta = ttId.
ieta();
141 int line = 17 - ieta;
143 int iphi = ttId.
iphi() - 1;
144 valEB[
line][iphi] = (*it).second;
148 for(
int iphi = 0; iphi < 72; iphi++)
std::map< uint32_t, uint16_t >::const_iterator EcalTPGTowerStatusMapIterator
std::map< uint32_t, uint16_t > EcalTPGTowerStatusMap
unsigned ttId(DetId const &)
void WriteNodeWithValue(xercesc::DOMNode *parentNode, const std::string &tag, const T &value)
write a node with
int ieta() const
get the tower ieta
const std::string TPGTowerStatus_tag("EcalTPGTowerStatus")
std::string toString(XMLCh const *toTranscode)
void readHeader(xercesc::DOMNode *parentNode, EcalCondHeader &header)
read header from
static std::string dumpXML(const EcalCondHeader &header, const EcalTPGTowerStatus &record)
void writeHeader(xercesc::DOMNode *parentNode, const EcalCondHeader &header)
write
ZStr< XMLCh > uStr(char const *str)
int iphi() const
get the tower iphi
const std::map< uint32_t, uint16_t > & getMap() const
static void plot(std::string, const EcalTPGTowerStatus &record)
xercesc::DOMElement * writeCell(xercesc::DOMNode *node, const DetId &detid)
Append a Cell node with attributes to.
static int readXML(const std::string &filename, EcalCondHeader &header, EcalTPGTowerStatus &record)
static int writeXML(const std::string &filename, const EcalCondHeader &header, const EcalTPGTowerStatus &record)