CMS 3D CMS Logo

List of all members | Static Public Member Functions | Static Private Member Functions
EcalTPGTowerStatusXMLTranslator Class Reference

#include <EcalTPGTowerStatusXMLTranslator.h>

Static Public Member Functions

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

Static Private Member Functions

static std::string dumpXML (const EcalCondHeader &header, const EcalTPGTowerStatus &record)
 
static void plot (std::string, const EcalTPGTowerStatus &record)
 

Detailed Description

Translates a Ecal record to XML and vice versa

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

Definition at line 14 of file EcalTPGTowerStatusXMLTranslator.h.

Member Function Documentation

◆ dumpXML()

std::string EcalTPGTowerStatusXMLTranslator::dumpXML ( const EcalCondHeader header,
const EcalTPGTowerStatus record 
)
staticprivate

Definition at line 87 of file EcalTPGTowerStatusXMLTranslator.cc.

87  {
88  unique_ptr<DOMImplementation> impl(DOMImplementationRegistry::getDOMImplementation(cms::xerces::uStr("LS").ptr()));
89 
90  DOMLSSerializer* writer = impl->createLSSerializer();
91  if (writer->getDomConfig()->canSetParameter(XMLUni::fgDOMWRTFormatPrettyPrint, true))
92  writer->getDomConfig()->setParameter(XMLUni::fgDOMWRTFormatPrettyPrint, true);
93 
94  DOMDocumentType* doctype = impl->createDocumentType(cms::xerces::uStr("XML").ptr(), nullptr, nullptr);
95  DOMDocument* doc = impl->createDocument(nullptr, cms::xerces::uStr(TPGTowerStatus_tag.c_str()).ptr(), doctype);
96 
97  DOMElement* root = doc->getDocumentElement();
98 
100  std::cout << "EcalTPGTowerStatusXMLTranslator::dumpXML" << std::endl;
101  const EcalTPGTowerStatusMap& towerMap = record.getMap();
102  std::cout << " tower map size " << towerMap.size() << std::endl;
104  for (it = towerMap.begin(); it != towerMap.end(); ++it) {
105  if ((*it).second > 0) {
106  EcalTrigTowerDetId ttId((*it).first);
107  std::cout << " TTDetId " << ttId << " eta " << ttId.ieta() << " phi " << ttId.iphi() << std::endl;
108  uint32_t rawid = ttId;
109  DOMElement* cellnode = writeCell(root, rawid);
111  }
112  }
113 
114  std::string dump = cms::xerces::toString(writer->writeToString(root));
115  doc->release();
116  doctype->release();
117  writer->release();
118 
119  return dump;
120 }

References gather_cfg::cout, boostedTaus_cff::doc, submitPVValidationJobs::dump, RecoTauValidation_cfi::header, AlCaHarvesting_cff::record, AlCaHLTBitMon_QueryRunRegistry::string, cms::xerces::toString(), xuti::TPGTowerStatus_tag(), ecaldqm::ttId(), cms::xerces::uStr(), xuti::writeCell(), xuti::writeHeader(), xuti::WriteNodeWithValue(), and cscNeutronWriter_cfi::writer.

◆ plot()

void EcalTPGTowerStatusXMLTranslator::plot ( std::string  fn,
const EcalTPGTowerStatus record 
)
staticprivate

Definition at line 122 of file EcalTPGTowerStatusXMLTranslator.cc.

