CMS 3D CMS Logo

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

#include <EcalClusterLocalContCorrXMLTranslator.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 EcalClusterLocalContCorr record to XML and vice versa

Definition at line 13 of file EcalClusterLocalContCorrXMLTranslator.h.

Member Function Documentation

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

Definition at line 55 of file EcalClusterLocalContCorrXMLTranslator.cc.

References boostedTaus_cff::doc, FrontierConditions_GlobalTag_cff::dump, EcalFunParams::params(), AlCaHLTBitMon_QueryRunRegistry::string, cms::xerces::toString(), cms::xerces::uStr(), xuti::Value_tag(), xuti::writeHeader(), xuti::WriteNodeWithValue(), and cscNeutronWriter_cfi::writer.

56  {
57 
58  unique_ptr<DOMImplementation> impl( DOMImplementationRegistry::getDOMImplementation( cms::xerces::uStr("LS").ptr()));
59 
60  DOMLSSerializer* writer = impl->createLSSerializer();
61  if( writer->getDomConfig()->canSetParameter( XMLUni::fgDOMWRTFormatPrettyPrint, true ))
62  writer->getDomConfig()->setParameter( XMLUni::fgDOMWRTFormatPrettyPrint, true );
63 
64  DOMDocumentType* doctype = impl->createDocumentType( cms::xerces::uStr("XML").ptr(), nullptr, nullptr );
65 
66  DOMDocument* doc = impl->createDocument( nullptr, cms::xerces::uStr("EcalClusterLocalContCorr").ptr(), doctype );
67 
68  DOMElement* root = doc->getDocumentElement();
69  xuti::writeHeader(root, header);
70 
71  for( auto it : record.params()) {
72  DOMElement* ECEC =
73  root->getOwnerDocument()->createElement( cms::xerces::uStr("ClusterLocal").ptr());
74  root->appendChild(ECEC);
75 
77  }
78 
79  std::string dump = cms::xerces::toString( writer->writeToString( root ));
80  doc->release();
81  doctype->release();
82  writer->release();
83 
84  return dump;
85 }
void WriteNodeWithValue(xercesc::DOMNode *parentNode, const std::string &tag, const T &value)
write a node with
const std::string Value_tag("Value")
std::string toString(XMLCh const *toTranscode)
EcalFunctionParameters & params()
void writeHeader(xercesc::DOMNode *parentNode, const EcalCondHeader &header)
write
ZStr< XMLCh > uStr(char const *str)
int EcalClusterLocalContCorrXMLTranslator::readXML ( const std::string &  filename,
EcalCondHeader header,
EcalFunParams record 
)
static

Definition at line 21 of file EcalClusterLocalContCorrXMLTranslator.cc.

References gather_cfg::cout, writedatasetfile::parser, xuti::readHeader(), AlCaHLTBitMon_QueryRunRegistry::string, cms::concurrency::xercesInitialize(), and cms::concurrency::xercesTerminate().

24  {
25 
27 
28  XercesDOMParser* parser = new XercesDOMParser;
29  parser->setValidationScheme( XercesDOMParser::Val_Never );
30  parser->setDoNamespaces( false );
31  parser->setDoSchema( false );
32 
33  parser->parse(filename.c_str());
34 
35  DOMDocument* xmlDoc = parser->getDocument();
36 
37 
38  if (!xmlDoc) {
39  std::cout << "EcalClusterLocalContCorrXMLTranslator::Error parsing document" << std::endl;
40  return -1;
41  }
42 
43  DOMElement* elementRoot = xmlDoc->getDocumentElement();
44 
45  xuti::readHeader(elementRoot, header);
46 
47  // need some extra code here
48 
49  delete parser;
51  return 0;
52 }
void xercesTerminate()
Definition: Xerces.cc:23
void xercesInitialize()
Definition: Xerces.cc:18
void readHeader(xercesc::DOMNode *parentNode, EcalCondHeader &header)
read header from
int EcalClusterLocalContCorrXMLTranslator::writeXML ( const std::string &  filename,
const EcalCondHeader header,
const EcalFunParams record 
)
static

Definition at line 88 of file EcalClusterLocalContCorrXMLTranslator.cc.

References EcalCondTools::dumpXML(), MillePedeFileConverter_cfg::out, cms::concurrency::xercesInitialize(), and cms::concurrency::xercesTerminate().

91  {
92 
94 
95  std::fstream fs(filename.c_str(),ios::out);
96  fs<< dumpXML(header,record);
97 
99 
100  return 0;
101 }
void xercesTerminate()
Definition: Xerces.cc:23
void xercesInitialize()
Definition: Xerces.cc:18
static std::string dumpXML(const EcalCondHeader &header, const EcalFunParams &record)