CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Static Public Member Functions
EcalTPGCrystalStatusXMLTranslator Class Reference

#include <EcalTPGCrystalStatusXMLTranslator.h>

Static Public Member Functions

static std::string dumpXML (const EcalCondHeader &header, const EcalTPGCrystalStatus &record)
 
static void plot (std::string, const EcalTPGCrystalStatus &record)
 
static int writeXML (const std::string &filename, const EcalCondHeader &header, const EcalTPGCrystalStatus &record)
 

Detailed Description

Translates a Ecal record to XML and vice versa

Version
Id:
EcalDAQCrystalStatusXMLTranslator.h,v 1.1 2011/04/04 fay Exp
Date
4 Apr 2011

Definition at line 18 of file EcalTPGCrystalStatusXMLTranslator.h.

Member Function Documentation

std::string EcalTPGCrystalStatusXMLTranslator::dumpXML ( const EcalCondHeader header,
const EcalTPGCrystalStatus record 
)
static

Definition at line 34 of file EcalTPGCrystalStatusXMLTranslator.cc.

References gather_cfg::cout, asciidump::doc, hcal_timing_source_file_cfg::dump, xuti::fromNative(), EEDetId::IX_MAX, EEDetId::IY_MAX, kBarlRings, kBarlWedges, kEndcWedgesX, kEndcWedgesY, kSides, EBDetId::MAX_IETA, EBDetId::MAX_IPHI, dbtoconf::root, jetcorrextractor::sign(), AlCaHLTBitMon_QueryRunRegistry::string, xuti::toNative(), xuti::TPGCrystalStatus_tag(), EEDetId::validDetId(), xuti::writeCell(), xuti::writeHeader(), xuti::WriteNodeWithValue(), and cms::concurrency::xercesInitialize().

Referenced by cond::PayLoadInspector< DataT >::dump().

34  {
35 
37  DOMImplementation* impl =
38  DOMImplementationRegistry::getDOMImplementation(fromNative("LS").c_str());
39 
40  DOMWriter* writer =static_cast<DOMImplementationLS*>(impl)->createDOMWriter( );
41  writer->setFeature(XMLUni::fgDOMWRTFormatPrettyPrint, true);
42 
43  DOMDocumentType* doctype = impl->createDocumentType(fromNative("XML").c_str(), 0, 0 );
44  DOMDocument * doc =
45  impl->createDocument( 0, fromNative(TPGCrystalStatus_tag).c_str(), doctype );
46 
47  doc->setEncoding(fromNative("UTF-8").c_str() );
48  doc->setStandalone(true);
49  doc->setVersion(fromNative("1.0").c_str() );
50 
51  DOMElement* root = doc->getDocumentElement();
52 
53  xuti::writeHeader(root,header);
54 
55  const int kSides = 2;
56  const int kBarlRings = EBDetId::MAX_IETA;
57  const int kBarlWedges = EBDetId::MAX_IPHI;
58  const int kEndcWedgesX = EEDetId::IX_MAX;
59  const int kEndcWedgesY = EEDetId::IY_MAX;
60 
61  std::cout << "EcalTPGCrystalStatusXMLTranslator::dumpXML" << std::endl;
62  for (int sign=0; sign < kSides; sign++) {
63  int thesign = sign==1 ? 1:-1;
64 
65  for (int ieta=0; ieta<kBarlRings; ieta++) {
66  for (int iphi=0; iphi<kBarlWedges; iphi++) {
67  EBDetId id((ieta+1)*thesign, iphi+1);
68  if(record[id.rawId()].getStatusCode() > 0) {
69  DOMElement* cellnode=writeCell(root, id);
70  WriteNodeWithValue(cellnode, TPGCrystalStatus_tag, record[id.rawId()].getStatusCode());
71  }
72  } // iphi
73  } // ieta
74 
75  for (int ix=0; ix<kEndcWedgesX; ix++) {
76  for (int iy=0; iy<kEndcWedgesY; iy++) {
77  if (! EEDetId::validDetId(ix+1,iy+1,thesign)) continue;
78  EEDetId id(ix+1,iy+1,thesign);
79  if(record[id.rawId()].getStatusCode() > 0) {
80  DOMElement* cellnode=writeCell(root, id);
81  WriteNodeWithValue(cellnode, TPGCrystalStatus_tag, record[id.rawId()].getStatusCode());
82  }
83  } // iy
84  } // ix
85  } // side
86 
87  std::string dump = toNative(writer->writeToString(*root));
88  doc->release();
89  return dump;
90 }
static const int kBarlRings
double sign(double x)
static const int kSides
void xercesInitialize()
Definition: Xerces.cc:17
void WriteNodeWithValue(xercesc::DOMNode *parentNode, const std::string &tag, const T &value)
write a node with
static const int kBarlWedges
static const int kEndcWedgesX
void writeHeader(xercesc::DOMNode *parentNode, const EcalCondHeader &header)
write
const std::string TPGCrystalStatus_tag("EcalTPGCrystalStatus")
tuple doc
Definition: asciidump.py:381
static const int IX_MAX
Definition: EEDetId.h:302
static const int MAX_IPHI
Definition: EBDetId.h:144
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
Definition: EEDetId.h:248
static const int MAX_IETA
Definition: EBDetId.h:143
XercesString fromNative(const char *str)
Definition: XercesString.h:31
tuple cout
Definition: gather_cfg.py:121
static const int IY_MAX
Definition: EEDetId.h:306
xercesc::DOMElement * writeCell(xercesc::DOMNode *node, const DetId &detid)
Append a Cell node with attributes to.
std::string toNative(const XMLCh *str)
Definition: XercesString.h:42
string root
initialization
Definition: dbtoconf.py:70
static const int kEndcWedgesY
static void EcalTPGCrystalStatusXMLTranslator::plot ( std::string  ,
const EcalTPGCrystalStatus record 
)
static

Referenced by cuy.FindIssue::__init__().

int EcalTPGCrystalStatusXMLTranslator::writeXML ( const std::string &  filename,
const EcalCondHeader header,
const EcalTPGCrystalStatus record 
)
static

Definition at line 26 of file EcalTPGCrystalStatusXMLTranslator.cc.

References EcalCondTools::dumpXML(), and dbtoconf::out.

28  {
29  std::fstream fs(filename.c_str(),ios::out);
30  fs<< dumpXML(header,record);
31  return 0;
32 }
static std::string dumpXML(const EcalCondHeader &header, const EcalTPGCrystalStatus &record)
tuple out
Definition: dbtoconf.py:99
tuple filename
Definition: lut2db_cfg.py:20