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 using namespace XERCES_CPP_NAMESPACE;
31 std::cout <<
" TPGTowerStatus should not be filled out from an xml file ..." << std::endl;
34 XercesDOMParser*
parser =
new XercesDOMParser;
35 parser->setValidationScheme(XercesDOMParser::Val_Never);
36 parser->setDoNamespaces(
false);
37 parser->setDoSchema(
false);
39 parser->parse(filename.c_str());
41 DOMDocument* xmlDoc = parser->getDocument();
43 std::cout <<
"EcalTPGTowerStatusXMLTranslator::Error parsing document" << std::endl;
47 DOMElement* elementRoot = xmlDoc->getDocumentElement();
79 std::fstream fs(filename.c_str(),
ios::out);
88 unique_ptr<DOMImplementation> impl(DOMImplementationRegistry::getDOMImplementation(
cms::xerces::uStr(
"LS").ptr()));
90 DOMLSSerializer* writer = impl->createLSSerializer();
91 if (writer->getDomConfig()->canSetParameter(XMLUni::fgDOMWRTFormatPrettyPrint,
true))
92 writer->getDomConfig()->setParameter(XMLUni::fgDOMWRTFormatPrettyPrint,
true);
94 DOMDocumentType* doctype = impl->createDocumentType(
cms::xerces::uStr(
"XML").ptr(),
nullptr,
nullptr);
97 DOMElement* root = doc->getDocumentElement();
100 std::cout <<
"EcalTPGTowerStatusXMLTranslator::dumpXML" << std::endl;
102 std::cout <<
" tower map size " << towerMap.size() << std::endl;
104 for (it = towerMap.begin(); it != towerMap.end(); ++it) {
105 if ((*it).second > 0) {
107 std::cout <<
" TTDetId " << ttId <<
" eta " << ttId.
ieta() <<
" phi " << ttId.
iphi() << std::endl;
108 uint32_t rawid =
ttId;
109 DOMElement* cellnode =
writeCell(root, rawid);
123 std::ofstream
fout(fn.c_str());
126 for (
int iphi = 0; iphi < 72; iphi++)
127 valEB[
line][iphi] = 0;
130 std::cout <<
" tower map size " << towerMap.size() << std::endl;
132 for (it = towerMap.begin(); it != towerMap.end(); ++it) {
133 if ((*it).second > 0) {
135 int ieta = ttId.
ieta();
136 int line = 17 - ieta;
139 int iphi = ttId.
iphi() - 1;
140 valEB[
line][iphi] = (*it).second;
144 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 &, EcalElectronicsMapping 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)
tuple dump
OutputFilePath = cms.string('/tmp/zhokin/'), OutputFileExt = cms.string(''),.