CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Classes | Functions
HcalDbXml.cc File Reference
#include <vector>
#include <string>
#include <fstream>
#include <sstream>
#include "CalibFormats/HcalObjects/interface/HcalText2DetIdConverter.h"
#include "CondFormats/HcalObjects/interface/AllObjects.h"
#include <xercesc/util/XMLString.hpp>
#include <xercesc/dom/DOMElement.hpp>
#include <xercesc/dom/DOMText.hpp>
#include <xercesc/dom/DOMImplementation.hpp>
#include <xercesc/dom/DOMImplementationRegistry.hpp>
#include <xercesc/dom/DOMDocument.hpp>
#include <xercesc/dom/DOMWriter.hpp>
#include "CondTools/Hcal/interface/StreamOutFormatTarget.h"
#include "CondTools/Hcal/interface/HcalDbXml.h"

Go to the source code of this file.

Classes

class  XMLDocument
 

Functions

template<class T1 , class T2 >
bool dumpObject_ (std::ostream &fOutput, unsigned fRun, unsigned long fGMTIOVBegin, unsigned long fGMTIOVEnd, const std::string &fTag, const T1 *fObject1, const T2 *fObject2=0)
 

Function Documentation

template<class T1 , class T2 >
bool dumpObject_ ( std::ostream &  fOutput,
unsigned  fRun,
unsigned long  fGMTIOVBegin,
unsigned long  fGMTIOVEnd,
const std::string &  fTag,
const T1 *  fObject1,
const T2 *  fObject2 = 0 
)

Definition at line 307 of file HcalDbXml.cc.

References XMLDocument::addData(), gather_cfg::cout, data, dataset::dataset, asciidump::doc, asciidump::elements, XMLDocument::makeChId(), XMLDocument::makeData(), XMLDocument::makeDataset(), XMLDocument::makeElement(), XMLDocument::makeElementDataset(), XMLDocument::makeElementIOV(), XMLDocument::makeElementTag(), XMLDocument::makeHeader(), XMLDocument::makeMapDataset(), XMLDocument::makeMapIOV(), XMLDocument::makeMaps(), XMLDocument::makeMapTag(), XMLDocument::root(), dbtoconf::root, XMLDocument::streamOut(), and BeamSplash_cfg::version.

Referenced by HcalDbXml::dumpObject().

309  {
310  if (!fObject1) return false;
311  const std::string KIND = kind (*fObject1);
312 
314  DOMElement* root = doc.root ();
315  doc.makeHeader (root, KIND, fRun);
316 
317  DOMElement* elements = doc.makeElement (root);
318  doc.makeElementIOV (elements, fGMTIOVBegin, fGMTIOVEnd);
319  doc.makeElementTag (elements, fTag, "HCAL");
320 
321  DOMElement* iovmap = doc.makeMapIOV (doc.makeMapTag (doc.makeMaps (root)));
322 
323  std::vector<DetId> detids = fObject1->getAllChannels ();
324  for (unsigned iCh = 0; iCh < detids.size(); iCh++) {
325  DetId id = detids [iCh];
326  ostringstream version;
327  version << fTag << '_' << fGMTIOVBegin; // CONVENTION: version == tag + iov for initial setting
328  DOMElement* dataset = doc.makeDataset (root, version.str());
329  doc.makeChId (dataset, id);
330  DOMElement* data = doc.makeData (dataset);
331  doc.addData (data, *(fObject1->getValues (id)));
332  try {
333  if (fObject2) doc.addData (data, *(fObject2->getValues (id)));
334  }
335  catch (...) {
336  std::cout << "dumpObject_-> ERROR: width is not available for cell # " << id.rawId() << std::endl;
337  }
338  doc.makeElementDataset (elements, iCh, id, version.str(), KIND, fRun);
339  doc.makeMapDataset (iovmap, iCh);
340  }
341  doc.streamOut (fOutput);
342  return true;
343 }
DOMElement * makeElementTag(DOMElement *fElement, const std::string &fTagName, const std::string &fDetectorName, const std::string &fComment="Automatically created by HcalDbXml")
Definition: HcalDbXml.cc:188
void streamOut(std::ostream &fOut)
Definition: HcalDbXml.cc:297
DOMElement * makeDataset(DOMElement *fRoot, const std::string &fVersion)
Definition: HcalDbXml.cc:148
list elements
Definition: asciidump.py:414
DOMElement * makeMapIOV(DOMElement *fTag)
Definition: HcalDbXml.cc:214
DOMElement * makeElementIOV(DOMElement *fElement, unsigned long long fIovBegin, unsigned long long fIovEnd=0)
Definition: HcalDbXml.cc:178
DOMElement * makeElementDataset(DOMElement *fElement, int fXMLId, DetId fDetId, const std::string &fVersion, const std::string &fKind, unsigned long fRun)
Definition: HcalDbXml.cc:168
tuple doc
Definition: asciidump.py:381
DOMElement * makeMapTag(DOMElement *fMap)
Definition: HcalDbXml.cc:208
void addData(DOMElement *fData, const HcalPedestal &fItem)
Definition: HcalDbXml.cc:230
DOMElement * makeElement(DOMElement *fRoot)
Definition: HcalDbXml.cc:198
Definition: DetId.h:20
DOMElement * makeChId(DOMElement *fDataset, DetId fId)
Definition: HcalDbXml.cc:154
tuple dataset
Definition: dataset.py:400
DOMElement * makeMaps(DOMElement *fRoot)
Definition: HcalDbXml.cc:203
DOMElement * makeData(DOMElement *fDataset, const HcalPedestal &fPed, const HcalPedestalWidth &fWidth)
Definition: HcalDbXml.cc:273
DOMElement * makeHeader(DOMElement *fRoot, const std::string &fExtensionName, unsigned long fRun)
Definition: HcalDbXml.cc:127
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
tuple cout
Definition: gather_cfg.py:121
DOMElement * root()
Definition: HcalDbXml.cc:125
DOMElement * makeMapDataset(DOMElement *fIov, int fXMLId)
Definition: HcalDbXml.cc:220
string root
initialization
Definition: dbtoconf.py:70