CMS 3D CMS Logo

Public Member Functions

HcalDQMDbInterface Class Reference

#include <HcalDQMDbInterface.h>

Inheritance diagram for HcalDQMDbInterface:
HcalHLXMaskDbInterface HcalHotCellDbInterface

List of all members.

Public Member Functions

DOMElement * createChannel (DOMDocument *doc, DOMElement *parent, HcalDetId id)
DOMDocument * createDocument ()
DOMElement * createElement (DOMDocument *doc, DOMElement *parent, char *name)
DOMElement * createElement (DOMDocument *doc, DOMElement *parent, char *name, char *value)
DOMElement * createElement (DOMDocument *doc, DOMElement *parent, char *name, const char *value)
DOMElement * createFooter (DOMDocument *doc, unsigned long long fIovBegin, unsigned long long fIovEnd, const char *fTagName, const char *fDetectorName, const char *fComment)
DOMElement * createIOV (DOMDocument *doc, DOMElement *parent, unsigned long long fIovBegin, unsigned long long fIovEnd)
DOMElement * createTag (DOMDocument *doc, DOMElement *parent, const char *fTagName, const char *fDetectorName, const char *fComment)
 HcalDQMDbInterface ()
const char * itoa (int i)
DOMElement * makeMapDataset (DOMDocument *doc, DOMElement *fIov)
DOMElement * makeMapIOV (DOMDocument *doc, DOMElement *fTag)
DOMElement * makeMapTag (DOMDocument *doc, DOMElement *fMap)
void writeDocument (DOMDocument *doc, const char *xmlFile)

Detailed Description

Definition at line 29 of file HcalDQMDbInterface.h.


Constructor & Destructor Documentation

HcalDQMDbInterface::HcalDQMDbInterface ( ) [inline]

Definition at line 32 of file HcalDQMDbInterface.h.

{};

Member Function Documentation

DOMElement * HcalDQMDbInterface::createChannel ( DOMDocument *  doc,
DOMElement *  parent,
HcalDetId  id 
)

Definition at line 123 of file HcalDQMDbInterface.cc.

References createElement(), HcalText2DetIdConverter::getFlavor(), and itoa().

Referenced by HcalHotCellDbInterface::createDataset().

                                                                                              {
  HcalText2DetIdConverter converter(id);
  DOMElement*  chanElem = createElement(doc,parent,(char*)"CHANNEL");
  createElement(doc,chanElem,(char*)"EXTENSION_TABLE_NAME",(char*)"HCAL_CHANNELS");
  createElement(doc,chanElem,(char*)"ETA",itoa(id.ietaAbs()));
  createElement(doc,chanElem,(char*)"PHI",itoa(id.iphi()));
  createElement(doc,chanElem,(char*)"DEPTH",itoa(id.depth()));
  createElement(doc,chanElem,(char*)"Z",itoa(id.zside()));
  createElement(doc,chanElem,(char*)"DETECTOR_NAME",converter.getFlavor().c_str());
  createElement(doc,chanElem,(char*)"HCAL_CHANNEL_ID",itoa(id.rawId()));
  return chanElem;
}
DOMDocument * HcalDQMDbInterface::createDocument ( )

Definition at line 29 of file HcalDQMDbInterface.cc.

References XML.

                                               {
  DOMImplementation* impl =  DOMImplementationRegistry::getDOMImplementation(XML("Core"));
  return impl->createDocument(0,XML("ROOT"),0);
}
DOMElement * HcalDQMDbInterface::createElement ( DOMDocument *  doc,
DOMElement *  parent,
char *  name,
char *  value 
)

Definition at line 17 of file HcalDQMDbInterface.cc.

References createElement(), and XML.

                                                                                                          {
  DOMElement*  elem = createElement(doc,parent,name);
  elem->appendChild(doc->createTextNode(XML(value)));
  return elem;
}
DOMElement * HcalDQMDbInterface::createElement ( DOMDocument *  doc,
DOMElement *  parent,
char *  name,
const char *  value 
)

Definition at line 23 of file HcalDQMDbInterface.cc.

References createElement(), and XML.

                                                                                                                {
  DOMElement*  elem = createElement(doc,parent,name);
  elem->appendChild(doc->createTextNode(XML(value)));
  return elem;
}
DOMElement * HcalDQMDbInterface::createElement ( DOMDocument *  doc,
DOMElement *  parent,
char *  name 
)
DOMElement * HcalDQMDbInterface::createFooter ( DOMDocument *  doc,
unsigned long long  fIovBegin,
unsigned long long  fIovEnd,
const char *  fTagName,
const char *  fDetectorName,
const char *  fComment 
)

Definition at line 47 of file HcalDQMDbInterface.cc.

