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
XMLHTRPatternLoader Class Reference

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

Inheritance diagram for XMLHTRPatternLoader:
XMLDOMBlock

Classes

struct  _checksumsDBConfig
 
struct  _datasetDBConfig
 
struct  _loaderBaseConfig
 

Public Types

typedef
XMLHTRPatternLoader::_checksumsDBConfig 
checksumsDBConfig
 
typedef
XMLHTRPatternLoader::_datasetDBConfig 
datasetDBConfig
 
typedef
XMLHTRPatternLoader::_loaderBaseConfig 
loaderBaseConfig
 

Public Member Functions

int addChecksums (checksumsDBConfig *config, std::string templateFileName="HCAL_HTR_DATA_PATTERNS.checksums.template")
 
int addPattern (datasetDBConfig *config, std::string templateFileName="HCAL_HTR_DATA_PATTERNS.dataset.template")
 
int createLoader (const std::vector< int > &crate_number, const std::vector< std::string > &file_name)
 
 XMLHTRPatternLoader ()
 
 XMLHTRPatternLoader (XMLProcessor::loaderBaseConfig *config, std::string templateBase="HCAL_HTR_DATA_PATTERNS.XMLloader.template")
 
virtual ~XMLHTRPatternLoader ()
 
- 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 XMLHTRPatternLoaderoperator= (const XMLHTRPatternLoader &)
 
 XMLHTRPatternLoader (const XMLHTRPatternLoader &)
 

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 XMLHTRPatternLoader.h.

Member Typedef Documentation

Constructor & Destructor Documentation

XMLHTRPatternLoader::XMLHTRPatternLoader ( )

Definition at line 63 of file XMLHTRPatternLoader.cc.

64 {
65 }
XMLHTRPatternLoader::XMLHTRPatternLoader ( XMLProcessor::loaderBaseConfig config,
std::string  templateBase = "HCAL_HTR_DATA_PATTERNS.XMLloader.template" 
)

Definition at line 67 of file XMLHTRPatternLoader.cc.

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

67  : XMLDOMBlock( templateBase )
68 {
69  setTagValue( "EXTENSION_TABLE_NAME", config -> extention_table_name );
70  setTagValue( "NAME", config -> name );
71  setTagAttribute( "RUN", "mode", config -> run_mode );
72  setTagAttribute( "DATA_SET", "id", config -> data_set_id );
73  setTagAttribute( "IOV", "id", config -> iov_id );
74  setTagValue( "INTERVAL_OF_VALIDITY_BEGIN", config -> iov_begin );
75  setTagValue( "INTERVAL_OF_VALIDITY_END", config -> iov_end );
76  setTagAttribute( "TAG", "id", config -> tag_id );
77  setTagAttribute( "TAG", "mode", config -> tag_mode );
78  setTagValue( "TAG_NAME", config -> tag_name );
79  setTagValue( "DETECTOR_NAME", config -> detector_name );
80  setTagValue( "COMMENT_DESCRIPTION", config -> comment_description );
81 
82  setTagAttribute( "TAG", "idref", config -> tag_id, 1 );
83  setTagAttribute( "IOV", "idref", config -> iov_id, 1 );
84  setTagAttribute( "DATA_SET", "idref", config -> data_set_id, 1 );
85 }
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
XMLHTRPatternLoader::~XMLHTRPatternLoader ( )
virtual

Definition at line 92 of file XMLHTRPatternLoader.cc.

93 {
94 }
XMLHTRPatternLoader::XMLHTRPatternLoader ( const XMLHTRPatternLoader )
private

Member Function Documentation

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

Definition at line 138 of file XMLHTRPatternLoader.cc.

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

