CMS 3D CMS Logo

Classes | Public Types | Public Member Functions | Private Member Functions

XMLHTRPatternLoader Class Reference

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

Inheritance diagram for XMLHTRPatternLoader:
XMLDOMBlock

List of all members.

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 (std::vector< int > crate_number, std::vector< std::string > file_name)
 XMLHTRPatternLoader (XMLProcessor::loaderBaseConfig *config, std::string templateBase="HCAL_HTR_DATA_PATTERNS.XMLloader.template")
 XMLHTRPatternLoader ()
virtual ~XMLHTRPatternLoader ()

Private Member Functions

const XMLHTRPatternLoaderoperator= (const XMLHTRPatternLoader &)
 XMLHTRPatternLoader (const XMLHTRPatternLoader &)

Detailed Description

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

Usage: <usage>

Definition at line 30 of file XMLHTRPatternLoader.h.


Member Typedef Documentation


Constructor & Destructor Documentation

XMLHTRPatternLoader::XMLHTRPatternLoader ( )

Definition at line 64 of file XMLHTRPatternLoader.cc.

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

Definition at line 68 of file XMLHTRPatternLoader.cc.

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

                                                                                                        : XMLDOMBlock( templateBase )
{
  setTagValue( "EXTENSION_TABLE_NAME", config -> extention_table_name );
  setTagValue( "NAME", config -> name );
  setTagAttribute( "RUN", "mode", config -> run_mode );
  setTagAttribute( "DATA_SET", "id", config -> data_set_id );
  setTagAttribute( "IOV", "id", config -> iov_id );
  setTagValue( "INTERVAL_OF_VALIDITY_BEGIN", config -> iov_begin );
  setTagValue( "INTERVAL_OF_VALIDITY_END", config -> iov_end );
  setTagAttribute( "TAG", "id", config -> tag_id );
  setTagAttribute( "TAG", "mode", config -> tag_mode );
  setTagValue( "TAG_NAME", config -> tag_name );
  setTagValue( "DETECTOR_NAME", config -> detector_name );
  setTagValue( "COMMENT_DESCRIPTION", config -> comment_description );

  setTagAttribute( "TAG", "idref", config -> tag_id, 1 );
  setTagAttribute( "IOV", "idref", config -> iov_id, 1 );
  setTagAttribute( "DATA_SET", "idref", config -> data_set_id, 1 );
}
XMLHTRPatternLoader::~XMLHTRPatternLoader ( ) [virtual]

Definition at line 93 of file XMLHTRPatternLoader.cc.

{
}
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 AlCaRecoCosmics_cfg::version.

{
  DOMElement * root = document -> getDocumentElement();

  XMLDOMBlock dataSetDoc( templateFileName );
  DOMDocument * dataSet = dataSetDoc . getDocument();

  // changes to the Checksums <data_set> node
  setTagValue( "VERSION", config -> version, 0, dataSet );
  setTagValue( "SUBVERSION", config -> subversion, 0, dataSet );
  char timebuf[50];
  //strftime( timebuf, 50, "%c", gmtime( &(config -> create_timestamp) ) );
  strftime( timebuf, 50, "%Y-%m-%d %H:%M:%S.0", gmtime( &(config -> create_timestamp) ) );
  setTagValue( "CREATE_TIMESTAMP", timebuf , 0, dataSet );
  setTagValue( "CREATED_BY_USER", config -> created_by_user, 0, dataSet );
  setTagValue( "COMMENT_DESCRIPTION", config -> comment_description, 0, dataSet );
  setTagValue( "NAME_LABEL", config -> name_label, 0, dataSet );
  setTagValue( "HTR_DATA_PATTERNS_DATA_FILE", config -> htr_data_patterns_data_file, 0, dataSet );
  setTagValue( "CRATE", config -> crate, 0, dataSet );

  // copy the <data_set> node into the final XML
  DOMNode * cloneDataSet = document -> importNode( dataSet -> getDocumentElement(), true );
  root -> appendChild( cloneDataSet );

  return 0;
}
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 AlCaRecoCosmics_cfg::version.

Referenced by createLoader().

{
  DOMElement * root = document -> getDocumentElement();

  XMLDOMBlock dataSetDoc( templateFileName );
  DOMDocument * dataSet = dataSetDoc . getDocument();

  // changes to the HTRPATTERN <data_set> node
  setTagValue( "VERSION", config -> version, 0, dataSet );
  setTagValue( "SUBVERSION", config -> subversion, 0, dataSet );
  char timebuf[50];
  //strftime( timebuf, 50, "%c", gmtime( &(config -> create_timestamp) ) );
  strftime( timebuf, 50, "%Y-%m-%d %H:%M:%S.0", gmtime( &(config -> create_timestamp) ) );
  setTagValue( "CREATE_TIMESTAMP", timebuf , 0, dataSet );
  setTagValue( "CREATED_BY_USER", config -> created_by_user, 0, dataSet );
  setTagValue( "KIND_OF_PART", config -> kind_of_part, 0, dataSet );
  setTagValue( "NAME_LABEL", config -> name_label, 0, dataSet );
  setTagValue( "HTR_DATA_PATTERNS_DATA_FILE", config -> htr_data_patterns_data_file, 0, dataSet );
  setTagValue( "CRATE", config -> crate, 0, dataSet );
  
  // copy the <data_set> node into the final XML
  DOMNode * cloneDataSet = document -> importNode( dataSet -> getDocumentElement(), true );
  root -> appendChild( cloneDataSet );

  return 0;
}
int XMLHTRPatternLoader::createLoader ( std::vector< int >  crate_number,
std::vector< std::string >  file_name 
)

Definition at line 166 of file XMLHTRPatternLoader.cc.

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

{
  XMLHTRPatternLoader::datasetDBConfig conf;

  for ( std::vector<std::string>::const_iterator _file = file_name . begin(); _file != file_name . end(); _file++ )
    {
      conf . htr_data_patterns_data_file = *_file;
      conf . htr_data_patterns_data_file += ".dat";
      conf . crate = crate_number[ _file - file_name . begin() ];

      char _buf[128];
      sprintf( _buf, "CRATE%.2d", conf . crate );
      std::string _namelabel;
      _namelabel . append( _buf );
      conf . name_label = _namelabel;
      addPattern( &conf );
    }
  
  write( "HTRPatternLoader.xml" );

  return 0;
}
const XMLHTRPatternLoader& XMLHTRPatternLoader::operator= ( const XMLHTRPatternLoader ) [private]