References createElement(), createIOV(), createTag(), BeamSplash_cfg::dataset, makeMapDataset(), makeMapIOV(), makeMapTag(), and dbtoconf::parent.

                                                                                                                   {
  
  DOMElement* parent = doc->getDocumentElement();
  DOMElement* elems = createElement(doc,parent,(char*)"ELEMENTS");
  DOMElement* dataset = createElement(doc, elems, (char*)"DATA_SET");
  dataset->setAttribute(transcode("id"), transcode("-1"));
  createIOV(doc,elems,fIovBegin,fIovEnd);
  createTag(doc,elems,fTagName,fDetectorName,fComment);

  DOMElement* maps = createElement(doc,parent,(char*)"MAPS");
  DOMElement* mapTag = makeMapTag(doc,maps);
  DOMElement* mapIov = makeMapIOV(doc,mapTag);
  makeMapDataset(doc,mapIov);

  return elems;
}
DOMElement * HcalDQMDbInterface::createIOV ( DOMDocument *  doc,
DOMElement *  parent,
unsigned long long  fIovBegin,
unsigned long long  fIovEnd 
)

Definition at line 84 of file HcalDQMDbInterface.cc.

References createElement(), o2o::iov, and itoa().

Referenced by createFooter().

                                                                                                    {
  DOMElement* iov = createElement(doc,parent,(char*)"IOV");
  iov->setAttribute(transcode("id"), transcode("IOV_ID"));
  
  createElement(doc,iov,(char*)"INTERVAL_OF_VALIDITY_BEGIN", itoa(fIovBegin));
  if(fIovEnd) {
    createElement(doc,iov,(char*)"INTERVAL_OF_VALIDITY_END", itoa(fIovEnd));
  }
  return iov;
}
DOMElement * HcalDQMDbInterface::createTag ( DOMDocument *  doc,
DOMElement *  parent,
const char *  fTagName,
const char *  fDetectorName,
const char *  fComment 
)

Definition at line 96 of file HcalDQMDbInterface.cc.

References createElement(), and GlobalPosition_Frontier_DevDB_cff::tag.

Referenced by createFooter().

                                                                                                                  {
  DOMElement* tag = createElement(doc,parent,(char*)"TAG");
  tag->setAttribute(transcode("id"), transcode ("TAG_ID"));
  tag->setAttribute(transcode("mode"), transcode ("auto"));

  createElement(doc,tag,(char*)"TAG_NAME", fTagName);
  createElement(doc,tag,(char*)"DETECTOR_NAME", fDetectorName);
  createElement(doc,tag,(char*)"COMMENT_DESCRIPTION", fComment);

  return tag;
}
const char* HcalDQMDbInterface::itoa ( int  i) [inline]

Definition at line 52 of file HcalDQMDbInterface.h.

References cond::rpcobtemp::temp.

Referenced by createChannel(), HcalHotCellDbInterface::createData(), HcalHLXMaskDbInterface::createDataset(), HcalHotCellDbInterface::createHeader(), and createIOV().

                         {
    char temp[256];
    sprintf(temp,"%d",i);
    std::string outVal(temp);
    return outVal.c_str();
  }
DOMElement * HcalDQMDbInterface::makeMapDataset ( DOMDocument *  doc,
DOMElement *  fIov 
)

Definition at line 78 of file HcalDQMDbInterface.cc.

References createElement().

Referenced by createFooter().

                                                                                {
  DOMElement* element = createElement(doc,fIov, (char*)"DATA_SET");
  element->setAttribute(transcode("idref"), transcode("-1"));
  return element;
}
DOMElement * HcalDQMDbInterface::makeMapIOV ( DOMDocument *  doc,
DOMElement *  fTag 
)

Definition at line 72 of file HcalDQMDbInterface.cc.

References createElement(), and o2o::iov.

Referenced by createFooter().

                                                                            {
  DOMElement* iov = createElement(doc,fTag, (char*)"IOV");
  iov->setAttribute(transcode("idref"), transcode("IOV_ID"));
  return iov;
}
DOMElement * HcalDQMDbInterface::makeMapTag ( DOMDocument *  doc,
DOMElement *  fMap 
)

Definition at line 66 of file HcalDQMDbInterface.cc.

References createElement(), and GlobalPosition_Frontier_DevDB_cff::tag.

Referenced by createFooter().

                                                                            {
  DOMElement* tag = createElement(doc, fMap, (char*)"TAG");
  tag->setAttribute(transcode("idref"), transcode("TAG_ID"));
  return tag;
}
void HcalDQMDbInterface::writeDocument ( DOMDocument *  doc,
const char *  xmlFile 
)

Definition at line 34 of file HcalDQMDbInterface.cc.

References XML.

                                                                           {
  DOMImplementation* impl =  DOMImplementationRegistry::getDOMImplementation(XML("Core"));
  DOMWriter *theSerializer = ((DOMImplementationLS*)impl)->createDOMWriter();
  if (theSerializer->canSetFeature(XMLUni::fgDOMWRTFormatPrettyPrint, true))
    theSerializer->setFeature(XMLUni::fgDOMWRTFormatPrettyPrint, true);
  if (theSerializer->canSetFeature(XMLUni::fgDOMWRTBOM, true))
    theSerializer->setFeature(XMLUni::fgDOMWRTBOM, true);
  XMLFormatTarget *myFormTarget = new LocalFileFormatTarget(xmlFile);
  theSerializer->writeNode(myFormTarget, *doc);
  delete theSerializer;
  delete myFormTarget;
}