139 {
140  DOMElement * root = document -> getDocumentElement();
141 
142  XMLDOMBlock dataSetDoc( templateFileName );
143  DOMDocument * dataSet = dataSetDoc . getDocument();
144 
145  // changes to the Checksums <data_set> node
146  setTagValue( "VERSION", config -> version, 0, dataSet );
147  setTagValue( "SUBVERSION", config -> subversion, 0, dataSet );
148  char timebuf[50];
149  //strftime( timebuf, 50, "%c", gmtime( &(config -> create_timestamp) ) );
150  strftime( timebuf, 50, "%Y-%m-%d %H:%M:%S.0", gmtime( &(config -> create_timestamp) ) );
151  setTagValue( "CREATE_TIMESTAMP", timebuf , 0, dataSet );
152  setTagValue( "CREATED_BY_USER", config -> created_by_user, 0, dataSet );
153  setTagValue( "COMMENT_DESCRIPTION", config -> comment_description, 0, dataSet );
154  setTagValue( "NAME_LABEL", config -> name_label, 0, dataSet );
155  setTagValue( "HTR_DATA_PATTERNS_DATA_FILE", config -> htr_data_patterns_data_file, 0, dataSet );
156  setTagValue( "CRATE", config -> crate, 0, dataSet );
157 
158  // copy the <data_set> node into the final XML
159  DOMNode * cloneDataSet = document -> importNode( dataSet -> getDocumentElement(), true );
160  root -> appendChild( cloneDataSet );
161 
162  return 0;
163 }
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 XMLHTRPatternLoader::addPattern ( datasetDBConfig config,
std::string  templateFileName = "HCAL_HTR_DATA_PATTERNS.dataset.template" 
)

Definition at line 111 of file XMLHTRPatternLoader.cc.

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

Referenced by createLoader().

112 {
113  DOMElement * root = document -> getDocumentElement();
114 
115  XMLDOMBlock dataSetDoc( templateFileName );
116  DOMDocument * dataSet = dataSetDoc . getDocument();
117 
118  // changes to the HTRPATTERN <data_set> node
119  setTagValue( "VERSION", config -> version, 0, dataSet );
120  setTagValue( "SUBVERSION", config -> subversion, 0, dataSet );
121  char timebuf[50];
122  //strftime( timebuf, 50, "%c", gmtime( &(config -> create_timestamp) ) );
123  strftime( timebuf, 50, "%Y-%m-%d %H:%M:%S.0", gmtime( &(config -> create_timestamp) ) );
124  setTagValue( "CREATE_TIMESTAMP", timebuf , 0, dataSet );
125  setTagValue( "CREATED_BY_USER", config -> created_by_user, 0, dataSet );
126  setTagValue( "KIND_OF_PART", config -> kind_of_part, 0, dataSet );
127  setTagValue( "NAME_LABEL", config -> name_label, 0, dataSet );
128  setTagValue( "HTR_DATA_PATTERNS_DATA_FILE", config -> htr_data_patterns_data_file, 0, dataSet );
129  setTagValue( "CRATE", config -> crate, 0, dataSet );
130 
131  // copy the <data_set> node into the final XML
132  DOMNode * cloneDataSet = document -> importNode( dataSet -> getDocumentElement(), true );
133  root -> appendChild( cloneDataSet );
134 
135  return 0;
136 }
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 XMLHTRPatternLoader::createLoader ( const std::vector< int > &  crate_number,
const std::vector< std::string > &  file_name 
)

Definition at line 165 of file XMLHTRPatternLoader.cc.

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

166 {
168 
169  for ( std::vector<std::string>::const_iterator _file = file_name . begin(); _file != file_name . end(); _file++ )
170  {
171  conf . htr_data_patterns_data_file = *_file;
172  conf . htr_data_patterns_data_file += ".dat";
173  conf . crate = crate_number[ _file - file_name . begin() ];
174 
175  char _buf[128];
176  sprintf( _buf, "CRATE%.2d", conf . crate );
177  std::string _namelabel;
178  _namelabel . append( _buf );
179  conf . name_label = _namelabel;
180  addPattern( &conf );
181  }
182 
183  write( "HTRPatternLoader.xml" );
184 
185  return 0;
186 }
int write(std::string target="stdout")
Definition: XMLDOMBlock.cc:322
int addPattern(datasetDBConfig *config, std::string templateFileName="HCAL_HTR_DATA_PATTERNS.dataset.template")
#define end
Definition: vmac.h:37
tuple conf
Definition: dbtoconf.py:185
#define begin
Definition: vmac.h:30
const XMLHTRPatternLoader& XMLHTRPatternLoader::operator= ( const XMLHTRPatternLoader )
private