CMS 3D CMS Logo

List of all members | Classes | Public Types | Public Member Functions
XMLLUTLoader Class Reference

#include <CaloOnlineTools/HcalOnlineDb/interface/XMLLUTLoader.h>

Inheritance diagram for XMLLUTLoader:
XMLDOMBlock

Classes

struct  _checksumsDBConfig
 
struct  _loaderBaseConfig
 
struct  _lutDBConfig
 

Public Types

typedef XMLLUTLoader::_checksumsDBConfig checksumsDBConfig
 
typedef XMLLUTLoader::_loaderBaseConfig loaderBaseConfig
 
typedef XMLLUTLoader::_lutDBConfig lutDBConfig
 

Public Member Functions

int addChecksums (checksumsDBConfig *config, std::string templateFileName="HCAL_TRIG_PRIM_LOOKUP_TABLE.checksums.template")
 
int addLUT (lutDBConfig *config, std::string templateFileName="HCAL_TRIG_PRIM_LOOKUP_TABLE.dataset.template")
 
int createLoader (const std::vector< int > &crate_number, const std::vector< std::string > &file_name)
 
const XMLLUTLoaderoperator= (const XMLLUTLoader &)=delete
 
 XMLLUTLoader ()
 
 XMLLUTLoader (XMLProcessor::loaderBaseConfig *config, std::string templateBase="HCAL_TRIG_PRIM_LOOKUP_TABLE.XMLloader.template")
 
 XMLLUTLoader (const XMLLUTLoader &)=delete
 
 ~XMLLUTLoader () override
 
- Public Member Functions inherited from XMLDOMBlock
XERCES_CPP_NAMESPACE::DOMElement * add_element (XERCES_CPP_NAMESPACE::DOMElement *parent, XMLCh *tagname, XMLCh *value)
 
XERCES_CPP_NAMESPACE::DOMDocument * getDocument (void)
 
XERCES_CPP_NAMESPACE::DOMDocument * getDocumentConst (void) const
 
XERCES_CPP_NAMESPACE::DOMDocument * getNewDocument (std::string xmlFileName)
 
std::string & getString (void)
 
std::string & getString (XERCES_CPP_NAMESPACE::DOMNode *_node)
 
const char * getTagAttribute (const std::string &tagName, const std::string &attrName, int _item=0)
 
const char * getTagValue (const std::string &tagName, int _item=0, XERCES_CPP_NAMESPACE::DOMDocument *_document=nullptr)
 
const char * getTagValue (const std::string &tagName, int _item, XERCES_CPP_NAMESPACE::DOMElement *_document)
 
std::string getTimestamp (time_t _time)
 
XMLDOMBlockoperator+= (const XMLDOMBlock &other)
 
void parse (XERCES_CPP_NAMESPACE::InputSource &_source)
 
XERCES_CPP_NAMESPACE::DOMNode * setTagAttribute (const std::string &tagName, const std::string &attrName, const std::string &attrValue, int _item=0)
 
XERCES_CPP_NAMESPACE::DOMNode * setTagAttribute (XERCES_CPP_NAMESPACE::DOMElement *_elem, const std::string &tagName, const std::string &attrName, const std::string &attrValue, int _item=0)
 
XERCES_CPP_NAMESPACE::DOMNode * setTagAttribute (const std::string &tagName, const std::string &attrName, const int &attrValue, int _item=0)
 
XERCES_CPP_NAMESPACE::DOMNode * setTagAttribute (XERCES_CPP_NAMESPACE::DOMElement *_elem, const std::string &tagName, const std::string &attrName, const int &attrValue, int _item=0)
 
XERCES_CPP_NAMESPACE::DOMNode * setTagValue (const std::string &tagName, const std::string &tagValue, int _item=0, XERCES_CPP_NAMESPACE::DOMDocument *_document=nullptr)
 
XERCES_CPP_NAMESPACE::DOMNode * setTagValue (XERCES_CPP_NAMESPACE::DOMElement *_elem, const std::string &tagName, const std::string &tagValue, int _item=0)
 
XERCES_CPP_NAMESPACE::DOMNode * setTagValue (const std::string &tagName, const int &tagValue, int _item=0, XERCES_CPP_NAMESPACE::DOMDocument *_document=nullptr)
 
XERCES_CPP_NAMESPACE::DOMNode * setTagValue (XERCES_CPP_NAMESPACE::DOMElement *_elem, const std::string &tagName, const int &tagValue, int _item=0)
 
int write (std::string target="stdout")
 
 XMLDOMBlock ()
 
 XMLDOMBlock (std::string xmlFileName)
 
 XMLDOMBlock (XERCES_CPP_NAMESPACE::InputSource &_source)
 
 XMLDOMBlock (std::string _root, int rootElementName)
 
virtual ~XMLDOMBlock ()
 

Additional Inherited Members

- Protected Member Functions inherited from XMLDOMBlock
int init (std::string _root)
 
