CMS 3D CMS Logo

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

#include <EcalTPGCrystalStatusXMLTranslator.h>

Static Public Member Functions

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

Static Private Member Functions

static std::string dumpXML (const EcalCondHeader &header, const EcalTPGCrystalStatus &record)
 
static void plot (std::string, 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 14 of file EcalTPGCrystalStatusXMLTranslator.h.

Member Function Documentation

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

Definition at line 40 of file EcalTPGCrystalStatusXMLTranslator.cc.

References gather_cfg::cout, remoteMonitoring_LASER_era2018_cfg::dump, gpuClustering::id, EEDetId::IX_MAX, EEDetId::IY_MAX, kBarlRings, kBarlWedges, kEndcWedgesX, kEndcWedgesY, kSides, EBDetId::MAX_IETA, EBDetId::MAX_IPHI, jetcorrextractor::sign(), AlCaHLTBitMon_QueryRunRegistry::string, cms::xerces::toString(), xuti::TPGCrystalStatus_tag(), cms::xerces::uStr(), EEDetId::validDetId(), xuti::writeCell(), xuti::writeHeader(), and xuti::WriteNodeWithValue().

41  {
42  unique_ptr<DOMImplementation> impl(DOMImplementationRegistry::getDOMImplementation(cms::xerces::uStr("LS").ptr()));
43 
44  DOMLSSerializer* writer = impl->createLSSerializer();
45  if (writer->getDomConfig()->canSetParameter(XMLUni::fgDOMWRTFormatPrettyPrint, true))
46  writer->getDomConfig()->setParameter(XMLUni::fgDOMWRTFormatPrettyPrint, true);
47  DOMDocumentType* doctype = impl->createDocumentType(cms::xerces::uStr("XML").ptr(), nullptr, nullptr);
48  DOMDocument* doc = impl->createDocument(nullptr, cms::xerces::uStr(TPGCrystalStatus_tag.c_str()).ptr(), doctype);
49 
50  DOMElement* root = doc->getDocumentElement();
51 
52  xuti::writeHeader(root, header);
53 
54  const int kSides = 2;
55  const int kBarlRings = EBDetId::MAX_IETA;
56  const int kBarlWedges = EBDetId::MAX_IPHI;
57  const int kEndcWedgesX = EEDetId::IX_MAX;
58  const int kEndcWedgesY = EEDetId::IY_MAX;
59 
60  std::cout << "EcalTPGCrystalStatusXMLTranslator::dumpXML" << std::endl;
61  for (int sign = 0; sign < kSides; sign++) {
62  int thesign = sign == 1 ? 1 : -1;
63 
64  for (int ieta = 0; ieta < kBarlRings; ieta++) {
65  for (int iphi = 0; iphi < kBarlWedges; iphi++) {
66  EBDetId id((ieta + 1) * thesign, iphi + 1);
67  if (record[id.rawId()].getStatusCode() > 0) {
68  DOMElement* cellnode = writeCell(root, id);
69  WriteNodeWithValue(cellnode, TPGCrystalStatus_tag, record[id.rawId()].getStatusCode());
70  }
71  } // iphi
72  } // ieta
73 
74  for (int ix = 0; ix < kEndcWedgesX; ix++) {
75  for (int iy = 0; iy < kEndcWedgesY; iy++) {
76  if (!EEDetId::validDetId(ix + 1, iy + 1, thesign))
77  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 = cms::xerces::toString(writer->writeToString(root));
88  doc->release();
89  doctype->release();
90  writer->release();
91 
92  return dump;
93 }
uint16_t *__restrict__ id
static const int kBarlRings
double sign(double x)
static const int kSides
void WriteNodeWithValue(xercesc::DOMNode *parentNode, const std::string &tag, const T &value)
write a node with
static const int kBarlWedges
std::string toString(XMLCh const *toTranscode)
static const int kEndcWedgesX
void writeHeader(xercesc::DOMNode *parentNode, const EcalCondHeader &header)
write
const std::string TPGCrystalStatus_tag("EcalTPGCrystalStatus")
ZStr< XMLCh > uStr(char const *str)
static const int IX_MAX
Definition: EEDetId.h:298
static const int MAX_IPHI
Definition: EBDetId.h:137
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
Definition: EEDetId.h:248
static const int MAX_IETA
Definition: EBDetId.h:136
tuple cout
Definition: gather_cfg.py:144
static const int IY_MAX
Definition: EEDetId.h:302
xercesc::DOMElement * writeCell(xercesc::DOMNode *node, const DetId &detid)
Append a Cell node with attributes to.
tuple dump
OutputFilePath = cms.string(&#39;/tmp/zhokin/&#39;), OutputFileExt = cms.string(&#39;&#39;),.
static const int kEndcWedgesY
static void EcalTPGCrystalStatusXMLTranslator::plot ( std::string  ,
const EcalTPGCrystalStatus record 
)
staticprivate
int EcalTPGCrystalStatusXMLTranslator::writeXML ( const std::string &  filename,
const EcalCondHeader header,
const EcalTPGCrystalStatus record 
)
static

Definition at line 27 of file EcalTPGCrystalStatusXMLTranslator.cc.

References EcalCondTools::dumpXML(), submitPVResolutionJobs::out, cms::concurrency::xercesInitialize(), and cms::concurrency::xercesTerminate().

29  {
31 
32  std::fstream fs(filename.c_str(), ios::out);
33  fs << dumpXML(header, record);
34 
36 
37  return 0;
38 }
static std::string dumpXML(const EcalCondHeader &header, const EcalTPGCrystalStatus &record)
void xercesTerminate()
Definition: Xerces.cc:23
void xercesInitialize()
Definition: Xerces.cc:18
tuple filename
Definition: lut2db_cfg.py:20