CMS 3D CMS Logo

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
 

Detailed Description

Definition at line 18 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 85 of file HcalConstantsXMLWriter.cc.

References particleFlowClusterECALTimeSelected_cfi::depth, stringResolutionProvider_cfi::eta, and Scenarios_cff::scale.

86 {
87  XMLCh tempStr[100];
88  XMLString::transcode("det_index", tempStr, 99);
89  DOMAttr* attrdet = mDoc->createAttribute(tempStr);
90 
91  XMLString::transcode("eta_index", tempStr, 99);
92  DOMAttr* attreta = mDoc->createAttribute(tempStr);
93 
94  XMLString::transcode("phi_index", tempStr, 99);
95  DOMAttr* attrphi = mDoc->createAttribute(tempStr) ;
96 
97  XMLString::transcode("depth_index", tempStr, 99);
98  DOMAttr* attrdepth = mDoc->createAttribute(tempStr) ;
99 
100  XMLString::transcode("scale_factor", tempStr, 99);
101  DOMAttr* attrscale = mDoc->createAttribute(tempStr) ;
102 
103  ostringstream ost;
104  ost <<det;
105  attrdet->setValue(XMLString::transcode(ost.str().c_str()));
106  detelem->setAttributeNode(attrdet);
107 
108  ostringstream ost1;
109  ost1 <<eta;
110  attreta->setValue(XMLString::transcode(ost1.str().c_str()));
111  //DOMAttr* attr3 = detelem->setAttributeNode(attreta);
112  detelem->setAttributeNode(attreta);
113 
114  ostringstream ost2;
115  ost2 <<phi;
116  attrphi->setValue(XMLString::transcode(ost2.str().c_str()));
117  //DOMAttr* attr4 = detelem->setAttributeNode(attrphi);
118  detelem->setAttributeNode(attrphi);
119 
120  ostringstream ost3;
121  ost3 <<depth;
122  attrdepth->setValue(XMLString::transcode(ost3.str().c_str()));
123  //DOMAttr* attr5 = detelem->setAttributeNode(attrdepth);
124  detelem->setAttributeNode(attrdepth);
125 
126  ostringstream ost4;
127  ost4 << scale;
128  attrscale->setValue(XMLString::transcode(ost4.str().c_str()));
129  //DOMAttr* attr6 = detelem->setAttributeNode(attrscale);
130  detelem->setAttributeNode(attrscale);
131 
132 }
xercesc::DOMDocument * mDoc
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, mps_fire::i, create_public_lumi_plots::newfile, groupFilesInBlocks::nn, MillePedeFileConverter_cfg::out, and convertSQLitetoXML_cfg::output.

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  unique_ptr<DOMImplementation> 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  DOMLSSerializer* domWriter = mDom->createLSSerializer();
58  domWriter->getDomConfig()->setParameter(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  DOMLSOutput* output= mDom->createLSOutput();
77  output->setByteStream(&formTarget);
78  domWriter->write (mDoc, output);
79  cout<<" End of Writting "<<endl;
80  mDoc->release ();
81  output->release();
82  domWriter->release();
83 }
void newCellLine(xercesc::DOMElement *, int, int, int, int, float)
xercesc::DOMDocument * mDoc

Member Data Documentation

std::string HcalConstantsXMLWriter::hcalfileOut_
private

Definition at line 28 of file HcalConstantsXMLWriter.h.

xercesc::DOMDocument* HcalConstantsXMLWriter::mDoc
private

Definition at line 29 of file HcalConstantsXMLWriter.h.