CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
HcalConstantsXMLWriter Class Reference

#include <HcalConstantsXMLWriter.h>

Public Member Functions

 HcalConstantsXMLWriter ()
 
void newCellLine (xercesc::DOMElement *, int, int, int, int, float)
 
void writeXML (std::string &, const std::vector< int > &, const std::vector< int > &, const std::vector< int > &, const std::vector< int > &, const std::vector< float > &)
 
virtual ~HcalConstantsXMLWriter ()
 

Private Attributes

std::string hcalfileOut_
 
xercesc::DOMDocument * mDoc
 
xercesc::DOMImplementation * mDom
 

Detailed Description

Definition at line 19 of file HcalConstantsXMLWriter.h.

Constructor & Destructor Documentation

HcalConstantsXMLWriter::HcalConstantsXMLWriter ( )

Definition at line 22 of file HcalConstantsXMLWriter.cc.

23 {
24 }
HcalConstantsXMLWriter::~HcalConstantsXMLWriter ( )
virtual

Definition at line 25 of file HcalConstantsXMLWriter.cc.

26 {
27 }

Member Function Documentation

void HcalConstantsXMLWriter::newCellLine ( xercesc::DOMElement *  ,
int  ,
int  ,
int  ,
int  ,
float   
)

Definition at line 81 of file HcalConstantsXMLWriter.cc.

References HLT_25ns14e33_v1_cff::depth, eta(), phi, and pileupReCalc_HLTpaths::scale.

82 {
83  XMLCh tempStr[100];
84  XMLString::transcode("det_index", tempStr, 99);
85  DOMAttr* attrdet = mDoc->createAttribute(tempStr);
86 
87  XMLString::transcode("eta_index", tempStr, 99);
88  DOMAttr* attreta = mDoc->createAttribute(tempStr);
89 
90  XMLString::transcode("phi_index", tempStr, 99);
91  DOMAttr* attrphi = mDoc->createAttribute(tempStr) ;
92 
93  XMLString::transcode("depth_index", tempStr, 99);
94  DOMAttr* attrdepth = mDoc->createAttribute(tempStr) ;
95 
96  XMLString::transcode("scale_factor", tempStr, 99);
97  DOMAttr* attrscale = mDoc->createAttribute(tempStr) ;
98 
99  ostringstream ost;
100  ost <<det;
101  attrdet->setValue(XMLString::transcode(ost.str().c_str()));
102  detelem->setAttributeNode(attrdet);
103 
104  ostringstream ost1;
105  ost1 <<eta;
106  attreta->setValue(XMLString::transcode(ost1.str().c_str()));
107  //DOMAttr* attr3 = detelem->setAttributeNode(attreta);
108  detelem->setAttributeNode(attreta);
109 
110  ostringstream ost2;
111  ost2 <<phi;
112  attrphi->setValue(XMLString::transcode(ost2.str().c_str()));
113  //DOMAttr* attr4 = detelem->setAttributeNode(attrphi);
114  detelem->setAttributeNode(attrphi);
115 
116  ostringstream ost3;
117  ost3 <<depth;
118  attrdepth->setValue(XMLString::transcode(ost3.str().c_str()));
119  //DOMAttr* attr5 = detelem->setAttributeNode(attrdepth);
120  detelem->setAttributeNode(attrdepth);
121 
122  ostringstream ost4;
123  ost4 << scale;
124  attrscale->setValue(XMLString::transcode(ost4.str().c_str()));
125  //DOMAttr* attr6 = detelem->setAttributeNode(attrscale);
126  detelem->setAttributeNode(attrscale);
127 
128 }
T eta() const
xercesc::DOMDocument * mDoc
Definition: DDAxes.h:10
void HcalConstantsXMLWriter::writeXML ( std::string &  ,
const std::vector< int > &  ,
const std::vector< int > &  ,
const std::vector< int > &  ,
const std::vector< int > &  ,
const std::vector< float > &   
)

Definition at line 28 of file HcalConstantsXMLWriter.cc.

References gather_cfg::cout, benchmark_cfg::fb, i, runonSM::newfile, dbtoconf::out, and dbtoconf::root.

29 {
30  int nn = newfile0.size();
31  char newfile[99];
32  for (int i = 0; i < nn; i++)
33  {
34  newfile[i]=newfile0[i];
35  }
36  char const* fend="\0";
37  newfile[nn] = *fend;
38 
39  cout<<" New file "<<newfile<<endl;
40 
41  filebuf fb;
42  fb.open (newfile,ios::out);
43  ostream fOut(&fb);
44 
45  XMLCh tempStr[100];
46 
47  XMLString::transcode ("Core",tempStr,99);
48  mDom = DOMImplementationRegistry::getDOMImplementation (tempStr);
49 
50  XMLString::transcode("CalibrationConstants", tempStr, 99);
51  mDoc = mDom->createDocument(
52  0, // root element namespace URI.
53  tempStr, // root element name
54  0); // document type object (DTD).
55 
56  StreamOutFormatTarget formTarget (fOut);
57  DOMWriter* domWriter = mDom->createDOMWriter();
58  domWriter->setFeature(XMLUni::fgDOMWRTFormatPrettyPrint, true);
59  DOMElement* root = mDoc->getDocumentElement();
60 
61  XMLString::transcode("Hcal", tempStr, 99);
62  DOMElement* rootelem = mDoc->createElement (tempStr);
63  root->appendChild(rootelem);
64 
65  XMLString::transcode("Cell", tempStr, 99);
66  vector<DOMElement*> theDOMVec;
67 
68  for(unsigned int i=0; i<detvec.size();i++)
69  {
70  theDOMVec.push_back(mDoc->createElement (tempStr));
71  newCellLine(theDOMVec[i],detvec[i],etavec[i],phivec[i],depthvec[i],scalevec[i]);
72  rootelem->appendChild(theDOMVec[i]);
73  }
74 
75  cout<<" Write Doc "<<theDOMVec.size()<<endl;
76  domWriter->writeNode (&formTarget, *mDoc);
77  cout<<" End of Writting "<<endl;
78  mDoc->release ();
79 }
int i
Definition: DBlmapReader.cc:9
void newCellLine(xercesc::DOMElement *, int, int, int, int, float)
tuple newfile
Definition: runonSM.py:48
xercesc::DOMImplementation * mDom
tuple out
Definition: dbtoconf.py:99
tuple cout
Definition: gather_cfg.py:121
xercesc::DOMDocument * mDoc
string root
initialization
Definition: dbtoconf.py:70

Member Data Documentation

std::string HcalConstantsXMLWriter::hcalfileOut_
private

Definition at line 29 of file HcalConstantsXMLWriter.h.

xercesc::DOMDocument* HcalConstantsXMLWriter::mDoc
private

Definition at line 31 of file HcalConstantsXMLWriter.h.

xercesc::DOMImplementation* HcalConstantsXMLWriter::mDom
private

Definition at line 30 of file HcalConstantsXMLWriter.h.