122  {
123  std::ofstream fout(fn.c_str());
124  int valEB[34][72];
125  for (int line = 0; line < 34; line++)
126  for (int iphi = 0; iphi < 72; iphi++)
127  valEB[line][iphi] = 0;
128 
129  const EcalTPGTowerStatusMap& towerMap = record.getMap();
130  std::cout << " tower map size " << towerMap.size() << std::endl;
132  for (it = towerMap.begin(); it != towerMap.end(); ++it) {
133  if ((*it).second > 0) {
134  EcalTrigTowerDetId ttId((*it).first);
135  int ieta = ttId.ieta();
136  int line = 17 - ieta;
137  if (ieta < 0)
138  line--;
139  int iphi = ttId.iphi() - 1; // 0 to 71
140  valEB[line][iphi] = (*it).second;
141  }
142  }
143  for (int line = 0; line < 34; line++) {
144  for (int iphi = 0; iphi < 72; iphi++)
145  fout << valEB[line][iphi] << " ";
146  fout << std::endl;
147  if (line == 16)
148  fout << std::endl;
149  }
150  /*
151 
152  std::cout << " endcap size " << record.endcapItems().size() << std::endl;
153  if (!record.endcapItems().size()) return;
154  int valEE[2][20][20];
155  for(int k = 0 ; k < 2; k++ )
156  for(int ix = 0 ; ix < 20; ix++)
157  for(int iy = 0 ; iy < 20; iy++)
158  valEE[k][ix][iy] = -1;
159  for(uint cellid = 0;
160  cellid < EcalTrigTowerDetId::kEETotalTowers;
161  ++cellid) {
162  if(EcalScDetId::validHashIndex(cellid)) {
163  EcalScDetId rawid = EcalScDetId::unhashIndex(cellid);
164  int ix = rawid.ix() - 1; // 0 to 19
165  int iy = 20 - rawid.iy(); // 0 to 19
166  int side = rawid.zside();
167  int iz = side;
168  if(side == -1) iz = 0;
169  if(ix < 0 || ix > 19) std::cout << " Pb in ix " << ix << std::endl;
170  if(iy < 0 || iy > 19) std::cout << " Pb in iy " << iy << std::endl;
171  valEE[iz][ix][iy] = record[rawid].getStatusCode();
172  }
173  }
174  for(int k = 0 ; k < 2; k++ ) {
175  int iz = -1;
176  if(k == 1) iz = 1;
177  fout << " Side : " << iz << std::endl;
178  for(int line = 0; line < 20; line++) {
179  for(int ix = 0 ; ix < 20; ix++) {
180  if(valEE[k][ix][line] < 0) fout << ". ";
181  else fout << valEE[k][ix][line] << " ";
182  }
183  fout << std::endl;
184  }
185  fout << std::endl;
186  }
187  */
188  return;
189 }

References gather_cfg::cout, personalPlayback::fn, groupFilesInBlocks::fout, LEDCalibrationChannels::ieta, LEDCalibrationChannels::iphi, mps_splice::line, AlCaHarvesting_cff::record, and ecaldqm::ttId().

◆ readXML()

int EcalTPGTowerStatusXMLTranslator::readXML ( const std::string &  filename,
EcalCondHeader header,
EcalTPGTowerStatus record 
)
static

Definition at line 28 of file EcalTPGTowerStatusXMLTranslator.cc.

30  {
31  std::cout << " TPGTowerStatus should not be filled out from an xml file ..." << std::endl;
33 
34  XercesDOMParser* parser = new XercesDOMParser;
35  parser->setValidationScheme(XercesDOMParser::Val_Never);
36  parser->setDoNamespaces(false);
37  parser->setDoSchema(false);
38 
39  parser->parse(filename.c_str());
40 
41  DOMDocument* xmlDoc = parser->getDocument();
42  if (!xmlDoc) {
43  std::cout << "EcalTPGTowerStatusXMLTranslator::Error parsing document" << std::endl;
44  return -1;
45  }
46 
47  DOMElement* elementRoot = xmlDoc->getDocumentElement();
48 
49  xuti::readHeader(elementRoot, header);
50 
51  /*
52  int chan = 0;
53  while(cellnode) {
54  int status = -1;
55  DetId detid = readCellId(dynamic_cast<DOMElement*>(cellnode));
56 
57  DOMNode* my_node = getChildNode(cellnode,TPGTowerStatusCode_tag);
58  GetNodeData(my_node, status);
59 
60  record[detid] = status;
61 
62  cellnode = cellnode->getNextSibling();
63 
64  while(cellnode && cellnode->getNodeType() != DOMNode::ELEMENT_NODE)
65  cellnode = cellnode->getNextSibling();
66  chan++;
67  }
68  */
69  delete parser;
71  return 0;
72 }

