test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Types | Public Member Functions | Private 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)
 
 XMLLUTLoader ()
 
 XMLLUTLoader (XMLProcessor::loaderBaseConfig *config, std::string templateBase="HCAL_TRIG_PRIM_LOOKUP_TABLE.XMLloader.template")
 
virtual ~XMLLUTLoader ()
 
- Public Member Functions inherited from XMLDOMBlock
DOMElement * add_element (DOMElement *parent, XMLCh *tagname, XMLCh *value)
 
DOMDocument * getDocument (void)
 
DOMDocument * getDocumentConst (void) const
 
DOMDocument * getNewDocument (std::string xmlFileName)
 
std::string & getString (void)
 
std::string & getString (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, DOMDocument *_document=NULL)
 
const char * getTagValue (const std::string &tagName, int _item, DOMElement *_document)
 
std::string getTimestamp (time_t _time)
 
XMLDOMBlockoperator+= (const XMLDOMBlock &other)
 
void parse (InputSource &_source)
 
DOMNode * setTagAttribute (const std::string &tagName, const std::string &attrName, const std::string &attrValue, int _item=0)
 
DOMNode * setTagAttribute (DOMElement *_elem, const std::string &tagName, const std::string &attrName, const std::string &attrValue, int _item=0)
 
DOMNode * setTagAttribute (const std::string &tagName, const std::string &attrName, const int &attrValue, int _item=0)
 
DOMNode * setTagAttribute (DOMElement *_elem, const std::string &tagName, const std::string &attrName, const int &attrValue, int _item=0)
 
DOMNode * setTagValue (const std::string &tagName, const std::string &tagValue, int _item=0, DOMDocument *_document=NULL)
 
DOMNode * setTagValue (DOMElement *_elem, const std::string &tagName, const std::string &tagValue, int _item=0)
 
DOMNode * setTagValue (const std::string &tagName, const int &tagValue, int _item=0, DOMDocument *_document=NULL)
 
DOMNode * setTagValue (DOMElement *_elem, const std::string &tagName, const int &tagValue, int _item=0)
 
int write (std::string target="stdout")
 
 XMLDOMBlock ()
 
 XMLDOMBlock (std::string xmlFileName)
 
 XMLDOMBlock (InputSource &_source)
 
 XMLDOMBlock (std::string _root, int rootElementName)
 
virtual ~XMLDOMBlock ()
 

Private Member Functions

const XMLLUTLoaderoperator= (const XMLLUTLoader &)
 
 XMLLUTLoader (const XMLLUTLoader &)
 

Additional Inherited Members

- Protected Member Functions inherited from XMLDOMBlock
int init (std::string _root)
 
- Protected Attributes inherited from XMLDOMBlock
DOMDocument * document
 
ErrorHandler * errHandler
 
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

Constructor & Destructor Documentation

XMLLUTLoader::XMLLUTLoader ( )

Definition at line 47 of file XMLLUTLoader.cc.

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

Definition at line 51 of file XMLLUTLoader.cc.

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

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

Definition at line 76 of file XMLLUTLoader.cc.

77 {
78 }
XMLLUTLoader::XMLLUTLoader ( const XMLLUTLoader )
private

Member Function Documentation

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

Definition at line 122 of file XMLLUTLoader.cc.

References XMLDOMBlock::document, XMLDOMBlock::getDocument(), dbtoconf::root, XMLDOMBlock::setTagValue(), and BeamSplash_cfg::version.

Referenced by createLoader().

123 {
124  DOMElement * root = document -> getDocumentElement();
125 
126  XMLDOMBlock dataSetDoc( templateFileName );
127  DOMDocument * dataSet = dataSetDoc . getDocument();
128 
129  // changes to the Checksums <data_set> node
130  setTagValue( "VERSION", config -> version, 0, dataSet );
131  setTagValue( "SUBVERSION", config -> subversion, 0, dataSet );
132  char timebuf[50];
133  //strftime( timebuf, 50, "%c", gmtime( &(config -> create_timestamp) ) );
134  strftime( timebuf, 50, "%Y-%m-%d %H:%M:%S.0", gmtime( &(config -> create_timestamp) ) );
135  setTagValue( "CREATE_TIMESTAMP", timebuf , 0, dataSet );
136  setTagValue( "CREATED_BY_USER", config -> created_by_user, 0, dataSet );
137  setTagValue( "COMMENT_DESCRIPTION", config -> comment_description, 0, dataSet );
138  setTagValue( "NAME_LABEL", config -> name_label, 0, dataSet );
139  setTagValue( "TRIG_PRIM_LOOKUPTBL_DATA_FILE", config -> trig_prim_lookuptbl_data_file, 0, dataSet );
140  setTagValue( "CRATE", config -> crate, 0, dataSet );
141 
142  // copy the <data_set> node into the final XML
143  DOMNode * cloneDataSet = document -> importNode( dataSet -> getDocumentElement(), true );
144  root -> appendChild( cloneDataSet );
145 
146  return 0;
147 }
DOMDocument * document
Definition: XMLDOMBlock.h:97
DOMDocument * getDocument(void)
Definition: XMLDOMBlock.cc:312
DOMNode * setTagValue(const std::string &tagName, const std::string &tagValue, int _item=0, DOMDocument *_document=NULL)
Definition: XMLDOMBlock.cc:364
string root
initialization
Definition: dbtoconf.py:70
int XMLLUTLoader::addLUT ( lutDBConfig config,
std::string  templateFileName = "HCAL_TRIG_PRIM_LOOKUP_TABLE.dataset.template" 
)

