#include <CaloOnlineTools/HcalOnlineDb/interface/HcalChannelDataXml.h>
Public Member Functions | |
DOMNode * | add_dataset (void) |
DOMNode * | add_hcal_channel (DOMNode *_dataset, int ieta, int iphi, int depth, std::string subdetector) |
DOMElement * | get_channel_element (DOMNode *_dataset) |
DOMElement * | get_data_element (DOMNode *_dataset) |
HcalChannelDataXml () | |
int | init_data (void) |
DOMNode * | set_elements_comment (std::string value) |
DOMNode * | set_elements_dataset_id (int id) |
DOMNode * | set_elements_detector_name (std::string value) |
DOMNode * | set_elements_iov_begin (int value) |
DOMNode * | set_elements_iov_end (int value) |
DOMNode * | set_elements_iov_id (int id) |
DOMNode * | set_elements_tag_id (int value) |
DOMNode * | set_elements_tag_mode (std::string value) |
DOMNode * | set_elements_tag_name (std::string value) |
DOMNode * | set_header_channel_map (std::string name) |
DOMNode * | set_header_run_number (int run) |
DOMNode * | set_header_table_name (std::string name) |
DOMNode * | set_header_type (std::string type) |
DOMNode * | set_maps_dataset_idref (int value) |
DOMNode * | set_maps_iov_idref (int value) |
DOMNode * | set_maps_tag_idref (int value) |
virtual | ~HcalChannelDataXml () |
Protected Attributes | |
MemBufInputSource * | _dataset |
MemBufInputSource * | _root |
std::string | channel_map |
std::string | comment |
int | data_set_id |
int | data_set_idref |
std::string | dataset_comment |
int | dataset_count |
std::string | detector_name |
std::string | extension_table_name |
time_t | global_timestamp |
HcalAssistant | hcal_ass |
int | iov_begin |
int | iov_end |
int | iov_id |
int | iov_idref |
int | run_number |
int | tag_id |
int | tag_idref |
std::string | tag_mode |
std::string | tag_name |
std::string | type_name |
std::string | username |
Description: <one line="" class="" summary>="">
Usage: <usage>
Definition at line 26 of file HcalChannelDataXml.h.
HcalChannelDataXml::HcalChannelDataXml | ( | ) |
Definition at line 27 of file HcalChannelDataXml.cc.
References comment, NULL, and cond::rpcobgas::time.
{ comment = hcal_ass.getRandomQuote(); //init_data(); dataset_count = 0; global_timestamp = time(NULL); }
HcalChannelDataXml::~HcalChannelDataXml | ( | ) | [virtual] |
Definition at line 35 of file HcalChannelDataXml.cc.
DOMNode * HcalChannelDataXml::add_dataset | ( | void | ) |
Definition at line 139 of file HcalChannelDataXml.cc.
References XMLProcessor::_toXMLCh(), AlCaHLTBitMon_QueryRunRegistry::string, cond::rpcobgas::time, and indexGenCompare::username.
{ XMLDOMBlock dataset_block( *_dataset ); DOMDocument * dataset_doc = dataset_block . getDocument(); DOMElement * root_elem = (DOMElement *)(document -> getElementsByTagName( XMLProcessor::_toXMLCh( "ROOT" ) ) -> item(0)); DOMNode * dataset_node = document -> importNode( dataset_doc -> getDocumentElement(), true ); root_elem -> appendChild( dataset_node ); // //_____ set defaults // // //_____ fix due to the new convention: version/subversion combo must be unique for every payload // char _buf[128]; //time_t _offset = time(NULL); time_t _offset = global_timestamp; sprintf( _buf, "%d", (uint32_t)_offset ); std::string _version; _version.clear(); _version.append(tag_name); _version.append("."); _version.append(_buf); // DOMElement * dataset_elem = (DOMElement *)dataset_node; setTagValue(dataset_elem, "COMMENT_DESCRIPTION", dataset_comment); setTagValue(dataset_elem, "CREATE_TIMESTAMP", getTimestamp(time(0))); setTagValue(dataset_elem, "CREATED_BY_USER", username); setTagValue(dataset_elem, "VERSION", _version); setTagValue(dataset_elem, "SUBVERSION", dataset_count); // //_____ set the chanel table name consistent with the header HINT // setTagValue(dataset_elem, "EXTENSION_TABLE_NAME", channel_map); // if (dataset_node) ++dataset_count; return dataset_node; }
DOMNode * HcalChannelDataXml::add_hcal_channel | ( | DOMNode * | _dataset, |
int | ieta, | ||
int | iphi, | ||
int | depth, | ||
std::string | subdetector | ||
) |
Definition at line 126 of file HcalChannelDataXml.cc.
References XMLProcessor::_toXMLCh().
{ DOMElement * _channel = get_channel_element(_dataset); if (_channel){ add_element(_channel, XMLProcessor::_toXMLCh("IETA"), XMLProcessor::_toXMLCh(ieta)); add_element(_channel, XMLProcessor::_toXMLCh("IPHI"), XMLProcessor::_toXMLCh(iphi)); add_element(_channel, XMLProcessor::_toXMLCh("DEPTH"), XMLProcessor::_toXMLCh(depth)); add_element(_channel, XMLProcessor::_toXMLCh("SUBDET"), XMLProcessor::_toXMLCh(subdetector)); } return (DOMNode *)_channel; }
DOMElement * HcalChannelDataXml::get_channel_element | ( | DOMNode * | _dataset | ) |
Definition at line 186 of file HcalChannelDataXml.cc.
References XMLProcessor::_toXMLCh().
{ DOMElement * _element = 0; if (_dataset){ _element = (DOMElement *)(((DOMElement *)_dataset) -> getElementsByTagName(XMLProcessor::_toXMLCh("CHANNEL"))->item( 0 )); } return _element; }
DOMElement * HcalChannelDataXml::get_data_element | ( | DOMNode * | _dataset | ) |
Definition at line 177 of file HcalChannelDataXml.cc.
References XMLProcessor::_toXMLCh().
{ DOMElement * _element = 0; if (_dataset){ _element = (DOMElement *)(((DOMElement *)_dataset) -> getElementsByTagName(XMLProcessor::_toXMLCh("DATA"))->item( 0 )); } return _element; }
int HcalChannelDataXml::init_data | ( | void | ) |
Definition at line 42 of file HcalChannelDataXml.cc.
References comment, triggerExpression::parse(), and indexGenCompare::username.
{ static const char * _str = "\ <ROOT>\n\ <HEADER>\n\ <TYPE>\n\ <EXTENSION_TABLE_NAME>HCAL_CHANNEL_QUALITY_V1</EXTENSION_TABLE_NAME>\n\ <NAME>HCAL Channel Quality [V1]</NAME>\n\ </TYPE>\n\ <RUN>\n\ <RUN_NUMBER>1</RUN_NUMBER>\n\ </RUN>\n\ <HINTS channelmap='HCAL_CHANNELS'/>\n\ </HEADER>\n\ <ELEMENTS>\n\ <DATA_SET id='-1'/>\n\ <IOV id='1'>\n\ <INTERVAL_OF_VALIDITY_BEGIN>1</INTERVAL_OF_VALIDITY_BEGIN>\n\ <INTERVAL_OF_VALIDITY_END>-1</INTERVAL_OF_VALIDITY_END>\n\ </IOV>\n\ <TAG id='2' mode='auto'>\n\ <TAG_NAME>test-channel-status-01jul2009-v4</TAG_NAME>\n\ <DETECTOR_NAME>HCAL</DETECTOR_NAME>\n\ <COMMENT_DESCRIPTION>testing channel status recording</COMMENT_DESCRIPTION>\n\ </TAG>\n\ </ELEMENTS>\n\ <MAPS>\n\ <TAG idref='2'>\n\ <IOV idref='1'>\n\ <DATA_SET idref='-1'/>\n\ </IOV>\n\ </TAG>\n\ </MAPS>\n\ </ROOT>\n\ "; const XMLByte * _template = (const XMLByte *)_str; _root = new MemBufInputSource( _template, strlen( (const char *)_template ), "_root", false ); parse(*_root); // //_____ fill header tags that will be redefined in the derived classes // set_header_table_name(extension_table_name); set_header_type(type_name); set_header_run_number(run_number); set_header_channel_map(channel_map); set_elements_dataset_id(data_set_id); set_elements_iov_id(iov_id); set_elements_iov_begin(iov_begin); set_elements_iov_end(iov_end); set_elements_tag_id(tag_id); set_elements_tag_mode(tag_mode); set_elements_tag_name(tag_name); set_elements_detector_name(detector_name); set_elements_comment(comment); set_maps_tag_idref(tag_idref); set_maps_iov_idref(iov_idref); set_maps_dataset_idref(data_set_idref); // static const char * _str2 = "\ <DATA_SET>\n\ <COMMENT_DESCRIPTION>test-channel-status-26jun2009-v1</COMMENT_DESCRIPTION>\n\ <CREATE_TIMESTAMP>2009-04-06 17:36:40.0</CREATE_TIMESTAMP>\n\ <CREATED_BY_USER>user</CREATED_BY_USER>\n\ <VERSION>test-channel-status-26jun2009-v1</VERSION>\n\ <SUBVERSION>1</SUBVERSION>\n\ <CHANNEL>\n\ <EXTENSION_TABLE_NAME>HCAL_CHANNELS</EXTENSION_TABLE_NAME>\n\ </CHANNEL>\n\ <DATA>\n\ </DATA>\n\ </DATA_SET>\n\ "; const XMLByte * _template2 = (const XMLByte *)_str2; _dataset = new MemBufInputSource( _template2, strlen( (const char *)_template2 ), "_dataset", false ); // //_____ some more default initialization username = hcal_ass.getUserName(); dataset_comment = hcal_ass.getRandomQuote(); // return 0; }
DOMNode * HcalChannelDataXml::set_elements_comment | ( | std::string | value | ) |
Definition at line 279 of file HcalChannelDataXml.cc.
References comment, and relativeConstraints::value.
{ comment = value; DOMElement * _elements = (DOMElement *)(document -> getElementsByTagName( XMLString::transcode("ELEMENTS") ) -> item(0)); return setTagValue(_elements, "COMMENT_DESCRIPTION", comment); }
DOMNode * HcalChannelDataXml::set_elements_dataset_id | ( | int | id | ) |
Definition at line 223 of file HcalChannelDataXml.cc.
{ data_set_id = id; DOMElement * _elements = (DOMElement *)(document -> getElementsByTagName( XMLString::transcode("ELEMENTS") ) -> item(0)); return setTagAttribute(_elements, "DATA_SET", "id", data_set_id); }
DOMNode * HcalChannelDataXml::set_elements_detector_name | ( | std::string | value | ) |
Definition at line 272 of file HcalChannelDataXml.cc.
References relativeConstraints::value.
{ detector_name = value; DOMElement * _elements = (DOMElement *)(document -> getElementsByTagName( XMLString::transcode("ELEMENTS") ) -> item(0)); return setTagValue(_elements, "DETECTOR_NAME", detector_name); }
DOMNode * HcalChannelDataXml::set_elements_iov_begin | ( | int | value | ) |
Definition at line 237 of file HcalChannelDataXml.cc.
References relativeConstraints::value.
{ iov_begin = value; DOMElement * _elements = (DOMElement *)(document -> getElementsByTagName( XMLString::transcode("ELEMENTS") ) -> item(0)); return setTagValue(_elements, "INTERVAL_OF_VALIDITY_BEGIN", iov_begin); }
DOMNode * HcalChannelDataXml::set_elements_iov_end | ( | int | value | ) |
Definition at line 244 of file HcalChannelDataXml.cc.
References relativeConstraints::value.
{ iov_end = value; DOMElement * _elements = (DOMElement *)(document -> getElementsByTagName( XMLString::transcode("ELEMENTS") ) -> item(0)); return setTagValue(_elements, "INTERVAL_OF_VALIDITY_END", iov_end); }
DOMNode * HcalChannelDataXml::set_elements_iov_id | ( | int | id | ) |
Definition at line 230 of file HcalChannelDataXml.cc.
{ iov_id = id; DOMElement * _elements = (DOMElement *)(document -> getElementsByTagName( XMLString::transcode("ELEMENTS") ) -> item(0)); return setTagAttribute(_elements, "IOV", "id", iov_id); }
DOMNode * HcalChannelDataXml::set_elements_tag_id | ( | int | value | ) |
Definition at line 251 of file HcalChannelDataXml.cc.
References relativeConstraints::value.
{ tag_id = value; DOMElement * _elements = (DOMElement *)(document -> getElementsByTagName( XMLString::transcode("ELEMENTS") ) -> item(0)); return setTagAttribute(_elements, "TAG", "id", tag_id); }
DOMNode * HcalChannelDataXml::set_elements_tag_mode | ( | std::string | value | ) |
Definition at line 258 of file HcalChannelDataXml.cc.
References relativeConstraints::value.
{ tag_mode = value; DOMElement * _elements = (DOMElement *)(document -> getElementsByTagName( XMLString::transcode("ELEMENTS") ) -> item(0)); return setTagAttribute(_elements, "TAG", "mode", tag_mode); }
DOMNode * HcalChannelDataXml::set_elements_tag_name | ( | std::string | value | ) |
Definition at line 265 of file HcalChannelDataXml.cc.
References relativeConstraints::value.
{ tag_name = value; DOMElement * _elements = (DOMElement *)(document -> getElementsByTagName( XMLString::transcode("ELEMENTS") ) -> item(0)); return setTagValue(_elements, "TAG_NAME", tag_name); }
DOMNode * HcalChannelDataXml::set_header_channel_map | ( | std::string | name | ) |
Definition at line 216 of file HcalChannelDataXml.cc.
References mergeVDriftHistosByStation::name.
{ channel_map = name; DOMElement * _header = (DOMElement *)(document -> getElementsByTagName( XMLString::transcode("HEADER") ) -> item(0)); return setTagAttribute(_header, "HINTS", "channelmap", channel_map); }
DOMNode * HcalChannelDataXml::set_header_run_number | ( | int | run | ) |
Definition at line 209 of file HcalChannelDataXml.cc.
References DTTTrigCorrFirst::run.
{ run_number = run; DOMElement * _header = (DOMElement *)(document -> getElementsByTagName( XMLString::transcode("HEADER") ) -> item(0)); return setTagValue(_header, "RUN_NUMBER", run_number); }
DOMNode * HcalChannelDataXml::set_header_table_name | ( | std::string | name | ) |
Definition at line 195 of file HcalChannelDataXml.cc.
References mergeVDriftHistosByStation::name.
{ extension_table_name = name; DOMElement * _header = (DOMElement *)(document -> getElementsByTagName( XMLString::transcode("HEADER") ) -> item(0)); return setTagValue(_header, "EXTENSION_TABLE_NAME", extension_table_name); }
DOMNode * HcalChannelDataXml::set_header_type | ( | std::string | type | ) |
Definition at line 202 of file HcalChannelDataXml.cc.
{ type_name = type; DOMElement * _header = (DOMElement *)(document -> getElementsByTagName( XMLString::transcode("HEADER") ) -> item(0)); return setTagValue(_header, "NAME", type_name); }
DOMNode * HcalChannelDataXml::set_maps_dataset_idref | ( | int | value | ) |
Definition at line 300 of file HcalChannelDataXml.cc.
References relativeConstraints::value.
{ data_set_idref = value; DOMElement * _maps = (DOMElement *)(document -> getElementsByTagName( XMLString::transcode("MAPS") ) -> item(0)); return setTagAttribute(_maps, "DATA_SET", "idref", data_set_idref); }
DOMNode * HcalChannelDataXml::set_maps_iov_idref | ( | int | value | ) |
Definition at line 293 of file HcalChannelDataXml.cc.
References relativeConstraints::value.
{ iov_idref = value; DOMElement * _maps = (DOMElement *)(document -> getElementsByTagName( XMLString::transcode("MAPS") ) -> item(0)); return setTagAttribute(_maps, "IOV", "idref", iov_idref); }
DOMNode * HcalChannelDataXml::set_maps_tag_idref | ( | int | value | ) |
Definition at line 286 of file HcalChannelDataXml.cc.
References relativeConstraints::value.
{ tag_idref = value; DOMElement * _maps = (DOMElement *)(document -> getElementsByTagName( XMLString::transcode("MAPS") ) -> item(0)); return setTagAttribute(_maps, "TAG", "idref", tag_idref); }
MemBufInputSource* HcalChannelDataXml::_dataset [protected] |
Definition at line 75 of file HcalChannelDataXml.h.
MemBufInputSource* HcalChannelDataXml::_root [protected] |
Definition at line 74 of file HcalChannelDataXml.h.
std::string HcalChannelDataXml::channel_map [protected] |
Definition at line 82 of file HcalChannelDataXml.h.
std::string HcalChannelDataXml::comment [protected] |
Definition at line 93 of file HcalChannelDataXml.h.
int HcalChannelDataXml::data_set_id [protected] |
Definition at line 85 of file HcalChannelDataXml.h.
int HcalChannelDataXml::data_set_idref [protected] |
Definition at line 98 of file HcalChannelDataXml.h.
std::string HcalChannelDataXml::dataset_comment [protected] |
Definition at line 102 of file HcalChannelDataXml.h.
int HcalChannelDataXml::dataset_count [protected] |
Definition at line 105 of file HcalChannelDataXml.h.
std::string HcalChannelDataXml::detector_name [protected] |
Definition at line 92 of file HcalChannelDataXml.h.
std::string HcalChannelDataXml::extension_table_name [protected] |
Definition at line 79 of file HcalChannelDataXml.h.
time_t HcalChannelDataXml::global_timestamp [protected] |
Definition at line 106 of file HcalChannelDataXml.h.
HcalAssistant HcalChannelDataXml::hcal_ass [protected] |
Definition at line 104 of file HcalChannelDataXml.h.
int HcalChannelDataXml::iov_begin [protected] |
Definition at line 87 of file HcalChannelDataXml.h.
int HcalChannelDataXml::iov_end [protected] |
Definition at line 88 of file HcalChannelDataXml.h.
int HcalChannelDataXml::iov_id [protected] |
Definition at line 86 of file HcalChannelDataXml.h.
int HcalChannelDataXml::iov_idref [protected] |
Definition at line 97 of file HcalChannelDataXml.h.
int HcalChannelDataXml::run_number [protected] |
Definition at line 81 of file HcalChannelDataXml.h.
int HcalChannelDataXml::tag_id [protected] |
Definition at line 89 of file HcalChannelDataXml.h.
int HcalChannelDataXml::tag_idref [protected] |
Definition at line 96 of file HcalChannelDataXml.h.
std::string HcalChannelDataXml::tag_mode [protected] |
Definition at line 90 of file HcalChannelDataXml.h.
std::string HcalChannelDataXml::tag_name [protected] |
Definition at line 91 of file HcalChannelDataXml.h.
std::string HcalChannelDataXml::type_name [protected] |
Definition at line 80 of file HcalChannelDataXml.h.
std::string HcalChannelDataXml::username [protected] |
Definition at line 101 of file HcalChannelDataXml.h.