References gather_cfg::cout, corrVsCorr::filename, RecoTauValidation_cfi::header, writedatasetfile::parser, xuti::readHeader(), cms::concurrency::xercesInitialize(), and cms::concurrency::xercesTerminate().

◆ writeXML()

int EcalTPGTowerStatusXMLTranslator::writeXML ( const std::string &  filename,
const EcalCondHeader header,
const EcalTPGTowerStatus record 
)
static
submitPVValidationJobs.dump
dump
Definition: submitPVValidationJobs.py:55
EcalTPGTowerStatusXMLTranslator::dumpXML
static std::string dumpXML(const EcalCondHeader &header, const EcalTPGTowerStatus &record)
Definition: EcalTPGTowerStatusXMLTranslator.cc:87
xuti::writeHeader
void writeHeader(xercesc::DOMNode *parentNode, const EcalCondHeader &header)
write
Definition: DOMHelperFunctions.cc:151
xuti::writeCell
xercesc::DOMElement * writeCell(xercesc::DOMNode *node, const DetId &detid)
Append a Cell node with attributes to.
Definition: DOMHelperFunctions.cc:71
boostedTaus_cff.doc
doc
Definition: boostedTaus_cff.py:20
ecaldqm::ttId
unsigned ttId(DetId const &, EcalElectronicsMapping const *)
Definition: EcalDQMCommonUtils.cc:99
EcalTPGTowerStatusMapIterator
std::map< uint32_t, uint16_t >::const_iterator EcalTPGTowerStatusMapIterator
Definition: EcalTPGTowerStatus.h:25
gather_cfg.cout
cout
Definition: gather_cfg.py:144
writedatasetfile.parser
parser
Definition: writedatasetfile.py:7
cscNeutronWriter_cfi.writer
writer
Definition: cscNeutronWriter_cfi.py:6
EcalTrigTowerDetId
Definition: EcalTrigTowerDetId.h:14
LEDCalibrationChannels.iphi
iphi
Definition: LEDCalibrationChannels.py:64
cms::xerces::toString
std::string toString(XMLCh const *toTranscode)
Definition: XercesStrUtils.h:35
EcalTPGTowerStatusMap
std::map< uint32_t, uint16_t > EcalTPGTowerStatusMap
Definition: EcalTPGTowerStatus.h:24
xuti::WriteNodeWithValue
void WriteNodeWithValue(xercesc::DOMNode *parentNode, const std::string &tag, const T &value)
write a node with
Definition: DOMHelperFunctions.h:46
corrVsCorr.filename
filename
Definition: corrVsCorr.py:123
LEDCalibrationChannels.ieta
ieta
Definition: LEDCalibrationChannels.py:63
groupFilesInBlocks.fout
fout
Definition: groupFilesInBlocks.py:162
cms::concurrency::xercesTerminate
void xercesTerminate()
Definition: Xerces.cc:23
root
Definition: RooFitFunction.h:10
cms::xerces::uStr
ZStr< XMLCh > uStr(char const *str)
Definition: XercesStrUtils.h:31
AlCaHarvesting_cff.record
record
Definition: AlCaHarvesting_cff.py:42
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
impl
Definition: trackAlgoPriorityOrder.h:18
personalPlayback.fn
fn
Definition: personalPlayback.py:515
RecoTauValidation_cfi.header
header
Definition: RecoTauValidation_cfi.py:291
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
xuti::TPGTowerStatus_tag
const std::string TPGTowerStatus_tag("EcalTPGTowerStatus")
mps_splice.line
line
Definition: mps_splice.py:76
cms::concurrency::xercesInitialize
void xercesInitialize()
Definition: Xerces.cc:18
xuti::readHeader
void readHeader(xercesc::DOMNode *parentNode, EcalCondHeader &header)
read header from
Definition: DOMHelperFunctions.cc:164