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> 27 std::cout <<
"EcalFloatCondObjectContainerXMLTranslatorr::readXML filename " << filename << std::endl;
86 std::cout <<
"ERROR : cannot open file " << filename << std::endl;
90 for(
int i=0;
i< 6;
i++) {
91 getline(fxml, dummyLine);
97 std::istringstream iEB(stt);
101 std::cout <<
" strange number of EB channels " << nEB << std::endl;
105 for (
int iChannel = 0; iChannel <
kEBChannels; iChannel++) {
108 std::size_t
found = bid.find(
"</");
109 stt = bid.substr(6, found - 6);
110 float val = std::stof(stt);
111 record[myEBDetId] =
val;
113 for(
int i=0;
i< 5;
i++) {
114 getline(fxml, dummyLine);
119 stt = bid.substr(7,5);
120 std::istringstream iEE(stt);
124 std::cout <<
" strange number of EE channels " << nEE << std::endl;
129 for (
int iChannel = 0; iChannel <
kEEChannels; iChannel++) {
132 std::size_t
found = bid.find(
"</");
133 stt = bid.substr(6, found - 6);
134 float val = std::stof(stt);
135 record[myEEDetId] =
val;
148 readXML(filename,header,record);
159 readXML(filename,header,record);
170 const std::vector<float>& eb,
171 const std::vector<float>& ee){
175 std::cerr<<
"Error in EcalFloatCondObjectContainerXMLTranslator::dumpXML, invalid Barrel array size: " 181 std::cerr<<
"Error in EcalFloatCondObjectContainerXMLTranslator::dumpXML, invalid Endcap array size: " 193 record[rawid] = eb[cellid];
205 record[rawid]=ee[cellid];
221 unique_ptr<DOMImplementation>
impl( DOMImplementationRegistry::getDOMImplementation(
cms::xerces::uStr(
"LS").ptr()));
223 DOMLSSerializer*
writer = impl->createLSSerializer();
224 if( writer->getDomConfig()->canSetParameter( XMLUni::fgDOMWRTFormatPrettyPrint,
true ))
225 writer->getDomConfig()->setParameter( XMLUni::fgDOMWRTFormatPrettyPrint,
true );
227 DOMDocumentType* doctype = impl->createDocumentType(
cms::xerces::uStr(
"XML").ptr(),
nullptr,
nullptr );
229 DOMElement*
root = doc->getDocumentElement();
240 if (value_ptr==record.
end())
continue;
242 DOMElement* cellnode=
writeCell(root,rawid);
260 if (value_ptr==record.
end())
continue;
263 DOMElement* cellnode=
writeCell(root,rawid);
289 std::fstream fs(filename.c_str(),
ios::out);
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")
const Items & barrelItems() const
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 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
const_iterator find(uint32_t rawId) const
const_iterator end() const
xercesc::DOMElement * writeCell(xercesc::DOMNode *node, const DetId &detid)
Append a Cell node with attributes to.
const Items & endcapItems() const