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

Member Typedef Documentation

Constructor & Destructor Documentation

XMLHTRPatternLoader::XMLHTRPatternLoader ( )

Definition at line 64 of file XMLHTRPatternLoader.cc.

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

Definition at line 68 of file XMLHTRPatternLoader.cc.

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

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

Definition at line 93 of file XMLHTRPatternLoader.cc.

94 {
95 }
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 139 of file XMLHTRPatternLoader.cc.

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

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

Definition at line 112 of file XMLHTRPatternLoader.cc.

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

Referenced by createLoader().

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

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

167 {
169 
170  for ( std::vector<std::string>::const_iterator _file = file_name . begin(); _file != file_name . end(); _file++ )
171  {
172  conf . htr_data_patterns_data_file = *_file;
173  conf . htr_data_patterns_data_file += ".dat";
174  conf . crate = crate_number[ _file - file_name . begin() ];
175 
176  char _buf[128];
177  sprintf( _buf, "CRATE%.2d", conf . crate );
178  std::string _namelabel;
179  _namelabel . append( _buf );
180  conf . name_label = _namelabel;
181  addPattern( &conf );
182  }
183 
184  write( "HTRPatternLoader.xml" );
185 
186  return 0;
187 }
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