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
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=NULL)
 
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=NULL)
 
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=NULL)
 
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 ()
 

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
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

Constructor & Destructor Documentation

XMLLUTLoader::XMLLUTLoader ( )

Definition at line 48 of file XMLLUTLoader.cc.

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

Definition at line 52 of file XMLLUTLoader.cc.

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

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

78 {
79 }
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 123 of file XMLLUTLoader.cc.

References XMLDOMBlock::document, XMLDOMBlock::getDocument(), pyrootRender::root, XMLDOMBlock::setTagValue(), and relval_steps::version.

Referenced by createLoader().

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

Definition at line 96 of file XMLLUTLoader.cc.

References XMLDOMBlock::document, XMLDOMBlock::getDocument(), pyrootRender::root, XMLDOMBlock::setTagValue(), and relval_steps::version.

Referenced by createLoader().

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

Definition at line 150 of file XMLLUTLoader.cc.

References addChecksums(), addLUT(), bitset_utilities::append(), begin, end, AlCaHLTBitMon_QueryRunRegistry::string, and XMLDOMBlock::write().

151 {
154 
155  for ( std::vector<std::string>::const_iterator _file = file_name . begin(); _file != file_name . end(); _file++ )
156  {
157  conf . trig_prim_lookuptbl_data_file = *_file;
158  conf . trig_prim_lookuptbl_data_file += ".dat";
159  conf . crate = crate_number[ _file - file_name . begin() ];
160 
161  char _buf[128];
162  sprintf( _buf, "CRATE%.2d", conf . crate );
163  std::string _namelabel;
164  _namelabel . append( _buf );
165  conf . name_label = _namelabel;
166  addLUT( &conf );
167  }
168 
169  CSconf . trig_prim_lookuptbl_data_file += ".dat";
170  addChecksums( &CSconf );
171  write( "LUTLoader.xml" );
172 
173  return 0;
174 }
int addLUT(lutDBConfig *config, std::string templateFileName="HCAL_TRIG_PRIM_LOOKUP_TABLE.dataset.template")
Definition: XMLLUTLoader.cc:96
int write(std::string target="stdout")
Definition: XMLDOMBlock.cc:322
boost::dynamic_bitset append(const boost::dynamic_bitset<> &bs1, const boost::dynamic_bitset<> &bs2)
this method takes two bitsets bs1 and bs2 and returns result of bs2 appended to the end of bs1 ...
#define end
Definition: vmac.h:37
#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