#include <EcalClusterEnergyCorrectionObjectSpecificXMLTranslator.h>
Static Public Member Functions | |
static std::string | dumpXML (const EcalCondHeader &header, const EcalFunParams &record) |
static int | readXML (const std::string &filename, EcalCondHeader &header, EcalFunParams &record) |
static int | writeXML (const std::string &filename, const EcalCondHeader &header, const EcalFunParams &record) |
Translates a EcalClusterEnergyCorrection record to XML and vice versa
Definition at line 21 of file EcalClusterEnergyCorrectionObjectSpecificXMLTranslator.h.
std::string EcalClusterEnergyCorrectionObjectSpecificXMLTranslator::dumpXML | ( | const EcalCondHeader & | header, |
const EcalFunParams & | record | ||
) | [static] |
Definition at line 57 of file EcalClusterEnergyCorrectionObjectSpecificXMLTranslator.cc.
References gather_cfg::cout, asciidump::doc, hcal_timing_source_file_cfg::dump, xuti::fromNative(), EcalFunParams::params(), dbtoconf::root, xuti::toNative(), xuti::Value_tag(), xuti::writeHeader(), and xuti::WriteNodeWithValue().
{ XMLPlatformUtils::Initialize(); DOMImplementation* impl = DOMImplementationRegistry::getDOMImplementation(fromNative("LS").c_str()); DOMWriter* writer = static_cast<DOMImplementationLS*>(impl)->createDOMWriter( ); writer->setFeature(XMLUni::fgDOMWRTFormatPrettyPrint, true); DOMDocumentType* doctype = impl->createDocumentType( fromNative("XML").c_str(), 0, 0 ); const std::string ECECOS_tag("EcalClusterEnergyCorrectionObjectSpecific"); DOMDocument * doc = impl->createDocument( 0, fromNative(ECECOS_tag).c_str(), doctype ); doc->setEncoding(fromNative("UTF-8").c_str() ); doc->setStandalone(true); doc->setVersion(fromNative("1.0").c_str() ); DOMElement* root = doc->getDocumentElement(); xuti::writeHeader(root, header); const std::string ECEC_tag[9] = {"fEta","fBremEtaElectrons","fBremEtaPhotons", "fEtElectronsEB","fEtElectronsEE","fEtPhotonsEB","fEtPhotonsEE", "fEnergyElectronsEE","fEnergyPhotonsEE"}; int tit = 0; int par = 0; for ( EcalFunctionParameters::const_iterator it = record.params().begin(); it != record.params().end(); ++it ) { if(par < 2) tit = 0; else if(par < 86) tit = 1; else if(par < 170) tit = 2; else if(par < 177) tit = 3; else if(par < 184) tit = 4; else if(par < 191) tit = 5; else if(par < 198) tit = 6; else if(par < 203) tit = 7; else tit = 8; DOMElement* ECEC = root->getOwnerDocument()->createElement( fromNative(ECEC_tag[tit]).c_str()); root->appendChild(ECEC); WriteNodeWithValue(ECEC,Value_tag,*it); par++; } std::cout << "\n"; std::string dump= toNative(writer->writeToString(*root)); doc->release(); return dump; }
static int EcalClusterEnergyCorrectionObjectSpecificXMLTranslator::readXML | ( | const std::string & | filename, |
EcalCondHeader & | header, | ||
EcalFunParams & | record | ||
) | [static] |
int EcalClusterEnergyCorrectionObjectSpecificXMLTranslator::writeXML | ( | const std::string & | filename, |
const EcalCondHeader & | header, | ||
const EcalFunParams & | record | ||
) | [static] |
Definition at line 115 of file EcalClusterEnergyCorrectionObjectSpecificXMLTranslator.cc.
References EcalCondTools::dumpXML(), and dbtoconf::out.