- Protected Attributes inherited from XMLDOMBlock
XERCES_CPP_NAMESPACE::DOMDocument * document
 
XERCES_CPP_NAMESPACE::ErrorHandler * errHandler
 
XERCES_CPP_NAMESPACE::XercesDOMParser * parser
 
std::string * the_string
 
std::string theFileName
 
XMLProcessortheProcessor
 

Detailed Description

Description: <one line="" class="" summary>="">

Usage: <usage>

Definition at line 29 of file XMLLUTLoader.h.

Member Typedef Documentation

◆ checksumsDBConfig

◆ loaderBaseConfig

◆ lutDBConfig

Constructor & Destructor Documentation

◆ XMLLUTLoader() [1/3]

XMLLUTLoader::XMLLUTLoader ( )

Definition at line 46 of file XMLLUTLoader.cc.

46 {}

◆ XMLLUTLoader() [2/3]

XMLLUTLoader::XMLLUTLoader ( XMLProcessor::loaderBaseConfig config,
std::string  templateBase = "HCAL_TRIG_PRIM_LOOKUP_TABLE.XMLloader.template" 
)

Definition at line 48 of file XMLLUTLoader.cc.

References XMLDOMBlock::setTagAttribute(), and XMLDOMBlock::setTagValue().

49  : XMLDOMBlock(templateBase) {
50  setTagValue("EXTENSION_TABLE_NAME", config->extention_table_name);
51  setTagValue("NAME", config->name);
52  setTagAttribute("RUN", "mode", config->run_mode);
53  setTagAttribute("DATA_SET", "id", config->data_set_id);
54  setTagAttribute("IOV", "id", config->iov_id);
55  setTagValue("INTERVAL_OF_VALIDITY_BEGIN", config->iov_begin);
56  setTagValue("INTERVAL_OF_VALIDITY_END", config->iov_end);
57  setTagAttribute("TAG", "id", config->tag_id);
58  setTagAttribute("TAG", "mode", config->tag_mode);
59  setTagValue("TAG_NAME", config->tag_name);
60  setTagValue("DETECTOR_NAME", config->detector_name);
61  setTagValue("COMMENT_DESCRIPTION", config->comment_description);
62 
63  setTagAttribute("TAG", "idref", config->tag_id, 1);
64  setTagAttribute("IOV", "idref", config->iov_id, 1);
65  setTagAttribute("DATA_SET", "idref", config->data_set_id, 1);
66 }
XERCES_CPP_NAMESPACE::DOMNode * setTagValue(const std::string &tagName, const std::string &tagValue, int _item=0, XERCES_CPP_NAMESPACE::DOMDocument *_document=nullptr)
Definition: config.py:1
XERCES_CPP_NAMESPACE::DOMNode * setTagAttribute(const std::string &tagName, const std::string &attrName, const std::string &attrValue, int _item=0)
Definition: XMLDOMBlock.cc:363

◆ XMLLUTLoader() [3/3]

XMLLUTLoader::XMLLUTLoader ( const XMLLUTLoader )
delete

◆ ~XMLLUTLoader()

XMLLUTLoader::~XMLLUTLoader ( )
override

Definition at line 73 of file XMLLUTLoader.cc.

73 {}

Member Function Documentation

◆ addChecksums()

int XMLLUTLoader::addChecksums ( checksumsDBConfig config,
std::string  templateFileName = "HCAL_TRIG_PRIM_LOOKUP_TABLE.checksums.template" 
)

Definition at line 116 of file XMLLUTLoader.cc.

References EgammaPostProcessor_cfi::dataSet, XMLDOMBlock::document, XMLDOMBlock::getDocument(), and XMLDOMBlock::setTagValue().

Referenced by createLoader().

116  {
117  DOMElement* root = document->getDocumentElement();
118 
119  XMLDOMBlock dataSetDoc(templateFileName);
120  DOMDocument* dataSet = dataSetDoc.getDocument();
121 
122  // changes to the Checksums <data_set> node
123  setTagValue("VERSION", config->version, 0, dataSet);
124  setTagValue("SUBVERSION", config->subversion, 0, dataSet);
125  char timebuf[50];
126  //strftime( timebuf, 50, "%c", gmtime( &(config -> create_timestamp) ) );
127  strftime(timebuf, 50, "%Y-%m-%d %H:%M:%S.0", gmtime(&(config->create_timestamp)));
128  setTagValue("CREATE_TIMESTAMP", timebuf, 0, dataSet);
129  setTagValue("CREATED_BY_USER", config->created_by_user, 0, dataSet);
130  setTagValue("COMMENT_DESCRIPTION", config->comment_description, 0, dataSet);
131  setTagValue("NAME_LABEL", config->name_label, 0, dataSet);
132  setTagValue("TRIG_PRIM_LOOKUPTBL_DATA_FILE", config->trig_prim_lookuptbl_data_file, 0, dataSet);
133  setTagValue("CRATE", config->crate, 0, dataSet);
134 
135  // copy the <data_set> node into the final XML
136  DOMNode* cloneDataSet = document->importNode(dataSet->getDocumentElement(), true);
137  root->appendChild(cloneDataSet);
138 
139  return 0;
140 }
XERCES_CPP_NAMESPACE::DOMDocument * document
Definition: XMLDOMBlock.h:117
XERCES_CPP_NAMESPACE::DOMNode * setTagValue(const std::string &tagName, const std::string &tagValue, int _item=0, XERCES_CPP_NAMESPACE::DOMDocument *_document=nullptr)
Definition: config.py:1

