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> 26 std::cout <<
"EcalFloatCondObjectContainerXMLTranslatorr::readXML filename " <<
filename << std::endl;
84 if (!fxml.is_open()) {
89 for (
int i = 0;
i < 6;
i++) {
90 getline(fxml, dummyLine);
96 std::istringstream iEB(stt);
100 std::cout <<
" strange number of EB channels " << nEB << std::endl;
104 for (
int iChannel = 0; iChannel <
kEBChannels; iChannel++) {
107 std::size_t
found = bid.find(
"</");
108 stt = bid.substr(6,
found - 6);
109 float val = std::stof(stt);
112 for (
int i = 0;
i < 5;
i++) {
113 getline(fxml, dummyLine);
118 stt = bid.substr(7, 5);
119 std::istringstream iEE(stt);
123 std::cout <<
" strange number of EE channels " << nEE << std::endl;
128 for (
int iChannel = 0; iChannel <
kEEChannels; iChannel++) {
131 std::size_t
found = bid.find(
"</");
132 stt = bid.substr(6,
found - 6);
133 float val = std::stof(stt);
145 return record.barrelItems();
153 return record.endcapItems();
157 const std::vector<float>& eb,
158 const std::vector<float>& ee) {
160 std::cerr <<
"Error in EcalFloatCondObjectContainerXMLTranslator::dumpXML, invalid Barrel array size: " << eb.size()
166 std::cerr <<
"Error in EcalFloatCondObjectContainerXMLTranslator::dumpXML, invalid Endcap array size: " << ee.size()
176 record[rawid] = eb[cellid];
184 record[rawid] = ee[cellid];
195 unique_ptr<DOMImplementation>
impl(DOMImplementationRegistry::getDOMImplementation(
cms::xerces::uStr(
"LS").ptr()));
197 DOMLSSerializer*
writer =
impl->createLSSerializer();
198 if (
writer->getDomConfig()->canSetParameter(XMLUni::fgDOMWRTFormatPrettyPrint,
true))
199 writer->getDomConfig()->setParameter(XMLUni::fgDOMWRTFormatPrettyPrint,
true);
201 DOMDocumentType* doctype =
impl->createDocumentType(
cms::xerces::uStr(
"XML").ptr(),
nullptr,
nullptr);
204 DOMElement*
root =
doc->getDocumentElement();
212 if (value_ptr ==
record.end())
228 if (value_ptr ==
record.end())
static constexpr int kSizeForDenseIndexing
static int writeXML(const std::string &filename, const EcalCondHeader &header, const EcalFloatCondObjectContainer &record)
static std::vector< float > barrelfromXML(const std::string &filename)
const std::string EcalFloatCondObjectContainer_tag("EcalFloatCondObjectContainer")
static EEDetId unhashIndex(int hi)
static int readXML(const std::string &filename, EcalCondHeader &header, EcalFloatCondObjectContainer &record)
void WriteNodeWithValue(xercesc::DOMNode *parentNode, const std::string &tag, const T &value)
write a node with
const std::string Value_tag("Value")
static bool validHashIndex(int i)
std::string toString(XMLCh const *toTranscode)
static constexpr int kSizeForDenseIndexing
static const int MIN_HASH
void writeHeader(xercesc::DOMNode *parentNode, const EcalCondHeader &header)
write
ZStr< XMLCh > uStr(char const *str)
static std::vector< float > endcapfromXML(const std::string &filename)
std::vector< Item >::const_iterator const_iterator
static std::string dumpXML(const EcalCondHeader &header, const std::vector< float > &eb, const std::vector< float > &ee)
static EBDetId unhashIndex(int hi)
get a DetId from a compact index for arrays
xercesc::DOMElement * writeCell(xercesc::DOMNode *node, const DetId &detid)
Append a Cell node with attributes to.