Translates a EcalLinearCorrections record to XML and vice versa
- Author
- Stefano ARGIRO
- Version
- Id
- EcalLinearCorrectionsXMLTranslator.h,v 1.1 2012/11/21 17:01:39 fra Exp
- Date
- 20 Jun 2008
Definition at line 16 of file EcalLinearCorrectionsXMLTranslator.h.
Definition at line 111 of file EcalLinearCorrectionsXMLTranslator.cc.
113 unique_ptr<DOMImplementation>
impl(DOMImplementationRegistry::getDOMImplementation(
cms::xerces::uStr(
"LS").ptr()));
115 DOMLSSerializer*
writer =
impl->createLSSerializer();
116 if (
writer->getDomConfig()->canSetParameter(XMLUni::fgDOMWRTFormatPrettyPrint,
true))
117 writer->getDomConfig()->setParameter(XMLUni::fgDOMWRTFormatPrettyPrint,
true);
119 DOMDocumentType* doctype =
impl->createDocumentType(
cms::xerces::uStr(
"XML").ptr(),
nullptr,
nullptr);
122 DOMElement*
root =
doc->getDocumentElement();
126 string Lasertag =
"Laser", LMtag =
"LM";
127 for (
int cellid = 0; cellid < (
int)
record.getTimeMap().size(); cellid++) {
129 root->appendChild(cellnode);
130 stringstream value_s;
135 t123[0] = (
record.getTimeMap())[cellid].
t1.value();
136 t123[1] = (
record.getTimeMap())[cellid].
t2.value();
137 t123[2] = (
record.getTimeMap())[cellid].
t3.value();
138 string Laser_t_tag[3] = {
"t1",
"t2",
"t3"};
139 for (
int i = 0;
i < 3;
i++) {
140 time_t
t = t123[
i] >> 32;
143 localtime_r(&
t, <);
144 strftime(
buf,
sizeof(
buf),
"%F %R:%S", <);
146 DOMDocument* subdoc = cellnode->getOwnerDocument();
147 DOMElement* new_node = subdoc->createElement(
cms::xerces::uStr(Laser_t_tag[
i].c_str()).ptr());
148 cellnode->appendChild(new_node);
149 std::stringstream value_ss;
151 string newstr = value_ss.str() +
" [" +
string(
buf) +
"]";
152 DOMText* tvalue = subdoc->createTextNode(
cms::xerces::uStr(newstr.c_str()).ptr());
153 new_node->appendChild(tvalue);
References visDQMUpload::buf, boostedTaus_cff::doc, submitPVValidationJobs::dump, RecoTauValidation_cfi::header, mps_fire::i, createfilelist::int, EBDetId::kSizeForDenseIndexing, EEDetId::kSizeForDenseIndexing, xuti::Laser_p1_tag(), xuti::Laser_p2_tag(), xuti::Laser_p3_tag(), xuti::Laser_tag(), EBDetId::MIN_HASH, p1, p2, p3, AlCaHarvesting_cff::record, AlCaHLTBitMon_QueryRunRegistry::string, submitPVValidationJobs::t, RandomServiceHelper::t1, RandomServiceHelper::t2, RandomServiceHelper::t3, cms::xerces::toString(), EBDetId::unhashIndex(), EEDetId::unhashIndex(), cms::xerces::uStr(), EEDetId::validHashIndex(), xuti::writeCell(), xuti::writeHeader(), xuti::WriteNodeWithValue(), and cscNeutronWriter_cfi::writer.
Definition at line 28 of file EcalLinearCorrectionsXMLTranslator.cc.
33 XercesDOMParser*
parser =
new XercesDOMParser;
34 parser->setValidationScheme(XercesDOMParser::Val_Never);
35 parser->setDoNamespaces(
false);
36 parser->setDoSchema(
false);
40 DOMDocument* xmlDoc =
parser->getDocument();
42 std::cout <<
"EcalLinearCorrectionsXMLTranslator::Error parsing document" << std::endl;
46 DOMElement* elementRoot = xmlDoc->getDocumentElement();
85 record.setValue(detid, pair);
87 cellnode = cellnode->getNextSibling();
89 while (cellnode && cellnode->getNodeType() != DOMNode::ELEMENT_NODE)
90 cellnode = cellnode->getNextSibling();
References xuti::Cell_tag(), gather_cfg::cout, corrVsCorr::filename, xuti::getChildNode(), xuti::GetNodeData(), RecoTauValidation_cfi::header, xuti::Laser_p1_tag(), xuti::Laser_p2_tag(), xuti::Laser_p3_tag(), EcalTimeDependentCorrections::Values::p1, p1, EcalTimeDependentCorrections::Values::p2, p2, EcalTimeDependentCorrections::Values::p3, p3, writedatasetfile::parser, xuti::readCellId(), xuti::readHeader(), AlCaHarvesting_cff::record, cms::concurrency::xercesInitialize(), and cms::concurrency::xercesTerminate().