Translates a EcalGainRatio record to XML and vice versa
- Author
- Francesco RUBBO
- Version
- Id
- EcalPulseSymmCovariancesXMLTranslator.h,v 0 2010/04/26 fay Exp
- Date
- 26 Apr 2010
Definition at line 15 of file EcalPulseSymmCovariancesXMLTranslator.h.
Definition at line 103 of file EcalPulseSymmCovariancesXMLTranslator.cc.
References EcalCondObjectContainer< T >::barrelItems(), common_cff::doc, FrontierConditions_GlobalTag_cff::dump, EcalCondObjectContainer< T >::end(), EcalCondObjectContainer< T >::endcapItems(), EcalCondObjectContainer< T >::find(), mps_fire::i, gen::k, EBDetId::kSizeForDenseIndexing, EEDetId::kSizeForDenseIndexing, EBDetId::MIN_HASH, funct::pow(), xuti::PulseSymmCovariances_tag(), AlCaHLTBitMon_QueryRunRegistry::string, EcalPulseShape::TEMPLATESAMPLES, cms::xerces::toString(), EBDetId::unhashIndex(), EEDetId::unhashIndex(), cms::xerces::uStr(), EEDetId::validHashIndex(), xuti::writeCell(), xuti::writeHeader(), xuti::WriteNodeWithValue(), and cscNeutronWriter_cfi::writer.
105 unique_ptr<DOMImplementation>
impl( DOMImplementationRegistry::getDOMImplementation(
cms::xerces::uStr(
"LS").ptr()));
107 DOMLSSerializer*
writer =
impl->createLSSerializer();
108 if( writer->getDomConfig()->canSetParameter( XMLUni::fgDOMWRTFormatPrettyPrint,
true ))
109 writer->getDomConfig()->setParameter( XMLUni::fgDOMWRTFormatPrettyPrint,
true );
111 DOMDocumentType* doctype =
impl->createDocumentType(
cms::xerces::uStr(
"XML").ptr(),
nullptr,
nullptr );
115 DOMElement*
root = doc->getDocumentElement();
124 pulsecov_tag[linK] = Form(
"samplecov_%d_%d",i,j);
134 if (record.
find(rawid) == record.
end())
continue;
136 DOMElement* cellnode=
writeCell(root,rawid);
151 if (record.
find(rawid) == record.
end())
continue;
153 DOMElement* cellnode=
writeCell(root,rawid);
const Items & barrelItems() const
static const int TEMPLATESAMPLES
static EEDetId unhashIndex(int hi)
void WriteNodeWithValue(xercesc::DOMNode *parentNode, const std::string &tag, const T &value)
write a node with
static bool validHashIndex(int i)
std::string toString(XMLCh const *toTranscode)
static const int MIN_HASH
void writeHeader(xercesc::DOMNode *parentNode, const EcalCondHeader &header)
write
ZStr< XMLCh > uStr(char const *str)
const std::string PulseSymmCovariances_tag("EcalPulseSymmCovariances")
static EBDetId unhashIndex(int hi)
get a DetId from a compact index for arrays
const_iterator find(uint32_t rawId) const
const_iterator end() const
xercesc::DOMElement * writeCell(xercesc::DOMNode *node, const DetId &detid)
Append a Cell node with attributes to.
const Items & endcapItems() const
Power< A, B >::type pow(const A &a, const B &b)
Definition at line 25 of file EcalPulseSymmCovariancesXMLTranslator.cc.
References xuti::Cell_tag(), officialStyle::chan, gather_cfg::cout, xuti::getChildNode(), xuti::GetNodeData(), mps_fire::i, createfilelist::int, gen::k, writedatasetfile::parser, xuti::readCellId(), xuti::readHeader(), EcalPulseShape::TEMPLATESAMPLES, cms::concurrency::xercesInitialize(), and cms::concurrency::xercesTerminate().
31 XercesDOMParser*
parser =
new XercesDOMParser;
32 parser->setValidationScheme( XercesDOMParser::Val_Never );
33 parser->setDoNamespaces(
false );
34 parser->setDoSchema(
false );
38 DOMDocument* xmlDoc = parser->getDocument();
40 std::cout <<
"EcalPulseSymmCovariancesXMLTranslator::Error parsing document" << std::endl;
44 DOMElement* elementRoot = xmlDoc->getDocumentElement();
62 if(j >=
i) k = j + (EcalPulseShape::TEMPLATESAMPLES-1)*
i;
63 else k =
i + (EcalPulseShape::TEMPLATESAMPLES-1)*j;
64 pulsecov_tag[
k] = Form(
"samplecov_%d_%d",
i,j);
68 DOMNode** covs_node =
new DOMNode*[
int(EcalPulseShape::TEMPLATESAMPLES*(EcalPulseShape::TEMPLATESAMPLES+1)/2)];
69 for(
int k=0;
k<EcalPulseShape::TEMPLATESAMPLES*(EcalPulseShape::TEMPLATESAMPLES+1)/2; ++
k) {
74 for(
int k=0;
k<EcalPulseShape::TEMPLATESAMPLES*(EcalPulseShape::TEMPLATESAMPLES+1)/2; ++
k) record[detid].covval[
k] = covs[
k];
76 cellnode = cellnode->getNextSibling();
78 while(cellnode && cellnode->getNodeType() != DOMNode::ELEMENT_NODE)
79 cellnode = cellnode->getNextSibling();
85 std::cout <<
" nb of channels found in xml file " << chan << std::endl;
static const int TEMPLATESAMPLES
void readHeader(xercesc::DOMNode *parentNode, EcalCondHeader &header)
read header from
const std::string Cell_tag("cell")
void GetNodeData(xercesc::DOMNode *node, T &value)
get the node data
xercesc::DOMNode * getChildNode(xercesc::DOMNode *node, const std::string &nodename)
get the child of
chan
lumi = TPaveText(lowX+0.38, lowY+0.061, lowX+0.45, lowY+0.161, "NDC") lumi.SetBorderSize( 0 ) lumi...
const DetId readCellId(xercesc::DOMElement *node)
Assuming.