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 "FWCore/Concurrency/interface/Xerces.h"
#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 308 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(), AlCaHLTBitMon_QueryRunRegistry::string, and BeamSplash_cfg::version.

Referenced by HcalDbXml::dumpObject().

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