#include <EcalFloatCondObjectContainerXMLTranslator.h>
Static Public Member Functions | |
static std::vector< float > | barrelfromXML (const std::string &filename) |
static std::string | dumpXML (const EcalCondHeader &header, const EcalFloatCondObjectContainer &record) |
static std::string | dumpXML (const EcalCondHeader &header, const std::vector< float > &eb, const std::vector< float > &ee) |
static std::vector< float > | endcapfromXML (const std::string &filename) |
static int | readXML (const std::string &filename, EcalCondHeader &header, EcalFloatCondObjectContainer &record) |
static int | writeXML (const std::string &filename, const EcalCondHeader &header, const EcalFloatCondObjectContainer &record) |
Translates a EcalFloatCondObjectContainer record to XML and vice versa
Definition at line 21 of file EcalFloatCondObjectContainerXMLTranslator.h.
std::vector< float > EcalFloatCondObjectContainerXMLTranslator::barrelfromXML | ( | const std::string & | filename | ) | [static] |
Definition at line 86 of file EcalFloatCondObjectContainerXMLTranslator.cc.
References EcalCondObjectContainer< T >::barrelItems(), insertMaterial::readXML(), and record.
Referenced by BOOST_PYTHON_MODULE().
{ EcalCondHeader header; EcalFloatCondObjectContainer record; readXML(filename,header,record); return record.barrelItems(); }
std::string EcalFloatCondObjectContainerXMLTranslator::dumpXML | ( | const EcalCondHeader & | header, |
const EcalFloatCondObjectContainer & | record | ||
) | [static] |
Definition at line 156 of file EcalFloatCondObjectContainerXMLTranslator.cc.
References asciidump::doc, hcal_timing_source_file_cfg::dump, xuti::EcalFloatCondObjectContainer_tag(), EcalCondObjectContainer< T >::end(), EcalCondObjectContainer< T >::find(), xuti::fromNative(), EBDetId::kSizeForDenseIndexing, EEDetId::kSizeForDenseIndexing, EBDetId::MIN_HASH, dbtoconf::root, AlCaHLTBitMon_QueryRunRegistry::string, xuti::toNative(), EBDetId::unhashIndex(), EEDetId::unhashIndex(), EEDetId::validHashIndex(), xuti::Value_tag(), xuti::writeCell(), xuti::writeHeader(), and xuti::WriteNodeWithValue().
{ XMLPlatformUtils::Initialize(); DOMImplementation* impl = DOMImplementationRegistry::getDOMImplementation(fromNative("LS").c_str()); DOMWriter* writer = static_cast<DOMImplementationLS*>(impl)->createDOMWriter( ); writer->setFeature(XMLUni::fgDOMWRTFormatPrettyPrint, true); DOMDocumentType* doctype = impl->createDocumentType( fromNative("XML").c_str(), 0, 0 ); DOMDocument * doc = impl->createDocument( 0, fromNative(EcalFloatCondObjectContainer_tag).c_str(), doctype ); doc->setEncoding(fromNative("UTF-8").c_str() ); doc->setStandalone(true); doc->setVersion(fromNative("1.0").c_str() ); DOMElement* root = doc->getDocumentElement(); xuti::writeHeader(root, header); for (int cellid = EBDetId::MIN_HASH; cellid < EBDetId::kSizeForDenseIndexing; ++cellid){// loop on EB cells uint32_t rawid= EBDetId::unhashIndex(cellid); EcalFloatCondObjectContainer::const_iterator value_ptr= record.find(rawid); if (value_ptr==record.end()) continue; // cell absent from original record DOMElement* cellnode=writeCell(root,rawid); WriteNodeWithValue(cellnode,Value_tag,*value_ptr); } // loop on EB cells for (int cellid = 0; cellid < EEDetId::kSizeForDenseIndexing; ++cellid){// loop on EE cells if (!EEDetId::validHashIndex(cellid)) continue; uint32_t rawid= EEDetId::unhashIndex(cellid); EcalFloatCondObjectContainer::const_iterator value_ptr= record.find(rawid); if (value_ptr==record.end()) continue; // cell absent from original record DOMElement* cellnode= writeCell(root,rawid); WriteNodeWithValue(cellnode,Value_tag,*value_ptr); } // loop on EE cells std::string dump= toNative(writer->writeToString(*root)); doc->release(); return dump; }
std::string EcalFloatCondObjectContainerXMLTranslator::dumpXML | ( | const EcalCondHeader & | header, |
const std::vector< float > & | eb, | ||
const std::vector< float > & | ee | ||
) | [static] |
Definition at line 109 of file EcalFloatCondObjectContainerXMLTranslator.cc.
References dtNoiseDBValidation_cfg::cerr, EcalCondTools::dumpXML(), EBDetId::kSizeForDenseIndexing, EEDetId::kSizeForDenseIndexing, record, AlCaHLTBitMon_QueryRunRegistry::string, EBDetId::unhashIndex(), EEDetId::unhashIndex(), and EEDetId::validHashIndex().
{ if (eb.size() != EBDetId::kSizeForDenseIndexing){ std::cerr<<"Error in EcalFloatCondObjectContainerXMLTranslator::dumpXML, invalid Barrel array size: " <<eb.size() << " should be "<< EBDetId::kSizeForDenseIndexing<< std::endl; return std::string(""); } if (ee.size() != EEDetId::kSizeForDenseIndexing){ std::cerr<<"Error in EcalFloatCondObjectContainerXMLTranslator::dumpXML, invalid Endcap array size: " <<ee.size() << " should be "<< EEDetId::kSizeForDenseIndexing<< std::endl; return std::string(""); } EcalFloatCondObjectContainer record; for (int cellid = 0; cellid < EBDetId::kSizeForDenseIndexing; ++cellid){// loop on EB cells uint32_t rawid = EBDetId::unhashIndex(cellid); record[rawid] = eb[cellid]; } for (int cellid = 0; cellid < EEDetId::kSizeForDenseIndexing; ++cellid){// loop on EE cells if (EEDetId::validHashIndex(cellid)){ uint32_t rawid = EEDetId::unhashIndex(cellid); record[rawid]=ee[cellid]; } // if } return dumpXML(header,record); }
std::vector< float > EcalFloatCondObjectContainerXMLTranslator::endcapfromXML | ( | const std::string & | filename | ) | [static] |
Definition at line 97 of file EcalFloatCondObjectContainerXMLTranslator.cc.
References EcalCondObjectContainer< T >::endcapItems(), insertMaterial::readXML(), and record.
Referenced by BOOST_PYTHON_MODULE().
{ EcalCondHeader header; EcalFloatCondObjectContainer record; readXML(filename,header,record); return record.endcapItems(); }
static int EcalFloatCondObjectContainerXMLTranslator::readXML | ( | const std::string & | filename, |
EcalCondHeader & | header, | ||
EcalFloatCondObjectContainer & | record | ||
) | [static] |
int EcalFloatCondObjectContainerXMLTranslator::writeXML | ( | const std::string & | filename, |
const EcalCondHeader & | header, | ||
const EcalFloatCondObjectContainer & | record | ||
) | [static] |
Definition at line 231 of file EcalFloatCondObjectContainerXMLTranslator.cc.
References EcalCondTools::dumpXML(), and dbtoconf::out.
Referenced by PhiSymmetryCalibration_step2_SM::endJob(), PhiSymmetryCalibration_step2::endJob(), and main().