CMS 3D CMS Logo

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

#include <EcalTPGLinearizationConstXMLTranslator.h>

Static Public Member Functions

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

Static Private Member Functions

static std::string dumpXML (const EcalCondHeader &header, const EcalTPGLinearizationConst &record)
 

Detailed Description

Translates a EcalTPGLinearizationConst record to XML

Version
Id
EcalTPGLinearizationConstXMLTranslator.h,v 1.0 2012/05/01 13:48:05 Exp
Date
01 May 2012

Definition at line 14 of file EcalTPGLinearizationConstXMLTranslator.h.

Member Function Documentation

◆ dumpXML()

std::string EcalTPGLinearizationConstXMLTranslator::dumpXML ( const EcalCondHeader header,
const EcalTPGLinearizationConst record 
)
staticprivate

Definition at line 30 of file EcalTPGLinearizationConstXMLTranslator.cc.

31  {
32  unique_ptr<DOMImplementation> impl(DOMImplementationRegistry::getDOMImplementation(cms::xerces::uStr("LS").ptr()));
33 
34  DOMLSSerializer* writer = impl->createLSSerializer();
35  if (writer->getDomConfig()->canSetParameter(XMLUni::fgDOMWRTFormatPrettyPrint, true))
36  writer->getDomConfig()->setParameter(XMLUni::fgDOMWRTFormatPrettyPrint, true);
37 
38  DOMDocumentType* doctype = impl->createDocumentType(cms::xerces::uStr("XML").ptr(), nullptr, nullptr);
39  DOMDocument* doc = impl->createDocument(nullptr, cms::xerces::uStr(Linearization_tag.c_str()).ptr(), doctype);
40  DOMElement* root = doc->getDocumentElement();
41 
43 
44  // open also a flat text file
45  std::ofstream fout;
46  fout.open("Linearization.txt");
47 
48  for (int cellid = EBDetId::MIN_HASH; cellid < EBDetId::kSizeForDenseIndexing; ++cellid) {
49  uint32_t rawid = EBDetId::unhashIndex(cellid);
50 
51  DOMElement* cellnode = writeCell(root, rawid);
52 
53  float m12 = (record)[rawid].mult_x12;
54  float s12 = (record)[rawid].shift_x12;
55  float m6 = (record)[rawid].mult_x6;
56  float s6 = (record)[rawid].shift_x6;
57  float m1 = (record)[rawid].mult_x1;
58  float s1 = (record)[rawid].shift_x1;
59 
66  fout << rawid << " " << m12 << " " << m6 << " " << m1 << " " << s12 << " " << s6 << " " << s1 << "\n";
67  }
68 
69  for (int cellid = 0; cellid < EEDetId::kSizeForDenseIndexing; ++cellid) {
70  if (!EEDetId::validHashIndex(cellid))
71  continue;
72 
73  uint32_t rawid = EEDetId::unhashIndex(cellid);
74 
75  DOMElement* cellnode = writeCell(root, rawid);
76 
77  float m12 = (record)[rawid].mult_x12;
78  float s12 = (record)[rawid].shift_x12;
79  float m6 = (record)[rawid].mult_x6;
80  float s6 = (record)[rawid].shift_x6;
81  float m1 = (record)[rawid].mult_x1;
82  float s1 = (record)[rawid].shift_x1;
83 
90  fout << rawid << " " << m12 << " " << m6 << " " << m1 << " " << s12 << " " << s6 << " " << s1 << "\n";
91  }
92  fout.close();
94  doc->release();
95  doctype->release();
96  writer->release();
97 
98  return dump;
99 }

References common_cff::doc, FrontierConditions_GlobalTag_cff::dump, groupFilesInBlocks::fout, RecoTauValidation_cfi::header, EBDetId::kSizeForDenseIndexing, EEDetId::kSizeForDenseIndexing, xuti::Linearization_m12_tag(), xuti::Linearization_m1_tag(), xuti::Linearization_m6_tag(), xuti::Linearization_s12_tag(), xuti::Linearization_s1_tag(), xuti::Linearization_s6_tag(), xuti::Linearization_tag(), EBDetId::MIN_HASH, GlobalPosition_Frontier_DevDB_cff::record, AlCaHLTBitMon_QueryRunRegistry::string, cms::xerces::toString(), EBDetId::unhashIndex(), EEDetId::unhashIndex(), cms::xerces::uStr(), EEDetId::validHashIndex(), xuti::writeCell(), xuti::writeHeader(), xuti::WriteNodeWithValue(), and cscNeutronWriter_cfi::writer.

◆ writeXML()

int EcalTPGLinearizationConstXMLTranslator::writeXML ( const std::string &  filename,
const EcalCondHeader header,
const EcalTPGLinearizationConst record 
)
static
common_cff.doc
doc
Definition: common_cff.py:54
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
EEDetId::unhashIndex
static EEDetId unhashIndex(int hi)
Definition: EEDetId.cc:65
EBDetId::unhashIndex
static EBDetId unhashIndex(int hi)
get a DetId from a compact index for arrays
Definition: EBDetId.h:110
GlobalPosition_Frontier_DevDB_cff.record
record
Definition: GlobalPosition_Frontier_DevDB_cff.py:10
cscNeutronWriter_cfi.writer
writer
Definition: cscNeutronWriter_cfi.py:6
xuti::Linearization_s6_tag
const std::string Linearization_s6_tag("shift6")
EcalTPGLinearizationConstXMLTranslator::dumpXML
static std::string dumpXML(const EcalCondHeader &header, const EcalTPGLinearizationConst &record)
Definition: EcalTPGLinearizationConstXMLTranslator.cc:30
cms::xerces::toString
std::string toString(XMLCh const *toTranscode)
Definition: XercesStrUtils.h:34
xuti::Linearization_m12_tag
const std::string Linearization_m12_tag("mult12")
EEDetId::kSizeForDenseIndexing
Definition: EEDetId.h:329
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
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
groupFilesInBlocks.fout
fout
Definition: groupFilesInBlocks.py:162
FrontierConditions_GlobalTag_cff.dump
dump
Definition: FrontierConditions_GlobalTag_cff.py:12
cms::concurrency::xercesTerminate
void xercesTerminate()
Definition: Xerces.cc:23
root
Definition: RooFitFunction.h:10
EEDetId::validHashIndex
static bool validHashIndex(int i)
Definition: EEDetId.h:239
xuti::Linearization_m6_tag
const std::string Linearization_m6_tag("mult6")
cms::xerces::uStr
ZStr< XMLCh > uStr(char const *str)
Definition: XercesStrUtils.h:30
xuti::Linearization_tag
const std::string Linearization_tag("EcalTPGLinearizationConts")
xuti::Linearization_m1_tag
const std::string Linearization_m1_tag("mult1")
impl
Definition: trackAlgoPriorityOrder.h:18
EBDetId::kSizeForDenseIndexing
Definition: EBDetId.h:155
RecoTauValidation_cfi.header
header
Definition: RecoTauValidation_cfi.py:292
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
EBDetId::MIN_HASH
static const int MIN_HASH
Definition: EBDetId.h:149
xuti::Linearization_s1_tag
const std::string Linearization_s1_tag("shift1")
xuti::Linearization_s12_tag
const std::string Linearization_s12_tag("shift12")
cms::concurrency::xercesInitialize
void xercesInitialize()
Definition: Xerces.cc:18