CMS 3D CMS Logo

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/DOMConfiguration.hpp>
#include <xercesc/dom/DOMDocument.hpp>
#include <xercesc/dom/DOMLSOutput.hpp>
#include <xercesc/dom/DOMLSSerializer.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 315 of file HcalDbXml.cc.

References XMLDocument::addData(), gather_cfg::cout, data, XMLDocument::doc, allElectronIsolations_cfi::elements, callgraph::kind, 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(), XMLDocument::streamOut(), AlCaHLTBitMon_QueryRunRegistry::string, and jets_cff::version.

Referenced by HcalDbXml::dumpObject().

317  {
318  if (!fObject1) return false;
319  const std::string KIND = kind (*fObject1);
320 
322  DOMElement* root = doc.root ();
323  doc.makeHeader (root, KIND, fRun);
324 
325  DOMElement* elements = doc.makeElement (root);
326  doc.makeElementIOV (elements, fGMTIOVBegin, fGMTIOVEnd);
327  doc.makeElementTag (elements, fTag, "HCAL");
328 
329  DOMElement* iovmap = doc.makeMapIOV (doc.makeMapTag (doc.makeMaps (root)));
330 
331  std::vector<DetId> detids = fObject1->getAllChannels ();
332  for (unsigned iCh = 0; iCh < detids.size(); iCh++) {
333  DetId id = detids [iCh];
334  ostringstream version;
335  version << fTag << '_' << fGMTIOVBegin; // CONVENTION: version == tag + iov for initial setting
336  DOMElement* dataset = doc.makeDataset (root, version.str());
337  doc.makeChId (dataset, id);
338  DOMElement* data = doc.makeData (dataset);
339  doc.addData (data, *(fObject1->getValues (id)));
340  try {
341  if (fObject2) doc.addData (data, *(fObject2->getValues (id)));
342  }
343  catch (...) {
344  std::cout << "dumpObject_-> ERROR: width is not available for cell # " << id.rawId() << std::endl;
345  }
346  doc.makeElementDataset (elements, iCh, id, version.str(), KIND, fRun);
347  doc.makeMapDataset (iovmap, iCh);
348  }
349  doc.streamOut (fOutput);
350  return true;
351 }
DOMElement * makeElementTag(DOMElement *fElement, const std::string &fTagName, const std::string &fDetectorName, const std::string &fComment="Automatically created by HcalDbXml")
Definition: HcalDbXml.cc:191
void streamOut(std::ostream &fOut)
Definition: HcalDbXml.cc:300
DOMElement * makeDataset(DOMElement *fRoot, const std::string &fVersion)
Definition: HcalDbXml.cc:151
DOMElement * makeMapIOV(DOMElement *fTag)
Definition: HcalDbXml.cc:217
DOMElement * makeElementIOV(DOMElement *fElement, unsigned long long fIovBegin, unsigned long long fIovEnd=0)
Definition: HcalDbXml.cc:181
DOMElement * makeElementDataset(DOMElement *fElement, int fXMLId, DetId fDetId, const std::string &fVersion, const std::string &fKind, unsigned long fRun)
Definition: HcalDbXml.cc:171
DOMElement * makeMapTag(DOMElement *fMap)
Definition: HcalDbXml.cc:211
void addData(DOMElement *fData, const HcalPedestal &fItem)
Definition: HcalDbXml.cc:233
DOMElement * makeElement(DOMElement *fRoot)
Definition: HcalDbXml.cc:201
Definition: DetId.h:18
DOMElement * makeChId(DOMElement *fDataset, DetId fId)
Definition: HcalDbXml.cc:157
DOMElement * makeMaps(DOMElement *fRoot)
Definition: HcalDbXml.cc:206
DOMElement * makeData(DOMElement *fDataset, const HcalPedestal &fPed, const HcalPedestalWidth &fWidth)
Definition: HcalDbXml.cc:276
DOMElement * makeHeader(DOMElement *fRoot, const std::string &fExtensionName, unsigned long fRun)
Definition: HcalDbXml.cc:130
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
DOMElement * root()
Definition: HcalDbXml.cc:128
DOMElement * makeMapDataset(DOMElement *fIov, int fXMLId)
Definition: HcalDbXml.cc:223