◆ addLUT()

int XMLLUTLoader::addLUT ( lutDBConfig config,
std::string  templateFileName = "HCAL_TRIG_PRIM_LOOKUP_TABLE.dataset.template" 
)

Definition at line 90 of file XMLLUTLoader.cc.

References EgammaPostProcessor_cfi::dataSet, XMLDOMBlock::document, XMLDOMBlock::getDocument(), and XMLDOMBlock::setTagValue().

Referenced by createLoader().

90  {
91  DOMElement* root = document->getDocumentElement();
92 
93  XMLDOMBlock dataSetDoc(templateFileName);
94  DOMDocument* dataSet = dataSetDoc.getDocument();
95 
96  // changes to the LUT <data_set> node
97  setTagValue("VERSION", config->version, 0, dataSet);
98  setTagValue("SUBVERSION", config->subversion, 0, dataSet);
99  char timebuf[50];
100  //strftime( timebuf, 50, "%c", gmtime( &(config -> create_timestamp) ) );
101  strftime(timebuf, 50, "%Y-%m-%d %H:%M:%S.0", gmtime(&(config->create_timestamp)));
102  setTagValue("CREATE_TIMESTAMP", timebuf, 0, dataSet);
103  setTagValue("CREATED_BY_USER", config->created_by_user, 0, dataSet);
104  setTagValue("KIND_OF_PART", config->kind_of_part, 0, dataSet);
105  setTagValue("NAME_LABEL", config->name_label, 0, dataSet);
106  setTagValue("TRIG_PRIM_LOOKUPTBL_DATA_FILE", config->trig_prim_lookuptbl_data_file, 0, dataSet);
107  setTagValue("CRATE", config->crate, 0, dataSet);
108 
109  // copy the <data_set> node into the final XML
110  DOMNode* cloneDataSet = document->importNode(dataSet->getDocumentElement(), true);
111  root->appendChild(cloneDataSet);
112 
113  return 0;
114 }
XERCES_CPP_NAMESPACE::DOMDocument * document
Definition: XMLDOMBlock.h:117
XERCES_CPP_NAMESPACE::DOMNode * setTagValue(const std::string &tagName, const std::string &tagValue, int _item=0, XERCES_CPP_NAMESPACE::DOMDocument *_document=nullptr)
Definition: config.py:1

◆ createLoader()

int XMLLUTLoader::createLoader ( const std::vector< int > &  crate_number,
const std::vector< std::string > &  file_name 
)

Definition at line 142 of file XMLLUTLoader.cc.

References findAndChange::_file, addChecksums(), addLUT(), XMLLUTLoader::_lutDBConfig::crate, contentValuesCheck::file_name, XMLLUTLoader::_lutDBConfig::name_label, AlCaHLTBitMon_QueryRunRegistry::string, XMLLUTLoader::_lutDBConfig::trig_prim_lookuptbl_data_file, XMLLUTLoader::_checksumsDBConfig::trig_prim_lookuptbl_data_file, and XMLDOMBlock::write().

142  {
145 
146  for (std::vector<std::string>::const_iterator _file = file_name.begin(); _file != file_name.end(); _file++) {
148  conf.trig_prim_lookuptbl_data_file += ".dat";
149  conf.crate = crate_number[_file - file_name.begin()];
150 
151  char _buf[128];
152  sprintf(_buf, "CRATE%.2d", conf.crate);
153  std::string _namelabel;
154  _namelabel.append(_buf);
155  conf.name_label = _namelabel;
156  addLUT(&conf);
157  }
158 
159  CSconf.trig_prim_lookuptbl_data_file += ".dat";
160  addChecksums(&CSconf);
161  write("LUTLoader.xml");
162 
163  return 0;
164 }
int addLUT(lutDBConfig *config, std::string templateFileName="HCAL_TRIG_PRIM_LOOKUP_TABLE.dataset.template")
Definition: XMLLUTLoader.cc:90
int write(std::string target="stdout")
Definition: XMLDOMBlock.cc:272
int addChecksums(checksumsDBConfig *config, std::string templateFileName="HCAL_TRIG_PRIM_LOOKUP_TABLE.checksums.template")
std::string trig_prim_lookuptbl_data_file
Definition: XMLLUTLoader.h:38

◆ operator=()

const XMLLUTLoader& XMLLUTLoader::operator= ( const XMLLUTLoader )
delete