Definition at line 95 of file XMLLUTLoader.cc.

References XMLDOMBlock::document, XMLDOMBlock::getDocument(), dbtoconf::root, XMLDOMBlock::setTagValue(), and BeamSplash_cfg::version.

Referenced by createLoader().

96 {
97  DOMElement * root = document -> getDocumentElement();
98 
99  XMLDOMBlock dataSetDoc( templateFileName );
100  DOMDocument * dataSet = dataSetDoc . getDocument();
101 
102  // changes to the LUT <data_set> node
103  setTagValue( "VERSION", config -> version, 0, dataSet );
104  setTagValue( "SUBVERSION", config -> subversion, 0, dataSet );
105  char timebuf[50];
106  //strftime( timebuf, 50, "%c", gmtime( &(config -> create_timestamp) ) );
107  strftime( timebuf, 50, "%Y-%m-%d %H:%M:%S.0", gmtime( &(config -> create_timestamp) ) );
108  setTagValue( "CREATE_TIMESTAMP", timebuf , 0, dataSet );
109  setTagValue( "CREATED_BY_USER", config -> created_by_user, 0, dataSet );
110  setTagValue( "KIND_OF_PART", config -> kind_of_part, 0, dataSet );
111  setTagValue( "NAME_LABEL", config -> name_label, 0, dataSet );
112  setTagValue( "TRIG_PRIM_LOOKUPTBL_DATA_FILE", config -> trig_prim_lookuptbl_data_file, 0, dataSet );
113  setTagValue( "CRATE", config -> crate, 0, dataSet );
114 
115  // copy the <data_set> node into the final XML
116  DOMNode * cloneDataSet = document -> importNode( dataSet -> getDocumentElement(), true );
117  root -> appendChild( cloneDataSet );
118 
119  return 0;
120 }
DOMDocument * document
Definition: XMLDOMBlock.h:97
DOMDocument * getDocument(void)
Definition: XMLDOMBlock.cc:312
DOMNode * setTagValue(const std::string &tagName, const std::string &tagValue, int _item=0, DOMDocument *_document=NULL)
Definition: XMLDOMBlock.cc:364
string root
initialization
Definition: dbtoconf.py:70
int XMLLUTLoader::createLoader ( const std::vector< int > &  crate_number,
const std::vector< std::string > &  file_name 
)

Definition at line 149 of file XMLLUTLoader.cc.

References addChecksums(), addLUT(), python.multivaluedict::append(), begin, dbtoconf::conf, end, AlCaHLTBitMon_QueryRunRegistry::string, and XMLDOMBlock::write().

150 {
153 
154  for ( std::vector<std::string>::const_iterator _file = file_name . begin(); _file != file_name . end(); _file++ )
155  {
156  conf . trig_prim_lookuptbl_data_file = *_file;
157  conf . trig_prim_lookuptbl_data_file += ".dat";
158  conf . crate = crate_number[ _file - file_name . begin() ];
159 
160  char _buf[128];
161  sprintf( _buf, "CRATE%.2d", conf . crate );
162  std::string _namelabel;
163  _namelabel . append( _buf );
164  conf . name_label = _namelabel;
165  addLUT( &conf );
166  }
167 
168  CSconf . trig_prim_lookuptbl_data_file += ".dat";
169  addChecksums( &CSconf );
170  write( "LUTLoader.xml" );
171 
172  return 0;
173 }
int addLUT(lutDBConfig *config, std::string templateFileName="HCAL_TRIG_PRIM_LOOKUP_TABLE.dataset.template")
Definition: XMLLUTLoader.cc:95
int write(std::string target="stdout")
Definition: XMLDOMBlock.cc:322
#define end
Definition: vmac.h:37
tuple conf
Definition: dbtoconf.py:185
#define begin
Definition: vmac.h:30
int addChecksums(checksumsDBConfig *config, std::string templateFileName="HCAL_TRIG_PRIM_LOOKUP_TABLE.checksums.template")
const XMLLUTLoader& XMLLUTLoader::operator= ( const XMLLUTLoader )
private