CMS 3D CMS Logo

List of all members | Static Public Member Functions | Static Private Member Functions
EcalClusterEnergyCorrectionXMLTranslator Class Reference

#include <EcalClusterEnergyCorrectionXMLTranslator.h>

Static Public Member Functions

static int readXML (const std::string &filename, EcalCondHeader &header, EcalFunParams &record)
 
static int writeXML (const std::string &filename, const EcalCondHeader &header, const EcalFunParams &record)
 

Static Private Member Functions

static std::string dumpXML (const EcalCondHeader &header, const EcalFunParams &record)
 

Detailed Description

Translates a EcalClusterEnergyCorrection record to XML and vice versa

Author
Version
Id
EcalClusterEnergyCorrectionXMLTranslator.h,v 1.0
Date
October 2011

Definition at line 17 of file EcalClusterEnergyCorrectionXMLTranslator.h.

Member Function Documentation

◆ dumpXML()

std::string EcalClusterEnergyCorrectionXMLTranslator::dumpXML ( const EcalCondHeader header,
const EcalFunParams record 
)
staticprivate

Definition at line 49 of file EcalClusterEnergyCorrectionXMLTranslator.cc.

50  {
51  unique_ptr<DOMImplementation> impl(DOMImplementationRegistry::getDOMImplementation(cms::xerces::uStr("LS").ptr()));
52 
53  DOMLSSerializer* writer = impl->createLSSerializer();
54  if (writer->getDomConfig()->canSetParameter(XMLUni::fgDOMWRTFormatPrettyPrint, true))
55  writer->getDomConfig()->setParameter(XMLUni::fgDOMWRTFormatPrettyPrint, true);
56 
57  DOMDocumentType* doctype = impl->createDocumentType(cms::xerces::uStr("XML").ptr(), nullptr, nullptr);
58 
59  DOMDocument* doc = impl->createDocument(nullptr, cms::xerces::uStr("EcalClusterEnergyCorrection").ptr(), doctype);
60 
61  DOMElement* root = doc->getDocumentElement();
63 
64  for (auto it : record.params()) {
65  DOMElement* ECEC = root->getOwnerDocument()->createElement(cms::xerces::uStr("ClusterEnergy").ptr());
66  root->appendChild(ECEC);
67 
68  WriteNodeWithValue(ECEC, Value_tag, it);
69  }
70 
72  doc->release();
73  doctype->release();
74  writer->release();
75 
76  return dump;
77 }

References common_cff::doc, FrontierConditions_GlobalTag_cff::dump, RecoTauValidation_cfi::header, GlobalPosition_Frontier_DevDB_cff::record, AlCaHLTBitMon_QueryRunRegistry::string, cms::xerces::toString(), cms::xerces::uStr(), xuti::Value_tag(), xuti::writeHeader(), xuti::WriteNodeWithValue(), and cscNeutronWriter_cfi::writer.

◆ readXML()

int EcalClusterEnergyCorrectionXMLTranslator::readXML ( const std::string &  filename,
EcalCondHeader header,
EcalFunParams record 
)
static

Definition at line 19 of file EcalClusterEnergyCorrectionXMLTranslator.cc.

21  {
23 
24  XercesDOMParser* parser = new XercesDOMParser;
25  parser->setValidationScheme(XercesDOMParser::Val_Never);
26  parser->setDoNamespaces(false);
27  parser->setDoSchema(false);
28 
29  parser->parse(filename.c_str());
30 
31  DOMDocument* xmlDoc = parser->getDocument();
32 
33  if (!xmlDoc) {
34  std::cout << "EcalClusterEnergyCorrectionXMLTranslator::Error parsing document" << std::endl;
35  return -1;
36  }
37 
38  DOMElement* elementRoot = xmlDoc->getDocumentElement();
39 
40  xuti::readHeader(elementRoot, header);
41 
42  // need some extra code here
43 
44  delete parser;
46  return 0;
47 }

References gather_cfg::cout, corrVsCorr::filename, RecoTauValidation_cfi::header, writedatasetfile::parser, xuti::readHeader(), cms::concurrency::xercesInitialize(), and cms::concurrency::xercesTerminate().

◆ writeXML()

int EcalClusterEnergyCorrectionXMLTranslator::writeXML ( const std::string &  filename,
const EcalCondHeader header,
const EcalFunParams record 
)
static
common_cff.doc
doc
Definition: common_cff.py:54
xuti::writeHeader
void writeHeader(xercesc::DOMNode *parentNode, const EcalCondHeader &header)
write
Definition: DOMHelperFunctions.cc:151
gather_cfg.cout
cout
Definition: gather_cfg.py:144
GlobalPosition_Frontier_DevDB_cff.record
record
Definition: GlobalPosition_Frontier_DevDB_cff.py:10
writedatasetfile.parser
parser
Definition: writedatasetfile.py:7
cscNeutronWriter_cfi.writer
writer
Definition: cscNeutronWriter_cfi.py:6
cms::xerces::toString
std::string toString(XMLCh const *toTranscode)
Definition: XercesStrUtils.h:34
xuti::WriteNodeWithValue
void WriteNodeWithValue(xercesc::DOMNode *parentNode, const std::string &tag, const T &value)
write a node with
Definition: DOMHelperFunctions.h:46
corrVsCorr.filename
filename
Definition: corrVsCorr.py:123
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
FrontierConditions_GlobalTag_cff.dump
dump
Definition: FrontierConditions_GlobalTag_cff.py:12
cms::concurrency::xercesTerminate
void xercesTerminate()
Definition: Xerces.cc:23
root
Definition: RooFitFunction.h:10
cms::xerces::uStr
ZStr< XMLCh > uStr(char const *str)
Definition: XercesStrUtils.h:30
EcalClusterEnergyCorrectionXMLTranslator::dumpXML
static std::string dumpXML(const EcalCondHeader &header, const EcalFunParams &record)
Definition: EcalClusterEnergyCorrectionXMLTranslator.cc:49
impl
Definition: trackAlgoPriorityOrder.h:18
xuti::Value_tag
const std::string Value_tag("Value")
RecoTauValidation_cfi.header
header
Definition: RecoTauValidation_cfi.py:292
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
cms::concurrency::xercesInitialize
void xercesInitialize()
Definition: Xerces.cc:18
xuti::readHeader
void readHeader(xercesc::DOMNode *parentNode, EcalCondHeader &header)
read header from
Definition: DOMHelperFunctions.cc:164